@wix/astro 2.28.0 → 2.30.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.
@@ -3594,7 +3594,9 @@ const onRequest = async (context, next) => {
3594
3594
  if (accessToken != null) {
3595
3595
  const auth = AppStrategy({
3596
3596
  accessToken,
3597
- appId: WIX_CLIENT_ID
3597
+ appId: WIX_CLIENT_ID,
3598
+ appSecret: WIX_CLIENT_SECRET,
3599
+ publicKey: WIX_CLIENT_PUBLIC_KEY
3598
3600
  });
3599
3601
  const elevatedAuth = await auth.elevated();
3600
3602
  return authAsyncLocalStorage.run({
@@ -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,7 @@ 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
+ optimizeDeps: { include: ["@wix/sdk-context"] },
10511
10513
  publicDir: false,
10512
10514
  resolve: { dedupe: ["@wix/sdk-context"] },
10513
10515
  root: astroConfig.root,
@@ -27463,7 +27465,7 @@ const createIntegration$12 = () => {
27463
27465
 
27464
27466
  //#endregion
27465
27467
  //#region ../astro-function-libraries-extensions/src/utils/getSupportedExtensions.ts
27466
- function getSupportedExtensions$4({ extensions, srcDir }) {
27468
+ function getSupportedExtensions$3({ extensions, srcDir }) {
27467
27469
  return extensions.filter(filterFunctionLibrary).map((extension) => {
27468
27470
  return {
27469
27471
  ...extension,
@@ -27478,7 +27480,7 @@ function filterFunctionLibrary(extension) {
27478
27480
  //#endregion
27479
27481
  //#region ../astro-function-libraries-extensions/src/utils/getFunctionLibrary.ts
27480
27482
  function getFunctionLibrary(model, id) {
27481
- return getSupportedExtensions$4(model).find((ext) => ext.options.id === id);
27483
+ return getSupportedExtensions$3(model).find((ext) => ext.options.id === id);
27482
27484
  }
27483
27485
 
27484
27486
  //#endregion
@@ -27553,7 +27555,7 @@ function virtualModulesPlugin$3({ model }) {
27553
27555
  //#endregion
27554
27556
  //#region ../astro-function-libraries-extensions/src/vite/configs/build.ts
27555
27557
  function getBuildViteConfigs$2({ createExtensionViteConfig, model }) {
27556
- return getSupportedExtensions$4(model).reduce((acc, extension) => {
27558
+ return getSupportedExtensions$3(model).reduce((acc, extension) => {
27557
27559
  const { options: { id: extensionId } } = extension;
27558
27560
  const input = { [getEntryNameForClientComponent$1(extensionId)]: getVirtualModuleIdForClientComponent$1(extensionId) };
27559
27561
  acc.push(createExtensionViteConfig({
@@ -27620,7 +27622,7 @@ function getDevViteConfig$2({ createExtensionViteConfig, model }) {
27620
27622
  return createExtensionViteConfig({
27621
27623
  name: extensionName$2,
27622
27624
  config: {
27623
- optimizeDeps: { entries: [...getSupportedExtensions$4(model).map((ext) => [ext.componentPath]).flat(), sdkRuntimePath$3] },
27625
+ optimizeDeps: { entries: [...getSupportedExtensions$3(model).map((ext) => [ext.componentPath]).flat(), sdkRuntimePath$3] },
27624
27626
  plugins: [m({ externals: externalDeps$3 }), virtualModulesPlugin$3({ model })]
27625
27627
  }
27626
27628
  });
@@ -27653,7 +27655,7 @@ const createIntegration$11 = () => {
27653
27655
  },
27654
27656
  async "wix:build:setup"({ createExtensionViteConfig }) {
27655
27657
  ok(model);
27656
- if (getSupportedExtensions$4(model).length === 0) return;
27658
+ if (getSupportedExtensions$3(model).length === 0) return;
27657
27659
  customBuildOutput = await buildAll(getBuildViteConfigs$2({
27658
27660
  createExtensionViteConfig,
27659
27661
  model
@@ -27661,7 +27663,7 @@ const createIntegration$11 = () => {
27661
27663
  },
27662
27664
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
27663
27665
  ok(model);
27664
- const extensions = getSupportedExtensions$4(model);
27666
+ const extensions = getSupportedExtensions$3(model);
27665
27667
  const components = [];
27666
27668
  for (const extension of extensions) {
27667
27669
  const buildContext = {
@@ -27769,7 +27771,7 @@ var src_default$2 = createIntegration$7;
27769
27771
 
27770
27772
  //#endregion
27771
27773
  //#region ../astro-site-component-panels-extensions/src/utils/getSupportedExtensions.ts
27772
- function getSupportedExtensions$3({ extensions, srcDir }) {
27774
+ function getSupportedExtensions$2({ extensions, srcDir }) {
27773
27775
  return extensions.filter((extension) => extension.type === "SiteComponentPanel").map((extension) => ({
27774
27776
  ...extension,
27775
27777
  componentPath: join(srcDir, extension.options.component)
@@ -27794,7 +27796,7 @@ function siteComponentPanelPlugin({ model }) {
27794
27796
  load(id) {
27795
27797
  if (id.startsWith(componentVirtualModuleIdPrefix)) {
27796
27798
  const extensionId = id.slice(14);
27797
- const extension = getSupportedExtensions$3(model).find((ext) => ext.options.id === extensionId);
27799
+ const extension = getSupportedExtensions$2(model).find((ext) => ext.options.id === extensionId);
27798
27800
  if (extension) {
27799
27801
  ok(config);
27800
27802
  const componentPath = normalizePath$1(extension.componentPath);
@@ -27887,7 +27889,7 @@ function getResourcesDev({ baseUrl, devServer, extension }) {
27887
27889
  //#region ../astro-site-component-panels-extensions/src/vite/getConfig.ts
27888
27890
  const externalDeps$2 = [/^react$/, /^react-dom$/];
27889
27891
  function getViteConfig$1({ createExtensionViteConfig, model }) {
27890
- const extensions = getSupportedExtensions$3(model);
27892
+ const extensions = getSupportedExtensions$2(model);
27891
27893
  const input = extensions.map((extension) => [`component-panel-${extension.options.id}`, getVirtualModuleIdForComponent(extension.options.id)]);
27892
27894
  return createExtensionViteConfig({
27893
27895
  name: "site-component-panels",
@@ -27935,7 +27937,7 @@ const createIntegration$6 = () => {
27935
27937
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
27936
27938
  if (target === "server") return;
27937
27939
  ok(model);
27938
- if (getSupportedExtensions$3(model).length === 0) return;
27940
+ if (getSupportedExtensions$2(model).length === 0) return;
27939
27941
  buildOutput = await build$1(getViteConfig$1({
27940
27942
  createExtensionViteConfig,
27941
27943
  model
@@ -27943,7 +27945,7 @@ const createIntegration$6 = () => {
27943
27945
  },
27944
27946
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
27945
27947
  ok(model);
27946
- const extensions = getSupportedExtensions$3(model);
27948
+ const extensions = getSupportedExtensions$2(model);
27947
27949
  const components = [];
27948
27950
  for (const extension of extensions) {
27949
27951
  const resources = getResources$1({
@@ -27988,7 +27990,7 @@ const hmrRuntimePath$1 = normalizePath$1(new URL("../dependencies/astro-site-com
27988
27990
 
27989
27991
  //#endregion
27990
27992
  //#region ../astro-site-components-extensions/src/utils/getSupportedExtensions.ts
27991
- function getSupportedExtensions$2({ extensions, srcDir }) {
27993
+ function getSupportedExtensions$1({ extensions, srcDir }) {
27992
27994
  return extensions.filter(filterSiteComponents).map((extension) => {
27993
27995
  const componentPresets = Object.entries(extension.options.editorElement.presets ?? {}).map(([name, config]) => ({
27994
27996
  name,
@@ -28012,7 +28014,7 @@ function filterSiteComponents(extension) {
28012
28014
  //#endregion
28013
28015
  //#region ../astro-site-components-extensions/src/utils/getSiteComponent.ts
28014
28016
  function getSiteComponent(model, id) {
28015
- return getSupportedExtensions$2(model).find((ext) => ext.options.id === id);
28017
+ return getSupportedExtensions$1(model).find((ext) => ext.options.id === id);
28016
28018
  }
28017
28019
 
28018
28020
  //#endregion
@@ -28411,7 +28413,7 @@ function getResources(buildContext) {
28411
28413
  //#endregion
28412
28414
  //#region ../astro-site-components-extensions/src/vite/configs/build.ts
28413
28415
  function getBuildViteConfigs$1({ createExtensionViteConfig, model }) {
28414
- return getSupportedExtensions$2(model).reduce((acc, extension) => {
28416
+ return getSupportedExtensions$1(model).reduce((acc, extension) => {
28415
28417
  const { editorPreviewPath, sdkPath } = extension;
28416
28418
  acc.push(getClientBuildConfig$1({
28417
28419
  createExtensionViteConfig,
@@ -28439,12 +28441,12 @@ function getBuildViteConfigs$1({ createExtensionViteConfig, model }) {
28439
28441
  //#endregion
28440
28442
  //#region ../astro-site-components-extensions/src/vite/configs/dev.ts
28441
28443
  function getDevViteConfig$1({ createExtensionViteConfig, model }) {
28442
- const extensionEntries = getSupportedExtensions$2(model).map((ext) => [
28444
+ const extensionEntries = getSupportedExtensions$1(model).map((ext) => [
28443
28445
  ext.componentPath,
28444
28446
  ...ext.sdkPath != null ? [ext.sdkPath] : [],
28445
28447
  ...ext.editorPreviewPath != null ? [ext.editorPreviewPath] : []
28446
28448
  ]).flat();
28447
- const componentExternals = getSupportedExtensions$2(model).map((ext) => [...ext.externals]).flat();
28449
+ const componentExternals = getSupportedExtensions$1(model).map((ext) => [...ext.externals]).flat();
28448
28450
  return createExtensionViteConfig({
28449
28451
  name: extensionName$1,
28450
28452
  config: {
@@ -28486,7 +28488,7 @@ const createIntegration$5 = () => {
28486
28488
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
28487
28489
  if (target === "server") return;
28488
28490
  ok(model);
28489
- if (getSupportedExtensions$2(model).length === 0) return;
28491
+ if (getSupportedExtensions$1(model).length === 0) return;
28490
28492
  customBuildOutput = await buildAll(getBuildViteConfigs$1({
28491
28493
  createExtensionViteConfig,
28492
28494
  model
@@ -28494,7 +28496,7 @@ const createIntegration$5 = () => {
28494
28496
  },
28495
28497
  async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
28496
28498
  ok(model);
28497
- const extensions = getSupportedExtensions$2(model);
28499
+ const extensions = getSupportedExtensions$1(model);
28498
28500
  const components = [];
28499
28501
  for (const extension of extensions) {
28500
28502
  const buildContext = {
@@ -28660,31 +28662,37 @@ function getAssetUrl({ baseUrl, buildOutput, fileName, viteDevServer }) {
28660
28662
  }
28661
28663
 
28662
28664
  //#endregion
28663
- //#region ../astro-trusted-backoffice-extensions/src/utils/getSupportedExtensions.ts
28664
- function getSupportedExtensions$1(model) {
28665
- return model.extensions.filter(isSupportedExtensions);
28665
+ //#region ../astro-trusted-backoffice-extensions/src/utils/getSupportedBundlers.ts
28666
+ function getSupportedBundlers(model) {
28667
+ return model.extensions.filter((extension) => extension.type === "GenericExtension").flatMap((extension) => getSupportedBundlersInExtension(extension).map((bundler) => ({
28668
+ bundler,
28669
+ extension
28670
+ })));
28666
28671
  }
28667
- function isSupportedExtensions(extension) {
28668
- return extension.type === "TrustedBackofficePage" || extension.type === "TrustedBackofficeWidget";
28672
+ function getSupportedBundlersInExtension(extension) {
28673
+ return deepFind(extension.options, (value) => {
28674
+ if ("type" in value && value.type === TrustedBackofficeComponentBundlerType) return value;
28675
+ return false;
28676
+ });
28669
28677
  }
28670
28678
 
28671
28679
  //#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);
28680
+ //#region ../astro-trusted-backoffice-extensions/src/utils/getTrustedBackofficeBundler.ts
28681
+ function getTrustedBackofficeBundler(model, id) {
28682
+ return getSupportedBundlers(model).find(({ bundler }) => bundler.id === id);
28675
28683
  }
28676
28684
 
28677
28685
  //#endregion
28678
28686
  //#region ../astro-trusted-backoffice-extensions/src/vite/registerComponentWrapperVirtualRoute.ts
28679
28687
  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}`;
28688
+ function getVirtualModuleIdForComponentWrapper(id) {
28689
+ return `wix/component/backoffice/wrappers/${id}`;
28682
28690
  }
28683
28691
  function registerComponentWrapperVirtualRoute({ model, router }) {
28684
28692
  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));
28693
+ const extensionBundler = getTrustedBackofficeBundler(model, id);
28694
+ if (extensionBundler) {
28695
+ const componentPath = normalizePath$1(join(model.srcDir, extensionBundler.bundler.options.component));
28688
28696
  if (command === "build") return getComponentBuildTemplate$1({ componentPath });
28689
28697
  return getComponentServeTemplate$1({ componentPath });
28690
28698
  }
@@ -28720,42 +28728,42 @@ function getComponentServeTemplate$1({ componentPath }) {
28720
28728
  //#endregion
28721
28729
  //#region ../astro-trusted-backoffice-extensions/src/vite/registerComponentEntryVirtualRoute.ts
28722
28730
  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}`;
28731
+ function getVirtualModuleIdForComponentEntry(id) {
28732
+ return `wix/component/backoffice/entries/${id}`;
28725
28733
  }
28726
28734
  function registerComponentEntryVirtualRoute({ model, router }) {
28727
28735
  router.route(getVirtualModuleIdForComponentEntry(":id"), ({ id }, { command }) => {
28728
- const extension = getTrustedBackofficeComponent(model, id);
28729
- if (extension) {
28730
- const componentPath = getVirtualModuleIdForComponentWrapper(extension.options.id);
28736
+ const extensionBundler = getTrustedBackofficeBundler(model, id);
28737
+ if (extensionBundler) {
28738
+ const componentPath = getVirtualModuleIdForComponentWrapper(extensionBundler.bundler.id);
28731
28739
  if (command === "build") return getComponentBuildTemplate({
28732
- componentId: extension.options.id,
28740
+ id: extensionBundler.bundler.id,
28733
28741
  componentPath
28734
28742
  });
28735
28743
  return getComponentServeTemplate({
28736
- componentId: extension.options.id,
28744
+ id: extensionBundler.bundler.id,
28737
28745
  componentPath
28738
28746
  });
28739
28747
  }
28740
28748
  return null;
28741
28749
  });
28742
28750
  }
28743
- function getComponentBuildTemplate({ componentId, componentPath }) {
28751
+ function getComponentBuildTemplate({ id, componentPath }) {
28744
28752
  return import_lib$1.outdent`
28745
28753
  import { wrapComponent } from '${wrapComponentRuntimePath}'
28746
28754
 
28747
28755
  wrapComponent({
28748
- componentId: '${componentId}',
28756
+ bundlerId: '${id}',
28749
28757
  loadComponent: () => import('${componentPath}'),
28750
28758
  });
28751
28759
  `;
28752
28760
  }
28753
- function getComponentServeTemplate({ componentId, componentPath }) {
28761
+ function getComponentServeTemplate({ id, componentPath }) {
28754
28762
  return import_lib$1.outdent`
28755
28763
  import { wrapComponent } from '${wrapComponentRuntimePath}'
28756
28764
 
28757
28765
  wrapComponent({
28758
- componentId: '${componentId}',
28766
+ bundlerId: '${id}',
28759
28767
  loadComponent: () => import('${componentPath}'),
28760
28768
  });
28761
28769
  `;
@@ -28782,7 +28790,7 @@ function virtualModulesPlugin$1({ model }) {
28782
28790
  //#endregion
28783
28791
  //#region ../astro-trusted-backoffice-extensions/src/vite/getViteConfig.ts
28784
28792
  function getViteConfig({ createExtensionViteConfig, model }) {
28785
- const componentEntries = getSupportedExtensions$1(model).map((x) => getVirtualModuleIdForComponentEntry(x.options.id));
28793
+ const componentEntries = getSupportedBundlers(model).map(({ bundler }) => getVirtualModuleIdForComponentEntry(bundler.id));
28786
28794
  return createExtensionViteConfig({
28787
28795
  name: "trusted-backoffice",
28788
28796
  config: {
@@ -28832,58 +28840,31 @@ const createIntegration$3 = () => {
28832
28840
  async "wix:build:setup"({ createExtensionViteConfig, target }) {
28833
28841
  if (target === "server") return;
28834
28842
  ok(model);
28835
- if (getSupportedExtensions$1(model).length === 0) return;
28843
+ if (getSupportedBundlers(model).length === 0) return;
28836
28844
  customBuildOutput = await build$1(getViteConfig({
28837
28845
  createExtensionViteConfig,
28838
28846
  model
28839
28847
  }));
28840
28848
  },
28841
- async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifest }) {
28849
+ async "wix:app-manifest:setup"({ staticsUrlPlaceholder, updateAppManifestComponent }) {
28842
28850
  ok(model);
28843
- const components = [];
28844
- for (const extension of getSupportedExtensions$1(model)) {
28845
- const virtualModuleId = getVirtualModuleIdForComponentEntry(extension.options.id);
28846
- const scriptAsset = {
28851
+ const bundlerExtensions = getSupportedBundlers(model);
28852
+ for (const { bundler, extension } of bundlerExtensions) await updateAppManifestComponent(extension.options.compId, (current) => {
28853
+ ok(model);
28854
+ const virtualModuleId = getVirtualModuleIdForComponentEntry(bundler.id);
28855
+ const url = getAssetUrl({
28856
+ baseUrl: staticsUrlPlaceholder,
28857
+ buildOutput: customBuildOutput,
28858
+ fileName: virtualModuleId,
28859
+ viteDevServer: customDevServer
28860
+ });
28861
+ return deepReplace(current, bundler, {
28847
28862
  containerId: model.appId,
28848
- exportedName: extension.options.id,
28863
+ exportedName: bundler.id,
28849
28864
  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 });
28865
+ url
28866
+ });
28867
+ });
28887
28868
  }
28888
28869
  }
28889
28870
  };
@@ -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.28.0",
3
+ "version": "2.30.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": "ccd07d98e4909e07b9f500bde01444bc3f4e2274474eab1f4c6ef8ce"
79
+ "falconPackageHash": "2ce2adc6cddcbcccf5e25de56dd1821dec917dde84b58c5da0f72d41"
80
80
  }