@ranty/ranty-sdk 3.21.0-beta.2 → 3.21.0-beta.5
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.
|
@@ -925,7 +925,7 @@ function _e(t) {
|
|
|
925
925
|
*/
|
|
926
926
|
var Z0;
|
|
927
927
|
((Z0 = window.HTMLSlotElement) === null || Z0 === void 0 ? void 0 : Z0.prototype.assignedElements) != null;
|
|
928
|
-
const Dk = "@ranty/ranty-sdk", Pk = "3.21.0-beta.
|
|
928
|
+
const Dk = "@ranty/ranty-sdk", Pk = "3.21.0-beta.5", Rk = "Ranty sdk", Nk = "dist/index.js", Ok = {
|
|
929
929
|
".": "./dist/index.js"
|
|
930
930
|
}, Lk = "types/index.d.ts", Qk = [
|
|
931
931
|
"dist",
|
|
@@ -12646,7 +12646,7 @@ const D5 = "region-service", B7 = (t, e, n) => pe(void 0, null, function* () {
|
|
|
12646
12646
|
});
|
|
12647
12647
|
class E7 {
|
|
12648
12648
|
constructor() {
|
|
12649
|
-
this._token = "", this._region = "", this.expirationTime = 0, this.key = "", this.lastTokenContext = {}, this.pendingRefresh = null, this.originalCreateTokenParams = null;
|
|
12649
|
+
this._token = "", this._region = "", this.expirationTime = 0, this.key = "", this.lastTokenContext = {}, this.pendingRefresh = null, this.originalCreateTokenParams = null, this.useAmplify = !0;
|
|
12650
12650
|
const e = sessionStorage.getItem("key");
|
|
12651
12651
|
e && (this.key = e);
|
|
12652
12652
|
}
|
|
@@ -12664,24 +12664,28 @@ class E7 {
|
|
|
12664
12664
|
return sessionStorage.setItem("key", e), sessionStorage.setItem("token", r), r;
|
|
12665
12665
|
});
|
|
12666
12666
|
}
|
|
12667
|
-
|
|
12667
|
+
createTokenWithSigner(e, n, r, s, i = 3) {
|
|
12668
12668
|
return pe(this, null, function* () {
|
|
12669
|
+
sessionStorage.setItem("key", e);
|
|
12669
12670
|
try {
|
|
12670
12671
|
const o = yield this.createTokenCaptcha(e), { data: a } = yield ft.instance.post(
|
|
12671
12672
|
"/sdk/signer",
|
|
12672
12673
|
{},
|
|
12674
|
+
// ? ANALIZAR SI LO ELIMINAMOS DEFINITIVAMENTE
|
|
12673
12675
|
{ headers: { "x-recaptcha-token": o } }
|
|
12674
|
-
);
|
|
12675
|
-
|
|
12676
|
+
), { headers: l, url: d, region: c } = a;
|
|
12677
|
+
delete l.host;
|
|
12678
|
+
const { data: u } = yield lf.post(d, null, { headers: l });
|
|
12679
|
+
return this._region = c, ie.info("signer", {
|
|
12676
12680
|
context: n,
|
|
12677
12681
|
tag: "SIGNER",
|
|
12678
12682
|
is_embedded: r,
|
|
12679
12683
|
contextObject: {
|
|
12680
12684
|
payment_request_id: s,
|
|
12681
|
-
data:
|
|
12685
|
+
data: u,
|
|
12682
12686
|
remaining_attempts: i
|
|
12683
12687
|
}
|
|
12684
|
-
}),
|
|
12688
|
+
}), u;
|
|
12685
12689
|
} catch (o) {
|
|
12686
12690
|
if (i <= 0)
|
|
12687
12691
|
throw ie.error(
|
|
@@ -12710,7 +12714,7 @@ class E7 {
|
|
|
12710
12714
|
},
|
|
12711
12715
|
o
|
|
12712
12716
|
), o.response.data.code === "BROWSER_ERROR")
|
|
12713
|
-
return this.
|
|
12717
|
+
return this.createTokenWithSigner(e, n, r, s, i - 1);
|
|
12714
12718
|
throw o;
|
|
12715
12719
|
}
|
|
12716
12720
|
});
|
|
@@ -12760,32 +12764,51 @@ class E7 {
|
|
|
12760
12764
|
return pe(this, null, function* () {
|
|
12761
12765
|
try {
|
|
12762
12766
|
this.key = e, this.lastTokenContext = { mode: n, isEmbedded: r, paymentRequestId: s }, this.originalCreateTokenParams = { key: e, mode: n, isEmbedded: r, paymentRequestId: s };
|
|
12763
|
-
let i
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12767
|
+
let i;
|
|
12768
|
+
if (ie.info("createToken started", {
|
|
12769
|
+
context: n,
|
|
12770
|
+
tag: "CREATE_TOKEN_START",
|
|
12771
|
+
is_embedded: r,
|
|
12772
|
+
contextObject: {
|
|
12773
|
+
payment_request_id: s,
|
|
12774
|
+
method: this.useAmplify ? "Amplify" : "Signer"
|
|
12775
|
+
}
|
|
12776
|
+
}), this.useAmplify) {
|
|
12777
|
+
const o = yield B7(), a = (o == null ? void 0 : o.region) || ft.getConfig().VITE_COGNITO_REGION_1;
|
|
12778
|
+
this._region = a;
|
|
12779
|
+
try {
|
|
12780
|
+
i = yield this.createTokenWithAmplify(e, n, r, s), ie.info("createToken with Amplify success", {
|
|
12781
|
+
context: n,
|
|
12782
|
+
tag: "AMPLIFY_SUCCESS",
|
|
12783
|
+
is_embedded: r,
|
|
12784
|
+
contextObject: {
|
|
12785
|
+
payment_request_id: s,
|
|
12786
|
+
region: a
|
|
12787
|
+
}
|
|
12788
|
+
});
|
|
12789
|
+
} catch (l) {
|
|
12790
|
+
ie.info("Amplify failed, falling back to signer", {
|
|
12791
|
+
context: n,
|
|
12792
|
+
tag: "AMPLIFY_FALLBACK",
|
|
12793
|
+
is_embedded: r,
|
|
12794
|
+
contextObject: {
|
|
12795
|
+
payment_request_id: s,
|
|
12796
|
+
error: l.message
|
|
12797
|
+
}
|
|
12798
|
+
}), i = yield this.createTokenWithSigner(e, n, r, s);
|
|
12799
|
+
}
|
|
12800
|
+
} else
|
|
12801
|
+
i = yield this.createTokenWithSigner(e, n, r, s);
|
|
12802
|
+
return this._token = `${i.token_type} ${i.access_token}`, this.expirationTime = Date.now() + i.expires_in * 1e3, sessionStorage.setItem("region", this._region), ie.info("createToken completed", {
|
|
12803
|
+
context: n,
|
|
12804
|
+
tag: "CREATE_TOKEN_SUCCESS",
|
|
12805
|
+
is_embedded: r,
|
|
12806
|
+
contextObject: {
|
|
12807
|
+
payment_request_id: s,
|
|
12808
|
+
region: this._region,
|
|
12809
|
+
method: this.useAmplify ? "Amplify" : "Signer"
|
|
12810
|
+
}
|
|
12811
|
+
}), i;
|
|
12789
12812
|
} catch (i) {
|
|
12790
12813
|
throw ie.error(
|
|
12791
12814
|
"createTokenError",
|
|
@@ -12794,7 +12817,8 @@ class E7 {
|
|
|
12794
12817
|
tag: "CREATE_TOKEN_ERROR",
|
|
12795
12818
|
is_embedded: r,
|
|
12796
12819
|
contextObject: {
|
|
12797
|
-
payment_request_id: s
|
|
12820
|
+
payment_request_id: s,
|
|
12821
|
+
method: this.useAmplify ? "Amplify" : "Signer"
|
|
12798
12822
|
}
|
|
12799
12823
|
},
|
|
12800
12824
|
i
|
|
@@ -16502,10 +16526,10 @@ function ZN(t, e, n, r) {
|
|
|
16502
16526
|
}
|
|
16503
16527
|
const Ru = _N(ZN);
|
|
16504
16528
|
_R(ao(), "DD_LOGS", Ru);
|
|
16505
|
-
const $N = "@nx-ranty/ranty-sdk", eO = "3.21.0-beta.
|
|
16529
|
+
const $N = "@nx-ranty/ranty-sdk", eO = "3.21.0-beta.5", tO = 3, nO = !0, rO = {
|
|
16506
16530
|
"": {
|
|
16507
16531
|
name: "@nx-ranty/ranty-sdk",
|
|
16508
|
-
version: "3.21.0-beta.
|
|
16532
|
+
version: "3.21.0-beta.5",
|
|
16509
16533
|
license: "ISC",
|
|
16510
16534
|
dependencies: {
|
|
16511
16535
|
"@datadog/browser-logs": "^6.17.0",
|
|
@@ -41995,15 +42019,15 @@ const c6 = (t) => pe(void 0, null, function* () {
|
|
|
41995
42019
|
const r = `/sdk/payment_request/${t}${e ? "?legacy=false" : ""}`, { data: s } = yield ft.instanceWithRetries.get(r, {});
|
|
41996
42020
|
return u2(s);
|
|
41997
42021
|
}), HL = (t) => pe(void 0, null, function* () {
|
|
41998
|
-
const e = `/sdk/
|
|
42022
|
+
const e = `/sdk/payment-links/${t}`, { data: n } = yield ft.instanceWithRetries.get(e, {});
|
|
41999
42023
|
return u2({ data: { response: n } }.data);
|
|
42000
42024
|
}), qL = (t) => pe(void 0, null, function* () {
|
|
42001
|
-
const e = `/sdk/
|
|
42025
|
+
const e = `/sdk/debt-refs/${t}`, { data: n } = yield ft.instanceWithRetries.get(e, {}), r = { data: { response: n.payment_request } };
|
|
42002
42026
|
return u2(r.data);
|
|
42003
42027
|
}), w_ = {
|
|
42004
42028
|
payment_request: (t, e = !1) => zL(t, e),
|
|
42005
42029
|
token: (t) => HL(t),
|
|
42006
|
-
|
|
42030
|
+
"debt-ref": (t) => qL(t)
|
|
42007
42031
|
}, eo = (t, e = "payment_request", n = !1) => pe(void 0, null, function* () {
|
|
42008
42032
|
var s;
|
|
42009
42033
|
return ((s = w_[e]) != null ? s : w_.payment_request)(t, n);
|
|
@@ -45089,30 +45113,30 @@ let Ci = class t extends tt {
|
|
|
45089
45113
|
}, this.messageError = Ue({}, this.messageErrorDefault), this._setTokenTask = new w6(this, {
|
|
45090
45114
|
args: () => [this.publicKey],
|
|
45091
45115
|
task: () => pe(this, null, function* () {
|
|
45092
|
-
var e, n;
|
|
45093
|
-
ft.setConfig(this.env), oO(ft.getConfig()), this.payfacContext.config = ft.getConfig(), this.payfacContext.isEmbedded = this.isEmbedded === "true", this.payfacContext.
|
|
45116
|
+
var e, n, r;
|
|
45117
|
+
ft.setConfig(this.env), oO(ft.getConfig()), this.payfacContext.config = ft.getConfig(), this.payfacContext.isEmbedded = this.isEmbedded === "true", this.payfacContext.paymentLinkId = this.paymentLinkId, this.payfacContext.debtRef = this.debtRef, this.payfacContext.context = (e = this.mode) == null ? void 0 : e.toUpperCase();
|
|
45094
45118
|
try {
|
|
45095
|
-
const
|
|
45119
|
+
const s = yield Ha.createToken(
|
|
45096
45120
|
this.publicKey,
|
|
45097
45121
|
this.mode,
|
|
45098
45122
|
this.payfacContext.isEmbedded,
|
|
45099
45123
|
this.paymentRequestId || this.paymentLinkId || this.debtRef
|
|
45100
45124
|
);
|
|
45101
|
-
if (!this.payfacContext.isEmbedded && this.env !== "sandbox" && (yield nQ(this.mode.toUpperCase(), this.payfacContext.isEmbedded, this.paymentRequestId)), this.payfacContext.token =
|
|
45102
|
-
const
|
|
45125
|
+
if (!this.payfacContext.isEmbedded && this.env !== "sandbox" && (yield nQ(this.mode.toUpperCase(), this.payfacContext.isEmbedded, this.paymentRequestId)), this.payfacContext.token = s == null ? void 0 : s.access_token, yield this.getPaymentRequest(), this.payfacContext.paymentSync = this.paymentSync === "true" || this.env === "sandbox" || this.paymentLinkId !== "" || this.debtRef !== "" || ((n = this.payfacContext.paymentRequest) == null ? void 0 : n.payment_type) === "payment_link", !this.payfacContext.paymentRequest && this.mode !== "a2a_feedback") {
|
|
45126
|
+
const i = vO("payment-request-not-found");
|
|
45103
45127
|
throw this.messageError = {
|
|
45104
|
-
title:
|
|
45105
|
-
message:
|
|
45106
|
-
image:
|
|
45128
|
+
title: i.title,
|
|
45129
|
+
message: i.subtitle,
|
|
45130
|
+
image: i.icon,
|
|
45107
45131
|
showButton: !1
|
|
45108
45132
|
}, new Error("Payment request not found");
|
|
45109
45133
|
}
|
|
45110
45134
|
this.payfacContext.isReady = !0, this.dispatchEvent(new CustomEvent("payfac-context-set", { bubbles: !0, composed: !0 }));
|
|
45111
|
-
} catch (
|
|
45112
|
-
throw mt("AUTH_ERROR", "Authentication failed."), this.payfacContext.isReady = !1, console.log(
|
|
45135
|
+
} catch (s) {
|
|
45136
|
+
throw mt("AUTH_ERROR", "Authentication failed."), this.payfacContext.isReady = !1, console.log(s), ie.error(
|
|
45113
45137
|
"authorizationError",
|
|
45114
45138
|
{
|
|
45115
|
-
context: (
|
|
45139
|
+
context: (r = this.mode) == null ? void 0 : r.toUpperCase(),
|
|
45116
45140
|
origin_sdk: Xh,
|
|
45117
45141
|
tag: "AUTH_ERROR",
|
|
45118
45142
|
is_embedded: this.payfacContext.isEmbedded,
|
|
@@ -45121,13 +45145,13 @@ let Ci = class t extends tt {
|
|
|
45121
45145
|
batch_token_id: this.paymentLinkId || null
|
|
45122
45146
|
}
|
|
45123
45147
|
},
|
|
45124
|
-
|
|
45125
|
-
),
|
|
45148
|
+
s
|
|
45149
|
+
), s.message === "Maximum retries reached" && (this.messageError = {
|
|
45126
45150
|
title: "Problemas de conexión",
|
|
45127
45151
|
message: "Por favor, verifica tu red y vuelve a intentarlo cuando tengas una conexión estable.",
|
|
45128
45152
|
image: "https://ranty-sdk-js.naranjax.com/images/circle-info.svg",
|
|
45129
45153
|
showButton: !0
|
|
45130
|
-
}),
|
|
45154
|
+
}), s;
|
|
45131
45155
|
}
|
|
45132
45156
|
})
|
|
45133
45157
|
}), this.setFraudPreventionOption = (e) => {
|
|
@@ -45152,7 +45176,7 @@ let Ci = class t extends tt {
|
|
|
45152
45176
|
try {
|
|
45153
45177
|
const a = (r = (n = [
|
|
45154
45178
|
{ condition: !!this.paymentLinkId, value: "token" },
|
|
45155
|
-
{ condition: !!this.debtRef, value: "
|
|
45179
|
+
{ condition: !!this.debtRef, value: "debt-ref" }
|
|
45156
45180
|
].find((p) => p.condition)) == null ? void 0 : n.value) != null ? r : "payment_request", l = this.paymentLinkId || this.paymentRequestId || this.debtRef, c = window.location.href.includes("walletPayment=true"), u = !c && this.payfacContext.paymentSync, h = yield eo(l, a, u);
|
|
45157
45181
|
this.payfacContext.paymentRequest = (h == null ? void 0 : h.response) || void 0, this.payfacContext.paymentRequest.fraudPreventionOptions = h.response.fraudPreventionOptions || this.setFraudPreventionOption((s = h == null ? void 0 : h.response) == null ? void 0 : s.seller), ie.info("GetPaymentRequest", {
|
|
45158
45182
|
context: this.payfacContext.context,
|
|
@@ -63309,7 +63333,7 @@ function(t) {
|
|
|
63309
63333
|
*/
|
|
63310
63334
|
function(t) {
|
|
63311
63335
|
function e() {
|
|
63312
|
-
return (gt.canvg ? Promise.resolve(gt.canvg) : import("./index.es-
|
|
63336
|
+
return (gt.canvg ? Promise.resolve(gt.canvg) : import("./index.es-bcdd33b7.js")).catch(function(n) {
|
|
63313
63337
|
return Promise.reject(new Error("Could not load canvg: " + n));
|
|
63314
63338
|
}).then(function(n) {
|
|
63315
63339
|
return n.default ? n.default : n;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a4 as t, a7 as e, a5 as n, a6 as o, A as r, t as p, G as C, v as i, B as u, a3 as l, R as d, K as m, X as c, J as P, Y as A, Z as I, $ as y, h as D, f, a2 as k, a1 as F, M as S, O as L, T as H, U as M, V as g, C as v, i as x, n as E, a as O, d as b, a0 as Q, s as h, y as B, r as w, o as N, p as j, q, D as z, W as G, E as J, e as K, k as R, b as T, F as U, H as V, I as W, L as X, N as Y, j as Z, w as $, P as _, l as aa, u as sa, x as ta, Q as ea, S as na, z as oa, m as ra } from "./index-
|
|
1
|
+
import { a4 as t, a7 as e, a5 as n, a6 as o, A as r, t as p, G as C, v as i, B as u, a3 as l, R as d, K as m, X as c, J as P, Y as A, Z as I, $ as y, h as D, f, a2 as k, a1 as F, M as S, O as L, T as H, U as M, V as g, C as v, i as x, n as E, a as O, d as b, a0 as Q, s as h, y as B, r as w, o as N, p as j, q, D as z, W as G, E as J, e as K, k as R, b as T, F as U, H as V, I as W, L as X, N as Y, j as Z, w as $, P as _, l as aa, u as sa, x as ta, Q as ea, S as na, z as oa, m as ra } from "./index-140cb73a.js";
|
|
2
2
|
export {
|
|
3
3
|
t as A2AAccountDetails,
|
|
4
4
|
e as A2AFeedbackHome,
|