@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,3 @@
1
+ export { default as version } from './version';
2
+ export { default as vendorsToTranspile } from './config/vendors-to-transpile';
3
+ export * from './deprecated-entry-points';
@@ -0,0 +1 @@
1
+ export { default as createPostcssConfig } from './config/create-postcss-config';
@@ -0,0 +1,87 @@
1
+ export type TCliGlobalOptions = {
2
+ '--'?: string[];
3
+ env?: string[];
4
+ };
5
+ export type TCliCommandBuildOptions = {
6
+ buildOnly: boolean;
7
+ };
8
+ export type TCliCommandCompileHtmlOptions = {
9
+ transformer?: string;
10
+ printSecurityHeaders: boolean;
11
+ };
12
+ export type TCliCommandConfigSyncOptions = {
13
+ dryRun: boolean;
14
+ };
15
+ export type TCliCommandSetDeploymentPreviewOptions = {
16
+ alias?: string;
17
+ url?: string;
18
+ dryRun?: boolean;
19
+ };
20
+ export type TMcCliAuthToken = {
21
+ token: string;
22
+ expiresAt: number;
23
+ };
24
+ export type TMcCliCredentialsStorage = Record<string, TMcCliAuthToken>;
25
+ /**
26
+ * Configuration options to extend the default configuration
27
+ */
28
+ export type TPostcssConfigOptions = {
29
+ /**
30
+ * A list of paths where to look for files used by the `@import` statements.
31
+ */
32
+ postcssImportPaths?: string[];
33
+ /**
34
+ * A list of paths where to look for files with custom media queries.
35
+ */
36
+ postcssCustomMediaPaths?: string[];
37
+ /**
38
+ * A list of paths where to look for files with custom properties.
39
+ */
40
+ postcssCustomPropertiesPaths?: string[];
41
+ };
42
+ export type TWebpackConfigMode = 'development' | 'production';
43
+ export type TWebpackConfigToggleFlagsForDevelopment = {
44
+ /**
45
+ * Allow to disable index.html generation in case it's not necessary (e.g. for Storybook)
46
+ */
47
+ generateIndexHtml?: boolean;
48
+ /**
49
+ * Some environemnts do not require `core-js` and can hence disable
50
+ * it explicitely. This will disable `core-js` for `preset-env` and the
51
+ * `plugin-transform-runtime`.
52
+ */
53
+ disableCoreJs?: boolean;
54
+ };
55
+ export type TWebpackConfigToggleFlagsForProduction = TWebpackConfigToggleFlagsForDevelopment & {
56
+ /**
57
+ * Allow to disable CSS extraction in case it's not necessary (e.g. for Storybook)
58
+ */
59
+ enableExtractCss?: boolean;
60
+ /**
61
+ * Some plugins spawn workers to speed up the build. However this can cause trouble on
62
+ * certain machines local and CI. This flag set to limit or disable any parallelism.
63
+ * Options:
64
+ * `true` to default to the machines number of CPUs
65
+ * `false` to disable any paralelism
66
+ * `int` for a specific number of CPUs
67
+ */
68
+ parallelism: true;
69
+ };
70
+ export type TWebpackConfigOptions<ConfigMode extends TWebpackConfigMode> = {
71
+ /**
72
+ * The absolute path to the application entry point file.
73
+ */
74
+ entryPoint?: string;
75
+ /**
76
+ * A list of folders where Webpack should look for source files.
77
+ */
78
+ sourceFolders?: string[];
79
+ /**
80
+ * Options related to Postcss plugins. See `createPostcssConfig` function.
81
+ */
82
+ postcssOptions?: TPostcssConfigOptions;
83
+ /**
84
+ * Options to enable/disable certain functionalities of the Webpack config.
85
+ */
86
+ toggleFlags?: ConfigMode extends 'development' ? TWebpackConfigToggleFlagsForDevelopment : ConfigMode extends 'production' ? TWebpackConfigToggleFlagsForProduction : never;
87
+ };
@@ -0,0 +1,6 @@
1
+ type TAuthPayload = {
2
+ email: string;
3
+ password: string;
4
+ };
5
+ declare const getAuthToken: (mcApiUrl: string, payload: TAuthPayload, headers?: Record<string, string>) => Promise<any>;
6
+ export { getAuthToken };
@@ -0,0 +1,11 @@
1
+ import type { TMcCliAuthToken, TMcCliCredentialsStorage } from '../types';
2
+ declare class CredentialsStorage {
3
+ static location: string;
4
+ constructor();
5
+ _writeCredentials(credentials?: TMcCliCredentialsStorage): void;
6
+ _loadCredentials(): TMcCliCredentialsStorage;
7
+ getToken(environmentKey: string): string | null;
8
+ setToken(environmentKey: string, credentials: TMcCliAuthToken): void;
9
+ isSessionValid(environmentKey: string): boolean;
10
+ }
11
+ export default CredentialsStorage;
@@ -0,0 +1,2 @@
1
+ declare function doesFileExist(path: string): boolean;
2
+ export default doesFileExist;
@@ -0,0 +1,3 @@
1
+ import { type CustomApplicationData, type CustomViewData } from '@commercetools-frontend/application-config';
2
+ export declare const getCustomApplicationConfigDiff: (oldConfig: CustomApplicationData, newConfig: CustomApplicationData) => string;
3
+ export declare const getCustomViewConfigDiff: (oldConfig: CustomViewData, newConfig: CustomViewData) => string;
@@ -0,0 +1,172 @@
1
+ import type { TCustomApplicationDeploymentPreviewCreateInput, TCustomApplicationDeploymentPreviewUpdateInput, TCustomApplicationDraftDataInput, TCustomViewDraftDataInput } from '../generated/settings';
2
+ type TFetchCustomApplicationOptions = {
3
+ mcApiUrl: string;
4
+ entryPointUriPath: string;
5
+ applicationIdentifier: string;
6
+ };
7
+ type TFetchCustomViewOptions = {
8
+ mcApiUrl: string;
9
+ customViewId: string;
10
+ applicationIdentifier: string;
11
+ };
12
+ type TUpdateCustomApplicationOptions = {
13
+ mcApiUrl: string;
14
+ applicationId: string;
15
+ organizationId: string;
16
+ data: TCustomApplicationDraftDataInput;
17
+ applicationIdentifier: string;
18
+ };
19
+ type TUpdateCustomViewOptions = {
20
+ mcApiUrl: string;
21
+ customViewId: string;
22
+ organizationId: string;
23
+ data: TCustomViewDraftDataInput;
24
+ applicationIdentifier: string;
25
+ };
26
+ type TCreateCustomApplicationOptions = {
27
+ mcApiUrl: string;
28
+ organizationId: string;
29
+ data: TCustomApplicationDraftDataInput;
30
+ applicationIdentifier: string;
31
+ };
32
+ type TCreateCustomViewOptions = {
33
+ mcApiUrl: string;
34
+ organizationId: string;
35
+ data: TCustomViewDraftDataInput;
36
+ applicationIdentifier: string;
37
+ };
38
+ type TFetchUserOrganizationsOptions = {
39
+ mcApiUrl: string;
40
+ applicationIdentifier: string;
41
+ customViewId?: string;
42
+ };
43
+ type TCreateCustomApplicationDeploymentPreviewOptions = {
44
+ mcApiUrl: string;
45
+ organizationId: string;
46
+ applicationId: string;
47
+ applicationIdentifier: string;
48
+ data: TCustomApplicationDeploymentPreviewCreateInput;
49
+ };
50
+ type TUpdateCustomApplicationDeploymentPreviewOptions = {
51
+ mcApiUrl: string;
52
+ deploymentId: string;
53
+ organizationId: string;
54
+ data: TCustomApplicationDeploymentPreviewUpdateInput;
55
+ applicationIdentifier: string;
56
+ };
57
+ type TDeleteCustomApplicationDeploymentPreviewOptions = {
58
+ mcApiUrl: string;
59
+ organizationId: string;
60
+ applicationIdentifier: string;
61
+ deploymentId: string;
62
+ };
63
+ declare const fetchCustomApplication: ({ mcApiUrl, entryPointUriPath, applicationIdentifier, }: TFetchCustomApplicationOptions) => Promise<{
64
+ __typename?: "OrganizationExtensionForCustomApplication" | undefined;
65
+ organizationId: string;
66
+ application: {
67
+ __typename?: "RestrictedCustomApplicationForOrganization" | undefined;
68
+ id: string;
69
+ entryPointUriPath: string;
70
+ name: string;
71
+ description?: string | null | undefined;
72
+ url: string;
73
+ icon: string;
74
+ permissions: {
75
+ __typename?: "CustomApplicationPermission" | undefined;
76
+ name: string;
77
+ oAuthScopes: string[];
78
+ }[];
79
+ mainMenuLink: {
80
+ __typename?: "CustomApplicationMenuLink" | undefined;
81
+ defaultLabel: string;
82
+ permissions: string[];
83
+ labelAllLocales: {
84
+ __typename?: "LocalizedField" | undefined;
85
+ locale: string;
86
+ value: string;
87
+ }[];
88
+ };
89
+ submenuLinks: {
90
+ __typename?: "CustomApplicationSubmenuLink" | undefined;
91
+ uriPath: string;
92
+ defaultLabel: string;
93
+ permissions: string[];
94
+ labelAllLocales: {
95
+ __typename?: "LocalizedField" | undefined;
96
+ locale: string;
97
+ value: string;
98
+ }[];
99
+ }[];
100
+ deployments: {
101
+ __typename?: "CustomApplicationDeploymentPreview" | undefined;
102
+ id: string;
103
+ url: string;
104
+ alias?: string | null | undefined;
105
+ }[];
106
+ };
107
+ } | null | undefined>;
108
+ declare const fetchCustomView: ({ mcApiUrl, customViewId, applicationIdentifier, }: TFetchCustomViewOptions) => Promise<{
109
+ __typename?: "OrganizationExtensionForCustomView" | undefined;
110
+ organizationId: string;
111
+ customView?: {
112
+ __typename?: "RestrictedCustomViewForOrganization" | undefined;
113
+ id: string;
114
+ defaultLabel: string;
115
+ url: string;
116
+ type: import("../generated/settings").TCustomViewType;
117
+ locators: string[];
118
+ labelAllLocales: {
119
+ __typename?: "LocalizedField" | undefined;
120
+ locale: string;
121
+ value: string;
122
+ }[];
123
+ typeSettings?: {
124
+ __typename?: "CustomViewTypeSettings" | undefined;
125
+ size?: import("../generated/settings").TCustomViewSize | null | undefined;
126
+ } | null | undefined;
127
+ permissions: {
128
+ __typename?: "CustomViewPermission" | undefined;
129
+ name: string;
130
+ oAuthScopes: string[];
131
+ }[];
132
+ } | null | undefined;
133
+ } | null | undefined>;
134
+ declare const updateCustomApplication: ({ mcApiUrl, applicationId, organizationId, data, applicationIdentifier, }: TUpdateCustomApplicationOptions) => Promise<{
135
+ __typename?: "RestrictedCustomApplicationForOrganization" | undefined;
136
+ id: string;
137
+ } | null | undefined>;
138
+ declare const updateCustomView: ({ mcApiUrl, organizationId, data, customViewId, applicationIdentifier, }: TUpdateCustomViewOptions) => Promise<{
139
+ __typename?: "RestrictedCustomViewForOrganization" | undefined;
140
+ id: string;
141
+ } | null | undefined>;
142
+ declare const createCustomApplication: ({ mcApiUrl, organizationId, data, applicationIdentifier, }: TCreateCustomApplicationOptions) => Promise<{
143
+ __typename?: "RestrictedCustomApplicationForOrganization" | undefined;
144
+ id: string;
145
+ } | null | undefined>;
146
+ declare const createCustomView: ({ mcApiUrl, organizationId, data, applicationIdentifier, }: TCreateCustomViewOptions) => Promise<{
147
+ __typename?: "RestrictedCustomViewForOrganization" | undefined;
148
+ id: string;
149
+ } | null | undefined>;
150
+ declare const fetchUserOrganizations: ({ mcApiUrl, applicationIdentifier, customViewId, }: TFetchUserOrganizationsOptions) => Promise<{
151
+ __typename?: "OrganizationQueryResult" | undefined;
152
+ total: any;
153
+ results: {
154
+ __typename?: "Organization" | undefined;
155
+ id: string;
156
+ name: string;
157
+ }[];
158
+ }>;
159
+ declare const createCustomApplicationDeploymentPreview: ({ mcApiUrl, organizationId, applicationId, applicationIdentifier, data, }: TCreateCustomApplicationDeploymentPreviewOptions) => Promise<{
160
+ __typename?: "CustomApplicationDeploymentPreview" | undefined;
161
+ id: string;
162
+ alias?: string | null | undefined;
163
+ url: string;
164
+ }>;
165
+ declare const updateCustomApplicationDeploymentPreview: ({ mcApiUrl, organizationId, deploymentId, data, applicationIdentifier, }: TUpdateCustomApplicationDeploymentPreviewOptions) => Promise<{
166
+ __typename?: "CustomApplicationDeploymentPreview" | undefined;
167
+ id: string;
168
+ alias?: string | null | undefined;
169
+ url: string;
170
+ }>;
171
+ declare const deleteCustomApplicationDeploymentPreview: ({ mcApiUrl, organizationId, applicationIdentifier, deploymentId, }: TDeleteCustomApplicationDeploymentPreviewOptions) => Promise<void>;
172
+ export { fetchCustomApplication, fetchCustomView, updateCustomApplication, createCustomApplication, fetchUserOrganizations, createCustomView, updateCustomView, createCustomApplicationDeploymentPreview, updateCustomApplicationDeploymentPreview, deleteCustomApplicationDeploymentPreview, };
@@ -0,0 +1,4 @@
1
+ type TMessageFormat = 'simple' | 'transifex';
2
+ declare function getI18nMessageFormat(source: string): TMessageFormat;
3
+ declare function handleMessageCompilationError(fileIdentifier: string, error: unknown, warnFunction: (e: Error) => void): void;
4
+ export { getI18nMessageFormat, handleMessageCompilationError };
@@ -0,0 +1,2 @@
1
+ declare const userAgent: string;
2
+ export default userAgent;
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@APPLICATION_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vite';
2
+ declare function vitePluginDynamicBaseAssetsGlobals(): Plugin;
3
+ export default vitePluginDynamicBaseAssetsGlobals;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vite';
2
+ declare function vitePluginI18nMessageCompilation(): Plugin;
3
+ export default vitePluginI18nMessageCompilation;
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { ApplicationRuntimeConfig } from '@commercetools-frontend/application-config';
3
+ declare const vitePluginCustomApplication: (applicationConfig: ApplicationRuntimeConfig) => Plugin;
4
+ export default vitePluginCustomApplication;
@@ -0,0 +1,3 @@
1
+ import { type Plugin } from 'vite';
2
+ declare function vitePluginSvgr(): Plugin;
3
+ export default vitePluginSvgr;
@@ -0,0 +1,3 @@
1
+ import type { LoaderDefinitionFunction } from 'webpack';
2
+ declare const i18nMessageCompilationLoader: LoaderDefinitionFunction;
3
+ export default i18nMessageCompilationLoader;
@@ -0,0 +1,12 @@
1
+ import type { Compiler, Stats } from 'webpack';
2
+ type TFinalStatsWriterPluginOptions = {
3
+ outputPath: string;
4
+ includeFields: string[];
5
+ };
6
+ declare class FinalStatsWriterPlugin {
7
+ config: TFinalStatsWriterPluginOptions;
8
+ constructor(config: TFinalStatsWriterPluginOptions);
9
+ apply(compiler: Compiler): void;
10
+ writeStats(stats: Stats): void;
11
+ }
12
+ export default FinalStatsWriterPlugin;
@@ -0,0 +1,5 @@
1
+ import type { Compiler } from 'webpack';
2
+ declare class LocalHtmlWebpackPlugin {
3
+ apply(compiler: Compiler): void;
4
+ }
5
+ export default LocalHtmlWebpackPlugin;
@@ -0,0 +1,2 @@
1
+ export { default as createWebpackConfigForDevelopment } from './config/create-webpack-config-for-development';
2
+ export { default as createWebpackConfigForProduction } from './config/create-webpack-config-for-production';
@@ -0,0 +1,203 @@
1
+ 'use strict';
2
+
3
+ var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
4
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
5
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
6
+ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
7
+ var chalk = require('chalk');
8
+ var prompts = require('prompts');
9
+ var applicationConfig = require('@commercetools-frontend/application-config');
10
+ var credentialsStorage$1 = require('./credentials-storage-3cea94ea.cjs.dev.js');
11
+ var graphqlRequests = require('./graphql-requests-733aac06.cjs.dev.js');
12
+ require('@commercetools/http-user-agent');
13
+ require('./package-436331e6.cjs.dev.js');
14
+ require('@babel/runtime-corejs3/helpers/classCallCheck');
15
+ require('@babel/runtime-corejs3/helpers/createClass');
16
+ require('@babel/runtime-corejs3/core-js-stable/json/stringify');
17
+ require('@babel/runtime-corejs3/core-js-stable/date/now');
18
+ require('fs');
19
+ require('os');
20
+ require('path');
21
+ require('./does-file-exist-eb86baca.cjs.dev.js');
22
+ require('node:fs');
23
+ require('@babel/runtime-corejs3/core-js-stable/object/keys');
24
+ require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
25
+ require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
26
+ require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
27
+ require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
28
+ require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
29
+ require('@babel/runtime-corejs3/core-js-stable/object/define-property');
30
+ require('@babel/runtime-corejs3/helpers/defineProperty');
31
+ require('@babel/runtime-corejs3/core-js-stable/instance/some');
32
+ require('graphql');
33
+ require('graphql-request');
34
+ require('@commercetools-frontend/constants');
35
+
36
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
37
+
38
+ var _URL__default = /*#__PURE__*/_interopDefault(_URL);
39
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
40
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
41
+ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
42
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
43
+ var prompts__default = /*#__PURE__*/_interopDefault(prompts);
44
+
45
+ const credentialsStorage = new credentialsStorage$1.CredentialsStorage();
46
+ const validateUrl = function () {
47
+ let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
48
+ try {
49
+ var _context;
50
+ const urlSchema = new _URL__default["default"](url);
51
+ return _includesInstanceProperty__default["default"](_context = ['http:', 'https:']).call(_context, urlSchema.protocol);
52
+ } catch (error) {
53
+ return false;
54
+ }
55
+ };
56
+ const validateAlias = function () {
57
+ let alias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
58
+ try {
59
+ new _URL__default["default"](`https://${alias}.commercetools.com/`);
60
+ return true;
61
+ } catch (error) {
62
+ return false;
63
+ }
64
+ };
65
+ const getMcUrlLink = _ref => {
66
+ let mcApiUrl = _ref.mcApiUrl,
67
+ organizationId = _ref.organizationId,
68
+ customEntityId = _ref.customEntityId,
69
+ isCustomView = _ref.isCustomView;
70
+ const mcUrl = mcApiUrl.replace('mc-api', 'mc');
71
+ const customEntityLink = `${mcUrl}/account/organizations/${organizationId}/custom-${isCustomView ? 'views' : 'applications'}/owned/${customEntityId}/deployment-previews`;
72
+ return customEntityLink;
73
+ };
74
+ const isCustomViewData = data => data.entryPointUriPath === undefined;
75
+ async function setDeploymentPreview(_ref2) {
76
+ var _context3;
77
+ let mcApiUrl = _ref2.mcApiUrl,
78
+ applicationId = _ref2.applicationId,
79
+ applicationIdentifier = _ref2.applicationIdentifier,
80
+ localCustomEntityData = _ref2.localCustomEntityData,
81
+ isCustomView = _ref2.isCustomView,
82
+ options = _ref2.options;
83
+ /*
84
+ 1. Check if the Custom Application exists in the Merchant Center.
85
+ 2. Ask for the alias and URL of the deployment preview.
86
+ 3. Check whether it exists a deployment preview with the same alias.
87
+ 4. If it exists, ask for confirmation to update it.
88
+ 5. If it doesn't exist, ask for confirmation to create it.
89
+ */
90
+
91
+ const fetchedCustomApplication = await graphqlRequests.fetchCustomApplication({
92
+ mcApiUrl,
93
+ entryPointUriPath: localCustomEntityData.entryPointUriPath,
94
+ applicationIdentifier
95
+ });
96
+ if (!fetchedCustomApplication) {
97
+ throw new Error(`The Custom Application "${applicationIdentifier}" does not exist in the Merchant Center. Please create a Custom Application first before configuring deployment previews.`);
98
+ }
99
+ let deploymentAlias = options.alias;
100
+ // If the alias was not provided as an argument to the script, let's ask for it.
101
+ if (!deploymentAlias) {
102
+ var _context2;
103
+ const _await$prompts = await prompts__default["default"]({
104
+ type: 'text',
105
+ name: 'alias',
106
+ 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'),
107
+ validate: value => validateAlias(value)
108
+ }),
109
+ alias = _await$prompts.alias;
110
+ deploymentAlias = alias;
111
+ }
112
+ const existingDeploymentPreview = _findInstanceProperty__default["default"](_context3 = fetchedCustomApplication.application.deployments).call(_context3, deployment => deployment.alias === deploymentAlias);
113
+ if (!options.alias && !options.url && existingDeploymentPreview) {
114
+ var _context4;
115
+ const _await$prompts2 = await prompts__default["default"]({
116
+ type: 'confirm',
117
+ name: 'aliasOverrideConfirmation',
118
+ 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'),
119
+ initial: false
120
+ }),
121
+ aliasOverrideConfirmation = _await$prompts2.aliasOverrideConfirmation;
122
+ if (!aliasOverrideConfirmation) {
123
+ console.log(chalk__default["default"].red('Aborted.'));
124
+ return;
125
+ }
126
+ }
127
+ let deploymentUrl = options.url;
128
+ if (!deploymentUrl) {
129
+ var _context5;
130
+ const _await$prompts3 = await prompts__default["default"]({
131
+ type: 'text',
132
+ name: 'url',
133
+ 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'),
134
+ validate: value => validateUrl(value)
135
+ }),
136
+ url = _await$prompts3.url;
137
+ deploymentUrl = url;
138
+ }
139
+ if (options.dryRun) {
140
+ 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}".`;
141
+ console.log(`\n${message}\n`);
142
+ return;
143
+ }
144
+ const mcDeploymentPreviewsLink = getMcUrlLink({
145
+ mcApiUrl,
146
+ organizationId: fetchedCustomApplication.organizationId,
147
+ customEntityId: fetchedCustomApplication.application.id,
148
+ isCustomView
149
+ });
150
+ if (existingDeploymentPreview) {
151
+ await graphqlRequests.updateCustomApplicationDeploymentPreview({
152
+ mcApiUrl,
153
+ organizationId: fetchedCustomApplication.organizationId,
154
+ applicationIdentifier,
155
+ deploymentId: existingDeploymentPreview.id,
156
+ data: {
157
+ url: deploymentUrl
158
+ }
159
+ });
160
+ console.log(chalk__default["default"].green(`Deployment preview with alias "${deploymentAlias}" updated successfully with URL "${deploymentUrl}".`));
161
+ console.log(chalk__default["default"].green(`You can access the deployment previews at: ${mcDeploymentPreviewsLink}`));
162
+ } else {
163
+ await graphqlRequests.createCustomApplicationDeploymentPreview({
164
+ mcApiUrl,
165
+ organizationId: fetchedCustomApplication.organizationId,
166
+ applicationIdentifier,
167
+ applicationId,
168
+ data: {
169
+ alias: deploymentAlias,
170
+ url: deploymentUrl
171
+ }
172
+ });
173
+ console.log(chalk__default["default"].green(`Deployment preview with alias "${deploymentAlias}" created successfully with URL "${deploymentUrl}".`));
174
+ console.log(chalk__default["default"].green(`You can access the deployment previews at: ${mcDeploymentPreviewsLink}`));
175
+ }
176
+ }
177
+ async function run(options) {
178
+ const applicationConfig$1 = applicationConfig.processConfig();
179
+ const localCustomEntityData = applicationConfig$1.data;
180
+ const _applicationConfig$en = applicationConfig$1.env,
181
+ mcApiUrl = _applicationConfig$en.mcApiUrl,
182
+ applicationIdentifier = _applicationConfig$en.applicationIdentifier;
183
+ const isCustomView = isCustomViewData(localCustomEntityData);
184
+ console.log(`Using Merchant Center environment "${chalk__default["default"].green(mcApiUrl)}".`);
185
+ console.log();
186
+ const isSessionValid = credentialsStorage.isSessionValid(mcApiUrl);
187
+ if (!isSessionValid) {
188
+ throw new Error(`You don't have a valid session. Please, run the "mc-scripts login" command to authenticate yourself.`);
189
+ }
190
+ if (isCustomView) {
191
+ throw new Error('Deployments previews are not supported for Custom Views.');
192
+ }
193
+ await setDeploymentPreview({
194
+ mcApiUrl,
195
+ applicationId: localCustomEntityData.id,
196
+ applicationIdentifier,
197
+ localCustomEntityData,
198
+ isCustomView,
199
+ options
200
+ });
201
+ }
202
+
203
+ exports["default"] = run;