@wix/astro 2.27.0 → 2.29.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 (177) hide show
  1. package/build/dependencies/astro-auth/backend-runtime/constants-Dbkf3D5f.mjs +6 -0
  2. package/build/dependencies/astro-auth/backend-runtime/elevatedContextualClient-tJx9dIn_.mjs +41 -0
  3. package/build/dependencies/astro-auth/backend-runtime/host-utils-B2Fs_Z4S.mjs +17 -0
  4. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.d.mts +6 -0
  5. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.mjs +3645 -0
  6. package/build/dependencies/astro-auth/backend-runtime/middleware/localization.d.mts +6 -0
  7. package/build/dependencies/astro-auth/backend-runtime/middleware/localization.mjs +193 -0
  8. package/build/dependencies/astro-auth/backend-runtime/routes/callback.d.mts +6 -0
  9. package/build/dependencies/astro-auth/backend-runtime/routes/callback.mjs +34 -0
  10. package/build/dependencies/astro-auth/backend-runtime/routes/login.d.mts +6 -0
  11. package/build/dependencies/astro-auth/backend-runtime/routes/login.mjs +32 -0
  12. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.d.mts +6 -0
  13. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.mjs +14 -0
  14. package/build/dependencies/astro-auth/backend-runtime/routes/logout.d.mts +6 -0
  15. package/build/dependencies/astro-auth/backend-runtime/routes/logout.mjs +19 -0
  16. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.d.mts +1 -0
  17. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.mjs +8 -0
  18. package/build/dependencies/astro-auth/backend-runtime/saveSessionTokensToCookie-DK3xvtzk.mjs +24 -0
  19. package/build/dependencies/astro-auth/backend-runtime/schemas-XrMhpOYn.mjs +2771 -0
  20. package/build/dependencies/astro-auth/browser-runtime/setup.d.ts +4 -3
  21. package/build/dependencies/astro-auth/browser-runtime/setup.js +55 -81
  22. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.d.mts +6 -0
  23. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.mjs +37 -0
  24. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.d.mts +10 -0
  25. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.mjs +22 -0
  26. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.d.mts +9 -0
  27. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.mjs +22 -0
  28. package/build/dependencies/astro-backend-extensions/backend-runtime/utils-DDHGZHjR.mjs +56 -0
  29. package/build/dependencies/astro-backend-extensions/backend-runtime/utils-mYlwmIjd.d.mts +6 -0
  30. package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.d.ts +4 -3
  31. package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.js +6 -5
  32. package/build/dependencies/astro-context-providers-extensions/browser-runtime/hmr.d.ts +10 -0
  33. package/build/dependencies/astro-context-providers-extensions/browser-runtime/hmr.js +20 -23
  34. package/build/dependencies/astro-context-providers-extensions/browser-runtime/sdk.d.ts +9 -0
  35. package/build/dependencies/astro-context-providers-extensions/browser-runtime/sdk.js +16 -15
  36. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.d.ts +9 -5
  37. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.js +23 -40
  38. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.d.ts +10 -1
  39. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.js +20 -23
  40. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.d.ts +4 -3
  41. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.js +14 -18
  42. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.d.ts +9 -5
  43. package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.js +23 -25
  44. package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.d.ts +8 -4
  45. package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.js +18 -17
  46. package/build/dependencies/astro-function-libraries-extensions/browser-runtime/sdk.d.ts +9 -0
  47. package/build/dependencies/astro-function-libraries-extensions/browser-runtime/sdk.js +16 -15
  48. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.d.mts +6 -0
  49. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.mjs +53 -0
  50. package/build/dependencies/astro-monitor/backend-runtime/monitor.d.mts +6 -0
  51. package/build/dependencies/astro-monitor/backend-runtime/monitor.mjs +43 -0
  52. package/build/dependencies/astro-payment-links/backend-runtime/elevate-CDDLuCIf.mjs +9 -0
  53. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.d.mts +6 -0
  54. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.mjs +20 -0
  55. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.d.mts +6 -0
  56. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.mjs +15 -0
  57. package/build/dependencies/astro-payment-links/backend-runtime/proposal.d.mts +6 -0
  58. package/build/dependencies/astro-payment-links/backend-runtime/proposal.mjs +20 -0
  59. package/build/dependencies/astro-robots/backend-runtime/robots.d.mts +6 -0
  60. package/build/dependencies/astro-robots/backend-runtime/robots.mjs +26 -0
  61. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/hmr.d.ts +10 -0
  62. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/hmr.js +20 -23
  63. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/sdk.d.ts +12 -0
  64. package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/sdk.js +10 -10
  65. package/build/dependencies/astro-site-components-extensions/browser-runtime/hmr.d.ts +10 -0
  66. package/build/dependencies/astro-site-components-extensions/browser-runtime/hmr.js +20 -23
  67. package/build/dependencies/astro-site-components-extensions/browser-runtime/sdk.d.ts +9 -0
  68. package/build/dependencies/astro-site-components-extensions/browser-runtime/sdk.js +16 -15
  69. package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.d.mts +6 -0
  70. package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.mjs +177 -0
  71. package/build/dependencies/astro-translations/backend-runtime/runtime/{i18n.d.ts → i18n.d.mts} +3 -2
  72. package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.mjs +38 -0
  73. package/build/dependencies/astro-translations/integration/index.d.mts +105 -0
  74. package/build/dependencies/astro-translations/integration/index.mjs +264 -0
  75. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.d.ts +10 -1
  76. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.js +20 -23
  77. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.d.ts +12 -8
  78. package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.js +25 -35
  79. package/build/dependencies/astro-viewer-api/backend-runtime/api.d.mts +6 -0
  80. package/build/dependencies/astro-viewer-api/backend-runtime/api.mjs +27 -0
  81. package/build/dependencies/astro-viewer-services-extensions/browser-runtime/sdk.d.ts +9 -0
  82. package/build/dependencies/astro-viewer-services-extensions/browser-runtime/sdk.js +16 -15
  83. package/build/integration/builders-B9yQdgSz.mjs +76 -0
  84. package/build/integration/builders-DP0350YQ.d.mts +121 -0
  85. package/build/integration/builders-DVfxT6EC.mjs +225 -0
  86. package/build/integration/builders-experimental.d.mts +56 -0
  87. package/build/integration/builders-experimental.mjs +26 -0
  88. package/build/integration/builders-trusted.d.mts +75 -0
  89. package/build/integration/builders-trusted.mjs +46 -0
  90. package/build/integration/builders.d.mts +4 -0
  91. package/build/integration/builders.mjs +4 -0
  92. package/build/integration/index-B3B_5bgh.d.mts +248 -0
  93. package/build/integration/index-D5k6Bmue.d.mts +32 -0
  94. package/build/integration/index.d.mts +35 -0
  95. package/build/integration/index.mjs +29236 -0
  96. package/package.json +12 -12
  97. package/build/dependencies/astro-auth/backend-runtime/chunk-24J7STEA.js +0 -8
  98. package/build/dependencies/astro-auth/backend-runtime/chunk-352W54SQ.js +0 -70
  99. package/build/dependencies/astro-auth/backend-runtime/chunk-BIARYLOZ.js +0 -3267
  100. package/build/dependencies/astro-auth/backend-runtime/chunk-DZHZMKUF.js +0 -26
  101. package/build/dependencies/astro-auth/backend-runtime/chunk-MLKGABMK.js +0 -9
  102. package/build/dependencies/astro-auth/backend-runtime/chunk-USQSPPTM.js +0 -14
  103. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.d.ts +0 -5
  104. package/build/dependencies/astro-auth/backend-runtime/middleware/auth.js +0 -136
  105. package/build/dependencies/astro-auth/backend-runtime/middleware/localization.d.ts +0 -5
  106. package/build/dependencies/astro-auth/backend-runtime/middleware/localization.js +0 -219
  107. package/build/dependencies/astro-auth/backend-runtime/routes/callback.d.ts +0 -5
  108. package/build/dependencies/astro-auth/backend-runtime/routes/callback.js +0 -53
  109. package/build/dependencies/astro-auth/backend-runtime/routes/login.d.ts +0 -5
  110. package/build/dependencies/astro-auth/backend-runtime/routes/login.js +0 -46
  111. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.d.ts +0 -5
  112. package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.js +0 -24
  113. package/build/dependencies/astro-auth/backend-runtime/routes/logout.d.ts +0 -5
  114. package/build/dependencies/astro-auth/backend-runtime/routes/logout.js +0 -33
  115. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.d.ts +0 -2
  116. package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js +0 -10
  117. package/build/dependencies/astro-backend-extensions/backend-runtime/chunk-CPGTXQVH.js +0 -75
  118. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.d.ts +0 -5
  119. package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.js +0 -41
  120. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.d.ts +0 -10
  121. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.js +0 -35
  122. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.d.ts +0 -9
  123. package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.js +0 -34
  124. package/build/dependencies/astro-backend-extensions/backend-runtime/utils-B7jr2PES.d.ts +0 -5
  125. package/build/dependencies/astro-backend-extensions/types/index.d.ts +0 -102
  126. package/build/dependencies/astro-backoffice-extensions/types/index.d.ts +0 -68
  127. package/build/dependencies/astro-context-providers-extensions/types/index.d.ts +0 -32
  128. package/build/dependencies/astro-core/types/index.d.ts +0 -109
  129. package/build/dependencies/astro-custom-elements-extensions/types/index.d.ts +0 -45
  130. package/build/dependencies/astro-embedded-scripts-extensions/types/index.d.ts +0 -18
  131. package/build/dependencies/astro-function-libraries-extensions/types/index.d.ts +0 -23
  132. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.d.ts +0 -5
  133. package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.js +0 -66
  134. package/build/dependencies/astro-payment-links/backend-runtime/chunk-656BVIJ3.js +0 -9
  135. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.d.ts +0 -5
  136. package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.js +0 -24
  137. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.d.ts +0 -5
  138. package/build/dependencies/astro-payment-links/backend-runtime/payment-link.js +0 -20
  139. package/build/dependencies/astro-payment-links/backend-runtime/proposal.d.ts +0 -5
  140. package/build/dependencies/astro-payment-links/backend-runtime/proposal.js +0 -24
  141. package/build/dependencies/astro-robots/backend-runtime/robots.d.ts +0 -5
  142. package/build/dependencies/astro-robots/backend-runtime/robots.js +0 -38
  143. package/build/dependencies/astro-site-component-panels-extensions/types/index.d.ts +0 -21
  144. package/build/dependencies/astro-site-components-extensions/types/index.d.ts +0 -48
  145. package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.d.ts +0 -5
  146. package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.js +0 -189
  147. package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.js +0 -42
  148. package/build/dependencies/astro-translations/integration/index.d.ts +0 -5
  149. package/build/dependencies/astro-translations/integration/index.js +0 -296
  150. package/build/dependencies/astro-trusted-backoffice-extensions/types/index.d.ts +0 -50
  151. package/build/dependencies/astro-viewer-api/backend-runtime/api.d.ts +0 -5
  152. package/build/dependencies/astro-viewer-api/backend-runtime/api.js +0 -34
  153. package/build/dependencies/astro-viewer-services-extensions/types/index.d.ts +0 -27
  154. package/build/integration/builders-experimental.d.ts +0 -53
  155. package/build/integration/builders-experimental.js +0 -20
  156. package/build/integration/builders-experimental.js.map +0 -1
  157. package/build/integration/builders-trusted.d.ts +0 -69
  158. package/build/integration/builders-trusted.js +0 -52
  159. package/build/integration/builders-trusted.js.map +0 -1
  160. package/build/integration/builders.d.ts +0 -112
  161. package/build/integration/builders.js +0 -14
  162. package/build/integration/builders.js.map +0 -1
  163. package/build/integration/chunk-23MOLCVI.js +0 -1087
  164. package/build/integration/chunk-23MOLCVI.js.map +0 -1
  165. package/build/integration/chunk-6UOFHB2M.js +0 -386
  166. package/build/integration/chunk-6UOFHB2M.js.map +0 -1
  167. package/build/integration/chunk-L6JEDTVM.js +0 -7458
  168. package/build/integration/chunk-L6JEDTVM.js.map +0 -1
  169. package/build/integration/chunk-MNQWQ2MC.js +0 -809
  170. package/build/integration/chunk-MNQWQ2MC.js.map +0 -1
  171. package/build/integration/chunk-XN6SBNMI.js +0 -23758
  172. package/build/integration/chunk-XN6SBNMI.js.map +0 -1
  173. package/build/integration/index.d-BUVlSCHa.d.ts +0 -211
  174. package/build/integration/index.d-D4c48TR0.d.ts +0 -58
  175. package/build/integration/index.d.ts +0 -34
  176. package/build/integration/index.js +0 -498
  177. package/build/integration/index.js.map +0 -1
