@monetize.software/sdk 3.0.0-alpha.15 → 3.0.0-alpha.17
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/dist/chunks/{PaywallUI-CwFdm-2Q.js → PaywallUI-BBX0qK8m.js} +2 -2
- package/dist/chunks/{PaywallUI-CwFdm-2Q.js.map → PaywallUI-BBX0qK8m.js.map} +1 -1
- package/dist/chunks/{PaywallUI-DZAhxO9L.js → PaywallUI-CX81Oe3o.js} +2 -2
- package/dist/chunks/{PaywallUI-DZAhxO9L.js.map → PaywallUI-CX81Oe3o.js.map} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +11 -1
- package/dist/core.js +12 -9
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +11 -1
- package/dist/ui.js +1 -1
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -780,7 +780,9 @@ export declare class BillingClient {
|
|
|
780
780
|
* инвойсы). Опен-флоу управляется host'ом:
|
|
781
781
|
*
|
|
782
782
|
* ```ts
|
|
783
|
-
* const { url } = await billing.getCustomerPortalUrl(
|
|
783
|
+
* const { url } = await billing.getCustomerPortalUrl({
|
|
784
|
+
* returnUrl: 'https://your-app.com/account'
|
|
785
|
+
* });
|
|
784
786
|
* window.open(url, '_blank');
|
|
785
787
|
* ```
|
|
786
788
|
*
|
|
@@ -792,6 +794,14 @@ export declare class BillingClient {
|
|
|
792
794
|
*/
|
|
793
795
|
getCustomerPortalUrl(opts?: {
|
|
794
796
|
signal?: AbortSignal;
|
|
797
|
+
/** URL для return-button у провайдера (Stripe «Return to ...», Paddle
|
|
798
|
+
* и Chargebee redirect_url'ы). Передавай туда страницу-аккаунт твоего
|
|
799
|
+
* app'а — `https://your-app.com/account`. Без явного returnUrl бэк
|
|
800
|
+
* применяет fallback в порядке: `paywall_settings.shop_url` →
|
|
801
|
+
* custom_domain пейвола → NEXT_PUBLIC_ONLINE_ORIGIN (последнее — это
|
|
802
|
+
* страница в самом online-сервисе, годится только для legacy
|
|
803
|
+
* v2-iframe-флоу). */
|
|
804
|
+
returnUrl?: string;
|
|
795
805
|
}): Promise<{
|
|
796
806
|
url: string;
|
|
797
807
|
}>;
|
package/dist/core.js
CHANGED
|
@@ -392,7 +392,7 @@ class yt {
|
|
|
392
392
|
offers: t.offers !== void 0 ? t.offers : e.offers,
|
|
393
393
|
version: `preview:${++this.previewVersionCounter}`
|
|
394
394
|
};
|
|
395
|
-
s.layout || (s.layout =
|
|
395
|
+
s.layout || (s.layout = O(s.settings, s.prices)), w(s), this.cachedBootstrap = s, this.cachedBootstrapAt = Date.now();
|
|
396
396
|
for (const a of this.bootstrapListeners)
|
|
397
397
|
try {
|
|
398
398
|
a(s);
|
|
@@ -414,7 +414,7 @@ class yt {
|
|
|
414
414
|
if ("unchanged" in a && a.unchanged)
|
|
415
415
|
return this.cachedBootstrap ? (this.cachedBootstrapAt = Date.now(), a.user && this.applyUser(a.user), this.cachedBootstrap) : this.fetchBootstrap({ signal: t.signal });
|
|
416
416
|
const n = a;
|
|
417
|
-
return Y(n.settings.custom_domain, this.apiOrigin), n.layout || (n.layout =
|
|
417
|
+
return Y(n.settings.custom_domain, this.apiOrigin), n.layout || (n.layout = O(n.settings, n.prices)), w(n), this.applyBootstrap(n, { persist: !0 }), n.user && this.applyUser(n.user), n;
|
|
418
418
|
}
|
|
419
419
|
// Фоновый revalidate из stale-while-revalidate ветки. Дедуплицируется через
|
|
420
420
|
// `inflightBootstrap`, чтобы параллельные revalidate'ы не пересекались.
|
|
@@ -869,7 +869,9 @@ class yt {
|
|
|
869
869
|
* инвойсы). Опен-флоу управляется host'ом:
|
|
870
870
|
*
|
|
871
871
|
* ```ts
|
|
872
|
-
* const { url } = await billing.getCustomerPortalUrl(
|
|
872
|
+
* const { url } = await billing.getCustomerPortalUrl({
|
|
873
|
+
* returnUrl: 'https://your-app.com/account'
|
|
874
|
+
* });
|
|
873
875
|
* window.open(url, '_blank');
|
|
874
876
|
* ```
|
|
875
877
|
*
|
|
@@ -887,9 +889,10 @@ class yt {
|
|
|
887
889
|
);
|
|
888
890
|
const e = {};
|
|
889
891
|
this.apiKey && (e["X-Api-Key"] = this.apiKey);
|
|
890
|
-
const s = this.auth && this.auth.getCachedSession() ? {} : {
|
|
892
|
+
const s = this.auth && this.auth.getCachedSession() ? { returnUrl: t.returnUrl } : {
|
|
891
893
|
email: this.identity?.email,
|
|
892
|
-
userMeta: this.identity?.userId ? { userId: this.identity.userId } : void 0
|
|
894
|
+
userMeta: this.identity?.userId ? { userId: this.identity.userId } : void 0,
|
|
895
|
+
returnUrl: t.returnUrl
|
|
893
896
|
};
|
|
894
897
|
return { url: (await this.api.request(
|
|
895
898
|
`/api/v1/paywall/${this.paywallId}/get-customer-portal`,
|
|
@@ -1005,7 +1008,7 @@ function T(i) {
|
|
|
1005
1008
|
function W(i, t) {
|
|
1006
1009
|
return i === t ? !0 : !i || !t ? !1 : i.email === t.email && i.userId === t.userId && i.anonymousId === t.anonymousId;
|
|
1007
1010
|
}
|
|
1008
|
-
function
|
|
1011
|
+
function U(i) {
|
|
1009
1012
|
if (!i) return null;
|
|
1010
1013
|
const t = i.trim();
|
|
1011
1014
|
if (!t) return null;
|
|
@@ -1016,14 +1019,14 @@ function O(i) {
|
|
|
1016
1019
|
}
|
|
1017
1020
|
}
|
|
1018
1021
|
function Y(i, t) {
|
|
1019
|
-
const e =
|
|
1020
|
-
if (!(!e ||
|
|
1022
|
+
const e = U(i);
|
|
1023
|
+
if (!(!e || U(t) === e))
|
|
1021
1024
|
throw new r(
|
|
1022
1025
|
"invalid_config",
|
|
1023
1026
|
`apiOrigin mismatch: SDK initialized with "${t}" but paywall is configured with custom_domain "${i}". Use the custom_domain from the platform paywall settings.`
|
|
1024
1027
|
);
|
|
1025
1028
|
}
|
|
1026
|
-
function
|
|
1029
|
+
function O(i, t) {
|
|
1027
1030
|
return {
|
|
1028
1031
|
type: "modal",
|
|
1029
1032
|
blocks: [
|