@tiun/react-native-sdk 0.2.0 → 0.3.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 +8 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +444 -417
- 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
|
|
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 Ie, { forwardRef as Oe, 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 h in o)
|
|
31
|
+
h !== "key" && (u[h] = o[h]);
|
|
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,105 +52,105 @@ 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 === _ ? null : e.displayName || e.name || null;
|
|
62
62
|
if (typeof e == "string")
|
|
63
63
|
return e;
|
|
64
64
|
switch (e) {
|
|
65
|
-
case
|
|
65
|
+
case E:
|
|
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
73
|
case s:
|
|
74
74
|
return "SuspenseList";
|
|
75
|
-
case
|
|
75
|
+
case I:
|
|
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 =
|
|
91
|
-
case
|
|
92
|
-
return
|
|
93
|
-
case
|
|
94
|
-
|
|
88
|
+
case G:
|
|
89
|
+
var c = e.render;
|
|
90
|
+
return e = e.displayName, e || (e = c.displayName || c.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
91
|
+
case v:
|
|
92
|
+
return c = e.displayName || null, c !== null ? c : r(e.type) || "Memo";
|
|
93
|
+
case b:
|
|
94
|
+
c = e._payload, e = e._init;
|
|
95
95
|
try {
|
|
96
|
-
return
|
|
96
|
+
return r(e(c));
|
|
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 c = !1;
|
|
109
109
|
} catch {
|
|
110
|
-
|
|
110
|
+
c = !0;
|
|
111
111
|
}
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
var f =
|
|
112
|
+
if (c) {
|
|
113
|
+
c = console;
|
|
114
|
+
var f = c.error, y = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
115
115
|
return f.call(
|
|
116
|
-
|
|
116
|
+
c,
|
|
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
|
+
y
|
|
119
|
+
), t(e);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
function l(e) {
|
|
123
|
-
if (e ===
|
|
123
|
+
if (e === E)
|
|
124
124
|
return "<>";
|
|
125
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
125
|
+
if (typeof e == "object" && e !== null && e.$$typeof === b)
|
|
126
126
|
return "<...>";
|
|
127
127
|
try {
|
|
128
|
-
var
|
|
129
|
-
return
|
|
128
|
+
var c = r(e);
|
|
129
|
+
return c ? "<" + c + ">" : "<...>";
|
|
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 c = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
144
|
+
if (c && c.isReactWarning)
|
|
145
145
|
return !1;
|
|
146
146
|
}
|
|
147
147
|
return e.key !== void 0;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function h(e, c) {
|
|
150
150
|
function f() {
|
|
151
|
-
|
|
151
|
+
p || (p = !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
|
+
c
|
|
154
154
|
));
|
|
155
155
|
}
|
|
156
156
|
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
@@ -158,22 +158,22 @@ function Be() {
|
|
|
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 f =
|
|
169
|
-
$$typeof:
|
|
167
|
+
function x(e, c, f, y, L, O, ce, se) {
|
|
168
|
+
return f = O.ref, e = {
|
|
169
|
+
$$typeof: A,
|
|
170
170
|
type: e,
|
|
171
|
-
key:
|
|
172
|
-
props:
|
|
173
|
-
_owner:
|
|
171
|
+
key: c,
|
|
172
|
+
props: O,
|
|
173
|
+
_owner: L
|
|
174
174
|
}, (f !== void 0 ? f : 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, c, f, y, L, O, ce, se) {
|
|
200
|
+
var w = c.children;
|
|
201
|
+
if (w !== void 0)
|
|
202
|
+
if (y)
|
|
203
|
+
if (T(w)) {
|
|
204
|
+
for (y = 0; y < w.length; y++)
|
|
205
|
+
C(w[y]);
|
|
206
|
+
Object.freeze && Object.freeze(w);
|
|
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(w);
|
|
213
|
+
if (n.call(c, "key")) {
|
|
214
|
+
w = r(e);
|
|
215
|
+
var D = Object.keys(c).filter(function(ge) {
|
|
216
|
+
return ge !== "key";
|
|
217
217
|
});
|
|
218
|
-
|
|
218
|
+
y = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", j[w + y] || (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
|
+
y,
|
|
226
|
+
w,
|
|
227
|
+
D,
|
|
228
|
+
w
|
|
229
|
+
), j[w + y] = !0);
|
|
230
230
|
}
|
|
231
|
-
if (
|
|
231
|
+
if (w = null, f !== void 0 && (a(f), w = "" + f), d(c) && (a(c.key), w = "" + c.key), "key" in c) {
|
|
232
232
|
f = {};
|
|
233
|
-
for (var
|
|
234
|
-
|
|
233
|
+
for (var le in c)
|
|
234
|
+
le !== "key" && (f[le] = c[le]);
|
|
235
235
|
} else
|
|
236
|
-
f =
|
|
237
|
-
return
|
|
236
|
+
f = c;
|
|
237
|
+
return w && h(
|
|
238
238
|
f,
|
|
239
239
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
240
|
-
),
|
|
240
|
+
), x(
|
|
241
241
|
e,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
w,
|
|
243
|
+
O,
|
|
244
|
+
L,
|
|
245
|
+
o(),
|
|
246
246
|
f,
|
|
247
|
-
|
|
248
|
-
|
|
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 = Ie, A = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), E = 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"), s = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), I = Symbol.for("react.activity"), _ = Symbol.for("react.client.reference"), i = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, n = Object.prototype.hasOwnProperty, T = Array.isArray, m = 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 p, g = {}, N = R["react-stack-bottom-frame"].bind(
|
|
263
|
+
R,
|
|
264
264
|
u
|
|
265
|
-
)(),
|
|
266
|
-
Q.Fragment =
|
|
267
|
-
var
|
|
268
|
-
return
|
|
265
|
+
)(), Y = m(l(u)), j = {};
|
|
266
|
+
Q.Fragment = E, Q.jsx = function(e, c, f, y, L) {
|
|
267
|
+
var O = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return F(
|
|
269
269
|
e,
|
|
270
|
-
|
|
270
|
+
c,
|
|
271
271
|
f,
|
|
272
272
|
!1,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
y,
|
|
274
|
+
L,
|
|
275
|
+
O ? Error("react-stack-top-frame") : N,
|
|
276
|
+
O ? m(l(e)) : Y
|
|
277
277
|
);
|
|
278
|
-
}, Q.jsxs = function(e,
|
|
279
|
-
var
|
|
280
|
-
return
|
|
278
|
+
}, Q.jsxs = function(e, c, f, y, L) {
|
|
279
|
+
var O = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
280
|
+
return F(
|
|
281
281
|
e,
|
|
282
|
-
|
|
282
|
+
c,
|
|
283
283
|
f,
|
|
284
284
|
!0,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
y,
|
|
286
|
+
L,
|
|
287
|
+
O ? Error("react-stack-top-frame") : N,
|
|
288
|
+
O ? m(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 = Oe(
|
|
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", h = P(null), [W, x] = z(!1), [F, C] = z(!1), R = P(!1), A = P(!1), M = () => {
|
|
554
|
+
var i;
|
|
555
|
+
C(!1), (i = h.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 T;
|
|
562
|
+
n === "active" && (C(!1), (T = h.current) == null || T.reload());
|
|
547
563
|
});
|
|
548
|
-
return () =>
|
|
549
|
-
}, [
|
|
550
|
-
const
|
|
551
|
-
var
|
|
552
|
-
return (
|
|
553
|
-
|
|
554
|
-
`window.tiunHost.${
|
|
564
|
+
return () => i.remove();
|
|
565
|
+
}, [F]);
|
|
566
|
+
const E = `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 T;
|
|
568
|
+
return (T = h.current) == null ? void 0 : T.injectJavaScript(
|
|
569
|
+
J(
|
|
570
|
+
`window.tiunHost.${i}(${n.map((m) => JSON.stringify(m) ?? "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 = h.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, T, m;
|
|
588
|
+
switch (i.type) {
|
|
589
|
+
case q.popPubKeyRequest:
|
|
590
|
+
return nt(re(t)).then((p) => k("popPubKey", p)).catch((p) => {
|
|
591
|
+
o && console.warn("[tiun] ensurePopKey failed:", p), k("popPubKey", null);
|
|
572
592
|
}), !0;
|
|
573
|
-
case
|
|
593
|
+
case q.tokenGet:
|
|
574
594
|
return (async () => {
|
|
575
595
|
try {
|
|
576
|
-
const p = await
|
|
577
|
-
if (p && !await
|
|
578
|
-
await
|
|
596
|
+
const p = await st(Z(t));
|
|
597
|
+
if (p && !await ot(re(t))) {
|
|
598
|
+
await ue(Z(t)), k("restoreToken", null);
|
|
579
599
|
return;
|
|
580
600
|
}
|
|
581
|
-
|
|
601
|
+
k("restoreToken", p);
|
|
582
602
|
} catch {
|
|
583
|
-
|
|
603
|
+
k("restoreToken", null);
|
|
584
604
|
}
|
|
585
605
|
})(), !0;
|
|
586
|
-
case
|
|
587
|
-
const p = (n =
|
|
588
|
-
return
|
|
589
|
-
const
|
|
590
|
-
|
|
606
|
+
case q.popSignRequest: {
|
|
607
|
+
const p = (n = i.payload) == null ? void 0 : n.requestId, g = (T = i.payload) == null ? void 0 : T.information;
|
|
608
|
+
return it(re(t), g).then((N) => k("popSignResult", p, 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", p, null, String(Y));
|
|
591
611
|
}), !0;
|
|
592
612
|
}
|
|
593
|
-
case
|
|
594
|
-
const p = ((
|
|
595
|
-
return (p ?
|
|
596
|
-
(
|
|
613
|
+
case q.tokenPersist: {
|
|
614
|
+
const p = ((m = i.payload) == null ? void 0 : m.token) ?? null;
|
|
615
|
+
return (p ? lt(Z(t), p) : 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,150 @@ const ft = Ce(
|
|
|
609
629
|
l,
|
|
610
630
|
() => ({
|
|
611
631
|
login: () => {
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
|
|
632
|
+
var i;
|
|
633
|
+
x(!0), (i = h.current) == null || i.injectJavaScript(
|
|
634
|
+
J("window.tiunHost.login()")
|
|
615
635
|
);
|
|
616
636
|
},
|
|
617
|
-
checkout: (
|
|
637
|
+
checkout: (i) => {
|
|
618
638
|
var n;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
`window.tiunHost.checkout(${
|
|
639
|
+
x(!0), R.current = !0, A.current = !1, (n = h.current) == null || n.injectJavaScript(
|
|
640
|
+
J(
|
|
641
|
+
`window.tiunHost.checkout(${i ? JSON.stringify(i) : ""})`
|
|
622
642
|
)
|
|
623
643
|
);
|
|
624
644
|
},
|
|
625
645
|
logout: () => {
|
|
626
|
-
var
|
|
627
|
-
return (
|
|
628
|
-
|
|
646
|
+
var i;
|
|
647
|
+
return (i = h.current) == null ? void 0 : i.injectJavaScript(
|
|
648
|
+
J("window.tiunHost.logout()")
|
|
629
649
|
);
|
|
630
650
|
},
|
|
631
|
-
getVerificationToken: (
|
|
651
|
+
getVerificationToken: (i) => {
|
|
632
652
|
var n;
|
|
633
|
-
return (n =
|
|
634
|
-
|
|
635
|
-
`window.tiunHost.getVerificationToken(${
|
|
653
|
+
return (n = h.current) == null ? void 0 : n.injectJavaScript(
|
|
654
|
+
J(
|
|
655
|
+
`window.tiunHost.getVerificationToken(${i ? JSON.stringify(i) : ""})`
|
|
636
656
|
)
|
|
637
657
|
);
|
|
638
658
|
},
|
|
639
|
-
resolveCheckout:
|
|
659
|
+
resolveCheckout: U,
|
|
640
660
|
reload: () => {
|
|
641
|
-
var
|
|
642
|
-
return (
|
|
661
|
+
var i;
|
|
662
|
+
return (i = h.current) == null ? void 0 : i.reload();
|
|
643
663
|
}
|
|
644
664
|
}),
|
|
645
665
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
646
666
|
[]
|
|
647
667
|
);
|
|
648
|
-
const
|
|
649
|
-
var
|
|
668
|
+
const G = (i) => {
|
|
669
|
+
var T, m, p;
|
|
650
670
|
let n = null;
|
|
651
671
|
try {
|
|
652
|
-
n = JSON.parse(
|
|
672
|
+
n = JSON.parse(i.nativeEvent.data);
|
|
653
673
|
} catch {
|
|
654
|
-
|
|
674
|
+
o && console.warn(
|
|
655
675
|
"[tiun] non-JSON bridge message:",
|
|
656
|
-
|
|
676
|
+
i.nativeEvent.data
|
|
657
677
|
);
|
|
658
678
|
return;
|
|
659
679
|
}
|
|
660
680
|
if (!(!n || typeof n.type != "string")) {
|
|
661
681
|
if (n.type === "console") {
|
|
662
|
-
|
|
682
|
+
o && console.log(
|
|
663
683
|
"[tiun webview]",
|
|
664
|
-
(
|
|
665
|
-
(
|
|
684
|
+
(T = n.payload) == null ? void 0 : T.level,
|
|
685
|
+
(m = n.payload) == null ? void 0 : m.message
|
|
666
686
|
);
|
|
667
687
|
return;
|
|
668
688
|
}
|
|
669
|
-
if ((n.type === "cryptoCheck" || n.type === "hostBridgeReady") &&
|
|
670
|
-
if (n.type ===
|
|
671
|
-
const
|
|
672
|
-
|
|
689
|
+
if ((n.type === "cryptoCheck" || n.type === "hostBridgeReady") && C(!1), o && console.log("[tiun] <-", n.type, n.payload), !B(n)) {
|
|
690
|
+
if (n.type === q.overlayChange) {
|
|
691
|
+
const g = !!((p = n.payload) != null && p.overlay);
|
|
692
|
+
x(g), g || (R.current = !1);
|
|
673
693
|
}
|
|
674
|
-
|
|
694
|
+
a(n);
|
|
675
695
|
}
|
|
676
696
|
}
|
|
677
|
-
},
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
n.type === "success" && n.url ?
|
|
681
|
-
}).catch((n) =>
|
|
697
|
+
}, H = (i) => {
|
|
698
|
+
if (R.current = !1, Fe.OS === "ios") {
|
|
699
|
+
Ye(i, t.returnUrl).then((n) => {
|
|
700
|
+
n.type === "success" && n.url ? U(Se(n.url)) : n.type === "cancel" && U("cancelled");
|
|
701
|
+
}).catch((n) => o && console.warn("[tiun] openAuth error:", n));
|
|
682
702
|
return;
|
|
683
703
|
}
|
|
684
|
-
be(
|
|
704
|
+
be(i, {
|
|
685
705
|
showTitle: !1,
|
|
686
706
|
enableUrlBarHiding: !1,
|
|
687
707
|
enableDefaultShare: !1,
|
|
688
708
|
forceCloseOnRedirection: !1
|
|
689
709
|
}).then((n) => {
|
|
690
|
-
n.type === "cancel" &&
|
|
710
|
+
n.type === "cancel" && U("cancelled");
|
|
691
711
|
}).catch(
|
|
692
|
-
(n) =>
|
|
712
|
+
(n) => o && console.warn("[tiun] in-app browser open error:", n)
|
|
693
713
|
);
|
|
694
|
-
},
|
|
695
|
-
be(
|
|
714
|
+
}, s = (i) => {
|
|
715
|
+
be(i, {
|
|
696
716
|
modalPresentationStyle: "fullScreen",
|
|
697
717
|
modalEnabled: !0,
|
|
698
718
|
animated: !0,
|
|
699
719
|
enableBarCollapsing: !0
|
|
700
720
|
}).catch(
|
|
701
|
-
(n) =>
|
|
721
|
+
(n) => o && console.warn("[tiun] in-app browser open failed:", n)
|
|
702
722
|
);
|
|
703
|
-
},
|
|
704
|
-
var
|
|
705
|
-
const n = (
|
|
706
|
-
n && (
|
|
707
|
-
},
|
|
708
|
-
const n =
|
|
709
|
-
return n.startsWith(fe(
|
|
710
|
-
}, { width:
|
|
711
|
-
return /* @__PURE__ */
|
|
723
|
+
}, v = (i) => {
|
|
724
|
+
var T;
|
|
725
|
+
const n = (T = i.nativeEvent) == null ? void 0 : T.targetUrl;
|
|
726
|
+
n && (R.current ? H(n) : s(n));
|
|
727
|
+
}, b = (i) => {
|
|
728
|
+
const n = i.url;
|
|
729
|
+
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) : s(n), !1) : !0;
|
|
730
|
+
}, { width: I, height: _ } = $e();
|
|
731
|
+
return /* @__PURE__ */ S.jsxs(
|
|
712
732
|
ne,
|
|
713
733
|
{
|
|
714
|
-
pointerEvents:
|
|
734
|
+
pointerEvents: W ? "auto" : "none",
|
|
715
735
|
style: [
|
|
716
736
|
ee.container,
|
|
717
|
-
{ width:
|
|
718
|
-
|
|
737
|
+
{ width: I, height: _ },
|
|
738
|
+
W ? ee.visible : ee.hidden
|
|
719
739
|
],
|
|
720
740
|
children: [
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
|
|
741
|
+
/* @__PURE__ */ S.jsx(
|
|
742
|
+
pt,
|
|
723
743
|
{
|
|
724
|
-
ref:
|
|
725
|
-
source: { uri:
|
|
744
|
+
ref: h,
|
|
745
|
+
source: { uri: tt(t) },
|
|
726
746
|
originWhitelist: ["*"],
|
|
727
|
-
onMessage:
|
|
728
|
-
onShouldStartLoadWithRequest:
|
|
729
|
-
onOpenWindow:
|
|
730
|
-
injectedJavaScriptBeforeContentLoaded:
|
|
747
|
+
onMessage: G,
|
|
748
|
+
onShouldStartLoadWithRequest: b,
|
|
749
|
+
onOpenWindow: v,
|
|
750
|
+
injectedJavaScriptBeforeContentLoaded: E,
|
|
731
751
|
javaScriptEnabled: !0,
|
|
732
752
|
domStorageEnabled: !0,
|
|
733
753
|
style: ee.webview,
|
|
734
754
|
containerStyle: ee.webview,
|
|
735
|
-
onError: (
|
|
736
|
-
|
|
755
|
+
onError: (i) => {
|
|
756
|
+
o && console.warn("[tiun] webview load error:", i.nativeEvent), C(!0);
|
|
737
757
|
},
|
|
738
|
-
onHttpError: (
|
|
739
|
-
|
|
758
|
+
onHttpError: (i) => {
|
|
759
|
+
o && console.warn("[tiun] webview http error:", i.nativeEvent), C(!0);
|
|
740
760
|
}
|
|
741
761
|
}
|
|
742
762
|
),
|
|
743
|
-
|
|
763
|
+
F && W ? /* @__PURE__ */ S.jsx(
|
|
764
|
+
dt,
|
|
765
|
+
{
|
|
766
|
+
language: t.language,
|
|
767
|
+
dark: d === "dark",
|
|
768
|
+
onRetry: M
|
|
769
|
+
}
|
|
770
|
+
) : null
|
|
744
771
|
]
|
|
745
772
|
}
|
|
746
773
|
);
|
|
747
774
|
}
|
|
748
|
-
), ee =
|
|
775
|
+
), ee = ie.create({
|
|
749
776
|
container: {
|
|
750
777
|
position: "absolute",
|
|
751
778
|
top: 0,
|
|
@@ -760,142 +787,142 @@ const ft = Ce(
|
|
|
760
787
|
visible: { opacity: 1 },
|
|
761
788
|
hidden: { opacity: 0 }
|
|
762
789
|
});
|
|
763
|
-
class
|
|
790
|
+
class Tt {
|
|
764
791
|
constructor() {
|
|
765
792
|
Te(this, "listeners", /* @__PURE__ */ new Map());
|
|
766
793
|
}
|
|
767
|
-
on(
|
|
768
|
-
let l = this.listeners.get(
|
|
769
|
-
return l || (l = /* @__PURE__ */ new Set(), this.listeners.set(
|
|
770
|
-
var
|
|
771
|
-
(
|
|
794
|
+
on(t, a) {
|
|
795
|
+
let l = this.listeners.get(t);
|
|
796
|
+
return l || (l = /* @__PURE__ */ new Set(), this.listeners.set(t, l)), l.add(a), () => {
|
|
797
|
+
var o;
|
|
798
|
+
(o = this.listeners.get(t)) == null || o.delete(a);
|
|
772
799
|
};
|
|
773
800
|
}
|
|
774
|
-
emit(
|
|
775
|
-
const l = this.listeners.get(
|
|
801
|
+
emit(t, a) {
|
|
802
|
+
const l = this.listeners.get(t);
|
|
776
803
|
if (l)
|
|
777
|
-
for (const
|
|
804
|
+
for (const o of l)
|
|
778
805
|
try {
|
|
779
|
-
|
|
806
|
+
o(a);
|
|
780
807
|
} catch {
|
|
781
808
|
}
|
|
782
809
|
}
|
|
783
810
|
}
|
|
784
|
-
const Re = ve(null),
|
|
785
|
-
function
|
|
786
|
-
const
|
|
787
|
-
l.current ? s() :
|
|
788
|
-
}, []),
|
|
811
|
+
const Re = ve(null), ke = ve(null);
|
|
812
|
+
function mt({ config: r, children: t }) {
|
|
813
|
+
const a = P(null), l = P(!1), o = P([]), u = P(/* @__PURE__ */ new Map()), d = P(new Tt()).current, [h, W] = z(!1), [x, F] = z(null), [C, R] = z(!1), [A, M] = z(null), E = K((s) => {
|
|
814
|
+
l.current ? s() : o.current.push(s);
|
|
815
|
+
}, []), k = K(
|
|
789
816
|
(s) => {
|
|
790
|
-
var
|
|
817
|
+
var v, b, I, _, i, n, T, m, p, g, N, Y;
|
|
791
818
|
switch (s.type) {
|
|
792
819
|
case "cryptoCheck":
|
|
793
|
-
|
|
820
|
+
M(!!((v = s.payload) != null && v.subtle && ((b = s.payload) != null && b.secureContext)));
|
|
794
821
|
break;
|
|
795
822
|
case "TIUN_SNIPPET_INITIALIZED": {
|
|
796
|
-
l.current = !0,
|
|
797
|
-
const
|
|
798
|
-
|
|
823
|
+
l.current = !0, R(!0), d.emit("ready", void 0);
|
|
824
|
+
const j = o.current;
|
|
825
|
+
o.current = [], j.forEach((e) => e());
|
|
799
826
|
break;
|
|
800
827
|
}
|
|
801
828
|
case "TIUN_USER_CHANGE": {
|
|
802
|
-
const
|
|
803
|
-
|
|
829
|
+
const j = !!((I = s.payload) != null && I.isAuthenticated), e = ((_ = s.payload) == null ? void 0 : _.user) ?? null;
|
|
830
|
+
W(j), F(e), d.emit("userChange", { isAuthenticated: j, user: e }), ((i = s.payload) == null ? void 0 : i.userEvent) === "login" && d.emit("login", { user: e }), ((n = s.payload) == null ? void 0 : n.userEvent) === "logout" && d.emit("logout", void 0);
|
|
804
831
|
break;
|
|
805
832
|
}
|
|
806
833
|
case "TIUN_VERIFICATION_TOKEN": {
|
|
807
|
-
const
|
|
808
|
-
e && u.current.has(e) && (u.current.get(e)(
|
|
834
|
+
const j = ((T = s.payload) == null ? void 0 : T.token) ?? null, e = (m = s.payload) == null ? void 0 : m.requestId;
|
|
835
|
+
e && u.current.has(e) && (u.current.get(e)(j), u.current.delete(e));
|
|
809
836
|
break;
|
|
810
837
|
}
|
|
811
838
|
case "TIUN_SHOW_PAYWALL":
|
|
812
|
-
|
|
839
|
+
d.emit("paywallShow", { isConnected: !!((p = s.payload) != null && p.isConnected) });
|
|
813
840
|
break;
|
|
814
841
|
case "TIUN_HIDE_PAYWALL":
|
|
815
|
-
|
|
816
|
-
sessionId: ((
|
|
817
|
-
isConnected: ((
|
|
842
|
+
d.emit("paywallHide", {
|
|
843
|
+
sessionId: ((g = s.payload) == null ? void 0 : g.sessionId) ?? "",
|
|
844
|
+
isConnected: ((N = s.payload) == null ? void 0 : N.isConnected) ?? !0
|
|
818
845
|
});
|
|
819
846
|
break;
|
|
820
847
|
case "TIUN_ERROR":
|
|
821
|
-
|
|
848
|
+
d.emit("error", ((Y = s.payload) == null ? void 0 : Y.error) ?? s.payload ?? {});
|
|
822
849
|
break;
|
|
823
850
|
}
|
|
824
851
|
},
|
|
825
|
-
[
|
|
852
|
+
[d]
|
|
826
853
|
);
|
|
827
|
-
|
|
828
|
-
const s = (
|
|
829
|
-
if (!
|
|
854
|
+
oe(() => {
|
|
855
|
+
const s = (b) => {
|
|
856
|
+
if (!b || !rt(r, b))
|
|
830
857
|
return;
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
var
|
|
834
|
-
return (
|
|
858
|
+
const I = Se(b);
|
|
859
|
+
E(() => {
|
|
860
|
+
var _;
|
|
861
|
+
return (_ = a.current) == null ? void 0 : _.resolveCheckout(I);
|
|
835
862
|
});
|
|
836
|
-
},
|
|
863
|
+
}, v = Ee.addEventListener("url", ({ url: b }) => s(b));
|
|
837
864
|
return Ee.getInitialURL().then(s).catch(() => {
|
|
838
|
-
}), () =>
|
|
839
|
-
}, [
|
|
840
|
-
const
|
|
865
|
+
}), () => v.remove();
|
|
866
|
+
}, [r, E]);
|
|
867
|
+
const V = K(() => E(() => {
|
|
841
868
|
var s;
|
|
842
|
-
return (s =
|
|
843
|
-
}), [
|
|
869
|
+
return (s = a.current) == null ? void 0 : s.login();
|
|
870
|
+
}), [E]), U = K(() => E(() => {
|
|
844
871
|
var s;
|
|
845
|
-
return (s =
|
|
846
|
-
}), [
|
|
847
|
-
(s) =>
|
|
848
|
-
var
|
|
849
|
-
return (
|
|
872
|
+
return (s = a.current) == null ? void 0 : s.logout();
|
|
873
|
+
}), [E]), B = K(
|
|
874
|
+
(s) => E(() => {
|
|
875
|
+
var v;
|
|
876
|
+
return (v = a.current) == null ? void 0 : v.checkout(s == null ? void 0 : s.productId);
|
|
850
877
|
}),
|
|
851
|
-
[
|
|
852
|
-
),
|
|
878
|
+
[E]
|
|
879
|
+
), G = K(
|
|
853
880
|
() => new Promise((s) => {
|
|
854
|
-
const
|
|
855
|
-
let
|
|
856
|
-
const
|
|
857
|
-
|
|
881
|
+
const v = `vt_${Math.random().toString(36).slice(2)}_${Date.now()}`;
|
|
882
|
+
let b = !1;
|
|
883
|
+
const I = (_) => {
|
|
884
|
+
b || (b = !0, u.current.delete(v), s(_));
|
|
858
885
|
};
|
|
859
|
-
u.current.set(
|
|
860
|
-
var
|
|
861
|
-
return (
|
|
862
|
-
}), setTimeout(() =>
|
|
886
|
+
u.current.set(v, I), E(() => {
|
|
887
|
+
var _;
|
|
888
|
+
return (_ = a.current) == null ? void 0 : _.getVerificationToken(v);
|
|
889
|
+
}), setTimeout(() => I(null), 5e3);
|
|
863
890
|
}),
|
|
864
|
-
[
|
|
865
|
-
),
|
|
891
|
+
[E]
|
|
892
|
+
), H = xe(
|
|
866
893
|
() => ({
|
|
867
|
-
isAuthenticated:
|
|
868
|
-
user:
|
|
869
|
-
ready:
|
|
870
|
-
cryptoOk:
|
|
871
|
-
login:
|
|
872
|
-
logout:
|
|
873
|
-
checkout:
|
|
874
|
-
getUserVerificationToken:
|
|
894
|
+
isAuthenticated: h,
|
|
895
|
+
user: x,
|
|
896
|
+
ready: C,
|
|
897
|
+
cryptoOk: A,
|
|
898
|
+
login: V,
|
|
899
|
+
logout: U,
|
|
900
|
+
checkout: B,
|
|
901
|
+
getUserVerificationToken: G
|
|
875
902
|
}),
|
|
876
|
-
[
|
|
903
|
+
[h, x, C, A, V, U, B, G]
|
|
877
904
|
);
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
|
|
880
|
-
/* @__PURE__ */
|
|
905
|
+
return /* @__PURE__ */ S.jsx(Re.Provider, { value: H, children: /* @__PURE__ */ S.jsxs(ke.Provider, { value: d, children: [
|
|
906
|
+
t,
|
|
907
|
+
/* @__PURE__ */ S.jsx(ht, { ref: a, config: r, onEvent: k })
|
|
881
908
|
] }) });
|
|
882
909
|
}
|
|
883
|
-
function
|
|
884
|
-
const
|
|
885
|
-
if (!
|
|
910
|
+
function St() {
|
|
911
|
+
const r = _e(Re);
|
|
912
|
+
if (!r)
|
|
886
913
|
throw new Error("useTiun must be used within a <TiunProvider>");
|
|
887
|
-
return
|
|
914
|
+
return r;
|
|
888
915
|
}
|
|
889
|
-
function
|
|
890
|
-
const
|
|
891
|
-
l.current =
|
|
892
|
-
if (!
|
|
916
|
+
function Rt(r, t) {
|
|
917
|
+
const a = _e(ke), l = P(t);
|
|
918
|
+
l.current = t, oe(() => {
|
|
919
|
+
if (!a)
|
|
893
920
|
throw new Error("useTiunEvent must be used within a <TiunProvider>");
|
|
894
|
-
return
|
|
895
|
-
}, [
|
|
921
|
+
return a.on(r, (o) => l.current(o));
|
|
922
|
+
}, [a, r]);
|
|
896
923
|
}
|
|
897
924
|
export {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
925
|
+
mt as TiunProvider,
|
|
926
|
+
St as useTiun,
|
|
927
|
+
Rt as useTiunEvent
|
|
901
928
|
};
|