expo-openpay 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.
- package/.eslintrc.js +5 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/android/build.gradle +76 -0
- package/android/gradle.properties +2 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/expo/modules/openpay/ExpoOpenpayModule.kt +127 -0
- package/android/src/main/java/expo/modules/openpay/ExpoOpenpayView.kt +30 -0
- package/android/src/main/java/mx/openpay/android/BuildConfig.java +8 -0
- package/android/src/main/java/mx/openpay/android/DeviceCollectorDefaultImpl.java +70 -0
- package/android/src/main/java/mx/openpay/android/JavaScriptInterface.java +19 -0
- package/android/src/main/java/mx/openpay/android/OpCountry.java +24 -0
- package/android/src/main/java/mx/openpay/android/OpenPayResult.java +35 -0
- package/android/src/main/java/mx/openpay/android/Openpay.java +98 -0
- package/android/src/main/java/mx/openpay/android/OpenpayUrls.java +11 -0
- package/android/src/main/java/mx/openpay/android/OperationCallBack.java +13 -0
- package/android/src/main/java/mx/openpay/android/OperationResult.java +14 -0
- package/android/src/main/java/mx/openpay/android/exceptions/OpenpayServiceException.java +93 -0
- package/android/src/main/java/mx/openpay/android/exceptions/ServiceUnavailableException.java +23 -0
- package/android/src/main/java/mx/openpay/android/model/Address.java +123 -0
- package/android/src/main/java/mx/openpay/android/model/Card.java +219 -0
- package/android/src/main/java/mx/openpay/android/model/Token.java +43 -0
- package/android/src/main/java/mx/openpay/android/services/BaseService.java +93 -0
- package/android/src/main/java/mx/openpay/android/services/ServicesFactory.java +47 -0
- package/android/src/main/java/mx/openpay/android/services/TokenService.java +19 -0
- package/android/src/main/java/mx/openpay/android/validation/CardType.java +9 -0
- package/android/src/main/java/mx/openpay/android/validation/CardValidator.java +105 -0
- package/android/src/main/java/mx/openpay/android/validation/LuhnValidator.java +34 -0
- package/build/ExpoOpenpay.types.d.ts +42 -0
- package/build/ExpoOpenpay.types.d.ts.map +1 -0
- package/build/ExpoOpenpay.types.js +2 -0
- package/build/ExpoOpenpay.types.js.map +1 -0
- package/build/ExpoOpenpayModule.d.ts +10 -0
- package/build/ExpoOpenpayModule.d.ts.map +1 -0
- package/build/ExpoOpenpayModule.js +6 -0
- package/build/ExpoOpenpayModule.js.map +1 -0
- package/build/ExpoOpenpayModule.web.d.ts +10 -0
- package/build/ExpoOpenpayModule.web.d.ts.map +1 -0
- package/build/ExpoOpenpayModule.web.js +12 -0
- package/build/ExpoOpenpayModule.web.js.map +1 -0
- package/build/ExpoOpenpayView.d.ts +4 -0
- package/build/ExpoOpenpayView.d.ts.map +1 -0
- package/build/ExpoOpenpayView.js +7 -0
- package/build/ExpoOpenpayView.js.map +1 -0
- package/build/ExpoOpenpayView.web.d.ts +3 -0
- package/build/ExpoOpenpayView.web.d.ts.map +1 -0
- package/build/ExpoOpenpayView.web.js +5 -0
- package/build/ExpoOpenpayView.web.js.map +1 -0
- package/build/assets/AmexLogo.d.ts +4 -0
- package/build/assets/AmexLogo.d.ts.map +1 -0
- package/build/assets/AmexLogo.js +9 -0
- package/build/assets/AmexLogo.js.map +1 -0
- package/build/assets/MCLogo.d.ts +4 -0
- package/build/assets/MCLogo.d.ts.map +1 -0
- package/build/assets/MCLogo.js +9 -0
- package/build/assets/MCLogo.js.map +1 -0
- package/build/assets/VisaLogo.d.ts +4 -0
- package/build/assets/VisaLogo.d.ts.map +1 -0
- package/build/assets/VisaLogo.js +6 -0
- package/build/assets/VisaLogo.js.map +1 -0
- package/build/assets/index.d.ts +4 -0
- package/build/assets/index.d.ts.map +1 -0
- package/build/assets/index.js +4 -0
- package/build/assets/index.js.map +1 -0
- package/build/components/OPCardForm.d.ts +33 -0
- package/build/components/OPCardForm.d.ts.map +1 -0
- package/build/components/OPCardForm.js +120 -0
- package/build/components/OPCardForm.js.map +1 -0
- package/build/components/OPCardNumberInput.d.ts +17 -0
- package/build/components/OPCardNumberInput.d.ts.map +1 -0
- package/build/components/OPCardNumberInput.js +60 -0
- package/build/components/OPCardNumberInput.js.map +1 -0
- package/build/components/OPCvv2Input.d.ts +17 -0
- package/build/components/OPCvv2Input.d.ts.map +1 -0
- package/build/components/OPCvv2Input.js +13 -0
- package/build/components/OPCvv2Input.js.map +1 -0
- package/build/components/OPExpInput.d.ts +17 -0
- package/build/components/OPExpInput.d.ts.map +1 -0
- package/build/components/OPExpInput.js +22 -0
- package/build/components/OPExpInput.js.map +1 -0
- package/build/components/OPExpMonthInput.d.ts +17 -0
- package/build/components/OPExpMonthInput.d.ts.map +1 -0
- package/build/components/OPExpMonthInput.js +6 -0
- package/build/components/OPExpMonthInput.js.map +1 -0
- package/build/components/OPExpYearInput.d.ts +17 -0
- package/build/components/OPExpYearInput.d.ts.map +1 -0
- package/build/components/OPExpYearInput.js +6 -0
- package/build/components/OPExpYearInput.js.map +1 -0
- package/build/components/OPHolderNameInput.d.ts +17 -0
- package/build/components/OPHolderNameInput.d.ts.map +1 -0
- package/build/components/OPHolderNameInput.js +6 -0
- package/build/components/OPHolderNameInput.js.map +1 -0
- package/build/components/forms/ErrorMessage.d.ts +7 -0
- package/build/components/forms/ErrorMessage.d.ts.map +1 -0
- package/build/components/forms/ErrorMessage.js +12 -0
- package/build/components/forms/ErrorMessage.js.map +1 -0
- package/build/components/forms/FormField.d.ts +34 -0
- package/build/components/forms/FormField.d.ts.map +1 -0
- package/build/components/forms/FormField.js +33 -0
- package/build/components/forms/FormField.js.map +1 -0
- package/build/components/forms/SubmitButton.d.ts +11 -0
- package/build/components/forms/SubmitButton.d.ts.map +1 -0
- package/build/components/forms/SubmitButton.js +45 -0
- package/build/components/forms/SubmitButton.js.map +1 -0
- package/build/components/forms/Text.d.ts +7 -0
- package/build/components/forms/Text.d.ts.map +1 -0
- package/build/components/forms/Text.js +12 -0
- package/build/components/forms/Text.js.map +1 -0
- package/build/components/forms/TextInput.d.ts +30 -0
- package/build/components/forms/TextInput.d.ts.map +1 -0
- package/build/components/forms/TextInput.js +195 -0
- package/build/components/forms/TextInput.js.map +1 -0
- package/build/components/forms/index.d.ts +4 -0
- package/build/components/forms/index.d.ts.map +1 -0
- package/build/components/forms/index.js +5 -0
- package/build/components/forms/index.js.map +1 -0
- package/build/components/index.d.ts +8 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -0
- package/build/constants/Colors.d.ts +27 -0
- package/build/constants/Colors.d.ts.map +1 -0
- package/build/constants/Colors.js +27 -0
- package/build/constants/Colors.js.map +1 -0
- package/build/constants/Styles.d.ts +9 -0
- package/build/constants/Styles.d.ts.map +1 -0
- package/build/constants/Styles.js +9 -0
- package/build/constants/Styles.js.map +1 -0
- package/build/context/FormContext.d.ts +22 -0
- package/build/context/FormContext.d.ts.map +1 -0
- package/build/context/FormContext.js +63 -0
- package/build/context/FormContext.js.map +1 -0
- package/build/context/FormThemeContext.d.ts +20 -0
- package/build/context/FormThemeContext.d.ts.map +1 -0
- package/build/context/FormThemeContext.js +21 -0
- package/build/context/FormThemeContext.js.map +1 -0
- package/build/context/index.d.ts +4 -0
- package/build/context/index.d.ts.map +1 -0
- package/build/context/index.js +3 -0
- package/build/context/index.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build/utility/cardBranding.d.ts +2 -0
- package/build/utility/cardBranding.d.ts.map +1 -0
- package/build/utility/cardBranding.js +2 -0
- package/build/utility/cardBranding.js.map +1 -0
- package/build/utility/formatting.d.ts +4 -0
- package/build/utility/formatting.d.ts.map +1 -0
- package/build/utility/formatting.js +20 -0
- package/build/utility/formatting.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/ExpoOpenpay.podspec +30 -0
- package/ios/Frameworks/OpenpayKit.xcframework/Info.plist +40 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Headers/OpenpayKit-Swift.h +274 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Info.plist +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/OpenpayKit +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/_CodeSignature/CodeResources +287 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/en.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/en.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es-MX.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es-MX.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64/OpenpayKit.framework/es.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Headers/OpenpayKit-Swift.h +544 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Info.plist +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +5179 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/OpenpayKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +127 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/OpenpayKit +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/_CodeSignature/CodeResources +342 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/en.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/en.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es-MX.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es-MX.lproj/Localizable.strings +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es.lproj/CardView.nib +0 -0
- package/ios/Frameworks/OpenpayKit.xcframework/ios-arm64_x86_64-simulator/OpenpayKit.framework/es.lproj/Localizable.strings +0 -0
- package/ios/src/ExpoOpenpayModule.swift +105 -0
- package/ios/src/ExpoOpenpayView.swift +38 -0
- package/package.json +46 -0
- package/src/ExpoOpenpay.types.ts +47 -0
- package/src/ExpoOpenpayModule.ts +29 -0
- package/src/ExpoOpenpayModule.web.ts +15 -0
- package/src/ExpoOpenpayView.tsx +11 -0
- package/src/ExpoOpenpayView.web.tsx +5 -0
- package/src/assets/AmexLogo.tsx +24 -0
- package/src/assets/MCLogo.tsx +19 -0
- package/src/assets/VisaLogo.tsx +11 -0
- package/src/assets/index.ts +3 -0
- package/src/assets/photos/discover_logo.png +0 -0
- package/src/components/OPCardForm.tsx +303 -0
- package/src/components/OPCardNumberInput.tsx +126 -0
- package/src/components/OPCvv2Input.tsx +62 -0
- package/src/components/OPExpInput.tsx +74 -0
- package/src/components/OPExpMonthInput.tsx +55 -0
- package/src/components/OPExpYearInput.tsx +55 -0
- package/src/components/OPHolderNameInput.tsx +53 -0
- package/src/components/forms/ErrorMessage.tsx +19 -0
- package/src/components/forms/FormField.tsx +96 -0
- package/src/components/forms/SubmitButton.tsx +81 -0
- package/src/components/forms/Text.tsx +20 -0
- package/src/components/forms/TextInput.tsx +329 -0
- package/src/components/forms/index.ts +4 -0
- package/src/components/index.ts +7 -0
- package/src/constants/Colors.ts +26 -0
- package/src/constants/Styles.ts +9 -0
- package/src/context/FormContext.tsx +109 -0
- package/src/context/FormThemeContext.tsx +55 -0
- package/src/context/index.ts +3 -0
- package/src/index.ts +19 -0
- package/src/utility/cardBranding.ts +0 -0
- package/src/utility/formatting.ts +23 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { FormField } from "./forms";
|
|
3
|
+
function getCardBrandIcon(cardType) {
|
|
4
|
+
switch (cardType) {
|
|
5
|
+
case "visa":
|
|
6
|
+
return { type: "png", name: "visa" };
|
|
7
|
+
case "mastercard":
|
|
8
|
+
return { type: "png", name: "mc" };
|
|
9
|
+
case "amex":
|
|
10
|
+
return { type: "png", name: "amex" };
|
|
11
|
+
case "discover":
|
|
12
|
+
return { type: "png", name: "discover" };
|
|
13
|
+
default:
|
|
14
|
+
return { type: "material", name: "credit-card" };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function detectCardBrand(cardNumber) {
|
|
18
|
+
const sanitized = cardNumber.replace(/\s+/g, "");
|
|
19
|
+
if (/^4\d{0,15}$/.test(sanitized))
|
|
20
|
+
return "visa";
|
|
21
|
+
if (/^(5[1-5]|2[2-7])\d{0,14}$/.test(sanitized))
|
|
22
|
+
return "mastercard";
|
|
23
|
+
if (/^3[47]\d{0,13}$/.test(sanitized))
|
|
24
|
+
return "amex";
|
|
25
|
+
if (/^6(?:011|5\d{2})\d{0,12}$/.test(sanitized))
|
|
26
|
+
return "discover";
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
// Luhn algorithm validator
|
|
30
|
+
function validateCardNumber(value) {
|
|
31
|
+
if (!value)
|
|
32
|
+
return "Card Number is required";
|
|
33
|
+
const sanitized = value.replace(/\s+/g, "");
|
|
34
|
+
if (sanitized.length < 13 || sanitized.length > 19) {
|
|
35
|
+
return "Card Number must be 13-19 digits";
|
|
36
|
+
}
|
|
37
|
+
let sum = 0;
|
|
38
|
+
let shouldDouble = false;
|
|
39
|
+
for (let i = sanitized.length - 1; i >= 0; i--) {
|
|
40
|
+
let digit = parseInt(sanitized[i], 10);
|
|
41
|
+
if (shouldDouble) {
|
|
42
|
+
digit *= 2;
|
|
43
|
+
if (digit > 9)
|
|
44
|
+
digit -= 9;
|
|
45
|
+
}
|
|
46
|
+
sum += digit;
|
|
47
|
+
shouldDouble = !shouldDouble;
|
|
48
|
+
}
|
|
49
|
+
if (sum % 10 !== 0)
|
|
50
|
+
return "Invalid card number";
|
|
51
|
+
return undefined; // valid card
|
|
52
|
+
}
|
|
53
|
+
export default function OPCardNumberInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
54
|
+
const [cardType, setCardType] = useState(null);
|
|
55
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
56
|
+
return (<FormField autoCapitalize="none" autoComplete="cc-number" autoCorrect={false} defaultStyling={defaultStyling} icon={getCardBrandIcon(cardType)} keyboardType="number-pad" labelStyle={labelStyle} maxLength={19} name="cardNumber" onValueChange={(text) => {
|
|
57
|
+
setCardType(detectCardBrand(text));
|
|
58
|
+
}} placeholder="Card Number" styling={{ formFieldStyle, inputStyle, textInputStyle }} validate={validateCardNumber} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=OPCardNumberInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCardNumberInput.js","sourceRoot":"","sources":["../../src/components/OPCardNumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA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AC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CACjC,YAAY,CAAC,YAAY,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,EAAE,CAAC,CACd,IAAI,CAAC,YAAY,CACjB,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;YACtB,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CACF,WAAW,CAAC,aAAa,CACzB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CACxD,QAAQ,CAAC,CAAC,kBAAkB,CAAC,CAC7B,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,UAAU,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from \"react\";\nimport { StyleProp, TextStyle, ViewStyle } from \"react-native\";\n\nimport { FormField } from \"./forms\";\n\ntype IconType =\n | {\n type: \"fa6\";\n name:\n | \"cc-visa\"\n | \"cc-mastercard\"\n | \"cc-amex\"\n | \"cc-discover\"\n | \"credit-card\";\n }\n | { type: \"material\"; name: \"credit-card\" }\n | { type: \"png\"; name: \"amex\" | \"discover\" | \"mc\" | \"visa\" };\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nfunction getCardBrandIcon(cardType: string | null): IconType {\n switch (cardType) {\n case \"visa\":\n return { type: \"png\", name: \"visa\" };\n case \"mastercard\":\n return { type: \"png\", name: \"mc\" };\n case \"amex\":\n return { type: \"png\", name: \"amex\" };\n case \"discover\":\n return { type: \"png\", name: \"discover\" };\n default:\n return { type: \"material\", name: \"credit-card\" };\n }\n}\n\nfunction detectCardBrand(cardNumber: string): string | null {\n const sanitized = cardNumber.replace(/\\s+/g, \"\");\n\n if (/^4\\d{0,15}$/.test(sanitized)) return \"visa\";\n if (/^(5[1-5]|2[2-7])\\d{0,14}$/.test(sanitized)) return \"mastercard\";\n if (/^3[47]\\d{0,13}$/.test(sanitized)) return \"amex\";\n if (/^6(?:011|5\\d{2})\\d{0,12}$/.test(sanitized)) return \"discover\";\n\n return null;\n}\n\n// Luhn algorithm validator\nfunction validateCardNumber(value: string) {\n if (!value) return \"Card Number is required\";\n\n const sanitized = value.replace(/\\s+/g, \"\");\n if (sanitized.length < 13 || sanitized.length > 19) {\n return \"Card Number must be 13-19 digits\";\n }\n\n let sum = 0;\n let shouldDouble = false;\n for (let i = sanitized.length - 1; i >= 0; i--) {\n let digit = parseInt(sanitized[i], 10);\n if (shouldDouble) {\n digit *= 2;\n if (digit > 9) digit -= 9;\n }\n sum += digit;\n shouldDouble = !shouldDouble;\n }\n if (sum % 10 !== 0) return \"Invalid card number\";\n\n return undefined; // valid card\n}\n\nexport default function OPCardNumberInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const [cardType, setCardType] = useState<string | null>(null);\n\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"none\"\n autoComplete=\"cc-number\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={getCardBrandIcon(cardType)}\n keyboardType=\"number-pad\"\n labelStyle={labelStyle}\n maxLength={19}\n name=\"cardNumber\"\n onValueChange={(text) => {\n setCardType(detectCardBrand(text));\n }}\n placeholder=\"Card Number\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n validate={validateCardNumber}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPExpYearInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPCvv2Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCvv2Input.d.ts","sourceRoot":"","sources":["../../src/components/OPCvv2Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAQF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BA8BlB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormField } from "./forms";
|
|
2
|
+
function validateCvv(value) {
|
|
3
|
+
if (!value)
|
|
4
|
+
return "CVV is required";
|
|
5
|
+
if (!/^\d{3,4}$/.test(value))
|
|
6
|
+
return "Invalid CVV";
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
export default function OPExpYearInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
10
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
11
|
+
return (<FormField autoCapitalize="none" autoComplete="cc-csc" autoCorrect={false} defaultStyling={defaultStyling} icon={{ type: "material", name: "lock" }} keyboardType="number-pad" labelStyle={labelStyle} maxLength={4} name="cvc" placeholder="CVC" styling={{ formFieldStyle, inputStyle, textInputStyle }} validate={validateCvv} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=OPCvv2Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPCvv2Input.js","sourceRoot":"","sources":["../../src/components/OPCvv2Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,CAAC,KAAK;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"./forms\";\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nfunction validateCvv(value: string) {\n if (!value) return \"CVV is required\";\n if (!/^\\d{3,4}$/.test(value)) return \"Invalid CVV\";\n return undefined;\n}\n\nexport default function OPExpYearInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"none\"\n autoComplete=\"cc-csc\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={{ type: \"material\", name: \"lock\" }}\n keyboardType=\"number-pad\"\n labelStyle={labelStyle}\n maxLength={4}\n name=\"cvc\"\n placeholder=\"CVC\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n validate={validateCvv}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPExpYearInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPExpInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpInput.d.ts","sourceRoot":"","sources":["../../src/components/OPExpInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAoBF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BA8BlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FormField } from "./forms";
|
|
2
|
+
function validateExpiry(value) {
|
|
3
|
+
if (!value)
|
|
4
|
+
return "Expiry is required";
|
|
5
|
+
const match = /^(\d{2})\/(\d{2})$/.exec(value);
|
|
6
|
+
if (!match)
|
|
7
|
+
return "Use MM/YY format";
|
|
8
|
+
const month = parseInt(match[1], 10);
|
|
9
|
+
const year = 2000 + parseInt(match[2], 10);
|
|
10
|
+
if (month < 1 || month > 12)
|
|
11
|
+
return "Invalid month";
|
|
12
|
+
const now = new Date();
|
|
13
|
+
const expiry = new Date(year, month);
|
|
14
|
+
if (expiry <= now)
|
|
15
|
+
return "Card expired";
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
export default function OPExpYearInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
19
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
20
|
+
return (<FormField autoCapitalize="none" autoComplete="cc-exp" autoCorrect={false} defaultStyling={defaultStyling} icon={{ type: "material", name: "calendar-blank" }} keyboardType="number-pad" labelStyle={labelStyle} maxLength={5} name="exp" placeholder="MM/YY" styling={{ formFieldStyle, inputStyle, textInputStyle }} validate={validateExpiry} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=OPExpInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpInput.js","sourceRoot":"","sources":["../../src/components/OPExpInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,CAAC,KAAK;QAAE,OAAO,oBAAoB,CAAC;IAExC,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK;QAAE,OAAO,kBAAkB,CAAC;IAEtC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAA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,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,UAAU,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { StyleProp, ViewStyle, TextStyle } from \"react-native\";\n\nimport { FormField } from \"./forms\";\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nfunction validateExpiry(value: string) {\n if (!value) return \"Expiry is required\";\n\n const match = /^(\\d{2})\\/(\\d{2})$/.exec(value);\n if (!match) return \"Use MM/YY format\";\n\n const month = parseInt(match[1], 10);\n const year = 2000 + parseInt(match[2], 10);\n\n if (month < 1 || month > 12) return \"Invalid month\";\n\n const now = new Date();\n const expiry = new Date(year, month);\n if (expiry <= now) return \"Card expired\";\n\n return undefined;\n}\n\nexport default function OPExpYearInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"none\"\n autoComplete=\"cc-exp\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={{ type: \"material\", name: \"calendar-blank\" }}\n keyboardType=\"number-pad\"\n labelStyle={labelStyle}\n maxLength={5}\n name=\"exp\"\n placeholder=\"MM/YY\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n validate={validateExpiry}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPExpMonthInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPExpMonthInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpMonthInput.d.ts","sourceRoot":"","sources":["../../src/components/OPExpMonthInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BA6BlB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormField } from "./forms";
|
|
2
|
+
export default function OPExpMonthInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
3
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
4
|
+
return (<FormField autoCapitalize="none" autoComplete="cc-exp-month" autoCorrect={false} defaultStyling={defaultStyling} icon={{ type: "material", name: "calendar-blank" }} keyboardType="number-pad" labelStyle={labelStyle} maxLength={2} name="expMonth" placeholder="MM" styling={{ formFieldStyle, inputStyle, textInputStyle }} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=OPExpMonthInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpMonthInput.js","sourceRoot":"","sources":["../../src/components/OPExpMonthInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,OAAO,GAAG,EAAE,EACZ,gBAAgB,GAAG,IAAI,EACvB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,IAAI,EACtB,GAAG,UAAU,EACI;IACjB,MAAM,EACJ,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,EAAE,EACnB,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,EAAE,EACf,cAAc,GAAG,EAAE,GACpB,GAAG,OAAO,CAAC;IAEZ,OAAO,CACL,CAAC,SAAS,CACR,cAAc,CAAC,MAAM,CACrB,YAAY,CAAC,cAAc,CAC3B,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CACnD,YAAY,CAAC,YAAY,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,CAAC,CAAC,CACb,IAAI,CAAC,UAAU,CACf,WAAW,CAAC,IAAI,CAChB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CACxD,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,UAAU,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { StyleProp, ViewStyle, TextStyle } from \"react-native\";\n\nimport { FormField } from \"./forms\";\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nexport default function OPExpMonthInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"none\"\n autoComplete=\"cc-exp-month\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={{ type: \"material\", name: \"calendar-blank\" }}\n keyboardType=\"number-pad\"\n labelStyle={labelStyle}\n maxLength={2}\n name=\"expMonth\"\n placeholder=\"MM\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPExpYearInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPExpYearInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpYearInput.d.ts","sourceRoot":"","sources":["../../src/components/OPExpYearInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BA6BlB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormField } from "./forms";
|
|
2
|
+
export default function OPExpYearInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
3
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
4
|
+
return (<FormField autoCapitalize="none" autoComplete="cc-exp-year" autoCorrect={false} defaultStyling={defaultStyling} icon={{ type: "material", name: "calendar-blank" }} keyboardType="number-pad" labelStyle={labelStyle} maxLength={2} name="expYear" placeholder="YY" styling={{ formFieldStyle, inputStyle, textInputStyle }} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=OPExpYearInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPExpYearInput.js","sourceRoot":"","sources":["../../src/components/OPExpYearInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,GAAG,EAAE,EACZ,gBAAgB,GAAG,IAAI,EACvB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,IAAI,EACtB,GAAG,UAAU,EACI;IACjB,MAAM,EACJ,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,EAAE,EACnB,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,EAAE,EACf,cAAc,GAAG,EAAE,GACpB,GAAG,OAAO,CAAC;IAEZ,OAAO,CACL,CAAC,SAAS,CACR,cAAc,CAAC,MAAM,CACrB,YAAY,CAAC,aAAa,CAC1B,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CACnD,YAAY,CAAC,YAAY,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,CAAC,CAAC,CACb,IAAI,CAAC,SAAS,CACd,WAAW,CAAC,IAAI,CAChB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CACxD,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,UAAU,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { StyleProp, ViewStyle, TextStyle } from \"react-native\";\n\nimport { FormField } from \"./forms\";\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nexport default function OPExpYearInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"none\"\n autoComplete=\"cc-exp-year\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={{ type: \"material\", name: \"calendar-blank\" }}\n keyboardType=\"number-pad\"\n labelStyle={labelStyle}\n maxLength={2}\n name=\"expYear\"\n placeholder=\"YY\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
2
|
+
type CardInputOptions = {
|
|
3
|
+
options?: {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
8
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
9
|
+
};
|
|
10
|
+
withAnimatedText?: boolean;
|
|
11
|
+
withIcon?: boolean;
|
|
12
|
+
withLabel?: boolean;
|
|
13
|
+
withPlaceholder?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default function OPHolderNameInput({ options, withAnimatedText, withIcon, withLabel, withPlaceholder, ...otherProps }: CardInputOptions): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=OPHolderNameInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPHolderNameInput.d.ts","sourceRoot":"","sources":["../../src/components/OPHolderNameInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACvC,CAAC;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,OAAY,EACZ,gBAAuB,EACvB,QAAe,EACf,SAAiB,EACjB,eAAsB,EACtB,GAAG,UAAU,EACd,EAAE,gBAAgB,+BA2BlB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormField } from "./forms";
|
|
2
|
+
export default function OPHolderNameInput({ options = {}, withAnimatedText = true, withIcon = true, withLabel = false, withPlaceholder = true, ...otherProps }) {
|
|
3
|
+
const { defaultStyling = true, formFieldStyle = {}, inputStyle = {}, labelStyle = {}, textInputStyle = {}, } = options;
|
|
4
|
+
return (<FormField autoCapitalize="words" autoComplete="cc-name" autoCorrect={false} defaultStyling={defaultStyling} icon={{ type: "material", name: "account" }} labelStyle={labelStyle} name="cardHolderName" placeholder="Cardholder Name" styling={{ formFieldStyle, inputStyle, textInputStyle }} withAnimatedText={withAnimatedText} withIcon={withIcon} withLabel={withLabel} withPlaceholder={withPlaceholder} {...otherProps}/>);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=OPHolderNameInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OPHolderNameInput.js","sourceRoot":"","sources":["../../src/components/OPHolderNameInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAgBpC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,OAAO,GAAG,EAAE,EACZ,gBAAgB,GAAG,IAAI,EACvB,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,IAAI,EACtB,GAAG,UAAU,EACI;IACjB,MAAM,EACJ,cAAc,GAAG,IAAI,EACrB,cAAc,GAAG,EAAE,EACnB,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,EAAE,EACf,cAAc,GAAG,EAAE,GACpB,GAAG,OAAO,CAAC;IAEZ,OAAO,CACL,CAAC,SAAS,CACR,cAAc,CAAC,OAAO,CACtB,YAAY,CAAC,SAAS,CACtB,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAC5C,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,IAAI,CAAC,gBAAgB,CACrB,WAAW,CAAC,iBAAiB,CAC7B,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CACxD,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,IAAI,UAAU,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { StyleProp, ViewStyle, TextStyle } from \"react-native\";\n\nimport { FormField } from \"./forms\";\n\ntype CardInputOptions = {\n options?: {\n formFieldStyle?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n inputStyle?: StyleProp<TextStyle>;\n labelStyle?: StyleProp<TextStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n };\n withAnimatedText?: boolean;\n withIcon?: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nexport default function OPHolderNameInput({\n options = {},\n withAnimatedText = true,\n withIcon = true,\n withLabel = false,\n withPlaceholder = true,\n ...otherProps\n}: CardInputOptions) {\n const {\n defaultStyling = true,\n formFieldStyle = {},\n inputStyle = {},\n labelStyle = {},\n textInputStyle = {},\n } = options;\n\n return (\n <FormField\n autoCapitalize=\"words\"\n autoComplete=\"cc-name\"\n autoCorrect={false}\n defaultStyling={defaultStyling}\n icon={{ type: \"material\", name: \"account\" }}\n labelStyle={labelStyle}\n name=\"cardHolderName\"\n placeholder=\"Cardholder Name\"\n styling={{ formFieldStyle, inputStyle, textInputStyle }}\n withAnimatedText={withAnimatedText}\n withIcon={withIcon}\n withLabel={withLabel}\n withPlaceholder={withPlaceholder}\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/components/forms/ErrorMessage.tsx"],"names":[],"mappings":"AAIA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAG5E;AAMD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import Text from "./Text";
|
|
3
|
+
function ErrorMessage({ error, visible }) {
|
|
4
|
+
if (!visible || !error)
|
|
5
|
+
return null;
|
|
6
|
+
return <Text style={styles.error}>{error}</Text>;
|
|
7
|
+
}
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
error: { color: "red", fontSize: 18, marginTop: 4, marginLeft: 10 },
|
|
10
|
+
});
|
|
11
|
+
export default ErrorMessage;
|
|
12
|
+
//# sourceMappingURL=ErrorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessage.js","sourceRoot":"","sources":["../../../src/components/forms/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAO1B,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAqB;IACzD,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE;CACpE,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC","sourcesContent":["import { StyleSheet } from \"react-native\";\n\nimport Text from \"./Text\";\n\ntype ErrorMessageProps = {\n error?: string;\n visible: boolean;\n};\n\nfunction ErrorMessage({ error, visible }: ErrorMessageProps): React.ReactNode {\n if (!visible || !error) return null;\n return <Text style={styles.error}>{error}</Text>;\n}\n\nconst styles = StyleSheet.create({\n error: { color: \"red\", fontSize: 18, marginTop: 4, marginLeft: 10 },\n});\n\nexport default ErrorMessage;\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import { FontAwesome6, MaterialCommunityIcons } from "@expo/vector-icons";
|
|
3
|
+
type StylingProps = {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
inputStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
};
|
|
8
|
+
type AppFormFieldProps = TextInputProps & {
|
|
9
|
+
customStyles?: StyleProp<ViewStyle>;
|
|
10
|
+
defaultStyling?: boolean;
|
|
11
|
+
icon?: {
|
|
12
|
+
type: "material";
|
|
13
|
+
name: keyof typeof MaterialCommunityIcons.glyphMap;
|
|
14
|
+
} | {
|
|
15
|
+
type: "fa6";
|
|
16
|
+
name: keyof typeof FontAwesome6.glyphMap;
|
|
17
|
+
} | {
|
|
18
|
+
type: "png";
|
|
19
|
+
name: "amex" | "discover" | "mc" | "visa";
|
|
20
|
+
};
|
|
21
|
+
name: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
styling?: StylingProps;
|
|
24
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
validate?: (value: string) => string | undefined;
|
|
27
|
+
withAnimatedText: boolean;
|
|
28
|
+
withIcon: boolean;
|
|
29
|
+
withLabel?: boolean;
|
|
30
|
+
withPlaceholder?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export default function AppFormField({ defaultStyling, name, labelStyle, placeholder, validate, withLabel, ...otherProps }: AppFormFieldProps): import("react").JSX.Element;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=FormField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/forms/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAM1E,KAAK,YAAY,GAAG;IAClB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,UAA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text, } from "react-native";
|
|
2
|
+
import TextInput from "./TextInput";
|
|
3
|
+
import { formatCreditCardNumber, formatExp } from "../../utility/formatting";
|
|
4
|
+
import { useFormContext } from "../../context/FormContext";
|
|
5
|
+
export default function AppFormField({ defaultStyling, name, labelStyle = {}, placeholder, validate, withLabel = false, ...otherProps }) {
|
|
6
|
+
const { errors, setFieldTouched, setFieldValue, setFieldError, touched, values, } = useFormContext();
|
|
7
|
+
const hasError = !!touched[name] && !!errors[name];
|
|
8
|
+
return (<>
|
|
9
|
+
{withLabel && (<Text style={defaultStyling ? [styles.label, labelStyle] : labelStyle}>
|
|
10
|
+
{placeholder}
|
|
11
|
+
</Text>)}
|
|
12
|
+
<TextInput defaultStyling={defaultStyling} onBlur={() => {
|
|
13
|
+
setFieldTouched(name);
|
|
14
|
+
if (validate) {
|
|
15
|
+
const errorMessage = validate(values[name]);
|
|
16
|
+
setFieldError(name, errorMessage);
|
|
17
|
+
}
|
|
18
|
+
}} onChangeText={(text) => {
|
|
19
|
+
if (name === "cardNumber")
|
|
20
|
+
text = formatCreditCardNumber(text);
|
|
21
|
+
if (name === "exp")
|
|
22
|
+
text = formatExp(text);
|
|
23
|
+
setFieldValue(name, text);
|
|
24
|
+
if (otherProps.onValueChange) {
|
|
25
|
+
otherProps.onValueChange(text);
|
|
26
|
+
}
|
|
27
|
+
}} hasError={hasError} errorText={errors[name]} placeholder={hasError ? errors[name] : placeholder} value={values[name]} {...otherProps}/>
|
|
28
|
+
</>);
|
|
29
|
+
}
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
label: { fontSize: 18, fontWeight: "500", marginTop: 12, paddingLeft: 6 },
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/forms/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,IAAI,GAIL,MAAM,cAAc,C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I,IAAI,KAAK,KAAK;gBAAE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC3C,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAE1B,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;gBAC7B,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;QACH,CAAC,CAAC,CACF,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CACxB,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CACnD,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CACpB,IAAI,UAAU,CAAC,EAEnB;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;CAC1E,CAAC,CAAC","sourcesContent":["import {\n StyleProp,\n StyleSheet,\n Text,\n TextInputProps,\n TextStyle,\n ViewStyle,\n} from \"react-native\";\nimport { FontAwesome6, MaterialCommunityIcons } from \"@expo/vector-icons\";\n\nimport TextInput from \"./TextInput\";\nimport { formatCreditCardNumber, formatExp } from \"../../utility/formatting\";\nimport { useFormContext } from \"../../context/FormContext\";\n\ntype StylingProps = {\n formFieldStyle?: StyleProp<ViewStyle>;\n inputStyle?: StyleProp<ViewStyle>;\n textInputStyle?: StyleProp<TextStyle>;\n};\n\ntype AppFormFieldProps = TextInputProps & {\n customStyles?: StyleProp<ViewStyle>;\n defaultStyling?: boolean;\n icon?:\n | { type: \"material\"; name: keyof typeof MaterialCommunityIcons.glyphMap }\n | { type: \"fa6\"; name: keyof typeof FontAwesome6.glyphMap }\n | { type: \"png\"; name: \"amex\" | \"discover\" | \"mc\" | \"visa\" };\n name: string;\n placeholder?: string;\n styling?: StylingProps;\n labelStyle?: StyleProp<TextStyle>;\n onValueChange?: (value: string) => void;\n validate?: (value: string) => string | undefined;\n withAnimatedText: boolean;\n withIcon: boolean;\n withLabel?: boolean;\n withPlaceholder?: boolean;\n};\n\nexport default function AppFormField({\n defaultStyling,\n name,\n labelStyle = {},\n placeholder,\n validate,\n withLabel = false,\n ...otherProps\n}: AppFormFieldProps) {\n const {\n errors,\n setFieldTouched,\n setFieldValue,\n setFieldError,\n touched,\n values,\n } = useFormContext();\n const hasError: boolean = !!touched[name] && !!errors[name];\n\n return (\n <>\n {withLabel && (\n <Text style={defaultStyling ? [styles.label, labelStyle] : labelStyle}>\n {placeholder}\n </Text>\n )}\n <TextInput\n defaultStyling={defaultStyling}\n onBlur={() => {\n setFieldTouched(name);\n if (validate) {\n const errorMessage = validate(values[name]);\n setFieldError(name, errorMessage);\n }\n }}\n onChangeText={(text) => {\n if (name === \"cardNumber\") text = formatCreditCardNumber(text);\n if (name === \"exp\") text = formatExp(text);\n setFieldValue(name, text);\n\n if (otherProps.onValueChange) {\n otherProps.onValueChange(text);\n }\n }}\n hasError={hasError}\n errorText={errors[name]}\n placeholder={hasError ? errors[name] : placeholder}\n value={values[name]}\n {...otherProps}\n />\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n label: { fontSize: 18, fontWeight: \"500\", marginTop: 12, paddingLeft: 6 },\n});\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
type SubmitButtonProps = {
|
|
3
|
+
buttonStyle?: StyleProp<ViewStyle>;
|
|
4
|
+
buttonTextStyle?: StyleProp<TextStyle>;
|
|
5
|
+
defaultStyling?: boolean;
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
9
|
+
export default function SubmitButton({ buttonStyle, buttonTextStyle, defaultStyling, onPress, title, }: SubmitButtonProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SubmitButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../src/components/forms/SubmitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,KAAK,iBAAiB,GAAG;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAgB,EAChB,eAAoB,EACpB,cAAc,EACd,OAAO,EACP,KAAgB,GACjB,EAAE,iBAAiB,+BA+BnB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { StyleSheet, Text, TouchableOpacity, } from "react-native";
|
|
2
|
+
import { useFormContext } from "../../context/FormContext";
|
|
3
|
+
import { useFormThemeContext } from "../../context/FormThemeContext";
|
|
4
|
+
export default function SubmitButton({ buttonStyle = {}, buttonTextStyle = {}, defaultStyling, onPress, title = "Submit", }) {
|
|
5
|
+
const { errors, handleSubmit, isSubmitting } = useFormContext();
|
|
6
|
+
const { button, buttonText } = useFormThemeContext();
|
|
7
|
+
return (<TouchableOpacity disabled={Object.values(errors).some(Boolean) || isSubmitting} style={defaultStyling
|
|
8
|
+
? [
|
|
9
|
+
Object.values(errors).some(Boolean) || isSubmitting
|
|
10
|
+
? styles.buttonDisabled
|
|
11
|
+
: styles.button,
|
|
12
|
+
{ backgroundColor: button },
|
|
13
|
+
buttonStyle,
|
|
14
|
+
]
|
|
15
|
+
: buttonStyle} onPress={onPress || handleSubmit}>
|
|
16
|
+
<Text style={defaultStyling
|
|
17
|
+
? [styles.text, { color: buttonText }, buttonTextStyle]
|
|
18
|
+
: buttonTextStyle}>
|
|
19
|
+
{title}
|
|
20
|
+
</Text>
|
|
21
|
+
</TouchableOpacity>);
|
|
22
|
+
}
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
button: {
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
borderRadius: 25,
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
marginVertical: 10,
|
|
29
|
+
padding: 15,
|
|
30
|
+
},
|
|
31
|
+
buttonDisabled: {
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
borderRadius: 25,
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
marginVertical: 10,
|
|
36
|
+
opacity: 0.7,
|
|
37
|
+
padding: 15,
|
|
38
|
+
},
|
|
39
|
+
text: {
|
|
40
|
+
fontSize: 18,
|
|
41
|
+
textTransform: "uppercase",
|
|
42
|
+
fontWeight: "bold",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=SubmitButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../../src/components/forms/SubmitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,IAAI,EAEJ,gBAAgB,GAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAUrE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,GAAG,EAAE,EAChB,eAAe,GAAG,EAAE,EACpB,cAAc,EACd,OAAO,EACP,KAAK,GAAG,QAAQ,GACE;IAClB,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAA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I,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,WAAW;QAC1B,UAAU,EAAE,MAAM;KACnB;CACF,CAAC,CAAC","sourcesContent":["import {\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n TouchableOpacity,\n ViewStyle,\n} from \"react-native\";\n\nimport { useFormContext } from \"../../context/FormContext\";\nimport { useFormThemeContext } from \"../../context/FormThemeContext\";\n\ntype SubmitButtonProps = {\n buttonStyle?: StyleProp<ViewStyle>;\n buttonTextStyle?: StyleProp<TextStyle>;\n defaultStyling?: boolean;\n onPress?: () => void;\n title?: string;\n};\n\nexport default function SubmitButton({\n buttonStyle = {},\n buttonTextStyle = {},\n defaultStyling,\n onPress,\n title = \"Submit\",\n}: SubmitButtonProps) {\n const { errors, handleSubmit, isSubmitting } = useFormContext();\n const { button, buttonText } = useFormThemeContext();\n\n return (\n <TouchableOpacity\n disabled={Object.values(errors).some(Boolean) || isSubmitting}\n style={\n defaultStyling\n ? [\n Object.values(errors).some(Boolean) || isSubmitting\n ? styles.buttonDisabled\n : styles.button,\n { backgroundColor: button },\n buttonStyle,\n ]\n : buttonStyle\n }\n onPress={onPress || handleSubmit}\n >\n <Text\n style={\n defaultStyling\n ? [styles.text, { color: buttonText }, buttonTextStyle]\n : buttonTextStyle\n }\n >\n {title}\n </Text>\n </TouchableOpacity>\n );\n}\n\nconst styles = StyleSheet.create({\n button: {\n alignItems: \"center\",\n borderRadius: 25,\n justifyContent: \"center\",\n marginVertical: 10,\n padding: 15,\n },\n buttonDisabled: {\n alignItems: \"center\",\n borderRadius: 25,\n justifyContent: \"center\",\n marginVertical: 10,\n opacity: 0.7,\n padding: 15,\n },\n text: {\n fontSize: 18,\n textTransform: \"uppercase\",\n fontWeight: \"bold\",\n },\n});\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextProps } from "react-native";
|
|
2
|
+
type AppTextProps = TextProps & {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare function AppText({ children, ...otherProps }: AppTextProps): import("react").JSX.Element;
|
|
6
|
+
export default AppText;
|
|
7
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/forms/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3D,KAAK,YAAY,GAAG,SAAS,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAAE,YAAY,+BAMzD;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyleSheet, Text } from "react-native";
|
|
2
|
+
import Styles from "../../constants/Styles";
|
|
3
|
+
function AppText({ children, ...otherProps }) {
|
|
4
|
+
return (<Text style={[styles.text]} {...otherProps}>
|
|
5
|
+
{children}
|
|
6
|
+
</Text>);
|
|
7
|
+
}
|
|
8
|
+
export default AppText;
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
text: { ...Styles.text },
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/forms/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAC3D,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAM5C,SAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAgB;IACxD,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CACzC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,eAAe,OAAO,CAAC;AAEvB,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE;CACzB,CAAC,CAAC","sourcesContent":["import { StyleSheet, Text, TextProps } from \"react-native\";\nimport Styles from \"../../constants/Styles\";\n\ntype AppTextProps = TextProps & {\n children?: React.ReactNode;\n};\n\nfunction AppText({ children, ...otherProps }: AppTextProps) {\n return (\n <Text style={[styles.text]} {...otherProps}>\n {children}\n </Text>\n );\n}\n\nexport default AppText;\n\nconst styles = StyleSheet.create({\n text: { ...Styles.text },\n});\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-native";
|
|
2
|
+
import { FontAwesome6, MaterialCommunityIcons } from "@expo/vector-icons";
|
|
3
|
+
type StylingProps = {
|
|
4
|
+
formFieldStyle?: StyleProp<ViewStyle>;
|
|
5
|
+
inputStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
textInputStyle?: StyleProp<TextStyle>;
|
|
7
|
+
};
|
|
8
|
+
type AppTextInputProps = TextInputProps & {
|
|
9
|
+
defaultStyling?: boolean;
|
|
10
|
+
fieldName?: string;
|
|
11
|
+
icon?: {
|
|
12
|
+
type: "material";
|
|
13
|
+
name: keyof typeof MaterialCommunityIcons.glyphMap;
|
|
14
|
+
} | {
|
|
15
|
+
type: "fa6";
|
|
16
|
+
name: keyof typeof FontAwesome6.glyphMap;
|
|
17
|
+
} | {
|
|
18
|
+
type: "png";
|
|
19
|
+
name: "amex" | "discover" | "mc" | "visa";
|
|
20
|
+
};
|
|
21
|
+
hasError?: boolean;
|
|
22
|
+
errorText?: string;
|
|
23
|
+
styling?: StylingProps;
|
|
24
|
+
withAnimatedText?: boolean;
|
|
25
|
+
withIcon?: boolean;
|
|
26
|
+
withPlaceholder?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export default function AppTextInput({ defaultStyling, fieldName, icon, onBlur, onChangeText, placeholder, hasError, errorText, styling: { formFieldStyle, inputStyle, textInputStyle }, value, withAnimatedText, withIcon, withPlaceholder, ...otherProps }: AppTextInputProps): import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/forms/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EAGT,cAAc,EACd,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAM1E,KAAK,YAAY,GAAG;IAClB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,iBAAiB,GAAG,cAAc,GAAG;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EACD;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,OAAO,sBAAsB,CAAC,QAAQ,CAAA;KAAE,GACxE;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,OAAO,YAAY,CAAC,QAAQ,CAAA;KAAE,GACzD;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,YAA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