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.
@@ -1,42 +1,42 @@
1
1
  name: Test and Deploy
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
10
 
11
11
  jobs:
12
- test-and-coverage:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@master
16
- - uses: actions/checkout@v2
17
- - uses: actions/setup-node@v1
18
- with:
19
- node-version: 12
20
- - run: npm ci
21
- - run: npm test
22
- - name: Upload coverage to Codecov
23
- uses: codecov/codecov-action@v1
24
- with:
25
- token: ${{ secrets.CODECOV_TOKEN }}
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
- publish-npm:
29
- needs: test-and-coverage
30
- runs-on: ubuntu-latest
31
- steps:
32
- - uses: actions/checkout@v2
33
- - uses: actions/setup-node@v1
34
- with:
35
- node-version: 12
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}}
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}}
@@ -7,9 +7,9 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - uses: actions/checkout@master
10
- - uses: actions/checkout@v2
11
- - uses: actions/setup-node@v1
10
+ - uses: actions/checkout@v4
11
+ - uses: actions/setup-node@v4
12
12
  with:
13
- node-version: 12
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: "pk_test_4296fd52-efba-4a38-b6ce-cf0d93639d8a",
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. The process of getting the token is async, so the outcome of the tokenization will be shared in the _cardTokenized_ or _cardTokenizationFailed_ handlers.
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
 
@@ -0,0 +1,9 @@
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ process(sourceText, sourcePath, options) {
5
+ return {
6
+ code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`,
7
+ };
8
+ },
9
+ };