@wix/astro 1.0.23 → 1.0.25

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 (53) hide show
  1. package/build/index.d.ts +4 -2
  2. package/build/index.js +926 -1796
  3. package/build/index.js.map +1 -1
  4. package/build-browser-runtime/setup.js +4 -4
  5. package/build-runtime/{chunk-VMS3NKCF.js → chunk-HPW4ZAEJ.js} +7 -2
  6. package/build-runtime/{chunk-C3QOE2TZ.js → chunk-NVTQFGTR.js} +1 -1
  7. package/build-runtime/chunk-W73LN534.js +24 -0
  8. package/build-runtime/context/{non-elevated.js → nonElevated.js} +2 -2
  9. package/build-runtime/context/setupServicePlugin.d.ts +5 -0
  10. package/build-runtime/context/setupServicePlugin.js +16 -0
  11. package/build-runtime/context/setupWebhook.d.ts +5 -0
  12. package/build-runtime/context/setupWebhook.js +16 -0
  13. package/build-runtime/middleware/auth.js +5 -5
  14. package/build-runtime/middleware/html-embeds.js +1 -1
  15. package/build-runtime/routes/auth/callback.js +3 -3
  16. package/build-runtime/routes/auth/login.js +2 -1
  17. package/build-runtime/routes/auth/logout-callback.js +3 -3
  18. package/build-runtime/routes/{service-plugins.js → servicePluginsDevRoute.js} +2 -2
  19. package/build-runtime/routes/{webhooks.js → webhooksDevRoute.js} +2 -2
  20. package/package.json +11 -14
  21. package/runtime/entry.astro +1 -1
  22. package/src/client-context/utils.ts +40 -0
  23. package/src/components.ts +80 -59
  24. package/src/context/setupServicePlugin.ts +13 -0
  25. package/src/context/setupWebhook.ts +13 -0
  26. package/src/context/utils.ts +22 -30
  27. package/src/index.ts +79 -164
  28. package/src/middleware/auth.ts +1 -1
  29. package/src/middleware/html-embeds.ts +1 -1
  30. package/src/plugins/setupSsrContext.ts +1 -1
  31. package/src/routes/auth/login.ts +3 -1
  32. package/src/routes/{service-plugins.ts → servicePluginsDevRoute.ts} +1 -1
  33. package/src/routes/{webhooks.ts → webhooksDevRoute.ts} +1 -1
  34. package/src/utils/buildBackofficeComponent.ts +66 -0
  35. package/src/utils/buildComponents.ts +194 -0
  36. package/src/utils/buildServicePluginComponent.ts +54 -0
  37. package/src/utils/buildWebhookComponent.ts +41 -0
  38. package/src/utils/createProjectModel.ts +42 -30
  39. package/src/utils/fs-utils.ts +7 -1
  40. package/src/utils/removeUnusedCodegenFiles.ts +34 -0
  41. package/src/utils/saveSessionTokensToCookie.ts +10 -3
  42. package/tsup.config.mjs +6 -4
  43. package/src/utils/isValidBackofficeComponent.ts +0 -18
  44. package/src/utils/isValidServicePluginComponent.ts +0 -26
  45. package/src/utils/isValidWebhookComponent.ts +0 -10
  46. package/src/utils/writeVirtualBackofficeExtensionFiles.ts +0 -93
  47. package/src/utils/writeVirtualServicePluginExtensionFiles.ts +0 -73
  48. package/src/utils/writeVirtualWebhookExtensionFiles.ts +0 -72
  49. /package/build-runtime/context/{non-elevated.d.ts → nonElevated.d.ts} +0 -0
  50. /package/build-runtime/routes/{service-plugins.d.ts → servicePluginsDevRoute.d.ts} +0 -0
  51. /package/build-runtime/routes/{webhooks.d.ts → webhooksDevRoute.d.ts} +0 -0
  52. /package/src/{context → client-context}/setup.ts +0 -0
  53. /package/src/context/{non-elevated.ts → nonElevated.ts} +0 -0
