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