@commercetools-frontend/mc-scripts 27.9.0 → 27.9.1

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.
Files changed (85) hide show
  1. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +1 -1
  2. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +1 -1
  3. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +1 -1
  4. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +17 -17
  5. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +17 -17
  6. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +17 -17
  7. package/dist/{build-1d64eec3.esm.js → build-5a0c84e7.esm.js} +8 -8
  8. package/dist/{build-bfc565e1.cjs.dev.js → build-b9cbc1d1.cjs.dev.js} +8 -8
  9. package/dist/{build-ffa10fc4.cjs.prod.js → build-cdeab3a8.cjs.prod.js} +8 -8
  10. package/dist/{build-vite-e4eeb1a3.cjs.dev.js → build-vite-0e8f3463.cjs.dev.js} +16 -14
  11. package/dist/{build-vite-377f721f.cjs.prod.js → build-vite-aa0e7242.cjs.prod.js} +16 -14
  12. package/dist/{build-vite-2ea8a241.esm.js → build-vite-ce3c4fb6.esm.js} +16 -14
  13. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  14. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  15. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  16. package/dist/{compile-html-f4ac88cc.cjs.dev.js → compile-html-8679f721.cjs.dev.js} +5 -2
  17. package/dist/{compile-html-025cd493.esm.js → compile-html-adfef598.esm.js} +4 -2
  18. package/dist/{compile-html-50fd05ec.cjs.prod.js → compile-html-b80f9651.cjs.prod.js} +5 -2
  19. package/dist/{config-sync-5a7916dc.cjs.dev.js → config-sync-2b56a941.cjs.dev.js} +17 -17
  20. package/dist/{config-sync-df11a5bf.cjs.prod.js → config-sync-41bc7f5e.cjs.prod.js} +17 -17
  21. package/dist/{config-sync-be573249.esm.js → config-sync-7031a7de.esm.js} +17 -17
  22. package/dist/{config-sync-ci-a34b7b54.esm.js → config-sync-ci-1866c188.esm.js} +25 -20
  23. package/dist/{config-sync-ci-1d706e60.cjs.dev.js → config-sync-ci-6d12f2f3.cjs.dev.js} +27 -22
  24. package/dist/{config-sync-ci-9bb94255.cjs.prod.js → config-sync-ci-ea943de9.cjs.prod.js} +27 -22
  25. package/dist/{config-sync-helpers-5fbe31c5.cjs.dev.js → config-sync-helpers-36985f8c.cjs.dev.js} +57 -48
  26. package/dist/{config-sync-helpers-aaaa44ef.cjs.prod.js → config-sync-helpers-79ccaaad.cjs.prod.js} +55 -46
  27. package/dist/{config-sync-helpers-876b7d09.esm.js → config-sync-helpers-875ef4a4.esm.js} +56 -47
  28. package/dist/{create-postcss-config-3a80caef.cjs.dev.js → create-postcss-config-13cb1cb8.cjs.dev.js} +1 -1
  29. package/dist/{create-postcss-config-7d0b0ae1.cjs.prod.js → create-postcss-config-1eeb3d9d.cjs.prod.js} +1 -1
  30. package/dist/{create-postcss-config-a9f7c8a8.esm.js → create-postcss-config-390e8a52.esm.js} +1 -1
  31. package/dist/{create-webpack-config-for-development-ee3e94e6.cjs.prod.js → create-webpack-config-for-development-6608b4e4.cjs.prod.js} +15 -10
  32. package/dist/{create-webpack-config-for-development-a81db65f.cjs.dev.js → create-webpack-config-for-development-9a3a3a93.cjs.dev.js} +15 -10
  33. package/dist/{create-webpack-config-for-development-34ec7d5c.esm.js → create-webpack-config-for-development-dd95f3d5.esm.js} +15 -9
  34. package/dist/{create-webpack-config-for-production-585f2e76.cjs.dev.js → create-webpack-config-for-production-29b34b8c.cjs.dev.js} +8 -8
  35. package/dist/{create-webpack-config-for-production-f1317617.cjs.prod.js → create-webpack-config-for-production-2e6e5036.cjs.prod.js} +8 -8
  36. package/dist/{create-webpack-config-for-production-633d3891.esm.js → create-webpack-config-for-production-31bb3d24.esm.js} +8 -8
  37. package/dist/{credentials-storage-fd195144.cjs.dev.js → credentials-storage-1826f1a2.cjs.dev.js} +1 -1
  38. package/dist/{credentials-storage-ea1c16dc.cjs.prod.js → credentials-storage-60a63c81.cjs.prod.js} +1 -1
  39. package/dist/{credentials-storage-67deadc3.esm.js → credentials-storage-bfaa78f0.esm.js} +1 -1
  40. package/dist/{deployment-previews-set-ee6978a8.esm.js → deployment-previews-set-410cecf1.esm.js} +27 -22
  41. package/dist/{deployment-previews-set-5aeb990a.cjs.dev.js → deployment-previews-set-a04efad3.cjs.dev.js} +28 -22
  42. package/dist/{deployment-previews-set-d96668d6.cjs.prod.js → deployment-previews-set-bebd7a04.cjs.prod.js} +28 -22
  43. package/dist/{graphql-requests-d1683e27.cjs.dev.js → graphql-requests-1ea68584.cjs.dev.js} +8 -5
  44. package/dist/{graphql-requests-8a5d602b.cjs.prod.js → graphql-requests-98b1b779.cjs.prod.js} +8 -5
  45. package/dist/{graphql-requests-1bd861af.esm.js → graphql-requests-c491206a.esm.js} +8 -5
  46. package/dist/{i18n-message-complilation-7311cb29.cjs.dev.js → i18n-message-complilation-393d344a.cjs.prod.js} +1 -1
  47. package/dist/{i18n-message-complilation-7762da61.cjs.prod.js → i18n-message-complilation-3f80e8d6.cjs.dev.js} +1 -1
  48. package/dist/{i18n-message-complilation-21d3b0aa.esm.js → i18n-message-complilation-8aec9d1b.esm.js} +1 -1
  49. package/dist/{login-d51248e8.cjs.prod.js → login-a99d14e6.cjs.prod.js} +38 -60
  50. package/dist/{login-79d02906.esm.js → login-b935aede.esm.js} +37 -58
  51. package/dist/{login-62b53ebe.cjs.dev.js → login-cd99208a.cjs.dev.js} +38 -60
  52. package/dist/{optimizations-da5a0cfa.cjs.prod.js → optimizations-09a6638c.cjs.prod.js} +8 -5
  53. package/dist/{optimizations-54382f7b.esm.js → optimizations-1b3f8157.esm.js} +7 -5
  54. package/dist/{optimizations-56be74d6.cjs.dev.js → optimizations-640ffcac.cjs.dev.js} +8 -5
  55. package/dist/{package-5371f8ba.esm.js → package-15124b28.esm.js} +3 -4
  56. package/dist/{package-af294ed4.cjs.dev.js → package-90af7dfe.cjs.prod.js} +3 -4
  57. package/dist/{package-3539c84a.cjs.prod.js → package-98adb0d5.cjs.dev.js} +3 -4
  58. package/dist/{paths-39f22b8b.esm.js → paths-7bf7e88e.esm.js} +9 -4
  59. package/dist/{paths-7768b440.cjs.prod.js → paths-af1a725a.cjs.prod.js} +10 -4
  60. package/dist/{paths-b76fc753.cjs.dev.js → paths-ec3e3a7d.cjs.dev.js} +10 -4
  61. package/dist/{serve-b1c12985.cjs.dev.js → serve-760fc169.cjs.dev.js} +13 -14
  62. package/dist/{serve-3837602d.cjs.prod.js → serve-87ef7d4f.cjs.prod.js} +13 -14
  63. package/dist/{serve-22475fec.esm.js → serve-ddf30b4c.esm.js} +13 -13
  64. package/dist/{start-6fe0ccd2.esm.js → start-08895b5f.esm.js} +11 -13
  65. package/dist/{start-6e03b662.cjs.dev.js → start-a0945fde.cjs.dev.js} +11 -13
  66. package/dist/{start-bea9b61d.cjs.prod.js → start-d9bd5dfb.cjs.prod.js} +11 -13
  67. package/dist/{start-vite-dd8a1e26.cjs.prod.js → start-vite-00514c35.cjs.prod.js} +5 -4
  68. package/dist/{start-vite-698c9e82.cjs.dev.js → start-vite-10e49e5c.cjs.dev.js} +5 -4
  69. package/dist/{start-vite-4b0df191.esm.js → start-vite-745d3123.esm.js} +5 -4
  70. package/dist/{try-load-nimbus-plugins-d502a5fe.cjs.dev.js → try-load-nimbus-plugins-06ce5d83.cjs.dev.js} +1 -1
  71. package/dist/{try-load-nimbus-plugins-2f528d8f.esm.js → try-load-nimbus-plugins-526dccbd.esm.js} +1 -1
  72. package/dist/{try-load-nimbus-plugins-a713d7d3.cjs.prod.js → try-load-nimbus-plugins-59c3a594.cjs.prod.js} +1 -1
  73. package/dist/{vite-plugin-svgr-de6ee7da.esm.js → vite-plugin-svgr-22c8d518.esm.js} +4 -4
  74. package/dist/{vite-plugin-svgr-4034a834.cjs.prod.js → vite-plugin-svgr-53ef97c7.cjs.dev.js} +4 -4
  75. package/dist/{vite-plugin-svgr-7d06f400.cjs.dev.js → vite-plugin-svgr-5de1cad9.cjs.prod.js} +4 -4
  76. package/package.json +32 -31
  77. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  78. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  79. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  80. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +7 -8
  81. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +7 -8
  82. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +7 -8
  83. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +1 -1
  84. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +1 -1
  85. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +1 -1
