develop
This commit is contained in:
parent
3fffab9855
commit
c4be260d89
@ -26,6 +26,7 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-top: 22px;
|
margin-top: 22px;
|
||||||
|
line-height: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.as-seen-in {
|
.as-seen-in {
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-top: 22px;
|
margin-top: 22px;
|
||||||
|
line-height: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.as-seen-in {
|
.as-seen-in {
|
||||||
|
|||||||
@ -51,6 +51,7 @@ export const usePayment = ({
|
|||||||
ccexp: { isValid: false, message: '' },
|
ccexp: { isValid: false, message: '' },
|
||||||
cvv: { isValid: false, message: '' }
|
cvv: { isValid: false, message: '' }
|
||||||
});
|
});
|
||||||
|
const [isCollectJSLoaded, setIsCollectJSLoaded] = useState(false);
|
||||||
|
|
||||||
const { anonymousAuthorization } = useAuthentication();
|
const { anonymousAuthorization } = useAuthentication();
|
||||||
|
|
||||||
@ -84,7 +85,19 @@ export const usePayment = ({
|
|||||||
}, [products, activeProduct]);
|
}, [products, activeProduct]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if ((!activeProduct || !token) && !isAnonymous) return;
|
const checkCollectJSLoaded = () => {
|
||||||
|
if (window.CollectJS) {
|
||||||
|
setIsCollectJSLoaded(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const configureCollectJS = () => {
|
||||||
|
if (!checkCollectJSLoaded()) {
|
||||||
|
console.warn('CollectJS not loaded yet, retrying...');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const config: any = {
|
const config: any = {
|
||||||
variant: paymentFormType,
|
variant: paymentFormType,
|
||||||
@ -142,8 +155,19 @@ export const usePayment = ({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
window.CollectJS?.configure(config);
|
window.CollectJS?.configure(config);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((!activeProduct || !token) && !isAnonymous) return;
|
||||||
|
|
||||||
|
const retryInterval = setInterval(() => {
|
||||||
|
if (configureCollectJS()) {
|
||||||
|
clearInterval(retryInterval);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
return () => clearInterval(retryInterval);
|
||||||
}, [placementId, paywallId, activeProduct, token]);
|
}, [placementId, paywallId, activeProduct, token]);
|
||||||
|
|
||||||
const finishSubmit = async (response: any) => {
|
const finishSubmit = async (response: any) => {
|
||||||
@ -227,7 +251,8 @@ export const usePayment = ({
|
|||||||
submitInlineForm,
|
submitInlineForm,
|
||||||
closeModal,
|
closeModal,
|
||||||
formValidation,
|
formValidation,
|
||||||
isFormValid
|
isFormValid,
|
||||||
|
isCollectJSLoaded
|
||||||
}), [
|
}), [
|
||||||
isLoading,
|
isLoading,
|
||||||
paymentResponse,
|
paymentResponse,
|
||||||
@ -239,6 +264,7 @@ export const usePayment = ({
|
|||||||
submitInlineForm,
|
submitInlineForm,
|
||||||
closeModal,
|
closeModal,
|
||||||
formValidation,
|
formValidation,
|
||||||
isFormValid
|
isFormValid,
|
||||||
|
isCollectJSLoaded
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@ -170,7 +170,9 @@ function CompatibilityV2Routes() {
|
|||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2Gender())}
|
path={removePrefix(routes.client.compatibilityV2Gender())}
|
||||||
element={<Gender />}
|
element={<Gender />}
|
||||||
/>
|
>
|
||||||
|
<Route path="*" element={<Gender />} />
|
||||||
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.compatibilityV2GenderPartner())}
|
path={removePrefix(routes.client.compatibilityV2GenderPartner())}
|
||||||
element={<GenderPartner />}
|
element={<GenderPartner />}
|
||||||
|
|||||||
@ -164,7 +164,9 @@ function PalmistryV1Routes() {
|
|||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1Gender())}
|
path={removePrefix(routes.client.palmistryV1Gender())}
|
||||||
element={<GenderPalmistry />}
|
element={<GenderPalmistry />}
|
||||||
/>
|
>
|
||||||
|
<Route path="*" element={<GenderPalmistry />} />
|
||||||
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path={removePrefix(routes.client.palmistryV1Welcome())}
|
path={removePrefix(routes.client.palmistryV1Welcome())}
|
||||||
element={<FindHappiness />}
|
element={<FindHappiness />}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user