@moon-x/react-native-sdk 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tron.js CHANGED
@@ -45,11 +45,11 @@ var import_tron = require("@moon-x/core/react/tron");
45
45
 
46
46
  // src/hooks/use-export-key.ts
47
47
  var import_sdk11 = require("@moon-x/core/sdk");
48
- var import_utils6 = require("@moon-x/core/utils");
48
+ var import_utils7 = require("@moon-x/core/utils");
49
49
 
50
50
  // src/provider.tsx
51
- var import_react2 = require("react");
52
- var import_react_native2 = require("react-native");
51
+ var import_react3 = require("react");
52
+ var import_react_native3 = require("react-native");
53
53
  var import_react_native_webview = require("react-native-webview");
54
54
 
55
55
  // src/sdk/create-sdk-instance.ts
@@ -158,100 +158,276 @@ var import_sdk7 = require("@moon-x/core/sdk");
158
158
  var import_sdk8 = require("@moon-x/core/sdk");
159
159
 
160
160
  // src/provider.tsx
161
- var import_utils5 = require("@moon-x/core/utils");
161
+ var import_utils6 = require("@moon-x/core/utils");
162
162
 
163
163
  // src/components/presence-otp-prompt.tsx
164
+ var import_react2 = __toESM(require("react"));
165
+ var import_react_native2 = require("react-native");
166
+ var import_sdk9 = require("@moon-x/core/sdk");
167
+
168
+ // src/components/use-reduce-motion.ts
164
169
  var import_react = require("react");
165
170
  var import_react_native = require("react-native");
166
- var import_sdk9 = require("@moon-x/core/sdk");
171
+
172
+ // src/components/presence-otp-strings.ts
173
+ var import_utils3 = require("@moon-x/core/utils");
174
+
175
+ // src/components/presence-otp-prompt.tsx
167
176
  var import_jsx_runtime = require("react/jsx-runtime");
