@revenuecat/purchases-ui-js 4.12.0 → 4.12.1
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.
|
@@ -12,6 +12,7 @@ type CustomWebCheckoutContext = {
|
|
|
12
12
|
* Mirrors the native SDKs: source, then app user ID, env and package when
|
|
13
13
|
* configured. The source is the host's own, so it survives a same-tab hop.
|
|
14
14
|
* Same-named params are replaced; an unparseable URL is returned unchanged.
|
|
15
|
+
* Script-capable URLs resolve to undefined, so the button purchases instead.
|
|
15
16
|
*/
|
|
16
|
-
export declare const buildCustomWebCheckoutURL: (url: string, config: CustomURLConfig, { packageId, appUserId, isSandbox, rcSource }: CustomWebCheckoutContext) => string;
|
|
17
|
+
export declare const buildCustomWebCheckoutURL: (url: string, config: CustomURLConfig, { packageId, appUserId, isSandbox, rcSource }: CustomWebCheckoutContext) => string | undefined;
|
|
17
18
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
const SCRIPT_PROTOCOLS = new Set(["javascript:", "data:", "vbscript:"]);
|
|
1
2
|
/**
|
|
2
3
|
* Mirrors the native SDKs: source, then app user ID, env and package when
|
|
3
4
|
* configured. The source is the host's own, so it survives a same-tab hop.
|
|
4
5
|
* Same-named params are replaced; an unparseable URL is returned unchanged.
|
|
6
|
+
* Script-capable URLs resolve to undefined, so the button purchases instead.
|
|
5
7
|
*/
|
|
6
8
|
export const buildCustomWebCheckoutURL = (url, config, { packageId, appUserId, isSandbox, rcSource }) => {
|
|
7
9
|
let parsed;
|
|
@@ -11,6 +13,9 @@ export const buildCustomWebCheckoutURL = (url, config, { packageId, appUserId, i
|
|
|
11
13
|
catch {
|
|
12
14
|
return url;
|
|
13
15
|
}
|
|
16
|
+
if (SCRIPT_PROTOCOLS.has(parsed.protocol)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
14
19
|
const { searchParams } = parsed;
|
|
15
20
|
if (rcSource !== undefined) {
|
|
16
21
|
searchParams.set("rc_source", rcSource);
|