@commercetools-frontend/cypress 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.
@@ -9,7 +9,6 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
9
9
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
10
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
11
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
12
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
13
12
  var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
14
13
  var constants$1 = require('@commercetools-frontend/constants');
15
14
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -31,7 +30,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
31
30
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
32
31
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
33
32
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
34
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
35
33
  var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
36
34
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
37
35
  var _URL__default = /*#__PURE__*/_interopDefault(_URL);
@@ -39,7 +37,7 @@ var semver__default = /*#__PURE__*/_interopDefault(semver);
39
37
  var _reduceRightInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceRightInstanceProperty);
40
38
 
41
39
  function ownKeys$1(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; }
42
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$1(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
40
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
43
41
 
44
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
43
 
@@ -51,11 +49,10 @@ function isFeatureSupported(expectedVersion) {
51
49
  return semver__default["default"].gte(Cypress.version, expectedVersion);
52
50
  }
53
51
  function loginByForm(commandOptions) {
54
- var _commandOptions$proje;
55
52
  if (isLocalhost()) {
56
- throw new Error("At the moment, the \"loginByForm\" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with \"cy.origin\".");
53
+ throw new Error(`At the moment, the "loginByForm" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with "cy.origin".`);
57
54
  }
58
- const projectKey = (_commandOptions$proje = commandOptions.projectKey) !== null && _commandOptions$proje !== void 0 ? _commandOptions$proje : Cypress.env('PROJECT_KEY');
55
+ const projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
59
56
  cy.task('customApplicationConfig', {
60
57
  entryPointUriPath: commandOptions.entryPointUriPath,
61
58
  dotfiles: commandOptions.dotfiles
@@ -64,10 +61,9 @@ function loginByForm(commandOptions) {
64
61
  {
65
62
  log: false
66
63
  }).then(appConfig => {
67
- var _context, _commandOptions$login;
68
- let url = _concatInstanceProperty__default["default"](_context = "/".concat(projectKey, "/")).call(_context, commandOptions.entryPointUriPath);
64
+ let url = `/${projectKey}/${commandOptions.entryPointUriPath}`;
69
65
  if (commandOptions.entryPointUriPath === 'account') {
70
- url = "/".concat(commandOptions.entryPointUriPath);
66
+ url = `/${commandOptions.entryPointUriPath}`;
71
67
  }
72
68
 
73
69
  // Log loaded application config for debugging purposes.
@@ -76,7 +72,7 @@ function loginByForm(commandOptions) {
76
72
  name: 'customApplicationConfig',
77
73
  message: appConfig
78
74
  });
79
- const userCredentials = (_commandOptions$login = commandOptions.login) !== null && _commandOptions$login !== void 0 ? _commandOptions$login : {
75
+ const userCredentials = commandOptions.login ?? {
80
76
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
81
77
  password: Cypress.env('LOGIN_PASSWORD')
82
78
  };
@@ -112,33 +108,30 @@ function loginByForm(commandOptions) {
112
108
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
113
109
  } : undefined);
114
110
  } else {
115
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
111
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
116
112
  authCallback();
117
113
  }
118
114
  if (commandOptions.initialRoute) {
119
- var _context2;
120
- cy.visit(_concatInstanceProperty__default["default"](_context2 = "".concat(Cypress.config('baseUrl'))).call(_context2, commandOptions.initialRoute));
115
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
121
116
  cy.url().should('include', commandOptions.initialRoute);
122
117
  }
123
118
  });
124
119
  }
125
120
  const isCustomView = commandOptions => commandOptions.entryPointUriPath === constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH;
126
121
  function loginByOidc(commandOptions) {
127
- var _commandOptions$packa;
128
122
  const isCustomViewConfigCommand = isCustomView(commandOptions);
129
123
  if (!isLocalhost()) {
130
- throw new Error("The \"loginByOidc\" command only works when testing a Custom ".concat(isCustomViewConfigCommand ? 'View' : 'Application', " running on localhost."));
124
+ throw new Error(`The "loginByOidc" command only works when testing a Custom ${isCustomViewConfigCommand ? 'View' : 'Application'} running on localhost.`);
131
125
  }
132
126
  const sessionNonce = uuid.v4();
133
127
  let projectKey = undefined;
134
128
  if (commandOptions.entryPointUriPath !== 'account') {
135
- var _commandOptions$proje2;
136
- projectKey = (_commandOptions$proje2 = commandOptions.projectKey) !== null && _commandOptions$proje2 !== void 0 ? _commandOptions$proje2 : Cypress.env('PROJECT_KEY');
129
+ projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
137
130
  }
138
131
  const customEntityConfigCommand = isCustomViewConfigCommand ? 'customViewConfig' : 'customApplicationConfig';
139
- const packageName = (_commandOptions$packa = commandOptions.packageName) !== null && _commandOptions$packa !== void 0 ? _commandOptions$packa : Cypress.env('PACKAGE_NAME');
132
+ const packageName = commandOptions.packageName ?? Cypress.env('PACKAGE_NAME');
140
133
  if (isCustomViewConfigCommand && !packageName) {
141
- throw new Error("Missing required option \"packageName\" when using the \"loginToMerchantCenterForCustomView\" command.");
134
+ throw new Error(`Missing required option "packageName" when using the "loginToMerchantCenterForCustomView" command.`);
142
135
  }
143
136
  cy.task(customEntityConfigCommand, _objectSpread$1({
144
137
  entryPointUriPath: commandOptions.entryPointUriPath,
@@ -150,7 +143,6 @@ function loginByOidc(commandOptions) {
150
143
  {
151
144
  log: false
152
145
  }).then(appConfig => {
153
- var _appConfig$__DEVELOPM, _appConfig$__DEVELOPM2, _appConfig$__DEVELOPM3, _appConfig$__DEVELOPM4, _commandOptions$login2;
154
146
  // Log loaded application config for debugging purposes.
155
147
  Cypress.log({
156
148
  displayName: 'task',
@@ -160,12 +152,12 @@ function loginByOidc(commandOptions) {
160
152
  const applicationId = appConfig.applicationId;
161
153
  const sessionScope = ssr.buildOidcScope({
162
154
  projectKey,
163
- oAuthScopes: (_appConfig$__DEVELOPM = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM === void 0 || (_appConfig$__DEVELOPM = _appConfig$__DEVELOPM.oidc) === null || _appConfig$__DEVELOPM === void 0 ? void 0 : _appConfig$__DEVELOPM.oAuthScopes,
164
- additionalOAuthScopes: (_appConfig$__DEVELOPM2 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM2 === void 0 || (_appConfig$__DEVELOPM2 = _appConfig$__DEVELOPM2.oidc) === null || _appConfig$__DEVELOPM2 === void 0 ? void 0 : _appConfig$__DEVELOPM2.additionalOAuthScopes,
165
- teamId: (_appConfig$__DEVELOPM3 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM3 === void 0 || (_appConfig$__DEVELOPM3 = _appConfig$__DEVELOPM3.oidc) === null || _appConfig$__DEVELOPM3 === void 0 ? void 0 : _appConfig$__DEVELOPM3.teamId,
166
- applicationId: (_appConfig$__DEVELOPM4 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM4 === void 0 || (_appConfig$__DEVELOPM4 = _appConfig$__DEVELOPM4.oidc) === null || _appConfig$__DEVELOPM4 === void 0 ? void 0 : _appConfig$__DEVELOPM4.applicationId
155
+ oAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.oAuthScopes,
156
+ additionalOAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
157
+ teamId: appConfig.__DEVELOPMENT__?.oidc?.teamId,
158
+ applicationId: appConfig.__DEVELOPMENT__?.oidc?.applicationId
167
159
  });
168
- const userCredentials = (_commandOptions$login2 = commandOptions.login) !== null && _commandOptions$login2 !== void 0 ? _commandOptions$login2 : {
160
+ const userCredentials = commandOptions.login ?? {
169
161
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
170
162
  password: Cypress.env('LOGIN_PASSWORD')
171
163
  };
@@ -173,7 +165,7 @@ function loginByOidc(commandOptions) {
173
165
  // and redirect to the auth callback route.
174
166
  const requestOptions = {
175
167
  method: 'POST',
176
- url: "".concat(appConfig.mcApiUrl, "/tokens"),
168
+ url: `${appConfig.mcApiUrl}/tokens`,
177
169
  body: _objectSpread$1(_objectSpread$1({}, userCredentials), {}, {
178
170
  client_id: applicationId,
179
171
  response_type: constants.OIDC_RESPONSE_TYPES.ID_TOKEN,
@@ -188,11 +180,10 @@ function loginByOidc(commandOptions) {
188
180
  function authCallback() {
189
181
  cy.visit(res.body.redirectTo, {
190
182
  onBeforeLoad(win) {
191
- var _context3;
192
183
  if (projectKey) {
193
184
  win.localStorage.setItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
194
185
  }
195
- win.sessionStorage.setItem(_concatInstanceProperty__default["default"](_context3 = "".concat(constants.STORAGE_KEYS.NONCE, "_")).call(_context3, sessionNonce), _JSON$stringify__default["default"]({
186
+ win.sessionStorage.setItem(`${constants.STORAGE_KEYS.NONCE}_${sessionNonce}`, _JSON$stringify__default["default"]({
196
187
  applicationId,
197
188
  query: {}
198
189
  }));
@@ -213,12 +204,11 @@ function loginByOidc(commandOptions) {
213
204
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
214
205
  } : undefined);
215
206
  } else {
216
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
207
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
217
208
  authCallback();
218
209
  }
219
210
  if (commandOptions.initialRoute) {
220
- var _context4;
221
- cy.visit(_concatInstanceProperty__default["default"](_context4 = "".concat(Cypress.config('baseUrl'))).call(_context4, commandOptions.initialRoute));
211
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
222
212
  cy.url().should('include', commandOptions.initialRoute);
223
213
  }
224
214
  });
@@ -259,7 +249,7 @@ async function fireCdpCommand(command, params) {
259
249
  command,
260
250
  params
261
251
  }).catch(error => {
262
- throw new Error("Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ".concat(error));
252
+ throw new Error(`Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ${error}`);
263
253
  });
264
254
  }
265
255
  function getPositionedCoordinates(x0, y0, width, height, position, frameScale) {
@@ -383,13 +373,12 @@ function getCypressElementCoordinates(
383
373
  // @ts-ignore
384
374
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
375
  jqueryEl, position, scrollBehavior) {
386
- var _ref2;
387
376
  const htmlElement = jqueryEl.get(0);
388
377
  const cypressAppFrame = window.parent.document.querySelector('iframe');
389
378
  if (!cypressAppFrame) {
390
379
  throw new Error('Can not find cypress application iframe, it looks like critical issue. Please rise an issue on GitHub.');
391
380
  }
392
- const effectiveScrollBehavior = (_ref2 = scrollBehavior !== null && scrollBehavior !== void 0 ? scrollBehavior : Cypress.config('scrollBehavior')) !== null && _ref2 !== void 0 ? _ref2 : 'center';
381
+ const effectiveScrollBehavior = scrollBehavior ?? Cypress.config('scrollBehavior') ?? 'center';
393
382
  if (effectiveScrollBehavior && typeof effectiveScrollBehavior !== 'object') {
394
383
  scrollIntoView(htmlElement, effectiveScrollBehavior);
395
384
  }
@@ -399,7 +388,7 @@ jqueryEl, position, scrollBehavior) {
399
388
  width = _getElementPositionXY.width,
400
389
  height = _getElementPositionXY.height,
401
390
  frameScale = _getElementPositionXY.frameScale;
402
- const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position !== null && position !== void 0 ? position : 'center', frameScale),
391
+ const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position ?? 'center', frameScale),
403
392
  _getPositionedCoordin2 = _slicedToArray(_getPositionedCoordin, 2),
404
393
  posX = _getPositionedCoordin2[0],
405
394
  posY = _getPositionedCoordin2[1];
@@ -419,7 +408,6 @@ async function realHover(
419
408
  // @ts-ignore
420
409
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
421
410
  subject) {
422
- var _options$pointer;
423
411
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
424
412
  const _getCypressElementCoo = getCypressElementCoordinates(subject, options.position, options.scrollBehavior),
425
413
  x = _getCypressElementCoo.x,
@@ -440,7 +428,7 @@ subject) {
440
428
  y,
441
429
  type: 'mouseMoved',
442
430
  button: 'none',
443
- pointerType: (_options$pointer = options.pointer) !== null && _options$pointer !== void 0 ? _options$pointer : 'mouse',
431
+ pointerType: options.pointer ?? 'mouse',
444
432
  modifiers: options.shiftKey ? keyToModifierBitMap.Shift : 0
445
433
  });
446
434
  log.snapshot().end();
@@ -448,7 +436,7 @@ subject) {
448
436
  }
449
437
 
450
438
  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; }
451
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
439
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
452
440
 
453
441
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
454
442
 
@@ -465,14 +453,13 @@ Cypress.Commands.add('loginToMerchantCenter', commandOptions => {
465
453
  }
466
454
  });
467
455
  Cypress.Commands.add('loginToMerchantCenterForCustomView', commandOptions => {
468
- var _context;
469
456
  Cypress.log({
470
457
  name: 'loginToMerchantCenterForCustomView'
471
458
  });
472
459
  const projectKey = Cypress.env('PROJECT_KEY');
473
460
  loginByOidc(_objectSpread(_objectSpread({}, commandOptions), {}, {
474
461
  entryPointUriPath: constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH,
475
- initialRoute: _concatInstanceProperty__default["default"](_context = "/".concat(projectKey, "/")).call(_context, constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH)
462
+ initialRoute: `/${projectKey}/${constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}`
476
463
  }));
477
464
  });
478
465
  Cypress.Commands.add('loginByOidc', commandOptions => {
@@ -499,7 +486,7 @@ Cypress.Commands.add('getIframeBody', {
499
486
  $iframe => {
500
487
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
501
488
  return new Cypress.Promise(resolve => {
502
- var _context2;
503
- resolve(_findInstanceProperty__default["default"](_context2 = $iframe.contents()).call(_context2, 'body'));
489
+ var _context;
490
+ resolve(_findInstanceProperty__default["default"](_context = $iframe.contents()).call(_context, 'body'));
504
491
  });
505
492
  });
@@ -9,7 +9,6 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
9
9
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
10
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
11
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
12
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
13
12
  var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
14
13
  var constants$1 = require('@commercetools-frontend/constants');
15
14
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -31,7 +30,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
31
30
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
32
31
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
33
32
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
34
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
35
33
  var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
36
34
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
37
35
  var _URL__default = /*#__PURE__*/_interopDefault(_URL);
@@ -39,7 +37,7 @@ var semver__default = /*#__PURE__*/_interopDefault(semver);
39
37
  var _reduceRightInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceRightInstanceProperty);
40
38
 
41
39
  function ownKeys$1(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; }
42
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context5 = ownKeys$1(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context6 = ownKeys$1(Object(t))).call(_context6, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
40
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
43
41
 
44
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
43
 
@@ -51,11 +49,10 @@ function isFeatureSupported(expectedVersion) {
51
49
  return semver__default["default"].gte(Cypress.version, expectedVersion);
52
50
  }
53
51
  function loginByForm(commandOptions) {
54
- var _commandOptions$proje;
55
52
  if (isLocalhost()) {
56
- throw new Error("At the moment, the \"loginByForm\" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with \"cy.origin\".");
53
+ throw new Error(`At the moment, the "loginByForm" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with "cy.origin".`);
57
54
  }
58
- const projectKey = (_commandOptions$proje = commandOptions.projectKey) !== null && _commandOptions$proje !== void 0 ? _commandOptions$proje : Cypress.env('PROJECT_KEY');
55
+ const projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
59
56
  cy.task('customApplicationConfig', {
60
57
  entryPointUriPath: commandOptions.entryPointUriPath,
61
58
  dotfiles: commandOptions.dotfiles
@@ -64,10 +61,9 @@ function loginByForm(commandOptions) {
64
61
  {
65
62
  log: false
66
63
  }).then(appConfig => {
67
- var _context, _commandOptions$login;
68
- let url = _concatInstanceProperty__default["default"](_context = "/".concat(projectKey, "/")).call(_context, commandOptions.entryPointUriPath);
64
+ let url = `/${projectKey}/${commandOptions.entryPointUriPath}`;
69
65
  if (commandOptions.entryPointUriPath === 'account') {
70
- url = "/".concat(commandOptions.entryPointUriPath);
66
+ url = `/${commandOptions.entryPointUriPath}`;
71
67
  }
72
68
 
73
69
  // Log loaded application config for debugging purposes.
@@ -76,7 +72,7 @@ function loginByForm(commandOptions) {
76
72
  name: 'customApplicationConfig',
77
73
  message: appConfig
78
74
  });
79
- const userCredentials = (_commandOptions$login = commandOptions.login) !== null && _commandOptions$login !== void 0 ? _commandOptions$login : {
75
+ const userCredentials = commandOptions.login ?? {
80
76
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
81
77
  password: Cypress.env('LOGIN_PASSWORD')
82
78
  };
@@ -112,33 +108,30 @@ function loginByForm(commandOptions) {
112
108
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
113
109
  } : undefined);
114
110
  } else {
115
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
111
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
116
112
  authCallback();
117
113
  }
118
114
  if (commandOptions.initialRoute) {
119
- var _context2;
120
- cy.visit(_concatInstanceProperty__default["default"](_context2 = "".concat(Cypress.config('baseUrl'))).call(_context2, commandOptions.initialRoute));
115
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
121
116
  cy.url().should('include', commandOptions.initialRoute);
122
117
  }
123
118
  });
124
119
  }
125
120
  const isCustomView = commandOptions => commandOptions.entryPointUriPath === constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH;
126
121
  function loginByOidc(commandOptions) {
127
- var _commandOptions$packa;
128
122
  const isCustomViewConfigCommand = isCustomView(commandOptions);
129
123
  if (!isLocalhost()) {
130
- throw new Error("The \"loginByOidc\" command only works when testing a Custom ".concat(isCustomViewConfigCommand ? 'View' : 'Application', " running on localhost."));
124
+ throw new Error(`The "loginByOidc" command only works when testing a Custom ${isCustomViewConfigCommand ? 'View' : 'Application'} running on localhost.`);
131
125
  }
132
126
  const sessionNonce = uuid.v4();
133
127
  let projectKey = undefined;
134
128
  if (commandOptions.entryPointUriPath !== 'account') {
135
- var _commandOptions$proje2;
136
- projectKey = (_commandOptions$proje2 = commandOptions.projectKey) !== null && _commandOptions$proje2 !== void 0 ? _commandOptions$proje2 : Cypress.env('PROJECT_KEY');
129
+ projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
137
130
  }
138
131
  const customEntityConfigCommand = isCustomViewConfigCommand ? 'customViewConfig' : 'customApplicationConfig';
139
- const packageName = (_commandOptions$packa = commandOptions.packageName) !== null && _commandOptions$packa !== void 0 ? _commandOptions$packa : Cypress.env('PACKAGE_NAME');
132
+ const packageName = commandOptions.packageName ?? Cypress.env('PACKAGE_NAME');
140
133
  if (isCustomViewConfigCommand && !packageName) {
141
- throw new Error("Missing required option \"packageName\" when using the \"loginToMerchantCenterForCustomView\" command.");
134
+ throw new Error(`Missing required option "packageName" when using the "loginToMerchantCenterForCustomView" command.`);
142
135
  }
143
136
  cy.task(customEntityConfigCommand, _objectSpread$1({
144
137
  entryPointUriPath: commandOptions.entryPointUriPath,
@@ -150,7 +143,6 @@ function loginByOidc(commandOptions) {
150
143
  {
151
144
  log: false
152
145
  }).then(appConfig => {
153
- var _appConfig$__DEVELOPM, _appConfig$__DEVELOPM2, _appConfig$__DEVELOPM3, _appConfig$__DEVELOPM4, _commandOptions$login2;
154
146
  // Log loaded application config for debugging purposes.
155
147
  Cypress.log({
156
148
  displayName: 'task',
@@ -160,12 +152,12 @@ function loginByOidc(commandOptions) {
160
152
  const applicationId = appConfig.applicationId;
161
153
  const sessionScope = ssr.buildOidcScope({
162
154
  projectKey,
163
- oAuthScopes: (_appConfig$__DEVELOPM = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM === void 0 || (_appConfig$__DEVELOPM = _appConfig$__DEVELOPM.oidc) === null || _appConfig$__DEVELOPM === void 0 ? void 0 : _appConfig$__DEVELOPM.oAuthScopes,
164
- additionalOAuthScopes: (_appConfig$__DEVELOPM2 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM2 === void 0 || (_appConfig$__DEVELOPM2 = _appConfig$__DEVELOPM2.oidc) === null || _appConfig$__DEVELOPM2 === void 0 ? void 0 : _appConfig$__DEVELOPM2.additionalOAuthScopes,
165
- teamId: (_appConfig$__DEVELOPM3 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM3 === void 0 || (_appConfig$__DEVELOPM3 = _appConfig$__DEVELOPM3.oidc) === null || _appConfig$__DEVELOPM3 === void 0 ? void 0 : _appConfig$__DEVELOPM3.teamId,
166
- applicationId: (_appConfig$__DEVELOPM4 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM4 === void 0 || (_appConfig$__DEVELOPM4 = _appConfig$__DEVELOPM4.oidc) === null || _appConfig$__DEVELOPM4 === void 0 ? void 0 : _appConfig$__DEVELOPM4.applicationId
155
+ oAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.oAuthScopes,
156
+ additionalOAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
157
+ teamId: appConfig.__DEVELOPMENT__?.oidc?.teamId,
158
+ applicationId: appConfig.__DEVELOPMENT__?.oidc?.applicationId
167
159
  });
168
- const userCredentials = (_commandOptions$login2 = commandOptions.login) !== null && _commandOptions$login2 !== void 0 ? _commandOptions$login2 : {
160
+ const userCredentials = commandOptions.login ?? {
169
161
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
170
162
  password: Cypress.env('LOGIN_PASSWORD')
171
163
  };
@@ -173,7 +165,7 @@ function loginByOidc(commandOptions) {
173
165
  // and redirect to the auth callback route.
174
166
  const requestOptions = {
175
167
  method: 'POST',
176
- url: "".concat(appConfig.mcApiUrl, "/tokens"),
168
+ url: `${appConfig.mcApiUrl}/tokens`,
177
169
  body: _objectSpread$1(_objectSpread$1({}, userCredentials), {}, {
178
170
  client_id: applicationId,
179
171
  response_type: constants.OIDC_RESPONSE_TYPES.ID_TOKEN,
@@ -188,11 +180,10 @@ function loginByOidc(commandOptions) {
188
180
  function authCallback() {
189
181
  cy.visit(res.body.redirectTo, {
190
182
  onBeforeLoad(win) {
191
- var _context3;
192
183
  if (projectKey) {
193
184
  win.localStorage.setItem(constants.STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
194
185
  }
195
- win.sessionStorage.setItem(_concatInstanceProperty__default["default"](_context3 = "".concat(constants.STORAGE_KEYS.NONCE, "_")).call(_context3, sessionNonce), _JSON$stringify__default["default"]({
186
+ win.sessionStorage.setItem(`${constants.STORAGE_KEYS.NONCE}_${sessionNonce}`, _JSON$stringify__default["default"]({
196
187
  applicationId,
197
188
  query: {}
198
189
  }));
@@ -213,12 +204,11 @@ function loginByOidc(commandOptions) {
213
204
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
214
205
  } : undefined);
215
206
  } else {
216
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
207
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
217
208
  authCallback();
218
209
  }
219
210
  if (commandOptions.initialRoute) {
220
- var _context4;
221
- cy.visit(_concatInstanceProperty__default["default"](_context4 = "".concat(Cypress.config('baseUrl'))).call(_context4, commandOptions.initialRoute));
211
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
222
212
  cy.url().should('include', commandOptions.initialRoute);
223
213
  }
224
214
  });
@@ -259,7 +249,7 @@ async function fireCdpCommand(command, params) {
259
249
  command,
260
250
  params
261
251
  }).catch(error => {
262
- throw new Error("Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ".concat(error));
252
+ throw new Error(`Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ${error}`);
263
253
  });
264
254
  }
265
255
  function getPositionedCoordinates(x0, y0, width, height, position, frameScale) {
@@ -383,13 +373,12 @@ function getCypressElementCoordinates(
383
373
  // @ts-ignore
384
374
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
375
  jqueryEl, position, scrollBehavior) {
386
- var _ref2;
387
376
  const htmlElement = jqueryEl.get(0);
388
377
  const cypressAppFrame = window.parent.document.querySelector('iframe');
389
378
  if (!cypressAppFrame) {
390
379
  throw new Error('Can not find cypress application iframe, it looks like critical issue. Please rise an issue on GitHub.');
391
380
  }
392
- const effectiveScrollBehavior = (_ref2 = scrollBehavior !== null && scrollBehavior !== void 0 ? scrollBehavior : Cypress.config('scrollBehavior')) !== null && _ref2 !== void 0 ? _ref2 : 'center';
381
+ const effectiveScrollBehavior = scrollBehavior ?? Cypress.config('scrollBehavior') ?? 'center';
393
382
  if (effectiveScrollBehavior && typeof effectiveScrollBehavior !== 'object') {
394
383
  scrollIntoView(htmlElement, effectiveScrollBehavior);
395
384
  }
@@ -399,7 +388,7 @@ jqueryEl, position, scrollBehavior) {
399
388
  width = _getElementPositionXY.width,
400
389
  height = _getElementPositionXY.height,
401
390
  frameScale = _getElementPositionXY.frameScale;
402
- const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position !== null && position !== void 0 ? position : 'center', frameScale),
391
+ const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position ?? 'center', frameScale),
403
392
  _getPositionedCoordin2 = _slicedToArray(_getPositionedCoordin, 2),
404
393
  posX = _getPositionedCoordin2[0],
405
394
  posY = _getPositionedCoordin2[1];
@@ -419,7 +408,6 @@ async function realHover(
419
408
  // @ts-ignore
420
409
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
421
410
  subject) {
422
- var _options$pointer;
423
411
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
424
412
  const _getCypressElementCoo = getCypressElementCoordinates(subject, options.position, options.scrollBehavior),
425
413
  x = _getCypressElementCoo.x,
@@ -440,7 +428,7 @@ subject) {
440
428
  y,
441
429
  type: 'mouseMoved',
442
430
  button: 'none',
443
- pointerType: (_options$pointer = options.pointer) !== null && _options$pointer !== void 0 ? _options$pointer : 'mouse',
431
+ pointerType: options.pointer ?? 'mouse',
444
432
  modifiers: options.shiftKey ? keyToModifierBitMap.Shift : 0
445
433
  });
446
434
  log.snapshot().end();
@@ -448,7 +436,7 @@ subject) {
448
436
  }
449
437
 
450
438
  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; }
451
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
439
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
452
440
 
453
441
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
454
442
 
@@ -465,14 +453,13 @@ Cypress.Commands.add('loginToMerchantCenter', commandOptions => {
465
453
  }
466
454
  });
467
455
  Cypress.Commands.add('loginToMerchantCenterForCustomView', commandOptions => {
468
- var _context;
469
456
  Cypress.log({
470
457
  name: 'loginToMerchantCenterForCustomView'
471
458
  });
472
459
  const projectKey = Cypress.env('PROJECT_KEY');
473
460
  loginByOidc(_objectSpread(_objectSpread({}, commandOptions), {}, {
474
461
  entryPointUriPath: constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH,
475
- initialRoute: _concatInstanceProperty__default["default"](_context = "/".concat(projectKey, "/")).call(_context, constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH)
462
+ initialRoute: `/${projectKey}/${constants$1.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}`
476
463
  }));
477
464
  });
478
465
  Cypress.Commands.add('loginByOidc', commandOptions => {
@@ -499,7 +486,7 @@ Cypress.Commands.add('getIframeBody', {
499
486
  $iframe => {
500
487
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
501
488
  return new Cypress.Promise(resolve => {
502
- var _context2;
503
- resolve(_findInstanceProperty__default["default"](_context2 = $iframe.contents()).call(_context2, 'body'));
489
+ var _context;
490
+ resolve(_findInstanceProperty__default["default"](_context = $iframe.contents()).call(_context, 'body'));
504
491
  });
505
492
  });
@@ -7,7 +7,6 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
7
7
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
11
10
  import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
12
11
  import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
13
12
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
@@ -20,7 +19,7 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
20
19
  import _reduceRightInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce-right';
21
20
 
22
21
  function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys$1(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys$1(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
22
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$1(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$1(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
24
23
 
25
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
25
 
@@ -32,11 +31,10 @@ function isFeatureSupported(expectedVersion) {
32
31
  return semver.gte(Cypress.version, expectedVersion);
33
32
  }
34
33
  function loginByForm(commandOptions) {
35
- var _commandOptions$proje;
36
34
  if (isLocalhost()) {
37
- throw new Error("At the moment, the \"loginByForm\" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with \"cy.origin\".");
35
+ throw new Error(`At the moment, the "loginByForm" command only works when testing a Merchant Center production URL. Using form login in an application running on localhost is not supported due to issues with "cy.origin".`);
38
36
  }
39
- const projectKey = (_commandOptions$proje = commandOptions.projectKey) !== null && _commandOptions$proje !== void 0 ? _commandOptions$proje : Cypress.env('PROJECT_KEY');
37
+ const projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
40
38
  cy.task('customApplicationConfig', {
41
39
  entryPointUriPath: commandOptions.entryPointUriPath,
42
40
  dotfiles: commandOptions.dotfiles
@@ -45,10 +43,9 @@ function loginByForm(commandOptions) {
45
43
  {
46
44
  log: false
47
45
  }).then(appConfig => {
48
- var _context, _commandOptions$login;
49
- let url = _concatInstanceProperty(_context = "/".concat(projectKey, "/")).call(_context, commandOptions.entryPointUriPath);
46
+ let url = `/${projectKey}/${commandOptions.entryPointUriPath}`;
50
47
  if (commandOptions.entryPointUriPath === 'account') {
51
- url = "/".concat(commandOptions.entryPointUriPath);
48
+ url = `/${commandOptions.entryPointUriPath}`;
52
49
  }
53
50
 
54
51
  // Log loaded application config for debugging purposes.
@@ -57,7 +54,7 @@ function loginByForm(commandOptions) {
57
54
  name: 'customApplicationConfig',
58
55
  message: appConfig
59
56
  });
60
- const userCredentials = (_commandOptions$login = commandOptions.login) !== null && _commandOptions$login !== void 0 ? _commandOptions$login : {
57
+ const userCredentials = commandOptions.login ?? {
61
58
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
62
59
  password: Cypress.env('LOGIN_PASSWORD')
63
60
  };
@@ -93,33 +90,30 @@ function loginByForm(commandOptions) {
93
90
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
94
91
  } : undefined);
95
92
  } else {
96
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
93
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
97
94
  authCallback();
98
95
  }
99
96
  if (commandOptions.initialRoute) {
100
- var _context2;
101
- cy.visit(_concatInstanceProperty(_context2 = "".concat(Cypress.config('baseUrl'))).call(_context2, commandOptions.initialRoute));
97
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
102
98
  cy.url().should('include', commandOptions.initialRoute);
103
99
  }
104
100
  });
105
101
  }
106
102
  const isCustomView = commandOptions => commandOptions.entryPointUriPath === CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH;
107
103
  function loginByOidc(commandOptions) {
108
- var _commandOptions$packa;
109
104
  const isCustomViewConfigCommand = isCustomView(commandOptions);
110
105
  if (!isLocalhost()) {
111
- throw new Error("The \"loginByOidc\" command only works when testing a Custom ".concat(isCustomViewConfigCommand ? 'View' : 'Application', " running on localhost."));
106
+ throw new Error(`The "loginByOidc" command only works when testing a Custom ${isCustomViewConfigCommand ? 'View' : 'Application'} running on localhost.`);
112
107
  }
113
108
  const sessionNonce = v4();
114
109
  let projectKey = undefined;
115
110
  if (commandOptions.entryPointUriPath !== 'account') {
116
- var _commandOptions$proje2;
117
- projectKey = (_commandOptions$proje2 = commandOptions.projectKey) !== null && _commandOptions$proje2 !== void 0 ? _commandOptions$proje2 : Cypress.env('PROJECT_KEY');
111
+ projectKey = commandOptions.projectKey ?? Cypress.env('PROJECT_KEY');
118
112
  }
119
113
  const customEntityConfigCommand = isCustomViewConfigCommand ? 'customViewConfig' : 'customApplicationConfig';
120
- const packageName = (_commandOptions$packa = commandOptions.packageName) !== null && _commandOptions$packa !== void 0 ? _commandOptions$packa : Cypress.env('PACKAGE_NAME');
114
+ const packageName = commandOptions.packageName ?? Cypress.env('PACKAGE_NAME');
121
115
  if (isCustomViewConfigCommand && !packageName) {
122
- throw new Error("Missing required option \"packageName\" when using the \"loginToMerchantCenterForCustomView\" command.");
116
+ throw new Error(`Missing required option "packageName" when using the "loginToMerchantCenterForCustomView" command.`);
123
117
  }
124
118
  cy.task(customEntityConfigCommand, _objectSpread$1({
125
119
  entryPointUriPath: commandOptions.entryPointUriPath,
@@ -131,7 +125,6 @@ function loginByOidc(commandOptions) {
131
125
  {
132
126
  log: false
133
127
  }).then(appConfig => {
134
- var _appConfig$__DEVELOPM, _appConfig$__DEVELOPM2, _appConfig$__DEVELOPM3, _appConfig$__DEVELOPM4, _commandOptions$login2;
135
128
  // Log loaded application config for debugging purposes.
136
129
  Cypress.log({
137
130
  displayName: 'task',
@@ -141,12 +134,12 @@ function loginByOidc(commandOptions) {
141
134
  const applicationId = appConfig.applicationId;
142
135
  const sessionScope = buildOidcScope({
143
136
  projectKey,
144
- oAuthScopes: (_appConfig$__DEVELOPM = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM === void 0 || (_appConfig$__DEVELOPM = _appConfig$__DEVELOPM.oidc) === null || _appConfig$__DEVELOPM === void 0 ? void 0 : _appConfig$__DEVELOPM.oAuthScopes,
145
- additionalOAuthScopes: (_appConfig$__DEVELOPM2 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM2 === void 0 || (_appConfig$__DEVELOPM2 = _appConfig$__DEVELOPM2.oidc) === null || _appConfig$__DEVELOPM2 === void 0 ? void 0 : _appConfig$__DEVELOPM2.additionalOAuthScopes,
146
- teamId: (_appConfig$__DEVELOPM3 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM3 === void 0 || (_appConfig$__DEVELOPM3 = _appConfig$__DEVELOPM3.oidc) === null || _appConfig$__DEVELOPM3 === void 0 ? void 0 : _appConfig$__DEVELOPM3.teamId,
147
- applicationId: (_appConfig$__DEVELOPM4 = appConfig.__DEVELOPMENT__) === null || _appConfig$__DEVELOPM4 === void 0 || (_appConfig$__DEVELOPM4 = _appConfig$__DEVELOPM4.oidc) === null || _appConfig$__DEVELOPM4 === void 0 ? void 0 : _appConfig$__DEVELOPM4.applicationId
137
+ oAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.oAuthScopes,
138
+ additionalOAuthScopes: appConfig.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
139
+ teamId: appConfig.__DEVELOPMENT__?.oidc?.teamId,
140
+ applicationId: appConfig.__DEVELOPMENT__?.oidc?.applicationId
148
141
  });
149
- const userCredentials = (_commandOptions$login2 = commandOptions.login) !== null && _commandOptions$login2 !== void 0 ? _commandOptions$login2 : {
142
+ const userCredentials = commandOptions.login ?? {
150
143
  email: Cypress.env('LOGIN_EMAIL') || Cypress.env('LOGIN_USER'),
151
144
  password: Cypress.env('LOGIN_PASSWORD')
152
145
  };
@@ -154,7 +147,7 @@ function loginByOidc(commandOptions) {
154
147
  // and redirect to the auth callback route.
155
148
  const requestOptions = {
156
149
  method: 'POST',
157
- url: "".concat(appConfig.mcApiUrl, "/tokens"),
150
+ url: `${appConfig.mcApiUrl}/tokens`,
158
151
  body: _objectSpread$1(_objectSpread$1({}, userCredentials), {}, {
159
152
  client_id: applicationId,
160
153
  response_type: OIDC_RESPONSE_TYPES.ID_TOKEN,
@@ -169,11 +162,10 @@ function loginByOidc(commandOptions) {
169
162
  function authCallback() {
170
163
  cy.visit(res.body.redirectTo, {
171
164
  onBeforeLoad(win) {
172
- var _context3;
173
165
  if (projectKey) {
174
166
  win.localStorage.setItem(STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
175
167
  }
176
- win.sessionStorage.setItem(_concatInstanceProperty(_context3 = "".concat(STORAGE_KEYS.NONCE, "_")).call(_context3, sessionNonce), _JSON$stringify({
168
+ win.sessionStorage.setItem(`${STORAGE_KEYS.NONCE}_${sessionNonce}`, _JSON$stringify({
177
169
  applicationId,
178
170
  query: {}
179
171
  }));
@@ -194,12 +186,11 @@ function loginByOidc(commandOptions) {
194
186
  cacheAcrossSpecs: typeof commandOptions.disableCacheAcrossSpecs === 'boolean' ? !commandOptions.disableCacheAcrossSpecs : true
195
187
  } : undefined);
196
188
  } else {
197
- cy.log("We recommend to use \"cy.session\" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via \"experimentalSessionAndOrigin\" for older Cypress versions.");
189
+ cy.log(`We recommend to use "cy.session" to reduce the time to log in between tests. Make sure to have at least Cypress v12 or enable it via "experimentalSessionAndOrigin" for older Cypress versions.`);
198
190
  authCallback();
199
191
  }
200
192
  if (commandOptions.initialRoute) {
201
- var _context4;
202
- cy.visit(_concatInstanceProperty(_context4 = "".concat(Cypress.config('baseUrl'))).call(_context4, commandOptions.initialRoute));
193
+ cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
203
194
  cy.url().should('include', commandOptions.initialRoute);
204
195
  }
205
196
  });
@@ -240,7 +231,7 @@ async function fireCdpCommand(command, params) {
240
231
  command,
241
232
  params
242
233
  }).catch(error => {
243
- throw new Error("Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ".concat(error));
234
+ throw new Error(`Failed request to chrome devtools protocol. This can happen if cypress lost connection to the browser or the command itself is not valid. Original cypress error: ${error}`);
244
235
  });
245
236
  }
246
237
  function getPositionedCoordinates(x0, y0, width, height, position, frameScale) {
@@ -364,13 +355,12 @@ function getCypressElementCoordinates(
364
355
  // @ts-ignore
365
356
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
366
357
  jqueryEl, position, scrollBehavior) {
367
- var _ref2;
368
358
  const htmlElement = jqueryEl.get(0);
369
359
  const cypressAppFrame = window.parent.document.querySelector('iframe');
370
360
  if (!cypressAppFrame) {
371
361
  throw new Error('Can not find cypress application iframe, it looks like critical issue. Please rise an issue on GitHub.');
372
362
  }
373
- const effectiveScrollBehavior = (_ref2 = scrollBehavior !== null && scrollBehavior !== void 0 ? scrollBehavior : Cypress.config('scrollBehavior')) !== null && _ref2 !== void 0 ? _ref2 : 'center';
363
+ const effectiveScrollBehavior = scrollBehavior ?? Cypress.config('scrollBehavior') ?? 'center';
374
364
  if (effectiveScrollBehavior && typeof effectiveScrollBehavior !== 'object') {
375
365
  scrollIntoView(htmlElement, effectiveScrollBehavior);
376
366
  }
@@ -380,7 +370,7 @@ jqueryEl, position, scrollBehavior) {
380
370
  width = _getElementPositionXY.width,
381
371
  height = _getElementPositionXY.height,
382
372
  frameScale = _getElementPositionXY.frameScale;
383
- const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position !== null && position !== void 0 ? position : 'center', frameScale),
373
+ const _getPositionedCoordin = getPositionedCoordinates(x, y, width, height, position ?? 'center', frameScale),
384
374
  _getPositionedCoordin2 = _slicedToArray(_getPositionedCoordin, 2),
385
375
  posX = _getPositionedCoordin2[0],
386
376
  posY = _getPositionedCoordin2[1];
@@ -400,7 +390,6 @@ async function realHover(
400
390
  // @ts-ignore
401
391
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
402
392
  subject) {
403
- var _options$pointer;
404
393
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
405
394
  const _getCypressElementCoo = getCypressElementCoordinates(subject, options.position, options.scrollBehavior),
406
395
  x = _getCypressElementCoo.x,
@@ -421,7 +410,7 @@ subject) {
421
410
  y,
422
411
  type: 'mouseMoved',
423
412
  button: 'none',
424
- pointerType: (_options$pointer = options.pointer) !== null && _options$pointer !== void 0 ? _options$pointer : 'mouse',
413
+ pointerType: options.pointer ?? 'mouse',
425
414
  modifiers: options.shiftKey ? keyToModifierBitMap.Shift : 0
426
415
  });
427
416
  log.snapshot().end();
@@ -429,7 +418,7 @@ subject) {
429
418
  }
430
419
 
431
420
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
432
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
421
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
433
422
 
434
423
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
435
424
 
@@ -446,14 +435,13 @@ Cypress.Commands.add('loginToMerchantCenter', commandOptions => {
446
435
  }
447
436
  });
448
437
  Cypress.Commands.add('loginToMerchantCenterForCustomView', commandOptions => {
449
- var _context;
450
438
  Cypress.log({
451
439
  name: 'loginToMerchantCenterForCustomView'
452
440
  });
453
441
  const projectKey = Cypress.env('PROJECT_KEY');
454
442
  loginByOidc(_objectSpread(_objectSpread({}, commandOptions), {}, {
455
443
  entryPointUriPath: CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH,
456
- initialRoute: _concatInstanceProperty(_context = "/".concat(projectKey, "/")).call(_context, CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH)
444
+ initialRoute: `/${projectKey}/${CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}`
457
445
  }));
458
446
  });
459
447
  Cypress.Commands.add('loginByOidc', commandOptions => {
@@ -480,7 +468,7 @@ Cypress.Commands.add('getIframeBody', {
480
468
  $iframe => {
481
469
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
482
470
  return new Cypress.Promise(resolve => {
483
- var _context2;
484
- resolve(_findInstanceProperty(_context2 = $iframe.contents()).call(_context2, 'body'));
471
+ var _context;
472
+ resolve(_findInstanceProperty(_context = $iframe.contents()).call(_context, 'body'));
485
473
  });
486
474
  });
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var constants = require('./constants-c657705e.cjs.dev.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "22.30.2";
8
+ var version = "22.31.0";
9
9
 
10
10
  exports.OIDC_RESPONSE_TYPES = constants.OIDC_RESPONSE_TYPES;
11
11
  exports.STORAGE_KEYS = constants.STORAGE_KEYS;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var constants = require('./constants-8ad2a50e.cjs.prod.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "22.30.2";
8
+ var version = "22.31.0";
9
9
 
10
10
  exports.OIDC_RESPONSE_TYPES = constants.OIDC_RESPONSE_TYPES;
11
11
  exports.STORAGE_KEYS = constants.STORAGE_KEYS;
@@ -1,6 +1,6 @@
1
1
  export { O as OIDC_RESPONSE_TYPES, S as STORAGE_KEYS } from './constants-18b165fc.esm.js';
2
2
 
3
3
  // NOTE: This string will be replaced on build time with the package version.
4
- var version = "22.30.2";
4
+ var version = "22.31.0";
5
5
 
6
6
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/cypress",
3
- "version": "22.30.2",
3
+ "version": "22.31.0",
4
4
  "description": "Cypress commands and utilities for Custom Applications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -41,9 +41,9 @@
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.22.15",
43
43
  "@babel/runtime-corejs3": "^7.22.15",
44
- "@commercetools-frontend/application-config": "22.30.2",
45
- "@commercetools-frontend/application-shell": "22.30.2",
46
- "@commercetools-frontend/constants": "22.30.2",
44
+ "@commercetools-frontend/application-config": "22.31.0",
45
+ "@commercetools-frontend/application-shell": "22.31.0",
46
+ "@commercetools-frontend/constants": "22.31.0",
47
47
  "@manypkg/get-packages": "1.1.3",
48
48
  "@types/semver": "^7.5.1",
49
49
  "semver": "7.6.2",
@@ -12,7 +12,6 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
15
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
15
  var fs = require('fs');
17
16
  var path = require('path');
18
17
  var getPackages = require('@manypkg/get-packages');
@@ -30,12 +29,11 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
30
29
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
31
30
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
32
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
33
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
34
32
  var fs__default = /*#__PURE__*/_interopDefault(fs);
35
33
  var path__default = /*#__PURE__*/_interopDefault(path);
36
34
 
37
35
  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; }
38
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
36
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
39
37
  function doesFileExist(path) {
40
38
  try {
41
39
  fs__default["default"].accessSync(path);
@@ -47,8 +45,7 @@ function doesFileExist(path) {
47
45
  let cachedAllCustomEntityConfigs;
48
46
  const defaultDotfiles = ['.env', '.env.local'];
49
47
  const loadEnvironmentVariables = (packageDirPath, options) => {
50
- var _options$dotfiles;
51
- const dotfiles = (_options$dotfiles = options.dotfiles) !== null && _options$dotfiles !== void 0 ? _options$dotfiles : defaultDotfiles;
48
+ const dotfiles = options.dotfiles ?? defaultDotfiles;
52
49
  return _reduceInstanceProperty__default["default"](dotfiles).call(dotfiles, (mergedEnvs, dotfile) => {
53
50
  const envPath = path__default["default"].join(packageDirPath, dotfile);
54
51
  if (!doesFileExist(envPath)) {
@@ -58,10 +55,10 @@ const loadEnvironmentVariables = (packageDirPath, options) => {
58
55
  path: envPath
59
56
  });
60
57
  if (env.error) {
61
- console.error("Failed to load environment variables from ".concat(envPath));
58
+ console.error(`Failed to load environment variables from ${envPath}`);
62
59
  return mergedEnvs;
63
60
  }
64
- console.log("Loading environment variables from ".concat(envPath));
61
+ console.log(`Loading environment variables from ${envPath}`);
65
62
  return _objectSpread(_objectSpread({}, mergedEnvs), env.parsed);
66
63
  // Merge it with the environment variables defined in the current process.
67
64
  }, process.env);
@@ -75,15 +72,14 @@ const loadAllCustomEntityConfigs = async options => {
75
72
  cachedAllCustomEntityConfigs = _reduceInstanceProperty__default["default"](packages).call(packages, (allConfigs, packageInfo) => {
76
73
  const processEnv = loadEnvironmentVariables(packageInfo.dir, options);
77
74
  try {
78
- var _context, _context2;
79
75
  const processedConfig = applicationConfig.processConfig({
80
76
  disableCache: true,
81
77
  processEnv,
82
78
  applicationPath: packageInfo.dir
83
79
  });
84
80
  const isCustomViewConfig = Boolean(processedConfig.env.customViewId);
85
- console.log(_concatInstanceProperty__default["default"](_context = "Found Custom ".concat(isCustomViewConfig ? 'View' : 'Application', " config for ")).call(_context, packageInfo.packageJson.name));
86
- const customEntityConfigCacheKey = isCustomViewConfig ? _concatInstanceProperty__default["default"](_context2 = "".concat(processedConfig.env.entryPointUriPath, "-")).call(_context2, packageInfo.packageJson.name) : processedConfig.env.entryPointUriPath;
81
+ console.log(`Found Custom ${isCustomViewConfig ? 'View' : 'Application'} config for ${packageInfo.packageJson.name}`);
82
+ const customEntityConfigCacheKey = isCustomViewConfig ? `${processedConfig.env.entryPointUriPath}-${packageInfo.packageJson.name}` : processedConfig.env.entryPointUriPath;
87
83
  return _objectSpread(_objectSpread({}, allConfigs), {}, {
88
84
  [customEntityConfigCacheKey]: processedConfig.env
89
85
  });
@@ -103,21 +99,20 @@ const customApplicationConfig = async options => {
103
99
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(options);
104
100
  const customApplicationConfig = allCustomEntityConfigs[options.entryPointUriPath];
105
101
  if (!customApplicationConfig) {
106
- throw new Error("Could not find Custom Application config for entry point \"".concat(options.entryPointUriPath, "\""));
102
+ throw new Error(`Could not find Custom Application config for entry point "${options.entryPointUriPath}"`);
107
103
  }
108
- console.log("Using Custom Application config for \"".concat(options.entryPointUriPath, "\""));
104
+ console.log(`Using Custom Application config for "${options.entryPointUriPath}"`);
109
105
  return customApplicationConfig;
110
106
  };
111
107
  const customViewConfig = async options => {
112
- var _context3;
113
108
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(_objectSpread(_objectSpread({}, options), {}, {
114
109
  entryPointUriPath: constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH
115
110
  }));
116
- const customViewConfig = allCustomEntityConfigs[_concatInstanceProperty__default["default"](_context3 = "".concat(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, "-")).call(_context3, options.packageName)];
111
+ const customViewConfig = allCustomEntityConfigs[`${constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}-${options.packageName}`];
117
112
  if (!customViewConfig) {
118
- throw new Error("Could not find Custom View config");
113
+ throw new Error(`Could not find Custom View config`);
119
114
  }
120
- console.log("Using Custom View config for \"".concat(options.packageName, "\""));
115
+ console.log(`Using Custom View config for "${options.packageName}"`);
121
116
  return customViewConfig;
122
117
  };
123
118
 
@@ -12,7 +12,6 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
14
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
15
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
16
15
  var fs = require('fs');
17
16
  var path = require('path');
18
17
  var getPackages = require('@manypkg/get-packages');
@@ -30,12 +29,11 @@ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_O
30
29
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
31
30
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
32
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
33
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
34
32
  var fs__default = /*#__PURE__*/_interopDefault(fs);
35
33
  var path__default = /*#__PURE__*/_interopDefault(path);
36
34
 
37
35
  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; }
38
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
36
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
39
37
  function doesFileExist(path) {
40
38
  try {
41
39
  fs__default["default"].accessSync(path);
@@ -47,8 +45,7 @@ function doesFileExist(path) {
47
45
  let cachedAllCustomEntityConfigs;
48
46
  const defaultDotfiles = ['.env', '.env.local'];
49
47
  const loadEnvironmentVariables = (packageDirPath, options) => {
50
- var _options$dotfiles;
51
- const dotfiles = (_options$dotfiles = options.dotfiles) !== null && _options$dotfiles !== void 0 ? _options$dotfiles : defaultDotfiles;
48
+ const dotfiles = options.dotfiles ?? defaultDotfiles;
52
49
  return _reduceInstanceProperty__default["default"](dotfiles).call(dotfiles, (mergedEnvs, dotfile) => {
53
50
  const envPath = path__default["default"].join(packageDirPath, dotfile);
54
51
  if (!doesFileExist(envPath)) {
@@ -58,10 +55,10 @@ const loadEnvironmentVariables = (packageDirPath, options) => {
58
55
  path: envPath
59
56
  });
60
57
  if (env.error) {
61
- console.error("Failed to load environment variables from ".concat(envPath));
58
+ console.error(`Failed to load environment variables from ${envPath}`);
62
59
  return mergedEnvs;
63
60
  }
64
- console.log("Loading environment variables from ".concat(envPath));
61
+ console.log(`Loading environment variables from ${envPath}`);
65
62
  return _objectSpread(_objectSpread({}, mergedEnvs), env.parsed);
66
63
  // Merge it with the environment variables defined in the current process.
67
64
  }, process.env);
@@ -75,15 +72,14 @@ const loadAllCustomEntityConfigs = async options => {
75
72
  cachedAllCustomEntityConfigs = _reduceInstanceProperty__default["default"](packages).call(packages, (allConfigs, packageInfo) => {
76
73
  const processEnv = loadEnvironmentVariables(packageInfo.dir, options);
77
74
  try {
78
- var _context, _context2;
79
75
  const processedConfig = applicationConfig.processConfig({
80
76
  disableCache: true,
81
77
  processEnv,
82
78
  applicationPath: packageInfo.dir
83
79
  });
84
80
  const isCustomViewConfig = Boolean(processedConfig.env.customViewId);
85
- console.log(_concatInstanceProperty__default["default"](_context = "Found Custom ".concat(isCustomViewConfig ? 'View' : 'Application', " config for ")).call(_context, packageInfo.packageJson.name));
86
- const customEntityConfigCacheKey = isCustomViewConfig ? _concatInstanceProperty__default["default"](_context2 = "".concat(processedConfig.env.entryPointUriPath, "-")).call(_context2, packageInfo.packageJson.name) : processedConfig.env.entryPointUriPath;
81
+ console.log(`Found Custom ${isCustomViewConfig ? 'View' : 'Application'} config for ${packageInfo.packageJson.name}`);
82
+ const customEntityConfigCacheKey = isCustomViewConfig ? `${processedConfig.env.entryPointUriPath}-${packageInfo.packageJson.name}` : processedConfig.env.entryPointUriPath;
87
83
  return _objectSpread(_objectSpread({}, allConfigs), {}, {
88
84
  [customEntityConfigCacheKey]: processedConfig.env
89
85
  });
@@ -103,21 +99,20 @@ const customApplicationConfig = async options => {
103
99
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(options);
104
100
  const customApplicationConfig = allCustomEntityConfigs[options.entryPointUriPath];
105
101
  if (!customApplicationConfig) {
106
- throw new Error("Could not find Custom Application config for entry point \"".concat(options.entryPointUriPath, "\""));
102
+ throw new Error(`Could not find Custom Application config for entry point "${options.entryPointUriPath}"`);
107
103
  }
108
- console.log("Using Custom Application config for \"".concat(options.entryPointUriPath, "\""));
104
+ console.log(`Using Custom Application config for "${options.entryPointUriPath}"`);
109
105
  return customApplicationConfig;
110
106
  };
111
107
  const customViewConfig = async options => {
112
- var _context3;
113
108
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(_objectSpread(_objectSpread({}, options), {}, {
114
109
  entryPointUriPath: constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH
115
110
  }));
116
- const customViewConfig = allCustomEntityConfigs[_concatInstanceProperty__default["default"](_context3 = "".concat(constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, "-")).call(_context3, options.packageName)];
111
+ const customViewConfig = allCustomEntityConfigs[`${constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}-${options.packageName}`];
117
112
  if (!customViewConfig) {
118
- throw new Error("Could not find Custom View config");
113
+ throw new Error(`Could not find Custom View config`);
119
114
  }
120
- console.log("Using Custom View config for \"".concat(options.packageName, "\""));
115
+ console.log(`Using Custom View config for "${options.packageName}"`);
121
116
  return customViewConfig;
122
117
  };
123
118
 
@@ -8,7 +8,6 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
10
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
11
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
12
11
  import fs from 'fs';
13
12
  import path from 'path';
14
13
  import { getPackages } from '@manypkg/get-packages';
@@ -16,7 +15,7 @@ import { processConfig, MissingOrInvalidConfigError } from '@commercetools-front
16
15
  import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
17
16
 
18
17
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context4, _context5; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context5 = ownKeys(Object(t))).call(_context5, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
20
19
  function doesFileExist(path) {
21
20
  try {
22
21
  fs.accessSync(path);
@@ -28,8 +27,7 @@ function doesFileExist(path) {
28
27
  let cachedAllCustomEntityConfigs;
29
28
  const defaultDotfiles = ['.env', '.env.local'];
30
29
  const loadEnvironmentVariables = (packageDirPath, options) => {
31
- var _options$dotfiles;
32
- const dotfiles = (_options$dotfiles = options.dotfiles) !== null && _options$dotfiles !== void 0 ? _options$dotfiles : defaultDotfiles;
30
+ const dotfiles = options.dotfiles ?? defaultDotfiles;
33
31
  return _reduceInstanceProperty(dotfiles).call(dotfiles, (mergedEnvs, dotfile) => {
34
32
  const envPath = path.join(packageDirPath, dotfile);
35
33
  if (!doesFileExist(envPath)) {
@@ -39,10 +37,10 @@ const loadEnvironmentVariables = (packageDirPath, options) => {
39
37
  path: envPath
40
38
  });
41
39
  if (env.error) {
42
- console.error("Failed to load environment variables from ".concat(envPath));
40
+ console.error(`Failed to load environment variables from ${envPath}`);
43
41
  return mergedEnvs;
44
42
  }
45
- console.log("Loading environment variables from ".concat(envPath));
43
+ console.log(`Loading environment variables from ${envPath}`);
46
44
  return _objectSpread(_objectSpread({}, mergedEnvs), env.parsed);
47
45
  // Merge it with the environment variables defined in the current process.
48
46
  }, process.env);
@@ -56,15 +54,14 @@ const loadAllCustomEntityConfigs = async options => {
56
54
  cachedAllCustomEntityConfigs = _reduceInstanceProperty(packages).call(packages, (allConfigs, packageInfo) => {
57
55
  const processEnv = loadEnvironmentVariables(packageInfo.dir, options);
58
56
  try {
59
- var _context, _context2;
60
57
  const processedConfig = processConfig({
61
58
  disableCache: true,
62
59
  processEnv,
63
60
  applicationPath: packageInfo.dir
64
61
  });
65
62
  const isCustomViewConfig = Boolean(processedConfig.env.customViewId);
66
- console.log(_concatInstanceProperty(_context = "Found Custom ".concat(isCustomViewConfig ? 'View' : 'Application', " config for ")).call(_context, packageInfo.packageJson.name));
67
- const customEntityConfigCacheKey = isCustomViewConfig ? _concatInstanceProperty(_context2 = "".concat(processedConfig.env.entryPointUriPath, "-")).call(_context2, packageInfo.packageJson.name) : processedConfig.env.entryPointUriPath;
63
+ console.log(`Found Custom ${isCustomViewConfig ? 'View' : 'Application'} config for ${packageInfo.packageJson.name}`);
64
+ const customEntityConfigCacheKey = isCustomViewConfig ? `${processedConfig.env.entryPointUriPath}-${packageInfo.packageJson.name}` : processedConfig.env.entryPointUriPath;
68
65
  return _objectSpread(_objectSpread({}, allConfigs), {}, {
69
66
  [customEntityConfigCacheKey]: processedConfig.env
70
67
  });
@@ -84,21 +81,20 @@ const customApplicationConfig = async options => {
84
81
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(options);
85
82
  const customApplicationConfig = allCustomEntityConfigs[options.entryPointUriPath];
86
83
  if (!customApplicationConfig) {
87
- throw new Error("Could not find Custom Application config for entry point \"".concat(options.entryPointUriPath, "\""));
84
+ throw new Error(`Could not find Custom Application config for entry point "${options.entryPointUriPath}"`);
88
85
  }
89
- console.log("Using Custom Application config for \"".concat(options.entryPointUriPath, "\""));
86
+ console.log(`Using Custom Application config for "${options.entryPointUriPath}"`);
90
87
  return customApplicationConfig;
91
88
  };
92
89
  const customViewConfig = async options => {
93
- var _context3;
94
90
  const allCustomEntityConfigs = await loadAllCustomEntityConfigs(_objectSpread(_objectSpread({}, options), {}, {
95
91
  entryPointUriPath: CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH
96
92
  }));
97
- const customViewConfig = allCustomEntityConfigs[_concatInstanceProperty(_context3 = "".concat(CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, "-")).call(_context3, options.packageName)];
93
+ const customViewConfig = allCustomEntityConfigs[`${CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH}-${options.packageName}`];
98
94
  if (!customViewConfig) {
99
- throw new Error("Could not find Custom View config");
95
+ throw new Error(`Could not find Custom View config`);
100
96
  }
101
- console.log("Using Custom View config for \"".concat(options.packageName, "\""));
97
+ console.log(`Using Custom View config for "${options.packageName}"`);
102
98
  return customViewConfig;
103
99
  };
104
100