@wix/astro 2.29.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,14 @@ function customElementHmr({ customElement, tagName }) {
7
7
  }
8
8
  }
9
9
  const replaceMethodsOnElement = (elementNode, newClass) => {
10
+ const instanceDescriptors = Object.getOwnPropertyDescriptors(newClass);
11
+ for (const [name, descriptor] of Object.entries(instanceDescriptors)) if (name !== "length" && name !== "name" && name !== "prototype") Object.defineProperty(elementNode.constructor, name, descriptor);
12
+ const instanceSymbols = Object.getOwnPropertySymbols(newClass);
13
+ for (const symbol of instanceSymbols) Object.defineProperty(elementNode, symbol, instanceDescriptors[symbol]);
10
14
  const prototypeDescriptors = Object.getOwnPropertyDescriptors(newClass.prototype);
11
15
  for (const [name, descriptor] of Object.entries(prototypeDescriptors)) Object.defineProperty(elementNode, name, descriptor);
16
+ const prototypeSymbols = Object.getOwnPropertySymbols(newClass.prototype);
17
+ for (const symbol of prototypeSymbols) Object.defineProperty(elementNode, symbol, prototypeDescriptors[symbol]);
12
18
  };
13
19
  function applyCustomElementHmr(elementNode, NewElementClass) {
14
20
  visitPrototypeChain(NewElementClass, (classInheritance) => {
@@ -2,10 +2,10 @@ import { ComponentType } from "react";
2
2
 
3
3
  //#region src/runtime/wrapComponent.d.ts
4
4
  declare function wrapComponent({
5
- componentId,
5
+ bundlerId,
6
6
  loadComponent
7
7
  }: {
8
- componentId: string;
8
+ bundlerId: string;
9
9
  loadComponent: () => Promise<{
10
10
  default: ComponentType;
11
11
  }>;
@@ -3,8 +3,8 @@ import { withContextualWixClient } from "@wix/dashboard/internal";
3
3
  //#region src/runtime/wrapComponent.ts
4
4
  const WIX_CLIENT_ID = import.meta.env.WIX_CLIENT_ID;
5
5
  const components = /* @__PURE__ */ new Map();
6
- function wrapComponent({ componentId, loadComponent }) {
7
- components.set(componentId, async () => {
6
+ function wrapComponent({ bundlerId, loadComponent }) {
7
+ components.set(bundlerId, async () => {
8
8
  return loadComponent().then(({ default: Component }) => withContextualWixClient(Component));
9
9
  });
10
10
  globalThis.__module_federation__containers ??= {};
@@ -1,5 +1,5 @@
1
- import { i as BaseExtension, n as genericExtension } from "./index-D5k6Bmue.mjs";
2
- import { a as customElement, c as webhook, d as ecomPaymentSettings, f as ecomGiftCards, h as bookingsStaffSortingProvider, i as sitePlugin, l as ecomValidations, m as ecomAdditionalFees, n as siteComponentPanel, o as webhookBundler, p as ecomDiscountTriggers, r as embeddedScript, s as servicePluginBundler, t as siteComponent, u as ecomShippingRates } from "./index-B3B_5bgh.mjs";
1
+ import { i as BaseExtension, n as genericExtension } from "./index-Bv6fcDr9.mjs";
2
+ import { a as customElement, c as webhook, d as ecomPaymentSettings, f as ecomGiftCards, h as bookingsStaffSortingProvider, i as sitePlugin, l as ecomValidations, m as ecomAdditionalFees, n as siteComponentPanel, o as webhookBundler, p as ecomDiscountTriggers, r as embeddedScript, s as servicePluginBundler, t as siteComponent, u as ecomShippingRates } from "./index-DmpTY60h.mjs";
3
3
 
4
4
  //#region ../astro-backoffice-extensions/src/builders/backofficeExtensionMenuPlugin.d.ts
5
5
  interface BackofficeExtensionMenuPlugin {
@@ -1,4 +1,4 @@
1
- import { i as BaseExtension } from "./index-D5k6Bmue.mjs";
1
+ import { i as BaseExtension } from "./index-Bv6fcDr9.mjs";
2
2
 
3
3
  //#region ../astro-context-providers-extensions/src/builders.d.ts
4
4
  interface ContextProvider extends BaseExtension {
@@ -1,16 +1,20 @@
1
- import { n as genericExtension, r as app } from "./index-D5k6Bmue.mjs";
2
- import { a as customElement, c as webhook, d as ecomPaymentSettings, f as ecomGiftCards, h as bookingsStaffSortingProvider, i as sitePlugin, l as ecomValidations, m as ecomAdditionalFees, n as siteComponentPanel, o as webhookBundler, p as ecomDiscountTriggers, r as embeddedScript, s as servicePluginBundler, t as siteComponent, u as ecomShippingRates } from "./index-B3B_5bgh.mjs";
1
+ import { n as genericExtension, r as app, t as GenericExtension } from "./index-Bv6fcDr9.mjs";
2
+ import { a as customElement, c as webhook, d as ecomPaymentSettings, f as ecomGiftCards, h as bookingsStaffSortingProvider, i as sitePlugin, l as ecomValidations, m as ecomAdditionalFees, n as siteComponentPanel, o as webhookBundler, p as ecomDiscountTriggers, r as embeddedScript, s as servicePluginBundler, t as siteComponent, u as ecomShippingRates } from "./index-DmpTY60h.mjs";
3
3
 
4
- //#region ../astro-trusted-backoffice-extensions/src/builders/trustedBackofficePage.d.ts
5
- interface TrustedBackofficePage {
6
- type: "TrustedBackofficePage";
7
- options: Options$1;
4
+ //#region ../dev-center-schemas/src/components/backoffice.d.ts
5
+ interface DevCenterBackofficeScriptAsset {
6
+ containerId: string;
7
+ exportedName: string;
8
+ scriptType?: string;
9
+ url: string;
8
10
  }
11
+ //#endregion
12
+ //#region ../astro-trusted-backoffice-extensions/src/builders/trustedBackofficePage.d.ts
9
13
  interface MetaDataKeyword {
10
14
  id: string;
11
15
  value: string;
12
16
  }
13
- interface Options$1 {
17
+ interface Options$2 {
14
18
  id: string;
15
19
  activeSidebarPageId?: string;
16
20
  additionalRoutes?: string[];
@@ -30,14 +34,10 @@ interface Options$1 {
30
34
  routePath: string;
31
35
  title: string;
32
36
  }
33
- declare function trustedBackofficePage(options: Options$1): TrustedBackofficePage;
37
+ declare function trustedBackofficePage(options: Options$2): GenericExtension;
34
38
  //#endregion
35
39
  //#region ../astro-trusted-backoffice-extensions/src/builders/trustedBackofficeWidget.d.ts
36
- interface TrustedBackofficeWidget {
37
- type: "TrustedBackofficeWidget";
38
- options: Options;
39
- }
40
- interface Options {
40
+ interface Options$1 {
41
41
  id: string;
42
42
  component: string;
43
43
  height?: number;
@@ -46,7 +46,13 @@ interface Options {
46
46
  title: string;
47
47
  width?: number;
48
48
  }
49
- declare function trustedBackofficeWidget(options: Options): TrustedBackofficeWidget;
49
+ declare function trustedBackofficeWidget(options: Options$1): GenericExtension;
50
+ //#endregion
51
+ //#region ../astro-trusted-backoffice-extensions/src/bundlers/trusted-backoffice-component.d.ts
52
+ interface Options {
53
+ component: string;
54
+ }
55
+ declare function trustedBackofficeComponentBundler(options: Options): DevCenterBackofficeScriptAsset;
50
56
  //#endregion
51
57
  //#region src/builders-trusted.d.ts
52
58
  declare const extensions: {
@@ -68,6 +74,7 @@ declare const extensions: {
68
74
  sitePlugin: typeof sitePlugin;
69
75
  };
70
76
  declare const bundlers: {
77
+ dashboardComponent: typeof trustedBackofficeComponentBundler;
71
78
  event: typeof webhookBundler;
72
79
  servicePlugin: typeof servicePluginBundler;
73
80
  };
@@ -1,19 +1,38 @@
1
1
  import { _ as webhookBundler, a as customElement, c as webhook, d as ecomPaymentSettings, f as ecomGiftCards, h as bookingsStaffSortingProvider, i as sitePlugin, l as ecomValidations, m as ecomAdditionalFees, n as siteComponentPanel, o as app, p as ecomDiscountTriggers, r as embeddedScript, s as genericExtension, t as siteComponent, u as ecomShippingRates, y as servicePluginBundler } from "./builders-DVfxT6EC.mjs";
2
+ import { n as trustedBackofficeComponentBundler } from "./trusted-backoffice-component-CkJ9DWRp.mjs";
2
3
 
3
4
  //#region ../astro-trusted-backoffice-extensions/src/builders/trustedBackofficePage.ts
4
5
  function trustedBackofficePage(options) {
6
+ const { id, component, ...pageOptions } = options;
5
7
  return {
6
- type: "TrustedBackofficePage",
7
- options
8
+ type: "GenericExtension",
9
+ options: {
10
+ compId: id,
11
+ compType: "BACK_OFFICE_PAGE",
12
+ compData: { backOfficePage: {
13
+ hostingPlatform: "BUSINESS_MANAGER",
14
+ scriptAsset: trustedBackofficeComponentBundler({ component }),
15
+ ...pageOptions
16
+ } }
17
+ }
8
18
  };
9
19
  }
10
20
 
11
21
  //#endregion
12
22
  //#region ../astro-trusted-backoffice-extensions/src/builders/trustedBackofficeWidget.ts
13
23
  function trustedBackofficeWidget(options) {
24
+ const { id, component, ...widgetOptions } = options;
14
25
  return {
15
- type: "TrustedBackofficeWidget",
16
- options
26
+ type: "GenericExtension",
27
+ options: {
28
+ compId: id,
29
+ compType: "BACK_OFFICE_WIDGET",
30
+ compData: { backOfficeWidget: {
31
+ hostingPlatform: "BUSINESS_MANAGER",
32
+ scriptAsset: trustedBackofficeComponentBundler({ component }),
33
+ ...widgetOptions
34
+ } }
35
+ }
17
36
  };
18
37
  }
19
38
 
@@ -38,6 +57,7 @@ const extensions = {
38
57
  sitePlugin
39
58
  };
40
59
  const bundlers = {
60
+ dashboardComponent: trustedBackofficeComponentBundler,
41
61
  event: webhookBundler,
42
62
  servicePlugin: servicePluginBundler
43
63
  };
@@ -1,4 +1,4 @@
1
- import { r as app } from "./index-D5k6Bmue.mjs";
2
- import "./index-B3B_5bgh.mjs";
3
- import { n as extensions, t as bundlers } from "./builders-DP0350YQ.mjs";
1
+ import { r as app } from "./index-Bv6fcDr9.mjs";
2
+ import "./index-DmpTY60h.mjs";
3
+ import { n as extensions, t as bundlers } from "./builders-DRquPmdR.mjs";
4
4
  export { app, bundlers, extensions };
@@ -1,4 +1,4 @@
1
- import { i as BaseExtension, t as GenericExtension } from "./index-D5k6Bmue.mjs";
1
+ import { i as BaseExtension, t as GenericExtension } from "./index-Bv6fcDr9.mjs";
2
2
 
3
3
  //#region ../dev-center-schemas/src/components/custom-element.d.ts
4
4
  interface DevCenterCustomElementBehaviors {
@@ -1,6 +1,6 @@
1
- import "./index-D5k6Bmue.mjs";
2
- import "./index-B3B_5bgh.mjs";
3
- import { n as extensions } from "./builders-DP0350YQ.mjs";
1
+ import "./index-Bv6fcDr9.mjs";
2
+ import "./index-DmpTY60h.mjs";
3
+ import { n as extensions } from "./builders-DRquPmdR.mjs";
4
4
  import { AstroIntegration } from "astro";
5
5
 
6
6
  //#region src/index.d.ts
@@ -1,5 +1,6 @@
1
1
  import { g as WebhookBundlerType, v as ServicePluginBundlerType } from "./builders-DVfxT6EC.mjs";
2
2
  import { n as extensions } from "./builders-B9yQdgSz.mjs";
3
+ import { t as TrustedBackofficeComponentBundlerType } from "./trusted-backoffice-component-CkJ9DWRp.mjs";
3
4
  import { createRequire } from "node:module";
4
5
  import { fileURLToPath } from "node:url";
5
6
  import { ok } from "node:assert";
@@ -839,13 +840,13 @@ async function loadModule({ id, devServer }) {
839
840
 
840
841
  //#endregion
841
842
  //#region ../astro-backend-extensions/src/utils/getSupportedBundlers.ts
842
- function getSupportedBundlers(model) {
843
- return model.extensions.filter((extension) => extension.type === "GenericExtension").flatMap((extension) => getSupportedBundlersInExtension(extension).map((bundler) => ({
843
+ function getSupportedBundlers$1(model) {
844
+ return model.extensions.filter((extension) => extension.type === "GenericExtension").flatMap((extension) => getSupportedBundlersInExtension$1(extension).map((bundler) => ({
844
845
  bundler,
845
846
  extension
846
847
  })));
847
848
  }
848
- function getSupportedBundlersInExtension(extension) {
849
+ function getSupportedBundlersInExtension$1(extension) {
849
850
  return deepFind(extension.options, (value) => {
850
851
  if ("type" in value && (value.type === WebhookBundlerType || value.type === ServicePluginBundlerType)) return value;
851
852
  return false;
@@ -904,7 +905,7 @@ function viteVirtualRouterPlugin({ name, router }) {
904
905
  //#endregion
905
906
  //#region ../astro-backend-extensions/src/utils/getBackendBundler.ts
906
907
  function getBackendBundler(model, id) {
907
- return getSupportedBundlers(model).find(({ bundler }) => bundler.id === id);
908
+ return getSupportedBundlers$1(model).find(({ bundler }) => bundler.id === id);
908
909
  }
909
910
 
910
911
  //#endregion
@@ -958,7 +959,7 @@ function virtualModulesPlugin$5({ model }) {
958
959
  //#endregion
959
960
  //#region ../astro-backend-extensions/src/vite/getViteConfig.ts
960
961
  function getViteConfig$4({ name, config: astroConfig, createExtensionViteConfig, model }) {
961
- const entries = getSupportedBundlers(model).map(({ bundler }) => getVirtualModuleIdForBackendExtension(bundler.id));
962
+ const entries = getSupportedBundlers$1(model).map(({ bundler }) => getVirtualModuleIdForBackendExtension(bundler.id));
962
963
  return createExtensionViteConfig({
963
964
  name,
964
965
  config: {
@@ -1070,7 +1071,7 @@ const createIntegration$17 = () => {
1070
1071
  async "wix:build:setup"({ createExtensionViteConfig, target, updateConfig, vite }) {
1071
1072
  if (target === "client") return;
1072
1073
  ok(model);
1073
- updateConfig({ plugins: [virtualEntriesPlugin(getSupportedBundlers(model).length > 0 ? await build$1(getViteConfig$4({
1074
+ updateConfig({ plugins: [virtualEntriesPlugin(getSupportedBundlers$1(model).length > 0 ? await build$1(getViteConfig$4({
1074
1075
  name: "backend-extensions",
1075
1076
  config: vite,
1076
1077
  createExtensionViteConfig,
@@ -1087,7 +1088,7 @@ const createIntegration$17 = () => {
1087
1088
  optimizeDeps: { noDiscovery: false }
1088
1089
  }
1089
1090
  });
1090
- const bundlerExtensions = getSupportedBundlers(model);
1091
+ const bundlerExtensions = getSupportedBundlers$1(model);
1091
1092
  for (const { bundler, extension } of bundlerExtensions) await updateAppManifestComponent(extension.options.compId, async (current) => {
1092
1093
  ok(temporaryViteServer);
1093
1094
  return createBundlerManifest({
@@ -7860,7 +7861,7 @@ const hmrRuntimePath$3 = normalizePath$1(new URL("../dependencies/astro-context-
7860
7861
 
7861
7862
  //#endregion
7862
7863
  //#region ../astro-context-providers-extensions/src/utils/getSupportedExtensions.ts
7863
- function getSupportedExtensions$5({ extensions, srcDir }) {
7864
+ function getSupportedExtensions$4({ extensions, srcDir }) {
7864
7865
  return extensions.filter(filterContextProviders).map((extension) => {
7865
7866
  return {
7866
7867
  ...extension,
@@ -7876,7 +7877,7 @@ function filterContextProviders(extension) {
7876
7877
  //#endregion
7877
7878
  //#region ../astro-context-providers-extensions/src/utils/getContextProvider.ts
7878
7879
  function getContextProvider(model, id) {
7879
- return getSupportedExtensions$5(model).find((ext) => ext.options.id === id);
7880
+ return getSupportedExtensions$4(model).find((ext) => ext.options.id === id);
7880
7881
  }
7881
7882
 
7882
7883
  //#endregion
@@ -8086,7 +8087,7 @@ function getResources$3(buildContext) {
8086
8087
  //#endregion
8087
8088
  //#region ../astro-context-providers-extensions/src/vite/configs/build.ts
8088
8089
  function getBuildViteConfigs$3({ createExtensionViteConfig, model }) {
8089
- return getSupportedExtensions$5(model).reduce((acc, extension) => {
8090
+ return getSupportedExtensions$4(model).reduce((acc, extension) => {
8090
8091
  const { editorPreviewPath } = extension;
8091
8092
  acc.push(getClientBuildConfig$2({
8092
8093
  createExtensionViteConfig,
@@ -8152,7 +8153,7 @@ function getDevViteConfig$3({ createExtensionViteConfig, model }) {
8152
8153
  name: extensionName$3,
8153
8154
  config: {
8154
8155
  optimizeDeps: { entries: [
8155
- ...getSupportedExtensions$5(model).map((ext) => [ext.componentPath, ...ext.editorPreviewPath != null ? [ext.editorPreviewPath] : []]).flat(),
8156
+ ...getSupportedExtensions$4(model).map((ext) => [ext.componentPath, ...ext.editorPreviewPath != null ? [ext.editorPreviewPath] : []]).flat(),
8156
8157
  sdkRuntimePath$4,
8157
8158
  hmrRuntimePath$3
8158
8159
  ] },
@@ -8188,7 +8189,7 @@ const createIntegration$15 = () => {
8188
8189
  },
8189
8190
  async "wix:build:setup"({ createExtensionViteConfig }) {
8190
8191
  ok(model);
8191
- if (getSupportedExtensions$5(model).length === 0) return;
8192
+ if (getSupportedExtensions$4(model).length === 0) return;
8192
8193
  customBuildOutput = await buildAll(getBuildViteConfigs$3({
8193
8194
  createExtensionViteConfig,
8194
8195
  model
@@ -8196,7 +8197,7 @@ const createIntegration$15 = () => {
8196
8197
  },
8197
8198
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
8198
8199
  ok(model);
8199
- const extensions = getSupportedExtensions$5(model);
8200
+ const extensions = getSupportedExtensions$4(model);
8200
8201
  const components = [];
8201
8202
  for (const extension of extensions) {
8202
8203
  const buildContext = {
@@ -10508,6 +10509,11 @@ function createExtensionViteConfigFactory({ command, config: astroConfig, model
10508
10509
  configFile: false,
10509
10510
  customLogger: astroConfig.customLogger,
10510
10511
  define: { "import.meta.env.WIX_CLIENT_ID": JSON.stringify(model.env.WIX_CLIENT_ID) },
10512
+ experimental: { renderBuiltUrl(filename, { hostId, hostType }) {
10513
+ if (hostType !== "js") return { relative: true };
10514
+ return { runtime: `import.meta.url.replace("${hostId}", "${filename}")` };
10515
+ } },
10516
+ optimizeDeps: { include: ["@wix/sdk-context"] },
10511
10517
  publicDir: false,
10512
10518
  resolve: { dedupe: ["@wix/sdk-context"] },
10513
10519
  root: astroConfig.root,
@@ -19980,6 +19986,7 @@ const renderSettingsPanelPath = normalizePath$1(new URL("../dependencies/astro-c
19980
19986
  const reactHmrPath = normalizePath$1(new URL("../dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.js", import.meta.url));
19981
19987
  const customElementHmrPath = normalizePath$1(new URL("../dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.js", import.meta.url));
19982
19988
  function viteWrapCustomElementPlugin({ getExtensions, srcDir }) {
19989
+ let config = null;
19983
19990
  const getExtensionForModuleId = (baseId) => {
19984
19991
  return getExtensions().find((extension) => extension.options.id === baseId);
19985
19992
  };
@@ -19998,6 +20005,9 @@ function viteWrapCustomElementPlugin({ getExtensions, srcDir }) {
19998
20005
  };
19999
20006
  return {
20000
20007
  name: "vite-wrap-custom-element-plugin",
20008
+ configResolved(resolvedConfig) {
20009
+ config = resolvedConfig;
20010
+ },
20001
20011
  configureServer: async (server) => {
20002
20012
  server.middlewares.use(async (req, res, next) => {
20003
20013
  ok(req.url != null);
@@ -20056,16 +20066,26 @@ function viteWrapCustomElementPlugin({ getExtensions, srcDir }) {
20056
20066
  }
20057
20067
  const customElement = getExtensionForModuleId(baseId);
20058
20068
  if (customElement) {
20059
- const filePath = join(srcDir, customElement.options.element);
20069
+ const filePath = normalizePath$1(join(srcDir, customElement.options.element));
20070
+ ok(config);
20071
+ if (config.command === "build") return import_lib$1.outdent`
20072
+ import { wrapCustomElement } from '${wrapCustomElementPath}';
20073
+
20074
+ import('${filePath}').then(({ default: CustomElement }) => {
20075
+ wrapCustomElement({
20076
+ customElement: CustomElement,
20077
+ tagName: '${customElement.options.tagName}',
20078
+ });
20079
+ });
20080
+ `;
20060
20081
  return import_lib$1.outdent`
20061
- import CustomElement from '${normalizePath$1(filePath)}';
20062
20082
  import { wrapCustomElement } from '${wrapCustomElementPath}';
20063
20083
  import { customElementHmr } from '${customElementHmrPath}';
20064
20084
 
20065
20085
  if (import.meta.hot) {
20066
20086
  import.meta.hot.accept(() => {});
20067
20087
  import.meta.hot.accept(
20068
- '${normalizePath$1(filePath)}',
20088
+ '${filePath}',
20069
20089
  function({ default: NewCustomElement }) {
20070
20090
  customElementHmr({
20071
20091
  customElement: NewCustomElement,
@@ -20075,9 +20095,11 @@ function viteWrapCustomElementPlugin({ getExtensions, srcDir }) {
20075
20095
  );
20076
20096
  }
20077
20097
 
20078
- wrapCustomElement({
20079
- customElement: CustomElement,
20080
- tagName: '${customElement.options.tagName}',
20098
+ import('${filePath}').then(({ default: CustomElement }) => {
20099
+ wrapCustomElement({
20100
+ customElement: CustomElement,
20101
+ tagName: '${customElement.options.tagName}',
20102
+ });
20081
20103
  });
20082
20104
  `;
20083
20105
  }
@@ -27463,7 +27485,7 @@ const createIntegration$12 = () => {
27463
27485
 
27464
27486
  //#endregion
27465
27487
  //#region ../astro-function-libraries-extensions/src/utils/getSupportedExtensions.ts
27466
- function getSupportedExtensions$4({ extensions, srcDir }) {
27488
+ function getSupportedExtensions$3({ extensions, srcDir }) {
27467
27489
  return extensions.filter(filterFunctionLibrary).map((extension) => {
27468
27490
  return {
27469
27491
  ...extension,
@@ -27478,7 +27500,7 @@ function filterFunctionLibrary(extension) {
27478
27500
  //#endregion
27479
27501
  //#region ../astro-function-libraries-extensions/src/utils/getFunctionLibrary.ts
27480
27502
  function getFunctionLibrary(model, id) {
27481
- return getSupportedExtensions$4(model).find((ext) => ext.options.id === id);
27503
+ return getSupportedExtensions$3(model).find((ext) => ext.options.id === id);
27482
27504
  }
27483
27505
 
27484
27506
  //#endregion
@@ -27553,7 +27575,7 @@ function virtualModulesPlugin$3({ model }) {
27553
27575
  //#endregion
27554
27576
  //#region ../astro-function-libraries-extensions/src/vite/configs/build.ts
27555
27577
  function getBuildViteConfigs$2({ createExtensionViteConfig, model }) {
27556
- return getSupportedExtensions$4(model).reduce((acc, extension) => {
27578
+ return getSupportedExtensions$3(model).reduce((acc, extension) => {
27557
27579
  const { options: { id: extensionId } } = extension;
27558
27580
  const input = { [getEntryNameForClientComponent$1(extensionId)]: getVirtualModuleIdForClientComponent$1(extensionId) };
27559
27581
  acc.push(createExtensionViteConfig({
@@ -27620,7 +27642,7 @@ function getDevViteConfig$2({ createExtensionViteConfig, model }) {
27620
27642
  return createExtensionViteConfig({
27621
27643
  name: extensionName$2,
27622
27644
  config: {
27623
- optimizeDeps: { entries: [...getSupportedExtensions$4(model).map((ext) => [ext.componentPath]).flat(), sdkRuntimePath$3] },
27645
+ optimizeDeps: { entries: [...getSupportedExtensions$3(model).map((ext) => [ext.componentPath]).flat(), sdkRuntimePath$3] },
27624
27646
  plugins: [m({ externals: externalDeps$3 }), virtualModulesPlugin$3({ model })]
27625
27647
  }
27626
27648
  });
@@ -27653,7 +27675,7 @@ const createIntegration$11 = () => {
27653
27675
  },
27654
27676
  async "wix:build:setup"({ createExtensionViteConfig }) {
27655
27677
  ok(model);
27656
- if (getSupportedExtensions$4(model).length === 0) return;
27678
+ if (getSupportedExtensions$3(model).length === 0) return;
27657
27679
  customBuildOutput = await buildAll(getBuildViteConfigs$2({
27658
27680
  createExtensionViteConfig,
27659
27681
  model
@@ -27661,7 +27683,7 @@ const createIntegration$11 = () => {
27661
27683
  },
27662
27684
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
27663
27685
  ok(model);
27664
- const extensions = getSupportedExtensions$4(model);
27686
+ const extensions = getSupportedExtensions$3(model);
27665
27687
  const components = [];
27666
27688
  for (const extension of extensions) {
27667
27689
  const buildContext = {
@@ -27769,7 +27791,7 @@ var src_default$2 = createIntegration$7;
27769
27791
 
27770
27792
  //#endregion
27771
27793
  //#region ../astro-site-component-panels-extensions/src/utils/getSupportedExtensions.ts
27772
- function getSupportedExtensions$3({ extensions, srcDir }) {
27794
+ function getSupportedExtensions$2({ extensions, srcDir }) {
27773
27795
  return extensions.filter((extension) => extension.type === "SiteComponentPanel").map((extension) => ({
27774
27796
  ...extension,
27775
27797
  componentPath: join(srcDir, extension.options.component)
@@ -27794,7 +27816,7 @@ function siteComponentPanelPlugin({ model }) {
27794
27816
  load(id) {
27795
27817
  if (id.startsWith(componentVirtualModuleIdPrefix)) {
27796
27818
  const extensionId = id.slice(14);
27797
- const extension = getSupportedExtensions$3(model).find((ext) => ext.options.id === extensionId);
27819
+ const extension = getSupportedExtensions$2(model).find((ext) => ext.options.id === extensionId);
27798
27820
  if (extension) {
27799
27821
  ok(config);
27800
27822
  const componentPath = normalizePath$1(extension.componentPath);
@@ -27887,7 +27909,7 @@ function getResourcesDev({ baseUrl, devServer, extension }) {
27887
27909
  //#region ../astro-site-component-panels-extensions/src/vite/getConfig.ts
27888
27910
  const externalDeps$2 = [/^react$/, /^react-dom$/];
27889
27911
  function getViteConfig$1({ createExtensionViteConfig, model }) {
27890
- const extensions = getSupportedExtensions$3(model);
27912
+ const extensions = getSupportedExtensions$2(model);
27891
27913
  const input = extensions.map((extension) => [`component-panel-${extension.options.id}`, getVirtualModuleIdForComponent(extension.options.id)]);
27892
27914
  return createExtensionViteConfig({
27893
27915
  name: "site-component-panels",
@@ -27935,7 +27957,7 @@ const createIntegration$6 = () => {
27935
27957
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
27936
27958
  if (target === "server") return;
27937
27959
  ok(model);
27938
- if (getSupportedExtensions$3(model).length === 0) return;
27960
+ if (getSupportedExtensions$2(model).length === 0) return;
27939
27961
  buildOutput = await build$1(getViteConfig$1({
27940
27962
  createExtensionViteConfig,
27941
27963
  model
@@ -27943,7 +27965,7 @@ const createIntegration$6 = () => {
27943
27965
  },
27944
27966
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
27945
27967
  ok(model);
27946
- const extensions = getSupportedExtensions$3(model);
27968
+ const extensions = getSupportedExtensions$2(model);
27947
27969
  const components = [];
27948
27970
  for (const extension of extensions) {
27949
27971
  const resources = getResources$1({
@@ -27988,7 +28010,7 @@ const hmrRuntimePath$1 = normalizePath$1(new URL("../dependencies/astro-site-com
27988
28010
 
27989
28011
  //#endregion
27990
28012
  //#region ../astro-site-components-extensions/src/utils/getSupportedExtensions.ts
27991
- function getSupportedExtensions$2({ extensions, srcDir }) {
28013
+ function getSupportedExtensions$1({ extensions, srcDir }) {
27992
28014
  return extensions.filter(filterSiteComponents).map((extension) => {
27993
28015
  const componentPresets = Object.entries(extension.options.editorElement.presets ?? {}).map(([name, config]) => ({
27994
28016
  name,
@@ -28012,7 +28034,7 @@ function filterSiteComponents(extension) {
28012
28034
  //#endregion
28013
28035
  //#region ../astro-site-components-extensions/src/utils/getSiteComponent.ts
28014
28036
  function getSiteComponent(model, id) {
28015
- return getSupportedExtensions$2(model).find((ext) => ext.options.id === id);
28037
+ return getSupportedExtensions$1(model).find((ext) => ext.options.id === id);
28016
28038
  }
28017
28039
 
28018
28040
  //#endregion
@@ -28411,7 +28433,7 @@ function getResources(buildContext) {
28411
28433
  //#endregion
28412
28434
  //#region ../astro-site-components-extensions/src/vite/configs/build.ts
28413
28435
  function getBuildViteConfigs$1({ createExtensionViteConfig, model }) {
28414
- return getSupportedExtensions$2(model).reduce((acc, extension) => {
28436
+ return getSupportedExtensions$1(model).reduce((acc, extension) => {
28415
28437
  const { editorPreviewPath, sdkPath } = extension;
28416
28438
  acc.push(getClientBuildConfig$1({
28417
28439
  createExtensionViteConfig,
@@ -28439,12 +28461,12 @@ function getBuildViteConfigs$1({ createExtensionViteConfig, model }) {
28439
28461
  //#endregion
28440
28462
  //#region ../astro-site-components-extensions/src/vite/configs/dev.ts
28441
28463
  function getDevViteConfig$1({ createExtensionViteConfig, model }) {
28442
- const extensionEntries = getSupportedExtensions$2(model).map((ext) => [
28464
+ const extensionEntries = getSupportedExtensions$1(model).map((ext) => [
28443
28465
  ext.componentPath,
28444
28466
  ...ext.sdkPath != null ? [ext.sdkPath] : [],
28445
28467
  ...ext.editorPreviewPath != null ? [ext.editorPreviewPath] : []
28446
28468
  ]).flat();
28447
- const componentExternals = getSupportedExtensions$2(model).map((ext) => [...ext.externals]).flat();
28469
+ const componentExternals = getSupportedExtensions$1(model).map((ext) => [...ext.externals]).flat();
28448
28470
  return createExtensionViteConfig({
28449
28471
  name: extensionName$1,
28450
28472
  config: {
@@ -28486,7 +28508,7 @@ const createIntegration$5 = () => {
28486
28508
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
28487
28509
  if (target === "server") return;
28488
28510
  ok(model);
28489
- if (getSupportedExtensions$2(model).length === 0) return;
28511
+ if (getSupportedExtensions$1(model).length === 0) return;
28490
28512
  customBuildOutput = await buildAll(getBuildViteConfigs$1({
28491
28513
  createExtensionViteConfig,
28492
28514
  model
@@ -28494,7 +28516,7 @@ const createIntegration$5 = () => {
28494
28516
  },
28495
28517
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
28496
28518
  ok(model);
28497
- const extensions = getSupportedExtensions$2(model);
28519
+ const extensions = getSupportedExtensions$1(model);
28498
28520
  const components = [];
28499
28521
  for (const extension of extensions) {
28500
28522
  const buildContext = {
@@ -28660,31 +28682,37 @@ function getAssetUrl({ baseUrl, buildOutput, fileName, viteDevServer }) {
28660
28682
  }
28661
28683
 
28662
28684
  //#endregion
28663
- //#region ../astro-trusted-backoffice-extensions/src/utils/getSupportedExtensions.ts
28664
- function getSupportedExtensions$1(model) {
28665
- return model.extensions.filter(isSupportedExtensions);
28685
+ //#region ../astro-trusted-backoffice-extensions/src/utils/getSupportedBundlers.ts
28686
+ function getSupportedBundlers(model) {
28687
+ return model.extensions.filter((extension) => extension.type === "GenericExtension").flatMap((extension) => getSupportedBundlersInExtension(extension).map((bundler) => ({
28688
+ bundler,
28689
+ extension
28690
+ })));
28666
28691
  }
28667
- function isSupportedExtensions(extension) {
28668
- return extension.type === "TrustedBackofficePage" || extension.type === "TrustedBackofficeWidget";
28692
+ function getSupportedBundlersInExtension(extension) {
28693
+ return deepFind(extension.options, (value) => {
28694
+ if ("type" in value && value.type === TrustedBackofficeComponentBundlerType) return value;
28695
+ return false;
28696
+ });
28669
28697
  }
28670
28698
 
28671
28699
  //#endregion
28672
- //#region ../astro-trusted-backoffice-extensions/src/utils/getTrustedBackofficeComponent.ts
28673
- function getTrustedBackofficeComponent(model, id) {
28674
- return getSupportedExtensions$1(model).find((ext) => ext.options.id === id);
28700
+ //#region ../astro-trusted-backoffice-extensions/src/utils/getTrustedBackofficeBundler.ts
28701
+ function getTrustedBackofficeBundler(model, id) {
28702
+ return getSupportedBundlers(model).find(({ bundler }) => bundler.id === id);
28675
28703
  }
28676
28704
 
28677
28705
  //#endregion
28678
28706
  //#region ../astro-trusted-backoffice-extensions/src/vite/registerComponentWrapperVirtualRoute.ts
28679
28707
  const hmrRuntimePath = normalizePath$1(new URL("../dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.js", import.meta.url));
28680
- function getVirtualModuleIdForComponentWrapper(componentId) {
28681
- return `wix/component/backoffice/wrappers/${componentId}`;
28708
+ function getVirtualModuleIdForComponentWrapper(id) {
28709
+ return `wix/component/backoffice/wrappers/${id}`;
28682
28710
  }
28683
28711
  function registerComponentWrapperVirtualRoute({ model, router }) {
28684
28712
  router.route(getVirtualModuleIdForComponentWrapper(":id"), ({ id }, { command }) => {
28685
- const extension = getTrustedBackofficeComponent(model, id);
28686
- if (extension) {
28687
- const componentPath = normalizePath$1(join(model.srcDir, extension.options.component));
28713
+ const extensionBundler = getTrustedBackofficeBundler(model, id);
28714
+ if (extensionBundler) {
28715
+ const componentPath = normalizePath$1(join(model.srcDir, extensionBundler.bundler.options.component));
28688
28716
  if (command === "build") return getComponentBuildTemplate$1({ componentPath });
28689
28717
  return getComponentServeTemplate$1({ componentPath });
28690
28718
  }
@@ -28720,42 +28748,42 @@ function getComponentServeTemplate$1({ componentPath }) {
28720
28748
  //#endregion
28721
28749
  //#region ../astro-trusted-backoffice-extensions/src/vite/registerComponentEntryVirtualRoute.ts
28722
28750
  const wrapComponentRuntimePath = normalizePath$1(new URL("../dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.js", import.meta.url));
28723
- function getVirtualModuleIdForComponentEntry(componentId) {
28724
- return `wix/component/backoffice/entries/${componentId}`;
28751
+ function getVirtualModuleIdForComponentEntry(id) {
28752
+ return `wix/component/backoffice/entries/${id}`;
28725
28753
  }
28726
28754
  function registerComponentEntryVirtualRoute({ model, router }) {
28727
28755
  router.route(getVirtualModuleIdForComponentEntry(":id"), ({ id }, { command }) => {
28728
- const extension = getTrustedBackofficeComponent(model, id);
28729
- if (extension) {
28730
- const componentPath = getVirtualModuleIdForComponentWrapper(extension.options.id);
28756
+ const extensionBundler = getTrustedBackofficeBundler(model, id);
28757
+ if (extensionBundler) {
28758
+ const componentPath = getVirtualModuleIdForComponentWrapper(extensionBundler.bundler.id);
28731
28759
  if (command === "build") return getComponentBuildTemplate({
28732
- componentId: extension.options.id,
28760
+ id: extensionBundler.bundler.id,
28733
28761
  componentPath
28734
28762
  });
28735
28763
  return getComponentServeTemplate({
28736
- componentId: extension.options.id,
28764
+ id: extensionBundler.bundler.id,
28737
28765
  componentPath
28738
28766
  });
28739
28767
  }
28740
28768
  return null;
28741
28769
  });
28742
28770
  }
28743
- function getComponentBuildTemplate({ componentId, componentPath }) {
28771
+ function getComponentBuildTemplate({ id, componentPath }) {
28744
28772
  return import_lib$1.outdent`
28745
28773
  import { wrapComponent } from '${wrapComponentRuntimePath}'
28746
28774
 
28747
28775
  wrapComponent({
28748
- componentId: '${componentId}',
28776
+ bundlerId: '${id}',
28749
28777
  loadComponent: () => import('${componentPath}'),
28750
28778
  });
28751
28779
  `;
28752
28780
  }
28753
- function getComponentServeTemplate({ componentId, componentPath }) {
28781
+ function getComponentServeTemplate({ id, componentPath }) {
28754
28782
  return import_lib$1.outdent`
28755
28783
  import { wrapComponent } from '${wrapComponentRuntimePath}'
28756
28784
 
28757
28785
  wrapComponent({
28758
- componentId: '${componentId}',
28786
+ bundlerId: '${id}',
28759
28787
  loadComponent: () => import('${componentPath}'),
28760
28788
  });
28761
28789
  `;
@@ -28782,15 +28810,11 @@ function virtualModulesPlugin$1({ model }) {
28782
28810
  //#endregion
28783
28811
  //#region ../astro-trusted-backoffice-extensions/src/vite/getViteConfig.ts
28784
28812
  function getViteConfig({ createExtensionViteConfig, model }) {
28785
- const componentEntries = getSupportedExtensions$1(model).map((x) => getVirtualModuleIdForComponentEntry(x.options.id));
28813
+ const componentEntries = getSupportedBundlers(model).map(({ bundler }) => getVirtualModuleIdForComponentEntry(bundler.id));
28786
28814
  return createExtensionViteConfig({
28787
28815
  name: "trusted-backoffice",
28788
28816
  config: {
28789
28817
  build: { rollupOptions: { input: componentEntries } },
28790
- experimental: { renderBuiltUrl(filename, { hostId, hostType }) {
28791
- if (hostType !== "js") return { relative: true };
28792
- return { runtime: `import.meta.url.replace("${hostId}", "${filename}")` };
28793
- } },
28794
28818
  optimizeDeps: { entries: [
28795
28819
  wrapComponentRuntimePath,
28796
28820
  hmrRuntimePath,
@@ -28832,58 +28856,31 @@ const createIntegration$3 = () => {
28832
28856
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
28833
28857
  if (target === "server") return;
28834
28858
  ok(model);
28835
- if (getSupportedExtensions$1(model).length === 0) return;
28859
+ if (getSupportedBundlers(model).length === 0) return;
28836
28860
  customBuildOutput = await build$1(getViteConfig({
28837
28861
  createExtensionViteConfig,
28838
28862
  model
28839
28863
  }));
28840
28864
  },
28841
- async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
28865
+ async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifestComponent }) {
28842
28866
  ok(model);
28843
- const components = [];
28844
- for (const extension of getSupportedExtensions$1(model)) {
28845
- const virtualModuleId = getVirtualModuleIdForComponentEntry(extension.options.id);
28846
- const scriptAsset = {
28867
+ const bundlerExtensions = getSupportedBundlers(model);
28868
+ for (const { bundler, extension } of bundlerExtensions) await updateAppManifestComponent(extension.options.compId, (current) => {
28869
+ ok(model);
28870
+ const virtualModuleId = getVirtualModuleIdForComponentEntry(bundler.id);
28871
+ const url = getAssetUrl({
28872
+ baseUrl: staticsUrlPlaceholder,
28873
+ buildOutput: customBuildOutput,
28874
+ fileName: virtualModuleId,
28875
+ viteDevServer: customDevServer
28876
+ });
28877
+ return deepReplace(current, bundler, {
28847
28878
  containerId: model.appId,
28848
- exportedName: extension.options.id,
28879
+ exportedName: bundler.id,
28849
28880
  scriptType: "MODULE",
28850
- url: getAssetUrl({
28851
- baseUrl: staticsUrlPlaceholder,
28852
- buildOutput: customBuildOutput,
28853
- fileName: virtualModuleId,
28854
- viteDevServer: customDevServer
28855
- })
28856
- };
28857
- switch (extension.type) {
28858
- case "TrustedBackofficePage": {
28859
- const { id, ...pageOptions } = extension.options;
28860
- components.push({
28861
- compId: id,
28862
- compType: "BACK_OFFICE_PAGE",
28863
- compData: { backOfficePage: {
28864
- hostingPlatform: "BUSINESS_MANAGER",
28865
- scriptAsset,
28866
- ...pageOptions
28867
- } }
28868
- });
28869
- break;
28870
- }
28871
- case "TrustedBackofficeWidget": {
28872
- const { id, ...widgetOptions } = extension.options;
28873
- components.push({
28874
- compId: id,
28875
- compType: "BACK_OFFICE_WIDGET",
28876
- compData: { backOfficeWidget: {
28877
- hostingPlatform: "BUSINESS_MANAGER",
28878
- scriptAsset,
28879
- ...widgetOptions
28880
- } }
28881
- });
28882
- break;
28883
- }
28884
- }
28885
- }
28886
- updateAppManifest({ components });
28881
+ url
28882
+ });
28883
+ });
28887
28884
  }
28888
28885
  }
28889
28886
  };
@@ -0,0 +1,17 @@
1
+ import { createHash } from "node:crypto";
2
+
3
+ //#region ../astro-trusted-backoffice-extensions/src/bundlers/trusted-backoffice-component.ts
4
+ const TrustedBackofficeComponentBundlerType = Symbol.for("@wix/astro-trusted-backoffice-extensions:TrustedBackofficeComponentBundler");
5
+ function trustedBackofficeComponentBundler(options) {
6
+ return {
7
+ id: createHash("sha256").update(JSON.stringify({
8
+ type: "TrustedBackofficeComponentBundler",
9
+ options
10
+ })).digest("hex"),
11
+ type: TrustedBackofficeComponentBundlerType,
12
+ options
13
+ };
14
+ }
15
+
16
+ //#endregion
17
+ export { trustedBackofficeComponentBundler as n, TrustedBackofficeComponentBundlerType as t };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "2.29.0",
3
+ "version": "2.31.0",
4
4
  "dependencies": {
5
5
  "@wix/auth-management": "^1.0.71",
6
- "@wix/dashboard": "^1.3.40",
6
+ "@wix/dashboard": "^1.3.43",
7
7
  "@wix/editor": "^1.403.0",
8
8
  "@wix/essentials": "^1.0.4",
9
9
  "@wix/headless-localization-utils": "^1.0.13",
@@ -11,7 +11,7 @@
11
11
  "@wix/headless-site": "^1.31.0",
12
12
  "@wix/headless-site-assets": "^1.0.9",
13
13
  "@wix/multilingual-manager": "^1.5.0",
14
- "@wix/sdk": "^1.21.2",
14
+ "@wix/sdk": "^1.21.3",
15
15
  "@wix/sdk-runtime": "^1.0.0",
16
16
  "@wix/sdk-types": "^1.17.1",
17
17
  "@wix/site": "^1.40.0"
@@ -76,5 +76,5 @@
76
76
  ]
77
77
  }
78
78
  },
79
- "falconPackageHash": "9f3d2e4b6d1c68ecb1d9834e46a8e75094089ba89b9ca0316d1bbdfc"
79
+ "falconPackageHash": "f6a1a481f80f85fc53e92179d02dd2fd56d2af7f69a8ef2157e78591"
80
80
  }