@wix/astro 2.26.0 → 2.28.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 +3643 -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 -168
  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-CBVCNKLN.js +0 -7458
  166. package/build/integration/chunk-CBVCNKLN.js.map +0 -1
  167. package/build/integration/chunk-E42TF2A2.js +0 -23747
  168. package/build/integration/chunk-E42TF2A2.js.map +0 -1
  169. package/build/integration/chunk-KCOYXYJL.js +0 -386
  170. package/build/integration/chunk-KCOYXYJL.js.map +0 -1
  171. package/build/integration/chunk-MNQWQ2MC.js +0 -809
  172. package/build/integration/chunk-MNQWQ2MC.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,66 +0,0 @@
1
- // src/middleware/html-embeds.ts
2
- import { scripts } from "@wix/headless-site-assets";
3
-
4
- // ../request-transform-utils/src/transformStreamUtils.ts
5
- function injectAfterTransformStream(predicate, htmlToInject) {
6
- let hasInjected = false;
7
- return new TransformStream({
8
- transform: (chunk, controller) => {
9
- if (!hasInjected) {
10
- const index = predicate.exec(chunk);
11
- if (index) {
12
- const position = index.index + index[0].length;
13
- chunk = chunk.slice(0, position) + htmlToInject + chunk.slice(position);
14
- hasInjected = true;
15
- }
16
- }
17
- controller.enqueue(chunk);
18
- }
19
- });
20
- }
21
- function injectBeforeTransformStream(predicate, htmlToInject) {
22
- let hasInjected = false;
23
- return new TransformStream({
24
- transform: (chunk, controller) => {
25
- if (!hasInjected) {
26
- const index = chunk.indexOf(predicate);
27
- if (index > -1) {
28
- chunk = chunk.slice(0, index) + htmlToInject + chunk.slice(index);
29
- hasInjected = true;
30
- }
31
- }
32
- controller.enqueue(chunk);
33
- }
34
- });
35
- }
36
-
37
- // ../request-transform-utils/src/index.ts
38
- var bodyEndTransformStream = (htmlToInject) => injectBeforeTransformStream("</body>", htmlToInject);
39
- var headTransformStream = (htmlToInject) => injectBeforeTransformStream("</head>", htmlToInject);
40
- var bodyStartTransformStream = (htmlToInject) => injectAfterTransformStream(/<body(?![^>]*\/>)[^>]*>/, htmlToInject);
41
-
42
- // src/middleware/html-embeds.ts
43
- var onRequest = async (context, next) => {
44
- const response = await next();
45
- const contentType = response.headers.get("Content-Type");
46
- if (contentType !== "text/html") {
47
- return response;
48
- }
49
- if (context.url.pathname.startsWith("/_wix")) {
50
- return response;
51
- }
52
- const { siteScripts } = await scripts.listSiteScripts();
53
- if (siteScripts == null) {
54
- throw new Error("Could not fetch site scripts");
55
- }
56
- const headInjection = siteScripts.filter((x) => x.position === "HEAD").map((x) => x.html).join("\n");
57
- const bodyStartInjection = siteScripts.filter((x) => x.position === "BODY_START").map((x) => x.html).join("\n");
58
- const bodyEndInjection = siteScripts.filter((x) => x.position === "BODY_END").map((x) => x.html).join("\n");
59
- return new Response(
60
- response.body?.pipeThrough(new TextDecoderStream()).pipeThrough(headTransformStream(headInjection)).pipeThrough(bodyStartTransformStream(bodyStartInjection)).pipeThrough(bodyEndTransformStream(bodyEndInjection)).pipeThrough(new TextEncoderStream()),
61
- response
62
- );
63
- };
64
- export {
65
- onRequest
66
- };
@@ -1,9 +0,0 @@
1
- // src/elevate.ts
2
- import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
3
- function elevate(restModule) {
4
- return createRESTModule(restModule, true);
5
- }
6
-
7
- export {
8
- elevate
9
- };
@@ -1,5 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- declare const GET: APIRoute;
4
-
5
- export { GET };
@@ -1,24 +0,0 @@
1
- import {
2
- elevate
3
- } from "./chunk-656BVIJ3.js";
4
-
5
- // src/routes/payment-checkout.ts
6
- import { ok } from "assert";
7
- import { oAuthApps } from "@wix/auth-management";
8
- import { WIX_CLIENT_ID } from "astro:env/client";
9
- var GET = async ({ url }) => {
10
- const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(
11
- WIX_CLIENT_ID
12
- );
13
- ok(redirectUrlWixPages != null);
14
- const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
15
- const newCheckoutUrl = new URL(url.pathname.replace("/", ""), baseUrl);
16
- newCheckoutUrl.search = url.search;
17
- return new Response(null, {
18
- headers: { Location: newCheckoutUrl.toString() },
19
- status: 302
20
- });
21
- };
22
- export {
23
- GET
24
- };
@@ -1,5 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- declare const GET: APIRoute;
4
-
5
- export { GET };
@@ -1,20 +0,0 @@
1
- import {
2
- elevate
3
- } from "./chunk-656BVIJ3.js";
4
-
5
- // src/routes/payment-link.ts
6
- import { ok } from "assert";
7
- import { oAuthApps } from "@wix/auth-management";
8
- import { WIX_CLIENT_ID } from "astro:env/client";
9
- var GET = async ({ params, redirect }) => {
10
- const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(
11
- WIX_CLIENT_ID
12
- );
13
- ok(redirectUrlWixPages != null);
14
- const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
15
- const paylinkUrl = new URL(`_paylink/${params.id}`, baseUrl);
16
- return redirect(paylinkUrl.toString(), 302);
17
- };
18
- export {
19
- GET
20
- };
@@ -1,5 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- declare const GET: APIRoute;
4
-
5
- export { GET };
@@ -1,24 +0,0 @@
1
- import {
2
- elevate
3
- } from "./chunk-656BVIJ3.js";
4
-
5
- // src/routes/proposal.ts
6
- import { ok } from "assert";
7
- import { oAuthApps } from "@wix/auth-management";
8
- import { WIX_CLIENT_ID } from "astro:env/client";
9
- var GET = async ({ url }) => {
10
- const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(
11
- WIX_CLIENT_ID
12
- );
13
- ok(redirectUrlWixPages != null);
14
- const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
15
- const newProposalUrl = new URL(url.pathname.replace("/", ""), baseUrl);
16
- newProposalUrl.search = url.search;
17
- return new Response(null, {
18
- headers: { Location: newProposalUrl.toString() },
19
- status: 302
20
- });
21
- };
22
- export {
23
- GET
24
- };
@@ -1,5 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- declare const GET: APIRoute;
4
-
5
- export { GET };
@@ -1,38 +0,0 @@
1
- // src/routes/robots.ts
2
- import { ok } from "assert";
3
- import { oAuthApps } from "@wix/auth-management";
4
- import { WIX_CLIENT_ID } from "astro:env/client";
5
-
6
- // src/elevate.ts
7
- import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
8
- function elevate(restModule) {
9
- return createRESTModule(restModule, true);
10
- }
11
-
12
- // src/routes/robots.ts
13
- var GET = async ({ request }) => {
14
- const { redirectUrlWixPages } = await elevate(oAuthApps.getOAuthApp)(
15
- WIX_CLIENT_ID
16
- );
17
- ok(redirectUrlWixPages != null);
18
- const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
19
- const robotsUrl = new URL("robots.txt", baseUrl);
20
- const userAgent = request.headers.get("user-agent");
21
- const originalResponse = await fetch(robotsUrl, {
22
- headers: { ...userAgent != null ? { "User-Agent": userAgent } : {} }
23
- });
24
- if (!originalResponse.ok) {
25
- throw new Error(
26
- `Failed to retrieve original robots.txt from: \`${robotsUrl.toString()}\`. Error: \`${originalResponse.statusText}\``
27
- );
28
- }
29
- const contentType = originalResponse.headers.get("content-type");
30
- return new Response(originalResponse.body, {
31
- headers: {
32
- ...contentType != null ? { "Content-Type": contentType } : {}
33
- }
34
- });
35
- };
36
- export {
37
- GET
38
- };
@@ -1,21 +0,0 @@
1
- import { WixIntegration, BaseExtension } from '@wix/astro-core';
2
-
3
- declare const createIntegration: () => WixIntegration;
4
-
5
- interface SiteComponentPanel extends BaseExtension {
6
- type: 'SiteComponentPanel';
7
- options: PanelOptions;
8
- }
9
- interface PanelOptions {
10
- id: string;
11
- component: string;
12
- displayName: string;
13
- referenceId?: string;
14
- size: {
15
- height: number;
16
- width: string;
17
- };
18
- }
19
- declare function siteComponentPanel(options: PanelOptions): SiteComponentPanel;
20
-
21
- export { createIntegration as default, siteComponentPanel };
@@ -1,48 +0,0 @@
1
- import { WixIntegration, BaseExtension } from '@wix/astro-core';
2
-
3
- declare const createIntegration: () => WixIntegration;
4
-
5
- interface PresetOptions {
6
- [key: string]: unknown;
7
- displayName: string;
8
- presetCssUrl: string;
9
- thumbnailUrl?: string;
10
- }
11
- interface SiteComponent extends BaseExtension {
12
- type: 'SiteComponent';
13
- options: Options;
14
- }
15
- interface Options {
16
- id: string;
17
- type: string;
18
- description: string;
19
- editorElement: {
20
- [key: string]: unknown;
21
- displayName: string;
22
- presets?: Record<string, PresetOptions>;
23
- selector: string;
24
- };
25
- resources: {
26
- [key: string]: unknown;
27
- client: {
28
- [key: string]: unknown;
29
- componentUrl: string;
30
- };
31
- dependencies?: {
32
- [key: string]: unknown;
33
- componentDependencies?: string[];
34
- contextDependencies?: string[];
35
- };
36
- editor?: {
37
- [key: string]: unknown;
38
- componentUrl: string;
39
- };
40
- sdk?: {
41
- [key: string]: unknown;
42
- url: string;
43
- };
44
- };
45
- }
46
- declare function siteComponent(options: Options): SiteComponent;
47
-
48
- export { createIntegration as default, siteComponent };
@@ -1,5 +0,0 @@
1
- import { MiddlewareHandler } from 'astro';
2
-
3
- declare const onRequest: MiddlewareHandler;
4
-
5
- export { onRequest };
@@ -1,168 +0,0 @@
1
- // src/middleware/static-translations.ts
2
- import { i18n } from "@wix/essentials";
3
- import { headTransformStream } from "@wix/request-transform-utils";
4
- import { multilingual } from "@wix/site";
5
-
6
- // ../../node_modules/outdent/lib-module/index.js
7
- function noop() {
8
- var args = [];
9
- for (var _i = 0; _i < arguments.length; _i++) {
10
- args[_i] = arguments[_i];
11
- }
12
- }
13
- function createWeakMap() {
14
- if (typeof WeakMap !== "undefined") {
15
- return /* @__PURE__ */ new WeakMap();
16
- } else {
17
- return fakeSetOrMap();
18
- }
19
- }
20
- function fakeSetOrMap() {
21
- return {
22
- add: noop,
23
- delete: noop,
24
- get: noop,
25
- set: noop,
26
- has: function(k) {
27
- return false;
28
- }
29
- };
30
- }
31
- var hop = Object.prototype.hasOwnProperty;
32
- var has = function(obj, prop) {
33
- return hop.call(obj, prop);
34
- };
35
- function extend(target, source) {
36
- for (var prop in source) {
37
- if (has(source, prop)) {
38
- target[prop] = source[prop];
39
- }
40
- }
41
- return target;
42
- }
43
- var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
44
- var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
45
- var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
46
- var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
47
- var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
48
- function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
49
- var indentationLevel = 0;
50
- var match = strings[0].match(reDetectIndentation);
51
- if (match) {
52
- indentationLevel = match[1].length;
53
- }
54
- var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
55
- var reMatchIndent = new RegExp(reSource, "g");
56
- if (firstInterpolatedValueSetsIndentationLevel) {
57
- strings = strings.slice(1);
58
- }
59
- var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
60
- var normalizeNewlines = typeof newline === "string";
61
- var l = strings.length;
62
- var outdentedStrings = strings.map(function(v, i) {
63
- v = v.replace(reMatchIndent, "$1");
64
- if (i === 0 && trimLeadingNewline) {
65
- v = v.replace(reLeadingNewline, "");
66
- }
67
- if (i === l - 1 && trimTrailingNewline) {
68
- v = v.replace(reTrailingNewline, "");
69
- }
70
- if (normalizeNewlines) {
71
- v = v.replace(/\r\n|\n|\r/g, function(_) {
72
- return newline;
73
- });
74
- }
75
- return v;
76
- });
77
- return outdentedStrings;
78
- }
79
- function concatStringsAndValues(strings, values) {
80
- var ret = "";
81
- for (var i = 0, l = strings.length; i < l; i++) {
82
- ret += strings[i];
83
- if (i < l - 1) {
84
- ret += values[i];
85
- }
86
- }
87
- return ret;
88
- }
89
- function isTemplateStringsArray(v) {
90
- return has(v, "raw") && has(v, "length");
91
- }
92
- function createInstance(options) {
93
- var arrayAutoIndentCache = createWeakMap();
94
- var arrayFirstInterpSetsIndentCache = createWeakMap();
95
- function outdent(stringsOrOptions) {
96
- var values = [];
97
- for (var _i = 1; _i < arguments.length; _i++) {
98
- values[_i - 1] = arguments[_i];
99
- }
100
- if (isTemplateStringsArray(stringsOrOptions)) {
101
- var strings = stringsOrOptions;
102
- var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
103
- var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
104
- var renderedArray = cache.get(strings);
105
- if (!renderedArray) {
106
- renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
107
- cache.set(strings, renderedArray);
108
- }
109
- if (values.length === 0) {
110
- return renderedArray[0];
111
- }
112
- var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
113
- return rendered;
114
- } else {
115
- return createInstance(extend(extend({}, options), stringsOrOptions || {}));
116
- }
117
- }
118
- var fullOutdent = extend(outdent, {
119
- string: function(str) {
120
- return _outdentArray([str], false, options)[0];
121
- }
122
- });
123
- return fullOutdent;
124
- }
125
- var defaultOutdent = createInstance({
126
- trimLeadingNewline: true,
127
- trimTrailingNewline: true
128
- });
129
- if (typeof module !== "undefined") {
130
- try {
131
- module.exports = defaultOutdent;
132
- Object.defineProperty(defaultOutdent, "__esModule", { value: true });
133
- defaultOutdent.default = defaultOutdent;
134
- defaultOutdent.outdent = defaultOutdent;
135
- } catch (e) {
136
- }
137
- }
138
-
139
- // src/middleware/static-translations.ts
140
- globalThis.__wix_translations__ = __WIX_ASTRO_I18N__.translations;
141
- var onRequest = async (context, next) => {
142
- const response = await next();
143
- const contentType = response.headers.get("Content-Type");
144
- if (contentType !== "text/html" || context.url.pathname.startsWith("/_wix") || !response.body) {
145
- return response;
146
- }
147
- const filteredTranslations = getFilteredTranslations();
148
- const translationsScript = defaultOutdent`
149
- <script>window.__wix_translations__ = ${JSON.stringify(filteredTranslations)};</script>
150
- `;
151
- return new Response(
152
- response.body.pipeThrough(new TextDecoderStream()).pipeThrough(headTransformStream(translationsScript)).pipeThrough(new TextEncoderStream()),
153
- response
154
- );
155
- };
156
- function getFilteredTranslations() {
157
- const allTranslations = globalThis.__wix_translations__ ?? {};
158
- const pickLanguage = (lang) => lang != null && allTranslations[lang] ? { [lang]: allTranslations[lang] } : {};
159
- const currentLanguage = i18n.getLanguage();
160
- const primaryLanguage = multilingual.listSupportedLanguages().find((language) => language.primary)?.id;
161
- return {
162
- ...pickLanguage(currentLanguage),
163
- ...pickLanguage(primaryLanguage)
164
- };
165
- }
166
- export {
167
- onRequest
168
- };
@@ -1,42 +0,0 @@
1
- // src/runtime/i18n.ts
2
- import { i18n } from "@wix/essentials";
3
- import { applyLanguageToUrl } from "@wix/headless-localization-utils";
4
- import { listSupportedLanguages } from "@wix/multilingual-manager";
5
- var PLACEHOLDER_BASE = "http://localhost";
6
- var { base: configBase = "/", siteUrl } = __WIX_ASTRO_I18N__;
7
- function getAbsoluteLocaleUrl(path) {
8
- const baseUrl = siteUrl ?? PLACEHOLDER_BASE;
9
- const localizedUrl = buildLocalizedUrl(baseUrl, path);
10
- if (siteUrl == null) {
11
- const url = new URL(localizedUrl);
12
- return url.pathname + url.search + url.hash;
13
- }
14
- return localizedUrl;
15
- }
16
- function getRelativeLocaleUrl(path) {
17
- const localizedUrl = new URL(buildLocalizedUrl(PLACEHOLDER_BASE, path));
18
- return localizedUrl.pathname + localizedUrl.search + localizedUrl.hash;
19
- }
20
- function buildLocalizedUrl(baseUrl, path) {
21
- const basePath = configBase === "/" ? "" : configBase.replace(/\/$/, "");
22
- const pathSegment = path?.startsWith("/") ? path : `/${path ?? ""}`;
23
- const url = new URL(basePath + pathSegment || "/", baseUrl);
24
- const languageConfig = getCurrentLanguageConfig();
25
- return languageConfig ? applyLanguageToUrl(url.href, languageConfig) : url.href;
26
- }
27
- function getCurrentLanguageConfig() {
28
- const currentLanguage = i18n.getLanguage();
29
- const languages = listSupportedLanguages();
30
- const language = languages.find((lang) => lang.id === currentLanguage);
31
- if (language == null || language.primary) {
32
- return;
33
- }
34
- return {
35
- languageCode: language.id,
36
- resolutionMethod: language.resolutionMethod
37
- };
38
- }
39
- export {
40
- getAbsoluteLocaleUrl,
41
- getRelativeLocaleUrl
42
- };
@@ -1,5 +0,0 @@
1
- import { WixIntegration } from '@wix/astro-core';
2
-
3
- declare const createIntegration: () => WixIntegration;
4
-
5
- export { createIntegration as default };