@@ -2,13 +2,14 @@
2
2
 
3
3
  var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
4
4
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
5
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
5
6
  var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
7
  var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
7
8
  var chalk = require('chalk');
8
9
  var prompts = require('prompts');
9
10
  var applicationConfig = require('@commercetools-frontend/application-config');
10
- var credentialsStorage$1 = require('./credentials-storage-ea1c16dc.cjs.prod.js');
11
- var graphqlRequests = require('./graphql-requests-8a5d602b.cjs.prod.js');
11
+ var credentialsStorage$1 = require('./credentials-storage-60a63c81.cjs.prod.js');
12
+ var graphqlRequests = require('./graphql-requests-98b1b779.cjs.prod.js');
12
13
  require('@babel/runtime-corejs3/helpers/classCallCheck');
13
14
  require('@babel/runtime-corejs3/helpers/createClass');
14
15
  require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -30,12 +31,13 @@ require('graphql');
30
31
  require('graphql-request');
31
32
  require('@commercetools-frontend/constants');
32
33
  require('@commercetools/http-user-agent');
33
- require('./package-3539c84a.cjs.prod.js');
34
+ require('./package-90af7dfe.cjs.prod.js');
34
35
 
35
36
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
36
37
 
37
38
  var _URL__default = /*#__PURE__*/_interopDefault(_URL);
38
39
  var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
40
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
39
41
  var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
40
42
  var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
41
43
  var chalk__default = /*#__PURE__*/_interopDefault(chalk);
@@ -55,24 +57,25 @@ const validateUrl = function () {
55
57
  const validateAlias = function () {
56
58
  let alias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
57
59
  try {
58
- new _URL__default["default"](`https://${alias}.commercetools.com/`);
60
+ new _URL__default["default"]("https://".concat(alias, ".commercetools.com/"));
59
61
  return true;
60
62
  } catch (error) {
61
63
  return false;
62
64
  }
63
65
  };
64
66
  const getMcUrlLink = _ref => {
67
+ var _context2, _context3, _context4;
65
68
  let mcApiUrl = _ref.mcApiUrl,
66
69
  organizationId = _ref.organizationId,
67
70
  customEntityId = _ref.customEntityId,
68
71
  isCustomView = _ref.isCustomView;
69
72
  const mcUrl = mcApiUrl.replace('mc-api', 'mc');
70
- const customEntityLink = `${mcUrl}/account/organizations/${organizationId}/custom-${isCustomView ? 'views' : 'applications'}/owned/${customEntityId}/deployment-previews`;
73
+ const customEntityLink = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = "".concat(mcUrl, "/account/organizations/")).call(_context4, organizationId, "/custom-")).call(_context3, isCustomView ? 'views' : 'applications', "/owned/")).call(_context2, customEntityId, "/deployment-previews");
71
74
  return customEntityLink;
