@wix/astro 2.20.0 → 2.22.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.
Files changed (30) hide show
  1. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.d.ts +1 -0
  2. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.js +26 -0
  3. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.d.ts +10 -0
  4. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.js +37 -0
  5. package/build/dependencies/astro-trusted-backoffice-extensions/types/index.d.ts +24 -0
  6. package/build/integration/builders-experimental.d.ts +1 -1
  7. package/build/integration/builders-experimental.js +2 -2
  8. package/build/integration/builders-trusted.d.ts +41 -0
  9. package/build/integration/builders-trusted.js +48 -0
  10. package/build/integration/builders-trusted.js.map +1 -0
  11. package/build/integration/builders.d.ts +12 -205
  12. package/build/integration/builders.js +5 -3
  13. package/build/integration/{chunk-WK4OVFTZ.js → chunk-2K4KOKVV.js} +10 -1
  14. package/build/integration/chunk-2K4KOKVV.js.map +1 -0
  15. package/build/integration/chunk-2K65FTYR.js +362 -0
  16. package/build/integration/chunk-2K65FTYR.js.map +1 -0
  17. package/build/integration/{chunk-ZOHC6VQD.js → chunk-C2WQBOJF.js} +5010 -11990
  18. package/build/integration/chunk-C2WQBOJF.js.map +1 -0
  19. package/build/integration/{chunk-QHGDEGZS.js → chunk-KH7M6QFM.js} +2 -2
  20. package/build/integration/chunk-LKZKWQSB.js +7032 -0
  21. package/build/integration/chunk-LKZKWQSB.js.map +1 -0
  22. package/build/integration/{index.d-DMz9m26S.d.ts → index.d-D4c48TR0.d.ts} +1 -1
  23. package/build/integration/index.d-DVHQaDA6.d.ts +197 -0
  24. package/build/integration/index.d.ts +2 -1
  25. package/build/integration/index.js +28 -23
  26. package/build/integration/index.js.map +1 -1
  27. package/package.json +9 -7
  28. package/build/integration/chunk-WK4OVFTZ.js.map +0 -1
  29. package/build/integration/chunk-ZOHC6VQD.js.map +0 -1
  30. /package/build/integration/{chunk-QHGDEGZS.js.map → chunk-KH7M6QFM.js.map} +0 -0
@@ -0,0 +1 @@
1
+ export * from '@wix/astro-browser-runtime/hmr/react-component';
@@ -0,0 +1,26 @@
1
+ // ../astro-browser-runtime/src/hmr/react-component.tsx
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ function createComponentHmrWrapper(OriginalComponent, hotData) {
4
+ return (props) => {
5
+ const [WrappedComponent, setComponent] = useState(
6
+ () => hotData.Component ?? OriginalComponent
7
+ );
8
+ const isMountedRef = useRef(false);
9
+ useEffect(() => {
10
+ isMountedRef.current = true;
11
+ hotData.setComponent = (NewComponent) => {
12
+ hotData.Component = NewComponent;
13
+ if (isMountedRef.current) {
14
+ setComponent(() => NewComponent);
15
+ }
16
+ };
17
+ return () => {
18
+ isMountedRef.current = false;
19
+ };
20
+ }, []);
21
+ return /* @__PURE__ */ React.createElement(WrappedComponent, { ...props });
22
+ };
23
+ }
24
+ export {
25
+ createComponentHmrWrapper
26
+ };
@@ -0,0 +1,10 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ declare function wrapComponent({ componentId, loadComponent, }: {
4
+ componentId: string;
5
+ loadComponent: () => Promise<{
6
+ default: ComponentType;
7
+ }>;
8
+ }): void;
9
+
10
+ export { wrapComponent };
@@ -0,0 +1,37 @@
1
+ // src/runtime/wrapComponent.ts
2
+ import { withContextualWixClient } from "@wix/dashboard/internal";
3
+ var WIX_CLIENT_ID = import.meta.env.WIX_CLIENT_ID;
4
+ var components = /* @__PURE__ */ new Map();
5
+ function wrapComponent({
6
+ componentId,
7
+ loadComponent
8
+ }) {
9
+ components.set(componentId, async () => {
10
+ return loadComponent().then(
11
+ ({ default: Component }) => withContextualWixClient(Component)
12
+ );
13
+ });
14
+ globalThis.__module_federation__containers ??= {};
15
+ globalThis.__module_federation__containers[WIX_CLIENT_ID] ??= {
16
+ get: async (id) => {
17
+ const loadModule = components.get(id);
18
+ if (loadModule == null) {
19
+ throw new Error(`Cannot find component for \`${id}\``);
20
+ }
21
+ const component = await loadModule();
22
+ return () => {
23
+ return {
24
+ default: component
25
+ };
26
+ };
27
+ },
28
+ init: async () => {
29
+ if (import.meta.env.DEV) {
30
+ await import("/@vite/client");
31
+ }
32
+ }
33
+ };
34
+ }
35
+ export {
36
+ wrapComponent
37
+ };
@@ -0,0 +1,24 @@
1
+ import { WixIntegration } from '@wix/astro-core';
2
+
3
+ declare const createIntegration: () => WixIntegration;
4
+
5
+ interface TrustedBackofficePage {
6
+ type: 'TrustedBackofficePage';
7
+ options: Options;
8
+ }
9
+ interface Options {
10
+ id: string;
11
+ activeSidebarPageId?: string;
12
+ component: string;
13
+ fullPage?: boolean;
14
+ hideInSidebar?: boolean;
15
+ pageCategoryId?: string;
16
+ previousRoutePaths?: string[];
17
+ priority?: number;
18
+ requiredPermission?: string;
19
+ routePath: string;
20
+ title: string;
21
+ }
22
+ declare function trustedBackofficePage(options: Options): TrustedBackofficePage;
23
+
24
+ export { createIntegration as default, trustedBackofficePage };
@@ -1,4 +1,4 @@
1
- import { B as BaseExtension } from './index.d-DMz9m26S.js';
1
+ import { B as BaseExtension } from './index.d-D4c48TR0.js';
2
2
 
