@revenuecat/purchases-js 1.30.1 → 1.32.0
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/Purchases.es.js +65 -52
- package/dist/Purchases.umd.js +5 -5
- package/package.json +1 -1
package/dist/Purchases.es.js
CHANGED
|
@@ -3770,33 +3770,35 @@ class hg {
|
|
|
3770
3770
|
workflowPurchaseContext: o,
|
|
3771
3771
|
paywallId: s,
|
|
3772
3772
|
customerEmail: l,
|
|
3773
|
-
metadata: c
|
|
3773
|
+
metadata: c,
|
|
3774
|
+
locale: u
|
|
3774
3775
|
}) {
|
|
3775
3776
|
try {
|
|
3776
|
-
const
|
|
3777
|
+
const d = this.eventsTracker.getTraceId(), p = o == null ? void 0 : o.stepId, _ = await this.backend.postCheckoutStart({
|
|
3777
3778
|
appUserId: r,
|
|
3778
3779
|
productId: t,
|
|
3779
3780
|
purchaseOption: n,
|
|
3780
3781
|
presentedOfferingContext: a,
|
|
3781
|
-
traceId:
|
|
3782
|
-
presentedStepId:
|
|
3782
|
+
traceId: d,
|
|
3783
|
+
presentedStepId: p,
|
|
3783
3784
|
paywallId: s,
|
|
3784
3785
|
customerEmail: l,
|
|
3785
|
-
metadata: c
|
|
3786
|
+
metadata: c,
|
|
3787
|
+
locale: u
|
|
3786
3788
|
});
|
|
3787
|
-
return this.operationSessionId =
|
|
3788
|
-
} catch (
|
|
3789
|
-
if (
|
|
3789
|
+
return this.operationSessionId = _.operation_session_id, _;
|
|
3790
|
+
} catch (d) {
|
|
3791
|
+
if (d instanceof je)
|
|
3790
3792
|
throw ae.fromPurchasesError(
|
|
3791
|
-
|
|
3793
|
+
d,
|
|
3792
3794
|
0
|
|
3793
3795
|
/* ErrorSettingUpPurchase */
|
|
3794
3796
|
);
|
|
3795
3797
|
{
|
|
3796
|
-
const
|
|
3797
|
-
throw ne.errorLog(
|
|
3798
|
+
const p = "Unknown error starting purchase: " + String(d);
|
|
3799
|
+
throw ne.errorLog(p), new ae(
|
|
3798
3800
|
2,
|
|
3799
|
-
|
|
3801
|
+
p
|
|
3800
3802
|
);
|
|
3801
3803
|
}
|
|
3802
3804
|
}
|
|
@@ -3831,27 +3833,31 @@ class hg {
|
|
|
3831
3833
|
}
|
|
3832
3834
|
}
|
|
3833
3835
|
}
|
|
3834
|
-
async checkoutComplete(r) {
|
|
3835
|
-
const
|
|
3836
|
-
if (!
|
|
3836
|
+
async checkoutComplete(r, t) {
|
|
3837
|
+
const n = this.operationSessionId;
|
|
3838
|
+
if (!n)
|
|
3837
3839
|
throw new ae(
|
|
3838
3840
|
0,
|
|
3839
3841
|
"No purchase started"
|
|
3840
3842
|
);
|
|
3841
3843
|
try {
|
|
3842
|
-
return await this.backend.postCheckoutComplete(
|
|
3843
|
-
|
|
3844
|
-
|
|
3844
|
+
return await this.backend.postCheckoutComplete(
|
|
3845
|
+
n,
|
|
3846
|
+
r,
|
|
3847
|
+
t
|
|
3848
|
+
);
|
|
3849
|
+
} catch (a) {
|
|
3850
|
+
if (a instanceof je)
|
|
3845
3851
|
throw ae.fromPurchasesError(
|
|
3846
|
-
|
|
3852
|
+
a,
|
|
3847
3853
|
0
|
|
3848
3854
|
/* ErrorSettingUpPurchase */
|
|
3849
3855
|
);
|
|
3850
3856
|
{
|
|
3851
|
-
const
|
|
3852
|
-
throw ne.errorLog(
|
|
3857
|
+
const o = "Unknown error starting purchase: " + String(a);
|
|
3858
|
+
throw ne.errorLog(o), new ae(
|
|
3853
3859
|
2,
|
|
3854
|
-
|
|
3860
|
+
o
|
|
3855
3861
|
);
|
|
3856
3862
|
}
|
|
3857
3863
|
}
|
|
@@ -14151,7 +14157,7 @@ function $b(e, r) {
|
|
|
14151
14157
|
}
|
|
14152
14158
|
async function Se() {
|
|
14153
14159
|
var Fe;
|
|
14154
|
-
const Z = await r.purchaseOperationHelper.checkoutComplete(i(k)), Te = (Fe = Z == null ? void 0 : Z.gateway_params) == null ? void 0 : Fe.client_secret;
|
|
14160
|
+
const Z = await r.purchaseOperationHelper.checkoutComplete(i(k), t().selectedLocale), Te = (Fe = Z == null ? void 0 : Z.gateway_params) == null ? void 0 : Fe.client_secret;
|
|
14155
14161
|
Te && L(S, Te, !0);
|
|
14156
14162
|
}
|
|
14157
14163
|
async function Ie(Z) {
|
|
@@ -16382,7 +16388,8 @@ function dw(e, r) {
|
|
|
16382
16388
|
customerEmail: i(o),
|
|
16383
16389
|
metadata: r.metadata,
|
|
16384
16390
|
workflowPurchaseContext: r.workflowPurchaseContext,
|
|
16385
|
-
paywallId: r.paywallId
|
|
16391
|
+
paywallId: r.paywallId,
|
|
16392
|
+
locale: r.selectedLocale
|
|
16386
16393
|
}).then((T) => {
|
|
16387
16394
|
L(l, null), L(u, "payment-entry"), L(p, T.gateway_params, !0), L(_, T.management_url, !0);
|
|
16388
16395
|
}).catch((T) => {
|
|
@@ -17023,30 +17030,32 @@ class qw {
|
|
|
17023
17030
|
presentedOfferingContext: n,
|
|
17024
17031
|
purchaseOption: a,
|
|
17025
17032
|
customerEmail: o,
|
|
17026
|
-
metadata: s
|
|
17033
|
+
metadata: s,
|
|
17034
|
+
locale: l
|
|
17027
17035
|
}) {
|
|
17028
17036
|
try {
|
|
17029
|
-
const
|
|
17037
|
+
const c = this.eventsTracker.getTraceId(), u = await this.backend.postCheckoutStart({
|
|
17030
17038
|
appUserId: r,
|
|
17031
17039
|
productId: t,
|
|
17032
17040
|
purchaseOption: a,
|
|
17033
17041
|
presentedOfferingContext: n,
|
|
17034
|
-
traceId:
|
|
17042
|
+
traceId: c,
|
|
17035
17043
|
customerEmail: o ?? void 0,
|
|
17036
|
-
metadata: s
|
|
17044
|
+
metadata: s,
|
|
17045
|
+
locale: l
|
|
17037
17046
|
});
|
|
17038
17047
|
return await this.initializePaddle(
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
),
|
|
17042
|
-
} catch (
|
|
17043
|
-
throw
|
|
17044
|
-
|
|
17048
|
+
u.paddle_billing_params.client_side_token,
|
|
17049
|
+
u.paddle_billing_params.is_sandbox
|
|
17050
|
+
), u;
|
|
17051
|
+
} catch (c) {
|
|
17052
|
+
throw c instanceof je ? ae.fromPurchasesError(
|
|
17053
|
+
c,
|
|
17045
17054
|
ee.ErrorSettingUpPurchase,
|
|
17046
|
-
|
|
17055
|
+
c.errorCode === We.InvalidCredentialsError
|
|
17047
17056
|
) : new ae(
|
|
17048
17057
|
ee.UnknownError,
|
|
17049
|
-
`Error starting Paddle checkout: ${
|
|
17058
|
+
`Error starting Paddle checkout: ${c}`
|
|
17050
17059
|
);
|
|
17051
17060
|
}
|
|
17052
17061
|
}
|
|
@@ -17406,7 +17415,8 @@ function Lw(e, r) {
|
|
|
17406
17415
|
presentedOfferingContext: x,
|
|
17407
17416
|
purchaseOption: r.purchaseOption,
|
|
17408
17417
|
customerEmail: r.customerEmail,
|
|
17409
|
-
metadata: r.metadata
|
|
17418
|
+
metadata: r.metadata,
|
|
17419
|
+
locale: r.selectedLocale
|
|
17410
17420
|
}), L(l, E.paddle_billing_params.is_sandbox, !0);
|
|
17411
17421
|
} catch (T) {
|
|
17412
17422
|
const S = Oo(T, `Start Paddle checkout failed: ${T}`);
|
|
@@ -17720,7 +17730,8 @@ function Xw(e, r) {
|
|
|
17720
17730
|
customerEmail: x,
|
|
17721
17731
|
metadata: r.metadata,
|
|
17722
17732
|
workflowPurchaseContext: r.workflowPurchaseContext,
|
|
17723
|
-
paywallId: r.paywallId
|
|
17733
|
+
paywallId: r.paywallId,
|
|
17734
|
+
locale: r.selectedLocale
|
|
17724
17735
|
});
|
|
17725
17736
|
if (!P.stripe_billing_params) {
|
|
17726
17737
|
f(new ae(ee.ErrorSettingUpPurchase, "Missing Stripe Checkout parameters"));
|
|
@@ -17965,7 +17976,7 @@ function nP(e) {
|
|
|
17965
17976
|
}
|
|
17966
17977
|
return r;
|
|
17967
17978
|
}
|
|
17968
|
-
const ap = "1.
|
|
17979
|
+
const ap = "1.32.0", aP = "https://api.revenuecat.com", oP = "https://e.revenue.cat";
|
|
17969
17980
|
var jo;
|
|
17970
17981
|
(function(e) {
|
|
17971
17982
|
e[e.CONTINUE = 100] = "CONTINUE", e[e.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", e[e.PROCESSING = 102] = "PROCESSING", e[e.EARLY_HINTS = 103] = "EARLY_HINTS", e[e.OK = 200] = "OK", e[e.CREATED = 201] = "CREATED", e[e.ACCEPTED = 202] = "ACCEPTED", e[e.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", e[e.NO_CONTENT = 204] = "NO_CONTENT", e[e.RESET_CONTENT = 205] = "RESET_CONTENT", e[e.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", e[e.MULTI_STATUS = 207] = "MULTI_STATUS", e[e.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", e[e.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", e[e.MOVED_TEMPORARILY = 302] = "MOVED_TEMPORARILY", e[e.SEE_OTHER = 303] = "SEE_OTHER", e[e.NOT_MODIFIED = 304] = "NOT_MODIFIED", e[e.USE_PROXY = 305] = "USE_PROXY", e[e.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", e[e.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", e[e.BAD_REQUEST = 400] = "BAD_REQUEST", e[e.UNAUTHORIZED = 401] = "UNAUTHORIZED", e[e.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", e[e.FORBIDDEN = 403] = "FORBIDDEN", e[e.NOT_FOUND = 404] = "NOT_FOUND", e[e.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", e[e.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", e[e.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", e[e.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", e[e.CONFLICT = 409] = "CONFLICT", e[e.GONE = 410] = "GONE", e[e.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", e[e.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", e[e.REQUEST_TOO_LONG = 413] = "REQUEST_TOO_LONG", e[e.REQUEST_URI_TOO_LONG = 414] = "REQUEST_URI_TOO_LONG", e[e.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", e[e.REQUESTED_RANGE_NOT_SATISFIABLE = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE", e[e.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", e[e.IM_A_TEAPOT = 418] = "IM_A_TEAPOT", e[e.INSUFFICIENT_SPACE_ON_RESOURCE = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE", e[e.METHOD_FAILURE = 420] = "METHOD_FAILURE", e[e.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", e[e.UNPROCESSABLE_ENTITY = 422] = "UNPROCESSABLE_ENTITY", e[e.LOCKED = 423] = "LOCKED", e[e.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", e[e.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", e[e.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", e[e.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", e[e.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", e[e.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", e[e.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", e[e.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", e[e.BAD_GATEWAY = 502] = "BAD_GATEWAY", e[e.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", e[e.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", e[e.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", e[e.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", e[e.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
@@ -18304,10 +18315,11 @@ class SP {
|
|
|
18304
18315
|
presentedStepId: s,
|
|
18305
18316
|
paywallId: l,
|
|
18306
18317
|
customerEmail: c,
|
|
18307
|
-
metadata: u
|
|
18318
|
+
metadata: u,
|
|
18319
|
+
locale: d
|
|
18308
18320
|
}) {
|
|
18309
|
-
var
|
|
18310
|
-
const
|
|
18321
|
+
var _, g;
|
|
18322
|
+
const p = {
|
|
18311
18323
|
app_user_id: r,
|
|
18312
18324
|
product_id: t,
|
|
18313
18325
|
email: c,
|
|
@@ -18315,16 +18327,16 @@ class SP {
|
|
|
18315
18327
|
presented_offering_identifier: a.offeringIdentifier,
|
|
18316
18328
|
trace_id: o
|
|
18317
18329
|
};
|
|
18318
|
-
return u && (
|
|
18330
|
+
return u && (p.metadata = u), n.id !== "base_option" && (p.offer_id = n.id), a.targetingContext && (p.applied_targeting_rule = {
|
|
18319
18331
|
rule_id: a.targetingContext.ruleId,
|
|
18320
18332
|
revision: a.targetingContext.revision
|
|
18321
|
-
}), a.placementIdentifier && (
|
|
18333
|
+
}), a.placementIdentifier && (p.presented_placement_identifier = a.placementIdentifier), (g = (_ = this.purchasesContext) == null ? void 0 : _.workflowContext) != null && g.workflowIdentifier && (p.presented_workflow_id = this.purchasesContext.workflowContext.workflowIdentifier), s && (p.presented_step_id = s), l && (p.paywall = {
|
|
18322
18334
|
paywall_id: l
|
|
18323
|
-
}), await Zr(
|
|
18335
|
+
}), d && (p.locale = d), await Zr(
|
|
18324
18336
|
new bP(),
|
|
18325
18337
|
{
|
|
18326
18338
|
apiKey: this.API_KEY,
|
|
18327
|
-
body:
|
|
18339
|
+
body: p,
|
|
18328
18340
|
httpConfig: this.httpConfig
|
|
18329
18341
|
}
|
|
18330
18342
|
);
|
|
@@ -18344,13 +18356,13 @@ class SP {
|
|
|
18344
18356
|
a
|
|
18345
18357
|
);
|
|
18346
18358
|
}
|
|
18347
|
-
async postCheckoutComplete(r, t) {
|
|
18348
|
-
const
|
|
18359
|
+
async postCheckoutComplete(r, t, n) {
|
|
18360
|
+
const a = {
|
|
18349
18361
|
email: t
|
|
18350
18362
|
};
|
|
18351
|
-
return await Zr(new kP(r), {
|
|
18363
|
+
return n && (a.locale = n), await Zr(new kP(r), {
|
|
18352
18364
|
apiKey: this.API_KEY,
|
|
18353
|
-
body:
|
|
18365
|
+
body: a,
|
|
18354
18366
|
httpConfig: this.httpConfig
|
|
18355
18367
|
});
|
|
18356
18368
|
}
|
|
@@ -19669,7 +19681,7 @@ function x1(e, r) {
|
|
|
19669
19681
|
var C, j;
|
|
19670
19682
|
if (!i(l) || !i(c)) return !1;
|
|
19671
19683
|
await Ve.submitElements(i(l));
|
|
19672
|
-
const D = await r.purchaseOperationHelper.checkoutComplete(S), q = (C = D == null ? void 0 : D.gateway_params) == null ? void 0 : C.client_secret;
|
|
19684
|
+
const D = await r.purchaseOperationHelper.checkoutComplete(S, r.translator.selectedLocale), q = (C = D == null ? void 0 : D.gateway_params) == null ? void 0 : C.client_secret;
|
|
19673
19685
|
if (!q)
|
|
19674
19686
|
return !1;
|
|
19675
19687
|
const O = (j = r.brandingInfo) != null && j.gateway_tax_collection_enabled ? await f(i(l), i(c)) : void 0;
|
|
@@ -19716,7 +19728,8 @@ function x1(e, r) {
|
|
|
19716
19728
|
purchaseOption: r.purchaseOption,
|
|
19717
19729
|
presentedOfferingContext: r.rcPackage.webBillingProduct.presentedOfferingContext,
|
|
19718
19730
|
customerEmail: r.customerEmail,
|
|
19719
|
-
metadata: r.metadata
|
|
19731
|
+
metadata: r.metadata,
|
|
19732
|
+
locale: r.translator.selectedLocale
|
|
19720
19733
|
}), O = q.management_url;
|
|
19721
19734
|
if (!i(l))
|
|
19722
19735
|
throw new ae(ee.ErrorSettingUpPurchase);
|