72
75
  };
73
76
  const isCustomViewData = data => data.entryPointUriPath === undefined;
74
77
  async function setDeploymentPreview(_ref2) {
75
- var _context3;
78
+ var _context6;
76
79
  let mcApiUrl = _ref2.mcApiUrl,
77
80
  applicationId = _ref2.applicationId,
78
81
  applicationIdentifier = _ref2.applicationIdentifier,
@@ -93,28 +96,28 @@ async function setDeploymentPreview(_ref2) {
93
96
  applicationIdentifier
94
97
  });
95
98
  if (!fetchedCustomApplication) {
96
- throw new Error(`The Custom Application "${applicationIdentifier}" does not exist in the Merchant Center. Please create a Custom Application first before configuring deployment previews.`);
99
+ throw new Error("The Custom Application \"".concat(applicationIdentifier, "\" does not exist in the Merchant Center. Please create a Custom Application first before configuring deployment previews."));
97
100
  }
98
101
  let deploymentAlias = options.alias;
99
102
  // If the alias was not provided as an argument to the script, let's ask for it.
100
103
  if (!deploymentAlias) {
101
- var _context2;
104
+ var _context5;
102
105
  const _await$prompts = await prompts__default["default"]({
103
106
  type: 'text',
104
107
  name: 'alias',
105
- message: _filterInstanceProperty__default["default"](_context2 = [`Enter the alias for the deployment preview`, options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context2, Boolean).join('\n'),
108
+ message: _filterInstanceProperty__default["default"](_context5 = ["Enter the alias for the deployment preview", options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context5, Boolean).join('\n'),
106
109
  validate: value => validateAlias(value)
107
110
  }),
108
111
  alias = _await$prompts.alias;
109
112
  deploymentAlias = alias;
110
113
  }
111
- const existingDeploymentPreview = _findInstanceProperty__default["default"](_context3 = fetchedCustomApplication.application.deployments).call(_context3, deployment => deployment.alias === deploymentAlias);
114
+ const existingDeploymentPreview = _findInstanceProperty__default["default"](_context6 = fetchedCustomApplication.application.deployments).call(_context6, deployment => deployment.alias === deploymentAlias);
112
115
  if (!options.alias && !options.url && existingDeploymentPreview) {
113
- var _context4;
116
+ var _context7;
114
117
  const _await$prompts2 = await prompts__default["default"]({
115
118
  type: 'confirm',
116
119
  name: 'aliasOverrideConfirmation',
117
- message: _filterInstanceProperty__default["default"](_context4 = [`The alias "${chalk__default["default"].green(deploymentAlias)}" already exists. Do you want to proceed and update the URL?`, options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context4, Boolean).join('\n'),
120
+ message: _filterInstanceProperty__default["default"](_context7 = ["The alias \"".concat(chalk__default["default"].green(deploymentAlias), "\" already exists. Do you want to proceed and update the URL?"), options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context7, Boolean).join('\n'),
118
121
  initial: false
119
122
  }),
120
123
  aliasOverrideConfirmation = _await$prompts2.aliasOverrideConfirmation;
@@ -125,19 +128,20 @@ async function setDeploymentPreview(_ref2) {
125
128
  }
126
129
  let deploymentUrl = options.url;
127
130
  if (!deploymentUrl) {
128
- var _context5;
131
+ var _context8;
129
132
  const _await$prompts3 = await prompts__default["default"]({
130
133
  type: 'text',
131
134
  name: 'url',
132
- message: _filterInstanceProperty__default["default"](_context5 = [`Enter the URL for the deployment preview`, options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context5, Boolean).join('\n'),
135
+ message: _filterInstanceProperty__default["default"](_context8 = ["Enter the URL for the deployment preview", options.dryRun && chalk__default["default"].gray('Using "--dry-run", no deployment preview will be created.')]).call(_context8, Boolean).join('\n'),
133
136
  validate: value => validateUrl(value)
134
137
  }),
135
138
  url = _await$prompts3.url;
136
139
  deploymentUrl = url;
137
140
  }
138
141
  if (options.dryRun) {
139
- const message = existingDeploymentPreview ? `The existing deployment preview with alias "${deploymentAlias}" would have been updated with this url: "${deploymentUrl}".` : `A new deployment preview with alias "${deploymentAlias}" would have been created with this url: "${deploymentUrl}".`;
140
- console.log(`\n${message}\n`);
142
+ var _context9, _context0;
143
+ const message = existingDeploymentPreview ? _concatInstanceProperty__default["default"](_context9 = "The existing deployment preview with alias \"".concat(deploymentAlias, "\" would have been updated with this url: \"")).call(_context9, deploymentUrl, "\".") : _concatInstanceProperty__default["default"](_context0 = "A new deployment preview with alias \"".concat(deploymentAlias, "\" would have been created with this url: \"")).call(_context0, deploymentUrl, "\".");
144
+ console.log("\n".concat(message, "\n"));
141
145
  return;
142
146
  }
143
147
  const mcDeploymentPreviewsLink = getMcUrlLink({
@@ -147,6 +151,7 @@ async function setDeploymentPreview(_ref2) {
147
151
  isCustomView
148
152
  });
149
153
  if (existingDeploymentPreview) {
154
+ var _context1;
150
155
  await graphqlRequests.updateCustomApplicationDeploymentPreview({
151
156
  mcApiUrl,
152
157
  organizationId: fetchedCustomApplication.organizationId,
@@ -156,9 +161,10 @@ async function setDeploymentPreview(_ref2) {
156
161
  url: deploymentUrl
157
162
  }
158
163
  });
159
- console.log(chalk__default["default"].green(`Deployment preview with alias "${deploymentAlias}" updated successfully with URL "${deploymentUrl}".`));
160
- console.log(chalk__default["default"].green(`You can access the deployment previews at: ${mcDeploymentPreviewsLink}`));
164
+ console.log(chalk__default["default"].green(_concatInstanceProperty__default["default"](_context1 = "Deployment preview with alias \"".concat(deploymentAlias, "\" updated successfully with URL \"")).call(_context1, deploymentUrl, "\".")));
165
+ console.log(chalk__default["default"].green("You can access the deployment previews at: ".concat(mcDeploymentPreviewsLink)));
161
166
  } else {
167
+ var _context10;
162
168
  await graphqlRequests.createCustomApplicationDeploymentPreview({
163
169
  mcApiUrl,
164
170
  organizationId: fetchedCustomApplication.organizationId,
@@ -169,8 +175,8 @@ async function setDeploymentPreview(_ref2) {
169
175
  url: deploymentUrl
170
176
  }
171
177
  });
172
- console.log(chalk__default["default"].green(`Deployment preview with alias "${deploymentAlias}" created successfully with URL "${deploymentUrl}".`));
173
- console.log(chalk__default["default"].green(`You can access the deployment previews at: ${mcDeploymentPreviewsLink}`));
178
+ console.log(chalk__default["default"].green(_concatInstanceProperty__default["default"](_context10 = "Deployment preview with alias \"".concat(deploymentAlias, "\" created successfully with URL \"")).call(_context10, deploymentUrl, "\".")));
179
+ console.log(chalk__default["default"].green("You can access the deployment previews at: ".concat(mcDeploymentPreviewsLink)));
174
180
  }
175
181
  }
176
182
  async function run(options) {
@@ -180,11 +186,11 @@ async function run(options) {
180
186
  mcApiUrl = _applicationConfig$en.mcApiUrl,
181
187
  applicationIdentifier = _applicationConfig$en.applicationIdentifier;
182
188
  const isCustomView = isCustomViewData(localCustomEntityData);
183
- console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
189
+ console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
184
190
  console.log();
185
191
  const isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
186
192
  if (!isSessionValid) {
187
- throw new Error(`You don't have a valid session. Please, run the "mc-scripts login" command to authenticate yourself.`);
193
+ throw new Error("You don't have a valid session. Please, run the \"mc-scripts login\" command to authenticate yourself.");
188
194
  }
189
195
  if (isCustomView) {
190
196
  throw new Error('Deployments previews are not supported for Custom Views.');
@@ -14,9 +14,9 @@ var chalk = require('chalk');
14
14
  var graphql = require('graphql');
15
15
  var graphqlRequest = require('graphql-request');
16
16
  var constants = require('@commercetools-frontend/constants');
17
- var credentialsStorage$1 = require('./credentials-storage-fd195144.cjs.dev.js');
17
+ var credentialsStorage$1 = require('./credentials-storage-1826f1a2.cjs.dev.js');
18
18
  var createHttpUserAgent = require('@commercetools/http-user-agent');
19
- var _package = require('./package-af294ed4.cjs.dev.js');
19
+ var _package = require('./package-98adb0d5.cjs.dev.js');
20
20
 
21
21
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
22
22
 
@@ -57,9 +57,9 @@ async function requestWithTokenRetry(document, requestOptions) {
57
57
  let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
58
58
  const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
59
59
  const tokenHeader = {
60
- [constants.SUPPORTED_HEADERS.AUTHORIZATION]: `Bearer ${token}`
60
+ [constants.SUPPORTED_HEADERS.AUTHORIZATION]: "Bearer ".concat(token)
61
61
  };
62
- const client = new graphqlRequest.GraphQLClient(`${requestOptions.mcApiUrl}/graphql`, {
62
+ const client = new graphqlRequest.GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
63
63
  headers: _objectSpread(_objectSpread({
64
64
  Accept: 'application/json',
65
65
  'Content-Type': 'application/json',
@@ -87,7 +87,10 @@ async function requestWithTokenRetry(document, requestOptions) {
87
87
  // If it's an unauthorized error, retry the request to force the token to be refreshed.
88
88
  if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
89
89
  var _context;
90
- const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => graphqlError.extensions?.code === 'UNAUTHENTICATED');
90
+ const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => {
91
+ var _graphqlError$extensi;
92
+ return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
93
+ });
91
94
  if (isUnauthorizedError) {
92
95
  console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
93
96
  return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
@@ -14,9 +14,9 @@ var chalk = require('chalk');
14
14
  var graphql = require('graphql');
15
15
  var graphqlRequest = require('graphql-request');
16
16
  var constants = require('@commercetools-frontend/constants');
17
- var credentialsStorage$1 = require('./credentials-storage-ea1c16dc.cjs.prod.js');
17
+ var credentialsStorage$1 = require('./credentials-storage-60a63c81.cjs.prod.js');
18
18
  var createHttpUserAgent = require('@commercetools/http-user-agent');
19
- var _package = require('./package-3539c84a.cjs.prod.js');
19
+ var _package = require('./package-90af7dfe.cjs.prod.js');
20
20
 
21
21
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
22
22
 
@@ -57,9 +57,9 @@ async function requestWithTokenRetry(document, requestOptions) {
57
57
  let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
58
58
  const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
59
59
  const tokenHeader = {
60
- [constants.SUPPORTED_HEADERS.AUTHORIZATION]: `Bearer ${token}`
60
+ [constants.SUPPORTED_HEADERS.AUTHORIZATION]: "Bearer ".concat(token)
61
61
  };
62
- const client = new graphqlRequest.GraphQLClient(`${requestOptions.mcApiUrl}/graphql`, {
62
+ const client = new graphqlRequest.GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
63
63
  headers: _objectSpread(_objectSpread({
64
64
  Accept: 'application/json',
65
65
  'Content-Type': 'application/json',
@@ -87,7 +87,10 @@ async function requestWithTokenRetry(document, requestOptions) {
87
87
  // If it's an unauthorized error, retry the request to force the token to be refreshed.
88
88
  if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
89
89
  var _context;
90
- const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => graphqlError.extensions?.code === 'UNAUTHENTICATED');
90
+ const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => {
91
+ var _graphqlError$extensi;
92
+ return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
93
+ });
91
94
  if (isUnauthorizedError) {
92
95
  console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
93
96
  return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
@@ -12,9 +12,9 @@ import chalk from 'chalk';
12
12
  import { print } from 'graphql';
13
13
  import { GraphQLClient, ClientError } from 'graphql-request';
14
14
  import { GRAPHQL_TARGETS, SUPPORTED_HEADERS } from '@commercetools-frontend/constants';
15
- import { C as CredentialsStorage } from './credentials-storage-67deadc3.esm.js';
15
+ import { C as CredentialsStorage } from './credentials-storage-bfaa78f0.esm.js';
16
16
  import createHttpUserAgent from '@commercetools/http-user-agent';
17
- import { p as pkgJson } from './package-5371f8ba.esm.js';
17
+ import { p as pkgJson } from './package-15124b28.esm.js';
18
18
 
19
19
  const userAgent = createHttpUserAgent({
20
20
  name: 'graphql-request',
@@ -41,9 +41,9 @@ async function requestWithTokenRetry(document, requestOptions) {
41
41
  let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
42
42
  const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
43
43
  const tokenHeader = {
44
- [SUPPORTED_HEADERS.AUTHORIZATION]: `Bearer ${token}`
44
+ [SUPPORTED_HEADERS.AUTHORIZATION]: "Bearer ".concat(token)
45
45
  };
46
- const client = new GraphQLClient(`${requestOptions.mcApiUrl}/graphql`, {
46
+ const client = new GraphQLClient("".concat(requestOptions.mcApiUrl, "/graphql"), {
47
47
  headers: _objectSpread(_objectSpread({
48
48
  Accept: 'application/json',
49
49
  'Content-Type': 'application/json',
@@ -71,7 +71,10 @@ async function requestWithTokenRetry(document, requestOptions) {
71
71
  // If it's an unauthorized error, retry the request to force the token to be refreshed.
72
72
  if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
73
73
  var _context;
74
- const isUnauthorizedError = _someInstanceProperty(_context = error.response.errors).call(_context, graphqlError => graphqlError.extensions?.code === 'UNAUTHENTICATED');
74
+ const isUnauthorizedError = _someInstanceProperty(_context = error.response.errors).call(_context, graphqlError => {
75
+ var _graphqlError$extensi;
76
+ return ((_graphqlError$extensi = graphqlError.extensions) === null || _graphqlError$extensi === void 0 ? void 0 : _graphqlError$extensi.code) === 'UNAUTHENTICATED';
77
+ });
75
78
  if (isUnauthorizedError) {
76
79
  console.log(chalk.yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
77
80
  return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
@@ -15,7 +15,7 @@ function getI18nMessageFormat(source) {
15
15
  }
16
16
  function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
17
17
  if (!process.env.CI) {
18
- warnFunction(new Error(`[i18n message compilation] Message compilation on ${fileIdentifier} has failed.\n` + `Consider setting the environmental variable ${chalk__default["default"].yellow('DISABLE_I18N_MESSAGE_COMPILATION')} to true to disable the message loader or resolve the issues on the messages file.\n` + `${error instanceof Error ? `Error: ${error.message}` : ''}`));
18
+ warnFunction(new Error("[i18n message compilation] Message compilation on ".concat(fileIdentifier, " has failed.\n") + "Consider setting the environmental variable ".concat(chalk__default["default"].yellow('DISABLE_I18N_MESSAGE_COMPILATION'), " to true to disable the message loader or resolve the issues on the messages file.\n") + "".concat(error instanceof Error ? "Error: ".concat(error.message) : '')));
19
19
  }
20
20
  }
21
21
 
@@ -15,7 +15,7 @@ function getI18nMessageFormat(source) {
15
15
  }
16
16
  function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
17
17
  if (!process.env.CI) {
18
- warnFunction(new Error(`[i18n message compilation] Message compilation on ${fileIdentifier} has failed.\n` + `Consider setting the environmental variable ${chalk__default["default"].yellow('DISABLE_I18N_MESSAGE_COMPILATION')} to true to disable the message loader or resolve the issues on the messages file.\n` + `${error instanceof Error ? `Error: ${error.message}` : ''}`));
18
+ warnFunction(new Error("[i18n message compilation] Message compilation on ".concat(fileIdentifier, " has failed.\n") + "Consider setting the environmental variable ".concat(chalk__default["default"].yellow('DISABLE_I18N_MESSAGE_COMPILATION'), " to true to disable the message loader or resolve the issues on the messages file.\n") + "".concat(error instanceof Error ? "Error: ".concat(error.message) : '')));
19
19
  }
20
20
  }
21
21
 
@@ -8,7 +8,7 @@ function getI18nMessageFormat(source) {
8
8
  }
9
9
  function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
10
10
  if (!process.env.CI) {
11
- warnFunction(new Error(`[i18n message compilation] Message compilation on ${fileIdentifier} has failed.\n` + `Consider setting the environmental variable ${chalk.yellow('DISABLE_I18N_MESSAGE_COMPILATION')} to true to disable the message loader or resolve the issues on the messages file.\n` + `${error instanceof Error ? `Error: ${error.message}` : ''}`));
11
+ warnFunction(new Error("[i18n message compilation] Message compilation on ".concat(fileIdentifier, " has failed.\n") + "Consider setting the environmental variable ".concat(chalk.yellow('DISABLE_I18N_MESSAGE_COMPILATION'), " to true to disable the message loader or resolve the issues on the messages file.\n") + "".concat(error instanceof Error ? "Error: ".concat(error.message) : '')));
12
12
  }
13
13
  }
14
14
 
@@ -3,7 +3,7 @@
3
3
  var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
4
4
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
5
5
  var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
6
- var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
6
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
7
7
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
8
8
  var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
9
9
  var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
@@ -15,10 +15,10 @@ var crypto = require('node:crypto');
15
15
  var process = require('node:process');
16
16
  var chalk = require('chalk');
17
17
  var applicationConfig = require('@commercetools-frontend/application-config');
18
- var _package = require('./package-3539c84a.cjs.prod.js');
18
+ var _package = require('./package-90af7dfe.cjs.prod.js');
19
19
  var http = require('node:http');
20
20
  var jwtDecode = require('jwt-decode');
21
- var credentialsStorage$1 = require('./credentials-storage-ea1c16dc.cjs.prod.js');
21
+ var credentialsStorage$1 = require('./credentials-storage-60a63c81.cjs.prod.js');
22
22
  require('@babel/runtime-corejs3/helpers/classCallCheck');
23
23
  require('@babel/runtime-corejs3/helpers/createClass');
24
24
  require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
50
50
  var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
51
51
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
52
52
  var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
53
- var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
53
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
54
54
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
55
55
  var _flatMapInstanceProperty__default = /*#__PURE__*/_interopDefault(_flatMapInstanceProperty);
56
56
  var _setTimeout__default = /*#__PURE__*/_interopDefault(_setTimeout);
@@ -62,21 +62,20 @@ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
62
62
  var process__default = /*#__PURE__*/_interopDefault(process);
63
63
  var chalk__default = /*#__PURE__*/_interopDefault(chalk);
64
64
  var http__default = /*#__PURE__*/_interopDefault(http);
65
- var jwtDecode__default = /*#__PURE__*/_interopDefault(jwtDecode);
66
65
 
67
66
  function createAuthCallbackServer(options) {
68
67
  const server = http__default["default"].createServer(async (request, response) => {
69
68
  try {
70
- var _context, _context2;
71
- if (((_context = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _includesInstanceProperty__default["default"](_context), _context))?.(`/${options.clientIdentifier}/oidc/callback`)) {
69
+ var _request$url;
70
+ if ((_request$url = request.url) !== null && _request$url !== void 0 && _includesInstanceProperty__default["default"](_request$url).call(_request$url, "/".concat(options.clientIdentifier, "/oidc/callback"))) {
72
71
  const incomingUrl = new _URL__default["default"](request.url, 'http://localhost');
73
72
  const sessionToken = incomingUrl.searchParams.get('sessionToken');
74
73
  const requestedState = incomingUrl.searchParams.get('state');
75
74
  if (!sessionToken) {
76
75
  throw new Error('Invalid authentication flow (missing sessionToken)');
77
76
  }
78
- const decodedSessionToken = jwtDecode__default["default"](sessionToken);
79
- if (decodedSessionToken?.nonce !== options.nonce) {
77
+ const decodedSessionToken = jwtDecode.jwtDecode(sessionToken);
78
+ if ((decodedSessionToken === null || decodedSessionToken === void 0 ? void 0 : decodedSessionToken.nonce) !== options.nonce) {
80
79
  throw new Error('Invalid authentication flow (nonce mismatch)');
81
80
  }
82
81
  if (requestedState !== options.state) {
@@ -99,7 +98,7 @@ function createAuthCallbackServer(options) {
99
98
  response.end(error.message);
100
99
  } else {
101
100
  console.error(error);
102
- response.end(`Invalid authentication flow.`);
101
+ response.end("Invalid authentication flow.");
103
102
  }
104
103
  server.close(() => {
105
104
  process.exit();
@@ -111,14 +110,14 @@ function createAuthCallbackServer(options) {
111
110
 
112
111
  const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
113
112
  const port = 3001;
114
- const clientIdentifier = `mc-scripts-${_package.pkgJson.version}`;
113
+ const clientIdentifier = "mc-scripts-".concat(_package.pkgJson.version);
115
114
  const isServerError = error => {
116
115
  return error instanceof Error && 'code' in error;
117
116
  };
118
117
  const startServer = server => new _Promise__default["default"]((resolve, reject) => {
119
118
  server.listen(port, 'localhost').on('listening', resolve).on('error', error => {
120
119
  if (isServerError(error) && error.code === 'EADDRINUSE') {
121
- return reject(new Error(`The address "localhost:${port}" is already in use. Are you running a Merchant Center application in other process? Please stop that and try again.`, {
120
+ return reject(new Error("The address \"localhost:".concat(port, "\" is already in use. Are you running a Merchant Center application in other process? Please stop that and try again."), {
122
121
  cause: error
123
122
  }));
124
123
  }
@@ -154,8 +153,9 @@ const resolveProjectKey = async options => {
154
153
  return process__default["default"].env.CTP_PROJECT_KEY;
155
154
  }
156
155
  try {
156
+ var _applicationConfig$en;
157
157
  const applicationConfig$1 = await applicationConfig.processConfig();
158
- return applicationConfig$1.env.__DEVELOPMENT__?.oidc?.initialProjectKey;
158
+ return (_applicationConfig$en = applicationConfig$1.env.__DEVELOPMENT__) === null || _applicationConfig$en === void 0 || (_applicationConfig$en = _applicationConfig$en.oidc) === null || _applicationConfig$en === void 0 ? void 0 : _applicationConfig$en.initialProjectKey;
159
159
  } catch (error) {
160
160
  // It's ok if there's not application config file or if it does not contain the initialProjectKey
161
161
  return;
@@ -164,10 +164,10 @@ const resolveProjectKey = async options => {
164
164
  const mapOAuthScopesToClaims = scopes => {
165
165
  return _mapInstanceProperty__default["default"](scopes).call(scopes, scope => {
166
166
  if (_startsWithInstanceProperty__default["default"](scope).call(scope, 'view_')) {
167
- return `view:${scope}`;
167
+ return "view:".concat(scope);
168
168
  }
169
169
  if (_startsWithInstanceProperty__default["default"](scope).call(scope, 'manage_')) {
170
- return `manage:${scope}`;
170
+ return "manage:".concat(scope);
171
171
  }
172
172
  return scope;
173
173
  });
@@ -175,10 +175,12 @@ const mapOAuthScopesToClaims = scopes => {
175
175
  const mapAdditionalOAuthScopesToClaims = (name, scopes) => {
176
176
  return _mapInstanceProperty__default["default"](scopes).call(scopes, scope => {
177
177
  if (_startsWithInstanceProperty__default["default"](scope).call(scope, 'view_')) {
178
- return `view/${name}:${scope}`;
178
+ var _context;
179
+ return _concatInstanceProperty__default["default"](_context = "view/".concat(name, ":")).call(_context, scope);
179
180
  }
180
181
  if (_startsWithInstanceProperty__default["default"](scope).call(scope, 'manage_')) {
181
- return `manage/${name}:${scope}`;
182
+ var _context2;
183
+ return _concatInstanceProperty__default["default"](_context2 = "manage/".concat(name, ":")).call(_context2, scope);
182
184
  }
183
185
  return scope;
184
186
  });
@@ -190,15 +192,15 @@ const resolveOAuthScopes = async options => {
190
192
 
191
193
  // We first check whether the user has set the CTP_OAUTH_SCOPES environment variable
192
194
  if (process__default["default"].env.CTP_OAUTH_SCOPES) {
193
- var _context, _context2;
194
- return mapOAuthScopesToClaims(((_context = process__default["default"].env.CTP_OAUTH_SCOPES?.split(',')) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _mapInstanceProperty__default["default"](_context), _context))?.(scope => _trimInstanceProperty__default["default"](scope).call(scope)) ?? []);
195
+ var _process$env$CTP_OAUT, _process$env$CTP_OAUT2, _context3;
196
+ return mapOAuthScopesToClaims((_process$env$CTP_OAUT = (_process$env$CTP_OAUT2 = process__default["default"].env.CTP_OAUTH_SCOPES) === null || _process$env$CTP_OAUT2 === void 0 ? void 0 : _mapInstanceProperty__default["default"](_context3 = _process$env$CTP_OAUT2.split(',')).call(_context3, scope => _trimInstanceProperty__default["default"](scope).call(scope))) !== null && _process$env$CTP_OAUT !== void 0 ? _process$env$CTP_OAUT : []);
195
197
  }
196
198
  try {
197
- var _context3, _context4, _context5, _context6;
199
+ var _applicationConfig$en2, _applicationConfig$en3, _configuredOAuthScope, _configuredOAuthScope2, _configuredAdditional, _configuredAdditional2;
198
200
  const applicationConfig$1 = await applicationConfig.processConfig();
199
- const configuredOAuthScopes = applicationConfig$1.env.__DEVELOPMENT__?.oidc?.oAuthScopes;
200
- const configuredAdditionalOAuthScopes = applicationConfig$1.env.__DEVELOPMENT__?.oidc?.additionalOAuthScopes;
201
- return [...mapOAuthScopesToClaims(configuredOAuthScopes?.view ?? []), ...mapOAuthScopesToClaims(configuredOAuthScopes?.manage ?? []), ...(((_context3 = configuredAdditionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default["default"](_context4 = Function.call).call(_context4, _flatMapInstanceProperty__default["default"](_context3), _context3))?.(scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.view)) ?? []), ...(((_context5 = configuredAdditionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default["default"](_context6 = Function.call).call(_context6, _flatMapInstanceProperty__default["default"](_context5), _context5))?.(scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.manage)) ?? [])];
201
+ const configuredOAuthScopes = (_applicationConfig$en2 = applicationConfig$1.env.__DEVELOPMENT__) === null || _applicationConfig$en2 === void 0 || (_applicationConfig$en2 = _applicationConfig$en2.oidc) === null || _applicationConfig$en2 === void 0 ? void 0 : _applicationConfig$en2.oAuthScopes;
202
+ const configuredAdditionalOAuthScopes = (_applicationConfig$en3 = applicationConfig$1.env.__DEVELOPMENT__) === null || _applicationConfig$en3 === void 0 || (_applicationConfig$en3 = _applicationConfig$en3.oidc) === null || _applicationConfig$en3 === void 0 ? void 0 : _applicationConfig$en3.additionalOAuthScopes;
203
+ return [...mapOAuthScopesToClaims((_configuredOAuthScope = configuredOAuthScopes === null || configuredOAuthScopes === void 0 ? void 0 : configuredOAuthScopes.view) !== null && _configuredOAuthScope !== void 0 ? _configuredOAuthScope : []), ...mapOAuthScopesToClaims((_configuredOAuthScope2 = configuredOAuthScopes === null || configuredOAuthScopes === void 0 ? void 0 : configuredOAuthScopes.manage) !== null && _configuredOAuthScope2 !== void 0 ? _configuredOAuthScope2 : []), ...((_configuredAdditional = configuredAdditionalOAuthScopes === null || configuredAdditionalOAuthScopes === void 0 ? void 0 : _flatMapInstanceProperty__default["default"](configuredAdditionalOAuthScopes).call(configuredAdditionalOAuthScopes, scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.view))) !== null && _configuredAdditional !== void 0 ? _configuredAdditional : []), ...((_configuredAdditional2 = configuredAdditionalOAuthScopes === null || configuredAdditionalOAuthScopes === void 0 ? void 0 : _flatMapInstanceProperty__default["default"](configuredAdditionalOAuthScopes).call(configuredAdditionalOAuthScopes, scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.manage))) !== null && _configuredAdditional2 !== void 0 ? _configuredAdditional2 : [])];
202
204
  } catch (error) {
203
205
  // It's ok if there's not application config file or if it does not contain the initialProjectKey
204
206
  return [];
@@ -222,7 +224,7 @@ async function runHeadlessLogin(authUrl) {
222
224
  let puppeteer;
223
225
  try {
224
226
  puppeteer = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('puppeteer')); });
225
- } catch {
227
+ } catch (_unused) {
226
228
  throw new Error('Puppeteer is required for headless login. Install it with: npm install puppeteer');
227
229
  }
228
230
  const browser = await puppeteer.default.launch({
@@ -243,17 +245,9 @@ async function runHeadlessLogin(authUrl) {
243
245
  // Dismiss cookie banner if present
244
246
  // Note: Using string-based evaluate to avoid bundler transforming Array.from
245
247
  try {
246
- await page.evaluate(`
247
- (function() {
248
- var buttons = Array.from(document.querySelectorAll('button'));
249
- var acceptBtn = buttons.find(function(btn) {
250
- return btn.textContent && btn.textContent.includes('Accept all cookies');
251
- });
252
- if (acceptBtn) acceptBtn.click();
253
- })()
254
- `);
248
+ await page.evaluate("\n (function() {\n var buttons = Array.from(document.querySelectorAll('button'));\n var acceptBtn = buttons.find(function(btn) {\n return btn.textContent && btn.textContent.includes('Accept all cookies');\n });\n if (acceptBtn) acceptBtn.click();\n })()\n ");
255
249
  await new _Promise__default["default"](resolve => _setTimeout__default["default"](resolve, 500));
256
- } catch {
250
+ } catch (_unused2) {
257
251
  // Cookie banner not found or already dismissed
258
252
  }
259
253
 
@@ -262,15 +256,7 @@ async function runHeadlessLogin(authUrl) {
262
256
  await new _Promise__default["default"](resolve => _setTimeout__default["default"](resolve, 500));
263
257
 
264
258
  // Click "Next" button
265
- await page.evaluate(`
266
- (function() {
267
- var buttons = Array.from(document.querySelectorAll('button'));
268
- var nextBtn = buttons.find(function(btn) {
269
- return btn.textContent && btn.textContent.toLowerCase().includes('next');
270
- });
271
- if (nextBtn) nextBtn.click();
272
- })()
273
- `);
259
+ await page.evaluate("\n (function() {\n var buttons = Array.from(document.querySelectorAll('button'));\n var nextBtn = buttons.find(function(btn) {\n return btn.textContent && btn.textContent.toLowerCase().includes('next');\n });\n if (nextBtn) nextBtn.click();\n })()\n ");
274
260
 
275
261
  // Wait for password field
276
262
  await page.waitForSelector('input[name="password"]', {
@@ -283,15 +269,7 @@ async function runHeadlessLogin(authUrl) {
283
269
  await new _Promise__default["default"](resolve => _setTimeout__default["default"](resolve, 500));
284
270
 
285
271
  // Click "Submit" button
286
- await page.evaluate(`
287
- (function() {
288
- var buttons = Array.from(document.querySelectorAll('button'));
289
- var submitBtn = buttons.find(function(btn) {
290
- return btn.textContent && btn.textContent.toLowerCase().includes('submit');
291
- });
292
- if (submitBtn) submitBtn.click();
293
- })()
294
- `);
272
+ await page.evaluate("\n (function() {\n var buttons = Array.from(document.querySelectorAll('button'));\n var submitBtn = buttons.find(function(btn) {\n return btn.textContent && btn.textContent.toLowerCase().includes('submit');\n });\n if (submitBtn) submitBtn.click();\n })()\n ");
295
273
 
296
274
  // Wait for the callback to be processed (the server will close and exit)
297
275
  // We just need to keep the browser alive until the redirect happens
@@ -323,17 +301,17 @@ async function run(options) {
323
301
  if (!mcApiUrl) {
324
302
  throw new Error('No Merchant Center API URL found. Aborting.');
325
303
  }
326
- console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
304
+ console.log("Using Merchant Center environment \"".concat(chalk__default["default"].green(mcApiUrl), "\"."));
327
305
  console.log();
328
306
  if (!options.force && credentialsStorage.isSessionValid(mcApiUrl)) {
329
- console.log(`You already have a valid session.`);
307
+ console.log("You already have a valid session.");
330
308
  return;
331
309
  }
332
310
  const projectKey = await resolveProjectKey(options);
333
311
  const oauthScopes = await resolveOAuthScopes(options);
334
312
  const scopes = ['openid'];
335
313
  if (projectKey) {
336
- scopes.push(`project_key:${projectKey}`);
314
+ scopes.push("project_key:".concat(projectKey));
337
315
  _forEachInstanceProperty__default["default"](oauthScopes).call(oauthScopes, scope => {
338
316
  scopes.push(scope);
339
317
  });
@@ -343,7 +321,7 @@ async function run(options) {
343
321
  const authUrl = new _URL__default["default"]('/login/authorize', mcApiUrl);
344
322
  authUrl.searchParams.set('response_type', 'id_token');
345
323
  authUrl.searchParams.set('response_mode', 'query');
346
- authUrl.searchParams.set('client_id', `__local:${clientIdentifier}`);
324
+ authUrl.searchParams.set('client_id', "__local:".concat(clientIdentifier));
347
325
  authUrl.searchParams.set('scope', scopes.join(' '));
348
326
  authUrl.searchParams.set('state', state);
349
327
  authUrl.searchParams.set('nonce', nonce);
@@ -354,18 +332,18 @@ async function run(options) {
354
332
  onSuccess: tokenContext => {
355
333
  credentialsStorage.setToken(mcApiUrl, tokenContext);
356
334
  console.log();
357
- console.log(chalk__default["default"].green(`Login successful.`));
335
+ console.log(chalk__default["default"].green("Login successful."));
358
336
  console.log();
359
337
  }
360
338
  });
361
339
  await startServer(server);
362
340
  if (options.headless) {
363
- console.log(`Initiating headless authentication flow using Puppeteer...`);
341
+ console.log("Initiating headless authentication flow using Puppeteer...");
364
342
  console.log();
365
343
  await runHeadlessLogin(authUrl);
366
344
  } else {
367
- console.log(`Initiating the OIDC authentication flow, opening the login page in your browser...`);
368
- console.log(` ${authUrl}`);
345
+ console.log("Initiating the OIDC authentication flow, opening the login page in your browser...");
346
+ console.log(" ".concat(authUrl));
369
347
  console.log();
370
348
  const open = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('open')); });
371
349
  await open.default(authUrl.toString());