@licklist/design 0.44.464 → 0.44.465
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),a=e(r),n=require("react-router-dom"),i=require("../../static/loader/BlockLoader.js"),o=require("react-i18next"),u=e(require("react-bootstrap/Button")),s=require("react-hook-form"),c=e(require("react-bootstrap/Form")),l=require("../../static/loader/ButtonLoader.js"),d=e(require("react-bootstrap/Alert"));require("../../static/index.js");var f=require("@licklist/plugins/dist/hooks/Ryft/useRyftPayment"),m={insufficient_funds:"insufficientFunds",declined_do_not_honour:"declinedDoNotHonour",invalid_card_number:"invalidCardNumber",restricted_card:"restrictedCard",security_violation:"securityViolation",expired_card:"expiredCard",gateway_reject:"gatewayReject",bad_track_data:"badTrackData","3ds_authentication_failure":"3dsAuthenticationFailure",unknown_error:"unknownError"};exports.RyftPaymentForm=function(e){var y=e.accountId,_=e.isCreateLoading,E=e.initRyft,v=e.resetReferrer,p=e.onSubmit,b=o.useTranslation(["Design","Validation","Ryft"]).t,g=n.useHistory(),R=t.__read(r.useState(!1),2),h=R[0],q=R[1],k=t.__read(r.useState(!1),2),w=k[0],S=k[1],T=t.__read(r.useState(!1),2),F=T[0],N=T[1],A=t.__read(r.useState(void 0),2),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),a=e(r),n=require("react-router-dom"),i=require("../../static/loader/BlockLoader.js"),o=require("react-i18next"),u=e(require("react-bootstrap/Button")),s=require("react-hook-form"),c=e(require("react-bootstrap/Form")),l=require("../../static/loader/ButtonLoader.js"),d=e(require("react-bootstrap/Alert"));require("../../static/index.js");var f=require("@licklist/plugins/dist/hooks/Ryft/useRyftPayment"),m={insufficient_funds:"insufficientFunds",declined_do_not_honour:"declinedDoNotHonour",invalid_card_number:"invalidCardNumber",restricted_card:"restrictedCard",security_violation:"securityViolation",expired_card:"expiredCard",gateway_reject:"gatewayReject",bad_track_data:"badTrackData","3ds_authentication_failure":"3dsAuthenticationFailure",unknown_error:"unknownError"};exports.RyftPaymentForm=function(e){var y=e.accountId,_=e.isCreateLoading,E=e.initRyft,v=e.resetReferrer,p=e.onSubmit,b=o.useTranslation(["Design","Validation","Ryft"]).t,g=n.useHistory(),R=t.__read(r.useState(!1),2),h=R[0],q=R[1],k=t.__read(r.useState(!1),2),w=k[0],S=k[1],T=t.__read(r.useState(!1),2),F=T[0],N=T[1],A=t.__read(r.useState(void 0),2),x=A[0],P=A[1],D=f.useRyftPayment().addEventHandler,C=s.useForm(),j=function(){v&&v()},L=function(e){(null==e?void 0:e.id)&&(null==e?void 0:e.returnUrl)&&(window.location.href="".concat(e.returnUrl,"&ps=").concat(e.id),j())};return r.useEffect((function(){y.data&&!y.isError&&E((function(){D("cardValidationChanged",(function(e){q(e.isValid)})),N(!1)}),(function(){return N(!0)}))}),[y.data]),y.isLoading||y.isFetching||_?a.createElement("div",{className:"mt-5 pt-5"},a.createElement(i.BlockLoader,null)):y.isError?a.createElement("div",{className:"mt-5 ryft-init-failure"},a.createElement(d,{key:"danger",variant:"danger"},a.createElement("h5",null,b("Ryft:errorMessage")),b("Ryft:noPaymentProviderFound"))):F?a.createElement("div",{className:"mt-5 ryft-init-failure"},a.createElement(d,{key:"danger",variant:"danger"},a.createElement("h5",null,b("Ryft:errorMessage")),b("Ryft:initFailureMessage"),a.createElement("div",{className:"flex flex-column align-items-center mt-4"},a.createElement(u,{variant:"primary",onClick:function(){g.go(0)}},b("Ryft:refresh"))))):a.createElement(a.Fragment,null,a.createElement(c.Label,null,b("Design:paymentDetails")),a.createElement("form",{id:"ryft-pay-form",noValidate:!0,onSubmit:C.handleSubmit((function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,r,a;return t.__generator(this,(function(t){switch(t.label){case 0:S(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,p()];case 2:if((e=t.sent())||P("unknown_error"),"requiredAction"in e){if(e.status!==f.RYFT_STATUS_PENDING_ACTION||!(null===(a=e.requiredAction)||void 0===a?void 0:a.url))return L(e),[2];window.location.href=e.requiredAction.url,j()}return e.status===f.RYFT_STATUS_APPROVED||e.status===f.RYFT_STATUS_CAPTURED?(L(e),[2]):(e.lastError&&(P(e.lastError),j()),[3,5]);case 3:return r=t.sent(),P(r),[3,5];case 4:return S(!1),[7];case 5:return[2]}}))}))})),className:"ryft-payment-form"},a.createElement("div",{className:"submit-button-wrapper mt-3 px-1"},a.createElement(u,{type:"submit",disabled:w||!h},w&&a.createElement(l.ButtonLoader,null),b("Design:buyNow"))),x&&a.createElement("div",{id:"ryft-payment-error"},b("".concat(m[x])))))},exports.ryftErrorMap=m;
|
package/package.json
CHANGED
|
@@ -183,7 +183,7 @@ export const RyftPaymentForm = ({
|
|
|
183
183
|
onSubmit={methods.handleSubmit(handleSubmit)}
|
|
184
184
|
className="ryft-payment-form"
|
|
185
185
|
>
|
|
186
|
-
<div className="submit-button-wrapper mt-3">
|
|
186
|
+
<div className="submit-button-wrapper mt-3 px-1">
|
|
187
187
|
<Button type="submit" disabled={isBtnDisabled || !isValid}>
|
|
188
188
|
{isBtnDisabled && <ButtonLoader />}
|
|
189
189
|
{t("Design:buyNow")}
|