@ikas/storefront 3.0.0-alpha.34 → 3.0.0-alpha.36
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/assets/translations/checkout/en.js +1 -1
- package/build/assets/translations/checkout/tr.js +1 -1
- package/build/components/checkout/components/customer-addresses/index.js +1 -1
- package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.d.ts +3 -2
- package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.js +1 -1
- package/build/components/checkout/components/master-pass/modal-link-card-to-client/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal-otp/index.d.ts +0 -8
- package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
- package/build/components/checkout/components/master-pass/modal-otp/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal-success/index.d.ts +11 -0
- package/build/components/checkout/components/master-pass/modal-success/index.js +1 -0
- package/build/components/checkout/components/master-pass/modal-success/style.module.scss.js +1 -0
- package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/master-pass-by-master-card-small.d.ts +0 -0
- package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/master-pass-by-master-card-small.js +0 -0
- package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/success.d.ts +0 -0
- package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/success.js +0 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/modelMasterPass.d.ts +18 -3
- package/build/components/checkout/modelMasterPass.js +1 -1
- package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/ikas.cjs +1 -1
- package/build/scripts/generators/config/content.js +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { IkasPaymentGateway } from "src/models/data/payment-gateway";
|
|
|
3
3
|
import { IkasBaseStore } from "src/store";
|
|
4
4
|
import { MasterPassOperationTypeEnum } from "src/__api/types";
|
|
5
5
|
import { OtpModalType } from "./components/master-pass/modal-otp";
|
|
6
|
+
import { SuccessModalType } from "./components/master-pass/modal-success";
|
|
6
7
|
declare type MFS_CB_HOC_TYPE_SOURCE = "checkMasterPass" | "register" | "resendOtp" | "linkCardToClient" | "validateTransaction" | "listCards" | "deleteCard";
|
|
7
8
|
declare type MFS_CB_HOC_TYPE = (params: {
|
|
8
9
|
source: MFS_CB_HOC_TYPE_SOURCE;
|
|
@@ -53,8 +54,12 @@ export default class MasterPassModel {
|
|
|
53
54
|
cardName: string;
|
|
54
55
|
phoneNumber: string;
|
|
55
56
|
};
|
|
56
|
-
otpResponse
|
|
57
|
-
|
|
57
|
+
otpResponse: {
|
|
58
|
+
status: "error" | "";
|
|
59
|
+
text: string;
|
|
60
|
+
};
|
|
61
|
+
isOtpFormSubmitAtLeastOnce: boolean;
|
|
62
|
+
visibleModal?: "otpModalBank" | "otpModalMasterPass" | "otpModalSuccess" | "linkCardToClientModal" | "linkCardToClientModalSuccess" | "mfsResponseModal";
|
|
58
63
|
mfsResponseModalText?: string;
|
|
59
64
|
cards: Card[];
|
|
60
65
|
selectedCard?: Card;
|
|
@@ -64,11 +69,18 @@ export default class MasterPassModel {
|
|
|
64
69
|
onSaveCardToMasterPassCardNameChange: (value: string) => void;
|
|
65
70
|
onSaveCardToMasterPassPhoneNumberChange: (value: string) => void;
|
|
66
71
|
onSaveCardToMasterPassSendConfirmationButtonClick: ({ creditCard, store, checkout, paymentGateway, callback, }: RegisterParams) => void;
|
|
72
|
+
get isLinkCardToClientModalVisible(): boolean;
|
|
73
|
+
get isOtpModalVisible(): boolean;
|
|
74
|
+
get isResponseModalVisible(): boolean;
|
|
75
|
+
get isSuccessModalVisible(): boolean;
|
|
76
|
+
get otpModalType(): OtpModalType;
|
|
77
|
+
get successModalType(): SuccessModalType;
|
|
67
78
|
showLinkCardToClientModal: () => void;
|
|
68
79
|
hideLinkCardToClientModal: () => void;
|
|
69
80
|
showOtpModal: (modalType: OtpModalType) => void;
|
|
70
81
|
hideOtpModal: () => void;
|
|
71
82
|
onResponseModalClose: () => void;
|
|
83
|
+
onSuccessModalClose: () => void;
|
|
72
84
|
onLinkCardToClientButtonClick: (params: LinkCardToClientParams) => void;
|
|
73
85
|
onOtpFormSubmit: (params: ValidateTransactionParams) => void;
|
|
74
86
|
MFS: () => MFS | undefined;
|
|
@@ -88,10 +100,12 @@ export default class MasterPassModel {
|
|
|
88
100
|
* @returns FormData
|
|
89
101
|
*/
|
|
90
102
|
prepareFormData<T>(data: T): FormData;
|
|
103
|
+
clearSaveCardToMasterPassForm: () => void;
|
|
91
104
|
/**
|
|
92
105
|
* MFS (MasterPass js library) response handler.
|
|
93
106
|
*/
|
|
94
107
|
mfsResponseHandler: MFS_CB_HOC_TYPE;
|
|
108
|
+
showTokenErrorWithModal: () => void;
|
|
95
109
|
/**
|
|
96
110
|
* CheckMasterPass for customer. Call it on initial. For more detail keep reading. [tr]
|
|
97
111
|
|
|
@@ -131,7 +145,7 @@ export default class MasterPassModel {
|
|
|
131
145
|
* ve evet cevabında linkCardtoClient servisi çağrılır. Sms doğrulaması yapıldıktan
|
|
132
146
|
* sonra linkleme başarıyla gerçekleşeceği için ListCard servisi ile kartlar listelenir.
|
|
133
147
|
*/
|
|
134
|
-
linkCardToClient: ({ store, checkout }: LinkCardToClientParams) => Promise<void>;
|
|
148
|
+
linkCardToClient: ({ store, checkout, callback, }: LinkCardToClientParams) => Promise<void>;
|
|
135
149
|
validateTransaction: ({ validationCode, store, cartId, paymentGateway, checkout, callback, }: ValidateTransactionParams) => Promise<void>;
|
|
136
150
|
listCards: ({ store, checkout }: ListCardsParams) => Promise<void>;
|
|
137
151
|
deleteCard: ({ store, checkout, card }: DeleteCardParams) => Promise<void>;
|
|
@@ -157,6 +171,7 @@ declare type LinkCardToClientParams = {
|
|
|
157
171
|
cartId: string;
|
|
158
172
|
checkout: IkasCheckout;
|
|
159
173
|
store: IkasBaseStore;
|
|
174
|
+
callback?: () => void;
|
|
160
175
|
};
|
|
161
176
|
declare type ValidateTransactionParams = {
|
|
162
177
|
cartId: string;
|
|
@@ -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 n}from"../../storefront/index.js";import a from"../../__api/queries/getMasterpassRequestToken.js";import{MasterPassOperationTypeEnum as r}from"../../__api/types/index.js";var i="undefined"==typeof localStorage,c=/000000[0|1]{10}/g,d=/[0|1]1100[0|1]{11}/g,l=/[0|1]11100[0|1]{10}/g,u=function(){function u(){var u=this;this.checkMasterPassData={status:""},this.saveCardToMasterPass={isCheckboxChecked:!1,cardName:"",phoneNumber:"",isSendConfirmationButtonPending:!1},this.visibleModal=void 0,this.cards=[],this.onSaveCardToMasterPassCheckedChange=function(e){u.saveCardToMasterPass.isCheckboxChecked=e},this.onSaveCardToMasterPassCardNameChange=function(e){u.saveCardToMasterPass.cardName=e},this.onSaveCardToMasterPassPhoneNumberChange=function(e){u.saveCardToMasterPass.phoneNumber=e},this.onSaveCardToMasterPassSendConfirmationButtonClick=function(e){var t=e.creditCard,s=e.store,o=e.checkout,n=e.paymentGateway,a=e.callback;console.log("onSaveCardToMasterPassSendConfirmationButtonClick 1"),u.register({creditCard:t,store:s,checkout:o,paymentGateway:n,callback:a})},this.showLinkCardToClientModal=function(){u.visibleModal="linkCardToClientModal"},this.hideLinkCardToClientModal=function(){u.visibleModal=void 0},this.showOtpModal=function(e){u.visibleModal="masterPassOtp"===e?"otpModalMasterPass":"otpModalBank",console.log("calisti",u.visibleModal)},this.hideOtpModal=function(){u.visibleModal=void 0},this.onResponseModalClose=function(){u.visibleModal=void 0,u.mfsResponseModalText=""},this.onLinkCardToClientButtonClick=function(e){u.linkCardToClient(e)},this.onOtpFormSubmit=function(e){u.validateTransaction(e)},this.MFS=function(){var e;if(!i){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,n=s.paymentGatewayId,r=s.operationType,i=s.phoneNumber;return e(u,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,a({cartId:o,paymentGatewayId:n,operationType:r,phoneNumber:i})];case 1:return(e=t.sent()).data&&e.isSuccess&&!e.errors.length?[2,e.data]:[2]}}))}))},this.phoneNumber=function(e){var t,s,o=e.store,n=e.checkout,a=(null===(t=o.customerStore.customer)||void 0===t?void 0:t.phone)||(null===(s=n.shippingAddress)||void 0===s?void 0:s.phone);return a&&a.includes("+")&&(a=a.replace("+","")),a},this.sendSmsLanguage=function(e){var t,s="eng";if(e.localeOptions.length){var o=e.localeOptions.find((function(e){return e.routing.locale===n.getCurrentLocale()}));o&&o.iso3&&(s=null===(t=o.iso3)||void 0===t?void 0:t.toLowerCase())}return s},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(c)&&(u.checkMasterPassData.status="noMasterPassAccount"),o(d)&&(u.checkMasterPassData.status="hasMasterPassAccountButDoesNotHaveAnyOperation",u.showLinkCardToClientModal()),o(l)&&(u.checkMasterPassData.status="hasMasterPassAccountAndHasRelation",(null==e?void 0:e.checkout)&&e.store&&(u.listCards({store:e.store,checkout:e.checkout}),console.log("call listcards"))),"1409"===s.responseCode&&s.responseDescription&&(u.otpResponse=s.responseDescription),"0000"!=s.responseCode&&""!=s.responseCode||(console.log("Register Success"),"deleteCard"===e.source&&u.listCards({store:e.store,checkout:e.checkout}),"validateTransaction"===e.source&&(null==e?void 0:e.checkout)&&e.store&&(u.visibleModal=void 0,u.listCards({store:e.store,checkout:e.checkout}))),"5196"===s.responseCode&&s.responseDescription&&(u.visibleModal="mfsResponseModal",u.mfsResponseModalText=s.responseDescription),"5001"!=s.responseCode&&"5008"!=s.responseCode)"5010"!=s.responseCode||"undefined"==typeof window?console.error("MFS response.responseDescription",s.responseDescription):window.location.assign(s.url3D+"&returnUrl="+window.location.href);else{var n="5001"===s.responseCode?"bankOtp":"masterPassOtp";u.showOtpModal(n)}}},this.checkMasterPass=function(o){return e(u,void 0,void 0,(function(){var e,n,a,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())?(n=this.phoneNumber({store:u,checkout:l}),console.log("checkMasterPass 2"),a=l.masterPassPaymentGateway,n&&a&&a.masterPassClientId?(console.log("checkMasterPass 3",n),[4,this.getToken({cartId:l.id,paymentGatewayId:a.id,operationType:r.CHECK_MASTER_PASS_USER,phoneNumber:n})]):[2]):[2];case 1:return(i=t.sent())?(e.setClientId(a.masterPassClientId),c=this.sendSmsLanguage(u),d=this.prepareFormData({sendSmsLanguage:c,sendSms:"N",referenceNo:i.requestReferenceNumber,token:i.token,userId:n}),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,n=s.store,a=s.checkout,i=s.paymentGateway,c=s.callback;return e(u,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:a.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(n),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:n,checkout:a,callback:c})),[2]):[2]}}))}))},this.resendOtp=function(s){var o=s.store,n=s.checkout,a=s.callback;return e(u,void 0,void 0,(function(){var e,s,r;return t(this,(function(t){return(e=this.MFS())?(s=e.getLastToken(),r=this.sendSmsLanguage(o),e.resendOtp(s,r,this.mfsResponseHandler({source:"resendOtp",store:o,checkout:n,callback:a})),[2]):[2]}))}))},this.linkCardToClient=function(s){var o=s.store,n=s.checkout;return e(u,void 0,void 0,(function(){var e,s,a,i,c;return t(this,(function(t){switch(t.label){case 0:return(e=this.MFS())&&((s=this.phoneNumber({store:o,checkout:n}))&&(null==(a=n.masterPassPaymentGateway)?void 0:a.id))?[4,this.getToken({cartId:n.id,paymentGatewayId:a.id,operationType:r.REGISTER_CARD,phoneNumber:s})]:[2];case 1:return(i=t.sent())?(c=this.prepareFormData({sendSms:"Y",sendSmsLanguage:this.sendSmsLanguage(o),token:i.token,referenceNo:i.requestReferenceNumber,cardAliasName:"",msisdn:s}),e.linkCardToClient(c,this.mfsResponseHandler({source:"linkCardToClient",store:o,checkout:n})),[2]):[2]}}))}))},this.validateTransaction=function(s){var o=s.validationCode,n=s.store,a=s.cartId,i=s.paymentGateway,c=s.checkout,d=s.callback;return e(u,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:n,checkout:c}))?[4,this.getToken({cartId:a,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(n),token:l.token,referenceNo:l.requestReferenceNumber}),e.validateTransaction(u,this.mfsResponseHandler({source:"validateTransaction",store:n,checkout:c,callback:d})),[2]):[2]}}))}))},this.listCards=function(s){var o=s.store,n=s.checkout;return e(u,void 0,void 0,(function(){var e,s,a,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:n}))?(a=null===(d=n.masterPassPaymentGateway)||void 0===d?void 0:d.id,console.log("listCards paymentGatewayId",a),a?[4,this.getToken({cartId:n.id,paymentGatewayId:a,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 n=t.cards[o];n.paymentGatewayId=a,s.push(n)}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,n=s.checkout,a=s.card;return e(u,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:n}))?[4,this.getToken({cartId:n.id,paymentGatewayId:a.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:a.Name}),e.deleteCard(c,this.mfsResponseHandler({source:"deleteCard",store:o,checkout:n})),[2]):[2]}}))}))},o(this)}return Object.defineProperty(u.prototype,"isSendConfirmationButtonDisabled",{get:function(){return!this.saveCardToMasterPass.cardName||!this.saveCardToMasterPass.phoneNumber},enumerable:!1,configurable:!0}),u.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},u}();export{u as default};
|
|
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 +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,m=n().t,d=e.useMemo((function(){return new o(i,"billing")}),[i]);return e.createElement(e.Fragment,null,e.createElement("div",{style:{marginTop:"32px",marginBottom:i.useDifferentAddress?"24px":"0px"}},
|
|
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,m=n().t,d=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"}},e.createElement(s,{value:!i.useDifferentAddress,hasError:i.isErrorsVisible&&!i.isTermsAndConditionsChecked,label:m("checkout-page:useShippingForBilling"),onChange:function(e){return i.setUseDifferentAddress(!e)}})),i.useDifferentAddress&&e.createElement(t,{vm:d}))}));export{i as BillingAddress};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import s from"../../components/svg/success-circle.js";import r from"../../components/expandable-section/index.js";import d from"../../components/credit-card-form/svg/amex.js";import n from"../../components/credit-card-form/svg/master-card.js";import l from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.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{formatMoney as c}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/city/index.js";import"mobx";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/attribute-value/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../../models/data/customer-attribute/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/customer-review-summary/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/merchant-settings/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/adjustment/index.js";import"../../../../models/data/order/gift-line/index.js";import"../../../../models/data/order/invoice/index.js";import"../../../../models/data/order/line-item/discount/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/option/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/tracking-info/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/payment-method/index.js";import"../../../../models/data/order/refund/line-item/index.js";import"../../../../models/data/order/shipping-line/index.js";import"../../../../models/data/order/tax-line/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/product-campaign/campaign/index.js";import"../../../../models/data/product-campaign/filter/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import"../../../../models/data/payment-gateway/index.js";import{PaymentMethodEnum as p,PaymentGatewayTypeEnum as v,OrderPackageStatusEnum as E,TransactionCardAssociationEnum as x}from"../../../../__api/types/index.js";var f=t((function(t){var E,f,j,h,k,T,N=t.vm,y=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a);e&&e===N.checkout.id&&localStorage.removeItem(a)}}),[]);var I=((null===(E=N.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(f=N.checkout.customer)||void 0===f?void 0:f.lastName)||""),L=((null===(j=N.checkout.shippingAddress)||void 0===j?void 0:j.firstName)||"")+" "+((null===(h=N.checkout.shippingAddress)||void 0===h?void 0:h.lastName)||""),A=N.paymentGateways.find((function(e){var t;return e.id===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),D=null===(k=N.successTransaction)||void 0===k?void 0:k.paymentMethodDetail,S=e.useMemo((function(){var t,o,a,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:paymentMethod")),A&&e.createElement(e.Fragment,null,!!A.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:A.logoUrl})),!A.logoUrl&&e.createElement("div",{className:i.InfoText},A.paymentMethodType===p.CREDIT_CARD&&A.type===v.INTERNAL?y("checkout-page:creditCard"):A.name),!!A.description&&A.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:A.description}}))),"CREDIT_CARD"===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case x.AMERICAN_EXPRESS:return e.createElement(d,null);case x.MASTER_CARD:return e.createElement(n,null);case x.TROY:return e.createElement(l,null);case x.VISA:return e.createElement(m,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==D?void 0:D.lastFourDigits)||""))),(null===(o=null==D?void 0:D.installment)||void 0===o?void 0:o.installmentCount)&&D.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," ").concat(y("checkout-page:installments"))),null!==D.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," x ").concat(c(D.installment.installmentPrice,N.checkout.currencyCode)))))),"address"===N.deliveryMethod&&e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:billingAddress")),!!(null===(a=N.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=N.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),C=e.useMemo((function(){var t,o,a,s,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=N.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},I),!!(null===(o=N.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:i.InfoText},null===(a=N.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,"in-store"===N.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:receiver")),e.createElement("div",{className:[i.InfoText,i.withMBottom].join(" ")},L)),e.createElement("div",{className:i.InfoTitle},"address"===N.deliveryMethod?y("checkout-page:shippingAddress"):y("checkout-page:pickUpLocation")),!!(null===(s=N.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=N.checkout.shippingAddress)||void 0===r?void 0:r.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(s,null),e.createElement("span",{className:i.SuccessTitle},y("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},y("address"===N.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:I})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(N.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},N.checkout.dateStr),e.createElement(g,{vm:N})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(T=N.checkout.customer)||void 0===T?void 0:T.email),e.createElement("div",{className:i.InfoText},I))),e.createElement(r,{title:y("checkout-page:paymentSummary")},S),e.createElement(r,{title:y("checkout-page:shippingSummary")},C),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,y("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return N.setContactModalVisible(!0)}},y("checkout-page:helpCta"))),e.createElement(o,{text:y("checkout-page:actions.backToShopping"),onClick:N.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),g=t((function(t){var o,a=t.vm,s=u().t,r=i.Yellow;switch(a.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:r=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:r=i.Red}return e.createElement("div",{className:[i.OrderStatus,r].join(" ")},a.checkout.orderPackageStatus?null===(o=[{types:[E.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(a.checkout.orderPackageStatus)})))||void 0===o?void 0:o.text:"")}));export{f as StepSuccess};
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import s from"../../components/svg/success-circle.js";import r from"../../components/expandable-section/index.js";import d from"../../components/credit-card-form/svg/amex.js";import n from"../../components/credit-card-form/svg/master-card.js";import l from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.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{formatMoney as c}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import"../../../../models/data/cart/campaign-offer/index.js";import"../../../../models/data/cart/index.js";import"../../../../models/data/category/index.js";import"../../../../models/data/city/index.js";import"mobx";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/attribute-value/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../../models/data/customer-attribute/index.js";import"../../../../models/data/customer-review/index.js";import"../../../../models/data/customer-review-summary/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/merchant-settings/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/adjustment/index.js";import"../../../../models/data/order/gift-line/index.js";import"../../../../models/data/order/invoice/index.js";import"../../../../models/data/order/line-item/discount/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/option/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/tracking-info/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/payment-method/index.js";import"../../../../models/data/order/refund/line-item/index.js";import"../../../../models/data/order/shipping-line/index.js";import"../../../../models/data/order/tax-line/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/product-attribute/index.js";import"../../../../models/data/product-filter/index.js";import"../../../../models/data/product-campaign/campaign/index.js";import"../../../../models/data/product-campaign/filter/index.js";import"../../../../models/data/product-option-set/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/variant-type/variant-value/index.js";import"../../../../models/theme/theme.js";import"../../../../models/theme/page/index.js";import"../../../../models/theme/component/prop/index.js";import"../../../../models/theme/page/component/prop-value/link.js";import"../../../../models/ui/brand-list/index.js";import"../../../../models/ui/blog-list/index.js";import"../../../../models/ui/blog-category-list/index.js";import"../../../../models/ui/category-list/index.js";import"../../../../models/ui/product-detail/index.js";import"../../../../models/ui/product-list/index.js";import"../../../../models/ui/product-attribute-detail/index.js";import"../../../../models/ui/product-attribute-list/index.js";import"../../../../models/ui/customer-review-list/index.js";import"../../../../models/ui/customer-review-summary-list/index.js";import"../../../../models/ui/validator/index.js";import"../../../../models/ui/validator/rules/index.js";import"../../../../models/ui/validator/form/login.js";import"../../../../models/ui/validator/form/address.js";import"../../../../models/ui/validator/form/register.js";import"../../../../models/ui/validator/form/contact-form.js";import"../../../../models/ui/validator/form/forgot-password.js";import"../../../../models/ui/validator/form/recover-password.js";import"../../../../models/ui/validator/form/account-info.js";import"../../../../models/ui/validator/form/raffle-form.js";import"../../../../models/ui/validator/form/customer-review.js";import"../../../../models/ui/raffle-list/index.js";import"../../../../models/theme/settings/index.js";import"../../../../models/theme/custom-data/index.js";import"../../../../models/data/payment-gateway/index.js";import{PaymentMethodEnum as p,PaymentGatewayTypeEnum as v,OrderPackageStatusEnum as E,TransactionCardAssociationEnum as x}from"../../../../__api/types/index.js";var f=t((function(t){var E,f,j,h,k,T,N=t.vm,y=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a);e&&e===N.checkout.id&&localStorage.removeItem(a)}}),[]);var I=((null===(E=N.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(f=N.checkout.customer)||void 0===f?void 0:f.lastName)||""),L=((null===(j=N.checkout.shippingAddress)||void 0===j?void 0:j.firstName)||"")+" "+((null===(h=N.checkout.shippingAddress)||void 0===h?void 0:h.lastName)||""),A=N.paymentGateways.find((function(e){var t;return e.id===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),D=null===(k=N.successTransaction)||void 0===k?void 0:k.paymentMethodDetail,S=e.useMemo((function(){var t,o,a,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:paymentMethod")),A&&e.createElement(e.Fragment,null,!!A.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:A.logoUrl})),!A.logoUrl&&e.createElement("div",{className:i.InfoText},A.paymentMethodType===p.CREDIT_CARD&&A.type===v.INTERNAL?y("checkout-page:creditCard"):A.name),!!A.description&&A.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:A.description}}))),"CREDIT_CARD"===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case x.AMERICAN_EXPRESS:return e.createElement(d,null);case x.MASTER_CARD:return e.createElement(n,null);case x.TROY:return e.createElement(l,null);case x.VISA:return e.createElement(m,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==D?void 0:D.lastFourDigits)||""))),(null===(o=null==D?void 0:D.installment)||void 0===o?void 0:o.installmentCount)&&D.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," ").concat(y("checkout-page:installments"))),null!==D.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," x ").concat(c(D.installment.installmentPrice,N.checkout.currencyCode)))))),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:billingAddress")),!!(null===(a=N.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=N.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),C=e.useMemo((function(){var t,o,a,s,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=N.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},I),!!(null===(o=N.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:i.InfoText},null===(a=N.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,"in-store"===N.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:receiver")),e.createElement("div",{className:[i.InfoText,i.withMBottom].join(" ")},L)),e.createElement("div",{className:i.InfoTitle},"address"===N.deliveryMethod?y("checkout-page:shippingAddress"):y("checkout-page:pickUpLocation")),!!(null===(s=N.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=N.checkout.shippingAddress)||void 0===r?void 0:r.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(s,null),e.createElement("span",{className:i.SuccessTitle},y("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},y("address"===N.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:I})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(N.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},N.checkout.dateStr),e.createElement(g,{vm:N})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(T=N.checkout.customer)||void 0===T?void 0:T.email),e.createElement("div",{className:i.InfoText},I))),e.createElement(r,{title:y("checkout-page:paymentSummary")},S),e.createElement(r,{title:y("checkout-page:shippingSummary")},C),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,y("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return N.setContactModalVisible(!0)}},y("checkout-page:helpCta"))),e.createElement(o,{text:y("checkout-page:actions.backToShopping"),onClick:N.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),g=t((function(t){var o,a=t.vm,s=u().t,r=i.Yellow;switch(a.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:r=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:r=i.Red}return e.createElement("div",{className:[i.OrderStatus,r].join(" ")},a.checkout.orderPackageStatus?null===(o=[{types:[E.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(a.checkout.orderPackageStatus)})))||void 0===o?void 0:o.text:"")}));export{f as StepSuccess};
|