3
3
  interface ContextProvider extends BaseExtension {
4
4
  type: 'ContextProvider';
@@ -3,10 +3,10 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  contextProvider,
5
5
  functionLibrary
6
- } from "./chunk-QHGDEGZS.js";
6
+ } from "./chunk-KH7M6QFM.js";
7
7
  import {
8
8
  init_esm_shims
9
- } from "./chunk-WK4OVFTZ.js";
9
+ } from "./chunk-2K4KOKVV.js";
10
10
 
11
11
  // src/builders-experimental.ts
12
12
  init_esm_shims();
@@ -0,0 +1,41 @@
1
+ import { c as customElement, e as ecomAdditionalFees, a as ecomDiscountTriggers, b as ecomGiftCards, d as ecomPaymentSettings, f as ecomShippingRates, g as ecomValidations, h as embeddedScript, w as webhook, s as siteComponent, i as siteComponentPanel, j as sitePlugin } from './index.d-DVHQaDA6.js';
2
+ import { g as genericExtension } from './index.d-D4c48TR0.js';
3
+ export { a as app } from './index.d-D4c48TR0.js';
4
+
5
+ interface TrustedBackofficePage {
6
+ type: 'TrustedBackofficePage';
7
+ options: Options;
8
+ }
9
+ interface Options {
10
+ id: string;
11
+ activeSidebarPageId?: string;
12
+ component: string;
13
+ fullPage?: boolean;
14
+ hideInSidebar?: boolean;
15
+ pageCategoryId?: string;
16
+ previousRoutePaths?: string[];
17
+ priority?: number;
18
+ requiredPermission?: string;
19
+ routePath: string;
20
+ title: string;
21
+ }
22
+ declare function trustedBackofficePage(options: Options): TrustedBackofficePage;
23
+
24
+ declare const extensions: {
25
+ customElement: typeof customElement;
26
+ dashboardPage: typeof trustedBackofficePage;
27
+ ecomAdditionalFees: typeof ecomAdditionalFees;
28
+ ecomDiscountTriggers: typeof ecomDiscountTriggers;
29
+ ecomGiftCards: typeof ecomGiftCards;
30
+ ecomPaymentSettings: typeof ecomPaymentSettings;
31
+ ecomShippingRates: typeof ecomShippingRates;
32
+ ecomValidations: typeof ecomValidations;
33
+ embeddedScript: typeof embeddedScript;
34
+ event: typeof webhook;
35
+ genericExtension: typeof genericExtension;
36
+ siteComponent: typeof siteComponent;
37
+ siteComponentPanel: typeof siteComponentPanel;
38
+ sitePlugin: typeof sitePlugin;
39
+ };
40
+
41
+ export { extensions };
@@ -0,0 +1,48 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import {
4
+ trustedBackofficePage
5
+ } from "./chunk-2K65FTYR.js";
6
+ import {
7
+ app,
8
+ customElement,
9
+ ecomAdditionalFees,
10
+ ecomDiscountTriggers,
11
+ ecomGiftCards,
12
+ ecomPaymentSettings,
13
+ ecomShippingRates,
14
+ ecomValidations,
15
+ embeddedScript,
16
+ genericExtension,
17
+ siteComponent,
18
+ siteComponentPanel,
19
+ sitePlugin,
20
+ webhook
21
+ } from "./chunk-C2WQBOJF.js";
22
+ import {
23
+ init_esm_shims
24
+ } from "./chunk-2K4KOKVV.js";
25
+
26
+ // src/builders-trusted.ts
27
+ init_esm_shims();
28
+ var extensions = {
29
+ customElement,
30
+ dashboardPage: trustedBackofficePage,
31
+ ecomAdditionalFees,
32
+ ecomDiscountTriggers,
33
+ ecomGiftCards,
34
+ ecomPaymentSettings,
35
+ ecomShippingRates,
36
+ ecomValidations,
37
+ embeddedScript,
38
+ event: webhook,
39
+ genericExtension,
40
+ siteComponent,
41
+ siteComponentPanel,
42
+ sitePlugin
43
+ };
44
+ export {
45
+ app,
46
+ extensions
47
+ };
48
+ //# sourceMappingURL=builders-trusted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/builders-trusted.ts"],"sourcesContent":["import {\n ecomAdditionalFees,\n ecomDiscountTriggers,\n ecomGiftCards,\n ecomPaymentSettings,\n ecomShippingRates,\n ecomValidations,\n webhook as event,\n} from '@wix/astro-backend-extensions';\nimport { genericExtension } from '@wix/astro-core';\nimport {\n customElement,\n sitePlugin,\n} from '@wix/astro-custom-elements-extensions';\nimport { embeddedScript } from '@wix/astro-embedded-scripts-extensions';\nimport { siteComponentPanel } from '@wix/astro-site-component-panels-extensions';\nimport { siteComponent } from '@wix/astro-site-components-extensions';\nimport { trustedBackofficePage as dashboardPage } from '@wix/astro-trusted-backoffice-extensions';\n\nexport { app } from '@wix/astro-core';\n\nexport const extensions = {\n customElement,\n dashboardPage,\n ecomAdditionalFees,\n ecomDiscountTriggers,\n ecomGiftCards,\n ecomPaymentSettings,\n ecomShippingRates,\n ecomValidations,\n embeddedScript,\n event,\n genericExtension,\n siteComponent,\n siteComponentPanel,\n sitePlugin,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAqBO,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,88 +1,6 @@
1
- import { D as DevCenterCustomElementBehaviors, a as DevCenterCustomElementSize, b as DevCenterCustomElementPresets, c as DevCenterSitePluginMarketData, d as DevCenterSitePluginPlacements, B as BaseExtension, g as genericExtension } from './index.d-DMz9m26S.js';
2
- export { e as app } from './index.d-DMz9m26S.js';
3
-
4
- interface EcomAdditionalFees {
5
- type: 'EcomAdditionalFees';
6
- options: Options$6;
7
- }
8
- interface Options$6 {
9
- id: string;
10
- name: string;
11
- source: string;
12
- }
13
- declare function ecomAdditionalFees(options: Options$6): EcomAdditionalFees;
14
-
15
- interface EcomDiscountsTrigger {
16
- type: 'EcomDiscountsTrigger';
17
- options: Options$5;
18
- }
19
- interface Options$5 {
20
- id: string;
21
- name: string;
22
- source: string;
23
- }
24
- declare function ecomDiscountTriggers(options: Options$5): EcomDiscountsTrigger;
25
-
26
- interface EcomGiftCardsProvider {
27
- type: 'EcomGiftCardsProvider';
28
- options: Options$4$1;
29
- }
30
- interface Options$4$1 {
31
- id: string;
32
- name: string;
33
- source: string;
34
- }
35
- declare function ecomGiftCards(options: Options$4$1): EcomGiftCardsProvider;
36
-
37
- interface EcomPaymentSettings {
38
- type: 'EcomPaymentSettings';
39
- options: Options$3$1;
40
- }
41
- interface Options$3$1 {
42
- id: string;
43
- name: string;
44
- fallbackValueForRequires3dSecure?: boolean;
45
- source: string;
46
- }
47
- declare function ecomPaymentSettings(options: Options$3$1): EcomPaymentSettings;
48
-
49
- interface EcomShippingRates {
50
- type: 'EcomShippingRates';
51
- options: Options$2$2;
52
- }
53
- interface Options$2$2 {
54
- id: string;
55
- name: string;
56
- dashboardUrl?: string;
57
- description?: string;
58
- fallbackDefinitionMandatory?: boolean;
59
- learnMoreUrl?: string;
60
- source: string;
61
- thumbnailUrl?: string;
62
- }
63
- declare function ecomShippingRates(options: Options$2$2): EcomShippingRates;
64
-
65
- interface EcomValidations {
66
- type: 'EcomValidations';
67
- options: Options$1$3;
68
- }
69
- interface Options$1$3 {
70
- id: string;
71
- name: string;
72
- source: string;
73
- validateInCart?: boolean;
74
- }
75
- declare function ecomValidations(options: Options$1$3): EcomValidations;
76
-
77
- interface Webhook {
78
- type: 'Webhook';
79
- options: Options$7;
80
- }
81
- interface Options$7 {
82
- id: string;
83
- source: string;
84
- }
85
- declare function webhook(options: Options$7): Webhook;
1
+ import { c as customElement, e as ecomAdditionalFees, a as ecomDiscountTriggers, b as ecomGiftCards, d as ecomPaymentSettings, f as ecomShippingRates, g as ecomValidations, h as embeddedScript, w as webhook, s as siteComponent, i as siteComponentPanel, j as sitePlugin } from './index.d-DVHQaDA6.js';
2
+ import { g as genericExtension } from './index.d-D4c48TR0.js';
3
+ export { a as app } from './index.d-D4c48TR0.js';
86
4
 
