@wix/astro 1.0.28 → 1.0.29

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.
@@ -1075,7 +1075,7 @@ var onOAuthAppUpdated2 = createEventModule(onOAuthAppUpdated);
1075
1075
  // src/routes/paylink/paylink.ts
1076
1076
  import { auth } from "@wix/essentials";
1077
1077
  import { WIX_CLIENT_ID } from "astro:env/client";
1078
- var GET = async ({ url }) => {
1078
+ var GET = async ({ params }) => {
1079
1079
  try {
1080
1080
  const { redirectUrlWixPages } = await auth.elevate(es_exports.getOAuthApp)(
1081
1081
  WIX_CLIENT_ID
@@ -1083,7 +1083,9 @@ var GET = async ({ url }) => {
1083
1083
  if (redirectUrlWixPages == null) {
1084
1084
  throw new Error(`Invalid Redirect URL: ${redirectUrlWixPages}`);
1085
1085
  }
1086
- const paylinkUrl = new URL(url.pathname, redirectUrlWixPages);
1086
+ const paylinkId = params.id;
1087
+ const baseUrl = redirectUrlWixPages.endsWith("/") ? redirectUrlWixPages : `${redirectUrlWixPages}/`;
1088
+ const paylinkUrl = new URL(`_paylink/${paylinkId}`, baseUrl);
1087
1089
  return new Response(null, {
1088
1090
  headers: { Location: paylinkUrl.toString() },
1089
1091
  status: 302
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/astro",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "devDependencies": {
5
5
  "@wix/auth-management": "^1.0.70",
6
6
  "@wix/dashboard": "^1.3.35",
@@ -50,5 +50,5 @@
50
50
  "artifactId": "wix-astro"
51
51
  }
52
52
  },
53
- "falconPackageHash": "0e9156d5c957f5a900159816a5fabb8c5b2cd0974a114cbfb573c154"
53
+ "falconPackageHash": "32d6a34fd70a219cbd5545ed0a8c818b655cc7ecd0d6b6cb2c1d3705"
54
54
  }
@@ -3,7 +3,7 @@ import { oAuthApps } from '@wix/auth-management';
3
3
  import { auth } from '@wix/essentials';
4
4
  import { WIX_CLIENT_ID } from 'astro:env/client';
5
5
 
6
- export const GET: APIRoute = async ({ url }) => {
6
+ export const GET: APIRoute = async ({ params }) => {
7
7
  try {
8
8
  const { redirectUrlWixPages } = await auth.elevate(oAuthApps.getOAuthApp)(
9
9
  WIX_CLIENT_ID
@@ -13,7 +13,13 @@ export const GET: APIRoute = async ({ url }) => {
13
13
  throw new Error(`Invalid Redirect URL: ${redirectUrlWixPages}`);
14
14
  }
15
15
 
16
- const paylinkUrl = new URL(url.pathname, redirectUrlWixPages);
16
+ const paylinkId = params.id;
17
+
18
+ const baseUrl = redirectUrlWixPages.endsWith('/')
19
+ ? redirectUrlWixPages
20
+ : `${redirectUrlWixPages}/`;
21
+
22
+ const paylinkUrl = new URL(`_paylink/${paylinkId}`, baseUrl);
17
23
 
18
24
  return new Response(null, {
19
25
  headers: { Location: paylinkUrl.toString() },