package/src/index.ts CHANGED
@@ -4,36 +4,34 @@ import type { AstroConfig, AstroIntegration } from 'astro';
4
4
  import { envField, passthroughImageService } from 'astro/config';
5
5
  import chokidar from 'chokidar';
6
6
  import { outdent } from 'outdent';
7
- import type { Model } from './types.js';
8
7
  import { EXTENSIONS_DIR, GIT_IGNORED_DIR } from './directories.js';
9
8
  import { patchAstroInlineScripts } from './plugins/patchAstroInlineScripts.js';
10
9
  import { patchGlobal } from './plugins/patchGlobal.js';
11
10
  import { setupSsrContext } from './plugins/setupSsrContext.js';
11
+ import { buildComponents } from './utils/buildComponents.js';
12
12
  import { createProjectModel } from './utils/createProjectModel.js';
13
- import { outputDir, writeJson } from './utils/fs-utils.js';
13
+ import { clearDir, writeJson } from './utils/fs-utils.js';
14
14
  import { generateAppManifest } from './utils/generateAppManifest.js';
15
- import { isValidBackofficeComponent } from './utils/isValidBackofficeComponent.js';
16
- import { isValidServicePluginComponent } from './utils/isValidServicePluginComponent.js';
17
- import { isValidWebhookComponent } from './utils/isValidWebhookComponent.js';
15
+ import { removeUnusedCodegenFiles } from './utils/removeUnusedCodegenFiles.js';
18
16
  import { resolveBuildMetadata } from './utils/resolveBuildMetadata.js';
19
- import { writeVirtualBackofficeExtensionFiles } from './utils/writeVirtualBackofficeExtensionFiles.js';
20
- import { writeVirtualServicePluginExtensionFiles } from './utils/writeVirtualServicePluginExtensionFiles.js';
21
- import { writeVirtualWebhookExtensionFiles } from './utils/writeVirtualWebhookExtensionFiles.js';
17
+
18
+ interface WixIntegrationOptions {
19
+ enableAuthRoutes?: boolean;
20
+ enableHtmlEmbeds?: boolean;
21
+ }
22
22
 
