frames-react-native 1.1.9 → 1.2.3
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/.github/workflows/cd.yml +36 -36
- package/.github/workflows/ci.yml +3 -3
- package/README.md +36 -2
- package/__mocks__/fileTransformer.js +9 -0
- package/__tests__/Integration.test.tsx +148 -359
- package/__tests__/Unit.test.tsx +1 -1
- package/dist/Frames.d.ts +2 -2
- package/dist/Frames.js +11 -8
- package/dist/Frames.js.map +1 -1
- package/dist/components/CardNumber.js +17 -16
- package/dist/components/CardNumber.js.map +1 -1
- package/dist/components/Cvv.d.ts +1 -1
- package/dist/components/Cvv.js +9 -8
- package/dist/components/Cvv.js.map +1 -1
- package/dist/components/ExpiryDate.d.ts +1 -1
- package/dist/components/ExpiryDate.js +9 -8
- package/dist/components/ExpiryDate.js.map +1 -1
- package/dist/components/SubmitButton.js +11 -11
- package/dist/components/SubmitButton.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/types/types.d.ts +18 -14
- package/dist/types/types.js +1 -0
- package/dist/utils/card.d.ts +5 -4
- package/dist/utils/card.js +14 -10
- package/dist/utils/card.js.map +1 -1
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/http.d.ts +1 -1
- package/dist/utils/http.js +5 -6
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/reducer.d.ts +5 -28
- package/dist/utils/reducer.js +7 -7
- package/dist/utils/reducer.js.map +1 -1
- package/package.json +18 -15
package/.github/workflows/cd.yml
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
name: Test and Deploy
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
verbose: true
|
|
12
|
+
test-and-coverage:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: 21
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm test
|
|
21
|
+
- name: Upload coverage to Codecov
|
|
22
|
+
uses: codecov/codecov-action@v1
|
|
23
|
+
with:
|
|
24
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
25
|
+
verbose: true
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
publish-npm:
|
|
28
|
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
29
|
+
needs: test-and-coverage
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: 21
|
|
36
|
+
registry-url: https://registry.npmjs.org/
|
|
37
|
+
- run: npm ci
|
|
38
|
+
- run: npm run build
|
|
39
|
+
- run: cp -R src/icons dist/
|
|
40
|
+
- run: npm publish
|
|
41
|
+
env:
|
|
42
|
+
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -7,9 +7,9 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
steps:
|
|
9
9
|
- uses: actions/checkout@master
|
|
10
|
-
- uses: actions/checkout@
|
|
11
|
-
- uses: actions/setup-node@
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
- uses: actions/setup-node@v4
|
|
12
12
|
with:
|
|
13
|
-
node-version:
|
|
13
|
+
node-version: 21
|
|
14
14
|
- run: npm ci
|
|
15
15
|
- run: npm test
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ export default function App() {
|
|
|
57
57
|
<Frames
|
|
58
58
|
config={{
|
|
59
59
|
debug: true,
|
|
60
|
-
publicKey: "
|
|
60
|
+
publicKey: "pk_sbox_eo3yb3urja2ozf6ycgn5kuy7ke#",
|
|
61
61
|
}}
|
|
62
62
|
cardTokenized={(e) => {
|
|
63
63
|
alert(e.token);
|
|
@@ -144,7 +144,41 @@ const styles = StyleSheet.create({
|
|
|
144
144
|
|
|
145
145
|
## Trigger tokenization
|
|
146
146
|
|
|
147
|
-
The tokenization is triggered when the SubmitButton is pressed
|
|
147
|
+
The tokenization is triggered when the `SubmitButton` is pressed, or programmatically via a ref on `Frames`.
|
|
148
|
+
|
|
149
|
+
### Programmatic submit via ref
|
|
150
|
+
|
|
151
|
+
You can attach a ref to `Frames` and call `submitCard()` imperatively:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import React, { useRef } from "react";
|
|
155
|
+
import { Frames, CardNumber, ExpiryDate, Cvv } from "frames-react-native";
|
|
156
|
+
import type { FramesRef } from "frames-react-native";
|
|
157
|
+
|
|
158
|
+
export const Example = () => {
|
|
159
|
+
const framesRef = useRef<FramesRef>(null);
|
|
160
|
+
|
|
161
|
+
const onCustomPress = () => {
|
|
162
|
+
framesRef.current?.submitCard();
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<Frames
|
|
167
|
+
ref={framesRef}
|
|
168
|
+
config={{ debug: true, publicKey: "pk_test_..." }}
|
|
169
|
+
cardTokenized={(e) => console.log(e.token)}
|
|
170
|
+
>
|
|
171
|
+
<CardNumber />
|
|
172
|
+
<ExpiryDate />
|
|
173
|
+
<Cvv />
|
|
174
|
+
{/* Use your own button UI */}
|
|
175
|
+
<MyCustomButton onPress={onCustomPress} />
|
|
176
|
+
</Frames>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The process of getting the token is async, so the outcome of the tokenization will be shared in the `cardTokenized` or `cardTokenizationFailed` handlers.
|
|
148
182
|
|
|
149
183
|
## The `props` for the Frames wrapper component
|
|
150
184
|
|