@@ -1,23 +1,19 @@
1
- // src/runtime/renderSettingsPanel.tsx
2
1
  import React from "react";
2
+ import { createClient } from "@wix/sdk";
3
3
  import { createRoot } from "react-dom/client";
4
4
  import { editor } from "@wix/editor";
5
- import { createClient } from "@wix/sdk";
5
+
6
+ //#region src/runtime/renderSettingsPanel.tsx
6
7
  function renderSettingsPanel(SettingsPanel) {
7
- const host = editor.host();
8
- const auth = editor.auth();
9
- const wixClient = createClient({
10
- auth,
11
- host
12
- });
13
- wixClient.enableContext("module");
14
- const container = document.getElementById("root");
15
- if (container == null) {
16
- throw new Error("Cannot find root element");
17
- }
18
- const root = createRoot(container);
19
- root.render(/* @__PURE__ */ React.createElement(SettingsPanel, null));
8
+ const host = editor.host();
9
+ createClient({
10
+ auth: editor.auth(),
11
+ host
12
+ }).enableContext("module");
13
+ const container = document.getElementById("root");
14
+ if (container == null) throw new Error("Cannot find root element");
15
+ createRoot(container).render(/* @__PURE__ */ React.createElement(SettingsPanel, null));
20
16
  }
21
- export {
22
- renderSettingsPanel
23
- };
17
+
18
+ //#endregion
19
+ export { renderSettingsPanel };
@@ -1,6 +1,10 @@
1
- declare function wrapCustomElement({ customElement, tagName, }: {
2
- customElement: CustomElementConstructor;
3
- tagName: string;
1
+ //#region src/runtime/wrapCustomElement.d.ts
2
+ declare function wrapCustomElement({
3
+ customElement,
4
+ tagName
5
+ }: {
6
+ customElement: CustomElementConstructor;
7
+ tagName: string;
4
8
  }): void;
5
-
6
- export { wrapCustomElement };
9
+ //#endregion
10
+ export { wrapCustomElement };
@@ -1,30 +1,28 @@
1
- // ../astro-browser-runtime/src/sdk/site.ts
2
1
  import { createClient } from "@wix/sdk";
3
2
  import { site } from "@wix/site";
4
- var enableClient = (applicationId) => {
5
- const host = site.host({ applicationId });
6
- const auth = site.auth();
7
- const wixClient = createClient({
8
- auth,
9
- host
10
- });
11
- wixClient.enableContext("module");
12
- return auth.getAccessTokenInjector();
3
+
4
+ //#region ../astro-browser-runtime/src/sdk/site.ts
5
+ const enableClient = (applicationId) => {
6
+ const host = site.host({ applicationId });
7
+ const auth = site.auth();
8
+ createClient({
9
+ auth,
10
+ host
11
+ }).enableContext("module");
12
+ return auth.getAccessTokenInjector();
13
13
  };
14
14
 
15
- // src/runtime/wrapCustomElement.ts
16
- function wrapCustomElement({
17
- customElement,
18
- tagName
19
- }) {
20
- const injectAccessTokenFunction = enableClient(import.meta.env.WIX_CLIENT_ID);
21
- Object.defineProperty(customElement.prototype, "accessTokenListener", {
22
- configurable: false,
23
- value: injectAccessTokenFunction,
24
- writable: false
25
- });
26
- customElements.define(tagName, customElement);
15
+ //#endregion
16
+ //#region src/runtime/wrapCustomElement.ts
17
+ function wrapCustomElement({ customElement, tagName }) {
18
+ const injectAccessTokenFunction = enableClient(import.meta.env.WIX_CLIENT_ID);
19
+ Object.defineProperty(customElement.prototype, "accessTokenListener", {
20
+ configurable: false,
21
+ value: injectAccessTokenFunction,
22
+ writable: false
23
+ });
24
+ customElements.define(tagName, customElement);
27
25
  }
28
- export {
29
- wrapCustomElement
30
- };
26
+
27
+ //#endregion
28
+ export { wrapCustomElement };
@@ -1,5 +1,9 @@
1
- import * as _wix_site from '@wix/site';
1
+ import { AccessTokenFn } from "@wix/site";
2
2
 
3
- declare const injectAccessTokenFunction: ((getAccessTokenFn: _wix_site.AccessTokenFn) => void) | null;
4
-
5
- export { injectAccessTokenFunction };
3
+ //#region ../astro-browser-runtime/src/sdk/site.d.ts
4
+ type AccessTokenInjector = (getAccessTokenFn: AccessTokenFn) => void;
5
+ //#endregion
6
+ //#region src/runtime/setupContext.d.ts
7
+ declare const injectAccessTokenFunction: AccessTokenInjector | null;
8
+ //#endregion
9
+ export { injectAccessTokenFunction };
@@ -1,21 +1,22 @@
1
- // ../astro-browser-runtime/src/sdk/site.ts
2
1
  import { createClient } from "@wix/sdk";
3
2
  import { site } from "@wix/site";
4
- var enableClient = (applicationId) => {
5
- const host = site.host({ applicationId });
6
- const auth = site.auth();
7
- const wixClient = createClient({
8
- auth,
9
- host
10
- });
11
- wixClient.enableContext("module");
12
- return auth.getAccessTokenInjector();
13
- };
14
-
15
- // src/runtime/setupContext.ts
16
3
  import { resolveContext } from "@wix/sdk-runtime/context";
17
- var context = resolveContext();
18
- var injectAccessTokenFunction = context == null ? enableClient(import.meta.env.WIX_CLIENT_ID) : null;
19
- export {
20
- injectAccessTokenFunction
4
+
5
+ //#region ../astro-browser-runtime/src/sdk/site.ts
6
+ const enableClient = (applicationId) => {
7
+ const host = site.host({ applicationId });
8
+ const auth = site.auth();
9
+ createClient({
10
+ auth,
11
+ host
12
+ }).enableContext("module");
13
+ return auth.getAccessTokenInjector();
21
14
  };
15
+
16
+ //#endregion
17
+ //#region src/runtime/setupContext.ts
18
+ const context = resolveContext();
19
+ const injectAccessTokenFunction = context == null ? enableClient(import.meta.env.WIX_CLIENT_ID) : null;
20
+
21
+ //#endregion
22
+ export { injectAccessTokenFunction };
@@ -0,0 +1,9 @@
1
+ import { AccessTokenFn } from "@wix/site";
2
+
3
+ //#region ../astro-browser-runtime/src/sdk/site.d.ts
4
+ type AccessTokenInjector = (getAccessTokenFn: AccessTokenFn) => void;
5
+ //#endregion
6
+ //#region src/runtime/sdk.d.ts
7
+ declare function createContext(): AccessTokenInjector;
8
+ //#endregion
9
+ export { createContext };
@@ -1,21 +1,22 @@
1
- // ../astro-browser-runtime/src/sdk/site.ts
2
1
  import { createClient } from "@wix/sdk";
3
2
  import { site } from "@wix/site";
4
- var enableClient = (applicationId) => {
5
- const host = site.host({ applicationId });
6
- const auth = site.auth();
7
- const wixClient = createClient({
8
- auth,
9
- host
10
- });
11
- wixClient.enableContext("module");
12
- return auth.getAccessTokenInjector();
3
+
4
+ //#region ../astro-browser-runtime/src/sdk/site.ts
5
+ const enableClient = (applicationId) => {
6
+ const host = site.host({ applicationId });
7
+ const auth = site.auth();
8
+ createClient({
9
+ auth,
10
+ host
11
+ }).enableContext("module");
12
+ return auth.getAccessTokenInjector();
13
13
  };
14
14
 
15
- // src/runtime/sdk.ts
15
+ //#endregion
16
+ //#region src/runtime/sdk.ts
16
17
  function createContext() {
17
- return enableClient(import.meta.env.WIX_CLIENT_ID);
18
+ return enableClient(import.meta.env.WIX_CLIENT_ID);
18
19
  }
19
- export {
20
- createContext
21
- };
20
+
21
+ //#endregion
22
+ export { createContext };
@@ -0,0 +1,6 @@
1
+ import { MiddlewareHandler } from "astro";
2
+
3
+ //#region src/middleware/html-embeds.d.ts
4
+ declare const onRequest: MiddlewareHandler;
5
+ //#endregion
6
+ export { onRequest };
@@ -0,0 +1,53 @@
1
+ import { scripts } from "@wix/headless-site-assets";
2
+
3
+ //#region ../request-transform-utils/src/transformStreamUtils.ts
4
+ function injectAfterTransformStream(predicate, htmlToInject) {
5
+ let hasInjected = false;
6
+ return new TransformStream({ transform: (chunk, controller) => {
7
+ if (!hasInjected) {
8
+ const index = predicate.exec(chunk);
9
+ if (index) {
10
+ const position = index.index + index[0].length;
11
+ chunk = chunk.slice(0, position) + htmlToInject + chunk.slice(position);
12
+ hasInjected = true;
13
+ }
14
+ }
15
+ controller.enqueue(chunk);
16
+ } });
17
+ }
18
+ function injectBeforeTransformStream(predicate, htmlToInject) {
19
+ let hasInjected = false;
20
+ return new TransformStream({ transform: (chunk, controller) => {
21
+ if (!hasInjected) {
22
+ const index = chunk.indexOf(predicate);
23
+ if (index > -1) {
24
+ chunk = chunk.slice(0, index) + htmlToInject + chunk.slice(index);
25
+ hasInjected = true;
26
+ }
27
+ }
28
+ controller.enqueue(chunk);
29
+ } });
30
+ }
31
+
32
+ //#endregion
33
+ //#region ../request-transform-utils/src/index.ts
34
+ const bodyEndTransformStream = (htmlToInject) => injectBeforeTransformStream("</body>", htmlToInject);
35
+ const headTransformStream = (htmlToInject) => injectBeforeTransformStream("</head>", htmlToInject);
36
+ const bodyStartTransformStream = (htmlToInject) => injectAfterTransformStream(/<body(?![^>]*\/>)[^>]*>/, htmlToInject);
37
+
38
+ //#endregion
39
+ //#region src/middleware/html-embeds.ts
40
+ const onRequest = async (context, next) => {
41
+ const response = await next();
42
+ if (response.headers.get("Content-Type") !== "text/html") return response;
43
+ if (context.url.pathname.startsWith("/_wix")) return response;
44
+ const { siteScripts } = await scripts.listSiteScripts();
45
+ if (siteScripts == null) throw new Error("Could not fetch site scripts");
46
+ const headInjection = siteScripts.filter((x) => x.position === "HEAD").map((x) => x.html).join("\n");
47
+ const bodyStartInjection = siteScripts.filter((x) => x.position === "BODY_START").map((x) => x.html).join("\n");
48
+ const bodyEndInjection = siteScripts.filter((x) => x.position === "BODY_END").map((x) => x.html).join("\n");
49
+ return new Response(response.body?.pipeThrough(new TextDecoderStream()).pipeThrough(headTransformStream(headInjection)).pipeThrough(bodyStartTransformStream(bodyStartInjection)).pipeThrough(bodyEndTransformStream(bodyEndInjection)).pipeThrough(new TextEncoderStream()), response);
50
+ };
51
+
52
+ //#endregion
53
+ export { onRequest };
@@ -0,0 +1,6 @@
1
+ import { MiddlewareHandler } from "astro";
2
+
3
+ //#region src/middleware/monitor.d.ts
4
+ declare const onRequest: MiddlewareHandler;
5
+ //#endregion
6
+ export { onRequest };
@@ -0,0 +1,43 @@
1
+ import { monitoring } from "@wix/essentials";
2
+ import { resolveContext } from "@wix/sdk-runtime/context";
3
+
4
+ //#region src/utils/reportUnhandledError.ts
5
+ const reportUnhandledError = (error) => {
6
+ monitoring.getMonitoringClient().captureException(error, { contexts: { errorDetails: { isHandled: false } } });
7
+ };
8
+
9
+ //#endregion
10
+ //#region src/utils/setResponseHeaders.ts
11
+ const BiAuthTokenHeaderName = "x-wix-bi-auth-token";
12
+ async function setResponseHeaders(response) {
13
+ const client = resolveContext();
14
+ if (!client) return;
15
+ const authorization = (await client.getAuth().getAuthHeaders({})).headers.Authorization;
16
+ if (authorization != null) response.headers.set(BiAuthTokenHeaderName, authorization);
17
+ }
18
+
19
+ //#endregion
20
+ //#region src/middleware/monitor.ts
21
+ const onRequest = async (context, next) => {
22
+ if (context.url.pathname.startsWith("/_wix/extensions/")) return next();
23
+ let response;
24
+ try {
25
+ response = await next();
26
+ } catch (error) {
27
+ try {
28
+ reportUnhandledError(error);
29
+ } catch {}
30
+ if (__WIX_ASTRO_MONITOR__.hasErrorPage) throw error;
31
+ response = new Response("Internal Server Error", {
32
+ headers: { "Content-Type": "text/plain" },
33
+ status: 500
34
+ });
35
+ }
36
+ try {
37
+ await setResponseHeaders(response);
38
+ } catch {}
39
+ return response;
40
+ };
41
+
42
+ //#endregion
43
+ export { onRequest };
@@ -0,0 +1,9 @@
1
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
2
+
3
+ //#region src/elevate.ts
4
+ function elevate(restModule) {
5
+ return createRESTModule(restModule, true);
6
+ }
7
+
8
+ //#endregion
9
+ export { elevate as t };
@@ -0,0 +1,6 @@
1
+ import { APIRoute } from "astro";
2
+
3
+ //#region src/routes/payment-checkout.d.ts
4
+ declare const GET: APIRoute;
5
+ //#endregion
6
+ export { GET };
@@ -0,0 +1,20 @@
1
+ import { t as elevate } from "./elevate-CDDLuCIf.mjs";
2
+ import { ok } from "node:assert";
3
+ import { oAuthApps } from "@wix/auth-management";
4
+ import { WIX_CLIENT_ID } from "astro:env/client";
5
+
6
+ //#region src/routes/payment-checkout.ts
7
+ const GET = async ({ url }) => {
8
+ const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(WIX_CLIENT_ID);
9
+ ok(redirectUrlWixPages != null);
10
+ const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
11
+ const newCheckoutUrl = new URL(url.pathname.replace("/", ""), baseUrl);
12
+ newCheckoutUrl.search = url.search;
13
+ return new Response(null, {
14
+ headers: { Location: newCheckoutUrl.toString() },
15
+ status: 302
16
+ });
17
+ };
18
+
19
+ //#endregion
20
+ export { GET };
@@ -0,0 +1,6 @@
1
+ import { APIRoute } from "astro";
2
+
3
+ //#region src/routes/payment-link.d.ts
4
+ declare const GET: APIRoute;
5
+ //#endregion
6
+ export { GET };
@@ -0,0 +1,15 @@
1
+ import { t as elevate } from "./elevate-CDDLuCIf.mjs";
2
+ import { ok } from "node:assert";
3
+ import { oAuthApps } from "@wix/auth-management";
4
+ import { WIX_CLIENT_ID } from "astro:env/client";
5
+
6
+ //#region src/routes/payment-link.ts
7
+ const GET = async ({ params, redirect }) => {
8
+ const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(WIX_CLIENT_ID);
9
+ ok(redirectUrlWixPages != null);
10
+ const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
11
+ return redirect(new URL(`_paylink/${params.id}`, baseUrl).toString(), 302);
12
+ };
13
+
14
+ //#endregion
15
+ export { GET };
@@ -0,0 +1,6 @@
1
+ import { APIRoute } from "astro";
2
+
3
+ //#region src/routes/proposal.d.ts
4
+ declare const GET: APIRoute;
5
+ //#endregion
6
+ export { GET };
@@ -0,0 +1,20 @@
1
+ import { t as elevate } from "./elevate-CDDLuCIf.mjs";
2
+ import { ok } from "node:assert";
3
+ import { oAuthApps } from "@wix/auth-management";
4
+ import { WIX_CLIENT_ID } from "astro:env/client";
5
+
6
+ //#region src/routes/proposal.ts
7
+ const GET = async ({ url }) => {
8
+ const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(WIX_CLIENT_ID);
9
+ ok(redirectUrlWixPages != null);
10
+ const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
11
+ const newProposalUrl = new URL(url.pathname.replace("/", ""), baseUrl);
12
+ newProposalUrl.search = url.search;
13
+ return new Response(null, {
14
+ headers: { Location: newProposalUrl.toString() },
15
+ status: 302
16
+ });
17
+ };
18
+
19
+ //#endregion
20
+ export { GET };
@@ -0,0 +1,6 @@
1
+ import { APIRoute } from "astro";
2
+
3
+ //#region src/routes/robots.d.ts
4
+ declare const GET: APIRoute;
5
+ //#endregion
6
+ export { GET };
@@ -0,0 +1,26 @@
1
+ import { ok } from "node:assert";
2
+ import { oAuthApps } from "@wix/auth-management";
3
+ import { WIX_CLIENT_ID } from "astro:env/client";
4
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
5
+
6
+ //#region src/elevate.ts
7
+ function elevate(restModule) {
8
+ return createRESTModule(restModule, true);
9
+ }
10
+
11
+ //#endregion
12
+ //#region src/routes/robots.ts
13
+ const GET = async ({ request }) => {
14
+ const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(WIX_CLIENT_ID);
15
+ ok(redirectUrlWixPages != null);
16
+ const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
17
+ const robotsUrl = new URL("robots.txt", baseUrl);
18
+ const userAgent = request.headers.get("user-agent");
19
+ const originalResponse = await fetch(robotsUrl, { headers: { ...userAgent != null ? { "User-Agent": userAgent } : {} } });
20
+ if (!originalResponse.ok) throw new Error(`Failed to retrieve original robots.txt from: \`${robotsUrl.toString()}\`. Error: \`${originalResponse.statusText}\``);
21
+ const contentType = originalResponse.headers.get("content-type");
22
+ return new Response(originalResponse.body, { headers: { ...contentType != null ? { "Content-Type": contentType } : {} } });
23
+ };
24
+
25
+ //#endregion
26
+ export { GET };
@@ -0,0 +1,10 @@
1
+ import { ComponentType } from "react";
2
+
3
+ //#region ../astro-browser-runtime/src/hmr/react-component.d.ts
4
+ interface HotData {
5
+ Component?: ComponentType;
6
+ setComponent?: (NewComponent: ComponentType) => void;
7
+ }
8
+ declare function createComponentHmrWrapper(OriginalComponent: ComponentType, hotData: HotData): ComponentType;
9
+ //#endregion
10
+ export { createComponentHmrWrapper };
@@ -1,26 +1,23 @@
1
- // ../astro-browser-runtime/src/hmr/react-component.tsx
2
1
  import React, { useEffect, useRef, useState } from "react";
2
+
3
+ //#region ../astro-browser-runtime/src/hmr/react-component.tsx
3
4
  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
- };
5
+ return (props) => {
6
+ const [WrappedComponent, setComponent] = useState(() => hotData.Component ?? OriginalComponent);
7
+ const isMountedRef = useRef(false);
8
+ useEffect(() => {
9
+ isMountedRef.current = true;
10
+ hotData.setComponent = (NewComponent) => {
11
+ hotData.Component = NewComponent;
12
+ if (isMountedRef.current) setComponent(() => NewComponent);
13
+ };
14
+ return () => {
15
+ isMountedRef.current = false;
16
+ };
17
+ }, []);
18
+ return /* @__PURE__ */ React.createElement(WrappedComponent, props);
19
+ };
23
20
  }
24
- export {
25
- createComponentHmrWrapper
26
- };
21
+
22
+ //#endregion
23
+ export { createComponentHmrWrapper };
@@ -0,0 +1,12 @@
1
+ import { AuthenticationStrategy, Host } from "@wix/sdk";
2
+
3
+ //#region src/runtime/sdk.d.ts
4
+ declare const createContext: ({
5
+ auth,
6
+ host
7
+ }: {
8
+ auth?: AuthenticationStrategy;
9
+ host: Host;
10
+ }) => void;
11
+ //#endregion
12
+ export { createContext };
@@ -1,12 +1,12 @@
1
- // src/runtime/sdk.ts
2
1
  import { createClient } from "@wix/sdk";
3
- var createContext = ({
4
- auth,
5
- host
6
- }) => {
7
- const wixClient = createClient({ auth, host });
8
- wixClient.enableContext("module");
9
- };
10
- export {
11
- createContext
2
+
3
+ //#region src/runtime/sdk.ts
4
+ const createContext = ({ auth, host }) => {
5
+ createClient({
6
+ auth,
7
+ host
8
+ }).enableContext("module");
12
9
  };
10
+
11
+ //#endregion
12
+ export { createContext };
@@ -0,0 +1,10 @@
1
+ import { ComponentType } from "react";
2
+
3
+ //#region ../astro-browser-runtime/src/hmr/react-component.d.ts
4
+ interface HotData {
5
+ Component?: ComponentType;
6
+ setComponent?: (NewComponent: ComponentType) => void;
7
+ }
8
+ declare function createComponentHmrWrapper(OriginalComponent: ComponentType, hotData: HotData): ComponentType;
9
+ //#endregion
10
+ export { createComponentHmrWrapper };
@@ -1,26 +1,23 @@
1
- // ../astro-browser-runtime/src/hmr/react-component.tsx
2
1
  import React, { useEffect, useRef, useState } from "react";
2
+
3
+ //#region ../astro-browser-runtime/src/hmr/react-component.tsx
3
4
  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
- };
5
+ return (props) => {
6
+ const [WrappedComponent, setComponent] = useState(() => hotData.Component ?? OriginalComponent);
7
+ const isMountedRef = useRef(false);
8
+ useEffect(() => {
9
+ isMountedRef.current = true;
10
+ hotData.setComponent = (NewComponent) => {
11
+ hotData.Component = NewComponent;
12
+ if (isMountedRef.current) setComponent(() => NewComponent);
13
+ };
14
+ return () => {
15
+ isMountedRef.current = false;
16
+ };
17
+ }, []);
18
+ return /* @__PURE__ */ React.createElement(WrappedComponent, props);
19
+ };
23
20
  }
24
- export {
25
- createComponentHmrWrapper
26
- };
21
+
22
+ //#endregion
23
+ export { createComponentHmrWrapper };
@@ -0,0 +1,9 @@
1
+ import { AccessTokenFn } from "@wix/site";
2
+
3
+ //#region ../astro-browser-runtime/src/sdk/site.d.ts
4
+ type AccessTokenInjector = (getAccessTokenFn: AccessTokenFn) => void;
5
+ //#endregion
6
+ //#region src/runtime/sdk.d.ts
7
+ declare function createContext(): AccessTokenInjector;
8
+ //#endregion
9
+ export { createContext };