@wix/astro 1.0.32 → 1.0.34
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/package.json +8 -7
- package/src/index.ts +9 -0
- package/src/plugins/setupSsrContext.ts +3 -0
- package/src/routes/wix-apis/api.ts +31 -0
- package/tsup.config.mjs +3 -0
- package/build/index.d.ts +0 -9
- package/build/index.js +0 -17165
- package/build/index.js.map +0 -1
- package/build-browser-runtime/setup.d.ts +0 -5
- package/build-browser-runtime/setup.js +0 -849
- package/build-runtime/chunk-7EHL72JI.js +0 -1079
- package/build-runtime/chunk-EK7YZVWJ.js +0 -353
- package/build-runtime/chunk-HPW4ZAEJ.js +0 -23
- package/build-runtime/chunk-NKY4T53W.js +0 -709
- package/build-runtime/chunk-NVTQFGTR.js +0 -7
- package/build-runtime/chunk-PSHIUVP2.js +0 -131
- package/build-runtime/chunk-U67V476Y.js +0 -35
- package/build-runtime/chunk-UZPSWWI5.js +0 -13
- package/build-runtime/chunk-W73LN534.js +0 -24
- package/build-runtime/chunk-WE3ELMU5.js +0 -3104
- package/build-runtime/chunk-YX6EVX5Q.js +0 -11
- package/build-runtime/context/elevated.d.ts +0 -2
- package/build-runtime/context/elevated.js +0 -25
- package/build-runtime/context/nonElevated.d.ts +0 -2
- package/build-runtime/context/nonElevated.js +0 -38
- package/build-runtime/context/setupServicePlugin.d.ts +0 -5
- package/build-runtime/context/setupServicePlugin.js +0 -16
- package/build-runtime/context/setupWebhook.d.ts +0 -5
- package/build-runtime/context/setupWebhook.js +0 -16
- package/build-runtime/middleware/auth.d.ts +0 -5
- package/build-runtime/middleware/auth.js +0 -74
- package/build-runtime/middleware/html-embeds.d.ts +0 -5
- package/build-runtime/middleware/html-embeds.js +0 -166
- package/build-runtime/routes/auth/callback.d.ts +0 -5
- package/build-runtime/routes/auth/callback.js +0 -52
- package/build-runtime/routes/auth/login.d.ts +0 -5
- package/build-runtime/routes/auth/login.js +0 -45
- package/build-runtime/routes/auth/logout-callback.d.ts +0 -5
- package/build-runtime/routes/auth/logout-callback.js +0 -23
- package/build-runtime/routes/auth/logout.d.ts +0 -5
- package/build-runtime/routes/auth/logout.js +0 -32
- package/build-runtime/routes/paylink/checkout.d.ts +0 -5
- package/build-runtime/routes/paylink/checkout.js +0 -35
- package/build-runtime/routes/paylink/paylink.d.ts +0 -5
- package/build-runtime/routes/paylink/paylink.js +0 -34
- package/build-runtime/routes/robots/robots.d.ts +0 -5
- package/build-runtime/routes/robots/robots.js +0 -44
- package/build-runtime/routes/servicePluginsDevRoute.d.ts +0 -5
- package/build-runtime/routes/servicePluginsDevRoute.js +0 -13
- package/build-runtime/routes/webhooksDevRoute.d.ts +0 -5
- package/build-runtime/routes/webhooksDevRoute.js +0 -13
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/astro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@wix/auth-management": "^1.0.70",
|
|
6
6
|
"@wix/dashboard": "^1.3.35",
|
|
7
7
|
"@wix/essentials": "^0.1.23",
|
|
8
|
-
"@wix/headless-node": "^1.
|
|
9
|
-
"@wix/headless-site": "^1.
|
|
8
|
+
"@wix/headless-node": "^1.11.0",
|
|
9
|
+
"@wix/headless-site": "^1.7.0",
|
|
10
10
|
"@wix/headless-site-assets": "^1.0.2",
|
|
11
11
|
"@wix/sdk": "^1.15.23",
|
|
12
12
|
"@wix/sdk-context": "^0.0.1",
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"registry": "https://registry.npmjs.org/",
|
|
39
|
-
"access": "public"
|
|
39
|
+
"access": "public",
|
|
40
|
+
"versionBumpStrategy": "manual",
|
|
41
|
+
"logLevel": "verbose"
|
|
40
42
|
},
|
|
41
43
|
"scripts": {
|
|
42
44
|
"build": "tsup",
|
|
@@ -50,6 +52,5 @@
|
|
|
50
52
|
"groupId": "com.wixpress.npm",
|
|
51
53
|
"artifactId": "wix-astro"
|
|
52
54
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -187,6 +187,15 @@ const createIntegration = (
|
|
|
187
187
|
prerender: false,
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
+
injectRoute({
|
|
191
|
+
entrypoint: new URL(
|
|
192
|
+
'../build-runtime/routes/wix-apis/api.js',
|
|
193
|
+
import.meta.url
|
|
194
|
+
),
|
|
195
|
+
pattern: '/_api/[...path]',
|
|
196
|
+
prerender: false,
|
|
197
|
+
});
|
|
198
|
+
|
|
190
199
|
updateConfig({
|
|
191
200
|
env: {
|
|
192
201
|
schema: {
|
|
@@ -37,6 +37,9 @@ const whitelistedFilePaths = [
|
|
|
37
37
|
fileURLToPath(
|
|
38
38
|
new URL('../build-runtime/routes/robots/robots.js', import.meta.url)
|
|
39
39
|
),
|
|
40
|
+
fileURLToPath(
|
|
41
|
+
new URL('../build-runtime/routes/wix-apis/api.js', import.meta.url)
|
|
42
|
+
),
|
|
40
43
|
];
|
|
41
44
|
|
|
42
45
|
export function setupSsrContext(rootDir: string): PluginOption {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { APIRoute } from 'astro';
|
|
2
|
+
import { oAuthApps } from '@wix/auth-management';
|
|
3
|
+
import { auth } from '@wix/essentials';
|
|
4
|
+
import { WIX_CLIENT_ID } from 'astro:env/client';
|
|
5
|
+
|
|
6
|
+
export const GET: APIRoute = async ({ url }) => {
|
|
7
|
+
const { redirectUrlWixPages } = await auth.elevate(oAuthApps.getOAuthApp)(
|
|
8
|
+
WIX_CLIENT_ID
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
if (redirectUrlWixPages == null) {
|
|
12
|
+
throw new Error(`Invalid Redirect URL: '${redirectUrlWixPages}'`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const baseWixUrl = new URL(redirectUrlWixPages);
|
|
16
|
+
const mergedPath =
|
|
17
|
+
baseWixUrl.pathname.replace(/\/$/, '') + url.pathname.replace(/\/$/, '');
|
|
18
|
+
const redirectUrl = new URL(mergedPath, baseWixUrl.origin);
|
|
19
|
+
|
|
20
|
+
for (const [key, value] of [
|
|
21
|
+
...baseWixUrl.searchParams.entries(),
|
|
22
|
+
...url.searchParams.entries(),
|
|
23
|
+
]) {
|
|
24
|
+
redirectUrl.searchParams.append(key, value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return new Response(null, {
|
|
28
|
+
headers: { Location: redirectUrl.toString() },
|
|
29
|
+
status: 302,
|
|
30
|
+
});
|
|
31
|
+
};
|
package/tsup.config.mjs
CHANGED
package/build/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AstroIntegration } from 'astro';
|
|
2
|
-
|
|
3
|
-
interface WixIntegrationOptions {
|
|
4
|
-
enableAuthRoutes?: boolean;
|
|
5
|
-
enableHtmlEmbeds?: boolean;
|
|
6
|
-
}
|
|
7
|
-
declare const createIntegration: (options?: WixIntegrationOptions) => AstroIntegration;
|
|
8
|
-
|
|
9
|
-
export { createIntegration as default };
|