@ikas/storefront 3.0.0-alpha.36 → 3.0.0-alpha.38
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/build/_virtual/index.js_commonjs-proxy2.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
- package/build/components/checkout/components/form-item/index.js +1 -1
- package/build/components/checkout/components/form-item/model.d.ts +2 -0
- package/build/components/checkout/components/form-item/model.js +1 -1
- package/build/components/checkout/components/master-pass/index.js +1 -1
- package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
- package/build/components/checkout/modelMasterPass.d.ts +13 -5
- package/build/components/checkout/modelMasterPass.js +1 -1
- package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
- package/build/ext/axios/package.json.js +1 -1
- package/build/ikas.cjs +1 -1
- package/build/models/data/order/address/index.js +1 -1
- package/build/scripts/generators/config/content.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'../ext/
|
|
1
|
+
import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{runInAction as t}from"mobx";import{observer as n}from"mobx-react-lite";import o,{FormItemType as r}from"./model.js";import a from"./caret-down.js";import l from"./style.module.scss.js";import u from'../../../../ext/@ikas/react-phone-number-input/min/index.js';import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as i}from"../../../../utils/i18n.js";import
|
|
1
|
+
import*as e from"react";import{runInAction as t}from"mobx";import{observer as n}from"mobx-react-lite";import o,{FormItemType as r}from"./model.js";import a from"./caret-down.js";import l from"./style.module.scss.js";import u from'../../../../ext/@ikas/react-phone-number-input/min/index.js';import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as i}from"../../../../utils/i18n.js";import s from'../../../../ext/react-tooltip/dist/index.es.js';var c=n((function(n){var a=i().t,c=e.useState((function(){return new o(n)})),p=c[0],E=c[1];return e.useEffect((function(){s.rebuild()}),[]),e.useEffect((function(){t((function(){p.type=n.type}))}),[n.type]),e.useEffect((function(){t((function(){p.inputType=n.inputType}))}),[n.inputType]),e.useEffect((function(){t((function(){p.value=n.value}))}),[n.value]),e.useEffect((function(){t((function(){p.options=n.options}))}),[n.options]),e.useEffect((function(){t((function(){p.label=n.label}))}),[n.label]),e.useEffect((function(){t((function(){p.hasError=n.hasError}))}),[n.hasError]),e.useEffect((function(){t((function(){p.errorText=n.errorText}))}),[n.errorText]),e.useEffect((function(){t((function(){p.errorText=n.errorText}))}),[n.errorText]),e.useEffect((function(){t((function(){p.textAreaPlaceholder=n.textAreaPlaceholder}))}),[n.textAreaPlaceholder]),e.useEffect((function(){t((function(){p.rightContent=n.rightContent}))}),[n.rightContent]),e.useEffect((function(){t((function(){p.disableResize=n.disableResize}))}),[n.disableResize]),e.useEffect((function(){t((function(){E(new o(n))}))}),[n.onChange]),e.useEffect((function(){!p.country&&n.currentCountryCode&&p.onCountryChange(n.currentCountryCode)}),[n.currentCountryCode]),e.createElement("div",{className:p.formItemStyle,style:n.style},e.createElement("div",{className:l.FormItemWrapper},e.createElement("div",{className:l.FormItemInputWrapper},e.createElement("label",{className:p.labelStyle},p.label),p.type===r.TEXT&&e.createElement(m,{vm:p,disabled:p.disabled,autocomplete:n.autocomplete,name:n.name}),p.type===r.TEL&&e.createElement(u,{key:n.currentCountryCode||"1",disabled:p.disabled,defaultCountry:n.currentCountryCode,placeholder:a("checkout-page:enterPhoneNumber"),value:p.value?p.value:"",onChange:p.onPhoneChange,international:!0,addInternationalOption:!1}),p.type===r.TEXT_AREA&&e.createElement(d,{vm:p}),p.type===r.SELECT&&e.createElement(f,{vm:p,autocomplete:n.autocomplete})),!!p.hasError&&e.createElement("div",{className:l.ErrorMsg},p.errorText||""),!!n.tooltipText&&e.createElement("div",{className:l.FormItemTooltipContainer,"data-tip":n.tooltipText,"data-event":"touchstart focus mouseover","data-event-off":"mouseout"},"?"),!!p.rightContent&&e.createElement("div",{className:l.RightContent},p.rightContent)))})),m=n((function(t){var n=t.vm,o=t.name,r=t.autocomplete,a=t.type,l=t.disabled;return e.createElement("input",{type:a||"text",name:o,disabled:l,autoComplete:r,inputMode:n.inputType||"text",className:n.inputStyle,value:n.value,onChange:n.onValueChange})})),d=n((function(t){var n=t.vm;return e.createElement("textarea",{style:{resize:n.disableResize?"none":"initial"},value:n.value,disabled:n.disabled,onChange:n.onTextAreaValueChange,placeholder:n.textAreaPlaceholder||""})})),f=n((function(t){var n,o=t.vm,r=t.autocomplete;return e.createElement(e.Fragment,null,e.createElement("select",{className:o.inputStyle,disabled:o.disabled,autoComplete:r,onChange:o.onSelectChange},!o.value&&e.createElement("option",{selected:!0,disabled:!0,key:-1}),null===(n=o.options)||void 0===n?void 0:n.map((function(t,n){return e.createElement("option",{key:n+t.value,value:t.label,selected:o.value===t.value},t.label)}))),e.createElement("div",{className:l.ArrowContainer},e.createElement(a,null)))}));export{c as FormItem};
|
|
@@ -12,6 +12,7 @@ export default class FormItemViewModel implements Props {
|
|
|
12
12
|
textAreaPlaceholder?: string | null;
|
|
13
13
|
rightContent?: React.ReactElement | null;
|
|
14
14
|
disableResize?: boolean;
|
|
15
|
+
disabled: boolean;
|
|
15
16
|
onChange: (value: string) => void;
|
|
16
17
|
constructor(props: Props);
|
|
17
18
|
get formItemStyle(): string;
|
|
@@ -40,6 +41,7 @@ export interface Props {
|
|
|
40
41
|
textAreaPlaceholder?: string | null;
|
|
41
42
|
rightContent?: React.ReactElement | null;
|
|
42
43
|
disableResize?: boolean;
|
|
44
|
+
disabled?: boolean;
|
|
43
45
|
onChange: (value: string) => void;
|
|
44
46
|
}
|
|
45
47
|
export declare enum FormItemType {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";import t from"./style.module.scss.js";var i,n,o=function(){function n(t){var i=this;this.country=null,this.textAreaPlaceholder=null,this.onValueChange=function(e){i.disabled||i.onChange(e.target.value)},this.onTextAreaValueChange=function(e){i.disabled||i.onChange(e.target.value)},this.onSelectChange=function(e){var t;if(!i.disabled){var n=null===(t=i.options)||void 0===t?void 0:t.find((function(t){return t.label===e.target.value}));n&&i.onChange(n.value)}},this.onPhoneChange=function(e){i.disabled||i.onChange(e)},this.onCountryChange=function(e){i.disabled||(i.country=e)},this.type=t.type,this.inputType=t.inputType,this.options=t.options,this.label=t.label,this.value=t.value,this.hasError=t.hasError,this.errorText=t.errorText,this.tooltipText=t.tooltipText,this.country=t.country||null,this.textAreaPlaceholder=t.textAreaPlaceholder||null,this.rightContent=t.rightContent||null,this.disableResize=t.disableResize||!1,this.disabled=t.disabled||!1,this.onChange=t.onChange,e(this)}return Object.defineProperty(n.prototype,"formItemStyle",{get:function(){var e=[t.FormItem];return this.type===i.TEL&&this.hasError&&e.push(t.PhoneError),e.join(" ")},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"labelStyle",{get:function(){return this.value||this.type===i.TEL?[t.FieldLabel,t.FieldLabelTop].join(" "):[t.FieldLabel].join(" ")},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inputStyle",{get:function(){var e=[];return this.value&&e.push(t.Bottom),this.hasError&&e.push(t.Error),this.tooltipText&&e.push(t.WithTooltip),this.type===i.TEL&&e.push(t.Tel),this.disabled&&e.push(t.Disabled),e.join(" ")},enumerable:!1,configurable:!0}),n}();!function(e){e[e.TEXT=0]="TEXT",e[e.TEXT_AREA=1]="TEXT_AREA",e[e.SELECT=2]="SELECT",e[e.TEL=3]="TEL"}(i||(i={})),function(e){e.NUMERIC="numeric",e.TEL="tel",e.EMAIL="email"}(n||(n={}));export{n as FormItemInputType,i as FormItemType,o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as a}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{createTranslationInputData as t,useTranslation as
|
|
1
|
+
import e from"react";import{observer as a}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{createTranslationInputData as t,useTranslation as s}from"../../../../utils/i18n.js";import{Checkbox as r}from"../checkbox/index.js";import{FormItem as n}from"../form-item/index.js";import{FormItemType as m}from"../form-item/model.js";import{Button as i}from"../button/index.js";import d from"./svg/master-pass-by-master-card.js";import c from"../../style.module.scss.js";import l from"./style.module.scss.js";var u=a((function(a){var u=a.vm,p=s().t,C=o.translations["checkout-page"],v=e.useMemo((function(){var e,a;return t(null===(a=null===(e=null==C?void 0:C.masterPass)||void 0===e?void 0:e.creditCardForm)||void 0===a?void 0:a.checkboxLabel)}),[C]),M=e.useMemo((function(){return e.createElement("div",{className:l.CheckboxLabel},v.map((function(a,o){return a.isVariable?e.createElement("span",{key:o,className:l.Logo},e.createElement(d,null)):e.createElement(e.Fragment,{key:o},a.value)})))}),[v]),P=u.mpVM.isSaveCardToMasterPassPhoneNumberInputDisabled?u.mpVM.saveCardToMasterPassPhoneNumberDisabledInputValue({store:u.store,checkout:u.checkout}):u.mpVM.saveCardToMasterPass.phoneNumber;return e.createElement("div",null,e.createElement(r,{label:M,value:u.mpVM.saveCardToMasterPass.isCheckboxChecked,onChange:u.mpVM.onSaveCardToMasterPassCheckedChange}),u.mpVM.saveCardToMasterPass.isCheckboxChecked&&e.createElement("div",{className:l.FormWrapper},e.createElement("div",{className:c.RowPB},e.createElement(n,{name:"masterPassCardName",type:m.TEXT,label:p("checkout-page:masterPass.creditCardForm.cardName"),value:u.mpVM.saveCardToMasterPass.cardName,onChange:u.mpVM.onSaveCardToMasterPassCardNameChange})),u.mpVM.isSaveCardToMasterPassPhoneNumberInputVisible&&e.createElement("div",{className:c.RowPB},e.createElement(n,{name:"masterPassPhoneNumber",type:m.TEL,disabled:u.mpVM.isSaveCardToMasterPassPhoneNumberInputDisabled,label:p("checkout-page:masterPass.creditCardForm.phoneNumber"),value:P,onChange:u.mpVM.onSaveCardToMasterPassPhoneNumberChange})),e.createElement(i,{style:{width:"100%"},text:p("checkout-page:masterPass.creditCardForm.button"),isDisabled:u.mpVM.isSendConfirmationButtonDisabled,isLoading:u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending,onClick:function(){var e;if(!u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending&&(console.log("onSendConfirmationButtonClick 1"),u.checkout.selectedPaymentGateway&&(console.log("onSendConfirmationButtonClick 2"),u.cardData&&u.cardData.cardNumber&&u.cardData.expirationDate&&u.cardData.cvv&&(console.log("onSendConfirmationButtonClick 3"),u.mpVM.saveCardToMasterPass.cardName&&(console.log("onSendConfirmationButtonClick 4"),u.mpVM.saveCardToMasterPass.phoneNumber))))){var a,o,t,s,r={creditCard:{rtaPan:u.cardData.cardNumber.replace(/ /g,""),expiryDate:(a=u.cardData.expirationDate,o=a.replace(" / ",""),t=o.substring(0,2),s=o.substring(2,4),"".concat(s).concat(t)),cvc:u.cardData.cvv,accountAliasName:u.mpVM.saveCardToMasterPass.cardName,phoneNumber:null===(e=u.mpVM.saveCardToMasterPass.phoneNumber)||void 0===e?void 0:e.replace("+","")},store:u.store,checkout:u.checkout,paymentGateway:u.checkout.selectedPaymentGateway,callback:function(){u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending=!1}};console.log("onSendConfirmationButtonClick 5",r),u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending=!0,u.mpVM.onSaveCardToMasterPassSendConfirmationButtonClick(r)}}})))}));export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useRef as t,useState as o,useEffect as a}from"react";import{observer as
|
|
1
|
+
import e,{useRef as t,useState as o,useEffect as a}from"react";import{observer as s}from"mobx-react-lite";import"../../../../../storefront/index.js";import'../../../../../ext/lodash/isArguments.js';import'../../../../../ext/lodash/isBuffer.js';import'../../../../../ext/lodash/isTypedArray.js';import'../../../../../ext/lodash/_baseGetTag.js';import{useTranslation as n}from"../../../../../utils/i18n.js";import{Button as r}from"../../button/index.js";import{FormItem as c}from"../../form-item/index.js";import{FormItemType as m}from"../../form-item/model.js";import l from"../modal/index.js";import i from"./svg/master-pass.js";import p from"./style.module.scss.js";var u=s((function(s){var u=s.visible,d=s.type,f=s.vm,h=s.onClose,v=n().t,b=t(),g=o(180),x=g[0],k=g[1],M=o(""),E=M[0],j=M[1],P=o(!1),T=P[0],y=P[1],C=o(!1),O=C[0],N=C[1],V=function(){if(!O&&E&&f.checkout.masterPassPaymentGateway){N(!0),f.mpVM.onOtpFormSubmit({validationCode:E,store:f.store,checkout:f.checkout,callback:function(){N(!1),j(""),R()}})}},R=function(){k(0)},_=function(){k(180)};a((function(){if(!(x<1&&b.current))return b.current&&clearInterval(b.current),b.current=setInterval((function(){k(x-1)}),1e3),function(){b.current&&clearInterval(b.current)};clearInterval(b.current)}),[x]);var w,I,L,A,B,S,D=e.createElement("div",null,e.createElement("div",{className:p.Wrapper},"masterPassOtp"===d&&e.createElement("span",{"data-mr":!0,className:p.Logo},e.createElement(i,null)),e.createElement("p",{className:p.Text},v("masterPassOtp"===d?"checkout-page:masterPass.otpModal.otpTextMasterPass":"checkout-page:masterPass.otpModal.otpTextBank"))),e.createElement("div",{className:p.Countdown},v("checkout-page:masterPass.otpModal.countdownText"),e.createElement("strong",null,(w=x%3600,I=Math.floor(w/60),L=w%60,A=Math.ceil(L),B=I<10?"0".concat(I):I,S=A<10?"0".concat(A):A,"".concat(B,":").concat(S)))),f.mpVM.otpResponse.text&&e.createElement("div",{role:"error"===f.mpVM.otpResponse.status?"alert":"",className:p.OtpResponseText},f.mpVM.otpResponse.text),e.createElement("form",{onSubmit:function(e){e.preventDefault(),V()}},e.createElement(c,{type:m.TEXT,label:v("checkout-page:masterPass.otpModal.inputLabel"),name:"validationCode",rightContent:f.mpVM.isOtpFormSubmitAtLeastOnce?e.createElement("button",{type:"button",className:p.ResendButton,disabled:T,onClick:function(e){e.stopPropagation(),T||(y(!0),f.mpVM.resendOtp({store:f.store,checkout:f.checkout,callback:function(){y(!1),_(),j("")}}))}},v("checkout-page:masterPass.otpModal.resendText")):void 0,value:E,onChange:function(e){j(e)}}),e.createElement(r,{type:"submit",style:{width:"100%",marginTop:"16px"},text:v("checkout-page:masterPass.otpModal.buttonText"),isLoading:O,isDisabled:!E,onClick:V})));return a((function(){u?k(180):R()}),[u]),console.log("calisti modal",u),e.createElement(l,{visible:u,onClose:h},D)}));export{u as default};
|
|
@@ -64,7 +64,16 @@ export default class MasterPassModel {
|
|
|
64
64
|
cards: Card[];
|
|
65
65
|
selectedCard?: Card;
|
|
66
66
|
constructor();
|
|
67
|
-
get
|
|
67
|
+
get isSaveCardToMasterPassPhoneNumberInputVisible(): boolean;
|
|
68
|
+
get isSaveCardToMasterPassPhoneNumberInputDisabled(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Use when phone number input disabled
|
|
71
|
+
*/
|
|
72
|
+
saveCardToMasterPassPhoneNumberDisabledInputValue: ({ store, checkout, }: {
|
|
73
|
+
store: IkasBaseStore;
|
|
74
|
+
checkout: IkasCheckout;
|
|
75
|
+
}) => string;
|
|
76
|
+
get isSendConfirmationButtonDisabled(): boolean | undefined;
|
|
68
77
|
onSaveCardToMasterPassCheckedChange: (value: boolean) => void;
|
|
69
78
|
onSaveCardToMasterPassCardNameChange: (value: string) => void;
|
|
70
79
|
onSaveCardToMasterPassPhoneNumberChange: (value: string) => void;
|
|
@@ -90,9 +99,10 @@ export default class MasterPassModel {
|
|
|
90
99
|
operationType: MasterPassOperationTypeEnum;
|
|
91
100
|
phoneNumber: string;
|
|
92
101
|
}) => Promise<import("src/__api/types").MasterPassTokenResponse | undefined>;
|
|
93
|
-
phoneNumber: ({ store, checkout, }: {
|
|
102
|
+
phoneNumber: ({ store, checkout, withPlus, }: {
|
|
94
103
|
store: IkasBaseStore;
|
|
95
104
|
checkout: IkasCheckout;
|
|
105
|
+
withPlus?: boolean | undefined;
|
|
96
106
|
}) => string | null | undefined;
|
|
97
107
|
sendSmsLanguage: (store: IkasBaseStore) => string;
|
|
98
108
|
/**
|
|
@@ -146,7 +156,7 @@ export default class MasterPassModel {
|
|
|
146
156
|
* sonra linkleme başarıyla gerçekleşeceği için ListCard servisi ile kartlar listelenir.
|
|
147
157
|
*/
|
|
148
158
|
linkCardToClient: ({ store, checkout, callback, }: LinkCardToClientParams) => Promise<void>;
|
|
149
|
-
validateTransaction: ({ validationCode, store,
|
|
159
|
+
validateTransaction: ({ validationCode, store, checkout, callback, }: ValidateTransactionParams) => Promise<void>;
|
|
150
160
|
listCards: ({ store, checkout }: ListCardsParams) => Promise<void>;
|
|
151
161
|
deleteCard: ({ store, checkout, card }: DeleteCardParams) => Promise<void>;
|
|
152
162
|
}
|
|
@@ -174,9 +184,7 @@ declare type LinkCardToClientParams = {
|
|
|
174
184
|
callback?: () => void;
|
|
175
185
|
};
|
|
176
186
|
declare type ValidateTransactionParams = {
|
|
177
|
-
cartId: string;
|
|
178
187
|
validationCode: string;
|
|
179
|
-
paymentGateway: IkasPaymentGateway;
|
|
180
188
|
store: IkasBaseStore;
|
|
181
189
|
checkout: IkasCheckout;
|
|
182
190
|
callback: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__rest as s}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import{IkasStorefrontConfig as a}from"../../storefront/index.js";import n from"../../__api/queries/getMasterpassRequestToken.js";import{MasterPassOperationTypeEnum as r}from"../../__api/types/index.js";import{useTranslation as i}from"../../utils/i18n.js";var c="undefined"==typeof localStorage,d=/000000[0|1]{10}/g,l=/[0|1]1100[0|1]{11}/g,u=/[0|1]11100[0|1]{10}/g,p=function(){function p(){var p=this;this.checkMasterPassData={status:""},this.saveCardToMasterPass={isCheckboxChecked:!1,cardName:"",phoneNumber:"",isSendConfirmationButtonPending:!1},this.otpResponse={status:"",text:""},this.isOtpFormSubmitAtLeastOnce=!1,this.visibleModal=void 0,this.cards=[],this.onSaveCardToMasterPassCheckedChange=function(e){p.saveCardToMasterPass.isCheckboxChecked=e},this.onSaveCardToMasterPassCardNameChange=function(e){p.saveCardToMasterPass.cardName=e},this.onSaveCardToMasterPassPhoneNumberChange=function(e){p.saveCardToMasterPass.phoneNumber=e},this.onSaveCardToMasterPassSendConfirmationButtonClick=function(e){var t=e.creditCard,s=e.store,o=e.checkout,a=e.paymentGateway,n=e.callback;console.log("onSaveCardToMasterPassSendConfirmationButtonClick 1"),p.register({creditCard:t,store:s,checkout:o,paymentGateway:a,callback:n})},this.showLinkCardToClientModal=function(){p.visibleModal="linkCardToClientModal"},this.hideLinkCardToClientModal=function(){p.visibleModal=void 0},this.showOtpModal=function(e){p.otpResponse.text="",p.otpResponse.status="",p.visibleModal="masterPassOtp"===e?"otpModalMasterPass":"otpModalBank",console.log("calisti",p.visibleModal)},this.hideOtpModal=function(){p.visibleModal=void 0,p.otpResponse.text="",p.otpResponse.status="",p.isOtpFormSubmitAtLeastOnce=!1},this.onResponseModalClose=function(){p.visibleModal=void 0,p.mfsResponseModalText=""},this.onSuccessModalClose=function(){p.visibleModal=void 0},this.onLinkCardToClientButtonClick=function(e){p.linkCardToClient(e)},this.onOtpFormSubmit=function(e){p.otpResponse.text="",p.otpResponse.status="",p.validateTransaction(e)},this.MFS=function(){var e;if(!c){if(window.MFS&&(null===(e=window.MFS)||void 0===e?void 0:e.setClientId))return window.MFS;console.error("MFS can not use.")}},this.getToken=function(s){var o=s.cartId,a=s.paymentGatewayId,r=s.operationType,i=s.phoneNumber;return e(p,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,n({cartId:o,paymentGatewayId:a,operationType:r,phoneNumber:i})];case 1:return(e=t.sent()).data&&e.isSuccess&&!e.errors.length?[2,e.data]:(this.showTokenErrorWithModal(),[2])}}))}))},this.phoneNumber=function(e){var t,s,o=e.store,a=e.checkout,n=(null===(t=o.customerStore.customer)||void 0===t?void 0:t.phone)||(null===(s=a.shippingAddress)||void 0===s?void 0:s.phone);return n&&n.includes("+")&&(n=n.replace("+","")),n},this.sendSmsLanguage=function(e){var t,s="eng";if(e.localeOptions.length){var o=e.localeOptions.find((function(e){return e.routing.locale===a.getCurrentLocale()}));o&&o.iso3&&(s=null===(t=o.iso3)||void 0===t?void 0:t.toLowerCase())}return s},this.clearSaveCardToMasterPassForm=function(){p.saveCardToMasterPass.isCheckboxChecked=!1,p.saveCardToMasterPass.phoneNumber="",p.saveCardToMasterPass.cardName="",p.saveCardToMasterPass.isSendConfirmationButtonPending=!1},this.mfsResponseHandler=function(e){return function(t,s){console.log({field:"mfsResponseHandler",response:s}),e.callback&&e.callback();var o=function(e){var t;return null===(t=null==s?void 0:s.accountStatus)||void 0===t?void 0:t.match(e)};if(o(d)&&(p.checkMasterPassData.status="noMasterPassAccount"),o(l)&&(p.checkMasterPassData.status="hasMasterPassAccountButDoesNotHaveAnyOperation",p.showLinkCardToClientModal()),o(u)&&(p.checkMasterPassData.status="hasMasterPassAccountAndHasRelation",(null==e?void 0:e.checkout)&&e.store&&(p.listCards({store:e.store,checkout:e.checkout}),console.log("call listcards"))),"validateTransaction"!==e.source&&"resendOtp"!==e.source||!s.responseDescription||(p.otpResponse.text=s.responseDescription,"1409"===s.responseCode&&(p.otpResponse.status="error")),"0000"!=s.responseCode&&""!=s.responseCode||(console.log("Register Success"),"deleteCard"===e.source&&p.listCards({store:e.store,checkout:e.checkout}),"validateTransaction"===e.source&&(null==e?void 0:e.checkout)&&e.store&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===p.checkMasterPassData.status?p.visibleModal="linkCardToClientModalSuccess":p.visibleModal="otpModalSuccess",e.checkout.selectedPaymentGateway=void 0,p.clearSaveCardToMasterPassForm(),p.listCards({store:e.store,checkout:e.checkout}))),"5196"===s.responseCode&&s.responseDescription&&(p.visibleModal="mfsResponseModal",p.mfsResponseModalText=s.responseDescription),"5001"==s.responseCode||"5008"==s.responseCode){var a="5001"===s.responseCode?"bankOtp":"masterPassOtp";p.showOtpModal(a)}if("5010"==s.responseCode&&"undefined"!=typeof window)return console.log('response.responseCode == "5010"'),void window.location.assign(s.url3D+"&returnUrl="+window.location.href);console.log({source:"MFS response.responseDescription",responseDescription:s.responseDescription,response:s})}},this.showTokenErrorWithModal=function(){var e=i().t;p.visibleModal="mfsResponseModal",p.mfsResponseModalText=e("checkout-page:errorUnknown")},this.checkMasterPass=function(o){return e(p,void 0,void 0,(function(){var e,a,n,i,c,d,l=o.checkout,u=o.store;return s(o,["checkout","store"]),t(this,(function(t){switch(t.label){case 0:return console.log("checkMasterPass 1"),(e=this.MFS())?(a=this.phoneNumber({store:u,checkout:l}),console.log("checkMasterPass 2"),n=l.masterPassPaymentGateway,a&&n&&n.masterPassClientId?(console.log("checkMasterPass 3",a),[4,this.getToken({cartId:l.id,paymentGatewayId:n.id,operationType:r.CHECK_MASTER_PASS_USER,phoneNumber:a})]):[2]):[2];case 1:return(i=t.sent())?(e.setClientId(n.masterPassClientId),c=this.sendSmsLanguage(u),d=this.prepareFormData({sendSmsLanguage:c,sendSms:"N",referenceNo:i.requestReferenceNumber,token:i.token,userId:a}),e.checkMasterPass(d,this.mfsResponseHandler({source:"checkMasterPass",checkout:l,store:u})),console.log("checkMasterPass 4"),[2]):[2]}}))}))},this.register=function(s){var o=s.creditCard,a=s.store,n=s.checkout,i=s.paymentGateway,c=s.callback;return e(p,void 0,void 0,(function(){var e,s,d,l;return t(this,(function(t){switch(t.label){case 0:return console.log("register 1"),(e=this.MFS())?(console.log("register 2"),(s=o.phoneNumber)&&i.masterPassClientId?(console.log("register 3"),[4,this.getToken({cartId:n.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:s})]):[2]):[2];case 1:return d=t.sent(),console.log("register 4"),(null==d?void 0:d.token)?(l=this.prepareFormData({msisdn:s,token:null==d?void 0:d.token,referenceNo:d.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(a),rtaPan:o.rtaPan,expiryDate:o.expiryDate,cvc:o.cvc,accountAliasName:o.accountAliasName,timeZone:d.timeZone,sendSms:"Y",actionType:"A",clientIp:"",delinkReason:"",eActionType:"A",cardTypeFlag:"05",cpinFlag:"Y",defaultAccount:"Y",mmrpConfig:"110010",identityVerificationFlag:"Y",mobileAccountConfig:"MWA",uiChannelType:"6"}),console.log("reigster 5"),e.setClientId(i.masterPassClientId),e.register(l,this.mfsResponseHandler({source:"register",store:a,checkout:n,callback:c})),[2]):[2]}}))}))},this.resendOtp=function(s){var o=s.store,a=s.checkout,n=s.callback;return e(p,void 0,void 0,(function(){var e,s,r;return t(this,(function(t){return this.isOtpFormSubmitAtLeastOnce&&(e=this.MFS())?(s=e.getLastToken(),r=this.sendSmsLanguage(o),e.resendOtp(s,r,this.mfsResponseHandler({source:"resendOtp",store:o,checkout:a,callback:n})),[2]):[2]}))}))},this.linkCardToClient=function(s){var o=s.store,a=s.checkout,n=s.callback;return e(p,void 0,void 0,(function(){var e,s,i,c,d;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=this.phoneNumber({store:o,checkout:a}))&&(null==(i=a.masterPassPaymentGateway)?void 0:i.id))?[4,this.getToken({cartId:a.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(c=t.sent())?(d=this.prepareFormData({sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(o),token:c.token,referenceNo:c.requestReferenceNumber,cardAliasName:"",msisdn:s}),e.linkCardToClient(d,this.mfsResponseHandler({source:"linkCardToClient",store:o,checkout:a,callback:n})),[2]):(n&&n(),[2])}}))}))},this.validateTransaction=function(s){var o=s.validationCode,a=s.store,n=s.cartId,i=s.paymentGateway,c=s.checkout,d=s.callback;return e(p,void 0,void 0,(function(){var e,s,l,u;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&(s=this.phoneNumber({store:a,checkout:c}))?[4,this.getToken({cartId:n,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(l=t.sent())?(u=this.prepareFormData({pinType:"otp",validationCode:o,sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(a),token:l.token,referenceNo:l.requestReferenceNumber}),this.isOtpFormSubmitAtLeastOnce||(this.isOtpFormSubmitAtLeastOnce=!0),e.validateTransaction(u,this.mfsResponseHandler({source:"validateTransaction",store:a,checkout:c,callback:d})),[2]):[2]}}))}))},this.listCards=function(s){var o=s.store,a=s.checkout;return e(p,void 0,void 0,(function(){var e,s,n,i,c,d,l=this;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&(s=this.phoneNumber({store:o,checkout:a}))?(n=null===(d=a.masterPassPaymentGateway)||void 0===d?void 0:d.id,console.log("listCards paymentGatewayId",n),n?[4,this.getToken({cartId:a.id,paymentGatewayId:n,operationType:r.LIST_CARDS,phoneNumber:s})]:[2]):[2];case 1:return(i=t.sent())?(c=function(e,t){if("0000"!=t.responseCode&&""!=t.responseCode)return l.visibleModal="mfsResponseModal",l.mfsResponseModalText=t.responseDescription,console.error("mfs response.responseDescription",t.responseDescription),void console.log("TransactionID->",t.transactionId);var s=[];if(Array.isArray(t.cards))for(var o=0;o<t.cards.length;o++){var a=t.cards[o];a.paymentGatewayId=n,s.push(a)}l.cards=s,console.log("list_card response->",t),console.log("Cards",s),console.log("TransactionID->",t.transactionId)},e.listCards(s,i.token,c),[2]):[2]}}))}))},this.deleteCard=function(s){var o=s.store,a=s.checkout,n=s.card;return e(p,void 0,void 0,(function(){var e,s,i,c;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&(s=this.phoneNumber({store:o,checkout:a}))?[4,this.getToken({cartId:a.id,paymentGatewayId:n.paymentGatewayId,operationType:r.DELETE_CARD,phoneNumber:s})]:[2];case 1:return(i=t.sent())?(c=this.prepareFormData({sendSms:"N",msisdn:s,token:i.token,referenceNo:i.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(o),accountAliasName:n.Name}),e.deleteCard(c,this.mfsResponseHandler({source:"deleteCard",store:o,checkout:a})),[2]):[2]}}))}))},o(this)}return Object.defineProperty(p.prototype,"isSendConfirmationButtonDisabled",{get:function(){return!this.saveCardToMasterPass.cardName||!this.saveCardToMasterPass.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isLinkCardToClientModalVisible",{get:function(){return"linkCardToClientModal"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isOtpModalVisible",{get:function(){return"otpModalBank"===this.visibleModal||"otpModalMasterPass"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isResponseModalVisible",{get:function(){return!("mfsResponseModal"!==this.visibleModal||!this.mfsResponseModalText)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isSuccessModalVisible",{get:function(){return"linkCardToClientModalSuccess"===this.visibleModal||"otpModalSuccess"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"otpModalType",{get:function(){return"otpModalMasterPass"===this.visibleModal?"masterPassOtp":"bankOtp"},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"successModalType",{get:function(){return"hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status?"linkCardToClient":"register"},enumerable:!1,configurable:!0}),p.prototype.prepareFormData=function(e){var t=new FormData;return Object.entries(e).forEach((function(e){var s=e[0],o=e[1];return t.append(s,o)})),t},p}();export{p as default};
|
|
1
|
+
import{__awaiter as e,__generator as s,__rest as t}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import{IkasStorefrontConfig as a}from"../../storefront/index.js";import n from"../../__api/queries/getMasterpassRequestToken.js";import{MasterPassOperationTypeEnum as r}from"../../__api/types/index.js";import{useTranslation as i}from"../../utils/i18n.js";var c="undefined"==typeof localStorage,u=/000000[0|1]{10}/g,l=/[0|1]1100[0|1]{11}/g,d=/[0|1]11100[0|1]{10}/g,p=function(){function p(){var p=this;this.checkMasterPassData={status:""},this.saveCardToMasterPass={isCheckboxChecked:!1,cardName:"",phoneNumber:"",isSendConfirmationButtonPending:!1},this.otpResponse={status:"",text:""},this.isOtpFormSubmitAtLeastOnce=!1,this.visibleModal=void 0,this.cards=[],this.saveCardToMasterPassPhoneNumberDisabledInputValue=function(e){var s=e.store,t=e.checkout;return p.phoneNumber({store:s,checkout:t,withPlus:!0})||""},this.onSaveCardToMasterPassCheckedChange=function(e){p.saveCardToMasterPass.isCheckboxChecked=e},this.onSaveCardToMasterPassCardNameChange=function(e){p.saveCardToMasterPass.cardName=e},this.onSaveCardToMasterPassPhoneNumberChange=function(e){p.saveCardToMasterPass.phoneNumber=e},this.onSaveCardToMasterPassSendConfirmationButtonClick=function(e){var s=e.creditCard,t=e.store,o=e.checkout,a=e.paymentGateway,n=e.callback;console.log("onSaveCardToMasterPassSendConfirmationButtonClick 1"),p.register({creditCard:s,store:t,checkout:o,paymentGateway:a,callback:n})},this.showLinkCardToClientModal=function(){p.visibleModal="linkCardToClientModal"},this.hideLinkCardToClientModal=function(){p.visibleModal=void 0},this.showOtpModal=function(e){p.otpResponse.text="",p.otpResponse.status="",p.visibleModal="masterPassOtp"===e?"otpModalMasterPass":"otpModalBank",console.log("calisti",p.visibleModal)},this.hideOtpModal=function(){p.visibleModal=void 0,p.otpResponse.text="",p.otpResponse.status="",p.isOtpFormSubmitAtLeastOnce=!1},this.onResponseModalClose=function(){p.visibleModal=void 0,p.mfsResponseModalText=""},this.onSuccessModalClose=function(){p.visibleModal=void 0},this.onLinkCardToClientButtonClick=function(e){p.linkCardToClient(e)},this.onOtpFormSubmit=function(e){p.otpResponse.text="",p.otpResponse.status="",p.validateTransaction(e)},this.MFS=function(){var e;if(!c){if(window.MFS&&(null===(e=window.MFS)||void 0===e?void 0:e.setClientId))return window.MFS;console.error("MFS can not use.")}},this.getToken=function(t){var o=t.cartId,a=t.paymentGatewayId,r=t.operationType,i=t.phoneNumber;return e(p,void 0,void 0,(function(){var e;return s(this,(function(s){switch(s.label){case 0:return[4,n({cartId:o,paymentGatewayId:a,operationType:r,phoneNumber:i})];case 1:return(e=s.sent()).data&&e.isSuccess&&!e.errors.length?[2,e.data]:(this.showTokenErrorWithModal(),[2])}}))}))},this.phoneNumber=function(e){var s,t,o=e.store,a=e.checkout,n=e.withPlus,r=void 0!==n&&n,i=(null===(s=o.customerStore.customer)||void 0===s?void 0:s.phone)||(null===(t=a.shippingAddress)||void 0===t?void 0:t.phone);return i&&i.includes("+")&&!r&&(i=i.replace("+","")),i},this.sendSmsLanguage=function(e){var s,t="eng";if(e.localeOptions.length){var o=e.localeOptions.find((function(e){return e.routing.locale===a.getCurrentLocale()}));o&&o.iso3&&(t=null===(s=o.iso3)||void 0===s?void 0:s.toLowerCase())}return t},this.clearSaveCardToMasterPassForm=function(){p.saveCardToMasterPass.isCheckboxChecked=!1,p.saveCardToMasterPass.phoneNumber="",p.saveCardToMasterPass.cardName="",p.saveCardToMasterPass.isSendConfirmationButtonPending=!1},this.mfsResponseHandler=function(e){return function(s,t){console.log({field:"mfsResponseHandler",response:t}),e.callback&&e.callback();var o,a=function(e){var s;return null===(s=null==t?void 0:t.accountStatus)||void 0===s?void 0:s.match(e)};a(u)&&(p.checkMasterPassData.status="noMasterPassAccount",(o=p.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(p.saveCardToMasterPass.phoneNumber=o));a(l)&&(p.checkMasterPassData.status="hasMasterPassAccountButDoesNotHaveAnyOperation",p.showLinkCardToClientModal(),(o=p.phoneNumber({checkout:e.checkout,store:e.store,withPlus:!0}))&&(p.saveCardToMasterPass.phoneNumber=o));if(a(d)&&(p.checkMasterPassData.status="hasMasterPassAccountAndHasRelation",(null==e?void 0:e.checkout)&&e.store&&(p.listCards({store:e.store,checkout:e.checkout}),console.log("call listcards"))),"validateTransaction"!==e.source&&"resendOtp"!==e.source||!t.responseDescription||(p.otpResponse.text=t.responseDescription,"1409"===t.responseCode&&(p.otpResponse.status="error")),"0000"!=t.responseCode&&""!=t.responseCode||(console.log("Register Success"),"deleteCard"===e.source&&p.listCards({store:e.store,checkout:e.checkout}),"validateTransaction"===e.source&&(null==e?void 0:e.checkout)&&e.store&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===p.checkMasterPassData.status?p.visibleModal="linkCardToClientModalSuccess":p.visibleModal="otpModalSuccess",e.checkout.selectedPaymentGateway=void 0,p.clearSaveCardToMasterPassForm(),p.listCards({store:e.store,checkout:e.checkout}))),"5196"===t.responseCode&&t.responseDescription&&(p.visibleModal="mfsResponseModal",p.mfsResponseModalText=t.responseDescription),"5001"==t.responseCode||"5008"==t.responseCode){var n="5001"===t.responseCode?"bankOtp":"masterPassOtp";p.showOtpModal(n)}if("5010"==t.responseCode&&"undefined"!=typeof window)return console.log('response.responseCode == "5010"'),void window.location.assign(t.url3D+"&returnUrl="+window.location.href);console.log({source:"MFS response.responseDescription",responseDescription:t.responseDescription,response:t})}},this.showTokenErrorWithModal=function(){var e=i().t;p.visibleModal="mfsResponseModal",p.mfsResponseModalText=e("checkout-page:errorUnknown")},this.checkMasterPass=function(o){return e(p,void 0,void 0,(function(){var e,a,n,i,c,u,l=o.checkout,d=o.store;return t(o,["checkout","store"]),s(this,(function(s){switch(s.label){case 0:return console.log("checkMasterPass 1"),(e=this.MFS())?(a=this.phoneNumber({store:d,checkout:l}),console.log("checkMasterPass 2"),n=l.masterPassPaymentGateway,a&&n&&n.masterPassClientId?(console.log("checkMasterPass 3",a),[4,this.getToken({cartId:l.id,paymentGatewayId:n.id,operationType:r.CHECK_MASTER_PASS_USER,phoneNumber:a})]):[2]):[2];case 1:return(i=s.sent())?(e.setClientId(n.masterPassClientId),c=this.sendSmsLanguage(d),u=this.prepareFormData({sendSmsLanguage:c,sendSms:"N",referenceNo:i.requestReferenceNumber,token:i.token,userId:a}),e.checkMasterPass(u,this.mfsResponseHandler({source:"checkMasterPass",checkout:l,store:d})),console.log("checkMasterPass 4"),[2]):[2]}}))}))},this.register=function(t){var o=t.creditCard,a=t.store,n=t.checkout,i=t.paymentGateway,c=t.callback;return e(p,void 0,void 0,(function(){var e,t,u,l;return s(this,(function(s){switch(s.label){case 0:return console.log("register 1"),(e=this.MFS())?(console.log("register 2"),(t=o.phoneNumber)&&i.masterPassClientId?(console.log("register 3"),[4,this.getToken({cartId:n.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:t})]):[2]):[2];case 1:return u=s.sent(),console.log("register 4"),(null==u?void 0:u.token)?(l=this.prepareFormData({msisdn:t,token:null==u?void 0:u.token,referenceNo:u.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(a),rtaPan:o.rtaPan,expiryDate:o.expiryDate,cvc:o.cvc,accountAliasName:o.accountAliasName,timeZone:u.timeZone,sendSms:"Y",actionType:"A",clientIp:"",delinkReason:"",eActionType:"A",cardTypeFlag:"05",cpinFlag:"Y",defaultAccount:"Y",mmrpConfig:"110010",identityVerificationFlag:"Y",mobileAccountConfig:"MWA",uiChannelType:"6"}),console.log("reigster 5"),e.setClientId(i.masterPassClientId),e.register(l,this.mfsResponseHandler({source:"register",store:a,checkout:n,callback:c})),[2]):[2]}}))}))},this.resendOtp=function(t){var o=t.store,a=t.checkout,n=t.callback;return e(p,void 0,void 0,(function(){var e,t,r;return s(this,(function(s){return this.isOtpFormSubmitAtLeastOnce&&(e=this.MFS())?(t=e.getLastToken(),r=this.sendSmsLanguage(o),e.resendOtp(t,r,this.mfsResponseHandler({source:"resendOtp",store:o,checkout:a,callback:n})),[2]):[2]}))}))},this.linkCardToClient=function(t){var o=t.store,a=t.checkout,n=t.callback;return e(p,void 0,void 0,(function(){var e,t,i,c,u;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&((t=this.phoneNumber({store:o,checkout:a}))&&(null==(i=a.masterPassPaymentGateway)?void 0:i.id))?[4,this.getToken({cartId:a.id,paymentGatewayId:i.id,operationType:r.REGISTER_CARD,phoneNumber:t})]:[2];case 1:return(c=s.sent())?(u=this.prepareFormData({sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(o),token:c.token,referenceNo:c.requestReferenceNumber,cardAliasName:"",msisdn:t}),e.linkCardToClient(u,this.mfsResponseHandler({source:"linkCardToClient",store:o,checkout:a,callback:n})),[2]):(n&&n(),[2])}}))}))},this.validateTransaction=function(t){var o=t.validationCode,a=t.store,n=t.checkout,i=t.callback;return e(p,void 0,void 0,(function(){var e,t,c,u,l;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&((t=this.phoneNumber({store:a,checkout:n}))&&(c=n.masterPassPaymentGateway))?[4,this.getToken({cartId:n.id,paymentGatewayId:c.id,operationType:r.REGISTER_CARD,phoneNumber:t})]:[2];case 1:return(u=s.sent())?(l=this.prepareFormData({pinType:"otp",validationCode:o,sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(a),token:u.token,referenceNo:u.requestReferenceNumber}),this.isOtpFormSubmitAtLeastOnce||(this.isOtpFormSubmitAtLeastOnce=!0),e.validateTransaction(l,this.mfsResponseHandler({source:"validateTransaction",store:a,checkout:n,callback:i})),[2]):[2]}}))}))},this.listCards=function(t){var o=t.store,a=t.checkout;return e(p,void 0,void 0,(function(){var e,t,n,i,c,u,l=this;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&(t=this.phoneNumber({store:o,checkout:a}))?(n=null===(u=a.masterPassPaymentGateway)||void 0===u?void 0:u.id,console.log("listCards paymentGatewayId",n),n?[4,this.getToken({cartId:a.id,paymentGatewayId:n,operationType:r.LIST_CARDS,phoneNumber:t})]:[2]):[2];case 1:return(i=s.sent())?(c=function(e,s){if("0000"!=s.responseCode&&""!=s.responseCode)return l.visibleModal="mfsResponseModal",l.mfsResponseModalText=s.responseDescription,console.error("mfs response.responseDescription",s.responseDescription),void console.log("TransactionID->",s.transactionId);var t=[];if(Array.isArray(s.cards))for(var o=0;o<s.cards.length;o++){var a=s.cards[o];a.paymentGatewayId=n,t.push(a)}l.cards=t,console.log("list_card response->",s),console.log("Cards",t),console.log("TransactionID->",s.transactionId)},e.listCards(t,i.token,c),[2]):[2]}}))}))},this.deleteCard=function(t){var o=t.store,a=t.checkout,n=t.card;return e(p,void 0,void 0,(function(){var e,t,i,c;return s(this,(function(s){switch(s.label){case 0:return(e=this.MFS())&&(t=this.phoneNumber({store:o,checkout:a}))?[4,this.getToken({cartId:a.id,paymentGatewayId:n.paymentGatewayId,operationType:r.DELETE_CARD,phoneNumber:t})]:[2];case 1:return(i=s.sent())?(c=this.prepareFormData({sendSms:"N",msisdn:t,token:i.token,referenceNo:i.requestReferenceNumber,sendSmsLanguage:this.sendSmsLanguage(o),accountAliasName:n.Name}),e.deleteCard(c,this.mfsResponseHandler({source:"deleteCard",store:o,checkout:a})),[2]):[2]}}))}))},o(this)}return Object.defineProperty(p.prototype,"isSaveCardToMasterPassPhoneNumberInputVisible",{get:function(){return("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)&&("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||this.checkMasterPassData.status,!0)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isSaveCardToMasterPassPhoneNumberInputDisabled",{get:function(){return!("hasMasterPassAccountAndHasRelation"!==this.checkMasterPassData.status||!this.cards.length)||("hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status||"noMasterPassAccount"===this.checkMasterPassData.status)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isSendConfirmationButtonDisabled",{get:function(){if(this)return!this.saveCardToMasterPass.cardName||!this.saveCardToMasterPass.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isLinkCardToClientModalVisible",{get:function(){return"linkCardToClientModal"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isOtpModalVisible",{get:function(){return"otpModalBank"===this.visibleModal||"otpModalMasterPass"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isResponseModalVisible",{get:function(){return!("mfsResponseModal"!==this.visibleModal||!this.mfsResponseModalText)},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isSuccessModalVisible",{get:function(){return"linkCardToClientModalSuccess"===this.visibleModal||"otpModalSuccess"===this.visibleModal},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"otpModalType",{get:function(){return"otpModalMasterPass"===this.visibleModal?"masterPassOtp":"bankOtp"},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"successModalType",{get:function(){return"hasMasterPassAccountButDoesNotHaveAnyOperation"===this.checkMasterPassData.status?"linkCardToClient":"register"},enumerable:!1,configurable:!0}),p.prototype.prepareFormData=function(e){var s=new FormData;return Object.entries(e).forEach((function(e){var t=e[0],o=e[1];return s.append(t,o)})),s},p}();export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as r}from"mobx-react-lite";import{Checkbox as s}from"../../../components/checkbox/index.js";import o from"../../../components/customer-addresses/model.js";import t from"../../../components/customer-addresses/index.js";import"../../../../../storefront/index.js";import'../../../../../ext/lodash/isArguments.js';import'../../../../../ext/lodash/isBuffer.js';import'../../../../../ext/lodash/isTypedArray.js';import'../../../../../ext/lodash/_baseGetTag.js';import{useTranslation as n}from"../../../../../utils/i18n.js";var i=r((function(r){var i=r.vm,
|
|
1
|
+
import*as e from"react";import{observer as r}from"mobx-react-lite";import{Checkbox as s}from"../../../components/checkbox/index.js";import o from"../../../components/customer-addresses/model.js";import t from"../../../components/customer-addresses/index.js";import"../../../../../storefront/index.js";import'../../../../../ext/lodash/isArguments.js';import'../../../../../ext/lodash/isBuffer.js';import'../../../../../ext/lodash/isTypedArray.js';import'../../../../../ext/lodash/_baseGetTag.js';import{useTranslation as n}from"../../../../../utils/i18n.js";var i=r((function(r){var i=r.vm,d=n().t,m=e.useMemo((function(){return new o(i,"billing")}),[i]);return e.useEffect((function(){"in-store"===i.deliveryMethod&&i.setUseDifferentAddress(!0)}),[i]),e.createElement(e.Fragment,null,e.createElement("div",{style:{marginTop:"32px",marginBottom:i.useDifferentAddress?"24px":"0px"}},"address"===i.deliveryMethod&&e.createElement(s,{value:!i.useDifferentAddress,hasError:i.isErrorsVisible&&!i.isTermsAndConditionsChecked,label:d("checkout-page:useShippingForBilling"),onChange:function(e){return i.setUseDifferentAddress(!e)}})),i.useDifferentAddress&&e.createElement(t,{vm:m}))}));export{i as BillingAddress};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var s=[["axios@0.21.4","/Users/ikas/Projects/ikas-storefront"]],e="axios@0.21.4",a="axios@0.21.4",r=!1,i="sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",t="/axios",o={},n={type:"version",registry:!0,raw:"axios@0.21.4",name:"axios",escapedName:"axios",rawSpec:"0.21.4",saveSpec:null,fetchSpec:"0.21.4"},d=["/"],c="https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",p="0.21.4",m="/Users/ikas/Projects/ikas-storefront",l={name:"Matt Zabriskie"},u={"./lib/adapters/http.js":"./lib/adapters/xhr.js"},x={url:"https://github.com/axios/axios/issues"},g=[{path:"./dist/axios.min.js",threshold:"5kB"}],h={"follow-redirects":"^1.14.0"},b="Promise based HTTP client for the browser and node.js",j={coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},k="https://axios-http.com",v="dist/axios.min.js",f=["xhr","http","ajax","promise","node"],w="MIT",_="index.js",y="axios",H={type:"git",url:"git+https://github.com/axios/axios.git"},N={build:"NODE_ENV=production grunt build",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",examples:"node ./examples/server.js",fix:"eslint --fix lib/**/*.js",postversion:"git push && git push --tags",preversion:"npm test",start:"node ./sandbox/server.js",test:"grunt test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},V="./index.d.ts",q="dist/axios.min.js",A="0.21.4",P={_args:s,_from:"axios@0.21.4",_id:a,_inBundle:false,_integrity:i,_location:"/axios",_phantomChildren:o,_requested:n,_requiredBy:d,_resolved:c,_spec:"0.21.4",_where:m,author:l,browser:u,bugs:x,bundlesize:g,dependencies:h,description:b,devDependencies:j,homepage:"https://axios-http.com",jsdelivr:"dist/axios.min.js",keywords:f,license:"MIT",main:"index.js",name:"axios",repository:H,scripts:N,typings:"./index.d.ts",unpkg:q,version:"0.21.4"};export{s as _args,e as _from,a as _id,r as _inBundle,i as _integrity,t as _location,o as _phantomChildren,n as _requested,d as _requiredBy,c as _resolved,p as _spec,m as _where,l as author,u as browser,x as bugs,g as bundlesize,P as default,h as dependencies,b as description,j as devDependencies,k as homepage,v as jsdelivr,f as keywords,w as license,_ as main,y as name,H as repository,N as scripts,V as typings,q as unpkg,A as version};
|