@tiun/react-native-sdk 0.2.0 → 0.4.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/README.md +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +463 -434
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Ne = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var Te = (
|
|
4
|
-
import Oe, { forwardRef as
|
|
5
|
-
import { StyleSheet as
|
|
6
|
-
import { WebView as
|
|
7
|
-
import { close as
|
|
8
|
-
import { getPublicKey as me, generate as
|
|
9
|
-
import * as
|
|
10
|
-
var
|
|
2
|
+
var Ce = (r, t, a) => t in r ? Ne(r, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[t] = a;
|
|
3
|
+
var Te = (r, t, a) => (Ce(r, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
+
import Oe, { forwardRef as Ie, useRef as P, useState as z, useEffect as oe, useImperativeHandle as Pe, createContext as ve, useCallback as K, useMemo as xe, useContext as _e } from "react";
|
|
5
|
+
import { StyleSheet as ie, View as ne, Text as te, Pressable as Ae, useColorScheme as Ue, AppState as je, useWindowDimensions as $e, Platform as Fe, Linking as Ee } from "react-native";
|
|
6
|
+
import { WebView as Le } from "react-native-webview";
|
|
7
|
+
import { close as We, closeAuth as Ve, openAuth as Ye, open as be } from "react-native-inappbrowser-nitro";
|
|
8
|
+
import { getPublicKey as me, generate as Be, sign as Ge, removeKey as He } from "react-native-secure-sign";
|
|
9
|
+
import * as ae from "react-native-keychain";
|
|
10
|
+
var de = { exports: {} }, X = {};
|
|
11
11
|
/**
|
|
12
12
|
* @license React
|
|
13
13
|
* react-jsx-runtime.production.js
|
|
@@ -18,28 +18,28 @@ var le = { exports: {} }, X = {};
|
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
20
|
var ye;
|
|
21
|
-
function
|
|
21
|
+
function De() {
|
|
22
22
|
if (ye)
|
|
23
23
|
return X;
|
|
24
24
|
ye = 1;
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
var
|
|
28
|
-
if (u !== void 0 && (
|
|
25
|
+
var r = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
26
|
+
function a(l, o, u) {
|
|
27
|
+
var d = null;
|
|
28
|
+
if (u !== void 0 && (d = "" + u), o.key !== void 0 && (d = "" + o.key), "key" in o) {
|
|
29
29
|
u = {};
|
|
30
|
-
for (var
|
|
31
|
-
|
|
30
|
+
for (var T in o)
|
|
31
|
+
T !== "key" && (u[T] = o[T]);
|
|
32
32
|
} else
|
|
33
|
-
u =
|
|
34
|
-
return
|
|
35
|
-
$$typeof:
|
|
33
|
+
u = o;
|
|
34
|
+
return o = u.ref, {
|
|
35
|
+
$$typeof: r,
|
|
36
36
|
type: l,
|
|
37
|
-
key:
|
|
38
|
-
ref:
|
|
37
|
+
key: d,
|
|
38
|
+
ref: o !== void 0 ? o : null,
|
|
39
39
|
props: u
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
return X.Fragment =
|
|
42
|
+
return X.Fragment = t, X.jsx = a, X.jsxs = a, X;
|
|
43
43
|
}
|
|
44
44
|
var Q = {};
|
|
45
45
|
/**
|
|
@@ -52,128 +52,128 @@ var Q = {};
|
|
|
52
52
|
* LICENSE file in the root directory of this source tree.
|
|
53
53
|
*/
|
|
54
54
|
var we;
|
|
55
|
-
function
|
|
55
|
+
function Ke() {
|
|
56
56
|
return we || (we = 1, process.env.NODE_ENV !== "production" && function() {
|
|
57
|
-
function
|
|
57
|
+
function r(e) {
|
|
58
58
|
if (e == null)
|
|
59
59
|
return null;
|
|
60
60
|
if (typeof e == "function")
|
|
61
|
-
return e.$$typeof ===
|
|
61
|
+
return e.$$typeof === m ? null : e.displayName || e.name || null;
|
|
62
62
|
if (typeof e == "string")
|
|
63
63
|
return e;
|
|
64
64
|
switch (e) {
|
|
65
|
-
case
|
|
65
|
+
case b:
|
|
66
66
|
return "Fragment";
|
|
67
|
-
case
|
|
67
|
+
case V:
|
|
68
68
|
return "Profiler";
|
|
69
|
-
case
|
|
69
|
+
case k:
|
|
70
70
|
return "StrictMode";
|
|
71
|
-
case
|
|
71
|
+
case H:
|
|
72
72
|
return "Suspense";
|
|
73
|
-
case
|
|
73
|
+
case c:
|
|
74
74
|
return "SuspenseList";
|
|
75
|
-
case
|
|
75
|
+
case O:
|
|
76
76
|
return "Activity";
|
|
77
77
|
}
|
|
78
78
|
if (typeof e == "object")
|
|
79
79
|
switch (typeof e.tag == "number" && console.error(
|
|
80
80
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
81
81
|
), e.$$typeof) {
|
|
82
|
-
case
|
|
82
|
+
case M:
|
|
83
83
|
return "Portal";
|
|
84
|
-
case
|
|
84
|
+
case B:
|
|
85
85
|
return (e.displayName || "Context") + ".Provider";
|
|
86
|
-
case
|
|
86
|
+
case U:
|
|
87
87
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
88
|
-
case
|
|
89
|
-
var
|
|
90
|
-
return e = e.displayName, e || (e =
|
|
88
|
+
case G:
|
|
89
|
+
var s = e.render;
|
|
90
|
+
return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
91
|
+
case _:
|
|
92
|
+
return s = e.displayName || null, s !== null ? s : r(e.type) || "Memo";
|
|
91
93
|
case y:
|
|
92
|
-
|
|
93
|
-
case o:
|
|
94
|
-
a = e._payload, e = e._init;
|
|
94
|
+
s = e._payload, e = e._init;
|
|
95
95
|
try {
|
|
96
|
-
return
|
|
96
|
+
return r(e(s));
|
|
97
97
|
} catch {
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function t(e) {
|
|
103
103
|
return "" + e;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function a(e) {
|
|
106
106
|
try {
|
|
107
|
-
|
|
108
|
-
var
|
|
107
|
+
t(e);
|
|
108
|
+
var s = !1;
|
|
109
109
|
} catch {
|
|
110
|
-
|
|
110
|
+
s = !0;
|
|
111
111
|
}
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
var
|
|
115
|
-
return
|
|
116
|
-
|
|
112
|
+
if (s) {
|
|
113
|
+
s = console;
|
|
114
|
+
var p = s.error, w = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
115
|
+
return p.call(
|
|
116
|
+
s,
|
|
117
117
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
118
|
-
|
|
119
|
-
),
|
|
118
|
+
w
|
|
119
|
+
), t(e);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
function l(e) {
|
|
123
|
-
if (e ===
|
|
123
|
+
if (e === b)
|
|
124
124
|
return "<>";
|
|
125
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
125
|
+
if (typeof e == "object" && e !== null && e.$$typeof === y)
|
|
126
126
|
return "<...>";
|
|
127
127
|
try {
|
|
128
|
-
var
|
|
129
|
-
return
|
|
128
|
+
var s = r(e);
|
|
129
|
+
return s ? "<" + s + ">" : "<...>";
|
|
130
130
|
} catch {
|
|
131
131
|
return "<...>";
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
var e =
|
|
134
|
+
function o() {
|
|
135
|
+
var e = i.A;
|
|
136
136
|
return e === null ? null : e.getOwner();
|
|
137
137
|
}
|
|
138
138
|
function u() {
|
|
139
139
|
return Error("react-stack-top-frame");
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
if (
|
|
143
|
-
var
|
|
144
|
-
if (
|
|
141
|
+
function d(e) {
|
|
142
|
+
if (n.call(e, "key")) {
|
|
143
|
+
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
144
|
+
if (s && s.isReactWarning)
|
|
145
145
|
return !1;
|
|
146
146
|
}
|
|
147
147
|
return e.key !== void 0;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
function
|
|
151
|
-
|
|
149
|
+
function T(e, s) {
|
|
150
|
+
function p() {
|
|
151
|
+
f || (f = !0, console.error(
|
|
152
152
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
153
|
-
|
|
153
|
+
s
|
|
154
154
|
));
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
get:
|
|
156
|
+
p.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
157
|
+
get: p,
|
|
158
158
|
configurable: !0
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
var e =
|
|
163
|
-
return
|
|
161
|
+
function W() {
|
|
162
|
+
var e = r(this.type);
|
|
163
|
+
return g[e] || (g[e] = !0, console.error(
|
|
164
164
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
165
165
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
169
|
-
$$typeof:
|
|
167
|
+
function x(e, s, p, w, L, I, ce, se) {
|
|
168
|
+
return p = I.ref, e = {
|
|
169
|
+
$$typeof: A,
|
|
170
170
|
type: e,
|
|
171
|
-
key:
|
|
172
|
-
props:
|
|
173
|
-
_owner:
|
|
174
|
-
}, (
|
|
171
|
+
key: s,
|
|
172
|
+
props: I,
|
|
173
|
+
_owner: L
|
|
174
|
+
}, (p !== void 0 ? p : null) !== null ? Object.defineProperty(e, "ref", {
|
|
175
175
|
enumerable: !1,
|
|
176
|
-
get:
|
|
176
|
+
get: W
|
|
177
177
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
178
178
|
configurable: !1,
|
|
179
179
|
enumerable: !1,
|
|
@@ -188,111 +188,111 @@ function Be() {
|
|
|
188
188
|
configurable: !1,
|
|
189
189
|
enumerable: !1,
|
|
190
190
|
writable: !0,
|
|
191
|
-
value:
|
|
191
|
+
value: ce
|
|
192
192
|
}), Object.defineProperty(e, "_debugTask", {
|
|
193
193
|
configurable: !1,
|
|
194
194
|
enumerable: !1,
|
|
195
195
|
writable: !0,
|
|
196
|
-
value:
|
|
196
|
+
value: se
|
|
197
197
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
var
|
|
201
|
-
if (
|
|
202
|
-
if (
|
|
203
|
-
if (
|
|
204
|
-
for (
|
|
205
|
-
|
|
206
|
-
Object.freeze && Object.freeze(
|
|
199
|
+
function F(e, s, p, w, L, I, ce, se) {
|
|
200
|
+
var v = s.children;
|
|
201
|
+
if (v !== void 0)
|
|
202
|
+
if (w)
|
|
203
|
+
if (h(v)) {
|
|
204
|
+
for (w = 0; w < v.length; w++)
|
|
205
|
+
C(v[w]);
|
|
206
|
+
Object.freeze && Object.freeze(v);
|
|
207
207
|
} else
|
|
208
208
|
console.error(
|
|
209
209
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
210
210
|
);
|
|
211
211
|
else
|
|
212
|
-
|
|
213
|
-
if (
|
|
214
|
-
|
|
215
|
-
var
|
|
216
|
-
return
|
|
212
|
+
C(v);
|
|
213
|
+
if (n.call(s, "key")) {
|
|
214
|
+
v = r(e);
|
|
215
|
+
var D = Object.keys(s).filter(function(ge) {
|
|
216
|
+
return ge !== "key";
|
|
217
217
|
});
|
|
218
|
-
|
|
218
|
+
w = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", j[v + w] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
219
219
|
`A props object containing a "key" prop is being spread into JSX:
|
|
220
220
|
let props = %s;
|
|
221
221
|
<%s {...props} />
|
|
222
222
|
React keys must be passed directly to JSX without using spread:
|
|
223
223
|
let props = %s;
|
|
224
224
|
<%s key={someKey} {...props} />`,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
),
|
|
225
|
+
w,
|
|
226
|
+
v,
|
|
227
|
+
D,
|
|
228
|
+
v
|
|
229
|
+
), j[v + w] = !0);
|
|
230
230
|
}
|
|
231
|
-
if (
|
|
232
|
-
|
|
233
|
-
for (var
|
|
234
|
-
|
|
231
|
+
if (v = null, p !== void 0 && (a(p), v = "" + p), d(s) && (a(s.key), v = "" + s.key), "key" in s) {
|
|
232
|
+
p = {};
|
|
233
|
+
for (var le in s)
|
|
234
|
+
le !== "key" && (p[le] = s[le]);
|
|
235
235
|
} else
|
|
236
|
-
|
|
237
|
-
return
|
|
238
|
-
|
|
236
|
+
p = s;
|
|
237
|
+
return v && T(
|
|
238
|
+
p,
|
|
239
239
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
240
|
-
),
|
|
240
|
+
), x(
|
|
241
241
|
e,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
242
|
+
v,
|
|
243
|
+
I,
|
|
244
|
+
L,
|
|
245
|
+
o(),
|
|
246
|
+
p,
|
|
247
|
+
ce,
|
|
248
|
+
se
|
|
249
249
|
);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
251
|
+
function C(e) {
|
|
252
|
+
typeof e == "object" && e !== null && e.$$typeof === A && e._store && (e._store.validated = 1);
|
|
253
253
|
}
|
|
254
|
-
var
|
|
254
|
+
var R = Oe, A = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), V = Symbol.for("react.profiler"), U = Symbol.for("react.consumer"), B = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), H = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), m = Symbol.for("react.client.reference"), i = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, n = Object.prototype.hasOwnProperty, h = Array.isArray, E = console.createTask ? console.createTask : function() {
|
|
255
255
|
return null;
|
|
256
256
|
};
|
|
257
|
-
|
|
257
|
+
R = {
|
|
258
258
|
"react-stack-bottom-frame": function(e) {
|
|
259
259
|
return e();
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
var
|
|
263
|
-
|
|
262
|
+
var f, g = {}, N = R["react-stack-bottom-frame"].bind(
|
|
263
|
+
R,
|
|
264
264
|
u
|
|
265
|
-
)(),
|
|
266
|
-
Q.Fragment =
|
|
267
|
-
var
|
|
268
|
-
return
|
|
265
|
+
)(), Y = E(l(u)), j = {};
|
|
266
|
+
Q.Fragment = b, Q.jsx = function(e, s, p, w, L) {
|
|
267
|
+
var I = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return F(
|
|
269
269
|
e,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
s,
|
|
271
|
+
p,
|
|
272
272
|
!1,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
w,
|
|
274
|
+
L,
|
|
275
|
+
I ? Error("react-stack-top-frame") : N,
|
|
276
|
+
I ? E(l(e)) : Y
|
|
277
277
|
);
|
|
278
|
-
}, Q.jsxs = function(e,
|
|
279
|
-
var
|
|
280
|
-
return
|
|
278
|
+
}, Q.jsxs = function(e, s, p, w, L) {
|
|
279
|
+
var I = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
280
|
+
return F(
|
|
281
281
|
e,
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
s,
|
|
283
|
+
p,
|
|
284
284
|
!0,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
w,
|
|
286
|
+
L,
|
|
287
|
+
I ? Error("react-stack-top-frame") : N,
|
|
288
|
+
I ? E(l(e)) : Y
|
|
289
289
|
);
|
|
290
290
|
};
|
|
291
291
|
}()), Q;
|
|
292
292
|
}
|
|
293
|
-
process.env.NODE_ENV === "production" ?
|
|
294
|
-
var
|
|
295
|
-
const
|
|
293
|
+
process.env.NODE_ENV === "production" ? de.exports = De() : de.exports = Ke();
|
|
294
|
+
var S = de.exports;
|
|
295
|
+
const qe = {
|
|
296
296
|
errorPillText: "Technical Error",
|
|
297
297
|
errorNotificationTitle: "Technical error",
|
|
298
298
|
errorNotificationSubtitle: "Please reload the page or contact our support.",
|
|
@@ -302,7 +302,7 @@ const Ke = {
|
|
|
302
302
|
connectionErrorTitle: "No connection",
|
|
303
303
|
connectionErrorText: "We couldn’t reach tiun. Check your internet connection and try again.",
|
|
304
304
|
connectionErrorCta: "Try again"
|
|
305
|
-
},
|
|
305
|
+
}, Je = {
|
|
306
306
|
errorPillText: "Erreur Technique",
|
|
307
307
|
errorNotificationTitle: "Erreur technique",
|
|
308
308
|
errorNotificationSubtitle: "Veuillez recharger la page ou contacter notre support.",
|
|
@@ -312,7 +312,7 @@ const Ke = {
|
|
|
312
312
|
connectionErrorTitle: "Pas de connexion",
|
|
313
313
|
connectionErrorText: "Impossible de joindre tiun. Vérifiez votre connexion Internet et réessayez.",
|
|
314
314
|
connectionErrorCta: "Réessayer"
|
|
315
|
-
},
|
|
315
|
+
}, ze = {
|
|
316
316
|
errorPillText: "Technischer Fehler",
|
|
317
317
|
errorNotificationTitle: "Technischer Fehler",
|
|
318
318
|
errorNotificationSubtitle: "Bitte lade die Seite neu, oder kontaktiere unseren Support.",
|
|
@@ -322,7 +322,7 @@ const Ke = {
|
|
|
322
322
|
connectionErrorTitle: "Keine Verbindung",
|
|
323
323
|
connectionErrorText: "tiun konnte nicht erreicht werden. Überprüfe deine Internetverbindung und versuche es erneut.",
|
|
324
324
|
connectionErrorCta: "Erneut versuchen"
|
|
325
|
-
},
|
|
325
|
+
}, Me = {
|
|
326
326
|
errorPillText: "Technischer Fehler",
|
|
327
327
|
errorNotificationTitle: "Technischer Fehler",
|
|
328
328
|
errorNotificationSubtitle: "Bitte laden Sie die Seite neu, oder kontaktieren Sie unseren Support.",
|
|
@@ -333,17 +333,17 @@ const Ke = {
|
|
|
333
333
|
connectionErrorText: "tiun konnte nicht erreicht werden. Überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
|
334
334
|
connectionErrorCta: "Erneut versuchen"
|
|
335
335
|
};
|
|
336
|
-
function
|
|
337
|
-
switch ((
|
|
336
|
+
function Xe(r, t = "informal") {
|
|
337
|
+
switch ((r ?? "en").trim().toLowerCase()) {
|
|
338
338
|
case "de":
|
|
339
|
-
return
|
|
339
|
+
return t === "formal" ? Me : ze;
|
|
340
340
|
case "fr":
|
|
341
|
-
return
|
|
341
|
+
return Je;
|
|
342
342
|
default:
|
|
343
|
-
return
|
|
343
|
+
return qe;
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const q = {
|
|
347
347
|
// Web protocol (TIUN_EVENT) — consumer → snippet commands.
|
|
348
348
|
start: "TIUN_START",
|
|
349
349
|
checkout: "TIUN_CHECKOUT",
|
|
@@ -351,6 +351,7 @@ const D = {
|
|
|
351
351
|
login: "TIUN_LOGIN",
|
|
352
352
|
logout: "TIUN_LOGOUT",
|
|
353
353
|
getVerificationToken: "TIUN_GET_VERIFICATION_TOKEN",
|
|
354
|
+
setAppearance: "TIUN_SET_APPEARANCE",
|
|
354
355
|
// Overlay (TIUN_OVERLAY) — snippet → native footprint signal.
|
|
355
356
|
overlayChange: "TIUN_OVERLAY_CHANGE",
|
|
356
357
|
// Native device bridge (TIUN_NATIVE) — snippet → native requests.
|
|
@@ -364,117 +365,121 @@ const D = {
|
|
|
364
365
|
restoreToken: "TIUN_RESTORE_TOKEN",
|
|
365
366
|
popSignResult: "TIUN_POP_SIGN_RESULT",
|
|
366
367
|
resolveCheckout: "TIUN_RESOLVE_CHECKOUT"
|
|
367
|
-
},
|
|
368
|
-
function fe(
|
|
369
|
-
return (
|
|
368
|
+
}, Qe = "__TIUN_NATIVE_CRYPTO__", Ze = "https://api.tiun.live";
|
|
369
|
+
function fe(r) {
|
|
370
|
+
return (r.host ?? Ze).replace(/\/$/, "");
|
|
370
371
|
}
|
|
371
|
-
function re(
|
|
372
|
-
return `app.tiun.pop.${
|
|
372
|
+
function re(r) {
|
|
373
|
+
return `app.tiun.pop.${r.snippetId || "default"}`;
|
|
373
374
|
}
|
|
374
|
-
function Z(
|
|
375
|
-
return `app.tiun.token.${
|
|
375
|
+
function Z(r) {
|
|
376
|
+
return `app.tiun.token.${r.snippetId || "default"}`;
|
|
376
377
|
}
|
|
377
|
-
function
|
|
378
|
-
return `${`${fe(
|
|
378
|
+
function et(r) {
|
|
379
|
+
return `${`${fe(r)}/live_api/v2/snippets/${encodeURIComponent(r.snippetId)}/webview_return`}?to=${encodeURIComponent(r.returnUrl)}`;
|
|
379
380
|
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
382
|
-
language:
|
|
383
|
-
},
|
|
384
|
-
return
|
|
381
|
+
function tt(r) {
|
|
382
|
+
const t = {
|
|
383
|
+
language: r.language ?? "en"
|
|
384
|
+
}, a = Object.entries(t).map(([o, u]) => `${encodeURIComponent(o)}=${encodeURIComponent(u)}`).join("&"), l = `${fe(r)}/live_api/v2/snippets/${encodeURIComponent(r.snippetId)}/webview_host`;
|
|
385
|
+
return a ? `${l}?${a}` : l;
|
|
385
386
|
}
|
|
386
|
-
function Se(
|
|
387
|
-
const
|
|
388
|
-
if (!(
|
|
389
|
-
for (const
|
|
390
|
-
const l =
|
|
391
|
-
if ((l < 0 ?
|
|
392
|
-
const u = l < 0 ? "" :
|
|
387
|
+
function Se(r) {
|
|
388
|
+
const t = r.indexOf("?");
|
|
389
|
+
if (!(t < 0))
|
|
390
|
+
for (const a of r.slice(t + 1).split("&")) {
|
|
391
|
+
const l = a.indexOf("=");
|
|
392
|
+
if ((l < 0 ? a : a.slice(0, l)) === "status") {
|
|
393
|
+
const u = l < 0 ? "" : a.slice(l + 1);
|
|
393
394
|
return u ? decodeURIComponent(u) : void 0;
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
return
|
|
398
|
+
function rt(r, t) {
|
|
399
|
+
const a = r.returnUrl.split("?")[0];
|
|
400
|
+
return t.startsWith(a);
|
|
400
401
|
}
|
|
401
402
|
const pe = "1005";
|
|
402
|
-
function he(
|
|
403
|
-
return
|
|
403
|
+
function he(r) {
|
|
404
|
+
return r == null ? void 0 : r.code;
|
|
404
405
|
}
|
|
405
|
-
async function
|
|
406
|
+
async function nt(r) {
|
|
406
407
|
try {
|
|
407
|
-
return await me(
|
|
408
|
-
} catch (
|
|
409
|
-
if (he(
|
|
410
|
-
return
|
|
411
|
-
throw
|
|
408
|
+
return await me(r);
|
|
409
|
+
} catch (t) {
|
|
410
|
+
if (he(t) === pe)
|
|
411
|
+
return Be(r, { requireUserAuthentication: !1 });
|
|
412
|
+
throw t;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
|
-
async function
|
|
415
|
+
async function ot(r) {
|
|
415
416
|
try {
|
|
416
|
-
return await me(
|
|
417
|
-
} catch (
|
|
418
|
-
if (he(
|
|
417
|
+
return await me(r);
|
|
418
|
+
} catch (t) {
|
|
419
|
+
if (he(t) === pe)
|
|
419
420
|
return null;
|
|
420
|
-
throw
|
|
421
|
+
throw t;
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
|
-
function
|
|
424
|
-
return
|
|
424
|
+
function it(r, t) {
|
|
425
|
+
return Ge(r, t);
|
|
425
426
|
}
|
|
426
|
-
async function
|
|
427
|
+
async function at(r) {
|
|
427
428
|
try {
|
|
428
|
-
await
|
|
429
|
-
} catch (
|
|
430
|
-
if (he(
|
|
431
|
-
throw
|
|
429
|
+
await He(r);
|
|
430
|
+
} catch (t) {
|
|
431
|
+
if (he(t) !== pe)
|
|
432
|
+
throw t;
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
|
-
const
|
|
435
|
-
async function
|
|
436
|
-
const
|
|
437
|
-
return
|
|
435
|
+
const ct = "tiun_auth_token";
|
|
436
|
+
async function st(r) {
|
|
437
|
+
const t = await ae.getGenericPassword({ service: r });
|
|
438
|
+
return t ? t.password : null;
|
|
438
439
|
}
|
|
439
|
-
async function
|
|
440
|
-
await
|
|
441
|
-
service:
|
|
442
|
-
accessible:
|
|
440
|
+
async function lt(r, t) {
|
|
441
|
+
await ae.setGenericPassword(ct, t, {
|
|
442
|
+
service: r,
|
|
443
|
+
accessible: ae.ACCESSIBLE.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY
|
|
443
444
|
});
|
|
444
445
|
}
|
|
445
|
-
async function
|
|
446
|
-
await
|
|
446
|
+
async function ue(r) {
|
|
447
|
+
await ae.resetGenericPassword({ service: r });
|
|
447
448
|
}
|
|
448
|
-
function ut(
|
|
449
|
-
const
|
|
449
|
+
function ut(r) {
|
|
450
|
+
const t = Xe(r);
|
|
450
451
|
return {
|
|
451
|
-
title:
|
|
452
|
-
text:
|
|
453
|
-
cta:
|
|
452
|
+
title: t.connectionErrorTitle,
|
|
453
|
+
text: t.connectionErrorText,
|
|
454
|
+
cta: t.connectionErrorCta
|
|
454
455
|
};
|
|
455
456
|
}
|
|
456
|
-
function
|
|
457
|
-
const
|
|
458
|
-
return /* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
/* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
457
|
+
function dt({ language: r, dark: t, onRetry: a }) {
|
|
458
|
+
const l = ut(r), o = t ? ft : null;
|
|
459
|
+
return /* @__PURE__ */ S.jsxs(ne, { style: [$.container, o == null ? void 0 : o.container], children: [
|
|
460
|
+
/* @__PURE__ */ S.jsxs(ne, { style: $.content, children: [
|
|
461
|
+
/* @__PURE__ */ S.jsx(te, { style: [$.title, o == null ? void 0 : o.title], children: l.title }),
|
|
462
|
+
/* @__PURE__ */ S.jsx(ne, { style: [$.iconBadge, o == null ? void 0 : o.iconBadge], children: /* @__PURE__ */ S.jsx(te, { style: [$.iconGlyph, o == null ? void 0 : o.iconGlyph], children: "!" }) }),
|
|
463
|
+
/* @__PURE__ */ S.jsx(te, { style: [$.text, o == null ? void 0 : o.text], children: l.text })
|
|
463
464
|
] }),
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ S.jsx(
|
|
465
466
|
Ae,
|
|
466
467
|
{
|
|
467
468
|
accessibilityRole: "button",
|
|
468
|
-
onPress:
|
|
469
|
-
style: ({ pressed:
|
|
470
|
-
|
|
469
|
+
onPress: a,
|
|
470
|
+
style: ({ pressed: u }) => [
|
|
471
|
+
$.button,
|
|
472
|
+
o == null ? void 0 : o.button,
|
|
473
|
+
u && $.buttonPressed
|
|
474
|
+
],
|
|
475
|
+
children: /* @__PURE__ */ S.jsx(te, { style: [$.buttonText, o == null ? void 0 : o.buttonText], children: l.cta })
|
|
471
476
|
}
|
|
472
477
|
)
|
|
473
478
|
] });
|
|
474
479
|
}
|
|
475
|
-
const
|
|
480
|
+
const $ = ie.create({
|
|
476
481
|
container: {
|
|
477
|
-
...
|
|
482
|
+
...ie.absoluteFillObject,
|
|
478
483
|
backgroundColor: "#fff",
|
|
479
484
|
padding: 24,
|
|
480
485
|
justifyContent: "space-between"
|
|
@@ -528,78 +533,93 @@ const C = ue.create({
|
|
|
528
533
|
fontSize: 16,
|
|
529
534
|
fontWeight: "500"
|
|
530
535
|
}
|
|
531
|
-
}),
|
|
532
|
-
|
|
533
|
-
|
|
536
|
+
}), ft = ie.create({
|
|
537
|
+
container: { backgroundColor: "#0a0a0a" },
|
|
538
|
+
title: { color: "#fafafa" },
|
|
539
|
+
iconBadge: { backgroundColor: "#500724" },
|
|
540
|
+
// pink-950
|
|
541
|
+
iconGlyph: { color: "#F472B6" },
|
|
542
|
+
// pink-400
|
|
543
|
+
text: { color: "#A1A1AA" },
|
|
544
|
+
// zinc-400
|
|
545
|
+
button: { backgroundColor: "#fafafa" },
|
|
546
|
+
buttonText: { color: "#000" }
|
|
547
|
+
}), pt = Le;
|
|
548
|
+
function J(r) {
|
|
549
|
+
return `try{window.tiunHost&&${r};}catch(e){}; true;`;
|
|
534
550
|
}
|
|
535
|
-
const
|
|
536
|
-
function({ config:
|
|
537
|
-
const
|
|
538
|
-
var
|
|
539
|
-
|
|
551
|
+
const ht = Ie(
|
|
552
|
+
function({ config: t, onEvent: a }, l) {
|
|
553
|
+
const o = !!t.debug, u = Ue(), d = t.appearance === "dark" || t.appearance === "auto" && u === "dark" ? "dark" : "light", T = P(null), [W, x] = z(!1), [F, C] = z(!1), R = P(!1), A = P(!1), M = () => {
|
|
554
|
+
var i;
|
|
555
|
+
C(!1), (i = T.current) == null || i.reload();
|
|
540
556
|
};
|
|
541
|
-
|
|
542
|
-
if (!
|
|
557
|
+
oe(() => {
|
|
558
|
+
if (!F)
|
|
543
559
|
return;
|
|
544
|
-
const
|
|
545
|
-
var
|
|
546
|
-
n === "active" && (
|
|
560
|
+
const i = je.addEventListener("change", (n) => {
|
|
561
|
+
var h;
|
|
562
|
+
n === "active" && (C(!1), (h = T.current) == null || h.reload());
|
|
547
563
|
});
|
|
548
|
-
return () =>
|
|
549
|
-
}, [
|
|
550
|
-
const
|
|
551
|
-
var
|
|
552
|
-
return (
|
|
553
|
-
|
|
554
|
-
`window.tiunHost.${
|
|
564
|
+
return () => i.remove();
|
|
565
|
+
}, [F]);
|
|
566
|
+
const b = `window.${Qe} = true;window.__TIUN_CONFIG__ = Object.assign({}, window.__TIUN_CONFIG__, { returnUrl: ${JSON.stringify(et(t))}, appearance: ${JSON.stringify(d)} });true;`, k = (i, ...n) => {
|
|
567
|
+
var h;
|
|
568
|
+
return (h = T.current) == null ? void 0 : h.injectJavaScript(
|
|
569
|
+
J(
|
|
570
|
+
`window.tiunHost.${i}(${n.map((E) => JSON.stringify(E) ?? "null").join(",")})`
|
|
555
571
|
)
|
|
556
572
|
);
|
|
557
|
-
},
|
|
573
|
+
}, V = P(d);
|
|
574
|
+
oe(() => {
|
|
575
|
+
d !== V.current && (V.current = d, k("setAppearance", d));
|
|
576
|
+
}, [d]);
|
|
577
|
+
const U = (i) => {
|
|
558
578
|
var n;
|
|
559
|
-
|
|
560
|
-
}),
|
|
561
|
-
}),
|
|
562
|
-
|
|
563
|
-
`window.tiunHost.resolveCheckout(${
|
|
579
|
+
A.current || (A.current = !0, We().catch(() => {
|
|
580
|
+
}), Ve().catch(() => {
|
|
581
|
+
}), x(!0), (n = T.current) == null || n.injectJavaScript(
|
|
582
|
+
J(
|
|
583
|
+
`window.tiunHost.resolveCheckout(${i ? JSON.stringify(i) : ""})`
|
|
564
584
|
)
|
|
565
585
|
));
|
|
566
|
-
},
|
|
567
|
-
var n,
|
|
568
|
-
switch (
|
|
569
|
-
case
|
|
570
|
-
return
|
|
571
|
-
|
|
586
|
+
}, B = (i) => {
|
|
587
|
+
var n, h, E;
|
|
588
|
+
switch (i.type) {
|
|
589
|
+
case q.popPubKeyRequest:
|
|
590
|
+
return nt(re(t)).then((f) => k("popPubKey", f)).catch((f) => {
|
|
591
|
+
o && console.warn("[tiun] ensurePopKey failed:", f), k("popPubKey", null);
|
|
572
592
|
}), !0;
|
|
573
|
-
case
|
|
593
|
+
case q.tokenGet:
|
|
574
594
|
return (async () => {
|
|
575
595
|
try {
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
await
|
|
596
|
+
const f = await st(Z(t));
|
|
597
|
+
if (f && !await ot(re(t))) {
|
|
598
|
+
await ue(Z(t)), k("restoreToken", null);
|
|
579
599
|
return;
|
|
580
600
|
}
|
|
581
|
-
|
|
601
|
+
k("restoreToken", f);
|
|
582
602
|
} catch {
|
|
583
|
-
|
|
603
|
+
k("restoreToken", null);
|
|
584
604
|
}
|
|
585
605
|
})(), !0;
|
|
586
|
-
case
|
|
587
|
-
const
|
|
588
|
-
return
|
|
589
|
-
const
|
|
590
|
-
|
|
606
|
+
case q.popSignRequest: {
|
|
607
|
+
const f = (n = i.payload) == null ? void 0 : n.requestId, g = (h = i.payload) == null ? void 0 : h.information;
|
|
608
|
+
return it(re(t), g).then((N) => k("popSignResult", f, N, null)).catch((N) => {
|
|
609
|
+
const Y = (N == null ? void 0 : N.code) ?? "sign_failed";
|
|
610
|
+
o && console.warn("[tiun] popSign failed:", N), k("popSignResult", f, null, String(Y));
|
|
591
611
|
}), !0;
|
|
592
612
|
}
|
|
593
|
-
case
|
|
594
|
-
const
|
|
595
|
-
return (
|
|
596
|
-
(
|
|
613
|
+
case q.tokenPersist: {
|
|
614
|
+
const f = ((E = i.payload) == null ? void 0 : E.token) ?? null;
|
|
615
|
+
return (f ? lt(Z(t), f) : ue(Z(t))).catch(
|
|
616
|
+
(g) => o && console.warn("[tiun] token persist failed:", g)
|
|
597
617
|
), !0;
|
|
598
618
|
}
|
|
599
|
-
case
|
|
619
|
+
case q.nativeReset:
|
|
600
620
|
return Promise.allSettled([
|
|
601
|
-
|
|
602
|
-
|
|
621
|
+
at(re(t)),
|
|
622
|
+
ue(Z(t))
|
|
603
623
|
]), !0;
|
|
604
624
|
default:
|
|
605
625
|
return !1;
|
|
@@ -609,143 +629,152 @@ const ft = Ce(
|
|
|
609
629
|
l,
|
|
610
630
|
() => ({
|
|
611
631
|
login: () => {
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
|
|
632
|
+
var i;
|
|
633
|
+
x(!0), (i = T.current) == null || i.injectJavaScript(
|
|
634
|
+
J("window.tiunHost.login()")
|
|
615
635
|
);
|
|
616
636
|
},
|
|
617
|
-
checkout: (
|
|
618
|
-
var
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
637
|
+
checkout: (i, n) => {
|
|
638
|
+
var E;
|
|
639
|
+
x(!0), R.current = !0, A.current = !1;
|
|
640
|
+
const h = n ? [i || null, n] : i ? [i] : [];
|
|
641
|
+
(E = T.current) == null || E.injectJavaScript(
|
|
642
|
+
J(
|
|
643
|
+
`window.tiunHost.checkout(${h.map((f) => JSON.stringify(f)).join(",")})`
|
|
622
644
|
)
|
|
623
645
|
);
|
|
624
646
|
},
|
|
625
647
|
logout: () => {
|
|
626
|
-
var
|
|
627
|
-
return (
|
|
628
|
-
|
|
648
|
+
var i;
|
|
649
|
+
return (i = T.current) == null ? void 0 : i.injectJavaScript(
|
|
650
|
+
J("window.tiunHost.logout()")
|
|
629
651
|
);
|
|
630
652
|
},
|
|
631
|
-
getVerificationToken: (
|
|
653
|
+
getVerificationToken: (i) => {
|
|
632
654
|
var n;
|
|
633
|
-
return (n =
|
|
634
|
-
|
|
635
|
-
`window.tiunHost.getVerificationToken(${
|
|
655
|
+
return (n = T.current) == null ? void 0 : n.injectJavaScript(
|
|
656
|
+
J(
|
|
657
|
+
`window.tiunHost.getVerificationToken(${i ? JSON.stringify(i) : ""})`
|
|
636
658
|
)
|
|
637
659
|
);
|
|
638
660
|
},
|
|
639
|
-
resolveCheckout:
|
|
661
|
+
resolveCheckout: U,
|
|
640
662
|
reload: () => {
|
|
641
|
-
var
|
|
642
|
-
return (
|
|
663
|
+
var i;
|
|
664
|
+
return (i = T.current) == null ? void 0 : i.reload();
|
|
643
665
|
}
|
|
644
666
|
}),
|
|
645
667
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
646
668
|
[]
|
|
647
669
|
);
|
|
648
|
-
const
|
|
649
|
-
var
|
|
670
|
+
const G = (i) => {
|
|
671
|
+
var h, E, f;
|
|
650
672
|
let n = null;
|
|
651
673
|
try {
|
|
652
|
-
n = JSON.parse(
|
|
674
|
+
n = JSON.parse(i.nativeEvent.data);
|
|
653
675
|
} catch {
|
|
654
|
-
|
|
676
|
+
o && console.warn(
|
|
655
677
|
"[tiun] non-JSON bridge message:",
|
|
656
|
-
|
|
678
|
+
i.nativeEvent.data
|
|
657
679
|
);
|
|
658
680
|
return;
|
|
659
681
|
}
|
|
660
682
|
if (!(!n || typeof n.type != "string")) {
|
|
661
683
|
if (n.type === "console") {
|
|
662
|
-
|
|
684
|
+
o && console.log(
|
|
663
685
|
"[tiun webview]",
|
|
664
|
-
(
|
|
665
|
-
(
|
|
686
|
+
(h = n.payload) == null ? void 0 : h.level,
|
|
687
|
+
(E = n.payload) == null ? void 0 : E.message
|
|
666
688
|
);
|
|
667
689
|
return;
|
|
668
690
|
}
|
|
669
|
-
if ((n.type === "cryptoCheck" || n.type === "hostBridgeReady") &&
|
|
670
|
-
if (n.type ===
|
|
671
|
-
const
|
|
672
|
-
|
|
691
|
+
if ((n.type === "cryptoCheck" || n.type === "hostBridgeReady") && C(!1), o && console.log("[tiun] <-", n.type, n.payload), !B(n)) {
|
|
692
|
+
if (n.type === q.overlayChange) {
|
|
693
|
+
const g = !!((f = n.payload) != null && f.overlay);
|
|
694
|
+
x(g), g || (R.current = !1);
|
|
673
695
|
}
|
|
674
|
-
|
|
696
|
+
a(n);
|
|
675
697
|
}
|
|
676
698
|
}
|
|
677
|
-
},
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
n.type === "success" && n.url ?
|
|
681
|
-
}).catch((n) =>
|
|
699
|
+
}, H = (i) => {
|
|
700
|
+
if (R.current = !1, Fe.OS === "ios") {
|
|
701
|
+
Ye(i, t.returnUrl).then((n) => {
|
|
702
|
+
n.type === "success" && n.url ? U(Se(n.url)) : n.type === "cancel" && U("cancelled");
|
|
703
|
+
}).catch((n) => o && console.warn("[tiun] openAuth error:", n));
|
|
682
704
|
return;
|
|
683
705
|
}
|
|
684
|
-
be(
|
|
706
|
+
be(i, {
|
|
685
707
|
showTitle: !1,
|
|
686
708
|
enableUrlBarHiding: !1,
|
|
687
709
|
enableDefaultShare: !1,
|
|
688
710
|
forceCloseOnRedirection: !1
|
|
689
711
|
}).then((n) => {
|
|
690
|
-
n.type === "cancel" &&
|
|
712
|
+
n.type === "cancel" && U("cancelled");
|
|
691
713
|
}).catch(
|
|
692
|
-
(n) =>
|
|
714
|
+
(n) => o && console.warn("[tiun] in-app browser open error:", n)
|
|
693
715
|
);
|
|
694
|
-
},
|
|
695
|
-
be(
|
|
716
|
+
}, c = (i) => {
|
|
717
|
+
be(i, {
|
|
696
718
|
modalPresentationStyle: "fullScreen",
|
|
697
719
|
modalEnabled: !0,
|
|
698
720
|
animated: !0,
|
|
699
721
|
enableBarCollapsing: !0
|
|
700
722
|
}).catch(
|
|
701
|
-
(n) =>
|
|
723
|
+
(n) => o && console.warn("[tiun] in-app browser open failed:", n)
|
|
702
724
|
);
|
|
703
|
-
},
|
|
704
|
-
var
|
|
705
|
-
const n = (
|
|
706
|
-
n && (
|
|
707
|
-
},
|
|
708
|
-
const n =
|
|
709
|
-
return n.startsWith(fe(
|
|
710
|
-
}, { width:
|
|
711
|
-
return /* @__PURE__ */
|
|
725
|
+
}, _ = (i) => {
|
|
726
|
+
var h;
|
|
727
|
+
const n = (h = i.nativeEvent) == null ? void 0 : h.targetUrl;
|
|
728
|
+
n && (R.current ? H(n) : c(n));
|
|
729
|
+
}, y = (i) => {
|
|
730
|
+
const n = i.url;
|
|
731
|
+
return n.startsWith(fe(t)) || n.startsWith("about:") || n.startsWith("data:") || n === "about:blank" ? !0 : n.startsWith("http://") || n.startsWith("https://") ? (R.current && i.isTopFrame !== !1 ? H(n) : c(n), !1) : !0;
|
|
732
|
+
}, { width: O, height: m } = $e();
|
|
733
|
+
return /* @__PURE__ */ S.jsxs(
|
|
712
734
|
ne,
|
|
713
735
|
{
|
|
714
|
-
pointerEvents:
|
|
736
|
+
pointerEvents: W ? "auto" : "none",
|
|
715
737
|
style: [
|
|
716
738
|
ee.container,
|
|
717
|
-
{ width:
|
|
718
|
-
|
|
739
|
+
{ width: O, height: m },
|
|
740
|
+
W ? ee.visible : ee.hidden
|
|
719
741
|
],
|
|
720
742
|
children: [
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
|
|
743
|
+
/* @__PURE__ */ S.jsx(
|
|
744
|
+
pt,
|
|
723
745
|
{
|
|
724
|
-
ref:
|
|
725
|
-
source: { uri:
|
|
746
|
+
ref: T,
|
|
747
|
+
source: { uri: tt(t) },
|
|
726
748
|
originWhitelist: ["*"],
|
|
727
|
-
onMessage:
|
|
728
|
-
onShouldStartLoadWithRequest:
|
|
729
|
-
onOpenWindow:
|
|
730
|
-
injectedJavaScriptBeforeContentLoaded:
|
|
749
|
+
onMessage: G,
|
|
750
|
+
onShouldStartLoadWithRequest: y,
|
|
751
|
+
onOpenWindow: _,
|
|
752
|
+
injectedJavaScriptBeforeContentLoaded: b,
|
|
731
753
|
javaScriptEnabled: !0,
|
|
732
754
|
domStorageEnabled: !0,
|
|
733
755
|
style: ee.webview,
|
|
734
756
|
containerStyle: ee.webview,
|
|
735
|
-
onError: (
|
|
736
|
-
|
|
757
|
+
onError: (i) => {
|
|
758
|
+
o && console.warn("[tiun] webview load error:", i.nativeEvent), C(!0);
|
|
737
759
|
},
|
|
738
|
-
onHttpError: (
|
|
739
|
-
|
|
760
|
+
onHttpError: (i) => {
|
|
761
|
+
o && console.warn("[tiun] webview http error:", i.nativeEvent), C(!0);
|
|
740
762
|
}
|
|
741
763
|
}
|
|
742
764
|
),
|
|
743
|
-
|
|
765
|
+
F && W ? /* @__PURE__ */ S.jsx(
|
|
766
|
+
dt,
|
|
767
|
+
{
|
|
768
|
+
language: t.language,
|
|
769
|
+
dark: d === "dark",
|
|
770
|
+
onRetry: M
|
|
771
|
+
}
|
|
772
|
+
) : null
|
|
744
773
|
]
|
|
745
774
|
}
|
|
746
775
|
);
|
|
747
776
|
}
|
|
748
|
-
), ee =
|
|
777
|
+
), ee = ie.create({
|
|
749
778
|
container: {
|
|
750
779
|
position: "absolute",
|
|
751
780
|
top: 0,
|
|
@@ -760,142 +789,142 @@ const ft = Ce(
|
|
|
760
789
|
visible: { opacity: 1 },
|
|
761
790
|
hidden: { opacity: 0 }
|
|
762
791
|
});
|
|
763
|
-
class
|
|
792
|
+
class Tt {
|
|
764
793
|
constructor() {
|
|
765
794
|
Te(this, "listeners", /* @__PURE__ */ new Map());
|
|
766
795
|
}
|
|
767
|
-
on(
|
|
768
|
-
let l = this.listeners.get(
|
|
769
|
-
return l || (l = /* @__PURE__ */ new Set(), this.listeners.set(
|
|
770
|
-
var
|
|
771
|
-
(
|
|
796
|
+
on(t, a) {
|
|
797
|
+
let l = this.listeners.get(t);
|
|
798
|
+
return l || (l = /* @__PURE__ */ new Set(), this.listeners.set(t, l)), l.add(a), () => {
|
|
799
|
+
var o;
|
|
800
|
+
(o = this.listeners.get(t)) == null || o.delete(a);
|
|
772
801
|
};
|
|
773
802
|
}
|
|
774
|
-
emit(
|
|
775
|
-
const l = this.listeners.get(
|
|
803
|
+
emit(t, a) {
|
|
804
|
+
const l = this.listeners.get(t);
|
|
776
805
|
if (l)
|
|
777
|
-
for (const
|
|
806
|
+
for (const o of l)
|
|
778
807
|
try {
|
|
779
|
-
|
|
808
|
+
o(a);
|
|
780
809
|
} catch {
|
|
781
810
|
}
|
|
782
811
|
}
|
|
783
812
|
}
|
|
784
|
-
const Re = ve(null),
|
|
785
|
-
function
|
|
786
|
-
const
|
|
787
|
-
l.current ?
|
|
788
|
-
}, []),
|
|
789
|
-
(
|
|
790
|
-
var
|
|
791
|
-
switch (
|
|
813
|
+
const Re = ve(null), ke = ve(null);
|
|
814
|
+
function mt({ config: r, children: t }) {
|
|
815
|
+
const a = P(null), l = P(!1), o = P([]), u = P(/* @__PURE__ */ new Map()), d = P(new Tt()).current, [T, W] = z(!1), [x, F] = z(null), [C, R] = z(!1), [A, M] = z(null), b = K((c) => {
|
|
816
|
+
l.current ? c() : o.current.push(c);
|
|
817
|
+
}, []), k = K(
|
|
818
|
+
(c) => {
|
|
819
|
+
var _, y, O, m, i, n, h, E, f, g, N, Y;
|
|
820
|
+
switch (c.type) {
|
|
792
821
|
case "cryptoCheck":
|
|
793
|
-
|
|
822
|
+
M(!!((_ = c.payload) != null && _.subtle && ((y = c.payload) != null && y.secureContext)));
|
|
794
823
|
break;
|
|
795
824
|
case "TIUN_SNIPPET_INITIALIZED": {
|
|
796
|
-
l.current = !0,
|
|
797
|
-
const
|
|
798
|
-
|
|
825
|
+
l.current = !0, R(!0), d.emit("ready", void 0);
|
|
826
|
+
const j = o.current;
|
|
827
|
+
o.current = [], j.forEach((e) => e());
|
|
799
828
|
break;
|
|
800
829
|
}
|
|
801
830
|
case "TIUN_USER_CHANGE": {
|
|
802
|
-
const
|
|
803
|
-
|
|
831
|
+
const j = !!((O = c.payload) != null && O.isAuthenticated), e = ((m = c.payload) == null ? void 0 : m.user) ?? null;
|
|
832
|
+
W(j), F(e), d.emit("userChange", { isAuthenticated: j, user: e }), ((i = c.payload) == null ? void 0 : i.userEvent) === "login" && d.emit("login", { user: e }), ((n = c.payload) == null ? void 0 : n.userEvent) === "logout" && d.emit("logout", void 0);
|
|
804
833
|
break;
|
|
805
834
|
}
|
|
806
835
|
case "TIUN_VERIFICATION_TOKEN": {
|
|
807
|
-
const
|
|
808
|
-
e && u.current.has(e) && (u.current.get(e)(
|
|
836
|
+
const j = ((h = c.payload) == null ? void 0 : h.token) ?? null, e = (E = c.payload) == null ? void 0 : E.requestId;
|
|
837
|
+
e && u.current.has(e) && (u.current.get(e)(j), u.current.delete(e));
|
|
809
838
|
break;
|
|
810
839
|
}
|
|
811
840
|
case "TIUN_SHOW_PAYWALL":
|
|
812
|
-
|
|
841
|
+
d.emit("paywallShow", { isConnected: !!((f = c.payload) != null && f.isConnected) });
|
|
813
842
|
break;
|
|
814
843
|
case "TIUN_HIDE_PAYWALL":
|
|
815
|
-
|
|
816
|
-
sessionId: ((
|
|
817
|
-
isConnected: ((
|
|
844
|
+
d.emit("paywallHide", {
|
|
845
|
+
sessionId: ((g = c.payload) == null ? void 0 : g.sessionId) ?? "",
|
|
846
|
+
isConnected: ((N = c.payload) == null ? void 0 : N.isConnected) ?? !0
|
|
818
847
|
});
|
|
819
848
|
break;
|
|
820
849
|
case "TIUN_ERROR":
|
|
821
|
-
|
|
850
|
+
d.emit("error", ((Y = c.payload) == null ? void 0 : Y.error) ?? c.payload ?? {});
|
|
822
851
|
break;
|
|
823
852
|
}
|
|
824
853
|
},
|
|
825
|
-
[
|
|
854
|
+
[d]
|
|
826
855
|
);
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
if (!
|
|
856
|
+
oe(() => {
|
|
857
|
+
const c = (y) => {
|
|
858
|
+
if (!y || !rt(r, y))
|
|
830
859
|
return;
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
var
|
|
834
|
-
return (
|
|
860
|
+
const O = Se(y);
|
|
861
|
+
b(() => {
|
|
862
|
+
var m;
|
|
863
|
+
return (m = a.current) == null ? void 0 : m.resolveCheckout(O);
|
|
835
864
|
});
|
|
836
|
-
},
|
|
837
|
-
return Ee.getInitialURL().then(
|
|
838
|
-
}), () =>
|
|
839
|
-
}, [
|
|
840
|
-
const
|
|
841
|
-
var
|
|
842
|
-
return (
|
|
843
|
-
}), [
|
|
844
|
-
var
|
|
845
|
-
return (
|
|
846
|
-
}), [
|
|
847
|
-
(
|
|
848
|
-
var
|
|
849
|
-
return (
|
|
865
|
+
}, _ = Ee.addEventListener("url", ({ url: y }) => c(y));
|
|
866
|
+
return Ee.getInitialURL().then(c).catch(() => {
|
|
867
|
+
}), () => _.remove();
|
|
868
|
+
}, [r, b]);
|
|
869
|
+
const V = K(() => b(() => {
|
|
870
|
+
var c;
|
|
871
|
+
return (c = a.current) == null ? void 0 : c.login();
|
|
872
|
+
}), [b]), U = K(() => b(() => {
|
|
873
|
+
var c;
|
|
874
|
+
return (c = a.current) == null ? void 0 : c.logout();
|
|
875
|
+
}), [b]), B = K(
|
|
876
|
+
(c) => b(() => {
|
|
877
|
+
var _;
|
|
878
|
+
return (_ = a.current) == null ? void 0 : _.checkout(c == null ? void 0 : c.productId, c == null ? void 0 : c.referenceId);
|
|
850
879
|
}),
|
|
851
|
-
[
|
|
852
|
-
),
|
|
853
|
-
() => new Promise((
|
|
854
|
-
const
|
|
855
|
-
let
|
|
856
|
-
const
|
|
857
|
-
|
|
880
|
+
[b]
|
|
881
|
+
), G = K(
|
|
882
|
+
() => new Promise((c) => {
|
|
883
|
+
const _ = `vt_${Math.random().toString(36).slice(2)}_${Date.now()}`;
|
|
884
|
+
let y = !1;
|
|
885
|
+
const O = (m) => {
|
|
886
|
+
y || (y = !0, u.current.delete(_), c(m));
|
|
858
887
|
};
|
|
859
|
-
u.current.set(
|
|
860
|
-
var
|
|
861
|
-
return (
|
|
862
|
-
}), setTimeout(() =>
|
|
888
|
+
u.current.set(_, O), b(() => {
|
|
889
|
+
var m;
|
|
890
|
+
return (m = a.current) == null ? void 0 : m.getVerificationToken(_);
|
|
891
|
+
}), setTimeout(() => O(null), 5e3);
|
|
863
892
|
}),
|
|
864
|
-
[
|
|
865
|
-
),
|
|
893
|
+
[b]
|
|
894
|
+
), H = xe(
|
|
866
895
|
() => ({
|
|
867
|
-
isAuthenticated:
|
|
868
|
-
user:
|
|
869
|
-
ready:
|
|
870
|
-
cryptoOk:
|
|
871
|
-
login:
|
|
872
|
-
logout:
|
|
873
|
-
checkout:
|
|
874
|
-
getUserVerificationToken:
|
|
896
|
+
isAuthenticated: T,
|
|
897
|
+
user: x,
|
|
898
|
+
ready: C,
|
|
899
|
+
cryptoOk: A,
|
|
900
|
+
login: V,
|
|
901
|
+
logout: U,
|
|
902
|
+
checkout: B,
|
|
903
|
+
getUserVerificationToken: G
|
|
875
904
|
}),
|
|
876
|
-
[
|
|
905
|
+
[T, x, C, A, V, U, B, G]
|
|
877
906
|
);
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
|
|
880
|
-
/* @__PURE__ */
|
|
907
|
+
return /* @__PURE__ */ S.jsx(Re.Provider, { value: H, children: /* @__PURE__ */ S.jsxs(ke.Provider, { value: d, children: [
|
|
908
|
+
t,
|
|
909
|
+
/* @__PURE__ */ S.jsx(ht, { ref: a, config: r, onEvent: k })
|
|
881
910
|
] }) });
|
|
882
911
|
}
|
|
883
|
-
function
|
|
884
|
-
const
|
|
885
|
-
if (!
|
|
912
|
+
function St() {
|
|
913
|
+
const r = _e(Re);
|
|
914
|
+
if (!r)
|
|
886
915
|
throw new Error("useTiun must be used within a <TiunProvider>");
|
|
887
|
-
return
|
|
916
|
+
return r;
|
|
888
917
|
}
|
|
889
|
-
function
|
|
890
|
-
const
|
|
891
|
-
l.current =
|
|
892
|
-
if (!
|
|
918
|
+
function Rt(r, t) {
|
|
919
|
+
const a = _e(ke), l = P(t);
|
|
920
|
+
l.current = t, oe(() => {
|
|
921
|
+
if (!a)
|
|
893
922
|
throw new Error("useTiunEvent must be used within a <TiunProvider>");
|
|
894
|
-
return
|
|
895
|
-
}, [
|
|
923
|
+
return a.on(r, (o) => l.current(o));
|
|
924
|
+
}, [a, r]);
|
|
896
925
|
}
|
|
897
926
|
export {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
927
|
+
mt as TiunProvider,
|
|
928
|
+
St as useTiun,
|
|
929
|
+
Rt as useTiunEvent
|
|
901
930
|
};
|