@commercetools-frontend/mc-scripts 0.0.0-FEC-157-preview-releases-20241126230331

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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +2 -0
  4. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts.map +1 -0
  5. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
  6. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
  7. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +7 -0
  8. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
  9. package/application-runtime/package.json +4 -0
  10. package/bin/cli.js +8 -0
  11. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +2 -0
  12. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts.map +1 -0
  13. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +211 -0
  14. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
  15. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +211 -0
  16. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +196 -0
  17. package/cli/package.json +4 -0
  18. package/config/create-webpack-config-for-development.js +8 -0
  19. package/config/create-webpack-config-for-production.js +8 -0
  20. package/config/vendors-to-transpile.js +6 -0
  21. package/dist/build-99744dae.cjs.prod.js +166 -0
  22. package/dist/build-a93715aa.esm.js +152 -0
  23. package/dist/build-f56ce7ec.cjs.dev.js +166 -0
  24. package/dist/build-vite-000f0a2d.cjs.prod.js +193 -0
  25. package/dist/build-vite-722f0dcf.esm.js +182 -0
  26. package/dist/build-vite-838c8e01.cjs.dev.js +193 -0
  27. package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +2 -0
  28. package/dist/commercetools-frontend-mc-scripts.cjs.d.ts.map +1 -0
  29. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +29 -0
  30. package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
  31. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +29 -0
  32. package/dist/commercetools-frontend-mc-scripts.esm.js +21 -0
  33. package/dist/compile-html-025cd493.esm.js +34 -0
  34. package/dist/compile-html-50fd05ec.cjs.prod.js +42 -0
  35. package/dist/compile-html-f4ac88cc.cjs.dev.js +42 -0
  36. package/dist/config-sync-2ff62f08.cjs.dev.js +845 -0
  37. package/dist/config-sync-b57f79e2.cjs.prod.js +839 -0
  38. package/dist/config-sync-cda7662e.esm.js +823 -0
  39. package/dist/create-postcss-config-2f709335.esm.js +75 -0
  40. package/dist/create-postcss-config-3b540c7c.cjs.prod.js +81 -0
  41. package/dist/create-postcss-config-5962fa01.cjs.dev.js +81 -0
  42. package/dist/create-webpack-config-for-development-7d9e4dc4.cjs.prod.js +463 -0
  43. package/dist/create-webpack-config-for-development-86baace3.esm.js +438 -0
  44. package/dist/create-webpack-config-for-development-b379913b.cjs.dev.js +463 -0
  45. package/dist/create-webpack-config-for-production-3a40f56b.cjs.dev.js +518 -0
  46. package/dist/create-webpack-config-for-production-5ec9d0e2.cjs.prod.js +518 -0
  47. package/dist/create-webpack-config-for-production-b6ee3116.esm.js +488 -0
  48. package/dist/credentials-storage-3cea94ea.cjs.dev.js +95 -0
  49. package/dist/credentials-storage-b13e1406.esm.js +83 -0
  50. package/dist/credentials-storage-dc849808.cjs.prod.js +95 -0
  51. package/dist/declarations/src/application-runtime.d.ts +1 -0
  52. package/dist/declarations/src/cli.d.ts +4 -0
  53. package/dist/declarations/src/commands/build-vite.d.ts +2 -0
  54. package/dist/declarations/src/commands/build.d.ts +2 -0
  55. package/dist/declarations/src/commands/compile-html.d.ts +3 -0
  56. package/dist/declarations/src/commands/config-sync.d.ts +3 -0
  57. package/dist/declarations/src/commands/deployment-previews-set.d.ts +3 -0
  58. package/dist/declarations/src/commands/login.d.ts +2 -0
  59. package/dist/declarations/src/commands/serve.d.ts +2 -0
  60. package/dist/declarations/src/commands/start-vite.d.ts +2 -0
  61. package/dist/declarations/src/commands/start.d.ts +2 -0
  62. package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
  63. package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
  64. package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
  65. package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
  66. package/dist/declarations/src/config/moment-locales.d.ts +2 -0
  67. package/dist/declarations/src/config/optimizations.d.ts +2 -0
  68. package/dist/declarations/src/config/paths.d.ts +12 -0
  69. package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
  70. package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
  71. package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
  72. package/dist/declarations/src/generated/core.d.ts +739 -0
  73. package/dist/declarations/src/generated/settings.d.ts +2116 -0
  74. package/dist/declarations/src/index.d.ts +3 -0
  75. package/dist/declarations/src/postcss.d.ts +1 -0
  76. package/dist/declarations/src/types.d.ts +87 -0
  77. package/dist/declarations/src/utils/auth.d.ts +6 -0
  78. package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
  79. package/dist/declarations/src/utils/does-file-exist.d.ts +2 -0
  80. package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
  81. package/dist/declarations/src/utils/graphql-requests.d.ts +172 -0
  82. package/dist/declarations/src/utils/i18n-message-complilation.d.ts +4 -0
  83. package/dist/declarations/src/utils/user-agent.d.ts +2 -0
  84. package/dist/declarations/src/version.d.ts +2 -0
  85. package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
  86. package/dist/declarations/src/vite-plugins/vite-plugin-i18n-message-compilation.d.ts +3 -0
  87. package/dist/declarations/src/vite-plugins/vite-plugin-merchant-center-customization.d.ts +4 -0
  88. package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -0
  89. package/dist/declarations/src/webpack-loaders/i18n-message-compilation-loader.d.ts +3 -0
  90. package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
  91. package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
  92. package/dist/declarations/src/webpack.d.ts +2 -0
  93. package/dist/deployment-previews-set-173d8491.cjs.dev.js +203 -0
  94. package/dist/deployment-previews-set-923f79de.esm.js +192 -0
  95. package/dist/deployment-previews-set-f451242a.cjs.prod.js +203 -0
  96. package/dist/does-file-exist-32618334.esm.js +12 -0
  97. package/dist/does-file-exist-be53305d.cjs.prod.js +18 -0
  98. package/dist/does-file-exist-eb86baca.cjs.dev.js +18 -0
  99. package/dist/graphql-requests-0e427050.esm.js +243 -0
  100. package/dist/graphql-requests-733aac06.cjs.dev.js +266 -0
  101. package/dist/graphql-requests-db54706e.cjs.prod.js +266 -0
  102. package/dist/has-jsx-runtime-aa5d21ee.cjs.dev.js +15 -0
  103. package/dist/has-jsx-runtime-c3202df5.cjs.prod.js +15 -0
  104. package/dist/has-jsx-runtime-e3ecb09b.esm.js +13 -0
  105. package/dist/i18n-message-complilation-21d3b0aa.esm.js +15 -0
  106. package/dist/i18n-message-complilation-7311cb29.cjs.dev.js +23 -0
  107. package/dist/i18n-message-complilation-7762da61.cjs.prod.js +23 -0
  108. package/dist/login-35f578e3.esm.js +86 -0
  109. package/dist/login-65c78b83.cjs.dev.js +103 -0
  110. package/dist/login-c616d769.cjs.prod.js +103 -0
  111. package/dist/optimizations-7789145e.cjs.dev.js +85 -0
  112. package/dist/optimizations-bf991634.esm.js +67 -0
  113. package/dist/optimizations-fb93514f.cjs.prod.js +85 -0
  114. package/dist/package-436331e6.cjs.dev.js +151 -0
  115. package/dist/package-a7096308.cjs.prod.js +151 -0
  116. package/dist/package-b2f2b4e5.esm.js +149 -0
  117. package/dist/paths-39f22b8b.esm.js +36 -0
  118. package/dist/paths-7768b440.cjs.prod.js +44 -0
  119. package/dist/paths-b76fc753.cjs.dev.js +44 -0
  120. package/dist/serve-5666b16a.cjs.prod.js +48 -0
  121. package/dist/serve-6a951584.esm.js +41 -0
  122. package/dist/serve-f898c45e.cjs.dev.js +48 -0
  123. package/dist/start-4e79e08f.esm.js +164 -0
  124. package/dist/start-569eb0f9.cjs.dev.js +177 -0
  125. package/dist/start-b0765c9a.cjs.prod.js +177 -0
  126. package/dist/start-vite-45bfc42f.esm.js +110 -0
  127. package/dist/start-vite-a68e1b9f.cjs.prod.js +122 -0
  128. package/dist/start-vite-a787f80d.cjs.dev.js +122 -0
  129. package/dist/vendors-to-transpile-04a49d40.cjs.prod.js +5 -0
  130. package/dist/vendors-to-transpile-6ab4ea06.cjs.dev.js +5 -0
  131. package/dist/vendors-to-transpile-7dc84a72.esm.js +3 -0
  132. package/dist/vite-plugin-svgr-069f402d.esm.js +83 -0
  133. package/dist/vite-plugin-svgr-7fb42bbf.cjs.dev.js +108 -0
  134. package/dist/vite-plugin-svgr-b080c510.cjs.prod.js +108 -0
  135. package/package.json +147 -0
  136. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +2 -0
  137. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts.map +1 -0
  138. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +12 -0
  139. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
  140. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +12 -0
  141. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +4 -0
  142. package/postcss/package.json +4 -0
  143. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +2 -0
  144. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts.map +1 -0
  145. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +57 -0
  146. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
  147. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +57 -0
  148. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +48 -0
  149. package/webpack/package.json +4 -0
  150. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.d.ts +3 -0
  151. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.d.ts.map +1 -0
  152. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +30 -0
  153. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.js +7 -0
  154. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +30 -0
  155. package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +26 -0
  156. package/webpack-loaders/i18n-message-compilation-loader/package.json +4 -0
