@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-cac35ba6.cjs.prod.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-0887e583.cjs.prod.js');
|
|
26
25
|
require('@commercetools/http-user-agent');
|
|
27
|
-
require('./package-
|
|
26
|
+
require('./package-378cc0b4.cjs.prod.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,7 +58,7 @@ 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
|
const red = str => {
|
|
65
63
|
return chalk__default["default"].red(str);
|
|
66
64
|
};
|
|
@@ -80,16 +78,13 @@ const getStringDiff = _ref => {
|
|
|
80
78
|
_ref$indentLevel = _ref.indentLevel,
|
|
81
79
|
indentLevel = _ref$indentLevel === void 0 ? 0 : _ref$indentLevel;
|
|
82
80
|
if (!previousValue && nextValue) {
|
|
83
|
-
|
|
84
|
-
return _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = "".concat(indent(indentLevel))).call(_context3, label, " added: ")).call(_context2, green(nextValue));
|
|
81
|
+
return `${indent(indentLevel)}${label} added: ${green(nextValue)}`;
|
|
85
82
|
}
|
|
86
83
|
if (previousValue && !nextValue) {
|
|
87
|
-
|
|
88
|
-
return _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = "".concat(indent(indentLevel))).call(_context5, label, " removed: ")).call(_context4, red(previousValue));
|
|
84
|
+
return `${indent(indentLevel)}${label} removed: ${red(previousValue)}`;
|
|
89
85
|
}
|
|
90
86
|
if (previousValue && nextValue && previousValue !== nextValue) {
|
|
91
|
-
|
|
92
|
-
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
|
+
return `${indent(indentLevel)}${label} changed: ${red(previousValue)} => ${green(nextValue)}`;
|
|
93
88
|
}
|
|
94
89
|
return null;
|
|
95
90
|
};
|
|
@@ -102,7 +97,7 @@ const getArrayDiff = _ref2 => {
|
|
|
102
97
|
indentLevel = _ref2$indentLevel === void 0 ? 0 : _ref2$indentLevel;
|
|
103
98
|
const oldArraySet = new _Set__default["default"](previousValue);
|
|
104
99
|
const arrayDiff = [];
|
|
105
|
-
nextValue
|
|
100
|
+
nextValue?.forEach(item => {
|
|
106
101
|
if (oldArraySet.has(item)) {
|
|
107
102
|
oldArraySet.delete(item);
|
|
108
103
|
} else {
|
|
@@ -123,7 +118,7 @@ const getArrayDiff = _ref2 => {
|
|
|
123
118
|
return arrayDiff.join('\n');
|
|
124
119
|
};
|
|
125
120
|
const getPermissionsDiff = _ref3 => {
|
|
126
|
-
var
|
|
121
|
+
var _context2;
|
|
127
122
|
let previousValue = _ref3.previousValue,
|
|
128
123
|
nextValue = _ref3.nextValue;
|
|
129
124
|
const permissionDiff = ['permissions changed'];
|
|
@@ -136,12 +131,10 @@ const getPermissionsDiff = _ref3 => {
|
|
|
136
131
|
}, {});
|
|
137
132
|
const indentLevel = 1;
|
|
138
133
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newPermission => {
|
|
139
|
-
|
|
140
|
-
const currentDiff = [_concatInstanceProperty__default["default"](_context9 = "".concat(indent(indentLevel), "\"")).call(_context9, newPermission.name, "\" changed")];
|
|
134
|
+
const currentDiff = [`${indent(indentLevel)}"${newPermission.name}" changed`];
|
|
141
135
|
// if the permission name is not in the old config, it means it is a new addition.
|
|
142
136
|
if (!mappedOldPermissions[newPermission.name]) {
|
|
143
|
-
|
|
144
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context10 = "".concat(indent(indentLevel), "\"")).call(_context10, green(newPermission.name), "\" was added"));
|
|
137
|
+
permissionDiff.push(`${indent(indentLevel)}"${green(newPermission.name)}" was added`);
|
|
145
138
|
}
|
|
146
139
|
|
|
147
140
|
// if permission name is in the old config, now we check if there was a change
|
|
@@ -158,22 +151,21 @@ const getPermissionsDiff = _ref3 => {
|
|
|
158
151
|
});
|
|
159
152
|
|
|
160
153
|
// if there are old permissions left, it means they were deleted in the new Permissions.
|
|
161
|
-
_forEachInstanceProperty__default["default"](
|
|
162
|
-
|
|
163
|
-
permissionDiff.push(_concatInstanceProperty__default["default"](_context12 = "".concat(indent(indentLevel), "\"")).call(_context12, red(oldPermissionName), "\" was removed"));
|
|
154
|
+
_forEachInstanceProperty__default["default"](_context2 = _Object$keys__default["default"](mappedOldPermissions)).call(_context2, oldPermissionName => {
|
|
155
|
+
permissionDiff.push(`${indent(indentLevel)}"${red(oldPermissionName)}" was removed`);
|
|
164
156
|
});
|
|
165
157
|
if (permissionDiff.length > 1) return permissionDiff.join('\n');
|
|
166
158
|
return null;
|
|
167
159
|
};
|
|
168
160
|
const getLabelAllLocalesDiff = _ref5 => {
|
|
169
|
-
var
|
|
161
|
+
var _context3;
|
|
170
162
|
let _ref5$previousValue = _ref5.previousValue,
|
|
171
163
|
previousValue = _ref5$previousValue === void 0 ? [] : _ref5$previousValue,
|
|
172
164
|
_ref5$nextValue = _ref5.nextValue,
|
|
173
165
|
nextValue = _ref5$nextValue === void 0 ? [] : _ref5$nextValue,
|
|
174
166
|
_ref5$indentLevel = _ref5.indentLevel,
|
|
175
167
|
indentLevel = _ref5$indentLevel === void 0 ? 0 : _ref5$indentLevel;
|
|
176
|
-
const labelAllLocalesDiff = [
|
|
168
|
+
const labelAllLocalesDiff = [`${indent(indentLevel - 1)}labelAllLocales changed`];
|
|
177
169
|
const mappedOldLabelAllLocales = _reduceInstanceProperty__default["default"](previousValue).call(previousValue, (previousLabelAllLocale, _ref6) => {
|
|
178
170
|
let locale = _ref6.locale,
|
|
179
171
|
value = _ref6.value;
|
|
@@ -185,8 +177,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
185
177
|
if (newLabelAllLocale.locale in mappedOldLabelAllLocales) {
|
|
186
178
|
const oldLocaleValue = mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
187
179
|
if (oldLocaleValue !== newLabelAllLocale.value) {
|
|
188
|
-
|
|
189
|
-
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)));
|
|
180
|
+
labelAllLocalesDiff.push(`${indent(indentLevel)}locale "${newLabelAllLocale.locale}" changed: ${red(oldLocaleValue)} => ${green(newLabelAllLocale.value)}`);
|
|
190
181
|
}
|
|
191
182
|
delete mappedOldLabelAllLocales[newLabelAllLocale.locale];
|
|
192
183
|
} else {
|
|
@@ -200,7 +191,7 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
200
191
|
}
|
|
201
192
|
}
|
|
202
193
|
});
|
|
203
|
-
_forEachInstanceProperty__default["default"](
|
|
194
|
+
_forEachInstanceProperty__default["default"](_context3 = _Object$keys__default["default"](mappedOldLabelAllLocales)).call(_context3, key => {
|
|
204
195
|
const localeDiff = getStringDiff({
|
|
205
196
|
previousValue: key,
|
|
206
197
|
label: 'locale',
|
|
@@ -214,14 +205,14 @@ const getLabelAllLocalesDiff = _ref5 => {
|
|
|
214
205
|
return null;
|
|
215
206
|
};
|
|
216
207
|
const getTypeSettingsDiff = _ref7 => {
|
|
217
|
-
var
|
|
208
|
+
var _context4;
|
|
218
209
|
let previousValue = _ref7.previousValue,
|
|
219
210
|
nextValue = _ref7.nextValue;
|
|
220
211
|
const nonNullablePreviousValue = previousValue || {};
|
|
221
212
|
const nonNullableNextValue = nextValue || {};
|
|
222
213
|
const indentLevel = 1;
|
|
223
|
-
const typeSettingsDiff = [
|
|
224
|
-
_forEachInstanceProperty__default["default"](
|
|
214
|
+
const typeSettingsDiff = [`${indent(indentLevel - 1)}type settings changed`];
|
|
215
|
+
_forEachInstanceProperty__default["default"](_context4 = _Object$keys__default["default"](nonNullablePreviousValue)).call(_context4, key => {
|
|
225
216
|
const typeSettingDiff = getStringDiff({
|
|
226
217
|
previousValue: nonNullablePreviousValue[key],
|
|
227
218
|
nextValue: nonNullableNextValue[key],
|
|
@@ -271,7 +262,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
271
262
|
indentLevel: 2
|
|
272
263
|
});
|
|
273
264
|
if (mainMenuLinkPermissionsDiff.length > 0) {
|
|
274
|
-
mainMenuLinkDiff.push(
|
|
265
|
+
mainMenuLinkDiff.push(`${indent(1)}permissions changed`);
|
|
275
266
|
mainMenuLinkDiff.push(mainMenuLinkPermissionsDiff);
|
|
276
267
|
}
|
|
277
268
|
const menuLabelsDiff = getLabelAllLocalesDiff({
|
|
@@ -287,7 +278,7 @@ const getMainMenuLinkDiff = _ref9 => {
|
|
|
287
278
|
return null;
|
|
288
279
|
};
|
|
289
280
|
const getSubmenuLinksDiff = _ref10 => {
|
|
290
|
-
var
|
|
281
|
+
var _context6;
|
|
291
282
|
let previousValue = _ref10.previousValue,
|
|
292
283
|
nextValue = _ref10.nextValue;
|
|
293
284
|
const submenuLinksDiff = ['submenuLink changed'];
|
|
@@ -297,9 +288,9 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
297
288
|
_forEachInstanceProperty__default["default"](nextValue).call(nextValue, newSubmenuLink => {
|
|
298
289
|
const oldSubMenuLink = mappedSubmenuLinks[newSubmenuLink.uriPath];
|
|
299
290
|
if (newSubmenuLink.uriPath in mappedSubmenuLinks) {
|
|
300
|
-
var
|
|
301
|
-
const submenuLinkDiff = [
|
|
302
|
-
_forEachInstanceProperty__default["default"](
|
|
291
|
+
var _context5;
|
|
292
|
+
const submenuLinkDiff = [`${indent(1)}menu link "${newSubmenuLink.uriPath}" changed`];
|
|
293
|
+
_forEachInstanceProperty__default["default"](_context5 = _Object$keys__default["default"](mappedSubmenuLinks[newSubmenuLink.uriPath])).call(_context5, key => {
|
|
303
294
|
switch (key) {
|
|
304
295
|
case 'defaultLabel':
|
|
305
296
|
{
|
|
@@ -323,7 +314,7 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
323
314
|
indentLevel: 3
|
|
324
315
|
});
|
|
325
316
|
if (submenuLinkPermissionsDiff.length > 0) {
|
|
326
|
-
submenuLinkDiff.push(
|
|
317
|
+
submenuLinkDiff.push(`${indent(2)}permissions changed`);
|
|
327
318
|
submenuLinkDiff.push(submenuLinkPermissionsDiff);
|
|
328
319
|
}
|
|
329
320
|
break;
|
|
@@ -358,7 +349,7 @@ const getSubmenuLinksDiff = _ref10 => {
|
|
|
358
349
|
}
|
|
359
350
|
}
|
|
360
351
|
});
|
|
361
|
-
_forEachInstanceProperty__default["default"](
|
|
352
|
+
_forEachInstanceProperty__default["default"](_context6 = _Object$keys__default["default"](mappedSubmenuLinks)).call(_context6, key => {
|
|
362
353
|
const linksDiff = getStringDiff({
|
|
363
354
|
previousValue: key,
|
|
364
355
|
label: 'menu link',
|
|
@@ -533,18 +524,17 @@ const getCustomViewConfigDiff = (oldConfig, newConfig) => {
|
|
|
533
524
|
|
|
534
525
|
const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
|
|
535
526
|
const getMcUrlLink = _ref => {
|
|
536
|
-
var _context, _context2, _context3;
|
|
537
527
|
let mcApiUrl = _ref.mcApiUrl,
|
|
538
528
|
organizationId = _ref.organizationId,
|
|
539
529
|
customEntityId = _ref.customEntityId,
|
|
540
530
|
isCustomView = _ref.isCustomView;
|
|
541
531
|
const mcUrl = mcApiUrl.replace('mc-api', 'mc');
|
|
542
|
-
const customEntityLink =
|
|
532
|
+
const customEntityLink = `${mcUrl}/account/organizations/${organizationId}/custom-${isCustomView ? 'views' : 'applications'}/owned/${customEntityId}`;
|
|
543
533
|
return customEntityLink;
|
|
544
534
|
};
|
|
545
535
|
const isCustomViewData = data => data.entryPointUriPath === undefined;
|
|
546
536
|
async function createOrUpdateCustomApplication(_ref2) {
|
|
547
|
-
var
|
|
537
|
+
var _context3;
|
|
548
538
|
let mcApiUrl = _ref2.mcApiUrl,
|
|
549
539
|
localCustomEntityData = _ref2.localCustomEntityData,
|
|
550
540
|
applicationIdentifier = _ref2.applicationIdentifier,
|
|
@@ -555,14 +545,14 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
555
545
|
applicationIdentifier
|
|
556
546
|
});
|
|
557
547
|
if (!fetchedCustomApplication) {
|
|
558
|
-
var
|
|
548
|
+
var _context2;
|
|
559
549
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
560
550
|
mcApiUrl,
|
|
561
551
|
applicationIdentifier
|
|
562
552
|
});
|
|
563
553
|
let organizationId, organizationName;
|
|
564
554
|
if (userOrganizations.total === 0) {
|
|
565
|
-
throw new Error(
|
|
555
|
+
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.`);
|
|
566
556
|
}
|
|
567
557
|
if (userOrganizations.total === 1) {
|
|
568
558
|
const _userOrganizations$re = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -570,8 +560,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
570
560
|
organizationId = organization.id;
|
|
571
561
|
organizationName = organization.name;
|
|
572
562
|
} else {
|
|
573
|
-
var
|
|
574
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
563
|
+
var _context;
|
|
564
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context = userOrganizations.results).call(_context, organization => ({
|
|
575
565
|
title: organization.name,
|
|
576
566
|
value: organization.id
|
|
577
567
|
}));
|
|
@@ -584,7 +574,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
584
574
|
}),
|
|
585
575
|
selectedOrganizationId = _await$prompts.organizationId;
|
|
586
576
|
if (!selectedOrganizationId) {
|
|
587
|
-
throw new Error(
|
|
577
|
+
throw new Error(`No Organization selected, aborting.`);
|
|
588
578
|
}
|
|
589
579
|
organizationId = selectedOrganizationId;
|
|
590
580
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref3 => {
|
|
@@ -595,7 +585,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
595
585
|
const _await$prompts2 = await prompts__default["default"]({
|
|
596
586
|
type: 'text',
|
|
597
587
|
name: 'confirmation',
|
|
598
|
-
message: _filterInstanceProperty__default["default"](
|
|
588
|
+
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'),
|
|
599
589
|
initial: 'yes'
|
|
600
590
|
}),
|
|
601
591
|
confirmation = _await$prompts2.confirmation;
|
|
@@ -606,7 +596,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
606
596
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
607
597
|
if (options.dryRun) {
|
|
608
598
|
console.log();
|
|
609
|
-
console.log(
|
|
599
|
+
console.log(`The following payload would be used to create a new Custom Application.`);
|
|
610
600
|
console.log();
|
|
611
601
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
612
602
|
return;
|
|
@@ -630,8 +620,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
630
620
|
organizationId,
|
|
631
621
|
customEntityId: createdCustomApplication.id
|
|
632
622
|
});
|
|
633
|
-
console.log(chalk__default["default"].green(
|
|
634
|
-
console.log(
|
|
623
|
+
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)}".`));
|
|
624
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
635
625
|
return;
|
|
636
626
|
}
|
|
637
627
|
const customAppLink = getMcUrlLink({
|
|
@@ -641,8 +631,8 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
641
631
|
});
|
|
642
632
|
const configDiff = getCustomApplicationConfigDiff(fetchedCustomApplication.application, localCustomEntityData);
|
|
643
633
|
if (!configDiff) {
|
|
644
|
-
console.log(chalk__default["default"].green(
|
|
645
|
-
console.log(
|
|
634
|
+
console.log(chalk__default["default"].green(`Custom Application up-to-date.`));
|
|
635
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
646
636
|
return;
|
|
647
637
|
}
|
|
648
638
|
console.log('Changes detected:');
|
|
@@ -651,7 +641,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
651
641
|
const _await$prompts3 = await prompts__default["default"]({
|
|
652
642
|
type: 'text',
|
|
653
643
|
name: 'confirmation',
|
|
654
|
-
message: _filterInstanceProperty__default["default"](
|
|
644
|
+
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'),
|
|
655
645
|
initial: 'yes'
|
|
656
646
|
}),
|
|
657
647
|
confirmation = _await$prompts3.confirmation;
|
|
@@ -662,7 +652,7 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
662
652
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
663
653
|
if (options.dryRun) {
|
|
664
654
|
console.log();
|
|
665
|
-
console.log(
|
|
655
|
+
console.log(`The following payload would be used to update the Custom Application "${chalk__default["default"].green(data.entryPointUriPath)}".`);
|
|
666
656
|
console.log();
|
|
667
657
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
668
658
|
return;
|
|
@@ -674,11 +664,11 @@ async function createOrUpdateCustomApplication(_ref2) {
|
|
|
674
664
|
applicationId: fetchedCustomApplication.application.id,
|
|
675
665
|
applicationIdentifier
|
|
676
666
|
});
|
|
677
|
-
console.log(chalk__default["default"].green(
|
|
678
|
-
console.log(
|
|
667
|
+
console.log(chalk__default["default"].green(`Custom Application updated.`));
|
|
668
|
+
console.log(`You can inspect the Custom Application data in the Merchant Center at "${chalk__default["default"].gray(customAppLink)}".`);
|
|
679
669
|
}
|
|
680
670
|
async function createOrUpdateCustomView(_ref4) {
|
|
681
|
-
var
|
|
671
|
+
var _context6;
|
|
682
672
|
let mcApiUrl = _ref4.mcApiUrl,
|
|
683
673
|
localCustomEntityData = _ref4.localCustomEntityData,
|
|
684
674
|
customViewId = _ref4.customViewId,
|
|
@@ -690,7 +680,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
690
680
|
applicationIdentifier
|
|
691
681
|
});
|
|
692
682
|
if (!fetchedCustomView) {
|
|
693
|
-
var
|
|
683
|
+
var _context5;
|
|
694
684
|
const userOrganizations = await graphqlRequests.fetchUserOrganizations({
|
|
695
685
|
mcApiUrl,
|
|
696
686
|
customViewId,
|
|
@@ -698,7 +688,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
698
688
|
});
|
|
699
689
|
let organizationId, organizationName;
|
|
700
690
|
if (userOrganizations.total === 0) {
|
|
701
|
-
throw new Error(
|
|
691
|
+
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.`);
|
|
702
692
|
}
|
|
703
693
|
if (userOrganizations.total === 1) {
|
|
704
694
|
const _userOrganizations$re2 = _slicedToArray(userOrganizations.results, 1),
|
|
@@ -706,8 +696,8 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
706
696
|
organizationId = organization.id;
|
|
707
697
|
organizationName = organization.name;
|
|
708
698
|
} else {
|
|
709
|
-
var
|
|
710
|
-
const organizationChoices = _mapInstanceProperty__default["default"](
|
|
699
|
+
var _context4;
|
|
700
|
+
const organizationChoices = _mapInstanceProperty__default["default"](_context4 = userOrganizations.results).call(_context4, organization => ({
|
|
711
701
|
title: organization.name,
|
|
712
702
|
value: organization.id
|
|
713
703
|
}));
|
|
@@ -720,7 +710,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
720
710
|
}),
|
|
721
711
|
selectedOrganizationId = _await$prompts4.organizationId;
|
|
722
712
|
if (!selectedOrganizationId) {
|
|
723
|
-
throw new Error(
|
|
713
|
+
throw new Error(`No Organization selected, aborting.`);
|
|
724
714
|
}
|
|
725
715
|
organizationId = selectedOrganizationId;
|
|
726
716
|
organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, _ref5 => {
|
|
@@ -731,7 +721,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
731
721
|
const _await$prompts5 = await prompts__default["default"]({
|
|
732
722
|
type: 'text',
|
|
733
723
|
name: 'confirmation',
|
|
734
|
-
message: _filterInstanceProperty__default["default"](
|
|
724
|
+
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'),
|
|
735
725
|
initial: 'yes'
|
|
736
726
|
}),
|
|
737
727
|
confirmation = _await$prompts5.confirmation;
|
|
@@ -742,7 +732,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
742
732
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
743
733
|
if (options.dryRun) {
|
|
744
734
|
console.log();
|
|
745
|
-
console.log(
|
|
735
|
+
console.log(`The following payload would be used to create a new Custom View.`);
|
|
746
736
|
console.log();
|
|
747
737
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
748
738
|
return;
|
|
@@ -767,20 +757,20 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
767
757
|
customEntityId: createdCustomView.id,
|
|
768
758
|
isCustomView: true
|
|
769
759
|
});
|
|
770
|
-
console.log(chalk__default["default"].green(
|
|
771
|
-
console.log(
|
|
760
|
+
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)}".`));
|
|
761
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
772
762
|
return;
|
|
773
763
|
}
|
|
774
764
|
const customViewLink = getMcUrlLink({
|
|
775
765
|
mcApiUrl,
|
|
776
766
|
organizationId: fetchedCustomView.organizationId,
|
|
777
|
-
customEntityId:
|
|
767
|
+
customEntityId: fetchedCustomView?.customView?.id || '',
|
|
778
768
|
isCustomView: true
|
|
779
769
|
});
|
|
780
770
|
const configDiff = getCustomViewConfigDiff(fetchedCustomView.customView, localCustomEntityData);
|
|
781
771
|
if (!configDiff) {
|
|
782
|
-
console.log(chalk__default["default"].green(
|
|
783
|
-
console.log(
|
|
772
|
+
console.log(chalk__default["default"].green(`Custom View up-to-date.`));
|
|
773
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
784
774
|
return;
|
|
785
775
|
}
|
|
786
776
|
console.log('Changes detected:');
|
|
@@ -789,7 +779,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
789
779
|
const _await$prompts6 = await prompts__default["default"]({
|
|
790
780
|
type: 'text',
|
|
791
781
|
name: 'confirmation',
|
|
792
|
-
message: _filterInstanceProperty__default["default"](
|
|
782
|
+
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'),
|
|
793
783
|
initial: 'yes'
|
|
794
784
|
}),
|
|
795
785
|
confirmation = _await$prompts6.confirmation;
|
|
@@ -800,7 +790,7 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
800
790
|
const data = omit__default["default"](localCustomEntityData, ['id']);
|
|
801
791
|
if (options.dryRun) {
|
|
802
792
|
console.log();
|
|
803
|
-
console.log(
|
|
793
|
+
console.log(`The following payload would be used to update the Custom View "${chalk__default["default"].green(data.defaultLabel)}".`);
|
|
804
794
|
console.log();
|
|
805
795
|
console.log(chalk__default["default"].gray(_JSON$stringify__default["default"](data, null, 2)));
|
|
806
796
|
return;
|
|
@@ -809,11 +799,11 @@ async function createOrUpdateCustomView(_ref4) {
|
|
|
809
799
|
mcApiUrl,
|
|
810
800
|
organizationId: fetchedCustomView.organizationId,
|
|
811
801
|
data: omit__default["default"](localCustomEntityData, ['id']),
|
|
812
|
-
customViewId:
|
|
802
|
+
customViewId: fetchedCustomView?.customView?.id || '',
|
|
813
803
|
applicationIdentifier
|
|
814
804
|
});
|
|
815
|
-
console.log(chalk__default["default"].green(
|
|
816
|
-
console.log(
|
|
805
|
+
console.log(chalk__default["default"].green(`Custom View updated.`));
|
|
806
|
+
console.log(`You can inspect the Custom View data in the Merchant Center at "${chalk__default["default"].gray(customViewLink)}".`);
|
|
817
807
|
}
|
|
818
808
|
async function run(options) {
|
|
819
809
|
const applicationConfig$1 = applicationConfig.processConfig();
|
|
@@ -822,11 +812,11 @@ async function run(options) {
|
|
|
822
812
|
mcApiUrl = _applicationConfig$en.mcApiUrl,
|
|
823
813
|
applicationIdentifier = _applicationConfig$en.applicationIdentifier,
|
|
824
814
|
customViewId = _applicationConfig$en.customViewId;
|
|
825
|
-
console.log(
|
|
815
|
+
console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
|
|
826
816
|
console.log();
|
|
827
817
|
const isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
|
|
828
818
|
if (!isSessionValid) {
|
|
829
|
-
throw new Error(
|
|
819
|
+
throw new Error(`You don't have a valid session. Please, run the "mc-scripts login" command to authenticate yourself.`);
|
|
830
820
|
}
|
|
831
821
|
if (isCustomViewData(localCustomEntityData)) {
|
|
832
822
|
createOrUpdateCustomView({
|