@wix/astro 1.0.33 → 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.
Files changed (51) hide show
  1. package/package.json +6 -5
  2. package/src/index.ts +9 -0
  3. package/src/plugins/setupSsrContext.ts +3 -0
  4. package/src/routes/wix-apis/api.ts +31 -0
  5. package/tsup.config.mjs +3 -0
  6. package/build/index.d.ts +0 -9
  7. package/build/index.js +0 -17165
  8. package/build/index.js.map +0 -1
  9. package/build-browser-runtime/setup.d.ts +0 -5
  10. package/build-browser-runtime/setup.js +0 -981
  11. package/build-runtime/chunk-EK7YZVWJ.js +0 -353
  12. package/build-runtime/chunk-HPW4ZAEJ.js +0 -23
  13. package/build-runtime/chunk-JODQ44LE.js +0 -1079
  14. package/build-runtime/chunk-NKFV7KCT.js +0 -831
  15. package/build-runtime/chunk-NVTQFGTR.js +0 -7
  16. package/build-runtime/chunk-PSHIUVP2.js +0 -131
  17. package/build-runtime/chunk-Q3KPY4P2.js +0 -3104
  18. package/build-runtime/chunk-QRPWKJ4C.js +0 -41
  19. package/build-runtime/chunk-UZPSWWI5.js +0 -13
  20. package/build-runtime/chunk-W73LN534.js +0 -24
  21. package/build-runtime/chunk-YX6EVX5Q.js +0 -11
  22. package/build-runtime/context/elevated.d.ts +0 -2
  23. package/build-runtime/context/elevated.js +0 -25
  24. package/build-runtime/context/nonElevated.d.ts +0 -2
  25. package/build-runtime/context/nonElevated.js +0 -38
  26. package/build-runtime/context/setupServicePlugin.d.ts +0 -5
  27. package/build-runtime/context/setupServicePlugin.js +0 -16
  28. package/build-runtime/context/setupWebhook.d.ts +0 -5
  29. package/build-runtime/context/setupWebhook.js +0 -16
  30. package/build-runtime/middleware/auth.d.ts +0 -5
  31. package/build-runtime/middleware/auth.js +0 -74
  32. package/build-runtime/middleware/html-embeds.d.ts +0 -5
  33. package/build-runtime/middleware/html-embeds.js +0 -166
  34. package/build-runtime/routes/auth/callback.d.ts +0 -5
  35. package/build-runtime/routes/auth/callback.js +0 -52
  36. package/build-runtime/routes/auth/login.d.ts +0 -5
  37. package/build-runtime/routes/auth/login.js +0 -45
  38. package/build-runtime/routes/auth/logout-callback.d.ts +0 -5
  39. package/build-runtime/routes/auth/logout-callback.js +0 -23
  40. package/build-runtime/routes/auth/logout.d.ts +0 -5
  41. package/build-runtime/routes/auth/logout.js +0 -32
  42. package/build-runtime/routes/paylink/checkout.d.ts +0 -5
  43. package/build-runtime/routes/paylink/checkout.js +0 -35
  44. package/build-runtime/routes/paylink/paylink.d.ts +0 -5
  45. package/build-runtime/routes/paylink/paylink.js +0 -34
  46. package/build-runtime/routes/robots/robots.d.ts +0 -5
  47. package/build-runtime/routes/robots/robots.js +0 -44
  48. package/build-runtime/routes/servicePluginsDevRoute.d.ts +0 -5
  49. package/build-runtime/routes/servicePluginsDevRoute.js +0 -13
  50. package/build-runtime/routes/webhooksDevRoute.d.ts +0 -5
  51. package/build-runtime/routes/webhooksDevRoute.js +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "devDependencies": {
5
5
  "@wix/auth-management": "^1.0.70",
6
6
  "@wix/dashboard": "^1.3.35",
@@ -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
- "falconPackageHash": "6d3fa14f5c808afa661a207cc6b85f6668862487c17e814c9a9995d3"
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
@@ -64,6 +64,9 @@ export default defineConfig([
64
64
  // robots route
65
65
  'src/routes/robots/robots.ts',
66
66
 
67
+ // wix apis route
68
+ 'src/routes/wix-apis/api.ts',
69
+
67
70
  // html embeds
68
71
  'src/middleware/html-embeds.ts',
69
72
  ],
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 };