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