@flopay/react 0.5.1 → 0.5.2
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/dist/index.cjs +20 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1270,12 +1270,17 @@ function SplitCardFormInner({
|
|
|
1270
1270
|
lastName: effectiveAccount.lastName ?? fullName.trim().split(/\s+/).slice(1).join(" ") ?? "",
|
|
1271
1271
|
...avsConfig ? (() => {
|
|
1272
1272
|
const c = selectedCountryRef.current;
|
|
1273
|
+
const stateVisible = (0, import_shared4.isAVSFieldVisible)(avsConfig.state, c);
|
|
1274
|
+
const line1Visible = (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_1, c);
|
|
1275
|
+
const zipVisible = (0, import_shared4.isAVSFieldVisible)(avsConfig.postal_code, c);
|
|
1276
|
+
const derivedState = line1Visible && !stateVisible && zipVisible ? (0, import_shared4.getStateFromPostalCode)(c, zipCodeRef.current ?? "") : null;
|
|
1277
|
+
const stateValue2 = stateVisible ? stateRef.current : derivedState;
|
|
1273
1278
|
return {
|
|
1274
1279
|
country: c,
|
|
1275
|
-
...
|
|
1280
|
+
...zipVisible && zipCodeRef.current ? { zip: zipCodeRef.current } : {},
|
|
1276
1281
|
...(0, import_shared4.isAVSFieldVisible)(avsConfig.city, c) && cityRef.current ? { city: cityRef.current } : {},
|
|
1277
|
-
...
|
|
1278
|
-
...
|
|
1282
|
+
...stateValue2 ? { state: stateValue2 } : {},
|
|
1283
|
+
...line1Visible && addressLine1Ref.current ? { addressLine1: addressLine1Ref.current } : {},
|
|
1279
1284
|
...(0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_2, c) && addressLine2Ref.current ? { addressLine2: addressLine2Ref.current } : {}
|
|
1280
1285
|
};
|
|
1281
1286
|
})() : {}
|
|
@@ -1330,7 +1335,12 @@ function SplitCardFormInner({
|
|
|
1330
1335
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_1, retryCC) && addressLine1Ref.current.trim()) retryBillingAddress["line1"] = addressLine1Ref.current.trim();
|
|
1331
1336
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_2, retryCC) && addressLine2Ref.current.trim()) retryBillingAddress["line2"] = addressLine2Ref.current.trim();
|
|
1332
1337
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.city, retryCC) && cityRef.current.trim()) retryBillingAddress["city"] = cityRef.current.trim();
|
|
1333
|
-
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.state, retryCC) && stateRef.current.trim())
|
|
1338
|
+
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.state, retryCC) && stateRef.current.trim()) {
|
|
1339
|
+
retryBillingAddress["state"] = stateRef.current.trim();
|
|
1340
|
+
} else if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_1, retryCC) && !(0, import_shared4.isAVSFieldVisible)(avsConfig.state, retryCC) && (0, import_shared4.isAVSFieldVisible)(avsConfig.postal_code, retryCC)) {
|
|
1341
|
+
const derivedRetryState = (0, import_shared4.getStateFromPostalCode)(retryCC, zipCodeRef.current.trim());
|
|
1342
|
+
if (derivedRetryState) retryBillingAddress["state"] = derivedRetryState;
|
|
1343
|
+
}
|
|
1334
1344
|
const result = await flopay.confirmPayment({
|
|
1335
1345
|
clientSecret: secret,
|
|
1336
1346
|
returnUrl: window.location.href,
|
|
@@ -1525,7 +1535,12 @@ function SplitCardFormInner({
|
|
|
1525
1535
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_1, cc) && addressLine1Ref.current.trim()) billingAddress["line1"] = addressLine1Ref.current.trim();
|
|
1526
1536
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_2, cc) && addressLine2Ref.current.trim()) billingAddress["line2"] = addressLine2Ref.current.trim();
|
|
1527
1537
|
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.city, cc) && cityRef.current.trim()) billingAddress["city"] = cityRef.current.trim();
|
|
1528
|
-
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.state, cc) && stateRef.current.trim())
|
|
1538
|
+
if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.state, cc) && stateRef.current.trim()) {
|
|
1539
|
+
billingAddress["state"] = stateRef.current.trim();
|
|
1540
|
+
} else if (avsConfig && (0, import_shared4.isAVSFieldVisible)(avsConfig.address_line_1, cc) && !(0, import_shared4.isAVSFieldVisible)(avsConfig.state, cc) && (0, import_shared4.isAVSFieldVisible)(avsConfig.postal_code, cc)) {
|
|
1541
|
+
const derivedSubmitState = (0, import_shared4.getStateFromPostalCode)(cc, zipCodeRef.current.trim());
|
|
1542
|
+
if (derivedSubmitState) billingAddress["state"] = derivedSubmitState;
|
|
1543
|
+
}
|
|
1529
1544
|
const billingDetails = {
|
|
1530
1545
|
...resolvedAccount.email ? { email: resolvedAccount.email } : {},
|
|
1531
1546
|
...fullName.trim() ? { name: fullName.trim() } : {},
|
|
@@ -3578,8 +3593,6 @@ function FloPayCheckout({
|
|
|
3578
3593
|
country: session?.customer?.country,
|
|
3579
3594
|
city: session?.customer?.city,
|
|
3580
3595
|
state: session?.customer?.state,
|
|
3581
|
-
addressLine1: session?.customer?.line1,
|
|
3582
|
-
addressLine2: session?.customer?.line2,
|
|
3583
3596
|
onCountryChange,
|
|
3584
3597
|
onZipChange,
|
|
3585
3598
|
avsCheck: !!enableAVS,
|