@jazadev/react-native 0.1.0 → 0.1.1
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/index.cjs +407 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +347 -189
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5
5
|
// src/provider/JazaProvider.tsx
|
|
6
6
|
import {
|
|
7
7
|
useCallback as useCallback2,
|
|
8
|
-
useEffect as
|
|
8
|
+
useEffect as useEffect5,
|
|
9
9
|
useMemo as useMemo4,
|
|
10
|
-
useRef as
|
|
10
|
+
useRef as useRef6,
|
|
11
11
|
useState as useState4
|
|
12
12
|
} from "react";
|
|
13
13
|
import { Appearance } from "react-native";
|
|
@@ -264,7 +264,9 @@ var darkTheme = {
|
|
|
264
264
|
overlay: "rgba(12,15,15,0.8)",
|
|
265
265
|
bundleBorder: "#262626",
|
|
266
266
|
bundleBorderSelected: "#2dd4bf",
|
|
267
|
-
bundleBg: "#111111"
|
|
267
|
+
bundleBg: "#111111",
|
|
268
|
+
skeleton: "#2a2c2c",
|
|
269
|
+
skeletonHighlight: "#3a3d3d"
|
|
268
270
|
}
|
|
269
271
|
};
|
|
270
272
|
var lightTheme = {
|
|
@@ -290,8 +292,8 @@ function useJaza() {
|
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
// src/sheet/TopUpBottomSheet.tsx
|
|
293
|
-
import { useCallback, useMemo as useMemo3, useRef as
|
|
294
|
-
import { Modal as Modal3, StyleSheet as
|
|
295
|
+
import { useCallback, useMemo as useMemo3, useRef as useRef5 } from "react";
|
|
296
|
+
import { Modal as Modal3, StyleSheet as StyleSheet12, View as View11 } from "react-native";
|
|
295
297
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
296
298
|
import BottomSheet, {
|
|
297
299
|
BottomSheetBackdrop,
|
|
@@ -301,22 +303,171 @@ import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-
|
|
|
301
303
|
|
|
302
304
|
// src/sheet/steps/OfferStep.tsx
|
|
303
305
|
import {
|
|
304
|
-
ActivityIndicator,
|
|
305
306
|
Pressable,
|
|
306
|
-
StyleSheet,
|
|
307
|
+
StyleSheet as StyleSheet4,
|
|
307
308
|
Text,
|
|
309
|
+
View as View4
|
|
310
|
+
} from "react-native";
|
|
311
|
+
|
|
312
|
+
// src/components/BalanceCardSkeleton.tsx
|
|
313
|
+
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
314
|
+
|
|
315
|
+
// src/components/Skeleton.tsx
|
|
316
|
+
import { useEffect, useRef } from "react";
|
|
317
|
+
import {
|
|
318
|
+
Animated,
|
|
319
|
+
Easing,
|
|
320
|
+
StyleSheet,
|
|
308
321
|
View
|
|
309
322
|
} from "react-native";
|
|
323
|
+
import { jsx } from "react/jsx-runtime";
|
|
324
|
+
function Skeleton({
|
|
325
|
+
theme,
|
|
326
|
+
width = "100%",
|
|
327
|
+
height,
|
|
328
|
+
borderRadius = theme.radius.md,
|
|
329
|
+
style
|
|
330
|
+
}) {
|
|
331
|
+
const pulse = useRef(new Animated.Value(0)).current;
|
|
332
|
+
const { colors } = theme;
|
|
333
|
+
useEffect(() => {
|
|
334
|
+
const loop = Animated.loop(
|
|
335
|
+
Animated.timing(pulse, {
|
|
336
|
+
toValue: 1,
|
|
337
|
+
duration: 1200,
|
|
338
|
+
easing: Easing.inOut(Easing.ease),
|
|
339
|
+
useNativeDriver: true
|
|
340
|
+
})
|
|
341
|
+
);
|
|
342
|
+
loop.start();
|
|
343
|
+
return () => loop.stop();
|
|
344
|
+
}, [pulse]);
|
|
345
|
+
const opacity = pulse.interpolate({
|
|
346
|
+
inputRange: [0, 0.5, 1],
|
|
347
|
+
outputRange: [0.45, 0.85, 0.45]
|
|
348
|
+
});
|
|
349
|
+
const styles = StyleSheet.create({
|
|
350
|
+
block: {
|
|
351
|
+
width,
|
|
352
|
+
height,
|
|
353
|
+
borderRadius,
|
|
354
|
+
backgroundColor: colors.skeleton,
|
|
355
|
+
overflow: "hidden"
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return /* @__PURE__ */ jsx(View, { style: [styles.block, style], children: /* @__PURE__ */ jsx(
|
|
359
|
+
Animated.View,
|
|
360
|
+
{
|
|
361
|
+
style: [StyleSheet.absoluteFill, { backgroundColor: colors.skeletonHighlight, opacity }]
|
|
362
|
+
}
|
|
363
|
+
) });
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/components/BalanceCardSkeleton.tsx
|
|
367
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
368
|
+
function BalanceCardSkeleton({ theme, style }) {
|
|
369
|
+
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
370
|
+
const styles = StyleSheet2.create({
|
|
371
|
+
card: {
|
|
372
|
+
backgroundColor: colors.surfaceContainer,
|
|
373
|
+
borderRadius: radius2.xl,
|
|
374
|
+
padding: spacing2.md
|
|
375
|
+
},
|
|
376
|
+
label: {
|
|
377
|
+
marginBottom: spacing2.xs
|
|
378
|
+
},
|
|
379
|
+
row: {
|
|
380
|
+
flexDirection: "row",
|
|
381
|
+
alignItems: "center",
|
|
382
|
+
gap: spacing2.sm
|
|
383
|
+
},
|
|
384
|
+
icon: {
|
|
385
|
+
width: 28,
|
|
386
|
+
height: 28,
|
|
387
|
+
borderRadius: 14
|
|
388
|
+
},
|
|
389
|
+
value: {
|
|
390
|
+
flex: 1,
|
|
391
|
+
maxWidth: 180
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return /* @__PURE__ */ jsxs(
|
|
395
|
+
View2,
|
|
396
|
+
{
|
|
397
|
+
style: [styles.card, style],
|
|
398
|
+
accessibilityRole: "progressbar",
|
|
399
|
+
accessibilityLabel: "Loading balance",
|
|
400
|
+
children: [
|
|
401
|
+
/* @__PURE__ */ jsx2(
|
|
402
|
+
Skeleton,
|
|
403
|
+
{
|
|
404
|
+
theme,
|
|
405
|
+
width: "42%",
|
|
406
|
+
height: 14,
|
|
407
|
+
borderRadius: 6,
|
|
408
|
+
style: styles.label
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
/* @__PURE__ */ jsxs(View2, { style: styles.row, children: [
|
|
412
|
+
/* @__PURE__ */ jsx2(Skeleton, { theme, style: styles.icon, height: 28, borderRadius: 14 }),
|
|
413
|
+
/* @__PURE__ */ jsx2(Skeleton, { theme, height: 48, borderRadius: 10, style: styles.value })
|
|
414
|
+
] })
|
|
415
|
+
]
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// src/components/BundleListSkeleton.tsx
|
|
421
|
+
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
422
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
423
|
+
function BundleRowSkeleton({ theme }) {
|
|
424
|
+
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
425
|
+
const styles = StyleSheet3.create({
|
|
426
|
+
row: {
|
|
427
|
+
flexDirection: "row",
|
|
428
|
+
alignItems: "center",
|
|
429
|
+
justifyContent: "space-between",
|
|
430
|
+
padding: spacing2.md,
|
|
431
|
+
borderRadius: radius2.xl,
|
|
432
|
+
backgroundColor: colors.bundleBg,
|
|
433
|
+
borderWidth: 1,
|
|
434
|
+
borderColor: colors.bundleBorder,
|
|
435
|
+
marginBottom: spacing2.sm
|
|
436
|
+
},
|
|
437
|
+
left: {
|
|
438
|
+
flex: 1,
|
|
439
|
+
marginRight: spacing2.md,
|
|
440
|
+
gap: spacing2.xs + 2
|
|
441
|
+
},
|
|
442
|
+
right: {
|
|
443
|
+
alignItems: "flex-end",
|
|
444
|
+
gap: spacing2.xs + 2
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
return /* @__PURE__ */ jsxs2(View3, { style: styles.row, children: [
|
|
448
|
+
/* @__PURE__ */ jsxs2(View3, { style: styles.left, children: [
|
|
449
|
+
/* @__PURE__ */ jsx3(Skeleton, { theme, width: "72%", height: 18, borderRadius: 6 }),
|
|
450
|
+
/* @__PURE__ */ jsx3(Skeleton, { theme, width: "48%", height: 14, borderRadius: 6 })
|
|
451
|
+
] }),
|
|
452
|
+
/* @__PURE__ */ jsxs2(View3, { style: styles.right, children: [
|
|
453
|
+
/* @__PURE__ */ jsx3(Skeleton, { theme, width: 56, height: 18, borderRadius: 6 }),
|
|
454
|
+
/* @__PURE__ */ jsx3(Skeleton, { theme, width: 72, height: 12, borderRadius: 4 })
|
|
455
|
+
] })
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
function BundleListSkeleton({ theme, count = 3 }) {
|
|
459
|
+
return /* @__PURE__ */ jsx3(View3, { accessibilityRole: "progressbar", accessibilityLabel: "Loading bundles", children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsx3(BundleRowSkeleton, { theme }, index)) });
|
|
460
|
+
}
|
|
310
461
|
|
|
311
462
|
// src/components/Icon.tsx
|
|
312
463
|
import MaterialIcons from "@expo/vector-icons/MaterialIcons";
|
|
313
|
-
import { jsx } from "react/jsx-runtime";
|
|
464
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
314
465
|
function Icon({ name, size = 24, color }) {
|
|
315
|
-
return /* @__PURE__ */
|
|
466
|
+
return /* @__PURE__ */ jsx4(MaterialIcons, { name, size, color });
|
|
316
467
|
}
|
|
317
468
|
|
|
318
469
|
// src/sheet/steps/OfferStep.tsx
|
|
319
|
-
import { jsx as
|
|
470
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
320
471
|
function OfferStep() {
|
|
321
472
|
const {
|
|
322
473
|
theme,
|
|
@@ -330,7 +481,7 @@ function OfferStep() {
|
|
|
330
481
|
goToPayment
|
|
331
482
|
} = useJaza();
|
|
332
483
|
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
333
|
-
const styles =
|
|
484
|
+
const styles = StyleSheet4.create({
|
|
334
485
|
balanceCard: {
|
|
335
486
|
backgroundColor: colors.surfaceContainer,
|
|
336
487
|
borderRadius: radius2.xl,
|
|
@@ -411,7 +562,6 @@ function OfferStep() {
|
|
|
411
562
|
fontSize: 16,
|
|
412
563
|
fontWeight: "600"
|
|
413
564
|
},
|
|
414
|
-
loading: { padding: spacing2.xl, alignItems: "center" },
|
|
415
565
|
error: {
|
|
416
566
|
color: colors.error,
|
|
417
567
|
fontSize: 14,
|
|
@@ -421,28 +571,28 @@ function OfferStep() {
|
|
|
421
571
|
});
|
|
422
572
|
const renderBundle = (bundle) => {
|
|
423
573
|
const selected = selectedBundle?.id === bundle.id;
|
|
424
|
-
return /* @__PURE__ */
|
|
574
|
+
return /* @__PURE__ */ jsxs3(
|
|
425
575
|
Pressable,
|
|
426
576
|
{
|
|
427
577
|
style: [styles.bundle, selected && styles.bundleSelected],
|
|
428
578
|
onPress: () => setSelectedBundle(bundle),
|
|
429
579
|
children: [
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ jsxs3(View4, { children: [
|
|
581
|
+
/* @__PURE__ */ jsx5(
|
|
432
582
|
Text,
|
|
433
583
|
{
|
|
434
584
|
style: [styles.bundleLabel, selected && styles.bundleLabelSelected],
|
|
435
585
|
children: bundle.label ?? "Bundle"
|
|
436
586
|
}
|
|
437
587
|
),
|
|
438
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ jsxs3(Text, { style: styles.bundleSub, children: [
|
|
439
589
|
formatCredits(bundle.credits),
|
|
440
590
|
" credits"
|
|
441
591
|
] })
|
|
442
592
|
] }),
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ jsxs3(View4, { style: { alignItems: "flex-end" }, children: [
|
|
594
|
+
/* @__PURE__ */ jsx5(Text, { style: styles.bundleCredits, children: formatCredits(bundle.credits) }),
|
|
595
|
+
/* @__PURE__ */ jsxs3(Text, { style: styles.bundlePrice, children: [
|
|
446
596
|
formatUsd(bundle.priceUsd),
|
|
447
597
|
" USD"
|
|
448
598
|
] })
|
|
@@ -452,30 +602,36 @@ function OfferStep() {
|
|
|
452
602
|
bundle.id
|
|
453
603
|
);
|
|
454
604
|
};
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
605
|
+
return /* @__PURE__ */ jsxs3(View4, { children: [
|
|
606
|
+
balanceLoading && balance === null ? /* @__PURE__ */ jsx5(
|
|
607
|
+
BalanceCardSkeleton,
|
|
608
|
+
{
|
|
609
|
+
theme,
|
|
610
|
+
style: { marginBottom: spacing2.lg }
|
|
611
|
+
}
|
|
612
|
+
) : /* @__PURE__ */ jsxs3(View4, { style: styles.balanceCard, children: [
|
|
613
|
+
/* @__PURE__ */ jsx5(Text, { style: styles.balanceLabel, children: "Current Balance" }),
|
|
614
|
+
/* @__PURE__ */ jsxs3(View4, { style: styles.balanceRow, children: [
|
|
615
|
+
/* @__PURE__ */ jsx5(Icon, { name: "bolt", size: 28, color: colors.primary }),
|
|
616
|
+
/* @__PURE__ */ jsx5(Text, { style: styles.balanceValue, children: balance !== null ? formatCredits(balance) : "\u2014" })
|
|
461
617
|
] })
|
|
462
618
|
] }),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
bundlesError ? /* @__PURE__ */
|
|
465
|
-
bundlesLoading ? /* @__PURE__ */
|
|
466
|
-
!bundlesLoading && !bundlesError && bundles.length === 0 ? /* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ jsx5(Text, { style: styles.title, children: "Top-up Credits" }),
|
|
620
|
+
bundlesError ? /* @__PURE__ */ jsx5(Text, { style: styles.error, children: bundlesError }) : null,
|
|
621
|
+
bundlesLoading ? /* @__PURE__ */ jsx5(BundleListSkeleton, { theme }) : bundles.map(renderBundle),
|
|
622
|
+
!bundlesLoading && !bundlesError && bundles.length === 0 ? /* @__PURE__ */ jsx5(Text, { style: styles.error, children: "No active bundles for this app." }) : null,
|
|
623
|
+
/* @__PURE__ */ jsxs3(
|
|
468
624
|
Pressable,
|
|
469
625
|
{
|
|
470
626
|
style: styles.cta,
|
|
471
627
|
onPress: goToPayment,
|
|
472
628
|
disabled: !selectedBundle,
|
|
473
629
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ jsxs3(Text, { style: styles.ctaText, children: [
|
|
475
631
|
"Continue with ",
|
|
476
632
|
selectedBundle?.label ?? "bundle"
|
|
477
633
|
] }),
|
|
478
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ jsx5(Icon, { name: "arrow-forward", size: 20, color: colors.onPrimaryContainer })
|
|
479
635
|
]
|
|
480
636
|
}
|
|
481
637
|
)
|
|
@@ -485,18 +641,18 @@ function OfferStep() {
|
|
|
485
641
|
// src/sheet/steps/PaymentStep.tsx
|
|
486
642
|
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
487
643
|
import {
|
|
488
|
-
ActivityIndicator
|
|
644
|
+
ActivityIndicator,
|
|
489
645
|
Pressable as Pressable5,
|
|
490
|
-
StyleSheet as
|
|
646
|
+
StyleSheet as StyleSheet9,
|
|
491
647
|
Text as Text5,
|
|
492
|
-
View as
|
|
648
|
+
View as View8
|
|
493
649
|
} from "react-native";
|
|
494
650
|
|
|
495
651
|
// src/components/PhoneDigitInput.tsx
|
|
496
|
-
import { useRef, useState } from "react";
|
|
497
|
-
import { Pressable as Pressable2, StyleSheet as
|
|
652
|
+
import { useRef as useRef2, useState } from "react";
|
|
653
|
+
import { Pressable as Pressable2, StyleSheet as StyleSheet5, Text as Text2, View as View5 } from "react-native";
|
|
498
654
|
import { BottomSheetTextInput } from "@gorhom/bottom-sheet";
|
|
499
|
-
import { jsx as
|
|
655
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
500
656
|
var MAX_DIGITS = 10;
|
|
501
657
|
function PhoneDigitInput({
|
|
502
658
|
theme,
|
|
@@ -506,11 +662,11 @@ function PhoneDigitInput({
|
|
|
506
662
|
trailing
|
|
507
663
|
}) {
|
|
508
664
|
const { colors, spacing: spacing2 } = theme;
|
|
509
|
-
const inputRef =
|
|
665
|
+
const inputRef = useRef2(null);
|
|
510
666
|
const [focused, setFocused] = useState(false);
|
|
511
667
|
const digits = value.replace(/\D/g, "").slice(0, MAX_DIGITS);
|
|
512
668
|
const activeIndex = digits.length >= MAX_DIGITS ? MAX_DIGITS - 1 : digits.length;
|
|
513
|
-
const styles =
|
|
669
|
+
const styles = StyleSheet5.create({
|
|
514
670
|
label: {
|
|
515
671
|
color: colors.onSurfaceVariant,
|
|
516
672
|
fontSize: 12,
|
|
@@ -555,14 +711,14 @@ function PhoneDigitInput({
|
|
|
555
711
|
const focusInput = () => {
|
|
556
712
|
inputRef.current?.focus();
|
|
557
713
|
};
|
|
558
|
-
return /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ jsxs4(View5, { children: [
|
|
715
|
+
/* @__PURE__ */ jsx6(Text2, { style: styles.label, children: "Phone Number" }),
|
|
716
|
+
/* @__PURE__ */ jsxs4(Pressable2, { style: styles.row, onPress: focusInput, children: [
|
|
561
717
|
dialPressable,
|
|
562
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ jsx6(View5, { style: styles.slots, pointerEvents: "none", children: Array.from({ length: MAX_DIGITS }, (_, i) => {
|
|
563
719
|
const char = digits[i];
|
|
564
720
|
const isFocused = focused && i === activeIndex;
|
|
565
|
-
return /* @__PURE__ */
|
|
721
|
+
return /* @__PURE__ */ jsx6(View5, { style: styles.slot, children: /* @__PURE__ */ jsx6(
|
|
566
722
|
Text2,
|
|
567
723
|
{
|
|
568
724
|
style: [
|
|
@@ -574,7 +730,7 @@ function PhoneDigitInput({
|
|
|
574
730
|
) }, i);
|
|
575
731
|
}) }),
|
|
576
732
|
trailing,
|
|
577
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ jsx6(
|
|
578
734
|
BottomSheetTextInput,
|
|
579
735
|
{
|
|
580
736
|
ref: inputRef,
|
|
@@ -595,31 +751,31 @@ function PhoneDigitInput({
|
|
|
595
751
|
}
|
|
596
752
|
|
|
597
753
|
// src/sheet/CountryPickerSheet.tsx
|
|
598
|
-
import { useEffect, useMemo, useState as useState2 } from "react";
|
|
754
|
+
import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
599
755
|
import {
|
|
600
756
|
FlatList,
|
|
601
757
|
KeyboardAvoidingView,
|
|
602
758
|
Modal,
|
|
603
759
|
Platform,
|
|
604
760
|
Pressable as Pressable3,
|
|
605
|
-
StyleSheet as
|
|
761
|
+
StyleSheet as StyleSheet7,
|
|
606
762
|
Text as Text3,
|
|
607
763
|
TextInput,
|
|
608
|
-
View as
|
|
764
|
+
View as View6
|
|
609
765
|
} from "react-native";
|
|
610
766
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
611
767
|
|
|
612
768
|
// src/theme/listStyles.ts
|
|
613
|
-
import { StyleSheet as
|
|
769
|
+
import { StyleSheet as StyleSheet6 } from "react-native";
|
|
614
770
|
function createSelectableRowStyles(theme) {
|
|
615
771
|
const { colors, spacing: spacing2 } = theme;
|
|
616
|
-
return
|
|
772
|
+
return StyleSheet6.create({
|
|
617
773
|
row: {
|
|
618
774
|
flexDirection: "row",
|
|
619
775
|
alignItems: "center",
|
|
620
776
|
justifyContent: "space-between",
|
|
621
777
|
paddingVertical: spacing2.md,
|
|
622
|
-
borderBottomWidth:
|
|
778
|
+
borderBottomWidth: StyleSheet6.hairlineWidth,
|
|
623
779
|
borderBottomColor: colors.outlineVariant,
|
|
624
780
|
gap: spacing2.md
|
|
625
781
|
},
|
|
@@ -644,7 +800,7 @@ function createSelectableRowStyles(theme) {
|
|
|
644
800
|
}
|
|
645
801
|
|
|
646
802
|
// src/sheet/CountryPickerSheet.tsx
|
|
647
|
-
import { jsx as
|
|
803
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
648
804
|
function CountryPickerSheet({
|
|
649
805
|
visible,
|
|
650
806
|
onClose
|
|
@@ -654,7 +810,7 @@ function CountryPickerSheet({
|
|
|
654
810
|
const insets = useSafeAreaInsets();
|
|
655
811
|
const [query, setQuery] = useState2("");
|
|
656
812
|
const rowStyles = createSelectableRowStyles(theme);
|
|
657
|
-
|
|
813
|
+
useEffect2(() => {
|
|
658
814
|
if (!visible) setQuery("");
|
|
659
815
|
}, [visible]);
|
|
660
816
|
const filtered = useMemo(() => {
|
|
@@ -664,7 +820,7 @@ function CountryPickerSheet({
|
|
|
664
820
|
(c) => c.name.toLowerCase().includes(q) || c.iso2.toLowerCase().includes(q) || c.dialCode.includes(q)
|
|
665
821
|
);
|
|
666
822
|
}, [countries, query]);
|
|
667
|
-
const styles =
|
|
823
|
+
const styles = StyleSheet7.create({
|
|
668
824
|
root: {
|
|
669
825
|
flex: 1,
|
|
670
826
|
justifyContent: "flex-end",
|
|
@@ -726,23 +882,23 @@ function CountryPickerSheet({
|
|
|
726
882
|
paddingVertical: spacing2.lg
|
|
727
883
|
}
|
|
728
884
|
});
|
|
729
|
-
return /* @__PURE__ */
|
|
885
|
+
return /* @__PURE__ */ jsx7(
|
|
730
886
|
Modal,
|
|
731
887
|
{
|
|
732
888
|
visible,
|
|
733
889
|
transparent: true,
|
|
734
890
|
animationType: "fade",
|
|
735
891
|
onRequestClose: onClose,
|
|
736
|
-
children: /* @__PURE__ */
|
|
892
|
+
children: /* @__PURE__ */ jsxs5(
|
|
737
893
|
KeyboardAvoidingView,
|
|
738
894
|
{
|
|
739
895
|
style: styles.root,
|
|
740
896
|
behavior: Platform.OS === "ios" ? "padding" : void 0,
|
|
741
897
|
children: [
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ jsx7(Pressable3, { style: StyleSheet7.absoluteFill, onPress: onClose }),
|
|
899
|
+
/* @__PURE__ */ jsxs5(View6, { style: styles.sheet, children: [
|
|
900
|
+
/* @__PURE__ */ jsx7(View6, { style: styles.handle }),
|
|
901
|
+
/* @__PURE__ */ jsx7(
|
|
746
902
|
TextInput,
|
|
747
903
|
{
|
|
748
904
|
style: styles.search,
|
|
@@ -756,7 +912,7 @@ function CountryPickerSheet({
|
|
|
756
912
|
returnKeyType: "search"
|
|
757
913
|
}
|
|
758
914
|
),
|
|
759
|
-
/* @__PURE__ */
|
|
915
|
+
/* @__PURE__ */ jsx7(
|
|
760
916
|
FlatList,
|
|
761
917
|
{
|
|
762
918
|
style: styles.list,
|
|
@@ -766,7 +922,7 @@ function CountryPickerSheet({
|
|
|
766
922
|
keyboardDismissMode: "on-drag",
|
|
767
923
|
renderItem: ({ item }) => {
|
|
768
924
|
const selected = selectedCountry?.id === item.id;
|
|
769
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs5(
|
|
770
926
|
Pressable3,
|
|
771
927
|
{
|
|
772
928
|
style: [rowStyles.row, selected && rowStyles.rowSelected],
|
|
@@ -775,9 +931,9 @@ function CountryPickerSheet({
|
|
|
775
931
|
onClose();
|
|
776
932
|
},
|
|
777
933
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ jsxs5(View6, { style: styles.nameRow, children: [
|
|
935
|
+
/* @__PURE__ */ jsx7(Text3, { style: styles.flag, children: item.flag }),
|
|
936
|
+
/* @__PURE__ */ jsx7(
|
|
781
937
|
Text3,
|
|
782
938
|
{
|
|
783
939
|
style: [
|
|
@@ -790,7 +946,7 @@ function CountryPickerSheet({
|
|
|
790
946
|
}
|
|
791
947
|
)
|
|
792
948
|
] }),
|
|
793
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ jsxs5(Text3, { style: styles.dial, children: [
|
|
794
950
|
"+",
|
|
795
951
|
item.dialCode
|
|
796
952
|
] })
|
|
@@ -798,7 +954,7 @@ function CountryPickerSheet({
|
|
|
798
954
|
}
|
|
799
955
|
);
|
|
800
956
|
},
|
|
801
|
-
ListEmptyComponent: /* @__PURE__ */
|
|
957
|
+
ListEmptyComponent: /* @__PURE__ */ jsx7(Text3, { style: styles.empty, children: "No countries match" })
|
|
802
958
|
}
|
|
803
959
|
)
|
|
804
960
|
] })
|
|
@@ -814,12 +970,12 @@ import {
|
|
|
814
970
|
FlatList as FlatList2,
|
|
815
971
|
Modal as Modal2,
|
|
816
972
|
Pressable as Pressable4,
|
|
817
|
-
StyleSheet as
|
|
973
|
+
StyleSheet as StyleSheet8,
|
|
818
974
|
Text as Text4,
|
|
819
|
-
View as
|
|
975
|
+
View as View7
|
|
820
976
|
} from "react-native";
|
|
821
977
|
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
822
|
-
import { jsx as
|
|
978
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
823
979
|
function CurrencyPickerSheet({
|
|
824
980
|
visible,
|
|
825
981
|
currencies,
|
|
@@ -831,7 +987,7 @@ function CurrencyPickerSheet({
|
|
|
831
987
|
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
832
988
|
const insets = useSafeAreaInsets2();
|
|
833
989
|
const rowStyles = createSelectableRowStyles(theme);
|
|
834
|
-
const styles =
|
|
990
|
+
const styles = StyleSheet8.create({
|
|
835
991
|
backdrop: {
|
|
836
992
|
flex: 1,
|
|
837
993
|
backgroundColor: colors.overlay,
|
|
@@ -861,17 +1017,17 @@ function CurrencyPickerSheet({
|
|
|
861
1017
|
marginBottom: spacing2.md
|
|
862
1018
|
}
|
|
863
1019
|
});
|
|
864
|
-
return /* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ jsx8(
|
|
865
1021
|
Modal2,
|
|
866
1022
|
{
|
|
867
1023
|
visible,
|
|
868
1024
|
transparent: true,
|
|
869
1025
|
animationType: "fade",
|
|
870
1026
|
onRequestClose: onClose,
|
|
871
|
-
children: /* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
1027
|
+
children: /* @__PURE__ */ jsx8(Pressable4, { style: styles.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs6(Pressable4, { style: styles.sheet, onPress: (e) => e.stopPropagation(), children: [
|
|
1028
|
+
/* @__PURE__ */ jsx8(View7, { style: styles.handle }),
|
|
1029
|
+
/* @__PURE__ */ jsx8(Text4, { style: styles.title, children: "Select currency" }),
|
|
1030
|
+
/* @__PURE__ */ jsx8(
|
|
875
1031
|
FlatList2,
|
|
876
1032
|
{
|
|
877
1033
|
data: currencies,
|
|
@@ -879,12 +1035,12 @@ function CurrencyPickerSheet({
|
|
|
879
1035
|
keyboardShouldPersistTaps: "handled",
|
|
880
1036
|
renderItem: ({ item }) => {
|
|
881
1037
|
const selected = selectedCode === item.code;
|
|
882
|
-
return /* @__PURE__ */
|
|
1038
|
+
return /* @__PURE__ */ jsx8(
|
|
883
1039
|
Pressable4,
|
|
884
1040
|
{
|
|
885
1041
|
style: [rowStyles.row, selected && rowStyles.rowSelected],
|
|
886
1042
|
onPress: () => onSelect(item.code),
|
|
887
|
-
children: /* @__PURE__ */
|
|
1043
|
+
children: /* @__PURE__ */ jsx8(
|
|
888
1044
|
Text4,
|
|
889
1045
|
{
|
|
890
1046
|
style: [rowStyles.label, selected && rowStyles.labelSelected],
|
|
@@ -902,7 +1058,7 @@ function CurrencyPickerSheet({
|
|
|
902
1058
|
}
|
|
903
1059
|
|
|
904
1060
|
// src/sheet/steps/PaymentStep.tsx
|
|
905
|
-
import { jsx as
|
|
1061
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
906
1062
|
function PaymentStep() {
|
|
907
1063
|
const {
|
|
908
1064
|
theme,
|
|
@@ -934,7 +1090,7 @@ function PaymentStep() {
|
|
|
934
1090
|
const showCurrencyPicker = currencyOptions.length > 1;
|
|
935
1091
|
const formattedQuote = quote ? formatCurrencyAmount(quote.totalLocal, quote.currencyCode) : null;
|
|
936
1092
|
const buyLabel = quote ? `Buy ${formattedQuote}` : quoteLoading ? "Loading\u2026" : selectedBundle ? `Buy ${formatUsd(selectedBundle.priceUsd)}` : "Buy";
|
|
937
|
-
const styles =
|
|
1093
|
+
const styles = StyleSheet9.create({
|
|
938
1094
|
header: {
|
|
939
1095
|
flexDirection: "row",
|
|
940
1096
|
alignItems: "center",
|
|
@@ -1047,78 +1203,78 @@ function PaymentStep() {
|
|
|
1047
1203
|
}
|
|
1048
1204
|
});
|
|
1049
1205
|
const canSubmit = !!predict && !!quote && !quoteLoading && !predictLoading && phoneNational.replace(/\D/g, "").length >= 6;
|
|
1050
|
-
return /* @__PURE__ */
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1206
|
+
return /* @__PURE__ */ jsxs7(View8, { children: [
|
|
1207
|
+
/* @__PURE__ */ jsxs7(View8, { style: styles.header, children: [
|
|
1208
|
+
/* @__PURE__ */ jsxs7(View8, { style: styles.headerLeft, children: [
|
|
1209
|
+
/* @__PURE__ */ jsx9(Pressable5, { style: styles.backBtn, onPress: goToOffer, children: /* @__PURE__ */ jsx9(Icon, { name: "arrow-back", size: 22, color: colors.onSurfaceVariant }) }),
|
|
1210
|
+
/* @__PURE__ */ jsx9(Text5, { style: styles.headerTitle, numberOfLines: 1, children: selectedBundle?.label ?? "Top-up Balance" })
|
|
1055
1211
|
] }),
|
|
1056
|
-
balance !== null ? /* @__PURE__ */
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1212
|
+
balance !== null ? /* @__PURE__ */ jsxs7(View8, { style: styles.balanceChip, children: [
|
|
1213
|
+
/* @__PURE__ */ jsx9(Icon, { name: "bolt", size: 16, color: colors.primary }),
|
|
1214
|
+
/* @__PURE__ */ jsx9(Text5, { style: styles.balanceChipText, children: balance.toLocaleString() })
|
|
1059
1215
|
] }) : null
|
|
1060
1216
|
] }),
|
|
1061
|
-
/* @__PURE__ */
|
|
1217
|
+
/* @__PURE__ */ jsx9(
|
|
1062
1218
|
PhoneDigitInput,
|
|
1063
1219
|
{
|
|
1064
1220
|
theme,
|
|
1065
1221
|
value: phoneNational,
|
|
1066
1222
|
onChangeText: setPhoneNational,
|
|
1067
|
-
dialPressable: /* @__PURE__ */
|
|
1223
|
+
dialPressable: /* @__PURE__ */ jsxs7(
|
|
1068
1224
|
Pressable5,
|
|
1069
1225
|
{
|
|
1070
1226
|
style: styles.dialBtn,
|
|
1071
1227
|
onPress: () => setCountryPickerOpen(true),
|
|
1072
1228
|
children: [
|
|
1073
|
-
/* @__PURE__ */
|
|
1229
|
+
/* @__PURE__ */ jsxs7(Text5, { style: styles.dialText, children: [
|
|
1074
1230
|
"+",
|
|
1075
1231
|
selectedCountry?.dialCode ?? "\u2026"
|
|
1076
1232
|
] }),
|
|
1077
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsx9(Icon, { name: "expand-more", size: 24, color: colors.primaryContainer })
|
|
1078
1234
|
]
|
|
1079
1235
|
}
|
|
1080
1236
|
),
|
|
1081
|
-
trailing: predict && !predictLoading ? /* @__PURE__ */
|
|
1237
|
+
trailing: predict && !predictLoading ? /* @__PURE__ */ jsx9(Icon, { name: "check-circle", size: 24, color: colors.primary }) : predictLoading ? /* @__PURE__ */ jsx9(ActivityIndicator, { color: colors.primary, size: "small" }) : null
|
|
1082
1238
|
}
|
|
1083
1239
|
),
|
|
1084
|
-
predict ? /* @__PURE__ */
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
showCurrencyPicker ? /* @__PURE__ */
|
|
1240
|
+
predict ? /* @__PURE__ */ jsx9(Text5, { style: styles.providerText, children: predict.provider.displayName }) : predictError ? /* @__PURE__ */ jsx9(Text5, { style: styles.providerError, children: predictError }) : null,
|
|
1241
|
+
/* @__PURE__ */ jsxs7(View8, { style: styles.payCard, children: [
|
|
1242
|
+
/* @__PURE__ */ jsxs7(View8, { style: styles.payRow, children: [
|
|
1243
|
+
showCurrencyPicker ? /* @__PURE__ */ jsxs7(
|
|
1088
1244
|
Pressable5,
|
|
1089
1245
|
{
|
|
1090
1246
|
style: styles.currencyBtn,
|
|
1091
1247
|
onPress: () => setCurrencyPickerOpen(true),
|
|
1092
1248
|
children: [
|
|
1093
|
-
/* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsx9(Text5, { style: styles.currencyCode, children: selectedCurrencyCode ?? "\u2014" }),
|
|
1250
|
+
/* @__PURE__ */ jsx9(Icon, { name: "expand-more", size: 20, color: colors.primaryContainer })
|
|
1095
1251
|
]
|
|
1096
1252
|
}
|
|
1097
|
-
) : /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1253
|
+
) : /* @__PURE__ */ jsx9(Text5, { style: styles.currencyCode, children: selectedCurrencyCode ?? quote?.currencyCode ?? "USD" }),
|
|
1254
|
+
/* @__PURE__ */ jsx9(Text5, { style: styles.amountText, children: formattedQuote ?? (selectedBundle ? formatUsd(selectedBundle.priceUsd) : "\u2014") })
|
|
1099
1255
|
] }),
|
|
1100
|
-
quoteError ? /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1256
|
+
quoteError ? /* @__PURE__ */ jsx9(Text5, { style: styles.quoteError, children: quoteError }) : null,
|
|
1257
|
+
/* @__PURE__ */ jsxs7(
|
|
1102
1258
|
Pressable5,
|
|
1103
1259
|
{
|
|
1104
1260
|
style: [styles.cta, !canSubmit && styles.ctaDisabled],
|
|
1105
1261
|
onPress: () => void submitDeposit(),
|
|
1106
1262
|
disabled: !canSubmit,
|
|
1107
1263
|
children: [
|
|
1108
|
-
/* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ jsx9(Icon, { name: "lock", size: 18, color: colors.onPrimaryContainer }),
|
|
1265
|
+
/* @__PURE__ */ jsx9(Text5, { style: styles.ctaText, children: buyLabel })
|
|
1110
1266
|
]
|
|
1111
1267
|
}
|
|
1112
1268
|
)
|
|
1113
1269
|
] }),
|
|
1114
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ jsx9(
|
|
1115
1271
|
CountryPickerSheet,
|
|
1116
1272
|
{
|
|
1117
1273
|
visible: countryPickerOpen,
|
|
1118
1274
|
onClose: () => setCountryPickerOpen(false)
|
|
1119
1275
|
}
|
|
1120
1276
|
),
|
|
1121
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ jsx9(
|
|
1122
1278
|
CurrencyPickerSheet,
|
|
1123
1279
|
{
|
|
1124
1280
|
visible: currencyPickerOpen,
|
|
@@ -1135,31 +1291,31 @@ function PaymentStep() {
|
|
|
1135
1291
|
}
|
|
1136
1292
|
|
|
1137
1293
|
// src/sheet/steps/ResultStep.tsx
|
|
1138
|
-
import { useEffect as
|
|
1294
|
+
import { useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
1139
1295
|
import {
|
|
1140
|
-
Animated as
|
|
1296
|
+
Animated as Animated3,
|
|
1141
1297
|
Pressable as Pressable6,
|
|
1142
|
-
StyleSheet as
|
|
1298
|
+
StyleSheet as StyleSheet11,
|
|
1143
1299
|
Text as Text6,
|
|
1144
|
-
View as
|
|
1300
|
+
View as View10
|
|
1145
1301
|
} from "react-native";
|
|
1146
1302
|
|
|
1147
1303
|
// src/components/ProcessingSpinner.tsx
|
|
1148
|
-
import { useEffect as
|
|
1149
|
-
import { Animated, Easing, StyleSheet as
|
|
1150
|
-
import { jsx as
|
|
1304
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
1305
|
+
import { Animated as Animated2, Easing as Easing2, StyleSheet as StyleSheet10, View as View9 } from "react-native";
|
|
1306
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1151
1307
|
function ProcessingSpinner({
|
|
1152
1308
|
theme,
|
|
1153
1309
|
size = 64
|
|
1154
1310
|
}) {
|
|
1155
1311
|
const { colors } = theme;
|
|
1156
|
-
const spin =
|
|
1157
|
-
|
|
1158
|
-
const loop =
|
|
1159
|
-
|
|
1312
|
+
const spin = useRef3(new Animated2.Value(0)).current;
|
|
1313
|
+
useEffect3(() => {
|
|
1314
|
+
const loop = Animated2.loop(
|
|
1315
|
+
Animated2.timing(spin, {
|
|
1160
1316
|
toValue: 1,
|
|
1161
1317
|
duration: 900,
|
|
1162
|
-
easing:
|
|
1318
|
+
easing: Easing2.linear,
|
|
1163
1319
|
useNativeDriver: true
|
|
1164
1320
|
})
|
|
1165
1321
|
);
|
|
@@ -1172,7 +1328,7 @@ function ProcessingSpinner({
|
|
|
1172
1328
|
});
|
|
1173
1329
|
const ring = size;
|
|
1174
1330
|
const stroke = 4;
|
|
1175
|
-
const styles =
|
|
1331
|
+
const styles = StyleSheet10.create({
|
|
1176
1332
|
wrap: {
|
|
1177
1333
|
width: ring,
|
|
1178
1334
|
height: ring,
|
|
@@ -1194,14 +1350,14 @@ function ProcessingSpinner({
|
|
|
1194
1350
|
justifyContent: "center"
|
|
1195
1351
|
}
|
|
1196
1352
|
});
|
|
1197
|
-
return /* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ jsxs8(View9, { style: styles.wrap, children: [
|
|
1354
|
+
/* @__PURE__ */ jsx10(Animated2.View, { style: [styles.ring, { transform: [{ rotate }] }] }),
|
|
1355
|
+
/* @__PURE__ */ jsx10(View9, { style: styles.icon, children: /* @__PURE__ */ jsx10(Icon, { name: "lock", size: Math.round(size * 0.38), color: colors.primary }) })
|
|
1200
1356
|
] });
|
|
1201
1357
|
}
|
|
1202
1358
|
|
|
1203
1359
|
// src/sheet/steps/ResultStep.tsx
|
|
1204
|
-
import { jsx as
|
|
1360
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1205
1361
|
function ResultStep() {
|
|
1206
1362
|
const {
|
|
1207
1363
|
theme,
|
|
@@ -1214,18 +1370,18 @@ function ResultStep() {
|
|
|
1214
1370
|
retryPayment
|
|
1215
1371
|
} = useJaza();
|
|
1216
1372
|
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
1217
|
-
const scale =
|
|
1218
|
-
|
|
1373
|
+
const scale = useRef4(new Animated3.Value(0)).current;
|
|
1374
|
+
useEffect4(() => {
|
|
1219
1375
|
if (resultPhase === "success") {
|
|
1220
1376
|
scale.setValue(0);
|
|
1221
|
-
|
|
1377
|
+
Animated3.spring(scale, {
|
|
1222
1378
|
toValue: 1,
|
|
1223
1379
|
useNativeDriver: true,
|
|
1224
1380
|
friction: 6
|
|
1225
1381
|
}).start();
|
|
1226
1382
|
}
|
|
1227
1383
|
}, [resultPhase, scale]);
|
|
1228
|
-
const styles =
|
|
1384
|
+
const styles = StyleSheet11.create({
|
|
1229
1385
|
container: {
|
|
1230
1386
|
alignItems: "center",
|
|
1231
1387
|
paddingVertical: spacing2.xl
|
|
@@ -1293,43 +1449,43 @@ function ResultStep() {
|
|
|
1293
1449
|
}
|
|
1294
1450
|
});
|
|
1295
1451
|
if (resultPhase === "loading") {
|
|
1296
|
-
return /* @__PURE__ */
|
|
1297
|
-
/* @__PURE__ */
|
|
1298
|
-
/* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1452
|
+
return /* @__PURE__ */ jsxs9(View10, { style: styles.container, children: [
|
|
1453
|
+
/* @__PURE__ */ jsx11(View10, { style: styles.spinnerWrap, children: /* @__PURE__ */ jsx11(ProcessingSpinner, { theme, size: 64 }) }),
|
|
1454
|
+
/* @__PURE__ */ jsx11(Text6, { style: [styles.title, styles.titlePulse], children: "Processing payment..." }),
|
|
1455
|
+
/* @__PURE__ */ jsx11(Text6, { style: styles.subtitle, children: "Please authorize on your device" })
|
|
1300
1456
|
] });
|
|
1301
1457
|
}
|
|
1302
1458
|
if (resultPhase === "failure") {
|
|
1303
|
-
return /* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1459
|
+
return /* @__PURE__ */ jsxs9(View10, { style: styles.container, children: [
|
|
1460
|
+
/* @__PURE__ */ jsx11(View10, { style: styles.failIcon, children: /* @__PURE__ */ jsx11(Icon, { name: "error-outline", size: 48, color: colors.error }) }),
|
|
1461
|
+
/* @__PURE__ */ jsx11(Text6, { style: styles.title, children: "Payment failed" }),
|
|
1462
|
+
/* @__PURE__ */ jsx11(Text6, { style: styles.subtitle, children: failureReason ?? depositError ?? "Something went wrong" }),
|
|
1463
|
+
/* @__PURE__ */ jsx11(Pressable6, { style: styles.retryBtn, onPress: retryPayment, children: /* @__PURE__ */ jsx11(Text6, { style: styles.retryText, children: "Try again" }) }),
|
|
1464
|
+
/* @__PURE__ */ jsx11(Pressable6, { style: styles.doneBtn, onPress: closeTopUp, children: /* @__PURE__ */ jsx11(Text6, { style: styles.doneText, children: "Dismiss" }) })
|
|
1309
1465
|
] });
|
|
1310
1466
|
}
|
|
1311
1467
|
const credits = deposit?.credits ?? selectedBundle?.credits ?? 0;
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1468
|
+
return /* @__PURE__ */ jsxs9(View10, { style: styles.container, children: [
|
|
1469
|
+
/* @__PURE__ */ jsx11(Animated3.View, { style: [styles.successIcon, { transform: [{ scale }] }], children: /* @__PURE__ */ jsx11(Icon, { name: "check-circle", size: 48, color: colors.success }) }),
|
|
1470
|
+
/* @__PURE__ */ jsx11(Text6, { style: styles.title, children: "Top-up Successful" }),
|
|
1471
|
+
/* @__PURE__ */ jsxs9(Text6, { style: styles.subtitle, children: [
|
|
1316
1472
|
formatCredits(credits),
|
|
1317
1473
|
" credits have been added to your balance."
|
|
1318
1474
|
] }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1475
|
+
/* @__PURE__ */ jsx11(Pressable6, { style: styles.doneBtn, onPress: closeTopUp, children: /* @__PURE__ */ jsx11(Text6, { style: styles.doneText, children: "Done" }) })
|
|
1320
1476
|
] });
|
|
1321
1477
|
}
|
|
1322
1478
|
|
|
1323
1479
|
// src/sheet/TopUpBottomSheet.tsx
|
|
1324
|
-
import { jsx as
|
|
1480
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1325
1481
|
function TopUpBottomSheet() {
|
|
1326
1482
|
const { theme, sheetOpen, step, closeTopUp } = useJaza();
|
|
1327
1483
|
const { colors, spacing: spacing2 } = theme;
|
|
1328
1484
|
const insets = useSafeAreaInsets3();
|
|
1329
|
-
const ref =
|
|
1485
|
+
const ref = useRef5(null);
|
|
1330
1486
|
const snapPoints = useMemo3(() => ["92%"], []);
|
|
1331
1487
|
const renderBackdrop = useCallback(
|
|
1332
|
-
(props) => /* @__PURE__ */
|
|
1488
|
+
(props) => /* @__PURE__ */ jsx12(
|
|
1333
1489
|
BottomSheetBackdrop,
|
|
1334
1490
|
{
|
|
1335
1491
|
...props,
|
|
@@ -1341,7 +1497,7 @@ function TopUpBottomSheet() {
|
|
|
1341
1497
|
),
|
|
1342
1498
|
[]
|
|
1343
1499
|
);
|
|
1344
|
-
const styles =
|
|
1500
|
+
const styles = StyleSheet12.create({
|
|
1345
1501
|
root: {
|
|
1346
1502
|
flex: 1
|
|
1347
1503
|
},
|
|
@@ -1359,7 +1515,7 @@ function TopUpBottomSheet() {
|
|
|
1359
1515
|
paddingBottom: insets.bottom + spacing2.xl
|
|
1360
1516
|
}
|
|
1361
1517
|
});
|
|
1362
|
-
return /* @__PURE__ */
|
|
1518
|
+
return /* @__PURE__ */ jsx12(
|
|
1363
1519
|
Modal3,
|
|
1364
1520
|
{
|
|
1365
1521
|
visible: sheetOpen,
|
|
@@ -1367,7 +1523,7 @@ function TopUpBottomSheet() {
|
|
|
1367
1523
|
animationType: "fade",
|
|
1368
1524
|
statusBarTranslucent: true,
|
|
1369
1525
|
onRequestClose: closeTopUp,
|
|
1370
|
-
children: /* @__PURE__ */
|
|
1526
|
+
children: /* @__PURE__ */ jsx12(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx12(
|
|
1371
1527
|
BottomSheet,
|
|
1372
1528
|
{
|
|
1373
1529
|
ref,
|
|
@@ -1380,16 +1536,16 @@ function TopUpBottomSheet() {
|
|
|
1380
1536
|
keyboardBlurBehavior: "restore",
|
|
1381
1537
|
android_keyboardInputMode: "adjustResize",
|
|
1382
1538
|
backgroundStyle: { backgroundColor: colors.surface },
|
|
1383
|
-
handleComponent: () => /* @__PURE__ */
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1539
|
+
handleComponent: () => /* @__PURE__ */ jsx12(View11, { style: styles.handle }),
|
|
1540
|
+
children: /* @__PURE__ */ jsxs10(
|
|
1385
1541
|
BottomSheetScrollView,
|
|
1386
1542
|
{
|
|
1387
1543
|
keyboardShouldPersistTaps: "handled",
|
|
1388
1544
|
contentContainerStyle: styles.content,
|
|
1389
1545
|
children: [
|
|
1390
|
-
step === "offer" ? /* @__PURE__ */
|
|
1391
|
-
step === "payment" ? /* @__PURE__ */
|
|
1392
|
-
step === "processing" ? /* @__PURE__ */
|
|
1546
|
+
step === "offer" ? /* @__PURE__ */ jsx12(OfferStep, {}) : null,
|
|
1547
|
+
step === "payment" ? /* @__PURE__ */ jsx12(PaymentStep, {}) : null,
|
|
1548
|
+
step === "processing" ? /* @__PURE__ */ jsx12(ResultStep, {}) : null
|
|
1393
1549
|
]
|
|
1394
1550
|
}
|
|
1395
1551
|
)
|
|
@@ -1400,7 +1556,7 @@ function TopUpBottomSheet() {
|
|
|
1400
1556
|
}
|
|
1401
1557
|
|
|
1402
1558
|
// src/provider/JazaProvider.tsx
|
|
1403
|
-
import { jsx as
|
|
1559
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1404
1560
|
var PREDICT_DEBOUNCE_MS = 500;
|
|
1405
1561
|
var POLL_INTERVAL_MS = 2e3;
|
|
1406
1562
|
var POLL_TIMEOUT_MS = 12e4;
|
|
@@ -1422,7 +1578,7 @@ function JazaProvider({
|
|
|
1422
1578
|
return scheme === "dark" ? "dark" : "light";
|
|
1423
1579
|
}
|
|
1424
1580
|
);
|
|
1425
|
-
|
|
1581
|
+
useEffect5(() => {
|
|
1426
1582
|
const sub = Appearance.addChangeListener(({ colorScheme }) => {
|
|
1427
1583
|
setSystemScheme(colorScheme === "dark" ? "dark" : "light");
|
|
1428
1584
|
});
|
|
@@ -1449,7 +1605,7 @@ function JazaProvider({
|
|
|
1449
1605
|
setBalanceLoading(false);
|
|
1450
1606
|
}
|
|
1451
1607
|
}, [getBalance]);
|
|
1452
|
-
|
|
1608
|
+
useEffect5(() => {
|
|
1453
1609
|
void refreshBalance();
|
|
1454
1610
|
}, [refreshBalance]);
|
|
1455
1611
|
const [sheetOpen, setSheetOpen] = useState4(false);
|
|
@@ -1475,9 +1631,9 @@ function JazaProvider({
|
|
|
1475
1631
|
const [deposit, setDeposit] = useState4(null);
|
|
1476
1632
|
const [depositError, setDepositError] = useState4(null);
|
|
1477
1633
|
const [failureReason, setFailureReason] = useState4(null);
|
|
1478
|
-
const predictTimer =
|
|
1479
|
-
const pollTimer =
|
|
1480
|
-
const pollStarted =
|
|
1634
|
+
const predictTimer = useRef6(null);
|
|
1635
|
+
const pollTimer = useRef6(null);
|
|
1636
|
+
const pollStarted = useRef6(null);
|
|
1481
1637
|
const clearPoll = useCallback2(() => {
|
|
1482
1638
|
if (pollTimer.current) {
|
|
1483
1639
|
clearInterval(pollTimer.current);
|
|
@@ -1676,7 +1832,7 @@ function JazaProvider({
|
|
|
1676
1832
|
setDepositError(null);
|
|
1677
1833
|
setFailureReason(null);
|
|
1678
1834
|
}, [clearPoll]);
|
|
1679
|
-
|
|
1835
|
+
useEffect5(() => {
|
|
1680
1836
|
if (step !== "payment" || !selectedCountry) return;
|
|
1681
1837
|
const digits = phoneNational.replace(/\D/g, "");
|
|
1682
1838
|
if (digits.length < 6) {
|
|
@@ -1718,7 +1874,7 @@ function JazaProvider({
|
|
|
1718
1874
|
selectedCurrencyCode,
|
|
1719
1875
|
step
|
|
1720
1876
|
]);
|
|
1721
|
-
|
|
1877
|
+
useEffect5(() => {
|
|
1722
1878
|
if (step !== "payment" || !selectedBundle || !predict || !selectedCurrencyCode) {
|
|
1723
1879
|
setQuote(null);
|
|
1724
1880
|
return;
|
|
@@ -1743,7 +1899,7 @@ function JazaProvider({
|
|
|
1743
1899
|
}
|
|
1744
1900
|
})();
|
|
1745
1901
|
}, [client, predict, selectedBundle, selectedCurrencyCode, step]);
|
|
1746
|
-
|
|
1902
|
+
useEffect5(() => () => clearPoll(), [clearPoll]);
|
|
1747
1903
|
const value = useMemo4(
|
|
1748
1904
|
() => ({
|
|
1749
1905
|
theme,
|
|
@@ -1827,28 +1983,27 @@ function JazaProvider({
|
|
|
1827
1983
|
onTopUpComplete
|
|
1828
1984
|
]
|
|
1829
1985
|
);
|
|
1830
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ jsxs11(JazaContext.Provider, { value, children: [
|
|
1831
1987
|
children,
|
|
1832
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx13(TopUpBottomSheet, {})
|
|
1833
1989
|
] });
|
|
1834
1990
|
}
|
|
1835
1991
|
|
|
1836
1992
|
// src/widgets/JazaBalanceWidget.tsx
|
|
1837
|
-
import { useEffect as
|
|
1993
|
+
import { useEffect as useEffect6 } from "react";
|
|
1838
1994
|
import {
|
|
1839
|
-
|
|
1840
|
-
StyleSheet as StyleSheet10,
|
|
1995
|
+
StyleSheet as StyleSheet13,
|
|
1841
1996
|
Text as Text7,
|
|
1842
|
-
View as
|
|
1997
|
+
View as View12
|
|
1843
1998
|
} from "react-native";
|
|
1844
|
-
import { jsx as
|
|
1999
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1845
2000
|
function JazaBalanceWidget({ style }) {
|
|
1846
2001
|
const { theme, balance, balanceLoading, balanceError, refreshBalance } = useJaza();
|
|
1847
2002
|
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
1848
|
-
|
|
2003
|
+
useEffect6(() => {
|
|
1849
2004
|
void refreshBalance();
|
|
1850
2005
|
}, [refreshBalance]);
|
|
1851
|
-
const styles =
|
|
2006
|
+
const styles = StyleSheet13.create({
|
|
1852
2007
|
card: {
|
|
1853
2008
|
backgroundColor: colors.surfaceContainer,
|
|
1854
2009
|
borderRadius: radius2.xl,
|
|
@@ -1877,25 +2032,28 @@ function JazaBalanceWidget({ style }) {
|
|
|
1877
2032
|
marginTop: spacing2.xs
|
|
1878
2033
|
}
|
|
1879
2034
|
});
|
|
1880
|
-
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2035
|
+
if (balanceLoading && balance === null) {
|
|
2036
|
+
return /* @__PURE__ */ jsx14(BalanceCardSkeleton, { theme, style });
|
|
2037
|
+
}
|
|
2038
|
+
return /* @__PURE__ */ jsxs12(View12, { style: styles.card, children: [
|
|
2039
|
+
/* @__PURE__ */ jsx14(Text7, { style: styles.label, children: "Current Balance" }),
|
|
2040
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles.row, children: [
|
|
2041
|
+
/* @__PURE__ */ jsx14(Icon, { name: "bolt", size: 28, color: colors.primary }),
|
|
2042
|
+
/* @__PURE__ */ jsx14(Text7, { style: styles.value, children: balance !== null ? formatCredits(balance) : "\u2014" })
|
|
1885
2043
|
] }),
|
|
1886
|
-
balanceError ? /* @__PURE__ */
|
|
2044
|
+
balanceError ? /* @__PURE__ */ jsx14(Text7, { style: styles.error, children: balanceError }) : null
|
|
1887
2045
|
] });
|
|
1888
2046
|
}
|
|
1889
2047
|
|
|
1890
2048
|
// src/widgets/JazaTopUpButton.tsx
|
|
1891
2049
|
import { useState as useState5 } from "react";
|
|
1892
2050
|
import {
|
|
1893
|
-
ActivityIndicator as
|
|
2051
|
+
ActivityIndicator as ActivityIndicator2,
|
|
1894
2052
|
Pressable as Pressable7,
|
|
1895
|
-
StyleSheet as
|
|
2053
|
+
StyleSheet as StyleSheet14,
|
|
1896
2054
|
Text as Text8
|
|
1897
2055
|
} from "react-native";
|
|
1898
|
-
import { Fragment, jsx as
|
|
2056
|
+
import { Fragment, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1899
2057
|
function JazaTopUpButton({
|
|
1900
2058
|
onRequestToken,
|
|
1901
2059
|
label = "Top up credits",
|
|
@@ -1905,7 +2063,7 @@ function JazaTopUpButton({
|
|
|
1905
2063
|
const { colors, spacing: spacing2, radius: radius2 } = theme;
|
|
1906
2064
|
const [loading, setLoading] = useState5(false);
|
|
1907
2065
|
const [error, setError] = useState5(null);
|
|
1908
|
-
const styles =
|
|
2066
|
+
const styles = StyleSheet14.create({
|
|
1909
2067
|
button: {
|
|
1910
2068
|
backgroundColor: colors.primaryContainer,
|
|
1911
2069
|
borderRadius: radius2.full,
|
|
@@ -1945,20 +2103,20 @@ function JazaTopUpButton({
|
|
|
1945
2103
|
setLoading(false);
|
|
1946
2104
|
}
|
|
1947
2105
|
};
|
|
1948
|
-
return /* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
2106
|
+
return /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
2107
|
+
/* @__PURE__ */ jsx15(
|
|
1950
2108
|
Pressable7,
|
|
1951
2109
|
{
|
|
1952
2110
|
style: ({ pressed }) => [styles.button, pressed && styles.pressed],
|
|
1953
2111
|
onPress: () => void handlePress(),
|
|
1954
2112
|
disabled: loading,
|
|
1955
|
-
children: loading ? /* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
-
/* @__PURE__ */
|
|
2113
|
+
children: loading ? /* @__PURE__ */ jsx15(ActivityIndicator2, { color: colors.onPrimaryContainer }) : /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
2114
|
+
/* @__PURE__ */ jsx15(Text8, { style: styles.label, children: label }),
|
|
2115
|
+
/* @__PURE__ */ jsx15(Icon, { name: "arrow-forward", size: 20, color: colors.onPrimaryContainer })
|
|
1958
2116
|
] })
|
|
1959
2117
|
}
|
|
1960
2118
|
),
|
|
1961
|
-
error ? /* @__PURE__ */
|
|
2119
|
+
error ? /* @__PURE__ */ jsx15(Text8, { style: styles.error, children: error }) : null
|
|
1962
2120
|
] });
|
|
1963
2121
|
}
|
|
1964
2122
|
export {
|