168
- var styles = import_react_native.StyleSheet.create({
177
+ var styles = import_react_native2.StyleSheet.create({
169
178
  backdrop: {
170
- flex: 1,
179
+ flex: 1
180
+ },
181
+ backdropSheet: {
182
+ justifyContent: "flex-end"
183
+ },
184
+ backdropCentered: {
171
185
  alignItems: "center",
172
186
  justifyContent: "center",
173
- padding: 16,
174
- backgroundColor: "rgba(0, 0, 0, 0.45)"
187
+ padding: 16
175
188
  },
176
189
  card: {
177
190
  width: "100%",
178
- maxWidth: 384,
179
- padding: 24,
180
- borderRadius: 14
191
+ maxHeight: "100%",
192
+ overflow: "hidden"
193
+ },
194
+ sheet: {
195
+ borderTopLeftRadius: 24,
196
+ borderTopRightRadius: 24,
197
+ borderTopWidth: 1
198
+ },
199
+ centered: {
200
+ maxWidth: 400,
201
+ borderRadius: 24,
202
+ borderWidth: 1
203
+ },
204
+ header: {
205
+ flexDirection: "row",
206
+ justifyContent: "flex-end",
207
+ alignItems: "center",
208
+ height: 56,
209
+ paddingHorizontal: 16
210
+ },
211
+ iconButton: {
212
+ width: 32,
213
+ height: 32,
214
+ borderRadius: 8,
215
+ alignItems: "center",
216
+ justifyContent: "center"
217
+ },
218
+ content: {
219
+ paddingHorizontal: 24,
220
+ // Clear of the home indicator when the keyboard is down.
221
+ paddingBottom: 32
222
+ },
223
+ body: {
224
+ gap: 16
225
+ },
226
+ hero: {
227
+ alignItems: "center",
228
+ gap: 16,
229
+ paddingTop: 8
230
+ },
231
+ iconDisc: {
232
+ width: 64,
233
+ height: 64,
234
+ borderRadius: 32,
235
+ alignItems: "center",
236
+ justifyContent: "center"
237
+ },
238
+ heroText: {
239
+ width: "100%",
240
+ gap: 4
181
241
  },
182
242
  title: {
183
243
  fontSize: 20,
184
- fontWeight: "600"
244
+ lineHeight: 24,
245
+ fontWeight: "500",
246
+ letterSpacing: -0.4,
247
+ textAlign: "center"
185
248
  },
186
- body: {
249
+ description: {
187
250
  fontSize: 14,
188
- marginTop: 8
251
+ lineHeight: 20,
252
+ textAlign: "center"
189
253
  },
190
- input: {
191
- marginTop: 16,
192
- paddingVertical: 12,
193
- paddingHorizontal: 16,
254
+ cells: {
255
+ flexDirection: "row",
256
+ alignItems: "center",
257
+ justifyContent: "center",
258
+ gap: 8
259
+ },
260
+ cellsCompact: {
261
+ gap: 6
262
+ },
263
+ cellsBusy: {
264
+ opacity: 0.6
265
+ },
266
+ cell: {
267
+ width: 44,
268
+ height: 52,
269
+ borderWidth: 1,
194
270
  borderRadius: 12,
195
- borderWidth: import_react_native.StyleSheet.hairlineWidth,
196
- fontSize: 24,
197
- letterSpacing: 8,
198
- textAlign: "center"
271
+ alignItems: "center",
272
+ justifyContent: "center"
273
+ },
274
+ cellCompact: {
275
+ width: 38,
276
+ height: 48
277
+ },
278
+ cellText: {
279
+ fontSize: 18,
280
+ fontWeight: "500",
281
+ fontVariant: ["tabular-nums"]
282
+ },
283
+ caret: {
284
+ width: 1.5,
285
+ height: 20,
286
+ borderRadius: 1
287
+ },
288
+ separator: {
289
+ width: 4,
290
+ height: 4,
291
+ borderRadius: 2,
292
+ marginHorizontal: 4,
293
+ opacity: 0.6
294
+ },
295
+ codeInput: {
296
+ position: "absolute",
297
+ top: 0,
298
+ right: 0,
299
+ bottom: 0,
300
+ left: 0,
301
+ // Not 0: iOS stops delivering touches to a view that is fully transparent.
302
+ opacity: 0.015,
303
+ color: "transparent",
304
+ backgroundColor: "transparent",
305
+ borderWidth: 0
199
306
  },
200
307
  error: {
201
- fontSize: 13,
202
- marginTop: 8
308
+ flexDirection: "row",
309
+ alignItems: "center",
310
+ justifyContent: "center",
311
+ gap: 4
203
312
  },
204
- primaryButton: {
205
- marginTop: 16,
206
- paddingVertical: 12,
207
- borderRadius: 12,
208
- alignItems: "center"
313
+ errorText: {
314
+ flexShrink: 1,
315
+ fontSize: 12,
316
+ fontWeight: "500",
317
+ textAlign: "center"
209
318
  },
210
- primaryButtonDisabled: {
211
- opacity: 0.5
319
+ actions: {
320
+ gap: 8,
321
+ paddingTop: 24
212
322
  },
213
- primaryButtonText: {
323
+ button: {
324
+ flexDirection: "row",
325
+ alignItems: "center",
326
+ justifyContent: "center",
327
+ gap: 8,
328
+ height: 48,
329
+ paddingHorizontal: 20,
330
+ borderRadius: 999
331
+ },
332
+ buttonText: {
214
333
  fontSize: 16,
215
- fontWeight: "600"
334
+ fontWeight: "500"
216
335
  },
217
- ghostButton: {
218
- marginTop: 8,
219
- paddingVertical: 12,
220
- alignItems: "center"
336
+ pressed: {
337
+ opacity: 0.88,
338
+ transform: [{ scale: 0.985 }]
221
339
  },
222
- ghostButtonText: {
223
- fontSize: 15,
224
- fontWeight: "500"
340
+ disabled: {
341
+ opacity: 0.5
225
342
  },
226
343
  hint: {
227
344
  fontSize: 12,
228
- marginTop: 4,
345
+ lineHeight: 16,
229
346
  textAlign: "center"
347
+ },
348
+ closeIcon: {
349
+ width: 16,
350
+ height: 16,
351
+ alignItems: "center",
352
+ justifyContent: "center"
353
+ },
354
+ closeBar: {
355
+ position: "absolute",
356
+ width: 12,
357
+ height: 1.5,
358
+ borderRadius: 1
359
+ },
360
+ mailIcon: {
361
+ width: 28,
362
+ height: 28
363
+ },
364
+ mailBody: {
365
+ position: "absolute",
366
+ top: 5,
367
+ left: 2,
368
+ width: 24,
369
+ height: 18,
370
+ borderWidth: 2,
371
+ borderRadius: 3
372
+ },
373
+ mailFlap: {
374
+ position: "absolute",
375
+ top: 10.6,
376
+ width: 13,
377
+ height: 2,
378
+ borderRadius: 1
379
+ },
380
+ mailFlapLeft: {
381
+ left: 2,
382
+ transform: [{ rotate: "29.8deg" }]
383
+ },
384
+ mailFlapRight: {
385
+ left: 13,
386
+ transform: [{ rotate: "-29.8deg" }]
387
+ },
388
+ alertIcon: {
389
+ width: 14,
390
+ height: 14,
391
+ borderRadius: 7,
392
+ borderWidth: 1.25,
393
+ alignItems: "center",
394
+ justifyContent: "center",
395
+ gap: 1
396
+ },
397
+ alertStem: {
398
+ width: 1.5,
399
+ height: 4,
400
+ borderRadius: 1
401
+ },
402
+ alertDot: {
403
+ width: 1.5,
404
+ height: 1.5,
405
+ borderRadius: 1
230
406
  }
231
407
  });
232
408
 
233
409
  // src/transport/webview-bridge.ts
234
- var import_utils3 = require("@moon-x/core/utils");
410
+ var import_utils4 = require("@moon-x/core/utils");
235
411
 
236
412
  // src/provider.tsx
237
- var import_react3 = require("@moon-x/core/react");
413
+ var import_react4 = require("@moon-x/core/react");
238
414
  var import_lib2 = require("@moon-x/core/lib");
239
415
 
240
416
  // src/session-resume.ts
241
417
  var import_sdk10 = require("@moon-x/core/sdk");
242
- var import_utils4 = require("@moon-x/core/utils");
418
+ var import_utils5 = require("@moon-x/core/utils");
243
419
 
244
420
  // src/provider.tsx
245
421
  var import_jsx_runtime2 = require("react/jsx-runtime");
246
- var MoonXContext = (0, import_react2.createContext)(null);
422
+ var MoonXContext = (0, import_react3.createContext)(null);
247
423
  var useMoonXContext = () => {
248
- const ctx = (0, import_react2.useContext)(MoonXContext);
424
+ const ctx = (0, import_react3.useContext)(MoonXContext);
249
425
  if (!ctx) {
250
426
  throw new Error("useMoonX must be used within a MoonXProvider");
251
427
  }
252
428
  return ctx;
253
429
  };
254
- var styles2 = import_react_native2.StyleSheet.create({
430
+ var styles2 = import_react_native3.StyleSheet.create({
255
431
  backdrop: {
256
432
  position: "absolute",
257
433
  top: 0,
@@ -301,7 +477,7 @@ var styles2 = import_react_native2.StyleSheet.create({
301
477
  paddingBottom: 12,
302
478
  paddingHorizontal: 16,
303
479
  backgroundColor: "#0a0a0a",
304
- borderBottomWidth: import_react_native2.StyleSheet.hairlineWidth,
480
+ borderBottomWidth: import_react_native3.StyleSheet.hairlineWidth,
305
481
  borderBottomColor: "#222"
306
482
  },
307
483
  // Empty flex spacer keeps the close button right-aligned without
@@ -366,8 +542,8 @@ var useExportKey = () => {
366
542
  title: "Export key",
367
543
  flowPath: `/export-key?${params.toString()}#${secrets.toString()}`,
368
544
  onMount: ({ bridge, setResult }) => bridge.register(
369
- import_utils6.PostMessageType.WALLET,
370
- import_utils6.PostMessageMethod.EXPORT_KEY_RESULT,
545
+ import_utils7.PostMessageType.WALLET,
546
+ import_utils7.PostMessageMethod.EXPORT_KEY_RESULT,
371
547
  (result) => {
372
548
  setResult(parseExportKeyResult(result));
373
549
  }
package/dist/tron.mjs CHANGED
@@ -18,22 +18,22 @@ import {
18
18
  createContext,
19
19
  useCallback,
20
20
  useContext,
21
- useEffect as useEffect2,
21
+ useEffect as useEffect3,
22
22
  useLayoutEffect,
23
23
  useMemo,
24
24
  useReducer,
25
25
  useRef as useRef2,
26
- useState as useState2,
26
+ useState as useState3,
27
27
  useSyncExternalStore
28
28
  } from "react";
29
29
  import {
30
- Animated,
30
+ Animated as Animated2,
31
31
  AppState,
32
- Platform,
32
+ Platform as Platform2,
33
33
  Pressable as Pressable2,
34
34
  StyleSheet as StyleSheet2,
35
35
  Text as Text2,
36
- useWindowDimensions,
36
+ useWindowDimensions as useWindowDimensions2,
37
37
  View as View2
38
38
  } from "react-native";
39
39
  import { WebView } from "react-native-webview";
@@ -170,79 +170,264 @@ import {
170
170
  import { PostMessageMethod as PostMessageMethod4, PostMessageType as PostMessageType4 } from "@moon-x/core/utils";
171
171
 
172
172
  // src/components/presence-otp-prompt.tsx
173
- import { useEffect, useRef, useState } from "react";
173
+ import React, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
174
174
  import {
175
+ AccessibilityInfo as AccessibilityInfo2,
176
+ ActivityIndicator,
177
+ Animated,
178
+ Easing,
179
+ KeyboardAvoidingView,
175
180
  Modal,
181
+ Platform,
176
182
  Pressable,
183
+ ScrollView,
177
184
  StyleSheet,
178
185
  Text,
179
186
  TextInput,
180
- View
187
+ View,
188
+ useColorScheme,
189
+ useWindowDimensions
181
190
  } from "react-native";
182
191
  import { registerPresenceOtpCodeProvider } from "@moon-x/core/sdk";
192
+
193
+ // src/components/use-reduce-motion.ts
194
+ import { useEffect, useState } from "react";
195
+ import { AccessibilityInfo } from "react-native";
196
+
197
+ // src/components/presence-otp-strings.ts
198
+ import { resolveLanguage } from "@moon-x/core/utils";
199
+
200
+ // src/components/presence-otp-prompt.tsx
183
201
  import { jsx, jsxs } from "react/jsx-runtime";
184
202
  var styles = StyleSheet.create({
185
203
  backdrop: {
186
- flex: 1,
204
+ flex: 1
205
+ },
206
+ backdropSheet: {
207
+ justifyContent: "flex-end"
208
+ },
209
+ backdropCentered: {
187
210
  alignItems: "center",
188
211
  justifyContent: "center",
189
- padding: 16,
190
- backgroundColor: "rgba(0, 0, 0, 0.45)"
212
+ padding: 16
191
213
  },
192
214
  card: {
193
215
  width: "100%",
194
- maxWidth: 384,
195
- padding: 24,
196
- borderRadius: 14
216
+ maxHeight: "100%",
217
+ overflow: "hidden"
218
+ },
219
+ sheet: {
220
+ borderTopLeftRadius: 24,
221
+ borderTopRightRadius: 24,
222
+ borderTopWidth: 1
223
+ },
224
+ centered: {
225
+ maxWidth: 400,
226
+ borderRadius: 24,
227
+ borderWidth: 1
228
+ },
229
+ header: {
230
+ flexDirection: "row",
231
+ justifyContent: "flex-end",
232
+ alignItems: "center",
233
+ height: 56,
234
+ paddingHorizontal: 16
235
+ },
236
+ iconButton: {
237
+ width: 32,
238
+ height: 32,
239
+ borderRadius: 8,
240
+ alignItems: "center",
241
+ justifyContent: "center"
242
+ },
243
+ content: {
244
+ paddingHorizontal: 24,
245
+ // Clear of the home indicator when the keyboard is down.
246
+ paddingBottom: 32
247
+ },
248
+ body: {
249
+ gap: 16
250
+ },
251
+ hero: {
252
+ alignItems: "center",
253
+ gap: 16,
254
+ paddingTop: 8
255
+ },
256
+ iconDisc: {
257
+ width: 64,
258
+ height: 64,
259
+ borderRadius: 32,
260
+ alignItems: "center",
261
+ justifyContent: "center"
262
+ },
263
+ heroText: {
264
+ width: "100%",
265
+ gap: 4
197
266
  },
198
267
  title: {
199
268
  fontSize: 20,
200
- fontWeight: "600"
269
+ lineHeight: 24,
270
+ fontWeight: "500",
271
+ letterSpacing: -0.4,
272
+ textAlign: "center"
201
273
  },
202
- body: {
274
+ description: {
203
275
  fontSize: 14,
204
- marginTop: 8
276
+ lineHeight: 20,
277
+ textAlign: "center"
205
278
  },
206
- input: {
207
- marginTop: 16,
208
- paddingVertical: 12,
209
- paddingHorizontal: 16,
279
+ cells: {
280
+ flexDirection: "row",
281
+ alignItems: "center",
282
+ justifyContent: "center",
283
+ gap: 8
284
+ },
285
+ cellsCompact: {
286
+ gap: 6
287
+ },
288
+ cellsBusy: {
289
+ opacity: 0.6
290
+ },
291
+ cell: {
292
+ width: 44,
293
+ height: 52,
294
+ borderWidth: 1,
210
295
  borderRadius: 12,
211
- borderWidth: StyleSheet.hairlineWidth,
212
- fontSize: 24,
213
- letterSpacing: 8,
214
- textAlign: "center"
296
+ alignItems: "center",
297
+ justifyContent: "center"
298
+ },
299
+ cellCompact: {
300
+ width: 38,
301
+ height: 48
302
+ },
303
+ cellText: {
304
+ fontSize: 18,
305
+ fontWeight: "500",
306
+ fontVariant: ["tabular-nums"]
307
+ },
308
+ caret: {
309
+ width: 1.5,
310
+ height: 20,
311
+ borderRadius: 1
312
+ },
313
+ separator: {
314
+ width: 4,
315
+ height: 4,
316
+ borderRadius: 2,
317
+ marginHorizontal: 4,
318
+ opacity: 0.6
319
+ },
320
+ codeInput: {
321
+ position: "absolute",
322
+ top: 0,
323
+ right: 0,
324
+ bottom: 0,
325
+ left: 0,
326
+ // Not 0: iOS stops delivering touches to a view that is fully transparent.
327
+ opacity: 0.015,
328
+ color: "transparent",
329
+ backgroundColor: "transparent",
330
+ borderWidth: 0
215
331
  },
216
332
  error: {
217
- fontSize: 13,
218
- marginTop: 8
333
+ flexDirection: "row",
334
+ alignItems: "center",
335
+ justifyContent: "center",
336
+ gap: 4
219
337
  },
220
- primaryButton: {
221
- marginTop: 16,
222
- paddingVertical: 12,
223
- borderRadius: 12,
224
- alignItems: "center"
338
+ errorText: {
339
+ flexShrink: 1,
340
+ fontSize: 12,
341
+ fontWeight: "500",
342
+ textAlign: "center"
225
343
  },
226
- primaryButtonDisabled: {
227
- opacity: 0.5
344
+ actions: {
345
+ gap: 8,
346
+ paddingTop: 24
228
347
  },
229
- primaryButtonText: {
348
+ button: {
349
+ flexDirection: "row",
350
+ alignItems: "center",
351
+ justifyContent: "center",
352
+ gap: 8,
353
+ height: 48,
354
+ paddingHorizontal: 20,
355
+ borderRadius: 999
356
+ },
357
+ buttonText: {
230
358
  fontSize: 16,
231
- fontWeight: "600"
359
+ fontWeight: "500"
232
360
  },
233
- ghostButton: {
234
- marginTop: 8,
235
- paddingVertical: 12,
236
- alignItems: "center"
361
+ pressed: {
362
+ opacity: 0.88,
363
+ transform: [{ scale: 0.985 }]
237
364
  },
238
- ghostButtonText: {
239
- fontSize: 15,
240
- fontWeight: "500"
365
+ disabled: {
366
+ opacity: 0.5
241
367
  },
242
368
  hint: {
243
369
  fontSize: 12,
244
- marginTop: 4,
370
+ lineHeight: 16,
245
371
  textAlign: "center"
372
+ },
373
+ closeIcon: {
374
+ width: 16,
375
+ height: 16,
376
+ alignItems: "center",
377
+ justifyContent: "center"
378
+ },
379
+ closeBar: {
380
+ position: "absolute",
381
+ width: 12,
382
+ height: 1.5,
383
+ borderRadius: 1
384
+ },
385
+ mailIcon: {
386
+ width: 28,
387
+ height: 28
388
+ },
389
+ mailBody: {
390
+ position: "absolute",
391
+ top: 5,
392
+ left: 2,
393
+ width: 24,
394
+ height: 18,
395
+ borderWidth: 2,
396
+ borderRadius: 3
397
+ },
398
+ mailFlap: {
399
+ position: "absolute",
400
+ top: 10.6,
401
+ width: 13,
402
+ height: 2,
403
+ borderRadius: 1
404
+ },
405
+ mailFlapLeft: {
406
+ left: 2,
407
+ transform: [{ rotate: "29.8deg" }]
408
+ },
409
+ mailFlapRight: {
410
+ left: 13,
411
+ transform: [{ rotate: "-29.8deg" }]
412
+ },
413
+ alertIcon: {
414
+ width: 14,
415
+ height: 14,
416
+ borderRadius: 7,
417
+ borderWidth: 1.25,
418
+ alignItems: "center",
419
+ justifyContent: "center",
420
+ gap: 1
421
+ },
422
+ alertStem: {
423
+ width: 1.5,
424
+ height: 4,
425
+ borderRadius: 1
426
+ },
427
+ alertDot: {
428
+ width: 1.5,
429
+ height: 1.5,
430
+ borderRadius: 1
246
431
  }
247
432
  });
248
433
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moon-x/react-native-sdk",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "Headless MoonX React Native SDK with WebView-backed transport, native passkeys, and app-owned UI.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",
@@ -63,7 +63,7 @@
63
63
  "vitest": "4.1.0"
64
64
  },
65
65
  "dependencies": {
66
- "@moon-x/core": "0.34.0"
66
+ "@moon-x/core": "0.37.0"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@expo/config-plugins": ">=10.0.0",