@heyama/pay-react-native 0.0.0-stage → 1.0.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.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -2
  3. package/assets/fonts/Figtree-Bold.ttf +0 -0
  4. package/assets/fonts/Figtree-ExtraBold.ttf +0 -0
  5. package/assets/fonts/Figtree-Medium.ttf +0 -0
  6. package/assets/fonts/Figtree-Regular.ttf +0 -0
  7. package/assets/fonts/Figtree-SemiBold.ttf +0 -0
  8. package/assets/fonts/OFL.txt +93 -0
  9. package/assets/logos/apple-pay.png +0 -0
  10. package/assets/logos/card.png +0 -0
  11. package/assets/logos/google-pay.png +0 -0
  12. package/assets/logos/mastercard.png +0 -0
  13. package/assets/logos/mixx.png +0 -0
  14. package/assets/logos/moov.png +0 -0
  15. package/assets/logos/mtn.png +0 -0
  16. package/assets/logos/orange.png +0 -0
  17. package/assets/logos/paypal.png +0 -0
  18. package/assets/logos/visa.png +0 -0
  19. package/assets/logos/wave.png +0 -0
  20. package/dist/checkout-core/hooks/use-checkout-controller.d.ts +9 -0
  21. package/dist/checkout-core/hooks/use-checkout-controller.js +319 -0
  22. package/dist/checkout-core/hooks/use-checkout-timers.d.ts +15 -0
  23. package/dist/checkout-core/hooks/use-checkout-timers.js +44 -0
  24. package/dist/checkout-core/hooks/use-phone-number.d.ts +7 -0
  25. package/dist/checkout-core/hooks/use-phone-number.js +82 -0
  26. package/dist/checkout-core/messages/en.d.ts +253 -0
  27. package/dist/checkout-core/messages/en.js +243 -0
  28. package/dist/checkout-core/messages/fr.d.ts +4 -0
  29. package/dist/checkout-core/messages/fr.js +245 -0
  30. package/dist/checkout-core/models/checkout.card.utils.d.ts +22 -0
  31. package/dist/checkout-core/models/checkout.card.utils.js +101 -0
  32. package/dist/checkout-core/models/checkout.constants.d.ts +56 -0
  33. package/dist/checkout-core/models/checkout.constants.js +142 -0
  34. package/dist/checkout-core/models/checkout.enum.d.ts +133 -0
  35. package/dist/checkout-core/models/checkout.enum.js +150 -0
  36. package/dist/checkout-core/models/checkout.interface.d.ts +417 -0
  37. package/dist/checkout-core/models/checkout.interface.js +1 -0
  38. package/dist/checkout-core/models/checkout.money.utils.d.ts +7 -0
  39. package/dist/checkout-core/models/checkout.money.utils.js +21 -0
  40. package/dist/checkout-core/models/checkout.phone.utils.d.ts +33 -0
  41. package/dist/checkout-core/models/checkout.phone.utils.js +159 -0
  42. package/dist/checkout-core/models/checkout.view.utils.d.ts +34 -0
  43. package/dist/checkout-core/models/checkout.view.utils.js +205 -0
  44. package/dist/checkout-core/models/domain.enum.d.ts +56 -0
  45. package/dist/checkout-core/models/domain.enum.js +62 -0
  46. package/dist/components/BrissotoPayProvider.d.ts +6 -0
  47. package/dist/components/BrissotoPayProvider.js +41 -0
  48. package/dist/components/PaymentSheetModal.d.ts +8 -0
  49. package/dist/components/PaymentSheetModal.js +77 -0
  50. package/dist/components/SheetBone.d.ts +3 -0
  51. package/dist/components/SheetBone.js +12 -0
  52. package/dist/components/SheetButton.d.ts +3 -0
  53. package/dist/components/SheetButton.js +33 -0
  54. package/dist/components/SheetCardFields.d.ts +8 -0
  55. package/dist/components/SheetCardFields.js +66 -0
  56. package/dist/components/SheetChosenMethod.d.ts +3 -0
  57. package/dist/components/SheetChosenMethod.js +60 -0
  58. package/dist/components/SheetCodeField.d.ts +8 -0
  59. package/dist/components/SheetCodeField.js +97 -0
  60. package/dist/components/SheetContent.d.ts +3 -0
  61. package/dist/components/SheetContent.js +106 -0
  62. package/dist/components/SheetFailed.d.ts +3 -0
  63. package/dist/components/SheetFailed.js +43 -0
  64. package/dist/components/SheetForm.d.ts +8 -0
  65. package/dist/components/SheetForm.js +101 -0
  66. package/dist/components/SheetHeader.d.ts +6 -0
  67. package/dist/components/SheetHeader.js +69 -0
  68. package/dist/components/SheetIcon.d.ts +3 -0
  69. package/dist/components/SheetIcon.js +70 -0
  70. package/dist/components/SheetLayout.d.ts +9 -0
  71. package/dist/components/SheetLayout.js +48 -0
  72. package/dist/components/SheetLogo.d.ts +3 -0
  73. package/dist/components/SheetLogo.js +20 -0
  74. package/dist/components/SheetMessage.d.ts +3 -0
  75. package/dist/components/SheetMessage.js +15 -0
  76. package/dist/components/SheetMethodCard.d.ts +3 -0
  77. package/dist/components/SheetMethodCard.js +32 -0
  78. package/dist/components/SheetPhoneField.d.ts +3 -0
  79. package/dist/components/SheetPhoneField.js +58 -0
  80. package/dist/components/SheetRow.d.ts +3 -0
  81. package/dist/components/SheetRow.js +28 -0
  82. package/dist/components/SheetSimulator.d.ts +6 -0
  83. package/dist/components/SheetSimulator.js +39 -0
  84. package/dist/components/SheetSkeleton.d.ts +5 -0
  85. package/dist/components/SheetSkeleton.js +23 -0
  86. package/dist/components/SheetSuccess.d.ts +3 -0
  87. package/dist/components/SheetSuccess.js +51 -0
  88. package/dist/components/SheetSummary.d.ts +3 -0
  89. package/dist/components/SheetSummary.js +32 -0
  90. package/dist/components/SheetTerminal.d.ts +3 -0
  91. package/dist/components/SheetTerminal.js +21 -0
  92. package/dist/components/SheetText.d.ts +5 -0
  93. package/dist/components/SheetText.js +25 -0
  94. package/dist/components/SheetToast.d.ts +3 -0
  95. package/dist/components/SheetToast.js +24 -0
  96. package/dist/components/SheetWaiting.d.ts +7 -0
  97. package/dist/components/SheetWaiting.js +77 -0
  98. package/dist/hooks/use-native-platform.d.ts +10 -0
  99. package/dist/hooks/use-native-platform.js +47 -0
  100. package/dist/hooks/use-payment-sheet.d.ts +4 -0
  101. package/dist/hooks/use-payment-sheet.js +10 -0
  102. package/dist/hooks/use-sheet-motion.d.ts +7 -0
  103. package/dist/hooks/use-sheet-motion.js +62 -0
  104. package/dist/hooks/use-sheet-resize.d.ts +6 -0
  105. package/dist/hooks/use-sheet-resize.js +15 -0
  106. package/dist/hooks/use-sheet-theme.d.ts +4 -0
  107. package/dist/hooks/use-sheet-theme.js +12 -0
  108. package/dist/hooks/use-watched-payment.d.ts +6 -0
  109. package/dist/hooks/use-watched-payment.js +17 -0
  110. package/dist/index.d.ts +3 -0
  111. package/dist/index.js +2 -0
  112. package/dist/models/sheet.constants.d.ts +39 -0
  113. package/dist/models/sheet.constants.js +78 -0
  114. package/dist/models/sheet.enum.d.ts +16 -0
  115. package/dist/models/sheet.enum.js +18 -0
  116. package/dist/models/sheet.interface.d.ts +232 -0
  117. package/dist/models/sheet.interface.js +1 -0
  118. package/dist/models/sheet.utils.d.ts +43 -0
  119. package/dist/models/sheet.utils.js +132 -0
  120. package/dist/services/checkout.service.d.ts +7 -0
  121. package/dist/services/checkout.service.js +39 -0
  122. package/package.json +58 -4