23
23
  const createIntegration = (
24
- options: {
25
- enableAuthRoutes?: boolean;
26
- } = {
24
+ options: WixIntegrationOptions = {
27
25
  enableAuthRoutes: true,
26
+ enableHtmlEmbeds: true,
28
27
  }
29
28
  ): AstroIntegration => {
30
29
  let _config: AstroConfig;
31
- let model: Model | null = null;
32
30
 
33
31
  return {
34
32
  hooks: {
35
33
  async 'astro:build:done'({ logger }) {
36
- model ??= await createProjectModel(logger);
34
+ const model = await createProjectModel(logger);
37
35
  const appManifest = generateAppManifest(model);
38
36
 
39
37
  const outDir = fileURLToPath(_config.outDir);
@@ -62,11 +60,14 @@ const createIntegration = (
62
60
  logger,
63
61
  updateConfig,
64
62
  }) {
63
+ const isDev = command === 'dev';
64
+
65
65
  const codegenDirURL = createCodegenDir();
66
66
  const codegenDir = fileURLToPath(codegenDirURL);
67
67
  const rootDir = fileURLToPath(config.root);
68
+ const extensionsDir = join(codegenDir, 'extensions');
68
69
 
69
- model ??= await createProjectModel(logger);
70
+ const model = await createProjectModel(logger);
70
71
 
71
72
  // support client-side context calls
72
73
  injectScript(
@@ -89,15 +90,6 @@ const createIntegration = (
89
90
  `
90
91
  );
91
92
 
92
- // inject HTML embeds
93
- addMiddleware({
94
- entrypoint: new URL(
95
- '../build-runtime/middleware/html-embeds.js',
96
- import.meta.url
97
- ),
98
- order: 'post',
99
- });
100
-
101
93
  // support server side context calls
102
94
  addMiddleware({
103
95
  entrypoint: new URL(
@@ -107,40 +99,18 @@ const createIntegration = (
107
99
  order: 'pre',
108
100
  });
109
101
 
110
- updateConfig({
111
- env: {
112
- schema: {
113
- WIX_CLIENT_ID: envField.string({
114
- access: 'public',
115
- context: 'client',
116
- }),
117
- WIX_CLIENT_INSTANCE_ID: envField.string({
118
- access: 'secret',
119
- context: 'server',
120
- }),
121
- WIX_CLIENT_PUBLIC_KEY: envField.string({
122
- access: 'secret',
123
- context: 'server',
124
- }),
125
- WIX_CLIENT_SECRET: envField.string({
126
- access: 'secret',
127
- context: 'server',
128
- }),
129
- },
130
- },
131
- image: {
132
- domains: ['static.wixstatic.com'],
133
- service: passthroughImageService(),
134
- },
135
- vite: {
136
- plugins: [
137
- patchGlobal(),
138
- patchAstroInlineScripts(),
139
- setupSsrContext(rootDir),
140
- ],
141
- },
142
- });
102
+ // support HTML embeds
103
+ if (options.enableHtmlEmbeds) {
104
+ addMiddleware({
105
+ entrypoint: new URL(
106
+ '../build-runtime/middleware/html-embeds.js',
107
+ import.meta.url
108
+ ),
109
+ order: 'post',
110
+ });
111
+ }
143
112
 
113
+ // support auth routes
144
114
  if (options.enableAuthRoutes) {
145
115
  injectRoute({
146
116
  entrypoint: new URL(
@@ -179,60 +149,63 @@ const createIntegration = (
179
149
  });
180
150
  }
181
151
 
182
- // add support for webhook extensions
183
- const webhookCodegenDir = join(codegenDir, 'extensions/webhooks');
184
- await outputDir(webhookCodegenDir);
152
+ updateConfig({
153
+ env: {
154
+ schema: {
155
+ WIX_CLIENT_ID: envField.string({
156
+ access: 'public',
157
+ context: 'client',
158
+ }),
159
+ WIX_CLIENT_INSTANCE_ID: envField.string({
160
+ access: 'secret',
161
+ context: 'server',
162
+ }),
163
+ WIX_CLIENT_PUBLIC_KEY: envField.string({
164
+ access: 'secret',
165
+ context: 'server',
166
+ }),
167
+ WIX_CLIENT_SECRET: envField.string({
168
+ access: 'secret',
169
+ context: 'server',
170
+ }),
171
+ },
172
+ },
173
+ image: {
174
+ domains: ['static.wixstatic.com'],
175
+ service: passthroughImageService(),
176
+ },
177
+ vite: {
178
+ plugins: [
179
+ patchGlobal(),
180
+ patchAstroInlineScripts(),
181
+ setupSsrContext(rootDir),
182
+ ],
183
+ },
184
+ });
185
+
186
+ // build relevant wix extensions
187
+ await clearDir(codegenDir);
188
+ await buildComponents({ extensionsDir, injectRoute, isDev, model });
189
+
190
+ if (isDev) {
191
+ injectRoute({
192
+ entrypoint: new URL('../runtime/entry.astro', import.meta.url),
193
+ pattern: `/_wix/extensions/backoffice/[compId]`,
194
+ prerender: false,
195
+ });
185
196
 
186
- if (command === 'dev') {
187
197
  injectRoute({
188
198
  entrypoint: new URL(
189
- '../build-runtime/routes/webhooks.js',
199
+ '../build-runtime/routes/webhooksDevRoute.js',
190
200
  import.meta.url
191
201
  ),
192
202
  pattern: `/_wix/extensions/webhooks/[compId]`,
193
203
  prerender: false,
194
204
  });
195
205
 
196
- chokidar
197
- .watch([EXTENSIONS_DIR], {
198
- cwd: rootDir,
199
- ignoreInitial: true,
200
- useFsEvents: false,
201
- })
202
- .on('all', async () => {
203
- model = await createProjectModel(logger);
204
- await writeVirtualWebhookExtensionFiles(model, webhookCodegenDir);
205
- });
206
- } else {
207
- const webhookComponents = model.components.filter(
208
- isValidWebhookComponent
209
- );
210
- for (const component of webhookComponents) {
211
- const virtualEntrypoint = join(
212
- webhookCodegenDir,
213
- `${component.manifest.compId}.ts`
214
- );
215
-
216
- injectRoute({
217
- entrypoint: virtualEntrypoint,
218
- pattern: `/_wix/extensions/webhooks/${component.manifest.compId}`,
219
- });
220
- }
221
- }
222
-
223
- await writeVirtualWebhookExtensionFiles(model, webhookCodegenDir);
224
-
225
- // add support for service plugin extensions
226
- const servicePluginCodegenDir = join(
227
- codegenDir,
228
- 'extensions/service-plugins'
229
- );
230
- await outputDir(servicePluginCodegenDir);
231
-
232
- if (command === 'dev') {
233
206
  injectRoute({
234
207
  entrypoint: new URL(
235
- '../build-runtime/routes/service-plugins.js',
208
+ '../build-runtime/routes/servicePluginsDevRoute.js',
236
209
  import.meta.url
237
210
  ),
238
211
  pattern: `/_wix/extensions/service-plugins/[compId]`,
@@ -246,76 +219,18 @@ const createIntegration = (
246
219
  useFsEvents: false,
247
220
  })
248
221
  .on('all', async () => {
249
- model = await createProjectModel(logger);
250
- await writeVirtualServicePluginExtensionFiles(
251
- model,
252
- servicePluginCodegenDir
253
- );
254
- });
255
- } else {
256
- const servicePluginComponents = model.components.filter(
257
- isValidServicePluginComponent
258
- );
259
- for (const component of servicePluginComponents) {
260
- const virtualEntrypoint = join(
261
- servicePluginCodegenDir,
262
- `${component.manifest.compId}.ts`
263
- );
264
- injectRoute({
265
- entrypoint: virtualEntrypoint,
266
- pattern: `/_wix/extensions/service-plugins/${component.manifest.compId}`,
267
- });
268
- }
269
- }
270
-
271
- await writeVirtualServicePluginExtensionFiles(
272
- model,
273
- servicePluginCodegenDir
274
- );
222
+ const model = await createProjectModel(logger);
275
223
 
276
- // add support for backoffice extensions
277
- const backofficeCodegenDir = join(codegenDir, 'extensions/backoffice');
278
- await outputDir(backofficeCodegenDir);
224
+ await removeUnusedCodegenFiles({ extensionsDir, model });
279
225
 
280
- if (command === 'dev') {
281
- injectRoute({
282
- entrypoint: new URL('../runtime/entry.astro', import.meta.url),
283
- pattern: `/_wix/extensions/backoffice/[compId]`,
284
- prerender: false,
285
- });
286
-
287
- chokidar
288
- .watch([EXTENSIONS_DIR], {
289
- cwd: rootDir,
290
- ignoreInitial: true,
291
- useFsEvents: false,
292
- })
293
- .on('all', async () => {
294
- model = await createProjectModel(logger);
295
- await writeVirtualBackofficeExtensionFiles(
226
+ await buildComponents({
227
+ extensionsDir,
228
+ injectRoute,
229
+ isDev,
296
230
  model,
297
- backofficeCodegenDir
298
- );
231
+ });
299
232
  });
300
- } else {
301
- const backofficeComponents = model.components.filter(
302
- isValidBackofficeComponent
303
- );
304
-
305
- for (const component of backofficeComponents) {
306
- const virtualEntrypoint = join(
307
- backofficeCodegenDir,
308
- `${component.manifest.compId}.astro`
309
- );
310
-
311
- injectRoute({
312
- entrypoint: virtualEntrypoint,
313
- pattern: `/_wix/extensions/backoffice/${component.manifest.compId}`,
314
- });
315
- }
316
233
  }
317
-
318
- await writeVirtualBackofficeExtensionFiles(model, backofficeCodegenDir);
319
234
  },
320
235
  'astro:server:setup': ({ logger, server }) => {
321
236
  server.middlewares.use(async (req, res, next) => {
@@ -12,7 +12,7 @@ export const onRequest: MiddlewareHandler = async (context, next) => {
12
12
  sessionTokens: usedTokens,
13
13
  };
14
14
 
15
- const response = await authAsyncLocalStorage.run(store, () => {
15
+ const response = await authAsyncLocalStorage.run(store, async () => {
16
16
  return next();
17
17
  });
18
18
 
@@ -22,7 +22,7 @@ const bodyStartTransformStream = (htmlToInject: string) =>
22
22
  async function fetchScripts() {
23
23
  return httpClient
24
24
  .fetchWithAuth('https://edge.wixapis.com/assets/scripts/v1/site-scripts')
25
- .then((res) => res.json() as Promise<{ siteScripts: SiteScript[] }>)
25
+ .then(async (res) => res.json() as Promise<{ siteScripts: SiteScript[] }>)
26
26
  .then((data) => data.siteScripts);
27
27
  }
28
28
 
@@ -6,7 +6,7 @@ import { SRC_DIR } from '../directories.js';
6
6
 
7
7
  // injected routes
8
8
  const nonElevatedSetupUrl = new URL(
9
- '../build-runtime/context/non-elevated.js',
9
+ '../build-runtime/context/nonElevated.js',
10
10
  import.meta.url
11
11
  );
12
12
  const elevatedSetupUrl = new URL(
@@ -28,12 +28,14 @@ export const GET: APIRoute = async ({ request, url }) => {
28
28
  responseMode: 'query',
29
29
  });
30
30
 
31
+ const sameSite = import.meta.env.DEV ? 'None' : 'Lax';
32
+
31
33
  return new Response(null, {
32
34
  headers: {
33
35
  Location: authUrl,
34
36
  'Set-Cookie': `${oAuthStateCookieName}=${JSON.stringify(
35
37
  oauthData
36
- )}; Max-Age=1800; Path=/; HttpOnly; Secure; SameSite=Lax`,
38
+ )}; Max-Age=1800; Path=/; HttpOnly; Secure; SameSite=${sameSite}`,
37
39
  },
38
40
  status: 302,
39
41
  });
@@ -3,7 +3,7 @@ import type { APIRoute } from 'astro';
3
3
  export const ALL: APIRoute = async (context) => {
4
4
  const { ALL } = (await import(
5
5
  /* @vite-ignore */
6
- `/.astro/integrations/_wix_astro/extensions/service-plugins/${context.params.compId}.ts`
6
+ `/.astro/integrations/_wix_astro/extensions/service-plugins/${context.params.compId}/entry.ts`
7
7
  )) as { ALL: APIRoute };
8
8
 
9
9
  return ALL(context);
@@ -3,7 +3,7 @@ import type { APIRoute } from 'astro';
3
3
  export const ALL: APIRoute = async (context) => {
4
4
  const { ALL } = (await import(
5
5
  /* @vite-ignore */
6
- `/.astro/integrations/_wix_astro/extensions/webhooks/${context.params.compId}.ts`
6
+ `/.astro/integrations/_wix_astro/extensions/webhooks/${context.params.compId}/entry.ts`
7
7
  )) as { ALL: APIRoute };
8
8
 
9
9
  return ALL(context);
@@ -0,0 +1,66 @@
1
+ import { writeFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import type { InjectedRoute } from 'astro';
4
+ import { outdent } from 'outdent';
5
+ import type {
6
+ BackofficeExtensionWidget,
7
+ BackofficeModal,
8
+ BackofficePage,
9
+ } from '../components.js';
10
+ import { outputDir, toRelativePath } from './fs-utils.js';
11
+
12
+ export async function buildBackofficeComponent({
13
+ codegenDir,
14
+ component,
15
+ entryFileName,
16
+ injectRoute,
17
+ rootDir,
18
+ }: {
19
+ codegenDir: string;
20
+ component: BackofficeExtensionWidget | BackofficeModal | BackofficePage;
21
+ entryFileName: string;
22
+ injectRoute: (injectRoute: InjectedRoute) => void;
23
+ rootDir: string;
24
+ }): Promise<void> {
25
+ const directory = join(codegenDir, component.manifest.compId);
26
+
27
+ await outputDir(directory);
28
+
29
+ const entryFilePath = join(rootDir, component.directory, entryFileName);
30
+
31
+ const entrypoint = join(directory, `entry.astro`);
32
+ const HocEntrypoint = join(directory, `wrapper.tsx`);
33
+
34
+ await writeFile(
35
+ HocEntrypoint,
36
+ outdent`
37
+ import Component from '${toRelativePath(HocEntrypoint, entryFilePath)}';
38
+ import { withContextualWixClient } from '@wix/dashboard/internal';
39
+
40
+ export const WrappedComponent = withContextualWixClient(Component);
41
+ `
42
+ );
43
+
44
+ await writeFile(
45
+ entrypoint,
46
+ outdent`
47
+ ---
48
+ import { WrappedComponent } from '${toRelativePath(entrypoint, HocEntrypoint)}';
49
+ ---
50
+
51
+ <html lang="en">
52
+ <head></head>
53
+ <body>
54
+ <div>
55
+ <WrappedComponent client:only="react" />
56
+ </div>
57
+ </body>
58
+ </html>
59
+ `
60
+ );
61
+
62
+ injectRoute({
63
+ entrypoint,
64
+ pattern: `/_wix/extensions/backoffice/${component.manifest.compId}`,
65
+ });
66
+ }
@@ -0,0 +1,194 @@
1
+ import { join } from 'node:path';
2
+ import type { InjectedRoute } from 'astro';
3
+ import type { Model } from '../types.js';
4
+ import { buildBackofficeComponent } from './buildBackofficeComponent.js';
5
+ import { buildServicePluginComponent } from './buildServicePluginComponent.js';
6
+ import { buildWebhookComponent } from './buildWebhookComponent.js';
7
+
8
+ export async function buildComponents({
9
+ extensionsDir,
10
+ injectRoute: originalInjectRoute,
11
+ isDev,
12
+ model,
13
+ }: {
14
+ extensionsDir: string;
15
+ injectRoute: (injectRoute: InjectedRoute) => void;
16
+ isDev: boolean;
17
+ model: Model;
18
+ }): Promise<void> {
19
+ const { rootDir } = model;
20
+
21
+ // during dev, a single dynamic route is injected so adding or removing
22
+ // components doesn't require re-running the dev command
23
+ const injectRoute = isDev ? () => null : originalInjectRoute;
24
+
25
+ const backofficeCodegenDir = join(extensionsDir, 'backoffice');
26
+ const webhooksCodegenDir = join(extensionsDir, 'webhooks');
27
+ const servicePluginsCodegenDir = join(extensionsDir, 'service-plugins');
28
+
29
+ for (const component of model.components) {
30
+ switch (component.type) {
31
+ case 'BackofficeExtensionMenuPlugin': {
32
+ // configuration only
33
+
34
+ break;
35
+ }
36
+ case 'BackofficeExtensionWidget': {
37
+ if (
38
+ component.manifest.compData.backOfficeExtensionWidget.iframeUrl !=
39
+ null
40
+ ) {
41
+ continue;
42
+ }
43
+
44
+ await buildBackofficeComponent({
45
+ codegenDir: backofficeCodegenDir,
46
+ component,
47
+ entryFileName: 'widget.tsx',
48
+ injectRoute,
49
+ rootDir,
50
+ });
51
+
52
+ break;
53
+ }
54
+ case 'BackofficeModal': {
55
+ if (component.manifest.compData.backOfficeModal.iframeUrl != null) {
56
+ continue;
57
+ }
58
+
59
+ await buildBackofficeComponent({
60
+ codegenDir: backofficeCodegenDir,
61
+ component,
62
+ entryFileName: 'modal.tsx',
63
+ injectRoute,
64
+ rootDir,
65
+ });
66
+
67
+ break;
68
+ }
69
+ case 'BackofficePage': {
70
+ if (component.manifest.compData.backOfficePage.iframeUrl != null) {
71
+ continue;
72
+ }
73
+
74
+ await buildBackofficeComponent({
75
+ codegenDir: backofficeCodegenDir,
76
+ component,
77
+ entryFileName: 'page.tsx',
78
+ injectRoute,
79
+ rootDir,
80
+ });
81
+
82
+ break;
83
+ }
84
+ case 'EcomAdditionalFees': {
85
+ if (
86
+ component.manifest.compData.ecomAdditionalFees.deploymentUri != null
87
+ ) {
88
+ continue;
89
+ }
90
+
91
+ await buildServicePluginComponent({
92
+ codegenDir: servicePluginsCodegenDir,
93
+ component,
94
+ injectRoute,
95
+ rootDir,
96
+ });
97
+
98
+ break;
99
+ }
100
+ case 'EcomDiscountsTrigger': {
101
+ if (
102
+ component.manifest.compData.ecomDiscountsTrigger.deploymentUri != null
103
+ ) {
104
+ continue;
105
+ }
106
+
107
+ await buildServicePluginComponent({
108
+ codegenDir: servicePluginsCodegenDir,
109
+ component,
110
+ injectRoute,
111
+ rootDir,
112
+ });
113
+
114
+ break;
115
+ }
116
+ case 'EcomGiftCardsProvider': {
117
+ if (
118
+ component.manifest.compData.giftCardsProvider.deploymentUri != null
119
+ ) {
120
+ continue;
121
+ }
122
+
123
+ await buildServicePluginComponent({
124
+ codegenDir: servicePluginsCodegenDir,
125
+ component,
126
+ injectRoute,
127
+ rootDir,
128
+ });
129
+
130
+ break;
131
+ }
132
+ case 'EcomPaymentSettings': {
133
+ if (
134
+ component.manifest.compData.ecomPaymentSettings.deploymentUri != null
135
+ ) {
136
+ continue;
137
+ }
138
+
139
+ await buildServicePluginComponent({
140
+ codegenDir: servicePluginsCodegenDir,
141
+ component,
142
+ injectRoute,
143
+ rootDir,
144
+ });
145
+
146
+ break;
147
+ }
148
+ case 'EcomShippingRates': {
149
+ if (
150
+ component.manifest.compData.ecomShippingRates.deploymentUri != null
151
+ ) {
152
+ continue;
153
+ }
154
+
155
+ await buildServicePluginComponent({
156
+ codegenDir: servicePluginsCodegenDir,
157
+ component,
158
+ injectRoute,
159
+ rootDir,
160
+ });
161
+
162
+ break;
163
+ }
164
+ case 'EcomValidations': {
165
+ if (component.manifest.compData.ecomValidations.deploymentUri != null) {
166
+ continue;
167
+ }
168
+
169
+ await buildServicePluginComponent({
170
+ codegenDir: servicePluginsCodegenDir,
171
+ component,
172
+ injectRoute,
173
+ rootDir,
174
+ });
175
+
176
+ break;
177
+ }
178
+ case 'Webhook': {
179
+ if (component.manifest.compData.webhook.callbackUrl != null) {
180
+ continue;
181
+ }
182
+
183
+ await buildWebhookComponent({
184
+ codegenDir: webhooksCodegenDir,
185
+ component,
186
+ injectRoute,
187
+ rootDir,
188
+ });
189
+
190
+ break;
191
+ }
192
+ }
193
+ }
194
+ }