@commercetools-frontend/mc-scripts 22.30.2 → 22.31.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 +19 -19
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +19 -19
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +19 -19
- package/dist/{build-f86a84a7.cjs.dev.js → build-08fc2868.cjs.dev.js} +6 -6
- package/dist/{build-14007257.esm.js → build-b00da074.esm.js} +6 -6
- package/dist/{build-9031cc94.cjs.prod.js → build-bfc9ead3.cjs.prod.js} +6 -6
- package/dist/{build-vite-87662f4d.cjs.dev.js → build-vite-14eeea5d.cjs.dev.js} +7 -8
- package/dist/{build-vite-b19a39fb.esm.js → build-vite-71767c7d.esm.js} +7 -8
- package/dist/{build-vite-c7ccff49.cjs.prod.js → build-vite-cefb3775.cjs.prod.js} +7 -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-adfef598.esm.js → compile-html-025cd493.esm.js} +2 -4
- package/dist/{compile-html-b80f9651.cjs.prod.js → compile-html-50fd05ec.cjs.prod.js} +2 -5
- package/dist/{compile-html-8679f721.cjs.dev.js → compile-html-f4ac88cc.cjs.dev.js} +2 -5
- package/dist/{config-sync-b325191e.cjs.prod.js → config-sync-a76e45e3.cjs.prod.js} +64 -74
- package/dist/{config-sync-1724cc9a.cjs.dev.js → config-sync-b2172892.cjs.dev.js} +66 -76
- package/dist/{config-sync-fc206c13.esm.js → config-sync-e5aa853f.esm.js} +66 -75
- package/dist/{create-postcss-config-057a555f.cjs.prod.js → create-postcss-config-4636f5c9.cjs.prod.js} +1 -1
- package/dist/{create-postcss-config-0617df94.cjs.dev.js → create-postcss-config-ce058cc5.cjs.dev.js} +1 -1
- package/dist/{create-postcss-config-807412fe.esm.js → create-postcss-config-e3ad83aa.esm.js} +1 -1
- package/dist/{create-webpack-config-for-development-568a4b28.cjs.dev.js → create-webpack-config-for-development-154ee43f.cjs.dev.js} +5 -5
- package/dist/{create-webpack-config-for-development-506dcdae.esm.js → create-webpack-config-for-development-aabb9a02.esm.js} +5 -5
- package/dist/{create-webpack-config-for-development-57671ec4.cjs.prod.js → create-webpack-config-for-development-b65498a3.cjs.prod.js} +5 -5
- package/dist/{create-webpack-config-for-production-7acd5767.cjs.dev.js → create-webpack-config-for-production-ce81f82b.cjs.dev.js} +6 -6
- package/dist/{create-webpack-config-for-production-44bd9918.esm.js → create-webpack-config-for-production-e8ba7a77.esm.js} +6 -6
- package/dist/{create-webpack-config-for-production-98a57ade.cjs.prod.js → create-webpack-config-for-production-f2aadce3.cjs.prod.js} +6 -6
- package/dist/{credentials-storage-c561765b.cjs.prod.js → credentials-storage-cac35ba6.cjs.prod.js} +2 -2
- package/dist/{credentials-storage-60d64f06.cjs.dev.js → credentials-storage-e3abd27b.cjs.dev.js} +2 -2
- package/dist/{credentials-storage-c04d4f40.esm.js → credentials-storage-eb6f9e03.esm.js} +2 -2
- package/dist/{deployment-previews-set-8e61ad4a.cjs.dev.js → deployment-previews-set-1fd17456.cjs.dev.js} +22 -28
- package/dist/{deployment-previews-set-46ac7db8.cjs.prod.js → deployment-previews-set-3c88d175.cjs.prod.js} +22 -28
- package/dist/{deployment-previews-set-e6668f10.esm.js → deployment-previews-set-ca0b28cb.esm.js} +22 -27
- package/dist/{graphql-requests-374900f3.cjs.dev.js → graphql-requests-0887e583.cjs.prod.js} +3 -6
- package/dist/{graphql-requests-4a3570d5.esm.js → graphql-requests-7e319ebc.esm.js} +3 -6
- package/dist/{graphql-requests-b46c1a1f.cjs.prod.js → graphql-requests-b05fd260.cjs.dev.js} +3 -6
- package/dist/{i18n-message-complilation-8aec9d1b.esm.js → i18n-message-complilation-21d3b0aa.esm.js} +1 -1
- package/dist/{i18n-message-complilation-3f80e8d6.cjs.dev.js → i18n-message-complilation-7311cb29.cjs.dev.js} +1 -1
- package/dist/{i18n-message-complilation-393d344a.cjs.prod.js → i18n-message-complilation-7762da61.cjs.prod.js} +1 -1
- package/dist/{login-ae73724b.cjs.dev.js → login-5fa5604e.cjs.dev.js} +8 -8
- package/dist/{login-caf53bc3.esm.js → login-7f5bb79c.esm.js} +8 -8
- package/dist/{login-8982f184.cjs.prod.js → login-829a1b56.cjs.prod.js} +8 -8
- package/dist/{package-15bc96fe.cjs.dev.js → package-378cc0b4.cjs.prod.js} +8 -8
- package/dist/{package-7793b7ec.cjs.prod.js → package-3a9024e1.cjs.dev.js} +8 -8
- package/dist/{package-f33bb0fc.esm.js → package-9a7b7976.esm.js} +8 -8
- package/dist/{paths-7bf7e88e.esm.js → paths-39f22b8b.esm.js} +4 -9
- package/dist/{paths-af1a725a.cjs.prod.js → paths-7768b440.cjs.prod.js} +4 -10
- package/dist/{paths-ec3e3a7d.cjs.dev.js → paths-b76fc753.cjs.dev.js} +4 -10
- package/dist/{serve-7b2e35a1.cjs.prod.js → serve-5666b16a.cjs.prod.js} +2 -3
- package/dist/{serve-5f480513.esm.js → serve-6a951584.esm.js} +2 -3
- package/dist/{serve-efceb930.cjs.dev.js → serve-f898c45e.cjs.dev.js} +2 -3
- package/dist/{start-c1143111.cjs.dev.js → start-58d4a0d4.cjs.dev.js} +7 -8
- package/dist/{start-2c728521.esm.js → start-7877df72.esm.js} +7 -8
- package/dist/{start-5bd6fd2b.cjs.prod.js → start-df494b7b.cjs.prod.js} +7 -8
- package/dist/{start-vite-8e72a6a9.cjs.prod.js → start-vite-1f2a92bd.cjs.prod.js} +3 -4
- package/dist/{start-vite-7d25a064.cjs.dev.js → start-vite-ce32d36a.cjs.dev.js} +3 -4
- package/dist/{start-vite-e706f764.esm.js → start-vite-d68b39d3.esm.js} +3 -4
- package/dist/{vite-plugin-svgr-13d96e7a.esm.js → vite-plugin-svgr-069f402d.esm.js} +2 -2
- package/dist/{vite-plugin-svgr-7def8ea1.cjs.prod.js → vite-plugin-svgr-7fb42bbf.cjs.dev.js} +2 -2
- package/dist/{vite-plugin-svgr-496f5b25.cjs.dev.js → vite-plugin-svgr-b080c510.cjs.prod.js} +2 -2
- package/package.json +8 -8
- 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 +5 -5
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +5 -5
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +5 -5
- 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,7 +1,6 @@
|
|
|
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');
|
|
5
4
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
6
5
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
7
6
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,7 +9,7 @@ var chalk = require('chalk');
|
|
|
10
9
|
var omit = require('lodash/omit');
|
|
11
10
|
var prompts = require('prompts');
|
|
12
11
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
13
|
-
var credentialsStorage$1 = require('./credentials-storage-
|
|
12
|
+
var credentialsStorage$1 = require('./credentials-storage-e3abd27b.cjs.dev.js');
|
|
14
13
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
15
14
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
16
15
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
@@ -22,9 +21,9 @@ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
|
22
21
|
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
23
22
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
24
23
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
25
|
-
var graphqlRequests = require('./graphql-requests-
|
|
24
|
+
var graphqlRequests = require('./graphql-requests-b05fd260.cjs.dev.js');
|
|
26
25
|
require('@commercetools/http-user-agent');
|
|
27
|
-
require('./package-
|
|
26
|
+
require('./package-3a9024e1.cjs.dev.js');
|
|
28
27
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
29
28
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
30
29
|
require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
@@ -40,7 +39,6 @@ require('@commercetools-frontend/constants');
|
|
|
40
39
|
|
|
41
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
42
41
|
|
|
43
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
44
42
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
45
43
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
46
44
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
@@ -60,17 +58,17 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
60
58
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
61
59
|
|
|
62
60
|
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; }
|
|
63
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
61
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
64
62
|
|
|
65
63
|
// Since not all terminal supports colors, to make things more consistent for testing purposes,
|
|
66
64
|
// during tests the color used is appended before the string instead of coloring it.
|
|
67
65
|
const isTest = process.env.NODE_ENV === 'test';
|
|
68
66
|
const red = str => {
|
|
69
|
-
if (isTest) return
|
|
67
|
+
if (isTest) return `<color-red>${str}</color-red>`;
|
|
70
68
|
return chalk__default["default"].red(str);
|
|
71
69
|
};
|
|
72
70
|
const green = str => {
|
|
73
|
-
if (isTest) return
|
|
71
|
+
if (isTest) return `<color-green>${str}</color-green>`;
|
|
74
72
|
return chalk__default["default"].green(str);
|
|
75
73
|
};
|
|
76
74
|
|
|
@@ -86,16 +84,13 @@ const getStringDiff = _ref => {
|
|
|
86
84
|
_ref$indentLevel = _ref.indentLevel,
|
|
87
85
|
indentLevel = _ref$indentLevel === void 0 ? 0 : _ref$indentLevel;
|
|
88
86
|
if (!previousValue && nextValue) {
|
|
89
|
-
|
|
90
|
-
return _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(indent(indentLevel))).call(_context3, label, " added: ")).call(_context2, green(nextValue));
|
|
87
|
+
return `${indent(indentLevel)}${label} added: ${green(nextValue)}`;
|
|
91
88
|
}
|
|
92
89
|
if (previousValue && !nextValue) {
|
|
93
|
-
|
|
94
|
-
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(indent(indentLevel))).call(_context5, label, " removed: ")).call(_context4, red(previousValue));
|
|
90
|
+
return `${indent(indentLevel)}${label} removed: ${red(previousValue)}`;
|
|
95
91
|
}
|
|
96
92
|
if (previousValue && nextValue && previousValue !== nextValue) {
|
|
97
|
-
|
|
98
|
-
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));
|
|
93
|
+
return `${indent(indentLevel)}${label} changed: ${red(previousValue)} => ${green(nextValue)}`;
|
|
99
94
|
}
|
|
100
95
|
return null;
|
|
101
96
|
};
|
|
@@ -108,7 +103,7 @@ const getArrayDiff = _ref2 => {
|
|
|
108
103
|
indentLevel = _ref2$indentLevel === void 0 ? 0 : _ref2$indentLevel;
|
|
109
104
|
const oldArraySet = new _Set__default["default"](previousValue);
|
|
110
105
|
const arrayDiff = [];
|
|
111
|
-
nextValue
|
|
106
|
+
nextValue?.forEach(item => {
|
|
112
107
|
if (oldArraySet.has(item)) {
|
|
113
108
|
oldArraySet.delete(item);
|
|
114
109
|
} else {
|
|
@@ -129,7 +124,7 @@ const getArrayDiff = _ref2 => {
|
|
|
129
124
|
return arrayDiff.join('\n');
|
|
130
125
|
};
|
|
131
126
|
const getPermissionsDiff = _ref3 => {
|
|
132
|
-
var
|
|
127
|
+
var _context2;
|
|
133
128
|
let previousValue = _ref3.previousValue,
|
|
134
129
|
nextValue = _ref3.nextValue;
|
|
135
130
|
const permissionDiff = ['permissions changed'];
|
|
@@ -142,12 +137,10 @@ const getPermissionsDiff = _ref3 => {
|
|
|
142
137
|
}, {});
|
|
143
138
|
const indentLevel = 1;
|
|
144
139
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newPermission => {
|
|
145
|
-
|
|
146
|
-
const currentDiff = [_concatInstanceProperty__default["default"](_context9 = "".concat(indent(indentLevel), "\"")).call(_context9, newPermission.name, "\" changed")];
|
|
140
|
+
const currentDiff = [`${indent(indentLevel)}"${newPermission.name}" changed`];
|
|
147
141
|
// if the permission name is not in the old config, it means it is a new addition.
|
|
148
142
|
if (!mappedOldPermissions[newPermission.name]) {
|
|
149
|
-
|
|
150
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context10 = "".concat(indent(indentLevel), "\"")).call(_context10, green(newPermission.name), "\" was added"));
|
|
143
|
+
permissionDiff.push(`${indent(indentLevel)}"${green(newPermission.name)}" was added`);
|
|
151
144
|
}
|
|
152
145
|
|
|
153
146
|
// if permission name is in the old config, now we check if there was a change
|
|
@@ -164,22 +157,21 @@ const getPermissionsDiff = _ref3 => {
|
|
|
164
157
|
});
|
|
165
158
|
|
|
166
159
|
// if there are old permissions left, it means they were deleted in the new Permissions.
|
|
167
|
-
_forEachInstanceProperty__default["default"](
|
|
168
|
-
|
|
169
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context12 = "".concat(indent(indentLevel), "\"")).call(_context12, red(oldPermissionName), "\" was removed"));
|
|
160
|
+
_forEachInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](mappedOldPermissions)).call(_context2, oldPermissionName => {
|
|
161
|
+
permissionDiff.push(`${indent(indentLevel)}"${red(oldPermissionName)}" was removed`);
|
|
170
162
|
});
|
|
171
163
|
if (permissionDiff.length > 1) return permissionDiff.join('\n');
|
|
172
164
|
return null;
|
|
173
165
|
};
|
|
174
166
|
const getLabelAllLocalesDiff = _ref5 => {
|
|
175
|
-
var
|
|
167
|
+
var _context3;
|
|
176
168
|
let _ref5$previousValue = _ref5.previousValue,
|
|
177
169
|
previousValue = _ref5$previousValue === void 0 ? [] : _ref5$previousValue,
|
|
178
170
|
_ref5$nextValue = _ref5.nextValue,
|
|
179
171
|
nextValue = _ref5$nextValue === void 0 ? [] : _ref5$nextValue,
|
|
180
172
|
_ref5$indentLevel = _ref5.indentLevel,
|
|
181
173
|
indentLevel = _ref5$indentLevel === void 0 ? 0 : _ref5$indentLevel;
|
|
182
|
-
const labelAllLocalesDiff = [
|
|
174
|
+
const labelAllLocalesDiff = [`${indent(indentLevel - 1)}labelAllLocales changed`];
|
|
183
175
|
const mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
|
|
184
176
|
let locale = _ref6.locale,
|
|
185
177
|
value = _ref6.value;
|
|
@@ -191,8 +183,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
191
183
|
if (newLabelAllLocale.locale in mappedOldLabelAllLocales) {
|
|
192
184
|
const oldLocaleValue = mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
193
185
|
if (oldLocaleValue !== newLabelAllLocale.value) {
|
|
194
|
-
|
|
195
|
-
labelAllLocalesDiff.push(_concatInstanceProperty__default["default"](_context13 = _concatInstanceProperty__default["default"](_context14 = _concatInstanceProperty__default["default"](_context15 = "".concat(indent(indentLevel), "locale \"")).call(_context15, newLabelAllLocale.locale, "\" changed: ")).call(_context14, red(oldLocaleValue), " => ")).call(_context13, green(newLabelAllLocale.value)));
|
|
186
|
+
labelAllLocalesDiff.push(`${indent(indentLevel)}locale "${newLabelAllLocale.locale}" changed: ${red(oldLocaleValue)} => ${green(newLabelAllLocale.value)}`);
|
|
196
187
|
}
|
|
197
188
|
delete mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
198
189
|
} else {
|
|
@@ -206,7 +197,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
206
197
|
}
|
|
207
198
|
}
|
|
208
199
|
});
|
|
209
|
-
_forEachInstanceProperty__default["default"](
|
|
200
|
+
_forEachInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](mappedOldLabelAllLocales)).call(_context3, key => {
|
|
210
201
|
const localeDiff = getStringDiff({
|
|
211
202
|
previousValue: key,
|
|
212
203
|
label: 'locale',
|
|
@@ -220,14 +211,14 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
220
211
|
return null;
|
|
221
212
|
};
|
|
222
213
|
const getTypeSettingsDiff = _ref7 => {
|
|
223
|
-
var
|
|
214
|
+
var _context4;
|
|
224
215
|
let previousValue = _ref7.previousValue,
|
|
225
216
|
nextValue = _ref7.nextValue;
|
|
226
217
|
const nonNullablePreviousValue = previousValue || {};
|
|
227
218
|
const nonNullableNextValue = nextValue || {};
|
|
228
219
|
const indentLevel = 1;
|
|
229
|
-
const typeSettingsDiff = [
|
|
230
|
-
_forEachInstanceProperty__default["default"](
|
|
220
|
+
const typeSettingsDiff = [`${indent(indentLevel - 1)}type settings changed`];
|
|
221
|
+
_forEachInstanceProperty__default["default"](_context4 = _Object$keys__default["default"](nonNullablePreviousValue)).call(_context4, key => {
|
|
231
222
|
const typeSettingDiff = getStringDiff({
|
|
232
223
|
previousValue: nonNullablePreviousValue[key],
|
|
233
224
|
nextValue: nonNullableNextValue[key],
|
|
@@ -277,7 +268,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
277
268
|
indentLevel: 2
|
|
278
269
|
});
|
|
279
270
|
if (mainMenuLinkPermissionsDiff.length > 0) {
|
|
280
|
-
mainMenuLinkDiff.push(
|
|
271
|
+
mainMenuLinkDiff.push(`${indent(1)}permissions changed`);
|
|
281
272
|
mainMenuLinkDiff.push(mainMenuLinkPermissionsDiff);
|
|
282
273
|
}
|
|
283
274
|
const menuLabelsDiff = getLabelAllLocalesDiff({
|
|
@@ -293,7 +284,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
293
284
|
return null;
|
|
294
285
|
};
|
|
295
286
|
const getSubmenuLinksDiff = _ref10 => {
|
|
296
|
-
var
|
|
287
|
+
var _context6;
|
|
297
288
|
let previousValue = _ref10.previousValue,
|
|
298
289
|
nextValue = _ref10.nextValue;
|
|
299
290
|
const submenuLinksDiff = ['submenuLink changed'];
|
|
@@ -303,9 +294,9 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
303
294
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newSubmenuLink => {
|
|
304
295
|
const oldSubMenuLink = mappedSubmenuLinks[newSubmenuLink.uriPath];
|
|
305
296
|
if (newSubmenuLink.uriPath in mappedSubmenuLinks) {
|
|
306
|
-
var
|
|
307
|
-
const submenuLinkDiff = [
|
|
308
|
-
_forEachInstanceProperty__default["default"](
|
|
297
|
+
var _context5;
|
|
298
|
+
const submenuLinkDiff = [`${indent(1)}menu link "${newSubmenuLink.uriPath}" changed`];
|
|
299
|
+
_forEachInstanceProperty__default["default"](_context5 = _Object$keys__default["default"](mappedSubmenuLinks[newSubmenuLink.uriPath])).call(_context5, key => {
|
|
309
300
|
switch (key) {
|
|
310
301
|
case 'defaultLabel':
|
|
311
302
|
{
|
|
@@ -329,7 +320,7 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
329
320
|
indentLevel: 3
|
|
330
321
|
});
|
|
331
322
|
if (submenuLinkPermissionsDiff.length > 0) {
|
|
332
|
-
submenuLinkDiff.push(
|
|
323
|
+
submenuLinkDiff.push(`${indent(2)}permissions changed`);
|
|
333
324
|
submenuLinkDiff.push(submenuLinkPermissionsDiff);
|
|
334
325
|
}
|
|
335
326
|
break;
|
|
@@ -364,7 +355,7 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
364
355
|
}
|
|
365
356
|
}
|
|
366
357
|
});
|
|
367
|
-
_forEachInstanceProperty__default["default"](
|
|
358
|
+
_forEachInstanceProperty__default["default"](_context6 = _Object$keys__default["default"](mappedSubmenuLinks)).call(_context6, key => {
|
|
368
359
|
const linksDiff = getStringDiff({
|
|
369
360
|
previousValue: key,
|
|
370
361
|
label: 'menu link',
|
|
@@ -539,18 +530,17 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
|
|
|
539
530
|
|
|
540
531
|
const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
|
|
541
532
|
const getMcUrlLink = _ref => {
|
|
542
|
-
var _context, _context2, _context3;
|
|
543
533
|
let mcApiUrl = _ref.mcApiUrl,
|
|
544
534
|
organizationId = _ref.organizationId,
|
|
545
535
|
customEntityId = _ref.customEntityId,
|
|
546
536
|
isCustomView = _ref.isCustomView;
|
|
547
537
|
const mcUrl = mcApiUrl.replace('mc-api', 'mc');
|
|
548
|
-
const customEntityLink =
|
|
538
|
+
const customEntityLink = `${mcUrl}/account/organizations/${organizationId}/custom-${isCustomView ? 'views' : 'applications'}/owned/${customEntityId}`;
|
|
549
539
|
return customEntityLink;
|
|
550
540
|
};
|
|
551
541
|
const isCustomViewData = data => data.entryPointUriPath === undefined;
|
|
552
542
|
async function createOrUpdateCustomApplication(_ref2) {
|
|
553
|
-
var
|
|
543
|
+
var _context3;
|
|
554
544
|
let mcApiUrl = _ref2.mcApiUrl,
|
|
555
545
|
localCustomEntityData = _ref2.localCustomEntityData,
|
|
556
546
|
applicationIdentifier = _ref2.applicationIdentifier,
|
|
@@ -561,14 +551,14 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
561
551
|
applicationIdentifier
|
|
562
552
|
});
|
|
563
553
|
if (!fetchedCustomApplication) {
|
|
564
|
-
var
|
|
554
|
+
var _context2;
|
|
565
555
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
566
556
|
mcApiUrl,
|
|
567
557
|
applicationIdentifier
|
|
568
558
|
});
|
|
569
559
|
let organizationId, organizationName;
|
|
570
560
|
if (userOrganizations.total === 0) {
|
|
571
|
-
throw new Error(
|
|
561
|
+
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.`);
|
|
572
562
|
}
|
|
573
563
|
if (userOrganizations.total === 1) {
|
|
574
564
|
const _userOrganizations$re = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -576,8 +566,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
576
566
|
organizationId = organization.id;
|
|
577
567
|
organizationName = organization.name;
|
|
578
568
|
} else {
|
|
579
|
-
var
|
|
580
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
569
|
+
var _context;
|
|
570
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context = userOrganizations.results).call(_context, organization => ({
|
|
581
571
|
title: organization.name,
|
|
582
572
|
value: organization.id
|
|
583
573
|
}));
|
|
@@ -590,7 +580,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
590
580
|
}),
|
|
591
581
|
selectedOrganizationId = _await$prompts.organizationId;
|
|
592
582
|
if (!selectedOrganizationId) {
|
|
593
|
-
throw new Error(
|
|
583
|
+
throw new Error(`No Organization selected, aborting.`);
|
|
594
584
|
}
|
|
595
585
|
organizationId = selectedOrganizationId;
|
|
596
586
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref3 => {
|
|
@@ -601,7 +591,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
601
591
|
const _await$prompts2 = await prompts__default["default"]({
|
|
602
592
|
type: 'text',
|
|
603
593
|
name: 'confirmation',
|
|
604
|
-
message: _filterInstanceProperty__default["default"](
|
|
594
|
+
message: _filterInstanceProperty__default["default"](_context2 = [`You are about to create a new Custom Application in the "${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(_context2, Boolean).join('\n'),
|
|
605
595
|
initial: 'yes'
|
|
606
596
|
}),
|
|
607
597
|
confirmation = _await$prompts2.confirmation;
|
|
@@ -612,7 +602,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
612
602
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
613
603
|
if (options.dryRun) {
|
|
614
604
|
console.log();
|
|
615
|
-
console.log(
|
|
605
|
+
console.log(`The following payload would be used to create a new Custom Application.`);
|
|
616
606
|
console.log();
|
|
617
607
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
618
608
|
return;
|
|
@@ -636,8 +626,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
636
626
|
organizationId,
|
|
637
627
|
customEntityId: createdCustomApplication.id
|
|
638
628
|
});
|
|
639
|
-
console.log(chalk__default["default"].green(
|
|
640
|
-
console.log(
|
|
629
|
+
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: "${chalk__default["default"].green(createdCustomApplication.id)}".`));
|
|
630
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
641
631
|
return;
|
|
642
632
|
}
|
|
643
633
|
const customAppLink = getMcUrlLink({
|
|
@@ -647,8 +637,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
647
637
|
});
|
|
648
638
|
const configDiff = getCustomApplicationConfigDiff(fetchedCustomApplication.application, localCustomEntityData);
|
|
649
639
|
if (!configDiff) {
|
|
650
|
-
console.log(chalk__default["default"].green(
|
|
651
|
-
console.log(
|
|
640
|
+
console.log(chalk__default["default"].green(`Custom Application up-to-date.`));
|
|
641
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
652
642
|
return;
|
|
653
643
|
}
|
|
654
644
|
console.log('Changes detected:');
|
|
@@ -657,7 +647,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
657
647
|
const _await$prompts3 = await prompts__default["default"]({
|
|
658
648
|
type: 'text',
|
|
659
649
|
name: 'confirmation',
|
|
660
|
-
message: _filterInstanceProperty__default["default"](
|
|
650
|
+
message: _filterInstanceProperty__default["default"](_context3 = [`You are about to update the Custom Application "${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(_context3, Boolean).join('\n'),
|
|
661
651
|
initial: 'yes'
|
|
662
652
|
}),
|
|
663
653
|
confirmation = _await$prompts3.confirmation;
|
|
@@ -668,7 +658,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
668
658
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
669
659
|
if (options.dryRun) {
|
|
670
660
|
console.log();
|
|
671
|
-
console.log(
|
|
661
|
+
console.log(`The following payload would be used to update the Custom Application "${chalk__default["default"].green(data.entryPointUriPath)}".`);
|
|
672
662
|
console.log();
|
|
673
663
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
674
664
|
return;
|
|
@@ -680,11 +670,11 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
680
670
|
applicationId: fetchedCustomApplication.application.id,
|
|
681
671
|
applicationIdentifier
|
|
682
672
|
});
|
|
683
|
-
console.log(chalk__default["default"].green(
|
|
684
|
-
console.log(
|
|
673
|
+
console.log(chalk__default["default"].green(`Custom Application updated.`));
|
|
674
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
685
675
|
}
|
|
686
676
|
async function createOrUpdateCustomView(_ref4) {
|
|
687
|
-
var
|
|
677
|
+
var _context6;
|
|
688
678
|
let mcApiUrl = _ref4.mcApiUrl,
|
|
689
679
|
localCustomEntityData = _ref4.localCustomEntityData,
|
|
690
680
|
customViewId = _ref4.customViewId,
|
|
@@ -696,7 +686,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
696
686
|
applicationIdentifier
|
|
697
687
|
});
|
|
698
688
|
if (!fetchedCustomView) {
|
|
699
|
-
var
|
|
689
|
+
var _context5;
|
|
700
690
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
701
691
|
mcApiUrl,
|
|
702
692
|
customViewId,
|
|
@@ -704,7 +694,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
704
694
|
});
|
|
705
695
|
let organizationId, organizationName;
|
|
706
696
|
if (userOrganizations.total === 0) {
|
|
707
|
-
throw new Error(
|
|
697
|
+
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.`);
|
|
708
698
|
}
|
|
709
699
|
if (userOrganizations.total === 1) {
|
|
710
700
|
const _userOrganizations$re2 = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -712,8 +702,8 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
712
702
|
organizationId = organization.id;
|
|
713
703
|
organizationName = organization.name;
|
|
714
704
|
} else {
|
|
715
|
-
var
|
|
716
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
705
|
+
var _context4;
|
|
706
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context4 = userOrganizations.results).call(_context4, organization => ({
|
|
717
707
|
title: organization.name,
|
|
718
708
|
value: organization.id
|
|
719
709
|
}));
|
|
@@ -726,7 +716,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
726
716
|
}),
|
|
727
717
|
selectedOrganizationId = _await$prompts4.organizationId;
|
|
728
718
|
if (!selectedOrganizationId) {
|
|
729
|
-
throw new Error(
|
|
719
|
+
throw new Error(`No Organization selected, aborting.`);
|
|
730
720
|
}
|
|
731
721
|
organizationId = selectedOrganizationId;
|
|
732
722
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref5 => {
|
|
@@ -737,7 +727,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
737
727
|
const _await$prompts5 = await prompts__default["default"]({
|
|
738
728
|
type: 'text',
|
|
739
729
|
name: 'confirmation',
|
|
740
|
-
message: _filterInstanceProperty__default["default"](
|
|
730
|
+
message: _filterInstanceProperty__default["default"](_context5 = [`You are about to create a new Custom View in the "${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'),
|
|
741
731
|
initial: 'yes'
|
|
742
732
|
}),
|
|
743
733
|
confirmation = _await$prompts5.confirmation;
|
|
@@ -748,7 +738,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
748
738
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
749
739
|
if (options.dryRun) {
|
|
750
740
|
console.log();
|
|
751
|
-
console.log(
|
|
741
|
+
console.log(`The following payload would be used to create a new Custom View.`);
|
|
752
742
|
console.log();
|
|
753
743
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
754
744
|
return;
|
|
@@ -773,20 +763,20 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
773
763
|
customEntityId: createdCustomView.id,
|
|
774
764
|
isCustomView: true
|
|
775
765
|
});
|
|
776
|
-
console.log(chalk__default["default"].green(
|
|
777
|
-
console.log(
|
|
766
|
+
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: "${chalk__default["default"].green(createdCustomView.id)}".`));
|
|
767
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
778
768
|
return;
|
|
779
769
|
}
|
|
780
770
|
const customViewLink = getMcUrlLink({
|
|
781
771
|
mcApiUrl,
|
|
782
772
|
organizationId: fetchedCustomView.organizationId,
|
|
783
|
-
customEntityId:
|
|
773
|
+
customEntityId: fetchedCustomView?.customView?.id || '',
|
|
784
774
|
isCustomView: true
|
|
785
775
|
});
|
|
786
776
|
const configDiff = getCustomViewConfigDiff(fetchedCustomView.customView, localCustomEntityData);
|
|
787
777
|
if (!configDiff) {
|
|
788
|
-
console.log(chalk__default["default"].green(
|
|
789
|
-
console.log(
|
|
778
|
+
console.log(chalk__default["default"].green(`Custom View up-to-date.`));
|
|
779
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
790
780
|
return;
|
|
791
781
|
}
|
|
792
782
|
console.log('Changes detected:');
|
|
@@ -795,7 +785,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
795
785
|
const _await$prompts6 = await prompts__default["default"]({
|
|
796
786
|
type: 'text',
|
|
797
787
|
name: 'confirmation',
|
|
798
|
-
message: _filterInstanceProperty__default["default"](
|
|
788
|
+
message: _filterInstanceProperty__default["default"](_context6 = [`You are about to update the Custom View "${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(_context6, Boolean).join('\n'),
|
|
799
789
|
initial: 'yes'
|
|
800
790
|
}),
|
|
801
791
|
confirmation = _await$prompts6.confirmation;
|
|
@@ -806,7 +796,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
806
796
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
807
797
|
if (options.dryRun) {
|
|
808
798
|
console.log();
|
|
809
|
-
console.log(
|
|
799
|
+
console.log(`The following payload would be used to update the Custom View "${chalk__default["default"].green(data.defaultLabel)}".`);
|
|
810
800
|
console.log();
|
|
811
801
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
812
802
|
return;
|
|
@@ -815,11 +805,11 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
815
805
|
mcApiUrl,
|
|
816
806
|
organizationId: fetchedCustomView.organizationId,
|
|
817
807
|
data: omit__default["default"](localCustomEntityData, ['id']),
|
|
818
|
-
customViewId:
|
|
808
|
+
customViewId: fetchedCustomView?.customView?.id || '',
|
|
819
809
|
applicationIdentifier
|
|
820
810
|
});
|
|
821
|
-
console.log(chalk__default["default"].green(
|
|
822
|
-
console.log(
|
|
811
|
+
console.log(chalk__default["default"].green(`Custom View updated.`));
|
|
812
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
823
813
|
}
|
|
824
814
|
async function run(options) {
|
|
825
815
|
const applicationConfig$1 = applicationConfig.processConfig();
|
|
@@ -828,11 +818,11 @@ async function run(options) {
|
|
|
828
818
|
mcApiUrl = _applicationConfig$en.mcApiUrl,
|
|
829
819
|
applicationIdentifier = _applicationConfig$en.applicationIdentifier,
|
|
830
820
|
customViewId = _applicationConfig$en.customViewId;
|
|
831
|
-
console.log(
|
|
821
|
+
console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
|
|
832
822
|
console.log();
|
|
833
823
|
const isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
834
824
|
if (!isSessionValid) {
|
|
835
|
-
throw new Error(
|
|
825
|
+
throw new Error(`You don't have a valid session. Please, run the "mc-scripts login" command to authenticate yourself.`);
|
|
836
826
|
}
|
|
837
827
|
if (isCustomViewData(localCustomEntityData)) {
|
|
838
828
|
createOrUpdateCustomView({
|