@@ -0,0 +1,39 @@
1
+ import { makeFunctionReference } from 'convex/server';
2
+ import { CHECKOUT_FUNCTIONS } from "../models/sheet.constants.js";
3
+ /**
4
+ * The checkout's calls over the Convex client: the same public functions the
5
+ * web checkout calls, by path, so the package needs none of the backend's code.
6
+ */
7
+ export function convexCheckoutCalls(client) {
8
+ const mutation = (path) => (args) => client.mutation(makeFunctionReference(path), args);
9
+ const action = (path) => (args) => client.action(makeFunctionReference(path), args);
10
+ const mutations = {
11
+ pay: mutation(CHECKOUT_FUNCTIONS.pay),
12
+ payWithCode: action(CHECKOUT_FUNCTIONS.payWithCode),
13
+ checkNow: mutation(CHECKOUT_FUNCTIONS.checkNow),
14
+ open: mutation(CHECKOUT_FUNCTIONS.open),
15
+ cancel: mutation(CHECKOUT_FUNCTIONS.cancel),
16
+ resend: mutation(CHECKOUT_FUNCTIONS.resend),
17
+ simulate: mutation(CHECKOUT_FUNCTIONS.simulate),
18
+ };
19
+ return {
20
+ watch: (paymentId, onView, onError) => {
21
+ const watch = client.watchQuery(makeFunctionReference(CHECKOUT_FUNCTIONS.get), { paymentId });
22
+ const read = () => {
23
+ let view;
24
+ try {
25
+ view = watch.localQueryResult();
26
+ }
27
+ catch {
28
+ onError();
29
+ return;
30
+ }
31
+ if (view !== undefined)
32
+ onView(view);
33
+ };
34
+ read();
35
+ return watch.onUpdate(read);
36
+ },
37
+ mutations,
38
+ };
39
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@heyama/pay-react-native",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Brissoto Pay for Expo and React Native apps: the payment sheet.",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist",
18
+ "assets",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "node scripts/build.mjs",
23
+ "prepack": "npm run build",
24
+ "test": "jest",
25
+ "typecheck": "tsc --noEmit",
26
+ "example": "node example/start.mjs"
27
+ },
28
+ "dependencies": {
29
+ "libphonenumber-js": "^1.13.15",
30
+ "use-intl": "^4.14.9"
31
+ },
32
+ "peerDependencies": {
33
+ "convex": "^1.48.0",
34
+ "expo-font": "*",
35
+ "react": "*",
36
+ "react-native": "*",
37
+ "react-native-webview": "*"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "devDependencies": {
43
+ "@react-native/jest-preset": "^0.88.1",
44
+ "@testing-library/react-native": "^14.1.0",
45
+ "@types/jest": "^30.0.0",
46
+ "@types/react": "~19.2",
47
+ "babel-preset-expo": "~58.0.23",
48
+ "convex": "^1.49.0",
49
+ "expo": "~58.0.22",
50
+ "expo-font": "~58.0.11",
51
+ "expo-status-bar": "~58.0.4",
52
+ "jest": "^30.5.2",
53
+ "jest-expo": "~58.0.13",
54
+ "react": "19.3.0",
55
+ "react-native": "0.88.1",
56
+ "react-native-webview": "14.0.1",
57
+ "test-renderer": "^1.3.1",
58
+ "typescript": "^6.0.3"
59
+ }
60
+ }