Skip to content

Commit

Permalink
Merge pull request #622 from evershopcommerce/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
treoden authored Sep 8, 2024
2 parents 0a0a1a5 + 47d8b4b commit 6e14d3e
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 35 deletions.
2 changes: 1 addition & 1 deletion packages/azure_file_storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@evershop/azure_file_storage",
"version": "1.1.0",
"version": "1.2.0",
"description": "An extension for EverShop to use Azure File Storage",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ body .codex-editor {
#rows .draggable-source--is-dragging>* {
visibility: hidden;
}

.ce-rawtool__textarea {
z-index: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ module.exports = async (request, response, delegate, next) => {
isApi: route.isApi,
isAdmin: route.isAdmin
};
let widgetInstances;
// Check if we are in the test mode
if (process.env.NODE_ENV === 'test') {
widgetInstances = [];
} else {
widgetInstances = await loadWidgetInstances(request);
}
widgetInstances = widgetInstances.map((widget) => {
const newWidget = {
sortOrder: widget.sortOrder,
areaId: widget.areaId,
type: widget.type
};
newWidget.id = `e${widget.uuid.replace(/-/g, '')}`;
if (route.isAdmin) {
newWidget.areaId = 'widget_setting_form';
}
return newWidget;
});
response.locals.widgets = widgetInstances;
if (
(isDevelopmentMode() &&
request.query &&
Expand All @@ -51,30 +71,11 @@ module.exports = async (request, response, delegate, next) => {
success: true,
eContext: {
graphqlResponse: get(response, 'locals.graphqlResponse', {}),
propsMap: get(response, 'locals.propsMap', {})
propsMap: get(response, 'locals.propsMap', {}),
widgets: widgetInstances
}
});
} else {
let widgetInstances;
// Check if we are in the test mode
if (process.env.NODE_ENV === 'test') {
widgetInstances = [];
} else {
widgetInstances = await loadWidgetInstances(request);
}
widgetInstances = widgetInstances.map((widget) => {
const newWidget = {
sortOrder: widget.sortOrder,
areaId: widget.areaId,
type: widget.type
};
newWidget.id = `e${widget.uuid.replace(/-/g, '')}`;
if (route.isAdmin) {
newWidget.areaId = 'widget_setting_form';
}
return newWidget;
});
response.locals.widgets = widgetInstances;
render(request, response);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export const layout = {
};

export const query = `
query Query {
query Query ($filters: [FilterInput!]) {
product(id: getContextValue("productId", null)) {
groupId
variantGroupId
Expand All @@ -264,7 +264,7 @@ export const query = `
optionText
}
},
groups: attributeGroups {
groups: attributeGroups(filters: $filters) {
items {
groupId: attributeGroupId
groupName
Expand All @@ -285,3 +285,8 @@ export const query = `
}
}
`;

export const variables = `
{
filters: [{ key: "limit", operation: 'eq', value: 1000 }]
}`;
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = async (request, response, delegate, next) => {
groupedItems.map((item) => item.sku)
)
.and('status', '=', 1)
.load(pool);
.execute(pool);
// Check if all products are available
if (products.length !== groupedItems.length) {
response.status(INVALID_PAYLOAD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe('Test line total calculation', () => {
const cart = new Cart({
status: 1
});

const priceConfig = config.get('pricing');
priceConfig.tax.price_including_tax = false;
const item = await cart.addItem(1, 1);
expect(item.getData('line_total')).toEqual(100);
const item2 = await cart.addItem(2, 2);
Expand All @@ -26,7 +27,8 @@ describe('Test line total calculation', () => {
const cart = new Cart({
status: 1
});

const priceConfig = config.get('pricing');
priceConfig.tax.price_including_tax = false;
const item = await cart.addItem(1, 1);
expect(item.getData('line_total_incl_tax')).toEqual(110);
const item2 = await cart.addItem(2, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe('Test product price calculation', () => {
const cart = new Cart({
status: 1
});

const priceConfig = config.get('pricing');
priceConfig.tax.price_including_tax = false;
const item = await cart.addItem(1, 1);
expect(item.getData('product_price')).toEqual(100);
expect(item.getData('final_price')).toEqual(100);
Expand All @@ -28,7 +29,8 @@ describe('Test product price calculation', () => {
const cart = new Cart({
status: 1
});

const priceConfig = config.get('pricing');
priceConfig.tax.price_including_tax = false;
const item = await cart.addItem(1, 1);
expect(item.getData('product_price_incl_tax')).toEqual(110);
expect(item.getData('final_price_incl_tax')).toEqual(110);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ describe('Test tax amount calculation', () => {
const cart = new Cart({
status: 1
});

const priceConfig = config.get('pricing');
priceConfig.tax.price_including_tax = false;
const item = await cart.addItem(1, 1);
expect(item.getData('tax_amount')).toEqual(10);
const item2 = await cart.addItem(2, 2);
Expand Down
28 changes: 24 additions & 4 deletions packages/s3_file_storage/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
const { addProcessor } = require('@evershop/evershop/src/lib/util/registry');
const { merge } = require('@evershop/evershop/src/lib/util/merge');
const { awsFileUploader } = require('./services/awsFileUploader');
const { awsFileDeleter } = require('./services/awsFileDeleter');
const { awsFileBrowser } = require('./services/awsFileBrowser');
const { awsFolderCreator } = require('./services/awsFolderCreator');

module.exports = () => {
addProcessor('configuratonSchema', (schema) => {
merge(
schema,
{
properties: {
system: {
type: 'object',
properties: {
file_storage: {
enum: ['s3']
}
}
}
}
},
100
);
return schema;
});
addProcessor('fileUploader', function (value) {
const {config} = this;
const { config } = this;
if (config === 's3') {
return awsFileUploader;
} else {
Expand All @@ -15,7 +35,7 @@ module.exports = () => {
});

addProcessor('fileDeleter', function (value) {
const {config} = this;
const { config } = this;
if (config === 's3') {
return awsFileDeleter;
} else {
Expand All @@ -24,7 +44,7 @@ module.exports = () => {
});

addProcessor('folderCreator', function (value) {
const {config} = this;
const { config } = this;
if (config === 's3') {
return awsFolderCreator;
} else {
Expand All @@ -33,7 +53,7 @@ module.exports = () => {
});

addProcessor('fileBrowser', function (value) {
const {config} = this;
const { config } = this;
if (config === 's3') {
return awsFileBrowser;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/s3_file_storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@evershop/s3_file_storage",
"version": "1.1.0",
"version": "1.2.0",
"description": "An extension for EverShop to use AWS S3 File Storage",
"repository": {
"type": "git",
Expand Down

0 comments on commit 6e14d3e

Please sign in to comment.