@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.
- package/build/dependencies/astro-auth/backend-runtime/constants-Dbkf3D5f.mjs +6 -0
- package/build/dependencies/astro-auth/backend-runtime/elevatedContextualClient-tJx9dIn_.mjs +41 -0
- package/build/dependencies/astro-auth/backend-runtime/host-utils-B2Fs_Z4S.mjs +17 -0
- package/build/dependencies/astro-auth/backend-runtime/middleware/auth.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/middleware/auth.mjs +3645 -0
- package/build/dependencies/astro-auth/backend-runtime/middleware/localization.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/middleware/localization.mjs +193 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/callback.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/callback.mjs +34 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/login.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/login.mjs +32 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.mjs +14 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/logout.d.mts +6 -0
- package/build/dependencies/astro-auth/backend-runtime/routes/logout.mjs +19 -0
- package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.d.mts +1 -0
- package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.mjs +8 -0
- package/build/dependencies/astro-auth/backend-runtime/saveSessionTokensToCookie-DK3xvtzk.mjs +24 -0
- package/build/dependencies/astro-auth/backend-runtime/schemas-XrMhpOYn.mjs +2771 -0
- package/build/dependencies/astro-auth/browser-runtime/setup.d.ts +4 -3
- package/build/dependencies/astro-auth/browser-runtime/setup.js +55 -81
- package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.d.mts +6 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.mjs +37 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.d.mts +10 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.mjs +22 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.d.mts +9 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.mjs +22 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/utils-DDHGZHjR.mjs +56 -0
- package/build/dependencies/astro-backend-extensions/backend-runtime/utils-mYlwmIjd.d.mts +6 -0
- package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.d.ts +4 -3
- package/build/dependencies/astro-backoffice-extensions/browser-runtime/wrapComponent.js +6 -5
- package/build/dependencies/astro-context-providers-extensions/browser-runtime/hmr.d.ts +10 -0
- package/build/dependencies/astro-context-providers-extensions/browser-runtime/hmr.js +20 -23
- package/build/dependencies/astro-context-providers-extensions/browser-runtime/sdk.d.ts +9 -0
- package/build/dependencies/astro-context-providers-extensions/browser-runtime/sdk.js +16 -15
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.d.ts +9 -5
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/customElementHmr.js +23 -40
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.d.ts +10 -1
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/reactHmr.js +20 -23
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.d.ts +4 -3
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.js +14 -18
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.d.ts +9 -5
- package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.js +23 -25
- package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.d.ts +8 -4
- package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.js +18 -17
- package/build/dependencies/astro-function-libraries-extensions/browser-runtime/sdk.d.ts +9 -0
- package/build/dependencies/astro-function-libraries-extensions/browser-runtime/sdk.js +16 -15
- package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.d.mts +6 -0
- package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.mjs +53 -0
- package/build/dependencies/astro-monitor/backend-runtime/monitor.d.mts +6 -0
- package/build/dependencies/astro-monitor/backend-runtime/monitor.mjs +43 -0
- package/build/dependencies/astro-payment-links/backend-runtime/elevate-CDDLuCIf.mjs +9 -0
- package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.d.mts +6 -0
- package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.mjs +20 -0
- package/build/dependencies/astro-payment-links/backend-runtime/payment-link.d.mts +6 -0
- package/build/dependencies/astro-payment-links/backend-runtime/payment-link.mjs +15 -0
- package/build/dependencies/astro-payment-links/backend-runtime/proposal.d.mts +6 -0
- package/build/dependencies/astro-payment-links/backend-runtime/proposal.mjs +20 -0
- package/build/dependencies/astro-robots/backend-runtime/robots.d.mts +6 -0
- package/build/dependencies/astro-robots/backend-runtime/robots.mjs +26 -0
- package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/hmr.d.ts +10 -0
- package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/hmr.js +20 -23
- package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/sdk.d.ts +12 -0
- package/build/dependencies/astro-site-component-panels-extensions/browser-runtime/sdk.js +10 -10
- package/build/dependencies/astro-site-components-extensions/browser-runtime/hmr.d.ts +10 -0
- package/build/dependencies/astro-site-components-extensions/browser-runtime/hmr.js +20 -23
- package/build/dependencies/astro-site-components-extensions/browser-runtime/sdk.d.ts +9 -0
- package/build/dependencies/astro-site-components-extensions/browser-runtime/sdk.js +16 -15
- package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.d.mts +6 -0
- package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.mjs +177 -0
- package/build/dependencies/astro-translations/backend-runtime/runtime/{i18n.d.ts → i18n.d.mts} +3 -2
- package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.mjs +38 -0
- package/build/dependencies/astro-translations/integration/index.d.mts +105 -0
- package/build/dependencies/astro-translations/integration/index.mjs +264 -0
- package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.d.ts +10 -1
- package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/hmr.js +20 -23
- package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.d.ts +12 -8
- package/build/dependencies/astro-trusted-backoffice-extensions/browser-runtime/wrapComponent.js +25 -35
- package/build/dependencies/astro-viewer-api/backend-runtime/api.d.mts +6 -0
- package/build/dependencies/astro-viewer-api/backend-runtime/api.mjs +27 -0
- package/build/dependencies/astro-viewer-services-extensions/browser-runtime/sdk.d.ts +9 -0
- package/build/dependencies/astro-viewer-services-extensions/browser-runtime/sdk.js +16 -15
- package/build/integration/builders-B9yQdgSz.mjs +76 -0
- package/build/integration/builders-DP0350YQ.d.mts +121 -0
- package/build/integration/builders-DVfxT6EC.mjs +225 -0
- package/build/integration/builders-experimental.d.mts +56 -0
- package/build/integration/builders-experimental.mjs +26 -0
- package/build/integration/builders-trusted.d.mts +75 -0
- package/build/integration/builders-trusted.mjs +46 -0
- package/build/integration/builders.d.mts +4 -0
- package/build/integration/builders.mjs +4 -0
- package/build/integration/index-B3B_5bgh.d.mts +248 -0
- package/build/integration/index-D5k6Bmue.d.mts +32 -0
- package/build/integration/index.d.mts +35 -0
- package/build/integration/index.mjs +29236 -0
- package/package.json +12 -12
- package/build/dependencies/astro-auth/backend-runtime/chunk-24J7STEA.js +0 -8
- package/build/dependencies/astro-auth/backend-runtime/chunk-352W54SQ.js +0 -70
- package/build/dependencies/astro-auth/backend-runtime/chunk-BIARYLOZ.js +0 -3267
- package/build/dependencies/astro-auth/backend-runtime/chunk-DZHZMKUF.js +0 -26
- package/build/dependencies/astro-auth/backend-runtime/chunk-MLKGABMK.js +0 -9
- package/build/dependencies/astro-auth/backend-runtime/chunk-USQSPPTM.js +0 -14
- package/build/dependencies/astro-auth/backend-runtime/middleware/auth.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/middleware/auth.js +0 -136
- package/build/dependencies/astro-auth/backend-runtime/middleware/localization.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/middleware/localization.js +0 -219
- package/build/dependencies/astro-auth/backend-runtime/routes/callback.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/routes/callback.js +0 -53
- package/build/dependencies/astro-auth/backend-runtime/routes/login.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/routes/login.js +0 -46
- package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/routes/logout-callback.js +0 -24
- package/build/dependencies/astro-auth/backend-runtime/routes/logout.d.ts +0 -5
- package/build/dependencies/astro-auth/backend-runtime/routes/logout.js +0 -33
- package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.d.ts +0 -2
- package/build/dependencies/astro-auth/backend-runtime/runtime/backend/setupContextualClient.js +0 -10
- package/build/dependencies/astro-backend-extensions/backend-runtime/chunk-CPGTXQVH.js +0 -75
- package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.d.ts +0 -5
- package/build/dependencies/astro-backend-extensions/backend-runtime/routes/extensions.js +0 -41
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.d.ts +0 -10
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupServicePlugin.js +0 -35
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.d.ts +0 -9
- package/build/dependencies/astro-backend-extensions/backend-runtime/runtime/setupWebhook.js +0 -34
- package/build/dependencies/astro-backend-extensions/backend-runtime/utils-B7jr2PES.d.ts +0 -5
- package/build/dependencies/astro-backend-extensions/types/index.d.ts +0 -102
- package/build/dependencies/astro-backoffice-extensions/types/index.d.ts +0 -68
- package/build/dependencies/astro-context-providers-extensions/types/index.d.ts +0 -32
- package/build/dependencies/astro-core/types/index.d.ts +0 -109
- package/build/dependencies/astro-custom-elements-extensions/types/index.d.ts +0 -45
- package/build/dependencies/astro-embedded-scripts-extensions/types/index.d.ts +0 -18
- package/build/dependencies/astro-function-libraries-extensions/types/index.d.ts +0 -23
- package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.d.ts +0 -5
- package/build/dependencies/astro-html-embeds/backend-runtime/html-embeds.js +0 -66
- package/build/dependencies/astro-payment-links/backend-runtime/chunk-656BVIJ3.js +0 -9
- package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.d.ts +0 -5
- package/build/dependencies/astro-payment-links/backend-runtime/payment-checkout.js +0 -24
- package/build/dependencies/astro-payment-links/backend-runtime/payment-link.d.ts +0 -5
- package/build/dependencies/astro-payment-links/backend-runtime/payment-link.js +0 -20
- package/build/dependencies/astro-payment-links/backend-runtime/proposal.d.ts +0 -5
- package/build/dependencies/astro-payment-links/backend-runtime/proposal.js +0 -24
- package/build/dependencies/astro-robots/backend-runtime/robots.d.ts +0 -5
- package/build/dependencies/astro-robots/backend-runtime/robots.js +0 -38
- package/build/dependencies/astro-site-component-panels-extensions/types/index.d.ts +0 -21
- package/build/dependencies/astro-site-components-extensions/types/index.d.ts +0 -48
- package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.d.ts +0 -5
- package/build/dependencies/astro-translations/backend-runtime/middleware/static-translations.js +0 -189
- package/build/dependencies/astro-translations/backend-runtime/runtime/i18n.js +0 -42
- package/build/dependencies/astro-translations/integration/index.d.ts +0 -5
- package/build/dependencies/astro-translations/integration/index.js +0 -296
- package/build/dependencies/astro-trusted-backoffice-extensions/types/index.d.ts +0 -50
- package/build/dependencies/astro-viewer-api/backend-runtime/api.d.ts +0 -5
- package/build/dependencies/astro-viewer-api/backend-runtime/api.js +0 -34
- package/build/dependencies/astro-viewer-services-extensions/types/index.d.ts +0 -27
- package/build/integration/builders-experimental.d.ts +0 -53
- package/build/integration/builders-experimental.js +0 -20
- package/build/integration/builders-experimental.js.map +0 -1
- package/build/integration/builders-trusted.d.ts +0 -69
- package/build/integration/builders-trusted.js +0 -52
- package/build/integration/builders-trusted.js.map +0 -1
- package/build/integration/builders.d.ts +0 -112
- package/build/integration/builders.js +0 -14
- package/build/integration/builders.js.map +0 -1
- package/build/integration/chunk-23MOLCVI.js +0 -1087
- package/build/integration/chunk-23MOLCVI.js.map +0 -1
- package/build/integration/chunk-6UOFHB2M.js +0 -386
- package/build/integration/chunk-6UOFHB2M.js.map +0 -1
- package/build/integration/chunk-L6JEDTVM.js +0 -7458
- package/build/integration/chunk-L6JEDTVM.js.map +0 -1
- package/build/integration/chunk-MNQWQ2MC.js +0 -809
- package/build/integration/chunk-MNQWQ2MC.js.map +0 -1
- package/build/integration/chunk-XN6SBNMI.js +0 -23758
- package/build/integration/chunk-XN6SBNMI.js.map +0 -1
- package/build/integration/index.d-BUVlSCHa.d.ts +0 -211
- package/build/integration/index.d-D4c48TR0.d.ts +0 -58
- package/build/integration/index.d.ts +0 -34
- package/build/integration/index.js +0 -498
- package/build/integration/index.js.map +0 -1
package/build/dependencies/astro-custom-elements-extensions/browser-runtime/renderSettingsPanel.js
CHANGED
|
@@ -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
|
-
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/renderSettingsPanel.tsx
|
|
6
7
|
function renderSettingsPanel(SettingsPanel) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { renderSettingsPanel };
|
package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 };
|
package/build/dependencies/astro-custom-elements-extensions/browser-runtime/wrapCustomElement.js
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { wrapCustomElement };
|
package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AccessTokenFn } from "@wix/site";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 };
|
package/build/dependencies/astro-embedded-scripts-extensions/browser-runtime/setupContext.js
CHANGED
|
@@ -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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/runtime/sdk.ts
|
|
16
17
|
function createContext() {
|
|
17
|
-
|
|
18
|
+
return enableClient(import.meta.env.WIX_CLIENT_ID);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { createContext };
|
|
@@ -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,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,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,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,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,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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { createComponentHmrWrapper };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// src/runtime/sdk.ts
|
|
2
1
|
import { createClient } from "@wix/sdk";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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 };
|