87
5
  interface BackofficeExtensionMenuPlugin {
88
6
  type: 'BackofficeExtensionMenuPlugin';
@@ -109,9 +27,9 @@ declare function backofficeExtensionMenuPlugin(options: Options$3): BackofficeEx
109
27
 
110
28
  interface BackofficeExtensionWidget {
111
29
  type: 'BackofficeExtensionWidget';
112
- options: Options$2$1;
30
+ options: Options$2;
113
31
  }
114
- interface Options$2$1 {
32
+ interface Options$2 {
115
33
  id: string;
116
34
  component: string;
117
35
  description?: string;
@@ -119,13 +37,13 @@ interface Options$2$1 {
119
37
  height?: number;
120
38
  title: string;
121
39
  }
122
- declare function backofficeExtensionWidget(options: Options$2$1): BackofficeExtensionWidget;
40
+ declare function backofficeExtensionWidget(options: Options$2): BackofficeExtensionWidget;
123
41
 
124
42
  interface BackofficeModal {
125
43
  type: 'BackofficeModal';
126
- options: Options$1$2;
44
+ options: Options$1;
127
45
  }
128
- interface Options$1$2 {
46
+ interface Options$1 {
129
47
  id: string;
130
48
  component: string;
131
49
  height?: number;
@@ -133,130 +51,19 @@ interface Options$1$2 {
133
51
  title: string;
134
52
  width?: number;
135
53
  }
136
- declare function backofficeModal(options: Options$1$2): BackofficeModal;
54
+ declare function backofficeModal(options: Options$1): BackofficeModal;
137
55
 
138
56
  interface BackofficePage {
139
57
  type: 'BackofficePage';
140
- options: Options$4;
58
+ options: Options;
141
59
  }
142
- interface Options$4 {
60
+ interface Options {
143
61
  id: string;
144
62
  component: string;
145
63
  routePath: string;
146
64
  title: string;
147
65
  }
148
- declare function backofficePage(options: Options$4): BackofficePage;
149
-
150
- interface CustomElement {
151
- type: 'CustomElement';
152
- options: Options$1$1;
153
- }
154
- interface Options$1$1 {
155
- id: string;
156
- name: string;
157
- behaviors?: DevCenterCustomElementBehaviors;
158
- element: string;
159
- height: DevCenterCustomElementSize['height'];
160
- installation: {
161
- autoAdd: boolean;
162
- essential?: boolean;
163
- };
164
- presets?: DevCenterCustomElementPresets;
165
- settings?: string;
166
- tagName: string;
167
- width: DevCenterCustomElementSize['width'];
168
- }
169
- declare function customElement(options: Options$1$1): CustomElement;
170
-
171
- interface SitePlugin extends BaseExtension {
172
- type: 'SitePlugin';
173
- options: Options$2;
174
- }
175
- interface Options$2 {
176
- id: string;
177
- name: string;
178
- element: string;
179
- installation: {
180
- autoAdd: boolean;
181
- };
182
- marketData?: DevCenterSitePluginMarketData;
183
- placements: DevCenterSitePluginPlacements[];
184
- settings: string;
185
- tagName: string;
186
- }
187
- declare function sitePlugin(options: Options$2): SitePlugin;
188
-
189
- interface EmbeddedScript extends BaseExtension {
190
- type: 'EmbeddedScript';
191
- options: Options$1;
192
- }
193
- interface Options$1 {
194
- id: string;
195
- name: string;
196
- placement: 'BODY_END' | 'BODY_START' | 'HEAD';
197
- scriptType: 'ADVERTISING' | 'ANALYTICS' | 'ESSENTIAL' | 'FUNCTIONAL';
198
- source: string;
199
- }
200
- declare function embeddedScript(options: Options$1): EmbeddedScript;
201
-
202
- interface SiteComponentPanel extends BaseExtension {
203
- type: 'SiteComponentPanel';
204
- options: PanelOptions;
205
- }
206
- interface PanelOptions {
207
- id: string;
208
- component: string;
209
- displayName: string;
210
- referenceId?: string;
211
- size: {
212
- height: number;
213
- width: string;
214
- };
215
- }
216
- declare function siteComponentPanel(options: PanelOptions): SiteComponentPanel;
217
-
218
- interface PresetOptions {
219
- [key: string]: unknown;
220
- displayName: string;
221
- presetCssUrl: string;
222
- thumbnailUrl?: string;
223
- }
224
- interface SiteComponent extends BaseExtension {
225
- type: 'SiteComponent';
226
- options: Options;
227
- }
228
- interface Options {
229
- id: string;
230
- type: string;
231
- description: string;
232
- editorElement: {
233
- [key: string]: unknown;
234
- displayName: string;
235
- presets?: Record<string, PresetOptions>;
236
- selector: string;
237
- };
238
- resources: {
239
- [key: string]: unknown;
240
- client: {
241
- [key: string]: unknown;
242
- componentUrl: string;
243
- };
244
- dependencies?: {
245
- [key: string]: unknown;
246
- componentDependencies?: string[];
247
- contextDependencies?: string[];
248
- };
249
- editor?: {
250
- [key: string]: unknown;
251
- componentUrl: string;
252
- };
253
- sdk?: {
254
- [key: string]: unknown;
255
- url: string;
256
- };
257
- };
258
- }
259
- declare function siteComponent(options: Options): SiteComponent;
66
+ declare function backofficePage(options: Options): BackofficePage;
260
67
 
261
68
  declare const extensions: {
262
69
  customElement: typeof customElement;
@@ -1,10 +1,12 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  import {
4
- app,
5
4
  extensions
6
- } from "./chunk-ZOHC6VQD.js";
7
- import "./chunk-WK4OVFTZ.js";
5
+ } from "./chunk-LKZKWQSB.js";
6
+ import {
7
+ app
8
+ } from "./chunk-C2WQBOJF.js";
9
+ import "./chunk-2K4KOKVV.js";
8
10
  export {
9
11
  app,
10
12
  extensions
@@ -501,6 +501,14 @@ function getLocalDevServerUrl(server) {
501
501
  ok(devServerUrl != null);
502
502
  return devServerUrl;
503
503
  }
504
+ function getStyleUrlForFile({
505
+ baseUrl,
506
+ devServer,
507
+ filePath
508
+ }) {
509
+ const pathWithBase = join(devServer.config.base, "@fs", `${filePath}?direct`);
510
+ return appendToDevServerUrl(baseUrl, pathWithBase);
511
+ }
504
512
  async function loadFileWithVite(filename, server) {
505
513
  const module2 = await server.ssrLoadModule(filename).catch((error) => {
506
514
  if (error != null && typeof error === "object" && "code" in error && error.code === "ERR_LOAD_URL") {
@@ -1065,6 +1073,7 @@ export {
1065
1073
  getChunkForModuleId,
1066
1074
  getCssFileNameFromChunk,
1067
1075
  getLocalDevServerUrl,
1076
+ getStyleUrlForFile,
1068
1077
  loadFileWithVite,
1069
1078
  normalizePath,
1070
1079
  cloneDeep,
@@ -1075,4 +1084,4 @@ export {
1075
1084
  defaultOutdent,
1076
1085
  m
1077
1086
  };
1078
- //# sourceMappingURL=chunk-WK4OVFTZ.js.map
1087
+ //# sourceMappingURL=chunk-2K4KOKVV.js.map