@@ -0,0 +1,266 @@
1
+ 'use strict';
2
+
3
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
4
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
5
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
7
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
9
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
10
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
11
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
12
+ var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
13
+ var chalk = require('chalk');
14
+ var graphql = require('graphql');
15
+ var graphqlRequest = require('graphql-request');
16
+ var constants = require('@commercetools-frontend/constants');
17
+ var credentialsStorage$1 = require('./credentials-storage-dc849808.cjs.prod.js');
18
+
19
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
20
+
21
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
22
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
23
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
24
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
25
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
26
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
27
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
28
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
29
+ var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
30
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
31
+
32
+ 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; }
33
+ 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; }
34
+ var CreateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomApplicationDeploymentPreview" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewCreateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 327, source: { body: "mutation CreateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $applicationId: ID!\n $data: CustomApplicationDeploymentPreviewCreateInput!\n) {\n createCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n applicationId: $applicationId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
35
+ var CreateCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDraftDataInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 201, source: { body: "mutation CreateCustomApplicationFromCli(\n $organizationId: String!\n $data: CustomApplicationDraftDataInput!\n) {\n createCustomApplication(organizationId: $organizationId, data: $data) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
36
+ var CreateCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "CreateCustomViewFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomViewDraftDataInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCustomView" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 180, source: { body: "mutation CreateCustomViewFromCli(\n $organizationId: String!\n $data: CustomViewDraftDataInput!\n) {\n createCustomView(organizationId: $organizationId, data: $data) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
37
+ var FetchCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationExtensionForCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "entryPointUriPath" }, value: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "description" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "deployments" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 712, source: { body: "query FetchCustomApplicationFromCli($entryPointUriPath: String!) {\n organizationExtensionForCustomApplication(\n entryPointUriPath: $entryPointUriPath\n ) {\n organizationId\n application {\n id\n entryPointUriPath\n name\n description\n url\n icon\n permissions {\n name\n oAuthScopes\n }\n mainMenuLink {\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n uriPath\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n deployments {\n id\n url\n alias\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
38
+ var FetchCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomViewFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationExtensionForCustomView" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "customViewId" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "customView" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "type" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "typeSettings" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "size" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "locators" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }] } }] } }] } }], loc: { start: 0, end: 399, source: { body: "query FetchCustomViewFromCli($customViewId: String!) {\n organizationExtensionForCustomView(customViewId: $customViewId) {\n organizationId\n customView {\n id\n defaultLabel\n labelAllLocales {\n locale\n value\n }\n url\n type\n typeSettings {\n size\n }\n locators\n permissions {\n name\n oAuthScopes\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
39
+ var FetchMyOrganizationsFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchMyOrganizationsFromCli" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "myOrganizations" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "total" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 112, source: { body: "query FetchMyOrganizationsFromCli {\n myOrganizations {\n total\n results {\n id\n name\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
40
+ var UpdateCustomApplicationDeploymentPreviewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationDeploymentPreview" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "deploymentId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDeploymentPreviewUpdateInput" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplicationDeploymentPreview" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "deploymentId" }, value: { kind: "Variable", name: { kind: "Name", value: "deploymentId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "alias" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 324, source: { body: "mutation UpdateCustomApplicationDeploymentPreview(\n $organizationId: String!\n $deploymentId: ID!\n $data: CustomApplicationDeploymentPreviewUpdateInput!\n) {\n updateCustomApplicationDeploymentPreview(\n organizationId: $organizationId\n deploymentId: $deploymentId\n data: $data\n ) {\n id\n alias\n url\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
41
+ var UpdateCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDraftDataInput" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 268, source: { body: "mutation UpdateCustomApplicationFromCli(\n $organizationId: String!\n $data: CustomApplicationDraftDataInput!\n $applicationId: ID!\n) {\n updateCustomApplication(\n organizationId: $organizationId\n data: $data\n applicationId: $applicationId\n ) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
42
+ var UpdateCustomViewFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomViewFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomViewDraftDataInput" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "customViewId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomView" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }, { kind: "Argument", name: { kind: "Name", value: "customViewId" }, value: { kind: "Variable", name: { kind: "Name", value: "customViewId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 248, source: { body: "mutation UpdateCustomViewFromCli(\n $organizationId: String!\n $data: CustomViewDraftDataInput!\n $customViewId: String!\n) {\n updateCustomView(\n organizationId: $organizationId\n data: $data\n customViewId: $customViewId\n ) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
43
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
44
+ async function requestWithTokenRetry(document, requestOptions) {
45
+ let retryCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
46
+ const token = credentialsStorage.getToken(requestOptions.mcApiUrl);
47
+ const client = new graphqlRequest.GraphQLClient(`${requestOptions.mcApiUrl}/graphql`, {
48
+ headers: _objectSpread(_objectSpread({
49
+ Accept: 'application/json',
50
+ 'Content-Type': 'application/json',
51
+ 'x-user-agent': credentialsStorage$1.userAgent
52
+ }, token ? {
53
+ 'x-mc-cli-access-token': token
54
+ } : {}), requestOptions.headers)
55
+ });
56
+ try {
57
+ const result = await client.rawRequest(graphql.print(document), requestOptions.variables);
58
+
59
+ // In case a new session token is returned from the server, save it.
60
+ const refreshedSessionToken = result.headers.get('x-refreshed-session-token');
61
+ if (refreshedSessionToken) {
62
+ console.log(chalk__default["default"].green('Session token refreshed.'));
63
+ console.log();
64
+ const refreshedSessionTokenExpiresAt = result.headers.get('x-refreshed-session-token-expires-at');
65
+ // Store the updated access token.
66
+ credentialsStorage.setToken(requestOptions.mcApiUrl, {
67
+ token: refreshedSessionToken,
68
+ expiresAt: Number(refreshedSessionTokenExpiresAt)
69
+ });
70
+ }
71
+ return result.data;
72
+ } catch (error) {
73
+ if (error instanceof graphqlRequest.ClientError) {
74
+ // If it's an unauthorized error, retry the request to force the token to be refreshed.
75
+ if (retryCount === 0 && error.response.errors && error.response.errors.length > 0) {
76
+ var _context;
77
+ const isUnauthorizedError = _someInstanceProperty__default["default"](_context = error.response.errors).call(_context, graphqlError => graphqlError.extensions?.code === 'UNAUTHENTICATED');
78
+ if (isUnauthorizedError) {
79
+ console.log(chalk__default["default"].yellow('Expired or invalid session token, attempting to retry the request with a refreshed token...'));
80
+ return requestWithTokenRetry(document, _objectSpread(_objectSpread({}, requestOptions), {}, {
81
+ headers: _objectSpread(_objectSpread({}, requestOptions.headers), {}, {
82
+ 'X-Force-Token': 'true'
83
+ })
84
+ }), retryCount + 1);
85
+ }
86
+ }
87
+ }
88
+ throw error;
89
+ }
90
+ }
91
+ const fetchCustomApplication = async _ref => {
92
+ let mcApiUrl = _ref.mcApiUrl,
93
+ entryPointUriPath = _ref.entryPointUriPath,
94
+ applicationIdentifier = _ref.applicationIdentifier;
95
+ const customAppData = await requestWithTokenRetry(FetchCustomApplicationFromCli, {
96
+ variables: {
97
+ entryPointUriPath
98
+ },
99
+ mcApiUrl,
100
+ headers: {
101
+ 'x-application-id': applicationIdentifier,
102
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
103
+ }
104
+ });
105
+ return customAppData.organizationExtensionForCustomApplication;
106
+ };
107
+ const fetchCustomView = async _ref2 => {
108
+ let mcApiUrl = _ref2.mcApiUrl,
109
+ customViewId = _ref2.customViewId,
110
+ applicationIdentifier = _ref2.applicationIdentifier;
111
+ const customViewData = await requestWithTokenRetry(FetchCustomViewFromCli, {
112
+ variables: {
113
+ customViewId
114
+ },
115
+ mcApiUrl,
116
+ headers: {
117
+ 'x-custom-view-id': customViewId,
118
+ 'x-application-id': applicationIdentifier,
119
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
120
+ }
121
+ });
122
+ return customViewData.organizationExtensionForCustomView;
123
+ };
124
+ const updateCustomApplication = async _ref3 => {
125
+ let mcApiUrl = _ref3.mcApiUrl,
126
+ applicationId = _ref3.applicationId,
127
+ organizationId = _ref3.organizationId,
128
+ data = _ref3.data,
129
+ applicationIdentifier = _ref3.applicationIdentifier;
130
+ const updatedCustomAppsData = await requestWithTokenRetry(UpdateCustomApplicationFromCli, {
131
+ variables: {
132
+ organizationId,
133
+ applicationId,
134
+ data
135
+ },
136
+ mcApiUrl,
137
+ headers: {
138
+ 'x-application-id': applicationIdentifier,
139
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
140
+ }
141
+ });
142
+ return updatedCustomAppsData.updateCustomApplication;
143
+ };
144
+ const updateCustomView = async _ref4 => {
145
+ let mcApiUrl = _ref4.mcApiUrl,
146
+ organizationId = _ref4.organizationId,
147
+ data = _ref4.data,
148
+ customViewId = _ref4.customViewId,
149
+ applicationIdentifier = _ref4.applicationIdentifier;
150
+ const updatedCustomViewData = await requestWithTokenRetry(UpdateCustomViewFromCli, {
151
+ variables: {
152
+ organizationId,
153
+ customViewId,
154
+ data
155
+ },
156
+ mcApiUrl,
157
+ headers: {
158
+ 'x-custom-view-id': customViewId,
159
+ 'x-application-id': applicationIdentifier,
160
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
161
+ }
162
+ });
163
+ return updatedCustomViewData.updateCustomView;
164
+ };
165
+ const createCustomApplication = async _ref5 => {
166
+ let mcApiUrl = _ref5.mcApiUrl,
167
+ organizationId = _ref5.organizationId,
168
+ data = _ref5.data,
169
+ applicationIdentifier = _ref5.applicationIdentifier;
170
+ const createdCustomAppData = await requestWithTokenRetry(CreateCustomApplicationFromCli, {
171
+ variables: {
172
+ organizationId,
173
+ data
174
+ },
175
+ mcApiUrl,
176
+ headers: {
177
+ 'x-application-id': applicationIdentifier,
178
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
179
+ }
180
+ });
181
+ return createdCustomAppData.createCustomApplication;
182
+ };
183
+ const createCustomView = async _ref6 => {
184
+ let mcApiUrl = _ref6.mcApiUrl,
185
+ organizationId = _ref6.organizationId,
186
+ data = _ref6.data,
187
+ applicationIdentifier = _ref6.applicationIdentifier;
188
+ const createdCustomViewData = await requestWithTokenRetry(CreateCustomViewFromCli, {
189
+ variables: {
190
+ organizationId,
191
+ data
192
+ },
193
+ mcApiUrl,
194
+ headers: {
195
+ 'x-application-id': applicationIdentifier,
196
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
197
+ }
198
+ });
199
+ return createdCustomViewData.createCustomView;
200
+ };
201
+ const fetchUserOrganizations = async _ref7 => {
202
+ let mcApiUrl = _ref7.mcApiUrl,
203
+ applicationIdentifier = _ref7.applicationIdentifier,
204
+ customViewId = _ref7.customViewId;
205
+ const userOrganizations = await requestWithTokenRetry(FetchMyOrganizationsFromCli, {
206
+ mcApiUrl,
207
+ headers: _objectSpread(_objectSpread({
208
+ 'x-application-id': applicationIdentifier
209
+ }, customViewId && {
210
+ 'x-custom-view-id': customViewId
211
+ }), {}, {
212
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.ADMINISTRATION_SERVICE
213
+ })
214
+ });
215
+ return userOrganizations.myOrganizations;
216
+ };
217
+ const createCustomApplicationDeploymentPreview = async _ref8 => {
218
+ let mcApiUrl = _ref8.mcApiUrl,
219
+ organizationId = _ref8.organizationId,
220
+ applicationId = _ref8.applicationId,
221
+ applicationIdentifier = _ref8.applicationIdentifier,
222
+ data = _ref8.data;
223
+ const createdDeploymentPreviewResult = await requestWithTokenRetry(CreateCustomApplicationDeploymentPreviewFromCli, {
224
+ variables: {
225
+ organizationId,
226
+ applicationId,
227
+ data
228
+ },
229
+ mcApiUrl,
230
+ headers: {
231
+ 'x-application-id': applicationIdentifier,
232
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
233
+ }
234
+ });
235
+ return createdDeploymentPreviewResult.createCustomApplicationDeploymentPreview;
236
+ };
237
+ const updateCustomApplicationDeploymentPreview = async _ref9 => {
238
+ let mcApiUrl = _ref9.mcApiUrl,
239
+ organizationId = _ref9.organizationId,
240
+ deploymentId = _ref9.deploymentId,
241
+ data = _ref9.data,
242
+ applicationIdentifier = _ref9.applicationIdentifier;
243
+ const updatedDeploymentPreviewResult = await requestWithTokenRetry(UpdateCustomApplicationDeploymentPreviewFromCli, {
244
+ variables: {
245
+ organizationId,
246
+ deploymentId,
247
+ data
248
+ },
249
+ mcApiUrl,
250
+ headers: {
251
+ 'x-application-id': applicationIdentifier,
252
+ 'x-graphql-target': constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
253
+ }
254
+ });
255
+ return updatedDeploymentPreviewResult.updateCustomApplicationDeploymentPreview;
256
+ };
257
+
258
+ exports.createCustomApplication = createCustomApplication;
259
+ exports.createCustomApplicationDeploymentPreview = createCustomApplicationDeploymentPreview;
260
+ exports.createCustomView = createCustomView;
261
+ exports.fetchCustomApplication = fetchCustomApplication;
262
+ exports.fetchCustomView = fetchCustomView;
263
+ exports.fetchUserOrganizations = fetchUserOrganizations;
264
+ exports.updateCustomApplication = updateCustomApplication;
265
+ exports.updateCustomApplicationDeploymentPreview = updateCustomApplicationDeploymentPreview;
266
+ exports.updateCustomView = updateCustomView;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ function hasJsxRuntime() {
4
+ if (process.env.ENABLE_NEW_JSX_TRANSFORM !== 'true') {
5
+ return false;
6
+ }
7
+ try {
8
+ require.resolve('react/jsx-runtime');
9
+ return true;
10
+ } catch (e) {
11
+ return false;
12
+ }
13
+ }
14
+
15
+ exports.hasJsxRuntime = hasJsxRuntime;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ function hasJsxRuntime() {
4
+ if (process.env.ENABLE_NEW_JSX_TRANSFORM !== 'true') {
5
+ return false;
6
+ }
7
+ try {
8
+ require.resolve('react/jsx-runtime');
9
+ return true;
10
+ } catch (e) {
11
+ return false;
12
+ }
13
+ }
14
+
15
+ exports.hasJsxRuntime = hasJsxRuntime;
@@ -0,0 +1,13 @@
1
+ function hasJsxRuntime() {
2
+ if (process.env.ENABLE_NEW_JSX_TRANSFORM !== 'true') {
3
+ return false;
4
+ }
5
+ try {
6
+ require.resolve('react/jsx-runtime');
7
+ return true;
8
+ } catch (e) {
9
+ return false;
10
+ }
11
+ }
12
+
13
+ export { hasJsxRuntime as h };
@@ -0,0 +1,15 @@
1
+ import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
2
+ import chalk from 'chalk';
3
+
4
+ function getI18nMessageFormat(source) {
5
+ const messageContents = JSON.parse(source);
6
+ const firstValue = _Object$values(messageContents)[0];
7
+ return typeof firstValue === 'string' ? 'simple' : 'transifex';
8
+ }
9
+ function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
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}` : ''}`));
12
+ }
13
+ }
14
+
15
+ export { getI18nMessageFormat as g, handleMessageCompilationError as h };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
4
+ var chalk = require('chalk');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
7
+
8
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
9
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
10
+
11
+ function getI18nMessageFormat(source) {
12
+ const messageContents = JSON.parse(source);
13
+ const firstValue = _Object$values__default["default"](messageContents)[0];
14
+ return typeof firstValue === 'string' ? 'simple' : 'transifex';
15
+ }
16
+ function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
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}` : ''}`));
19
+ }
20
+ }
21
+
22
+ exports.getI18nMessageFormat = getI18nMessageFormat;
23
+ exports.handleMessageCompilationError = handleMessageCompilationError;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
4
+ var chalk = require('chalk');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
7
+
8
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
9
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
10
+
11
+ function getI18nMessageFormat(source) {
12
+ const messageContents = JSON.parse(source);
13
+ const firstValue = _Object$values__default["default"](messageContents)[0];
14
+ return typeof firstValue === 'string' ? 'simple' : 'transifex';
15
+ }
16
+ function handleMessageCompilationError(fileIdentifier, error, warnFunction) {
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}` : ''}`));
19
+ }
20
+ }
21
+
22
+ exports.getI18nMessageFormat = getI18nMessageFormat;
23
+ exports.handleMessageCompilationError = handleMessageCompilationError;
@@ -0,0 +1,86 @@
1
+ import chalk from 'chalk';
2
+ import prompts from 'prompts';
3
+ import { processConfig } from '@commercetools-frontend/application-config';
4
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
5
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
6
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
7
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
8
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
9
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
10
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
11
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
12
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
13
+ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
14
+ import fetch from 'node-fetch';
15
+ import { u as userAgent, C as CredentialsStorage } from './credentials-storage-b13e1406.esm.js';
16
+ import '@commercetools/http-user-agent';
17
+ import './package-b2f2b4e5.esm.js';
18
+ import '@babel/runtime-corejs3/helpers/classCallCheck';
19
+ import '@babel/runtime-corejs3/helpers/createClass';
20
+ import '@babel/runtime-corejs3/core-js-stable/date/now';
21
+ import 'fs';
22
+ import 'os';
23
+ import 'path';
24
+ import './does-file-exist-32618334.esm.js';
25
+ import 'node:fs';
26
+
27
+ 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; }
28
+ 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; }
29
+ const getAuthToken = async (mcApiUrl, payload, headers) => {
30
+ const response = await fetch(`${mcApiUrl}/tokens/cli`, {
31
+ method: 'POST',
32
+ headers: _objectSpread({
33
+ Accept: 'application/json',
34
+ 'Content-Type': 'application/json',
35
+ 'x-user-agent': userAgent
36
+ }, headers),
37
+ body: _JSON$stringify(payload)
38
+ });
39
+ if (!response.ok) {
40
+ const text = await response.text();
41
+ let parsed;
42
+ try {
43
+ parsed = JSON.parse(text);
44
+ } catch (error) {}
45
+ const errorMessage = parsed ? parsed.message : text;
46
+ throw new Error(errorMessage);
47
+ }
48
+ const authToken = await response.json();
49
+ return authToken;
50
+ };
51
+
52
+ const credentialsStorage = new CredentialsStorage();
53
+ async function run() {
54
+ const applicationConfig = processConfig();
55
+ const mcApiUrl = applicationConfig.env.mcApiUrl;
56
+ console.log(`Using Merchant Center environment "${chalk.green(mcApiUrl)}".`);
57
+ console.log();
58
+ if (credentialsStorage.isSessionValid(mcApiUrl)) {
59
+ console.log(`You already have a valid session.`);
60
+ return;
61
+ }
62
+ console.log(`Enter the login credentials:`);
63
+ const _await$prompts = await prompts({
64
+ type: 'text',
65
+ name: 'email',
66
+ message: 'Email'
67
+ }),
68
+ email = _await$prompts.email;
69
+ const _await$prompts2 = await prompts({
70
+ type: 'invisible',
71
+ name: 'password',
72
+ message: 'Password (hidden)'
73
+ }),
74
+ password = _await$prompts2.password;
75
+ if (!email || !password) {
76
+ throw new Error(`Missing email or password values. Aborting.`);
77
+ }
78
+ const credentials = await getAuthToken(mcApiUrl, {
79
+ email,
80
+ password
81
+ });
82
+ credentialsStorage.setToken(mcApiUrl, credentials);
83
+ console.log(chalk.green(`Login successful.\n`));
84
+ }
85
+
86
+ export { run as default };
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+ var prompts = require('prompts');
5
+ var applicationConfig = require('@commercetools-frontend/application-config');
6
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
7
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
8
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
9
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
10
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
11
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
12
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
13
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
14
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
15
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
16
+ var fetch = require('node-fetch');
17
+ var credentialsStorage$1 = require('./credentials-storage-3cea94ea.cjs.dev.js');
18
+ require('@commercetools/http-user-agent');
19
+ require('./package-436331e6.cjs.dev.js');
20
+ require('@babel/runtime-corejs3/helpers/classCallCheck');
21
+ require('@babel/runtime-corejs3/helpers/createClass');
22
+ require('@babel/runtime-corejs3/core-js-stable/date/now');
23
+ require('fs');
24
+ require('os');
25
+ require('path');
26
+ require('./does-file-exist-eb86baca.cjs.dev.js');
27
+ require('node:fs');
28
+
29
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
30
+
31
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
32
+ var prompts__default = /*#__PURE__*/_interopDefault(prompts);
33
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
34
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
35
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
36
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
37
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
38
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
39
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
40
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
41
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
42
+ var fetch__default = /*#__PURE__*/_interopDefault(fetch);
43
+
44
+ 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; }
45
+ 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; }
46
+ const getAuthToken = async (mcApiUrl, payload, headers) => {
47
+ const response = await fetch__default["default"](`${mcApiUrl}/tokens/cli`, {
48
+ method: 'POST',
49
+ headers: _objectSpread({
50
+ Accept: 'application/json',
51
+ 'Content-Type': 'application/json',
52
+ 'x-user-agent': credentialsStorage$1.userAgent
53
+ }, headers),
54
+ body: _JSON$stringify__default["default"](payload)
55
+ });
56
+ if (!response.ok) {
57
+ const text = await response.text();
58
+ let parsed;
59
+ try {
60
+ parsed = JSON.parse(text);
61
+ } catch (error) {}
62
+ const errorMessage = parsed ? parsed.message : text;
63
+ throw new Error(errorMessage);
64
+ }
65
+ const authToken = await response.json();
66
+ return authToken;
67
+ };
68
+
69
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
70
+ async function run() {
71
+ const applicationConfig$1 = applicationConfig.processConfig();
72
+ const mcApiUrl = applicationConfig$1.env.mcApiUrl;
73
+ console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
74
+ console.log();
75
+ if (credentialsStorage.isSessionValid(mcApiUrl)) {
76
+ console.log(`You already have a valid session.`);
77
+ return;
78
+ }
79
+ console.log(`Enter the login credentials:`);
80
+ const _await$prompts = await prompts__default["default"]({
81
+ type: 'text',
82
+ name: 'email',
83
+ message: 'Email'
84
+ }),
85
+ email = _await$prompts.email;
86
+ const _await$prompts2 = await prompts__default["default"]({
87
+ type: 'invisible',
88
+ name: 'password',
89
+ message: 'Password (hidden)'
90
+ }),
91
+ password = _await$prompts2.password;
92
+ if (!email || !password) {
93
+ throw new Error(`Missing email or password values. Aborting.`);
94
+ }
95
+ const credentials = await getAuthToken(mcApiUrl, {
96
+ email,
97
+ password
98
+ });
99
+ credentialsStorage.setToken(mcApiUrl, credentials);
100
+ console.log(chalk__default["default"].green(`Login successful.\n`));
101
+ }
102
+
103
+ exports["default"] = run;