From cd3ea0bb1e4bbc85180a0aa9b227766b74d59f3b Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Mon, 16 Dec 2019 14:55:46 -0800 Subject: [PATCH 01/34] fix: revert removal of extendSimpleSchema Signed-off-by: Erik Kieckhafer --- .../server/extendCoreSchemas.js | 78 +++++++++++++++++++ .../included/simple-pricing/server/index.js | 1 + 2 files changed, 79 insertions(+) create mode 100644 imports/plugins/included/simple-pricing/server/extendCoreSchemas.js create mode 100644 imports/plugins/included/simple-pricing/server/index.js diff --git a/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js b/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js new file mode 100644 index 00000000000..df811e27ce9 --- /dev/null +++ b/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js @@ -0,0 +1,78 @@ +import SimpleSchema from "simpl-schema"; +import { registerSchema } from "@reactioncommerce/schemas"; +import { + CatalogProduct, + CatalogVariantSchema, + Product, + ProductVariant, + VariantBaseSchema +} from "/imports/collections/schemas"; + +/** + * @name PriceRange + * @type {SimpleSchema} + * @memberof Schemas + * @property {String} range, default value: `"0.00"` + * @property {Number} min optional, default value: `0` + * @property {Number} max optional, default value: `0` + */ +const PriceRange = new SimpleSchema({ + range: { + type: String, + defaultValue: "0.00" + }, + min: { + type: Number, + defaultValue: 0, + optional: true + }, + max: { + type: Number, + defaultValue: 0, + optional: true + } +}); + +registerSchema("PriceRange", PriceRange); + +Product.extend({ + price: { + label: "Price", + type: PriceRange + } +}); + +ProductVariant.extend({ + compareAtPrice: { + label: "Compare At Price", + type: Number, + optional: true, + min: 0, + defaultValue: 0.00 + }, + price: { + label: "Price", + type: Number, + defaultValue: 0.00, + min: 0, + optional: true + } +}); + +CatalogProduct.extend({ + pricing: { + type: Object, + blackbox: true + } +}); + +// Extend the catalog variant database schemas +const variantSchemaExtension = { + pricing: { + type: Object, + blackbox: true + } +}; + +VariantBaseSchema.extend(variantSchemaExtension); +CatalogVariantSchema.extend(variantSchemaExtension); diff --git a/imports/plugins/included/simple-pricing/server/index.js b/imports/plugins/included/simple-pricing/server/index.js new file mode 100644 index 00000000000..7245b45d206 --- /dev/null +++ b/imports/plugins/included/simple-pricing/server/index.js @@ -0,0 +1 @@ +import "./extendCoreSchemas"; From 93f91c7f0c9d728bb44267235dade2d0bddf8c5c Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Mon, 16 Dec 2019 14:59:04 -0800 Subject: [PATCH 02/34] Revert "fix: revert removal of extendSimpleSchema" This reverts commit cd3ea0bb1e4bbc85180a0aa9b227766b74d59f3b. Signed-off-by: Ross Hadden --- .../server/extendCoreSchemas.js | 78 ------------------- .../included/simple-pricing/server/index.js | 1 - 2 files changed, 79 deletions(-) delete mode 100644 imports/plugins/included/simple-pricing/server/extendCoreSchemas.js delete mode 100644 imports/plugins/included/simple-pricing/server/index.js diff --git a/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js b/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js deleted file mode 100644 index df811e27ce9..00000000000 --- a/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js +++ /dev/null @@ -1,78 +0,0 @@ -import SimpleSchema from "simpl-schema"; -import { registerSchema } from "@reactioncommerce/schemas"; -import { - CatalogProduct, - CatalogVariantSchema, - Product, - ProductVariant, - VariantBaseSchema -} from "/imports/collections/schemas"; - -/** - * @name PriceRange - * @type {SimpleSchema} - * @memberof Schemas - * @property {String} range, default value: `"0.00"` - * @property {Number} min optional, default value: `0` - * @property {Number} max optional, default value: `0` - */ -const PriceRange = new SimpleSchema({ - range: { - type: String, - defaultValue: "0.00" - }, - min: { - type: Number, - defaultValue: 0, - optional: true - }, - max: { - type: Number, - defaultValue: 0, - optional: true - } -}); - -registerSchema("PriceRange", PriceRange); - -Product.extend({ - price: { - label: "Price", - type: PriceRange - } -}); - -ProductVariant.extend({ - compareAtPrice: { - label: "Compare At Price", - type: Number, - optional: true, - min: 0, - defaultValue: 0.00 - }, - price: { - label: "Price", - type: Number, - defaultValue: 0.00, - min: 0, - optional: true - } -}); - -CatalogProduct.extend({ - pricing: { - type: Object, - blackbox: true - } -}); - -// Extend the catalog variant database schemas -const variantSchemaExtension = { - pricing: { - type: Object, - blackbox: true - } -}; - -VariantBaseSchema.extend(variantSchemaExtension); -CatalogVariantSchema.extend(variantSchemaExtension); diff --git a/imports/plugins/included/simple-pricing/server/index.js b/imports/plugins/included/simple-pricing/server/index.js deleted file mode 100644 index 7245b45d206..00000000000 --- a/imports/plugins/included/simple-pricing/server/index.js +++ /dev/null @@ -1 +0,0 @@ -import "./extendCoreSchemas"; From ef4157e12ff7772e3385aa142e011fe1ba09da22 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Mon, 16 Dec 2019 15:23:05 -0800 Subject: [PATCH 03/34] fix: prices not updating via UI Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- .../server/extendCoreSchemas.js | 78 ++++++++++ .../included/simple-pricing/server/index.js | 1 + package-lock.json | 144 +++++------------- 3 files changed, 117 insertions(+), 106 deletions(-) create mode 100644 imports/plugins/included/simple-pricing/server/extendCoreSchemas.js create mode 100644 imports/plugins/included/simple-pricing/server/index.js diff --git a/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js b/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js new file mode 100644 index 00000000000..df811e27ce9 --- /dev/null +++ b/imports/plugins/included/simple-pricing/server/extendCoreSchemas.js @@ -0,0 +1,78 @@ +import SimpleSchema from "simpl-schema"; +import { registerSchema } from "@reactioncommerce/schemas"; +import { + CatalogProduct, + CatalogVariantSchema, + Product, + ProductVariant, + VariantBaseSchema +} from "/imports/collections/schemas"; + +/** + * @name PriceRange + * @type {SimpleSchema} + * @memberof Schemas + * @property {String} range, default value: `"0.00"` + * @property {Number} min optional, default value: `0` + * @property {Number} max optional, default value: `0` + */ +const PriceRange = new SimpleSchema({ + range: { + type: String, + defaultValue: "0.00" + }, + min: { + type: Number, + defaultValue: 0, + optional: true + }, + max: { + type: Number, + defaultValue: 0, + optional: true + } +}); + +registerSchema("PriceRange", PriceRange); + +Product.extend({ + price: { + label: "Price", + type: PriceRange + } +}); + +ProductVariant.extend({ + compareAtPrice: { + label: "Compare At Price", + type: Number, + optional: true, + min: 0, + defaultValue: 0.00 + }, + price: { + label: "Price", + type: Number, + defaultValue: 0.00, + min: 0, + optional: true + } +}); + +CatalogProduct.extend({ + pricing: { + type: Object, + blackbox: true + } +}); + +// Extend the catalog variant database schemas +const variantSchemaExtension = { + pricing: { + type: Object, + blackbox: true + } +}; + +VariantBaseSchema.extend(variantSchemaExtension); +CatalogVariantSchema.extend(variantSchemaExtension); diff --git a/imports/plugins/included/simple-pricing/server/index.js b/imports/plugins/included/simple-pricing/server/index.js new file mode 100644 index 00000000000..5903397ebea --- /dev/null +++ b/imports/plugins/included/simple-pricing/server/index.js @@ -0,0 +1 @@ +import "./extendCoreSchemas.js"; diff --git a/package-lock.json b/package-lock.json index 5420fd9b99a..0f8376b5765 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2524,8 +2524,7 @@ "version": "5.1.2", "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -2645,8 +2644,7 @@ "version": "3.0.3", "resolved": false, "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, @@ -3969,8 +3967,7 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -4002,7 +3999,6 @@ "resolved": false, "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4019,8 +4015,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", @@ -4033,8 +4028,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4165,8 +4159,7 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4180,7 +4173,6 @@ "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4197,7 +4189,6 @@ "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4206,15 +4197,13 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "resolved": false, "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4235,7 +4224,6 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4324,8 +4312,7 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4339,7 +4326,6 @@ "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4435,8 +4421,7 @@ "version": "5.1.2", "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4478,7 +4463,6 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4500,7 +4484,6 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4549,15 +4532,13 @@ "version": "1.0.2", "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "resolved": false, "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, @@ -12554,8 +12535,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -12597,8 +12577,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", @@ -12611,8 +12590,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -12733,8 +12711,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -12748,7 +12725,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -12765,7 +12741,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -12774,8 +12749,7 @@ "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", @@ -12799,7 +12773,6 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -12888,8 +12861,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -12903,7 +12875,6 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -13040,7 +13011,6 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -13062,7 +13032,6 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -13095,7 +13064,6 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -13115,15 +13083,13 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, @@ -13148,8 +13114,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", @@ -17036,8 +17001,7 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -17069,7 +17033,6 @@ "resolved": false, "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -17086,8 +17049,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", @@ -17100,8 +17062,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -17232,8 +17193,7 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -17247,7 +17207,6 @@ "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -17264,7 +17223,6 @@ "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -17273,15 +17231,13 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "resolved": false, "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -17302,7 +17258,6 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -17391,8 +17346,7 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -17406,7 +17360,6 @@ "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -17502,8 +17455,7 @@ "version": "5.1.2", "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -17545,7 +17497,6 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -17567,7 +17518,6 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -17616,15 +17566,13 @@ "version": "1.0.2", "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "resolved": false, "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, @@ -19306,8 +19254,7 @@ "version": "2.1.1", "resolved": false, "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -19356,8 +19303,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", @@ -19370,8 +19316,7 @@ "version": "1.1.0", "resolved": false, "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -19502,8 +19447,7 @@ "version": "2.0.3", "resolved": false, "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -19517,7 +19461,6 @@ "resolved": false, "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -19534,7 +19477,6 @@ "resolved": false, "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -19543,15 +19485,13 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "resolved": false, "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -19572,7 +19512,6 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -19661,8 +19600,7 @@ "version": "1.0.1", "resolved": false, "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -19676,7 +19614,6 @@ "resolved": false, "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -19772,8 +19709,7 @@ "version": "5.1.2", "resolved": false, "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -19815,7 +19751,6 @@ "resolved": false, "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -19837,7 +19772,6 @@ "resolved": false, "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -19886,15 +19820,13 @@ "version": "1.0.2", "resolved": false, "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "resolved": false, "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, From b3a4d8a0fb39590e35a917d535189620f010af04 Mon Sep 17 00:00:00 2001 From: Mike Murray Date: Mon, 16 Dec 2019 16:17:13 -0800 Subject: [PATCH 04/34] fix: missing logout button Signed-off-by: Mike Murray Signed-off-by: Ross Hadden --- imports/plugins/core/accounts/server/init.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/imports/plugins/core/accounts/server/init.js b/imports/plugins/core/accounts/server/init.js index 341e614d403..4032299789b 100644 --- a/imports/plugins/core/accounts/server/init.js +++ b/imports/plugins/core/accounts/server/init.js @@ -126,6 +126,11 @@ Meteor.startup(() => { emailIsVerified = true; } + // Set the first email to be the default + if (user.emails[0]) { + user.emails[0].provides = "default"; + } + // create a tokenObj and send a welcome email to new users, // but skip the first default admin user and anonymous users // (default admins already get a verification email) From 1b17021f8eedfa530ca7d5147b8a6a97fb400cc0 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Mon, 16 Dec 2019 16:13:49 -0800 Subject: [PATCH 05/34] fix: add shop based roles to first user account Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- .../core-services/account/util/createDefaultAdminUser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imports/node-app/core-services/account/util/createDefaultAdminUser.js b/imports/node-app/core-services/account/util/createDefaultAdminUser.js index 83ab275d7fb..63130e85aa8 100644 --- a/imports/node-app/core-services/account/util/createDefaultAdminUser.js +++ b/imports/node-app/core-services/account/util/createDefaultAdminUser.js @@ -76,7 +76,8 @@ export default async function createDefaultAdminUser(context) { $set: { name: userInput.name, roles: { - __global_roles__: defaultOwnerRoles // eslint-disable-line camelcase + __global_roles__: defaultOwnerRoles, // eslint-disable-line camelcase + [shop._id]: defaultOwnerRoles // eslint-disable-line camelcase } } }); From 34565caacdc3f9beae3ff5e839f5cb707efb4acc Mon Sep 17 00:00:00 2001 From: Will Lopez Date: Wed, 18 Dec 2019 08:08:26 -0600 Subject: [PATCH 06/34] fix: issue that prevented uploading images on Firefox Signed-off-by: Will Lopez Signed-off-by: Ross Hadden --- package-lock.json | 193 +++++++++++++++++++++++++++++++++++----------- package.json | 4 +- 2 files changed, 151 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0f8376b5765..a3c79e353c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1371,6 +1371,27 @@ } } }, + "@babel/runtime-corejs2": { + "version": "7.7.6", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.7.6.tgz", + "integrity": "sha512-QYp/8xdH8iMin3pH5gtT/rUuttVfIcOhWBC3wh9Eh/qs4jEe39+3DpCDLgWXhMQgiCTOH8mrLSvQ0OHOCcox9g==", + "requires": { + "core-js": "^2.6.5", + "regenerator-runtime": "^0.13.2" + }, + "dependencies": { + "core-js": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", + "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==" + }, + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" + } + } + }, "@babel/template": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0.tgz", @@ -2295,8 +2316,7 @@ "version": "0.0.8", "resolved": false, "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", @@ -2324,7 +2344,6 @@ "resolved": false, "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -6863,11 +6882,11 @@ "dev": true }, "@reactioncommerce/file-collections": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections/-/file-collections-0.7.0.tgz", - "integrity": "sha512-Tqhfz3nFC8ivjKseogu3qnU7HauklD89eJjPJNZJrf61ayjEfNfoCHLnijHRQ/B8pT0qy8/jLp9RUukQuS7lrg==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections/-/file-collections-0.7.2.tgz", + "integrity": "sha512-6wYndfboaKjiNnh5y1bqa1TgnRyI8Hv6X+igoeSRF99xn/ApGwJ1srUhVrP09GwIIr36LxFFtqYXiEXjMIKMqw==", "requires": { - "babel-runtime": "^6.26.0", + "@babel/runtime-corejs2": "^7.7.6", "content-disposition": "^0.5.2", "debug": "^3.1.0", "extend": "~3.0.2", @@ -6893,31 +6912,36 @@ } }, "@reactioncommerce/file-collections-sa-base": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections-sa-base/-/file-collections-sa-base-0.1.0.tgz", - "integrity": "sha512-T4isLFSb5CKHyYgJkvPnMY/GCwit8j3SFvCFXvRUNrqUWnqHMPLIMgsWLPmCfGC5EIFiqf1cBNF9JeBs/gHvfw==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections-sa-base/-/file-collections-sa-base-0.1.1.tgz", + "integrity": "sha512-kygkaSvUXoxqvKIOvaiuRiJFLgaJsUrcBCvR3BL17NcBq8t94JlVPQOpkoWBALgULeT2eDaaKpqnbDy66p8fzw==", "requires": { - "babel-runtime": "^6.26.0", + "@babel/runtime-corejs2": "^7.7.6", "debug": "^3.1.0" }, "dependencies": { "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, "@reactioncommerce/file-collections-sa-gridfs": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections-sa-gridfs/-/file-collections-sa-gridfs-0.1.0.tgz", - "integrity": "sha512-fmFB99WXFGMN9iFmiZvjHxDHktpiZe0NVmB2hbPpDJjYsyFZszc8ELj0TES7EAulwU8Eb0IszULlZMiQq1+fqw==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@reactioncommerce/file-collections-sa-gridfs/-/file-collections-sa-gridfs-0.1.2.tgz", + "integrity": "sha512-P2zaTn29UOqEpyUgfTTHaNBRdsFJcYth6N3ARtc/ZnDReRPqpuXVtkWY3ymLI4OPmXDQKDRXYK+BzG/vKeahwA==", "requires": { - "@reactioncommerce/file-collections-sa-base": "^0.1.0", - "babel-runtime": "^6.26.0", + "@babel/runtime-corejs2": "^7.7.6", + "@reactioncommerce/file-collections-sa-base": "^0.1.1", "debug": "^3.1.0", "gridfs-stream": "^1.1.1" }, @@ -8182,13 +8206,13 @@ "integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA==" }, "aws-sdk": { - "version": "2.521.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.521.0.tgz", - "integrity": "sha512-YRViGahZoHq0lEsy0Cq7bqaLzP8OTzjg35Hz08Rv88ltk+b5UWVpDgIWls7mXCBNTBTYjbfbeGXzNaHJBLKlpA==", + "version": "2.592.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.592.0.tgz", + "integrity": "sha512-4L0SuERTJnz4JMf70q4VvYG5trR72k+ynJeMZuvE79apUBSs+tAUZTrFwSeDgbJnYycQdwQf6Ocm5wHwIzNHRg==", "requires": { "buffer": "4.9.1", "events": "1.1.1", - "ieee754": "1.1.8", + "ieee754": "1.1.13", "jmespath": "0.15.0", "querystring": "0.2.0", "sax": "1.2.1", @@ -8199,7 +8223,7 @@ "dependencies": { "buffer": { "version": "4.9.1", - "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "requires": { "base64-js": "^1.0.2", @@ -8208,9 +8232,9 @@ } }, "ieee754": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", - "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" }, "punycode": { "version": "1.3.2", @@ -8253,9 +8277,9 @@ }, "dependencies": { "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" } } }, @@ -9771,6 +9795,15 @@ "wcwidth": "^1.0.0" } }, + "combine-errors": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz", + "integrity": "sha1-9N9nQAg+VwOjGBEQwrEFUfAD2oY=", + "requires": { + "custom-error-instance": "2.1.1", + "lodash.uniqby": "4.5.0" + } + }, "combined-stream": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", @@ -9806,9 +9839,9 @@ }, "dependencies": { "mime-db": { - "version": "1.41.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.41.0.tgz", - "integrity": "sha512-B5gxBI+2K431XW8C2rcc/lhppbuji67nf9v39eH8pkWoZDxnAL0PxdpH32KYRScniF8qDHBDlI+ipgg5WrCUYw==" + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" } } }, @@ -10150,6 +10183,11 @@ "resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.5.tgz", "integrity": "sha512-s7Al6m0GYp9A/iFRf9GjuZYO/+VI65AD0pNoDK2O4AwM1tQEcNE0MjpyUi6CTyWVAl2DjQ0JVosjEUujmkTSUA==" }, + "custom-error-instance": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz", + "integrity": "sha1-PPY5FIemYppiR+sMoM4ACBt+Nho=" + }, "cwd": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/cwd/-/cwd-0.10.0.tgz", @@ -13859,9 +13897,9 @@ } }, "hash-stream-validation": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.1.tgz", - "integrity": "sha1-7Mm5l7IYvluzEphii7gHhptz3NE=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.2.tgz", + "integrity": "sha512-cMlva5CxWZOrlS/cY0C+9qAzesn5srhFA8IT1VPiHc9bWWBLkJfEUIZr7MWoi89oOOGmpg8ymchaOjiArsGu5A==", "requires": { "through2": "^2.0.0" } @@ -21355,6 +21393,14 @@ "lodash._baseisequal": "^3.0.0" } }, + "lodash._baseiteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz", + "integrity": "sha1-NKm1VDVycnw9sueO2uPA6eZr0QI=", + "requires": { + "lodash._stringtopath": "~4.8.0" + } + }, "lodash._basematches": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash._basematches/-/lodash._basematches-3.2.0.tgz", @@ -21364,16 +21410,48 @@ "lodash.pairs": "^3.0.0" } }, + "lodash._basetostring": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz", + "integrity": "sha1-kyfJ3FFYhmt/pLnUL0Y45XZt2d8=" + }, + "lodash._baseuniq": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "integrity": "sha1-DrtE5FaBSveQXGIS+iybLVG4Qeg=", + "requires": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + } + }, "lodash._bindcallback": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=" }, + "lodash._createset": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "integrity": "sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=" + }, "lodash._getnative": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=" }, + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=" + }, + "lodash._stringtopath": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/lodash._stringtopath/-/lodash._stringtopath-4.8.0.tgz", + "integrity": "sha1-lBvPDmQmbl/B1m/tCmlZVExXaCQ=", + "requires": { + "lodash._basetostring": "~4.12.0" + } + }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -21568,6 +21646,15 @@ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, + "lodash.uniqby": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.5.0.tgz", + "integrity": "sha1-o6F7v2LutiQPSRhG6XwcTipeHiE=", + "requires": { + "lodash._baseiteratee": "~4.7.0", + "lodash._baseuniq": "~4.6.0" + } + }, "lodash.uniqueid": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz", @@ -24248,6 +24335,22 @@ "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", "dev": true }, + "proper-lockfile": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-2.0.1.tgz", + "integrity": "sha1-FZ+wYZPTIAP0s2kd0uwaY0qoDR0=", + "requires": { + "graceful-fs": "^4.1.2", + "retry": "^0.10.0" + }, + "dependencies": { + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=" + } + } + }, "protobufjs": { "version": "6.8.8", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz", @@ -27054,9 +27157,9 @@ } }, "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" }, "stream-transform": { "version": "1.0.8", @@ -27956,14 +28059,16 @@ } }, "tus-js-client": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-1.7.1.tgz", - "integrity": "sha512-38NMOvjZm/HQTdmwLctXqctsUUsiuZsdUGBew6xn3/s1D7ofzjW/VBRAp+uAWrzN0ziAmo2WuiZ9FMP9UeU0UQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-1.8.0.tgz", + "integrity": "sha512-qPX3TywqzxocTxUZtcS8X7Aik72SVMa0jKi4hWyfvRV+s9raVzzYGaP4MoJGaF0yOgm2+b6jXaVEHogxcJ8LGw==", "requires": { "buffer-from": "^0.1.1", - "extend": "^3.0.0", + "combine-errors": "^3.0.3", + "extend": "^3.0.2", "js-base64": "^2.4.9", "lodash.throttle": "^4.1.1", + "proper-lockfile": "^2.0.1", "url-parse": "^1.4.3" } }, diff --git a/package.json b/package.json index 8c08aec26c4..fab56b006d1 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "@reactioncommerce/components": "^0.67.2", "@reactioncommerce/components-context": "1.2.0", "@reactioncommerce/data-factory": "^1.0.1", - "@reactioncommerce/file-collections": "0.7.0", - "@reactioncommerce/file-collections-sa-gridfs": "0.1.0", + "@reactioncommerce/file-collections": "0.7.2", + "@reactioncommerce/file-collections-sa-gridfs": "0.1.2", "@reactioncommerce/job-queue": "1.0.5", "@reactioncommerce/logger": "1.1.1", "@reactioncommerce/nodemailer": "5.0.5", From d46f5b044c7e319dfa463660b754f87112449763 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Tue, 17 Dec 2019 13:39:09 -0800 Subject: [PATCH 07/34] fix: routing when logging in from storefront Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- .../layout/client/components/coreLayout.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/imports/plugins/core/layout/client/components/coreLayout.js b/imports/plugins/core/layout/client/components/coreLayout.js index e0dfeefef3d..8b40bf53d1b 100644 --- a/imports/plugins/core/layout/client/components/coreLayout.js +++ b/imports/plugins/core/layout/client/components/coreLayout.js @@ -6,6 +6,7 @@ import Logger from "/client/modules/logger"; import { Meteor } from "meteor/meteor"; import Button from "@material-ui/core/Button"; import withStyles from "@material-ui/core/styles/withStyles"; +import InlineAlert from "@reactioncommerce/components/InlineAlert/v1"; import ShopLogo from "/imports/client/ui/components/ShopLogoWithData/ShopLogoWithData"; const styles = (theme) => ({ @@ -82,6 +83,24 @@ function CoreLayout({ classes, isAdmin, isLoading, isLoggedIn, location, storefr } } + // If user is logged in, and they come from storefront (/account in url) + // redirect to storefront + if (location.pathname.startsWith("/account") && isLoggedIn) { + if (storefrontHomeUrl && storefrontHomeUrl.length) { + window.location.href = storefrontHomeUrl; + return null; + } + + Logger.warn("Missing storefront home URL. Please set this from the shop settings panel so that customer users can be redirected to your storefront."); + + content = ( + + ); + } + return (
From 2e994c44567594bccf693f2c0b10952d9c365b8d Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 14:42:19 -0800 Subject: [PATCH 08/34] get challenge from URL Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- imports/plugins/core/accounts/client/containers/auth.js | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/plugins/core/accounts/client/containers/auth.js b/imports/plugins/core/accounts/client/containers/auth.js index 72714a0adc1..a7e086661c0 100644 --- a/imports/plugins/core/accounts/client/containers/auth.js +++ b/imports/plugins/core/accounts/client/containers/auth.js @@ -45,6 +45,7 @@ class AuthContainer extends Component { const validatedEmail = LoginFormValidation.email(username); const validatedPassword = LoginFormValidation.password(pword, { validationLevel: "exists" }); + const challenge = Router.current().query.login_challenge; if (validatedEmail !== true) { errors.email = validatedEmail; From c8ac27e6c671f4ad69d17e0b5704df12581c3901 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 15:53:01 -0800 Subject: [PATCH 09/34] add logout functionality from storefront Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- .../layout/client/components/coreLayout.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/imports/plugins/core/layout/client/components/coreLayout.js b/imports/plugins/core/layout/client/components/coreLayout.js index 8b40bf53d1b..c210d36601e 100644 --- a/imports/plugins/core/layout/client/components/coreLayout.js +++ b/imports/plugins/core/layout/client/components/coreLayout.js @@ -1,7 +1,7 @@ import React, { useState } from "react"; import PropTypes from "prop-types"; import { registerComponent, Components, composeWithTracker } from "@reactioncommerce/reaction-components"; -import { Reaction } from "/client/api"; +import { Reaction, Router } from "/client/api"; import Logger from "/client/modules/logger"; import { Meteor } from "meteor/meteor"; import Button from "@material-ui/core/Button"; @@ -36,7 +36,7 @@ const styles = (theme) => ({ * to operator 2.0 * @returns {Node} React component */ -function CoreLayout({ classes, isAdmin, isLoading, isLoggedIn, location, storefrontHomeUrl }) { +function CoreLayout({ classes, isAdmin, isLoading, isLoggedIn, location, referer, storefrontHomeUrl }) { const [isLoggingOut, setIsLoggingOut] = useState(false); if (isLoading || isLoggingOut) return null; @@ -83,6 +83,27 @@ function CoreLayout({ classes, isAdmin, isLoading, isLoggedIn, location, storefr } } + + if (location.pathname.startsWith("/account/logout")) { + Meteor.logout(); + if (referer) { + window.location.href = referer; + return null; + } else if (storefrontHomeUrl && storefrontHomeUrl.length) { + window.location.href = storefrontHomeUrl; + return null; + } + + Logger.warn("Missing storefront home URL. Please set this from the shop settings panel so that customer users can be redirected to your storefront."); + + content = ( + + ); + } + // If user is logged in, and they come from storefront (/account in url) // redirect to storefront if (location.pathname.startsWith("/account") && isLoggedIn) { @@ -137,11 +158,13 @@ function composer(props, onData) { const shop = Reaction.getCurrentShop(); const isLoading = (isAdmin !== true && isAdmin !== false) || !shop; const isLoggedIn = !!Reaction.getUserId(); + const referer = Router.current().query.referer; onData(null, { isAdmin, isLoading, isLoggedIn, + referer, storefrontHomeUrl: (shop && shop.storefrontUrls && shop.storefrontUrls.storefrontHomeUrl) || null }); } From ac8761c39f2ecff756daedab3bfa7c1f520aa7fb Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 15:53:57 -0800 Subject: [PATCH 10/34] feat: add oauth to new AuthContainer alongside meteor Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- imports/plugins/core/hydra-oauth/server/oauthMethods.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imports/plugins/core/hydra-oauth/server/oauthMethods.js b/imports/plugins/core/hydra-oauth/server/oauthMethods.js index 7c5bcbd5588..ba48253e174 100644 --- a/imports/plugins/core/hydra-oauth/server/oauthMethods.js +++ b/imports/plugins/core/hydra-oauth/server/oauthMethods.js @@ -30,7 +30,9 @@ export function oauthLogin(options) { // eslint-disable-next-line camelcase remember_for: HYDRA_SESSION_LIFESPAN ? Number(HYDRA_SESSION_LIFESPAN) : 86400 }) - .then((response) => response.redirect_to) + .then((response) => { + return response.redirect_to; + }) .catch((error) => { Logger.error(error); throw error; From f9009e9c7c9860e944252a9bec80adf2162389cd Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 15:54:17 -0800 Subject: [PATCH 11/34] feat: add oauth call to AuthContainer Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- imports/plugins/core/accounts/client/containers/auth.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imports/plugins/core/accounts/client/containers/auth.js b/imports/plugins/core/accounts/client/containers/auth.js index a7e086661c0..dbc27d294df 100644 --- a/imports/plugins/core/accounts/client/containers/auth.js +++ b/imports/plugins/core/accounts/client/containers/auth.js @@ -75,7 +75,9 @@ class AuthContainer extends Component { } }); } else { - Router.go(this.props.currentRoute.route.path); + Meteor.call("oauth/login", { challenge }, (err, redirect_to) => { + window.location.href = redirect_to; + }); } }); } else if (this.props.currentView === "loginFormSignUpView") { From 762839f9412320dc3babfa51c85df8f39269aff6 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 16:22:54 -0800 Subject: [PATCH 12/34] feat: add oauth-login for new users Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- imports/plugins/core/accounts/client/containers/auth.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imports/plugins/core/accounts/client/containers/auth.js b/imports/plugins/core/accounts/client/containers/auth.js index dbc27d294df..a21ca5033f7 100644 --- a/imports/plugins/core/accounts/client/containers/auth.js +++ b/imports/plugins/core/accounts/client/containers/auth.js @@ -96,7 +96,9 @@ class AuthContainer extends Component { } }); } else { - Router.go(this.props.currentRoute.route.path); + Meteor.call("oauth/login", { challenge }, (err, redirect_to) => { + window.location.href = redirect_to; + }); } }); } From ef85848d7d9b7664797163474557afa83acd1222 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 18 Dec 2019 16:09:48 -0800 Subject: [PATCH 13/34] refactor: unneeded return Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- imports/plugins/core/hydra-oauth/server/oauthMethods.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/imports/plugins/core/hydra-oauth/server/oauthMethods.js b/imports/plugins/core/hydra-oauth/server/oauthMethods.js index ba48253e174..7c5bcbd5588 100644 --- a/imports/plugins/core/hydra-oauth/server/oauthMethods.js +++ b/imports/plugins/core/hydra-oauth/server/oauthMethods.js @@ -30,9 +30,7 @@ export function oauthLogin(options) { // eslint-disable-next-line camelcase remember_for: HYDRA_SESSION_LIFESPAN ? Number(HYDRA_SESSION_LIFESPAN) : 86400 }) - .then((response) => { - return response.redirect_to; - }) + .then((response) => response.redirect_to) .catch((error) => { Logger.error(error); throw error; From d6e9b58148043f6b441363204006a7314355b9cb Mon Sep 17 00:00:00 2001 From: Ross Hadden Date: Thu, 19 Dec 2019 15:20:56 -0500 Subject: [PATCH 14/34] chore: fixed linter violations Signed-off-by: Ross Hadden --- imports/plugins/core/accounts/client/containers/auth.js | 8 ++++---- .../plugins/core/layout/client/components/coreLayout.js | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/imports/plugins/core/accounts/client/containers/auth.js b/imports/plugins/core/accounts/client/containers/auth.js index a21ca5033f7..4897ce21ade 100644 --- a/imports/plugins/core/accounts/client/containers/auth.js +++ b/imports/plugins/core/accounts/client/containers/auth.js @@ -75,8 +75,8 @@ class AuthContainer extends Component { } }); } else { - Meteor.call("oauth/login", { challenge }, (err, redirect_to) => { - window.location.href = redirect_to; + Meteor.call("oauth/login", { challenge }, (err, redirectUrl) => { + window.location.href = redirectUrl; }); } }); @@ -96,8 +96,8 @@ class AuthContainer extends Component { } }); } else { - Meteor.call("oauth/login", { challenge }, (err, redirect_to) => { - window.location.href = redirect_to; + Meteor.call("oauth/login", { challenge }, (err, redirectUrl) => { + window.location.href = redirectUrl; }); } }); diff --git a/imports/plugins/core/layout/client/components/coreLayout.js b/imports/plugins/core/layout/client/components/coreLayout.js index c210d36601e..b46d1a32bc3 100644 --- a/imports/plugins/core/layout/client/components/coreLayout.js +++ b/imports/plugins/core/layout/client/components/coreLayout.js @@ -142,6 +142,7 @@ CoreLayout.propTypes = { isLoading: PropTypes.bool, isLoggedIn: PropTypes.bool, location: PropTypes.object, + referer: PropTypes.string, storefrontHomeUrl: PropTypes.string }; @@ -158,7 +159,7 @@ function composer(props, onData) { const shop = Reaction.getCurrentShop(); const isLoading = (isAdmin !== true && isAdmin !== false) || !shop; const isLoggedIn = !!Reaction.getUserId(); - const referer = Router.current().query.referer; + const { referer } = Router.current().query; onData(null, { isAdmin, From 27cdc3c84c916ed906e7ed6b3f929eb68ad8ca44 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Mon, 16 Dec 2019 14:59:04 -0800 Subject: [PATCH 15/34] Revert "fix: revert removal of extendSimpleSchema" This reverts commit cd3ea0bb1e4bbc85180a0aa9b227766b74d59f3b. Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- CHANGELOG.md | 15 +++++++++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40db4363b85..aa7385e5cbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# v2.9.1 + +Miscellaneous fixes for our app and some of its dependencies. + +##Fixes + +- fix: login from storefront [#5951](https://github.com/reactioncommerce/reaction/pull/5951) +- fix: issue that prevented uploading images on Firefox [#5939](https://github.com/reactioncommerce/reaction/pull/5939) +- fix: routing when logging in from storefront [#5932](https://github.com/reactioncommerce/reaction/pull/5932) +- fix: add shop based roles to first user account [#5926](https://github.com/reactioncommerce/reaction/pull/5926) +- fix: missing logout button [#5927](https://github.com/reactioncommerce/reaction/pull/5927) +- fix: prices not updating via UI [#5924](https://github.com/reactioncommerce/reaction/pull/5924) +- fix: made bin/setup always run from the desired path [#5853](https://github.com/reactioncommerce/reaction/pull/5853) +- fix: upgrade handlebars version [#5810](https://github.com/reactioncommerce/reaction/pull/5810) + # v2.9.0 Reaction v2.9.0 adds integration tests for GraphQL API endpoints, security updates and fixes a fulfillment method bug. diff --git a/package-lock.json b/package-lock.json index a3c79e353c9..a1e286d6ad9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "reaction", - "version": "2.9.0", + "version": "2.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fab56b006d1..cdaa7a6b4d5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "reaction", "description": "Reaction is a modern reactive, real-time event driven ecommerce platform.", - "version": "2.9.0", + "version": "2.9.1", "main": "main.js", "directories": { "test": "tests" From a7f72cb9f4cac3777e1422214bb92ceb27ad5a2a Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 19 Dec 2019 14:24:52 -0800 Subject: [PATCH 16/34] docs: add notable changes to release docs Signed-off-by: Erik Kieckhafer Signed-off-by: Ross Hadden --- CHANGELOG.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa7385e5cbd..3e4dff01a05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,16 @@ # v2.9.1 -Miscellaneous fixes for our app and some of its dependencies. +Reaction v2.9.1 adds miscellaneous bug fixes and contains no breaking changes since v2.9.0. -##Fixes +This release is being coordinated with `reaction-platform` and is designed to work with `v2.9.1` of `example-storefront` and `reaction-hydra`. + +## Notable changes + +### Fix example-storefront login issue + +Logging in from the example storefront has been fixed to allow a user to stay logged in when navigating to login from the storefront. + +## Fixes - fix: login from storefront [#5951](https://github.com/reactioncommerce/reaction/pull/5951) - fix: issue that prevented uploading images on Firefox [#5939](https://github.com/reactioncommerce/reaction/pull/5939) From ab3fa7456a5af56a184b00a517557a2e2963b0b5 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 19 Dec 2019 20:18:06 -0800 Subject: [PATCH 17/34] refactor: use better cache policy to show new tags Signed-off-by: Erik Kieckhafer --- imports/plugins/core/tags/client/components/TagDataTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/plugins/core/tags/client/components/TagDataTable.js b/imports/plugins/core/tags/client/components/TagDataTable.js index e6abe7acbc5..133cadcc0a8 100644 --- a/imports/plugins/core/tags/client/components/TagDataTable.js +++ b/imports/plugins/core/tags/client/components/TagDataTable.js @@ -465,7 +465,7 @@ class TagDataTable extends Component { // All available props: https://github.com/tannerlinsley/react-table#props return ( - + {({ data, fetchMore, refetch }) => { const result = (data[otherProps.dataKey] && data[otherProps.dataKey].nodes) || []; const resultCount = (Array.isArray(result) && result.length) || 0; From 1f80239e6cac138d749d8bfb17d48e53a5d1add8 Mon Sep 17 00:00:00 2001 From: Manuel Del Real Date: Fri, 20 Dec 2019 17:41:33 -0600 Subject: [PATCH 18/34] Fix: recalculate shipping prices correctly Signed-off-by: Manuel Del Real --- .../shipping-rates/getFulfillmentMethodsWithQuotes.js | 5 ++--- imports/plugins/core/graphql/server/no-meteor/xforms/cart.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js index d043b327a47..f1646e3af13 100644 --- a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js +++ b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js @@ -87,13 +87,12 @@ export default async function getFulfillmentMethodsWithQuotes(context, commonOrd if (!method.carrier) { method.carrier = carrier; } - const rate = method.rate + method.handling; rates.push({ carrier, handlingPrice: method.handling, method, - rate, - shippingPrice: method.rate, + rate: method.rate, + shippingPrice: method.rate + method.handling, shopId: doc.shopId }); } diff --git a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js index 60279ca74ce..f1f56780b01 100644 --- a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js +++ b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js @@ -141,7 +141,7 @@ function xformCartFulfillmentGroup(fulfillmentGroup, cart) { currencyCode: cart.currencyCode }, price: { - amount: option.rate || 0, + amount: (option.rate + option.handlingPrice) || 0, currencyCode: cart.currencyCode } })); @@ -162,7 +162,7 @@ function xformCartFulfillmentGroup(fulfillmentGroup, cart) { currencyCode: cart.currencyCode }, price: { - amount: fulfillmentGroup.shipmentMethod.rate || 0, + amount: (fulfillmentGroup.shipmentMethod.rate + fulfillmentGroup.shipmentMethod.handling) || 0, currencyCode: cart.currencyCode } }; From 29e93ab7037f31eac0ed70a47bbd6b793119a22f Mon Sep 17 00:00:00 2001 From: Manuel Del Real Date: Fri, 20 Dec 2019 18:09:08 -0600 Subject: [PATCH 19/34] Fix lint warnings Signed-off-by: Manuel Del Real --- .../plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js index f1646e3af13..dbd5c0f6cf0 100644 --- a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js +++ b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js @@ -87,6 +87,7 @@ export default async function getFulfillmentMethodsWithQuotes(context, commonOrd if (!method.carrier) { method.carrier = carrier; } + rates.push({ carrier, handlingPrice: method.handling, From 2a7aca9a220b3dc2a590e32f2d7139c37917c4c8 Mon Sep 17 00:00:00 2001 From: Manuel Del Real Date: Fri, 20 Dec 2019 18:27:08 -0600 Subject: [PATCH 20/34] Fix linting error Signed-off-by: Manuel Del Real --- .../plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js index dbd5c0f6cf0..4fe8b6f41ac 100644 --- a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js +++ b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js @@ -87,7 +87,7 @@ export default async function getFulfillmentMethodsWithQuotes(context, commonOrd if (!method.carrier) { method.carrier = carrier; } - + rates.push({ carrier, handlingPrice: method.handling, From c9b46aae4a7095ca5491b303b2500d7f6d3fd5bd Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 17:18:43 -0800 Subject: [PATCH 21/34] chore: update CHANGELOG with new commits Signed-off-by: Erik Kieckhafer --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e4dff01a05..df4d7aef72f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ This release is being coordinated with `reaction-platform` and is designed to wo Logging in from the example storefront has been fixed to allow a user to stay logged in when navigating to login from the storefront. +### Fix cart total calculation + +Cart total calculation has been fixed to correctly add rate + handling numbers. + ## Fixes - fix: login from storefront [#5951](https://github.com/reactioncommerce/reaction/pull/5951) @@ -20,6 +24,7 @@ Logging in from the example storefront has been fixed to allow a user to stay lo - fix: prices not updating via UI [#5924](https://github.com/reactioncommerce/reaction/pull/5924) - fix: made bin/setup always run from the desired path [#5853](https://github.com/reactioncommerce/reaction/pull/5853) - fix: upgrade handlebars version [#5810](https://github.com/reactioncommerce/reaction/pull/5810) +- fix: cart total calculation when shipping includes handling fee [#5985](https://github.com/reactioncommerce/reaction/pull/5985) # v2.9.0 From c13a956af54dc052c2d030bd0b9cb7ef0140a929 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 17:20:47 -0800 Subject: [PATCH 22/34] chore: update changelog Signed-off-by: Erik Kieckhafer --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4d7aef72f..e62bf97e894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ Cart total calculation has been fixed to correctly add rate + handling numbers. - fix: upgrade handlebars version [#5810](https://github.com/reactioncommerce/reaction/pull/5810) - fix: cart total calculation when shipping includes handling fee [#5985](https://github.com/reactioncommerce/reaction/pull/5985) +## refactors + +- refactor: use better cache policy to show newly created tags [#5978](https://github.com/reactioncommerce/reaction/pull/5978) + # v2.9.0 Reaction v2.9.0 adds integration tests for GraphQL API endpoints, security updates and fixes a fulfillment method bug. From d35a4523fff93d085d29ae9e434a3c8d6834abc8 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 17:20:47 -0800 Subject: [PATCH 23/34] chore: update changelog Signed-off-by: Erik Kieckhafer --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4d7aef72f..e62bf97e894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ Cart total calculation has been fixed to correctly add rate + handling numbers. - fix: upgrade handlebars version [#5810](https://github.com/reactioncommerce/reaction/pull/5810) - fix: cart total calculation when shipping includes handling fee [#5985](https://github.com/reactioncommerce/reaction/pull/5985) +## refactors + +- refactor: use better cache policy to show newly created tags [#5978](https://github.com/reactioncommerce/reaction/pull/5978) + # v2.9.0 Reaction v2.9.0 adds integration tests for GraphQL API endpoints, security updates and fixes a fulfillment method bug. From 4033039f0faf0a574127d3f523ce8046e0a20ebe Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 19:12:30 -0800 Subject: [PATCH 24/34] Revert "Fix cart total calculation when shipping includes handling fee" Signed-off-by: Erik Kieckhafer --- .../shipping-rates/getFulfillmentMethodsWithQuotes.js | 6 +++--- .../plugins/core/graphql/server/no-meteor/xforms/cart.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js index 4fe8b6f41ac..d043b327a47 100644 --- a/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js +++ b/imports/node-app/plugins/shipping-rates/getFulfillmentMethodsWithQuotes.js @@ -87,13 +87,13 @@ export default async function getFulfillmentMethodsWithQuotes(context, commonOrd if (!method.carrier) { method.carrier = carrier; } - + const rate = method.rate + method.handling; rates.push({ carrier, handlingPrice: method.handling, method, - rate: method.rate, - shippingPrice: method.rate + method.handling, + rate, + shippingPrice: method.rate, shopId: doc.shopId }); } diff --git a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js index f1f56780b01..60279ca74ce 100644 --- a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js +++ b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js @@ -141,7 +141,7 @@ function xformCartFulfillmentGroup(fulfillmentGroup, cart) { currencyCode: cart.currencyCode }, price: { - amount: (option.rate + option.handlingPrice) || 0, + amount: option.rate || 0, currencyCode: cart.currencyCode } })); @@ -162,7 +162,7 @@ function xformCartFulfillmentGroup(fulfillmentGroup, cart) { currencyCode: cart.currencyCode }, price: { - amount: (fulfillmentGroup.shipmentMethod.rate + fulfillmentGroup.shipmentMethod.handling) || 0, + amount: fulfillmentGroup.shipmentMethod.rate || 0, currencyCode: cart.currencyCode } }; From aaef0a2767d9399c802dd657dd4a4d30d62f8c54 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 21:23:52 -0800 Subject: [PATCH 25/34] fix: remove extra handling price calculation Signed-off-by: Erik Kieckhafer --- imports/node-app/core-services/orders/util/addInvoiceToGroup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js index 1b6c49c797d..8f7fd508476 100644 --- a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js +++ b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js @@ -28,7 +28,7 @@ export default function addInvoiceToGroup({ // Fulfillment const shippingTotal = group.shipmentMethod.rate || 0; const handlingTotal = group.shipmentMethod.handling || 0; - const fulfillmentTotal = shippingTotal + handlingTotal; + const fulfillmentTotal = shippingTotal; // Totals // To avoid rounding errors, be sure to keep this calculation the same between here and From 0ba7f50e0778b0db67507a4c6ab58ade45cb1cd2 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 22:13:53 -0800 Subject: [PATCH 26/34] style: lint fix Signed-off-by: Erik Kieckhafer --- imports/node-app/core-services/orders/util/addInvoiceToGroup.js | 1 - 1 file changed, 1 deletion(-) diff --git a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js index 8f7fd508476..edacb39dd0c 100644 --- a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js +++ b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js @@ -27,7 +27,6 @@ export default function addInvoiceToGroup({ // Fulfillment const shippingTotal = group.shipmentMethod.rate || 0; - const handlingTotal = group.shipmentMethod.handling || 0; const fulfillmentTotal = shippingTotal; // Totals From 07598c96d81fbb2b2d71d7515200a0fde0741441 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 20 Dec 2019 22:15:39 -0800 Subject: [PATCH 27/34] refactor: remove unneeded code Signed-off-by: Erik Kieckhafer --- .../node-app/core-services/orders/util/addInvoiceToGroup.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js index edacb39dd0c..bee7c7f8670 100644 --- a/imports/node-app/core-services/orders/util/addInvoiceToGroup.js +++ b/imports/node-app/core-services/orders/util/addInvoiceToGroup.js @@ -26,8 +26,7 @@ export default function addInvoiceToGroup({ const effectiveTaxRate = taxableAmount > 0 ? taxTotal / taxableAmount : 0; // Fulfillment - const shippingTotal = group.shipmentMethod.rate || 0; - const fulfillmentTotal = shippingTotal; + const fulfillmentTotal = group.shipmentMethod.rate || 0; // Totals // To avoid rounding errors, be sure to keep this calculation the same between here and From 3aa27c5c33970e82c7d84346b65dbe84d71e7f59 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Mon, 23 Dec 2019 17:09:01 -0600 Subject: [PATCH 28/34] fix: fix selected fulfillment method in cart total price Signed-off-by: Eric Dobbertin --- .../graphql/server/no-meteor/xforms/cart.js | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js index 60279ca74ce..520a03d949c 100644 --- a/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js +++ b/imports/plugins/core/graphql/server/no-meteor/xforms/cart.js @@ -1,3 +1,4 @@ +import { toFixed } from "accounting-js"; import getRateObjectForRate from "@reactioncommerce/api-utils/getRateObjectForRate.js"; import namespaces from "@reactioncommerce/api-utils/graphql/namespaces.js"; import ReactionError from "@reactioncommerce/reaction-error"; @@ -147,22 +148,27 @@ function xformCartFulfillmentGroup(fulfillmentGroup, cart) { })); let selectedFulfillmentOption = null; - if (fulfillmentGroup.shipmentMethod) { + const { shipmentMethod: selectedShipmentMethod } = fulfillmentGroup; + if (selectedShipmentMethod) { selectedFulfillmentOption = { fulfillmentMethod: { - _id: fulfillmentGroup.shipmentMethod._id, - carrier: fulfillmentGroup.shipmentMethod.carrier || null, - displayName: fulfillmentGroup.shipmentMethod.label || fulfillmentGroup.shipmentMethod.name, - group: fulfillmentGroup.shipmentMethod.group || null, - name: fulfillmentGroup.shipmentMethod.name, - fulfillmentTypes: fulfillmentGroup.shipmentMethod.fulfillmentTypes + _id: selectedShipmentMethod._id, + carrier: selectedShipmentMethod.carrier || null, + displayName: selectedShipmentMethod.label || selectedShipmentMethod.name, + group: selectedShipmentMethod.group || null, + name: selectedShipmentMethod.name, + fulfillmentTypes: selectedShipmentMethod.fulfillmentTypes }, handlingPrice: { - amount: fulfillmentGroup.shipmentMethod.handling || 0, + amount: selectedShipmentMethod.handling || 0, currencyCode: cart.currencyCode }, price: { - amount: fulfillmentGroup.shipmentMethod.rate || 0, + amount: +toFixed((selectedShipmentMethod.handling || 0) + (selectedShipmentMethod.rate || 0), 3), + currencyCode: cart.currencyCode + }, + shippingPrice: { + amount: selectedShipmentMethod.rate || 0, currencyCode: cart.currencyCode } }; From e454bb4b2c24fdda3227774e465564b46fd3aada Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 23 Jan 2020 13:04:33 -0800 Subject: [PATCH 29/34] chore: update config to use `trunk` as the default branch Signed-off-by: Erik Kieckhafer --- .circleci/config.yml | 2 +- .reaction/jsdoc/templates/tmpl/details.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 45d2669ad32..e6a2f25222b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -299,4 +299,4 @@ workflows: - docker-build filters: branches: - only: /^master$/ + only: /^trunk$/ diff --git a/.reaction/jsdoc/templates/tmpl/details.tmpl b/.reaction/jsdoc/templates/tmpl/details.tmpl index 10c37bd57d9..ac58c71733b 100755 --- a/.reaction/jsdoc/templates/tmpl/details.tmpl +++ b/.reaction/jsdoc/templates/tmpl/details.tmpl @@ -14,11 +14,11 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu } function getGitHubLink(meta) { - return "https://github.com/reactioncommerce/reaction/blob/master/" + meta.shortpath + return "https://github.com/reactioncommerce/reaction/blob/trunk/" + meta.shortpath } function getGitHubLinkWithLine(meta) { - return "https://github.com/reactioncommerce/reaction/blame/master/" + meta.shortpath + "#L" + meta.lineno + return "https://github.com/reactioncommerce/reaction/blame/trunk/" + meta.shortpath + "#L" + meta.lineno } ?> From e4cc934b3f5b4d5b134576eaf43801e80b959f50 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 23 Jan 2020 13:14:37 -0800 Subject: [PATCH 30/34] chore: update branch name to trunk in config Signed-off-by: Erik Kieckhafer --- .circleci/bin/docker-tags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/bin/docker-tags b/.circleci/bin/docker-tags index 6560cfaab47..3d89b5d8469 100755 --- a/.circleci/bin/docker-tags +++ b/.circleci/bin/docker-tags @@ -26,7 +26,7 @@ git show-ref --tags -d | grep "^${SHA1}" | sed -e 's,.* refs/tags/,,' -e 's/\^{} echo "%" # Tag with latest if certain conditions are met -if [[ "$BRANCH" == "master" ]]; then +if [[ "$BRANCH" == "trunk" ]]; then # Check to see if we have a valid `vX.X.X` tag and assign to CURRENT_TAG CURRENT_TAG=$( \ git show-ref --tags -d \ From edd7ac21c45b36b1bec12af456d72363ce4ebcad Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 23 Jan 2020 15:50:11 -0800 Subject: [PATCH 31/34] ci: update docker-image Signed-off-by: Erik Kieckhafer --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6a2f25222b..7b599fa2014 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ defaults: &defaults - TOOL_NODE_FLAGS: "--max-old-space-size=4000" working_directory: ~/reaction-app docker: - - image: circleci/node:8-stretch + - image: circleci/node@sha256:deb885eea09fdd008066738298de1c14815e5b200a302c5c25e8d3280060ee6e jobs: build: From 63b28223103202d70cc760ffb2d741513f139327 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 23 Jan 2020 15:56:08 -0800 Subject: [PATCH 32/34] chore: pin sharp version number Signed-off-by: Erik Kieckhafer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cdaa7a6b4d5..679945c4e43 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "reacto-form": "0.0.2", "recompose": "^0.26.0", "shallowequal": "^1.0.2", - "sharp": "^0.20.5", + "sharp": "0.20.5", "simpl-schema": "1.5.0", "slugify": "1.3.1", "store": "^2.0.12", From 9e9caf4da31129d4c7726ff6be1a1d7fc5fbe439 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 23 Jan 2020 15:57:08 -0800 Subject: [PATCH 33/34] revert: docker image Signed-off-by: Erik Kieckhafer --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b599fa2014..e6a2f25222b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ defaults: &defaults - TOOL_NODE_FLAGS: "--max-old-space-size=4000" working_directory: ~/reaction-app docker: - - image: circleci/node@sha256:deb885eea09fdd008066738298de1c14815e5b200a302c5c25e8d3280060ee6e + - image: circleci/node:8-stretch jobs: build: From d89c2ef326598cbd31373479dca1e2778e1a99f0 Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 24 Jan 2020 10:31:49 -0800 Subject: [PATCH 34/34] chore: update CI to use npm install in stead of meteor Signed-off-by: Erik Kieckhafer --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6a2f25222b..98a7814b75f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,8 +40,8 @@ jobs: paths: - ~/.meteor - run: - name: Meteor NPM Install - command: meteor npm install + name: NPM Install + command: npm install - run: name: Build dist bundle command: meteor build --directory ../build/