@test-glide/payment-react-native 0.1.0

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 (56) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +34 -0
  3. package/lib/module/assets/icons/AlertCircle.png +0 -0
  4. package/lib/module/assets/icons/InfoCircle.png +0 -0
  5. package/lib/module/assets/icons/Lock.png +0 -0
  6. package/lib/module/assets/icons/amex.png +0 -0
  7. package/lib/module/assets/icons/card.png +0 -0
  8. package/lib/module/assets/icons/discover.png +0 -0
  9. package/lib/module/assets/icons/mastercard.png +0 -0
  10. package/lib/module/assets/icons/visa.png +0 -0
  11. package/lib/module/assets/index.js +13 -0
  12. package/lib/module/assets/index.js.map +1 -0
  13. package/lib/module/components/BivoCVCInput.js +84 -0
  14. package/lib/module/components/BivoCVCInput.js.map +1 -0
  15. package/lib/module/components/BivoCardInput.js +114 -0
  16. package/lib/module/components/BivoCardInput.js.map +1 -0
  17. package/lib/module/components/BivoTextInput.js +89 -0
  18. package/lib/module/components/BivoTextInput.js.map +1 -0
  19. package/lib/module/core/Collector.js +116 -0
  20. package/lib/module/core/Collector.js.map +1 -0
  21. package/lib/module/index.js +7 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/module/package.json +1 -0
  24. package/lib/module/utils/utils.js +25 -0
  25. package/lib/module/utils/utils.js.map +1 -0
  26. package/lib/typescript/package.json +1 -0
  27. package/lib/typescript/src/assets/index.d.ts +11 -0
  28. package/lib/typescript/src/assets/index.d.ts.map +1 -0
  29. package/lib/typescript/src/components/BivoCVCInput.d.ts +17 -0
  30. package/lib/typescript/src/components/BivoCVCInput.d.ts.map +1 -0
  31. package/lib/typescript/src/components/BivoCardInput.d.ts +17 -0
  32. package/lib/typescript/src/components/BivoCardInput.d.ts.map +1 -0
  33. package/lib/typescript/src/components/BivoTextInput.d.ts +17 -0
  34. package/lib/typescript/src/components/BivoTextInput.d.ts.map +1 -0
  35. package/lib/typescript/src/core/Collector.d.ts +22 -0
  36. package/lib/typescript/src/core/Collector.d.ts.map +1 -0
  37. package/lib/typescript/src/index.d.ts +5 -0
  38. package/lib/typescript/src/index.d.ts.map +1 -0
  39. package/lib/typescript/src/utils/utils.d.ts +6 -0
  40. package/lib/typescript/src/utils/utils.d.ts.map +1 -0
  41. package/package.json +154 -0
  42. package/src/assets/icons/AlertCircle.png +0 -0
  43. package/src/assets/icons/InfoCircle.png +0 -0
  44. package/src/assets/icons/Lock.png +0 -0
  45. package/src/assets/icons/amex.png +0 -0
  46. package/src/assets/icons/card.png +0 -0
  47. package/src/assets/icons/discover.png +0 -0
  48. package/src/assets/icons/mastercard.png +0 -0
  49. package/src/assets/icons/visa.png +0 -0
  50. package/src/assets/index.ts +11 -0
  51. package/src/components/BivoCVCInput.tsx +74 -0
  52. package/src/components/BivoCardInput.tsx +96 -0
  53. package/src/components/BivoTextInput.tsx +80 -0
  54. package/src/core/Collector.ts +124 -0
  55. package/src/index.ts +5 -0
  56. package/src/utils/utils.ts +28 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bivo
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @bivo/payment-react-native
2
+
3
+ bivo payment
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install @bivo/payment-react-native
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { BivoCollect, BivoTextInput, BivoCardInput, BivoCVCInput } from '@bivo/payment-react-native';
18
+
19
+ ```
20
+
21
+
22
+ ## Contributing
23
+
24
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
25
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
26
+ - [Code of conduct](CODE_OF_CONDUCT.md)
27
+
28
+ ## License
29
+
30
+ MIT
31
+
32
+ ---
33
+
34
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ export const Icons = {
4
+ visa: require("../assets/icons/visa.png"),
5
+ mastercard: require("../assets/icons/mastercard.png"),
6
+ amex: require("../assets/icons/amex.png"),
7
+ discover: require("../assets/icons/discover.png"),
8
+ card: require("../assets/icons/card.png"),
9
+ lock: require("../assets/icons/Lock.png"),
10
+ info: require("../assets/icons/InfoCircle.png"),
11
+ alert: require("../assets/icons/AlertCircle.png")
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Icons","visa","require","mastercard","amex","discover","card","lock","info","alert"],"sourceRoot":"../../../src","sources":["assets/index.ts"],"mappings":";;AAAA,OAAO,MAAMA,KAAK,GAAG;EACnBC,IAAI,EAAEC,OAAO,CAAC,0BAA0B,CAAC;EACzCC,UAAU,EAAED,OAAO,CAAC,gCAAgC,CAAC;EACrDE,IAAI,EAAEF,OAAO,CAAC,0BAA0B,CAAC;EACzCG,QAAQ,EAAEH,OAAO,CAAC,8BAA8B,CAAC;EACjDI,IAAI,EAAEJ,OAAO,CAAC,0BAA0B,CAAC;EAEzCK,IAAI,EAAEL,OAAO,CAAC,0BAA0B,CAAC;EACzCM,IAAI,EAAEN,OAAO,CAAC,gCAAgC,CAAC;EAC/CO,KAAK,EAAEP,OAAO,CAAC,iCAAiC;AAClD,CAAC","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ import React, { useState } from "react";
4
+ import { View, TextInput, Text, StyleSheet, Image } from "react-native";
5
+ import { Icons } from "../assets/index.js";
6
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export const BivoCVCInput = ({
8
+ collector,
9
+ fieldName,
10
+ placeholder,
11
+ onStateChange,
12
+ required,
13
+ regex,
14
+ errorMsg,
15
+ containerStyle,
16
+ textStyle
17
+ }) => {
18
+ const [value, setValue] = useState("");
19
+ const handleChange = text => {
20
+ setValue(text);
21
+ collector.setField(fieldName, text, onStateChange, required, regex, errorMsg);
22
+ };
23
+ const handleBlur = () => {
24
+ collector.setField(fieldName, value, onStateChange, required, regex, errorMsg);
25
+ };
26
+ const error = collector.errors[fieldName];
27
+ return /*#__PURE__*/_jsxs(View, {
28
+ style: [styles.container, containerStyle],
29
+ children: [/*#__PURE__*/_jsx(TextInput, {
30
+ value: value,
31
+ onChangeText: handleChange,
32
+ onBlur: handleBlur,
33
+ placeholder: placeholder,
34
+ secureTextEntry: true,
35
+ keyboardType: "number-pad",
36
+ style: [styles.input, textStyle, error ? {
37
+ borderColor: "red"
38
+ } : {}]
39
+ }), /*#__PURE__*/_jsx(View, {
40
+ style: styles.errorContainer,
41
+ children: error ? /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsx(Image, {
43
+ source: Icons.alert,
44
+ style: styles.errorIcon
45
+ }), /*#__PURE__*/_jsx(Text, {
46
+ style: styles.error,
47
+ children: error
48
+ })]
49
+ }) : /*#__PURE__*/_jsx(Text, {
50
+ style: [styles.error, {
51
+ opacity: 0
52
+ }],
53
+ children: "placeholder"
54
+ })
55
+ })]
56
+ });
57
+ };
58
+ const styles = StyleSheet.create({
59
+ container: {
60
+ marginVertical: 8
61
+ },
62
+ input: {
63
+ borderWidth: 1,
64
+ borderColor: "#ccc",
65
+ borderRadius: 6,
66
+ padding: 10
67
+ },
68
+ errorContainer: {
69
+ flexDirection: "row",
70
+ alignItems: "center",
71
+ marginTop: 4,
72
+ minHeight: 12
73
+ },
74
+ errorIcon: {
75
+ width: 12,
76
+ height: 12,
77
+ marginRight: 4
78
+ },
79
+ error: {
80
+ color: "red",
81
+ fontSize: 12
82
+ }
83
+ });
84
+ //# sourceMappingURL=BivoCVCInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","View","TextInput","Text","StyleSheet","Image","Icons","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BivoCVCInput","collector","fieldName","placeholder","onStateChange","required","regex","errorMsg","containerStyle","textStyle","value","setValue","handleChange","text","setField","handleBlur","error","errors","style","styles","container","children","onChangeText","onBlur","secureTextEntry","keyboardType","input","borderColor","errorContainer","source","alert","errorIcon","opacity","create","marginVertical","borderWidth","borderRadius","padding","flexDirection","alignItems","marginTop","minHeight","width","height","marginRight","color","fontSize"],"sourceRoot":"../../../src","sources":["components/BivoCVCInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,EAAEC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,QAAQ,cAAc;AAGvE,SAASC,KAAK,QAAQ,oBAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAclC,OAAO,MAAMC,YAA6B,GAAGA,CAAC;EAC5CC,SAAS;EACTC,SAAS;EACTC,WAAW;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K,EAAEC,MAAM,CAACY;QAAU,CAAE,CAAC,eACvDpC,IAAA,CAACL,IAAI;UAAC4B,KAAK,EAAEC,MAAM,CAACH,KAAM;UAAAK,QAAA,EAAEL;QAAK,CAAO,CAAC;MAAA,CACzC,CAAC,gBAEHrB,IAAA,CAACL,IAAI;QAAC4B,KAAK,EAAE,CAACC,MAAM,CAACH,KAAK,EAAE;UAAEgB,OAAO,EAAE;QAAE,CAAC,CAAE;QAAAX,QAAA,EAAC;MAAW,CAAM;IAC/D,CACG,CAAC;EAAA,CACH,CAAC;AAEX,CAAC;AAED,MAAMF,MAAM,GAAG5B,UAAU,CAAC0C,MAAM,CAAC;EAC/Bb,SAAS,EAAE;IAAEc,cAAc,EAAE;EAAE,CAAC;EAChCR,KAAK,EAAE;IAAES,WAAW,EAAE,CAAC;IAAER,WAAW,EAAE,MAAM;IAAES,YAAY,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAG,CAAC;EAC5ET,cAAc,EAAE;IAAEU,aAAa,EAAE,KAAK;IAAEC,UAAU,EAAE,QAAQ;IAAEC,SAAS,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAG,CAAC;EAC3FV,SAAS,EAAE;IAAEW,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE,EAAE;IAAEC,WAAW,EAAE;EAAE,CAAC;EACpD5B,KAAK,EAAE;IAAE6B,KAAK,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAG;AACtC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ import React, { useState } from "react";
4
+ import { View, TextInput, Image, Text, StyleSheet } from "react-native";
5
+ import { Icons } from "../assets/index.js";
6
+ import { formatCardNumber } from "../utils/utils.js";
7
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
+ const cardIcons = {
9
+ visa: Icons.visa,
10
+ mastercard: Icons.mastercard,
11
+ amex: Icons.amex,
12
+ discover: Icons.discover,
13
+ unknown: Icons.card
14
+ };
15
+ export const BivoCardInput = ({
16
+ collector,
17
+ fieldName,
18
+ placeholder,
19
+ onStateChange,
20
+ required,
21
+ regex,
22
+ errorMsg,
23
+ containerStyle,
24
+ textStyle
25
+ }) => {
26
+ const [value, setValue] = useState("");
27
+ const [cardType, setCardType] = useState("unknown"); //cardType
28
+
29
+ const handleChange = text => {
30
+ const formatted = formatCardNumber(text);
31
+ setValue(formatted);
32
+ const cleaned = text.replace(/\D/g, "");
33
+ if (/^4/.test(cleaned)) setCardType("visa");else if (/^5[1-5]/.test(cleaned)) setCardType("mastercard");else if (/^3[47]/.test(cleaned)) setCardType("amex");else if (/^6(?:011|5)/.test(cleaned)) setCardType("discover");else setCardType("unknown");
34
+ collector.setField(fieldName, text, onStateChange, required, regex, errorMsg);
35
+ };
36
+ const handleBlur = () => {
37
+ collector.setField(fieldName, value, onStateChange, required, regex, errorMsg);
38
+ };
39
+ const error = collector.errors[fieldName];
40
+ return /*#__PURE__*/_jsxs(View, {
41
+ style: [styles.container, containerStyle],
42
+ children: [/*#__PURE__*/_jsxs(View, {
43
+ style: styles.row,
44
+ children: [/*#__PURE__*/_jsx(Image, {
45
+ source: cardIcons[cardType],
46
+ style: styles.icon
47
+ }), /*#__PURE__*/_jsx(TextInput, {
48
+ value: value,
49
+ onChangeText: handleChange,
50
+ onBlur: handleBlur,
51
+ placeholder: placeholder,
52
+ keyboardType: "number-pad",
53
+ style: [styles.input, textStyle, error ? {
54
+ borderColor: "red"
55
+ } : {}]
56
+ })]
57
+ }), /*#__PURE__*/_jsx(View, {
58
+ style: styles.errorContainer,
59
+ children: error ? /*#__PURE__*/_jsxs(_Fragment, {
60
+ children: [/*#__PURE__*/_jsx(Image, {
61
+ source: Icons.alert,
62
+ style: styles.errorIcon
63
+ }), /*#__PURE__*/_jsx(Text, {
64
+ style: styles.error,
65
+ children: error
66
+ })]
67
+ }) : /*#__PURE__*/_jsx(Text, {
68
+ style: [styles.error, {
69
+ opacity: 0
70
+ }],
71
+ children: "placeholder"
72
+ })
73
+ })]
74
+ });
75
+ };
76
+ const styles = StyleSheet.create({
77
+ container: {
78
+ marginVertical: 8
79
+ },
80
+ row: {
81
+ flexDirection: "row",
82
+ alignItems: "center"
83
+ },
84
+ input: {
85
+ flex: 1,
86
+ borderWidth: 1,
87
+ borderColor: "#ccc",
88
+ borderRadius: 6,
89
+ padding: 10
90
+ },
91
+ icon: {
92
+ width: 40,
93
+ height: 25,
94
+ resizeMode: "contain",
95
+ marginRight: 8
96
+ },
97
+ errorContainer: {
98
+ flexDirection: "row",
99
+ alignItems: "center",
100
+ marginLeft: 40,
101
+ marginTop: 4,
102
+ minHeight: 12
103
+ },
104
+ errorIcon: {
105
+ width: 12,
106
+ height: 12,
107
+ marginRight: 4
108
+ },
109
+ error: {
110
+ color: "red",
111
+ fontSize: 12
112
+ }
113
+ });
114
+ //# sourceMappingURL=BivoCardInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","View","TextInput","Image","Text","StyleSheet","Icons","formatCardNumber","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","cardIcons","visa","mastercard","amex","discover","unknown","card","BivoCardInput","collector","fieldName","placeholder","onStateChange","required","regex","errorMsg","containerStyle","textStyle","value","setValue","cardType","setCardType","handleChange","text","formatted","cleaned","replace","test","setField","handleBlur","error","errors","style","styles","container","children","row","source","icon","onChangeText","onBlur","keyboardType","input","borderColor","errorContainer","alert","errorIcon","opacity","create","marginVertical","flexDirection","alignItems","flex","borderWidth","borderRadius","padding","width","height","resizeMode","marginRight","marginLeft","marginTop","minHeight","color","fontSize"],"sourceRoot":"../../../src","sources":["components/BivoCardInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAEC,IAAI,EAAEC,UAAU,QAAO,cAAc;AAGtE,SAASC,KAAK,QAAQ,oBAAW;AACjC,SAASC,gBAAgB,QAAQ,m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TextInput, Text, StyleSheet, Image } from "react-native";
5
+ import { Icons } from "../assets/index.js";
6
+ import { formatExpiry } from "../utils/utils.js";
7
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export const BivoTextInput = ({
9
+ collector,
10
+ fieldName,
11
+ placeholder,
12
+ onStateChange,
13
+ required,
14
+ regex,
15
+ errorMsg,
16
+ containerStyle,
17
+ textStyle
18
+ }) => {
19
+ const [value, setValue] = useState("");
20
+ const handleChange = text => {
21
+ let updatedValue;
22
+ if (fieldName === "expiryDate") {
23
+ updatedValue = formatExpiry(text);
24
+ } else {
25
+ updatedValue = text;
26
+ }
27
+ setValue(updatedValue);
28
+ collector.setField(fieldName, updatedValue, onStateChange, required, regex, errorMsg);
29
+ };
30
+ const handleBlur = () => {
31
+ collector.setField(fieldName, value, onStateChange, required, regex, errorMsg);
32
+ };
33
+ const error = collector.errors[fieldName];
34
+ return /*#__PURE__*/_jsxs(View, {
35
+ style: [styles.container, containerStyle],
36
+ children: [/*#__PURE__*/_jsx(TextInput, {
37
+ value: value,
38
+ onChangeText: handleChange,
39
+ onBlur: handleBlur,
40
+ placeholder: placeholder,
41
+ style: [styles.input, textStyle, error ? {
42
+ borderColor: "red"
43
+ } : {}]
44
+ }), /*#__PURE__*/_jsx(View, {
45
+ style: styles.errorContainer,
46
+ children: error ? /*#__PURE__*/_jsxs(_Fragment, {
47
+ children: [/*#__PURE__*/_jsx(Image, {
48
+ source: Icons.alert,
49
+ style: styles.errorIcon
50
+ }), /*#__PURE__*/_jsx(Text, {
51
+ style: styles.error,
52
+ children: error
53
+ })]
54
+ }) : /*#__PURE__*/_jsx(Text, {
55
+ style: [styles.error, {
56
+ opacity: 0
57
+ }],
58
+ children: "placeholder"
59
+ })
60
+ })]
61
+ });
62
+ };
63
+ const styles = StyleSheet.create({
64
+ container: {
65
+ marginVertical: 8
66
+ },
67
+ input: {
68
+ borderWidth: 1,
69
+ borderColor: "#ccc",
70
+ borderRadius: 6,
71
+ padding: 10
72
+ },
73
+ errorContainer: {
74
+ flexDirection: "row",
75
+ alignItems: "center",
76
+ marginTop: 4,
77
+ minHeight: 12
78
+ },
79
+ errorIcon: {
80
+ width: 12,
81
+ height: 12,
82
+ marginRight: 4
83
+ },
84
+ error: {
85
+ color: "red",
86
+ fontSize: 12
87
+ }
88
+ });
89
+ //# sourceMappingURL=BivoTextInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","View","TextInput","Text","StyleSheet","Image","Icons","formatExpiry","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BivoTextInput","collector","fieldName","placeholder","onStateChange","required","regex","errorMsg","containerStyle","textStyle","value","setValue","handleChange","text","updatedValue","setField","handleBlur","error","errors","style","styles","container","children","onChangeText","onBlur","input","borderColor","errorContainer","source","alert","errorIcon","opacity","create","marginVertical","borderWidth","borderRadius","padding","flexDirection","alignItems","marginTop","minHeight","width","height","marginRight","color","fontSize"],"sourceRoot":"../../../src","sources":["components/BivoTextInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,EAAEC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,QAAQ,cAAc;AAGvE,SAASC,KAAK,QAAQ,oBAAW;AACjC,SAASC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAe9C,OAAO,MAAMC,aAA8B,GAAGA,CAAC;EAC3CC,SAAS;EACTC,SAAS;EACTC,WAAW;EACXC,aAAa;EACbC,QAAQ;EACRC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC;AACJ,CAAC,KAAK;EACF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGzB,QAAQ,CAAC,EAAE,CAAC;EAEtC,MAAM0B,YAAY,GAAIC,IAAY,IAAK;IACnC,IAAIC,YAAY;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,QAAA,EAAEL;QAAK,CAAO,CAAC;MAAA,CAC3C,CAAC,gBAEHtB,IAAA,CAACN,IAAI;QAAC8B,KAAK,EAAE,CAACC,MAAM,CAACH,KAAK,EAAE;UAAEc,OAAO,EAAE;QAAE,CAAC,CAAE;QAAAT,QAAA,EAAC;MAAW,CAAM;IACjE,CACC,CAAC;EAAA,CACL,CAAC;AAEf,CAAC;AAED,MAAMF,MAAM,GAAG9B,UAAU,CAAC0C,MAAM,CAAC;EAC7BX,SAAS,EAAE;IAAEY,cAAc,EAAE;EAAE,CAAC;EAChCR,KAAK,EAAE;IAAES,WAAW,EAAE,CAAC;IAAER,WAAW,EAAE,MAAM;IAAES,YAAY,EAAE,CAAC;IAAEC,OAAO,EAAE;EAAG,CAAC;EAC5ET,cAAc,EAAE;IAAEU,aAAa,EAAE,KAAK;IAAEC,UAAU,EAAE,QAAQ;IAAEC,SAAS,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAG,CAAC;EAC3FV,SAAS,EAAE;IAAEW,KAAK,EAAE,EAAE;IAAEC,MAAM,EAAE,EAAE;IAAEC,WAAW,EAAE;EAAE,CAAC;EACpD1B,KAAK,EAAE;IAAE2B,KAAK,EAAE,KAAK;IAAEC,QAAQ,EAAE;EAAG;AACxC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ import { formatCardYear, formatString } from "../utils/utils.js";
4
+ export class BivoCollect {
5
+ form = {};
6
+ errors = {};
7
+ fieldConfig = {};
8
+ constructor(vaultId, environment) {
9
+ this.vaultId = vaultId;
10
+ this.environment = environment;
11
+ }
12
+ setField(fieldName, value, onStateChange, required = false, regex, errorMsg) {
13
+ this.form[fieldName] = value;
14
+ this.fieldConfig[fieldName] = {
15
+ required,
16
+ regex,
17
+ errorMsg
18
+ };
19
+ const error = this.validateField(fieldName, value, required, regex, errorMsg);
20
+ this.errors[fieldName] = error || "";
21
+ onStateChange?.({
22
+ value,
23
+ error
24
+ });
25
+ }
26
+ validateField(fieldName, value, required, regex, errorMsg) {
27
+ const trimmedValue = value?.trim();
28
+
29
+ // Required check
30
+ if (!trimmedValue && required) return "Required";
31
+
32
+ // If custom regex is provided → use it first
33
+ if (regex && trimmedValue) {
34
+ if (!regex.test(trimmedValue)) {
35
+ return errorMsg || "Invalid value";
36
+ }
37
+ return "";
38
+ }
39
+
40
+ // Default validations
41
+ switch (fieldName) {
42
+ case "cardNumber":
43
+ {
44
+ const digits = trimmedValue.replace(/\D/g, "");
45
+ if (digits.length < 12) return "Invalid card number";
46
+ break;
47
+ }
48
+ case "cvc":
49
+ {
50
+ if (!/^\d{3,4}$/.test(trimmedValue)) {
51
+ return "Invalid CVC";
52
+ }
53
+ break;
54
+ }
55
+ case "expiryDate":
56
+ {
57
+ // Format check MM/YY
58
+ if (!/^\d{2}\/\d{2}$/.test(trimmedValue)) {
59
+ return "Invalid expiry";
60
+ }
61
+ const [monthStr, yearStr] = trimmedValue.split("/");
62
+ if (!monthStr || !yearStr) {
63
+ return "Invalid expiry";
64
+ }
65
+ const month = parseInt(monthStr, 10);
66
+ const year = parseInt(yearStr, 10);
67
+ if (month < 1 || month > 12) {
68
+ return "Invalid month";
69
+ }
70
+
71
+ // Convert YY → YYYY (assume 2000-2099)
72
+ const fullYear = 2000 + year;
73
+ const now = new Date();
74
+ const currentMonth = now.getMonth() + 1;
75
+ const currentYear = now.getFullYear();
76
+
77
+ // Expiry check
78
+ if (fullYear < currentYear || fullYear === currentYear && month < currentMonth) {
79
+ return "Card expired";
80
+ }
81
+ break;
82
+ }
83
+ }
84
+ return "";
85
+ }
86
+ isSubmitDisabled(fieldNames) {
87
+ return fieldNames.some(fieldName => {
88
+ const value = this.form[fieldName]?.trim() ?? "";
89
+ const error = this.errors[fieldName];
90
+ return !value || !!error;
91
+ });
92
+ }
93
+ async submit(endpoint, token) {
94
+ console.log("Submitting form:", this.form, this.errors);
95
+ const expiry = this.form.expiryDate?.split("/") || [];
96
+ const payload = {
97
+ token,
98
+ pan: formatString(this.form.cardNumber || ""),
99
+ expiry_month: Number(expiry[0] || 0),
100
+ expiry_year: formatCardYear(expiry[1] || ""),
101
+ cvv: this.form.cvc ? formatString(this.form.cvc) : null,
102
+ name: this.form.cardHolderName || null
103
+ };
104
+
105
+ // Replace fetchData with your API call
106
+ const response = await fetch(endpoint, {
107
+ method: "POST",
108
+ headers: {
109
+ "Content-Type": "application/json"
110
+ },
111
+ body: JSON.stringify(payload)
112
+ });
113
+ return response.json();
114
+ }
115
+ }
116
+ //# sourceMappingURL=Collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatCardYear","formatString","BivoCollect","form","errors","fieldConfig","constructor","vaultId","environment","setField","fieldName","value","onStateChange","required","regex","errorMsg","error","validateField","trimmedValue","trim","test","digits","replace","length","monthStr","yearStr","split","month","parseInt","year","fullYear","now","Date","currentMonth","getMonth","currentYear","getFullYear","isSubmitDisabled","fieldNames","some","submit","endpoint","token","console","log","expiry","expiryDate","payload","pan","cardNumber","expiry_month","Number","expiry_year","cvv","cvc","name","cardHolderName","response","fetch","method","headers","body","JSON","stringify","json"],"sourceRoot":"../../../src","sources":["core/Collector.ts"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,YAAY,QAAQ,mBAAgB;AAK7D,OAAO,MAAMC,WAAW,CAAC;EAGvBC,IAAI,GAA2B,CAAC,CAAC;EACjCC,MAAM,GAA2B,CAAC,CAAC;EACnCC,WAAW,GAA8E,CAAC,CAAC;EAE3FC,WAAWA,CAACC,OAAe,EAAEC,WAA+B,EAAE;IAC5D,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;EAEAC,QAAQA,CAACC,SAAiB,EAAEC,KAAa,EAAEC,aAA2C,EAAEC,QAAiB,GAAG,KAAK,EAAEC,KAAc,EAAEC,QAAiB,EAAE;IACpJ,IAAI,CAACZ,IAAI,CAACO,SAAS,CAAC,GAAGC,KAAK;IAC5B,IAAI,CAACN,WAAW,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C,IAAI,EAAE;IACrD,MAAMqB,OAAO,GAAG;MACdL,KAAK;MACLM,GAAG,EAAE/C,YAAY,CAAC,IAAI,CAACE,IAAI,CAAC8C,UAAU,IAAI,EAAE,CAAC;MAC7CC,YAAY,EAAEC,MAAM,CAACN,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;MACpCO,WAAW,EAAEpD,cAAc,CAAC6C,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;MAC5CQ,GAAG,EAAE,IAAI,CAAClD,IAAI,CAACmD,GAAG,GAAGrD,YAAY,CAAC,IAAI,CAACE,IAAI,CAACmD,GAAG,CAAC,GAAG,IAAI;MACvDC,IAAI,EAAE,IAAI,CAACpD,IAAI,CAACqD,cAAc,IAAI;IACpC,CAAC;;IAED;IACA,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACjB,QAAQ,EAAE;MACrCkB,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QAAE,cAAc,EAAE;MAAmB,CAAC;MAC/CC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAChB,OAAO;IAC9B,CAAC,CAAC;IACF,OAAOU,QAAQ,CAACO,IAAI,CAAC,CAAC;EACxB;AACF","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ export { BivoCollect } from "./core/Collector.js";
4
+ export { BivoTextInput } from "./components/BivoTextInput.js";
5
+ export { BivoCardInput } from "./components/BivoCardInput.js";
6
+ export { BivoCVCInput } from "./components/BivoCVCInput.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BivoCollect","BivoTextInput","BivoCardInput","BivoCVCInput"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,qBAAkB;AAE9C,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,YAAY,QAAQ,8BAA2B","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ // sdk/utils.ts
4
+ export const formatCardNumber = number => {
5
+ const cleaned = number.replace(/\D/g, "");
6
+ if (/^3[47]/.test(cleaned)) {
7
+ return cleaned.replace(/(\d{4})(\d{0,6})(\d{0,5})/, (_, a, b, c) => [a, b, c].filter(Boolean).join(" ")).trim();
8
+ }
9
+ return cleaned.replace(/(\d{4})/g, "$1 ").trim();
10
+ };
11
+ export const formatExpiry = value => {
12
+ const cleaned = value.replace(/\D/g, "").slice(0, 4);
13
+ if (cleaned.length >= 3) return `${cleaned.slice(0, 2)}/${cleaned.slice(2)}`;
14
+ return cleaned;
15
+ };
16
+ export const formatCVV = (value, cardType) => {
17
+ const cleaned = value.replace(/\D/g, "");
18
+ return cardType === "amex" ? cleaned.slice(0, 4) : cleaned.slice(0, 3);
19
+ };
20
+ export const formatCardYear = year => {
21
+ if (year.length === 2) return Number("20" + year);
22
+ return Number(year);
23
+ };
24
+ export const formatString = value => value.replace(/\s/g, "");
25
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatCardNumber","number","cleaned","replace","test","_","a","b","c","filter","Boolean","join","trim","formatExpiry","value","slice","length","formatCVV","cardType","formatCardYear","year","Number","formatString"],"sourceRoot":"../../../src","sources":["utils/utils.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,gBAAgB,GAAIC,MAAc,IAAK;EAClD,MAAMC,OAAO,GAAGD,MAAM,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EACzC,IAAI,QAAQ,CAACC,IAAI,CAACF,OAAO,CAAC,EAAE;IAC1B,OAAOA,OAAO,CAACC,OAAO,CAAC,2BAA2B,EAAE,CAACE,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,KAC7D,CAACF,CAAC,EAAEC,CAAC,EAAEC,CAAC,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IA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lock: any;
8
+ info: any;
9
+ alert: any;
10
+ };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/assets/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;;;CAUjB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import type { ViewStyle, TextStyle } from "react-native";
3
+ import { BivoCollect } from "../core/Collector";
4
+ interface Props {
5
+ collector: BivoCollect;
6
+ fieldName: string;
7
+ placeholder?: string;
8
+ onStateChange?: (state: any) => void;
9
+ required?: boolean;
10
+ regex?: RegExp;
11
+ errorMsg?: string;
12
+ containerStyle?: ViewStyle;
13
+ textStyle?: TextStyle;
14
+ }
15
+ export declare const BivoCVCInput: React.FC<Props>;
16
+ export {};
17
+ //# sourceMappingURL=BivoCVCInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BivoCVCInput.d.ts","sourceRoot":"","sources":["../../../../src/components/BivoCVCInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,UAAU,KAAK;IACb,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+CxC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import type { ViewStyle, TextStyle } from "react-native";
3
+ import { BivoCollect } from "../core/Collector";
4
+ interface Props {
5
+ collector: BivoCollect;
6
+ fieldName: string;
7
+ placeholder?: string;
8
+ onStateChange?: (state: any) => void;
9
+ required?: boolean;
10
+ regex?: RegExp;
11
+ errorMsg?: string;
12
+ containerStyle?: ViewStyle;
13
+ textStyle?: TextStyle;
14
+ }
15
+ export declare const BivoCardInput: React.FC<Props>;
16
+ export {};
17
+ //# sourceMappingURL=BivoCardInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BivoCardInput.d.ts","sourceRoot":"","sources":["../../../../src/components/BivoCardInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,UAAU,KAAK;IACb,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAUD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0DzC,CAAC"}