@commercetools-frontend/mc-scripts 24.10.0 → 24.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +1 -1
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +1 -1
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +1 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +13 -14
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +13 -14
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +13 -14
- package/dist/{build-c91d680c.esm.js → build-1c7d82ef.esm.js} +7 -7
- package/dist/{build-bd986bac.cjs.dev.js → build-895fb1d2.cjs.dev.js} +7 -7
- package/dist/{build-9c26fe58.cjs.prod.js → build-be24f6d9.cjs.prod.js} +7 -7
- package/dist/{build-vite-5d317720.cjs.prod.js → build-vite-4a6c90c2.cjs.prod.js} +9 -8
- package/dist/{build-vite-59e1f185.esm.js → build-vite-85211835.esm.js} +9 -8
- package/dist/{build-vite-16b1a575.cjs.dev.js → build-vite-e26f6c9f.cjs.dev.js} +9 -8
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
- package/dist/{compile-html-f4ac88cc.cjs.dev.js → compile-html-8679f721.cjs.dev.js} +5 -2
- package/dist/{compile-html-025cd493.esm.js → compile-html-adfef598.esm.js} +4 -2
- package/dist/{compile-html-50fd05ec.cjs.prod.js → compile-html-b80f9651.cjs.prod.js} +5 -2
- package/dist/{config-sync-d57260cc.esm.js → config-sync-78ccf97c.esm.js} +79 -69
- package/dist/{config-sync-200c5df5.cjs.prod.js → config-sync-e32e3fa6.cjs.prod.js} +78 -67
- package/dist/{config-sync-6977827c.cjs.dev.js → config-sync-ffddb604.cjs.dev.js} +80 -69
- package/dist/{create-postcss-config-fe3387fa.cjs.prod.js → create-postcss-config-2d574316.cjs.prod.js} +1 -1
- package/dist/{create-postcss-config-152ced99.esm.js → create-postcss-config-3887c44a.esm.js} +1 -1
- package/dist/{create-postcss-config-fd3dee79.cjs.dev.js → create-postcss-config-a47547b4.cjs.dev.js} +1 -1
- package/dist/{create-webpack-config-for-development-527a632e.cjs.prod.js → create-webpack-config-for-development-03c59e8e.cjs.prod.js} +9 -7
- package/dist/{create-webpack-config-for-development-48e5e9d0.esm.js → create-webpack-config-for-development-2c20b570.esm.js} +9 -7
- package/dist/{create-webpack-config-for-development-049a78d6.cjs.dev.js → create-webpack-config-for-development-99b8871e.cjs.dev.js} +9 -7
- package/dist/{create-webpack-config-for-production-9452f0ea.cjs.dev.js → create-webpack-config-for-production-28456828.cjs.dev.js} +7 -7
- package/dist/{create-webpack-config-for-production-5ef997a2.cjs.prod.js → create-webpack-config-for-production-59e18392.cjs.prod.js} +7 -7
- package/dist/{create-webpack-config-for-production-991b35ad.esm.js → create-webpack-config-for-production-94bc1e6d.esm.js} +7 -7
- package/dist/{credentials-storage-0b89aa0e.cjs.prod.js → credentials-storage-381abf27.cjs.prod.js} +1 -1
- package/dist/{credentials-storage-4464313c.esm.js → credentials-storage-7285d7b4.esm.js} +1 -1
- package/dist/{credentials-storage-cbb5c559.cjs.dev.js → credentials-storage-de220814.cjs.dev.js} +1 -1
- package/dist/{deployment-previews-set-93927f50.cjs.prod.js → deployment-previews-set-117c5626.cjs.prod.js} +28 -22
- package/dist/{deployment-previews-set-b9ebe08f.cjs.dev.js → deployment-previews-set-1e263b53.cjs.dev.js} +28 -22
- package/dist/{deployment-previews-set-178cacbc.esm.js → deployment-previews-set-a243363b.esm.js} +27 -22
- package/dist/{graphql-requests-6043a20b.esm.js → graphql-requests-54b9815d.esm.js} +8 -5
- package/dist/{graphql-requests-c5ecf40e.cjs.prod.js → graphql-requests-b4c8c047.cjs.dev.js} +8 -5
- package/dist/{graphql-requests-5527b635.cjs.dev.js → graphql-requests-b89caeb1.cjs.prod.js} +8 -5
- package/dist/{i18n-message-complilation-7311cb29.cjs.dev.js → i18n-message-complilation-393d344a.cjs.prod.js} +1 -1
- package/dist/{i18n-message-complilation-7762da61.cjs.prod.js → i18n-message-complilation-3f80e8d6.cjs.dev.js} +1 -1
- package/dist/{i18n-message-complilation-21d3b0aa.esm.js → i18n-message-complilation-8aec9d1b.esm.js} +1 -1
- package/dist/{login-2c875e0b.esm.js → login-0223db92.esm.js} +32 -23
- package/dist/{login-d7cb2619.cjs.dev.js → login-935abd52.cjs.dev.js} +35 -23
- package/dist/{login-73e9f04f.cjs.prod.js → login-bf7607cf.cjs.prod.js} +35 -23
- package/dist/{optimizations-fb93514f.cjs.prod.js → optimizations-ea21b802.cjs.prod.js} +8 -5
- package/dist/{optimizations-bf991634.esm.js → optimizations-ea71a24a.esm.js} +7 -5
- package/dist/{optimizations-7789145e.cjs.dev.js → optimizations-ebbeaf88.cjs.dev.js} +8 -5
- package/dist/{package-6a5c0475.esm.js → package-31f38f64.esm.js} +10 -10
- package/dist/{package-0d7eef40.cjs.dev.js → package-ad6a5026.cjs.prod.js} +10 -10
- package/dist/{package-c32ced1c.cjs.prod.js → package-dc76e3fe.cjs.dev.js} +10 -10
- package/dist/{paths-39f22b8b.esm.js → paths-7bf7e88e.esm.js} +9 -4
- package/dist/{paths-7768b440.cjs.prod.js → paths-af1a725a.cjs.prod.js} +10 -4
- package/dist/{paths-b76fc753.cjs.dev.js → paths-ec3e3a7d.cjs.dev.js} +10 -4
- package/dist/{serve-50d33f0b.cjs.dev.js → serve-04a03d5f.cjs.dev.js} +6 -4
- package/dist/{serve-8a506da6.cjs.prod.js → serve-2a863026.cjs.prod.js} +6 -4
- package/dist/{serve-1036c2de.esm.js → serve-fb1a0f5a.esm.js} +6 -4
- package/dist/{start-296a8335.cjs.prod.js → start-3a301547.cjs.prod.js} +9 -8
- package/dist/{start-f7aed0ed.esm.js → start-57d1d14c.esm.js} +9 -8
- package/dist/{start-66ec8479.cjs.dev.js → start-7e607d2a.cjs.dev.js} +9 -8
- package/dist/{start-vite-29078b3a.cjs.prod.js → start-vite-d548c121.cjs.prod.js} +4 -3
- package/dist/{start-vite-7d1161e8.esm.js → start-vite-d649d1f3.esm.js} +4 -3
- package/dist/{start-vite-068e9f73.cjs.dev.js → start-vite-eea72ba9.cjs.dev.js} +4 -3
- package/dist/{vite-plugin-svgr-de6ee7da.esm.js → vite-plugin-svgr-22c8d518.esm.js} +4 -4
- package/dist/{vite-plugin-svgr-4034a834.cjs.prod.js → vite-plugin-svgr-53ef97c7.cjs.dev.js} +4 -4
- package/dist/{vite-plugin-svgr-7d06f400.cjs.dev.js → vite-plugin-svgr-5de1cad9.cjs.prod.js} +4 -4
- package/package.json +10 -10
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +6 -6
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +6 -6
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +6 -6
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +1 -1
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +1 -1
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
4
5
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
5
6
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
6
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -9,7 +10,7 @@ var chalk = require('chalk');
|
|
|
9
10
|
var omit = require('lodash/omit');
|
|
10
11
|
var prompts = require('prompts');
|
|
11
12
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
12
|
-
var credentialsStorage$1 = require('./credentials-storage-
|
|
13
|
+
var credentialsStorage$1 = require('./credentials-storage-381abf27.cjs.prod.js');
|
|
13
14
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
14
15
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
15
16
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
@@ -21,7 +22,7 @@ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
|
21
22
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
22
23
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
23
24
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
24
|
-
var graphqlRequests = require('./graphql-requests-
|
|
25
|
+
var graphqlRequests = require('./graphql-requests-b89caeb1.cjs.prod.js');
|
|
25
26
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
26
27
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
27
28
|
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
@@ -34,10 +35,11 @@ require('graphql');
|
|
|
34
35
|
require('graphql-request');
|
|
35
36
|
require('@commercetools-frontend/constants');
|
|
36
37
|
require('@commercetools/http-user-agent');
|
|
37
|
-
require('./package-
|
|
38
|
+
require('./package-ad6a5026.cjs.prod.js');
|
|
38
39
|
|
|
39
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
40
41
|
|
|
42
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
41
43
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
42
44
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
43
45
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -57,7 +59,7 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
57
59
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
58
60
|
|
|
59
61
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
60
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
62
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context21, _context22; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context21 = ownKeys(Object(t), !0)).call(_context21, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context22 = ownKeys(Object(t))).call(_context22, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
61
63
|
const red = str => {
|
|
62
64
|
return chalk__default["default"].red(str);
|
|
63
65
|
};
|
|
@@ -77,13 +79,16 @@ const getStringDiff = _ref => {
|
|
|
77
79
|
_ref$indentLevel = _ref.indentLevel,
|
|
78
80
|
indentLevel = _ref$indentLevel === void 0 ? 0 : _ref$indentLevel;
|
|
79
81
|
if (!previousValue && nextValue) {
|
|
80
|
-
|
|
82
|
+
var _context2, _context3;
|
|
83
|
+
return _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(indent(indentLevel))).call(_context3, label, " added: ")).call(_context2, green(nextValue));
|
|
81
84
|
}
|
|
82
85
|
if (previousValue && !nextValue) {
|
|
83
|
-
|
|
86
|
+
var _context4, _context5;
|
|
87
|
+
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(indent(indentLevel))).call(_context5, label, " removed: ")).call(_context4, red(previousValue));
|
|
84
88
|
}
|
|
85
89
|
if (previousValue && nextValue && previousValue !== nextValue) {
|
|
86
|
-
|
|
90
|
+
var _context6, _context7, _context8;
|
|
91
|
+
return _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = "".concat(indent(indentLevel))).call(_context8, label, " changed: ")).call(_context7, red(previousValue), " => ")).call(_context6, green(nextValue));
|
|
87
92
|
}
|
|
88
93
|
return null;
|
|
89
94
|
};
|
|
@@ -96,7 +101,7 @@ const getArrayDiff = _ref2 => {
|
|
|
96
101
|
indentLevel = _ref2$indentLevel === void 0 ? 0 : _ref2$indentLevel;
|
|
97
102
|
const oldArraySet = new _Set__default["default"](previousValue);
|
|
98
103
|
const arrayDiff = [];
|
|
99
|
-
nextValue
|
|
104
|
+
nextValue === null || nextValue === void 0 || _forEachInstanceProperty__default["default"](nextValue).call(nextValue, item => {
|
|
100
105
|
if (oldArraySet.has(item)) {
|
|
101
106
|
oldArraySet.delete(item);
|
|
102
107
|
} else {
|
|
@@ -117,7 +122,7 @@ const getArrayDiff = _ref2 => {
|
|
|
117
122
|
return arrayDiff.join('\n');
|
|
118
123
|
};
|
|
119
124
|
const getPermissionsDiff = _ref3 => {
|
|
120
|
-
var
|
|
125
|
+
var _context1;
|
|
121
126
|
let previousValue = _ref3.previousValue,
|
|
122
127
|
nextValue = _ref3.nextValue;
|
|
123
128
|
const permissionDiff = ['permissions changed'];
|
|
@@ -130,10 +135,12 @@ const getPermissionsDiff = _ref3 => {
|
|
|
130
135
|
}, {});
|
|
131
136
|
const indentLevel = 1;
|
|
132
137
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newPermission => {
|
|
133
|
-
|
|
138
|
+
var _context9;
|
|
139
|
+
const currentDiff = [_concatInstanceProperty__default["default"](_context9 = "".concat(indent(indentLevel), "\"")).call(_context9, newPermission.name, "\" changed")];
|
|
134
140
|
// if the permission name is not in the old config, it means it is a new addition.
|
|
135
141
|
if (!mappedOldPermissions[newPermission.name]) {
|
|
136
|
-
|
|
142
|
+
var _context0;
|
|
143
|
+
permissionDiff.push(_concatInstanceProperty__default["default"](_context0 = "".concat(indent(indentLevel), "\"")).call(_context0, green(newPermission.name), "\" was added"));
|
|
137
144
|
}
|
|
138
145
|
|
|
139
146
|
// if permission name is in the old config, now we check if there was a change
|
|
@@ -150,21 +157,22 @@ const getPermissionsDiff = _ref3 => {
|
|
|
150
157
|
});
|
|
151
158
|
|
|
152
159
|
// if there are old permissions left, it means they were deleted in the new Permissions.
|
|
153
|
-
_forEachInstanceProperty__default["default"](
|
|
154
|
-
|
|
160
|
+
_forEachInstanceProperty__default["default"](_context1 = _Object$keys__default["default"](mappedOldPermissions)).call(_context1, oldPermissionName => {
|
|
161
|
+
var _context10;
|
|
162
|
+
permissionDiff.push(_concatInstanceProperty__default["default"](_context10 = "".concat(indent(indentLevel), "\"")).call(_context10, red(oldPermissionName), "\" was removed"));
|
|
155
163
|
});
|
|
156
164
|
if (permissionDiff.length > 1) return permissionDiff.join('\n');
|
|
157
165
|
return null;
|
|
158
166
|
};
|
|
159
167
|
const getLabelAllLocalesDiff = _ref5 => {
|
|
160
|
-
var
|
|
168
|
+
var _context14;
|
|
161
169
|
let _ref5$previousValue = _ref5.previousValue,
|
|
162
170
|
previousValue = _ref5$previousValue === void 0 ? [] : _ref5$previousValue,
|
|
163
171
|
_ref5$nextValue = _ref5.nextValue,
|
|
164
172
|
nextValue = _ref5$nextValue === void 0 ? [] : _ref5$nextValue,
|
|
165
173
|
_ref5$indentLevel = _ref5.indentLevel,
|
|
166
174
|
indentLevel = _ref5$indentLevel === void 0 ? 0 : _ref5$indentLevel;
|
|
167
|
-
const labelAllLocalesDiff = [
|
|
175
|
+
const labelAllLocalesDiff = ["".concat(indent(indentLevel - 1), "labelAllLocales changed")];
|
|
168
176
|
const mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
|
|
169
177
|
let locale = _ref6.locale,
|
|
170
178
|
value = _ref6.value;
|
|
@@ -176,7 +184,8 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
176
184
|
if (newLabelAllLocale.locale in mappedOldLabelAllLocales) {
|
|
177
185
|
const oldLocaleValue = mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
178
186
|
if (oldLocaleValue !== newLabelAllLocale.value) {
|
|
179
|
-
|
|
187
|
+
var _context11, _context12, _context13;
|
|
188
|
+
labelAllLocalesDiff.push(_concatInstanceProperty__default["default"](_context11 = _concatInstanceProperty__default["default"](_context12 = _concatInstanceProperty__default["default"](_context13 = "".concat(indent(indentLevel), "locale \"")).call(_context13, newLabelAllLocale.locale, "\" changed: ")).call(_context12, red(oldLocaleValue), " => ")).call(_context11, green(newLabelAllLocale.value)));
|
|
180
189
|
}
|
|
181
190
|
delete mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
182
191
|
} else {
|
|
@@ -190,7 +199,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
});
|
|
193
|
-
_forEachInstanceProperty__default["default"](
|
|
202
|
+
_forEachInstanceProperty__default["default"](_context14 = _Object$keys__default["default"](mappedOldLabelAllLocales)).call(_context14, key => {
|
|
194
203
|
const localeDiff = getStringDiff({
|
|
195
204
|
previousValue: key,
|
|
196
205
|
label: 'locale',
|
|
@@ -204,14 +213,14 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
204
213
|
return null;
|
|
205
214
|
};
|
|
206
215
|
const getTypeSettingsDiff = _ref7 => {
|
|
207
|
-
var
|
|
216
|
+
var _context15;
|
|
208
217
|
let previousValue = _ref7.previousValue,
|
|
209
218
|
nextValue = _ref7.nextValue;
|
|
210
219
|
const nonNullablePreviousValue = previousValue || {};
|
|
211
220
|
const nonNullableNextValue = nextValue || {};
|
|
212
221
|
const indentLevel = 1;
|
|
213
|
-
const typeSettingsDiff = [
|
|
214
|
-
_forEachInstanceProperty__default["default"](
|
|
222
|
+
const typeSettingsDiff = ["".concat(indent(indentLevel - 1), "type settings changed")];
|
|
223
|
+
_forEachInstanceProperty__default["default"](_context15 = _Object$keys__default["default"](nonNullablePreviousValue)).call(_context15, key => {
|
|
215
224
|
const typeSettingDiff = getStringDiff({
|
|
216
225
|
previousValue: nonNullablePreviousValue[key],
|
|
217
226
|
nextValue: nonNullableNextValue[key],
|
|
@@ -261,7 +270,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
261
270
|
indentLevel: 2
|
|
262
271
|
});
|
|
263
272
|
if (mainMenuLinkPermissionsDiff.length > 0) {
|
|
264
|
-
mainMenuLinkDiff.push(
|
|
273
|
+
mainMenuLinkDiff.push("".concat(indent(1), "permissions changed"));
|
|
265
274
|
mainMenuLinkDiff.push(mainMenuLinkPermissionsDiff);
|
|
266
275
|
}
|
|
267
276
|
const menuLabelsDiff = getLabelAllLocalesDiff({
|
|
@@ -277,7 +286,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
277
286
|
return null;
|
|
278
287
|
};
|
|
279
288
|
const getSubmenuLinksDiff = _ref0 => {
|
|
280
|
-
var
|
|
289
|
+
var _context20;
|
|
281
290
|
let previousValue = _ref0.previousValue,
|
|
282
291
|
nextValue = _ref0.nextValue;
|
|
283
292
|
const submenuLinksDiff = ['submenuLink changed'];
|
|
@@ -288,16 +297,17 @@ const getSubmenuLinksDiff = _ref0 => {
|
|
|
288
297
|
const previousOrder = getOrder(previousValue);
|
|
289
298
|
const newOrder = getOrder(nextValue);
|
|
290
299
|
if (previousOrder !== newOrder) {
|
|
291
|
-
|
|
292
|
-
submenuLinksDiff.push(
|
|
293
|
-
submenuLinksDiff.push(
|
|
300
|
+
var _context16, _context17;
|
|
301
|
+
submenuLinksDiff.push("".concat(indent(1), "submenu order changed"));
|
|
302
|
+
submenuLinksDiff.push(_concatInstanceProperty__default["default"](_context16 = "".concat(indent(2), "previous order: [")).call(_context16, previousOrder, "]"));
|
|
303
|
+
submenuLinksDiff.push(_concatInstanceProperty__default["default"](_context17 = "".concat(indent(2), "new order: [")).call(_context17, newOrder, "]"));
|
|
294
304
|
}
|
|
295
305
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newSubmenuLink => {
|
|
296
306
|
const oldSubMenuLink = mappedSubmenuLinks[newSubmenuLink.uriPath];
|
|
297
307
|
if (newSubmenuLink.uriPath in mappedSubmenuLinks) {
|
|
298
|
-
var
|
|
299
|
-
const submenuLinkDiff = [
|
|
300
|
-
_forEachInstanceProperty__default["default"](
|
|
308
|
+
var _context18, _context19;
|
|
309
|
+
const submenuLinkDiff = [_concatInstanceProperty__default["default"](_context18 = "".concat(indent(1), "menu link \"")).call(_context18, newSubmenuLink.uriPath, "\" changed")];
|
|
310
|
+
_forEachInstanceProperty__default["default"](_context19 = _Object$keys__default["default"](mappedSubmenuLinks[newSubmenuLink.uriPath])).call(_context19, key => {
|
|
301
311
|
switch (key) {
|
|
302
312
|
case 'defaultLabel':
|
|
303
313
|
{
|
|
@@ -321,7 +331,7 @@ const getSubmenuLinksDiff = _ref0 => {
|
|
|
321
331
|
indentLevel: 3
|
|
322
332
|
});
|
|
323
333
|
if (submenuLinkPermissionsDiff.length > 0) {
|
|
324
|
-
submenuLinkDiff.push(
|
|
334
|
+
submenuLinkDiff.push("".concat(indent(2), "permissions changed"));
|
|
325
335
|
submenuLinkDiff.push(submenuLinkPermissionsDiff);
|
|
326
336
|
}
|
|
327
337
|
break;
|
|
@@ -356,7 +366,7 @@ const getSubmenuLinksDiff = _ref0 => {
|
|
|
356
366
|
}
|
|
357
367
|
}
|
|
358
368
|
});
|
|
359
|
-
_forEachInstanceProperty__default["default"](
|
|
369
|
+
_forEachInstanceProperty__default["default"](_context20 = _Object$keys__default["default"](mappedSubmenuLinks)).call(_context20, key => {
|
|
360
370
|
const linksDiff = getStringDiff({
|
|
361
371
|
previousValue: key,
|
|
362
372
|
label: 'menu link',
|
|
@@ -531,17 +541,18 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
|
|
|
531
541
|
|
|
532
542
|
const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
|
|
533
543
|
const getMcUrlLink = _ref => {
|
|
544
|
+
var _context, _context2, _context3;
|
|
534
545
|
let mcApiUrl = _ref.mcApiUrl,
|
|
535
546
|
organizationId = _ref.organizationId,
|
|
536
547
|
customEntityId = _ref.customEntityId,
|
|
537
548
|
isCustomView = _ref.isCustomView;
|
|
538
549
|
const mcUrl = mcApiUrl.replace('mc-api', 'mc');
|
|
539
|
-
const customEntityLink =
|
|
550
|
+
const customEntityLink = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(mcUrl, "/account/organizations/")).call(_context3, organizationId, "/custom-")).call(_context2, isCustomView ? 'views' : 'applications', "/owned/")).call(_context, customEntityId);
|
|
540
551
|
return customEntityLink;
|
|
541
552
|
};
|
|
542
553
|
const isCustomViewData = data => data.entryPointUriPath === undefined;
|
|
543
554
|
async function createOrUpdateCustomApplication(_ref2) {
|
|
544
|
-
var
|
|
555
|
+
var _context6;
|
|
545
556
|
let mcApiUrl = _ref2.mcApiUrl,
|
|
546
557
|
localCustomEntityData = _ref2.localCustomEntityData,
|
|
547
558
|
applicationIdentifier = _ref2.applicationIdentifier,
|
|
@@ -552,14 +563,14 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
552
563
|
applicationIdentifier
|
|
553
564
|
});
|
|
554
565
|
if (!fetchedCustomApplication) {
|
|
555
|
-
var
|
|
566
|
+
var _context5;
|
|
556
567
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
557
568
|
mcApiUrl,
|
|
558
569
|
applicationIdentifier
|
|
559
570
|
});
|
|
560
571
|
let organizationId, organizationName;
|
|
561
572
|
if (userOrganizations.total === 0) {
|
|
562
|
-
throw new Error(
|
|
573
|
+
throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.");
|
|
563
574
|
}
|
|
564
575
|
if (userOrganizations.total === 1) {
|
|
565
576
|
const _userOrganizations$re = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -567,8 +578,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
567
578
|
organizationId = organization.id;
|
|
568
579
|
organizationName = organization.name;
|
|
569
580
|
} else {
|
|
570
|
-
var
|
|
571
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
581
|
+
var _context4;
|
|
582
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context4 = userOrganizations.results).call(_context4, organization => ({
|
|
572
583
|
title: organization.name,
|
|
573
584
|
value: organization.id
|
|
574
585
|
}));
|
|
@@ -581,7 +592,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
581
592
|
}),
|
|
582
593
|
selectedOrganizationId = _await$prompts.organizationId;
|
|
583
594
|
if (!selectedOrganizationId) {
|
|
584
|
-
throw new Error(
|
|
595
|
+
throw new Error("No Organization selected, aborting.");
|
|
585
596
|
}
|
|
586
597
|
organizationId = selectedOrganizationId;
|
|
587
598
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref3 => {
|
|
@@ -592,7 +603,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
592
603
|
const _await$prompts2 = await prompts__default["default"]({
|
|
593
604
|
type: 'text',
|
|
594
605
|
name: 'confirmation',
|
|
595
|
-
message: _filterInstanceProperty__default["default"](
|
|
606
|
+
message: _filterInstanceProperty__default["default"](_context5 = ["You are about to create a new Custom Application in the \"".concat(chalk__default["default"].green(organizationName), "\" organization. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be created.')]).call(_context5, Boolean).join('\n'),
|
|
596
607
|
initial: 'yes'
|
|
597
608
|
}),
|
|
598
609
|
confirmation = _await$prompts2.confirmation;
|
|
@@ -603,7 +614,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
603
614
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
604
615
|
if (options.dryRun) {
|
|
605
616
|
console.log();
|
|
606
|
-
console.log(
|
|
617
|
+
console.log("The following payload would be used to create a new Custom Application.");
|
|
607
618
|
console.log();
|
|
608
619
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
609
620
|
return;
|
|
@@ -627,8 +638,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
627
638
|
organizationId,
|
|
628
639
|
customEntityId: createdCustomApplication.id
|
|
629
640
|
});
|
|
630
|
-
console.log(chalk__default["default"].green(
|
|
631
|
-
console.log(
|
|
641
|
+
console.log(chalk__default["default"].green("Custom Application created.\nPlease update the \"env.production.applicationId\" field in your local Custom Application config file with the following value: \"".concat(chalk__default["default"].green(createdCustomApplication.id), "\".")));
|
|
642
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
632
643
|
return;
|
|
633
644
|
}
|
|
634
645
|
const customAppLink = getMcUrlLink({
|
|
@@ -638,8 +649,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
638
649
|
});
|
|
639
650
|
const configDiff = getCustomApplicationConfigDiff(fetchedCustomApplication.application, localCustomEntityData);
|
|
640
651
|
if (!configDiff) {
|
|
641
|
-
console.log(chalk__default["default"].green(
|
|
642
|
-
console.log(
|
|
652
|
+
console.log(chalk__default["default"].green("Custom Application up-to-date."));
|
|
653
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
643
654
|
return;
|
|
644
655
|
}
|
|
645
656
|
console.log('Changes detected:');
|
|
@@ -648,7 +659,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
648
659
|
const _await$prompts3 = await prompts__default["default"]({
|
|
649
660
|
type: 'text',
|
|
650
661
|
name: 'confirmation',
|
|
651
|
-
message: _filterInstanceProperty__default["default"](
|
|
662
|
+
message: _filterInstanceProperty__default["default"](_context6 = ["You are about to update the Custom Application \"".concat(chalk__default["default"].green(localCustomEntityData.entryPointUriPath), "\" with the changes above. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be updated.')]).call(_context6, Boolean).join('\n'),
|
|
652
663
|
initial: 'yes'
|
|
653
664
|
}),
|
|
654
665
|
confirmation = _await$prompts3.confirmation;
|
|
@@ -659,7 +670,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
659
670
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
660
671
|
if (options.dryRun) {
|
|
661
672
|
console.log();
|
|
662
|
-
console.log(
|
|
673
|
+
console.log("The following payload would be used to update the Custom Application \"".concat(chalk__default["default"].green(data.entryPointUriPath), "\"."));
|
|
663
674
|
console.log();
|
|
664
675
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
665
676
|
return;
|
|
@@ -671,11 +682,11 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
671
682
|
applicationId: fetchedCustomApplication.application.id,
|
|
672
683
|
applicationIdentifier
|
|
673
684
|
});
|
|
674
|
-
console.log(chalk__default["default"].green(
|
|
675
|
-
console.log(
|
|
685
|
+
console.log(chalk__default["default"].green("Custom Application updated."));
|
|
686
|
+
console.log("You can inspect the Custom Application data in the Merchant Center at \"".concat(chalk__default["default"].gray(customAppLink), "\"."));
|
|
676
687
|
}
|
|
677
688
|
async function createOrUpdateCustomView(_ref4) {
|
|
678
|
-
var
|
|
689
|
+
var _fetchedCustomView$cu, _context9, _fetchedCustomView$cu2;
|
|
679
690
|
let mcApiUrl = _ref4.mcApiUrl,
|
|
680
691
|
localCustomEntityData = _ref4.localCustomEntityData,
|
|
681
692
|
customViewId = _ref4.customViewId,
|
|
@@ -687,7 +698,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
687
698
|
applicationIdentifier
|
|
688
699
|
});
|
|
689
700
|
if (!fetchedCustomView) {
|
|
690
|
-
var
|
|
701
|
+
var _context8;
|
|
691
702
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
692
703
|
mcApiUrl,
|
|
693
704
|
customViewId,
|
|
@@ -695,7 +706,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
695
706
|
});
|
|
696
707
|
let organizationId, organizationName;
|
|
697
708
|
if (userOrganizations.total === 0) {
|
|
698
|
-
throw new Error(
|
|
709
|
+
throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom View to be configured to.");
|
|
699
710
|
}
|
|
700
711
|
if (userOrganizations.total === 1) {
|
|
701
712
|
const _userOrganizations$re2 = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -703,8 +714,8 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
703
714
|
organizationId = organization.id;
|
|
704
715
|
organizationName = organization.name;
|
|
705
716
|
} else {
|
|
706
|
-
var
|
|
707
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
717
|
+
var _context7;
|
|
718
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context7 = userOrganizations.results).call(_context7, organization => ({
|
|
708
719
|
title: organization.name,
|
|
709
720
|
value: organization.id
|
|
710
721
|
}));
|
|
@@ -717,7 +728,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
717
728
|
}),
|
|
718
729
|
selectedOrganizationId = _await$prompts4.organizationId;
|
|
719
730
|
if (!selectedOrganizationId) {
|
|
720
|
-
throw new Error(
|
|
731
|
+
throw new Error("No Organization selected, aborting.");
|
|
721
732
|
}
|
|
722
733
|
organizationId = selectedOrganizationId;
|
|
723
734
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref5 => {
|
|
@@ -728,7 +739,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
728
739
|
const _await$prompts5 = await prompts__default["default"]({
|
|
729
740
|
type: 'text',
|
|
730
741
|
name: 'confirmation',
|
|
731
|
-
message: _filterInstanceProperty__default["default"](
|
|
742
|
+
message: _filterInstanceProperty__default["default"](_context8 = ["You are about to create a new Custom View in the \"".concat(chalk__default["default"].green(organizationName), "\" organization. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be created.')]).call(_context8, Boolean).join('\n'),
|
|
732
743
|
initial: 'yes'
|
|
733
744
|
}),
|
|
734
745
|
confirmation = _await$prompts5.confirmation;
|
|
@@ -739,7 +750,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
739
750
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
740
751
|
if (options.dryRun) {
|
|
741
752
|
console.log();
|
|
742
|
-
console.log(
|
|
753
|
+
console.log("The following payload would be used to create a new Custom View.");
|
|
743
754
|
console.log();
|
|
744
755
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
745
756
|
return;
|
|
@@ -764,20 +775,20 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
764
775
|
customEntityId: createdCustomView.id,
|
|
765
776
|
isCustomView: true
|
|
766
777
|
});
|
|
767
|
-
console.log(chalk__default["default"].green(
|
|
768
|
-
console.log(
|
|
778
|
+
console.log(chalk__default["default"].green("Custom View created.\nPlease update the \"env.production.customViewId\" field in your local Custom View config file with the following value: \"".concat(chalk__default["default"].green(createdCustomView.id), "\".")));
|
|
779
|
+
console.log("You can inspect the Custom View data in the Merchant Center at \"".concat(chalk__default["default"].gray(customViewLink), "\"."));
|
|
769
780
|
return;
|
|
770
781
|
}
|
|
771
782
|
const customViewLink = getMcUrlLink({
|
|
772
783
|
mcApiUrl,
|
|
773
784
|
organizationId: fetchedCustomView.organizationId,
|
|
774
|
-
customEntityId: fetchedCustomView
|
|
785
|
+
customEntityId: (fetchedCustomView === null || fetchedCustomView === void 0 || (_fetchedCustomView$cu = fetchedCustomView.customView) === null || _fetchedCustomView$cu === void 0 ? void 0 : _fetchedCustomView$cu.id) || '',
|
|
775
786
|
isCustomView: true
|
|
776
787
|
});
|
|
777
788
|
const configDiff = getCustomViewConfigDiff(fetchedCustomView.customView, localCustomEntityData);
|
|
778
789
|
if (!configDiff) {
|
|
779
|
-
console.log(chalk__default["default"].green(
|
|
780
|
-
console.log(
|
|
790
|
+
console.log(chalk__default["default"].green("Custom View up-to-date."));
|
|
791
|
+
console.log("You can inspect the Custom View data in the Merchant Center at \"".concat(chalk__default["default"].gray(customViewLink), "\"."));
|
|
781
792
|
return;
|
|
782
793
|
}
|
|
783
794
|
console.log('Changes detected:');
|
|
@@ -786,7 +797,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
786
797
|
const _await$prompts6 = await prompts__default["default"]({
|
|
787
798
|
type: 'text',
|
|
788
799
|
name: 'confirmation',
|
|
789
|
-
message: _filterInstanceProperty__default["default"](
|
|
800
|
+
message: _filterInstanceProperty__default["default"](_context9 = ["You are about to update the Custom View \"".concat(chalk__default["default"].green(localCustomEntityData.defaultLabel), "\" with the changes above. Are you sure you want to proceed?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no data will be updated.')]).call(_context9, Boolean).join('\n'),
|
|
790
801
|
initial: 'yes'
|
|
791
802
|
}),
|
|
792
803
|
confirmation = _await$prompts6.confirmation;
|
|
@@ -797,7 +808,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
797
808
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
798
809
|
if (options.dryRun) {
|
|
799
810
|
console.log();
|
|
800
|
-
console.log(
|
|
811
|
+
console.log("The following payload would be used to update the Custom View \"".concat(chalk__default["default"].green(data.defaultLabel), "\"."));
|
|
801
812
|
console.log();
|
|
802
813
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
803
814
|
return;
|
|
@@ -806,11 +817,11 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
806
817
|
mcApiUrl,
|
|
807
818
|
organizationId: fetchedCustomView.organizationId,
|
|
808
819
|
data: omit__default["default"](localCustomEntityData, ['id']),
|
|
809
|
-
customViewId: fetchedCustomView
|
|
820
|
+
customViewId: (fetchedCustomView === null || fetchedCustomView === void 0 || (_fetchedCustomView$cu2 = fetchedCustomView.customView) === null || _fetchedCustomView$cu2 === void 0 ? void 0 : _fetchedCustomView$cu2.id) || '',
|
|
810
821
|
applicationIdentifier
|
|
811
822
|
});
|
|
812
|
-
console.log(chalk__default["default"].green(
|
|
813
|
-
console.log(
|
|
823
|
+
console.log(chalk__default["default"].green("Custom View updated."));
|
|
824
|
+
console.log("You can inspect the Custom View data in the Merchant Center at \"".concat(chalk__default["default"].gray(customViewLink), "\"."));
|
|
814
825
|
}
|
|
815
826
|
async function run(options) {
|
|
816
827
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
@@ -819,11 +830,11 @@ async function run(options) {
|
|
|
819
830
|
mcApiUrl = _applicationConfig$en.mcApiUrl,
|
|
820
831
|
applicationIdentifier = _applicationConfig$en.applicationIdentifier,
|
|
821
832
|
customViewId = _applicationConfig$en.customViewId;
|
|
822
|
-
console.log(
|
|
833
|
+
console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
|
|
823
834
|
console.log();
|
|
824
835
|
const isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
825
836
|
if (!isSessionValid) {
|
|
826
|
-
throw new Error(
|
|
837
|
+
throw new Error("You don't have a valid session. Please, run the \"mc-scripts login\" command to authenticate yourself.");
|
|
827
838
|
}
|
|
828
839
|
if (isCustomViewData(localCustomEntityData)) {
|
|
829
840
|
createOrUpdateCustomView({
|