@mintmoney/react 0.1.0-alpha.23 → 0.1.0-alpha.27

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 (100) hide show
  1. package/dist/css/styles.css +149 -3
  2. package/dist/esm/api/checkouts.js +11 -3
  3. package/dist/esm/api/checkouts.js.map +1 -1
  4. package/dist/esm/api/generated.js +164 -0
  5. package/dist/esm/api/generated.js.map +1 -1
  6. package/dist/esm/api/payments.js +17 -8
  7. package/dist/esm/api/payments.js.map +1 -1
  8. package/dist/esm/checkout/modal.js +14 -11
  9. package/dist/esm/checkout/modal.js.map +1 -1
  10. package/dist/esm/checkout/views/amount-header.js +9 -2
  11. package/dist/esm/checkout/views/amount-header.js.map +1 -1
  12. package/dist/esm/checkout/views/card-intent/details.js +30 -6
  13. package/dist/esm/checkout/views/card-intent/details.js.map +1 -1
  14. package/dist/esm/checkout/views/crypto-intent/currency-select.js +14 -18
  15. package/dist/esm/checkout/views/crypto-intent/currency-select.js.map +1 -1
  16. package/dist/esm/checkout/views/crypto-intent/direct-details.js +169 -8
  17. package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
  18. package/dist/esm/checkout/views/crypto-intent/methods.js +43 -17
  19. package/dist/esm/checkout/views/crypto-intent/methods.js.map +1 -1
  20. package/dist/esm/checkout/views/crypto-intent/processing.js +1 -1
  21. package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
  22. package/dist/esm/checkout/views/crypto-intent/test-payment.js +2 -2
  23. package/dist/esm/checkout/views/crypto-intent/test-payment.js.map +1 -1
  24. package/dist/esm/checkout/views/fiat-intent/bank-payment.js +35 -0
  25. package/dist/esm/checkout/views/fiat-intent/bank-payment.js.map +1 -0
  26. package/dist/esm/components/crypto/currency-selector.js +3 -3
  27. package/dist/esm/components/crypto/currency-selector.js.map +1 -1
  28. package/dist/esm/components/crypto/default-currency-selector.js +1 -1
  29. package/dist/esm/components/crypto/default-currency-selector.js.map +1 -1
  30. package/dist/esm/components/icons/clipboard-add.js +20 -0
  31. package/dist/esm/components/icons/clipboard-add.js.map +1 -0
  32. package/dist/esm/components/icons/clipboard-check.js +20 -0
  33. package/dist/esm/components/icons/clipboard-check.js.map +1 -0
  34. package/dist/esm/components/icons/index.js +2 -0
  35. package/dist/esm/components/icons/index.js.map +1 -1
  36. package/dist/esm/components/modals/modal-with-views.js +4 -3
  37. package/dist/esm/components/modals/modal-with-views.js.map +1 -1
  38. package/dist/esm/config.js.map +1 -1
  39. package/dist/esm/index.js +2 -0
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/integrations/index.js +3 -0
  42. package/dist/esm/integrations/index.js.map +1 -0
  43. package/dist/esm/integrations/instaxchange.js +44 -0
  44. package/dist/esm/integrations/instaxchange.js.map +1 -0
  45. package/dist/esm/integrations/types.js +2 -0
  46. package/dist/esm/integrations/types.js.map +1 -0
  47. package/dist/esm/state/checkout/store.js +39 -5
  48. package/dist/esm/state/checkout/store.js.map +1 -1
  49. package/dist/esm/utils/string.js +34 -0
  50. package/dist/esm/utils/string.js.map +1 -0
  51. package/dist/types/api/checkouts.d.ts +2 -7
  52. package/dist/types/api/checkouts.d.ts.map +1 -1
  53. package/dist/types/api/generated.d.ts +445 -44
  54. package/dist/types/api/generated.d.ts.map +1 -1
  55. package/dist/types/api/payments.d.ts +5 -3
  56. package/dist/types/api/payments.d.ts.map +1 -1
  57. package/dist/types/api/types.d.ts +9 -0
  58. package/dist/types/api/types.d.ts.map +1 -1
  59. package/dist/types/checkout/modal.d.ts.map +1 -1
  60. package/dist/types/checkout/views/amount-header.d.ts +1 -0
  61. package/dist/types/checkout/views/amount-header.d.ts.map +1 -1
  62. package/dist/types/checkout/views/card-intent/details.d.ts +1 -1
  63. package/dist/types/checkout/views/card-intent/details.d.ts.map +1 -1
  64. package/dist/types/checkout/views/crypto-intent/currency-select.d.ts.map +1 -1
  65. package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
  66. package/dist/types/checkout/views/crypto-intent/methods.d.ts.map +1 -1
  67. package/dist/types/checkout/views/fiat-intent/bank-payment.d.ts +2 -0
  68. package/dist/types/checkout/views/fiat-intent/bank-payment.d.ts.map +1 -0
  69. package/dist/types/components/crypto/currency-selector.d.ts +1 -1
  70. package/dist/types/components/crypto/currency-selector.d.ts.map +1 -1
  71. package/dist/types/components/icons/clipboard-add.d.ts +6 -0
  72. package/dist/types/components/icons/clipboard-add.d.ts.map +1 -0
  73. package/dist/types/components/icons/clipboard-check.d.ts +6 -0
  74. package/dist/types/components/icons/clipboard-check.d.ts.map +1 -0
  75. package/dist/types/components/icons/index.d.ts +2 -0
  76. package/dist/types/components/icons/index.d.ts.map +1 -1
  77. package/dist/types/components/modals/modal-with-views.d.ts +1 -0
  78. package/dist/types/components/modals/modal-with-views.d.ts.map +1 -1
  79. package/dist/types/config.d.ts.map +1 -1
  80. package/dist/types/index.d.ts +2 -0
  81. package/dist/types/index.d.ts.map +1 -1
  82. package/dist/types/integrations/index.d.ts +3 -0
  83. package/dist/types/integrations/index.d.ts.map +1 -0
  84. package/dist/types/integrations/instaxchange.d.ts +4 -0
  85. package/dist/types/integrations/instaxchange.d.ts.map +1 -0
  86. package/dist/types/integrations/types.d.ts +5 -0
  87. package/dist/types/integrations/types.d.ts.map +1 -0
  88. package/dist/types/state/checkout/store.d.ts +34 -7
  89. package/dist/types/state/checkout/store.d.ts.map +1 -1
  90. package/dist/types/utils/string.d.ts +23 -0
  91. package/dist/types/utils/string.d.ts.map +1 -0
  92. package/package.json +8 -8
  93. package/dist/docs/api-examples.md +0 -55
  94. package/dist/docs/guides/customisation.md +0 -45
  95. package/dist/docs/guides/overview.md +0 -19
  96. package/dist/docs/guides/quickstart.md +0 -169
  97. package/dist/docs/index.md +0 -21
  98. package/dist/docs/markdown-examples.md +0 -85
  99. package/dist/docs/package-lock.json +0 -2408
  100. package/dist/docs/package.json +0 -19
@@ -1,45 +0,0 @@
1
- # Customisation
2
-
3
- ## MintMoney UI Namespace (`mm-`)
4
-
5
- ### 🎯 What is the `mm-` Namespace?
6
-
7
- The **`mm-` namespace** is a **CSS class prefix** used in MintMoney UI to:
8
-
9
- - **Scope styles** to MintMoney components.
10
- - **Prevent style conflicts** with other CSS in consuming applications.
11
- - **Provide customization flexibility** through CSS variables.
12
-
13
- ### **Example of Namespace Usage**
14
-
15
- ```css
16
- .mm-button {
17
- background-color: var(--mm-color-primary);
18
- font-family: var(--mm-font-family);
19
- }
20
- ```
21
-
22
- ## Customizing Fonts
23
-
24
- MintMoney UI allows you to customize fonts using CSS variables. This ensures flexibility while maintaining a consistent
25
- look across all components.
26
-
27
- ### 🎨 Default Font
28
-
29
- By default, MintMoney UI uses **Nunito Sans** as the primary font:
30
-
31
- ```css
32
- .mm-root {
33
- font-family: var(--mm-font-family, "Nunito Sans"), sans-serif;
34
- }
35
- ```
36
-
37
- ### Overriding the default font
38
-
39
- If you want to override the font for only a specific section, apply the CSS variable to a class.
40
-
41
- ```css
42
- :root {
43
- --mm-font-family: "Inter", sans-serif;
44
- }
45
- ```
@@ -1,19 +0,0 @@
1
- # Guides
2
-
3
- This page demonstrates some of the built-in markdown extensions provided by VitePress.
4
-
5
- ## Syntax Highlighting
6
-
7
- VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8
-
9
- **Input**
10
-
11
- ```js
12
- export default {
13
- data() {
14
- return {
15
- msg: "Highlighted!",
16
- };
17
- },
18
- };
19
- ```
@@ -1,169 +0,0 @@
1
- # Quickstart
2
-
3
- This guide walks you through integrating @mintmoney/react into your React application, including both frontend setup and backend integration.
4
-
5
- ## 🚀 Prerequisites
6
-
7
- Before starting, ensure you have the following:
8
-
9
- - ✅ A React application (React 18+)
10
- - ✅ API Keys from your MintMoney dashboard
11
- - ✅ A backend server (Node.js/Express recommended)
12
-
13
- ## 📥 Installation
14
-
15
- Install @mintmoney/react in your project:
16
-
17
- ```sh
18
- npm install @mintmoney/react
19
- # or
20
- yarn add @mintmoney/react
21
- # or
22
- pnpm add @mintmoney/react
23
- ```
24
-
25
- ## 🛠️ SDK Setup
26
-
27
- Add the MintMoneyProvider to your application's root component:
28
-
29
- ```tsx
30
- import { createConfig } from "@mintmoney/react/config";
31
- import { MintMoneyProvider } from "@mintmoney/react/context";
32
- import "@mintmoney/react/css/styles.css"; // Import default styles
33
-
34
- const config = createConfig("your-public-key", {
35
- apiUrl: "https://api.mintmoney.com", // Your API URL
36
- checkoutId: "your-checkout-id", // Your checkout ID
37
- });
38
-
39
- const App = () => {
40
- return (
41
- <MintMoneyProvider config={config}>
42
- <YourApp />
43
- </MintMoneyProvider>
44
- );
45
- };
46
- ```
47
-
48
- ## 🔒 Backend Integration
49
-
50
- For security, always create payments through a server-side endpoint. Here's an example using Express:
51
-
52
- ```typescript
53
- // Example using Express
54
- app.post("/api/create-payment", async (req, res) => {
55
- const { amount, currency } = req.body;
56
-
57
- // Validate required fields
58
- if (!amount || !currency) {
59
- res.status(400).json({ error: "Missing required fields" });
60
- return;
61
- }
62
-
63
- try {
64
- // Make request to MintMoney API
65
- const response = await fetch(`${process.env.API_URL}/v1/payments`, {
66
- method: "POST",
67
- headers: {
68
- "Content-Type": "application/json",
69
- "x-api-key": process.env.API_SECRET_KEY,
70
- },
71
- body: JSON.stringify({
72
- amount: Number(amount), // Ensure amount is a number
73
- currency: currency.toUpperCase(), // Ensure currency is uppercase
74
- checkout_id: process.env.CHECKOUT_ID,
75
- }),
76
- });
77
-
78
- const data = await response.json();
79
-
80
- if (!response.ok) {
81
- throw new Error(data.error || "Failed to create payment");
82
- }
83
-
84
- res.json(data);
85
- } catch (error) {
86
- console.error("Payment creation error:", error);
87
- res.status(500).json({
88
- error:
89
- error instanceof Error ? error.message : "Failed to create payment",
90
- });
91
- }
92
- });
93
- ```
94
-
95
- ## 💳 Using the Checkout Component
96
-
97
- Add the Checkout component to your application:
98
-
99
- ```tsx
100
- import { Checkout } from "@mintmoney/react";
101
-
102
- function ProductPage() {
103
- const handleCreatePayment = async () => {
104
- // Call your server endpoint to create the payment
105
- const response = await fetch("/api/create-payment", {
106
- method: "POST",
107
- headers: {
108
- "Content-Type": "application/json",
109
- },
110
- body: JSON.stringify({
111
- amount: 10.99, // Amount in the currency's standard unit (e.g., dollars)
112
- currency: "USD", // Currency code (e.g., USD, EUR)
113
- }),
114
- });
115
-
116
- if (!response.ok) {
117
- const error = await response.json();
118
- throw new Error(error.error || "Failed to create payment");
119
- }
120
-
121
- return response.json();
122
- };
123
-
124
- const handleSuccess = (paymentId: string) => {
125
- // Handle successful payment
126
- console.log("Payment successful:", paymentId);
127
- };
128
-
129
- const handleError = (error: Error) => {
130
- // Handle payment error
131
- console.error("Payment failed:", error);
132
- };
133
-
134
- return (
135
- <Checkout
136
- createPayment={handleCreatePayment}
137
- onSuccess={handleSuccess}
138
- onError={handleError}
139
- >
140
- {/* Optional: Custom trigger button */}
141
- <button>Pay with Crypto</button>
142
- </Checkout>
143
- );
144
- }
145
- ```
146
-
147
- ### Checkout Component Props
148
-
149
- | Prop | Type | Required | Description |
150
- | --------------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------- |
151
- | `createPayment` | `() => Promise<Payment>` | Yes | Function that calls your server endpoint to create a payment. Must be implemented server-side. |
152
- | `onSuccess` | `(paymentId: string) => Promise<void>` | No | Callback when payment is successful |
153
- | `onError` | `(error: Error) => Promise<void>` | No | Callback when payment fails |
154
- | `asChild` | `boolean` | No | Whether to use the child element as the trigger button |
155
- | `children` | `ReactNode` | No | Custom trigger element when asChild is true |
156
-
157
- ## ⚠️ Security Considerations
158
-
159
- - Never expose your API secret key in the frontend code
160
- - Always create payments through a server-side endpoint
161
- - Use environment variables to store sensitive credentials
162
- - Implement proper error handling and validation on the server
163
- - Use HTTPS for all API communications
164
-
165
- ## 📚 Next Steps
166
-
167
- - Learn about [customizing the checkout experience](./customisation.md)
168
- - Read the [overview guide](./overview.md) for more details about the SDK
169
- - Check out our [example implementations](https://github.com/mintmoney/mintmoney-js/tree/main/examples) for more use cases
@@ -1,21 +0,0 @@
1
- ---
2
- # https://vitepress.dev/reference/default-theme-home-page
3
- layout: home
4
-
5
- hero:
6
- name: "mint money SDK"
7
- text: "Mint Money SDK Docs"
8
- tagline: Money without limitations
9
- actions:
10
- - theme: brand
11
- text: Get Started
12
- link: /guides/overview
13
-
14
- features:
15
- - title: Feature A
16
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
17
- - title: Feature B
18
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
19
- - title: Feature C
20
- details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
21
- ---
@@ -1,85 +0,0 @@
1
- # Markdown Extension Examples
2
-
3
- This page demonstrates some of the built-in markdown extensions provided by VitePress.
4
-
5
- ## Syntax Highlighting
6
-
7
- VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8
-
9
- **Input**
10
-
11
- ````md
12
- ```js{4}
13
- export default {
14
- data () {
15
- return {
16
- msg: 'Highlighted!'
17
- }
18
- }
19
- }
20
- ```
21
- ````
22
-
23
- **Output**
24
-
25
- ```js{4}
26
- export default {
27
- data () {
28
- return {
29
- msg: 'Highlighted!'
30
- }
31
- }
32
- }
33
- ```
34
-
35
- ## Custom Containers
36
-
37
- **Input**
38
-
39
- ```md
40
- ::: info
41
- This is an info box.
42
- :::
43
-
44
- ::: tip
45
- This is a tip.
46
- :::
47
-
48
- ::: warning
49
- This is a warning.
50
- :::
51
-
52
- ::: danger
53
- This is a dangerous warning.
54
- :::
55
-
56
- ::: details
57
- This is a details block.
58
- :::
59
- ```
60
-
61
- **Output**
62
-
63
- ::: info
64
- This is an info box.
65
- :::
66
-
67
- ::: tip
68
- This is a tip.
69
- :::
70
-
71
- ::: warning
72
- This is a warning.
73
- :::
74
-
75
- ::: danger
76
- This is a dangerous warning.
77
- :::
78
-
79
- ::: details
80
- This is a details block.
81
- :::
82
-
83
- ## More
84
-
85
- Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).