@ikas/storefront 6.1.0-beta.320 → 6.1.0-beta.321
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/components/checkout/model.d.ts +4 -0
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/thy-logo.d.ts +8 -0
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/thy-logo.js +1 -0
- package/build/components/page/head.js +1 -1
- package/build/models/data/payment-gateway/index.d.ts +2 -0
- package/build/models/data/payment-gateway/index.js +1 -1
- package/package.json +11 -11
|
@@ -15,6 +15,7 @@ import { RetrieveInstallmentInfoQueryParams, SaveCartInput, MilesSmilesDetailsRe
|
|
|
15
15
|
import { LocalizedAddressModel } from "@ikas/localized-address";
|
|
16
16
|
import { IkasOrderTransactionWithPrices, IkasStoreCreditBalance } from "@ikas/storefront-models";
|
|
17
17
|
import { StripeExpressCheckoutAddressInput, StripeExpressCheckoutSessionContextResponse } from "@ikas/storefront-api/src/__api/types";
|
|
18
|
+
export declare const MILES_SMILES_RATE_PER_POINT: Record<string, number>;
|
|
18
19
|
export declare type IUnavailableItems = {
|
|
19
20
|
item: IkasOrderLineItem;
|
|
20
21
|
stockCount: number;
|
|
@@ -36,6 +37,7 @@ export default class CheckoutViewModel {
|
|
|
36
37
|
cardData?: CreditCardData | null;
|
|
37
38
|
paymentGateways: IkasPaymentGateway[];
|
|
38
39
|
useMilesSmiles: boolean;
|
|
40
|
+
milesToRedeem: number;
|
|
39
41
|
milesSmilesDetails?: MilesSmilesDetailsResponse | null;
|
|
40
42
|
productFiles: IkasProductFile[];
|
|
41
43
|
installmentInfo?: RetrieveInstallmentInfoResponse | null;
|
|
@@ -136,6 +138,8 @@ export default class CheckoutViewModel {
|
|
|
136
138
|
get isHepsiPay(): boolean | null | undefined;
|
|
137
139
|
get isIyzico(): boolean | null | undefined;
|
|
138
140
|
get isFree(): boolean;
|
|
141
|
+
get milesSmilesRedeemValue(): number;
|
|
142
|
+
get isMilesSmilesFullPayment(): boolean;
|
|
139
143
|
get store(): IkasBaseStore;
|
|
140
144
|
get isCouponCodeRequirementDefult(): boolean;
|
|
141
145
|
get isCouponCodeRequirementOpen(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCartCreatedBy as o,IkasCouponCodeRequirement as a,IkasCorporateInvoiceRequirement as c,IkasPaymentMethodType as d,IkasPaymentGatewayType as u,IkasOrderShippingMethod as l,IkasOrderStatus as h,IkasCustomerEmailSubscriptionStatus as p,IkasOrderPaymentStatus as m,IkasTransactionStatus as f,IkasCartCampaignOfferStatus as g,IkasCampaignOfferTargetPageType as y,IkasOrderLineItemStatus as v,IkasAmountType as S,IkasCampaignOfferProductApplicablePriceEnum as b}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as I}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as P}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as A}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as w}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as O}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as E}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as R}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import{LocalizedAddressModel as N}from"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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 T from"./components/credit-card-form/model.js";import M from"../../store/customer/api.js";import j from"../../store/checkout/index.js";import L from"../../store/cart/api.js";import G,{MFS_ELEMENT_ID as D,MFS_SCRIPT_URL as x}from"./modelMasterPass.js";import _ from"../../store/product/index.js";import{TransactionCardAssociationEnum as V,SaveCartInput as U,CheckStocksLineInput as F,getLoyaltyCustomerInfo as B,listSpendingMethodsByCartId as H,LoyaltyProgramPointEarningTypeEnum as Y,listEarningMethods as K,getMilesSmilesDetails as Z,RewardSourceEnum as z,CampaignOfferTargetPageTypeEnum as W}from"@ikas/storefront-api";import{IkasBaseStore as q}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as Q}from"@ikas/storefront-config";import{Analytics as X}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import J from"../../models/data/order/address/ikas-localized-order-address.js";import $ from"../../store/location/index.js";import{isEqual as ee,getCookieValue as te}from"../../utils/helper.js";import ie from"../../analytics/ikasV3.js";var se,ne,re=/^\d+$/,oe=/^3[47]/,ae="undefined"==typeof localStorage,ce=function(){function re(o,c,h,C,A,V,re,oe,ce,le){var he=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=se.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.useMilesSmiles=!1,this.milesSmilesDetails=null,this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.iyzicoResponse=null,this.isIyzicoLoading=!1,this.showIyzicoContainer=!1,this.stripeExpressCheckoutSessionResponse=null,this.isStripeExpressCheckoutSessionVisible=!1,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.storeCreditBalance=null,this.loyaltyCustomerInfo=null,this.loyaltySpendingMethods=null,this.loyaltySpendingMethodsAll=null,this.loyaltyEarningMethod=null,this.isLoyaltyPointsVisible=!1,this.showTestModal=!1,this.openEditOrderTransaction=null,this.previousRawValue="",this.previousBin=null,this.init=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,q.getInstance().customerStore.waitUntilInitialized()];case 2:return t.sent(),(e=this.isOpenEditOrder||this.checkout.edited)?[4,this.getOpenEditOrderTransaction()]:[3,4];case 3:t.sent(),t.label=4;case 4:return e&&(this.openEditOrderTransaction||this.checkout.edited)||this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 5:return t.sent(),[2]}}))}))},this.initStep=function(){return t(he,void 0,void 0,(function(){var t,s,n,r,o,c,d;return i(this,(function(i){switch(i.label){case 0:if(Q.getIsEditor())return this.step=se.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),s=t.get("step"),n=t.get("failed"),r=t.get("error"),s){if(this.step=s,this.step===se.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(se.INFO)];if(this.step!==se.PAYMENT||this.canProceedToPayment){if(this.step===se.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(se.INFO)];if(![se.INFO,se.SUCCESS,se.SHIPPING,se.PAYMENT].includes(this.step))return[2,this.changeStep(se.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings||this.isManualOrderWithoutShippingLines?[2,this.changeStep(se.INFO)]:[2,this.changeStep(se.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return i.sent(),this.step!==se.SHIPPING&&this.step!==se.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new I(e(e({},this.checkoutSettings),{couponCodeRequirement:a.DEFAULT}))),this.step!==se.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return i.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:i.sent(),this.checkShippingCountries(),i.label=4;case 4:return[4,this.getStockLocations()];case 5:return i.sent(),[4,this.getAvailableStockLocations()];case 6:i.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),i.label=7;case 7:return this.step!==se.SHIPPING||1!==(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=se.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==se.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==se.SUCCESS||this.checkout.orderPaymentStatus!==m.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:ne.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:i.sent(),i.label=9;case 9:return this.step!==se.PAYMENT&&this.step!==se.SUCCESS?[3,15]:[4,this.listPaymentGateways()];case 10:return i.sent(),this.checkout.hasCustomer?[4,this.getStoreCreditBalance()]:[3,12];case 11:i.sent(),i.label=12;case 12:return this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,14];case 13:i.sent(),i.label=14;case 14:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:ne.NO_SHIPPING_ERROR},this.isMinTransactionError&&(this.error={type:ne.API_ERROR,data:this.t("checkout-page:minTransactionErrorMessage",{value:200})}),this.isCheckoutLoaded=!0,[2];i.label=15;case 15:return this.step===se.SUCCESS?[3,23]:this.isOpenEditOrder?[3,18]:this.checkout.isComplete?[2,this.changeStep(se.SUCCESS)]:[3,16];case 16:return[4,this.initialStockCheck()];case 17:i.sent(),i.label=18;case 18:return this.checkout.hasCustomer?[4,this.getLoyaltyCustomerInfo()]:[3,22];case 19:return i.sent(),[4,this.listSpendingMethodsByCartId()];case 20:return i.sent(),[4,this.listEarningMethods()];case 21:i.sent(),i.label=22;case 22:return[3,25];case 23:return[4,this.getSuccessTransaction()];case 24:i.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),i.label=25;case 25:return n&&(this.error={type:ne.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,X.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getOpenEditOrderTransaction=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,M.listOrderTransactionsWithPrices({input:{orderId:this.checkout.id}})];case 1:return(e=t.sent()).isSuccess&&e.data&&e.data.chargedAmount&&(this.openEditOrderTransaction=e.data),[2]}}))}))},this.getSuccessTransaction=function(){return t(he,void 0,void 0,(function(){var e,t,s;return i(this,(function(i){switch(i.label){case 0:return[4,M.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=i.sent(),this.successTransactions=e.isSuccess&&(null===(t=e.data)||void 0===t?void 0:t.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,d,u,l,h,m,f,g,y,v;return i(this,(function(i){switch(i.label){case 0:return e=new U(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=i.sent(),i.label=2;case 2:return this.step!==se.INFO&&this.step!==se.SHIPPING&&this.step!==se.PAYMENT||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||this.step===se.PAYMENT||(e.billingAddress=null),e.billingAddress&&(this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress||this.useDifferentAddress&&!this.isShowBillingAddressOnShippingStep&&this.checkoutSettings.showCompanyInfoInShippingAddress)&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(o=e.shippingAddress)||void 0===o?void 0:o.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===p.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),null===(null===(c=null===(a=e.shippingAddress)||void 0===a?void 0:a.city)||void 0===c?void 0:c.code)&&""===(null===(u=null===(d=e.shippingAddress)||void 0===d?void 0:d.city)||void 0===u?void 0:u.name)&&(e.shippingAddress.city.name="-"),null===(null===(h=null===(l=e.billingAddress)||void 0===l?void 0:l.city)||void 0===h?void 0:h.code)&&""===(null===(f=null===(m=e.billingAddress)||void 0===m?void 0:m.city)||void 0===f?void 0:f.name)&&(e.billingAddress.city.name="-"),[4,L.saveCart({input:e})];case 3:if((null==(t=i.sent())?void 0:t.graphQLErrors)&&t.graphQLErrors.length)throw s=t.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(g=s.extensions)||void 0===g?void 0:g.code)?{type:ne.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(y=s.extensions)||void 0===y?void 0:y.code)?{type:ne.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(v=s.extensions)||void 0===v?void 0:v.code)?{type:ne.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:ne.API_ERROR,data:t.firstErrorMessage};return[2,t.data]}}))}))},this.inStockDeliveryInputData=function(e){return t(he,void 0,void 0,(function(){var t,s,n=this;return i(this,(function(i){return t=e,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,d,u,h,p,m,f;return i(this,(function(i){switch(i.label){case 0:return this.isManualOrder||this.isOpenEditOrderWithTransaction?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===l.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(p=Q.getStockLocationIds())||void 0===p?void 0:p.length)?Q.getStockLocationIds():null,[4,j.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(t=i.sent()).isSuccess)throw s="UPSELL"===this.checkout.createdBy,n=s?this.t("checkout-page:upsellTimeErrorMessage"):t.firstErrorMessage,{type:ne.API_ERROR,data:n};if(null==(r=null===(f=null===(m=t.data)||void 0===m?void 0:m.lines)||void 0===f?void 0:f.filter((function(e){return!e.isAvailable})))?void 0:r.length){for(o=[],a=function(e){var t=c.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&o.push({item:t,stockCount:e.stockCount})},c=this,d=0,u=r;d<u.length;d++)h=u[d],a(h);throw{type:ne.STOCK_ERROR,data:o}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(e){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.isKlarnaPaymentCompleted=e,[2]}))}))},this.setIsLoyaltyPointsVisible=function(e){he.isLoyaltyPointsVisible=e},this.removeUnavailableItems=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:t=0,s=e,i.label=1;case 1:return t<s.length?(n=s[t],[4,q.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:i.sent(),i.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,j.getAvailableShippingCountries({salesChannelId:Q.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return t(he,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:return Q.getPickupStockLocationIds()?[4,j.listStockLocation({id:{in:Q.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=i.sent()).isSuccess||!(null===(t=e.data)||void 0===t?void 0:t.length))return this.error={type:ne.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,i.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(he,void 0,void 0,(function(){var e,t,s,n=this;return i(this,(function(i){switch(i.label){case 0:return Q.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,j.getAvailableStockLocations({lines:e.map((function(e){return new F(e)})),stockLocationIdList:Q.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(t=i.sent()).isSuccess)return this.error={type:ne.API_ERROR},[2];s=Q.getCurrentRouting(),this.availableStockLocations=(t.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),i.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=he.shippingCountryIds)||void 0===e?void 0:e.length)||(he.error={type:ne.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;he.deliveryMethod!==e&&("address"===e&&(he.checkout.stockLocationId=null,(null===(t=he.customerAddresses)||void 0===t?void 0:t.length)?he.onSelectedShippingAddressIdChange(he.customerAddresses[0].id||"-1"):(he.checkout.shippingAddress=new J,he.checkout.shippingAddress.countrySettings=he.countrySettings,he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones)),he.deliveryMethod=e,he.isErrorsVisible=!1)},this.initialStockCheck=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.getStoreCreditBalance=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,j.getStoreCreditBalance()];case 1:return e=t.sent(),this.storeCreditBalance=e.data,[2]}}))}))},this.getLoyaltyCustomerInfo=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,B({cartId:this.checkout.id})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltyCustomerInfo=e.data),[2]}}))}))},this.listSpendingMethodsByCartId=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,H({cartId:this.checkout.id})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltySpendingMethods=e.data.filter((function(e){return e.isAvailable})),this.loyaltySpendingMethodsAll=e.data),[2]}}))}))},this.listEarningMethods=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,K()];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltyEarningMethod=e.data.find((function(e){return"ORDER_CREATE"===e.methodType&&e.pointEarningType===Y.DYNAMIC_ORDER_AMOUNT}))),[2]}}))}))},this.listPaymentGateways=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,o,a,c,d,u,l,h,p,m,f,g,y,v,S,b,k=this;return i(this,(function(i){switch(i.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,t=Q.getPaymentGateways().map((function(e){return e.id})),[4,j.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:t},locale:Q.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=i.sent()).isSuccess?(null===(y=s.data)||void 0===y?void 0:y.length)||this.isFree?(this.error=void 0,n=null===(v=s.data)||void 0===v?void 0:v.some((function(e){return"IKAS_WALLET"===e.code})),this.isMinTransactionError=n&&this.finalPrice<200&&!this.isDigitalOnly,this.isMinTransactionError?[2]:(o=s.data||[],this.step===se.PAYMENT&&(o=o.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(k.checkout.currencyCode)})),(a=null===(S=this.checkout.shippingAddress)||void 0===S?void 0:S.country)&&a.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")}))),c=null===(b=this.checkout.billingAddress)||void 0===b?void 0:b.country,!a&&c&&c.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(c.iso2||"")})))),d=[],r(Q.getPaymentGateways(),"order").forEach((function(e){var t=null==o?void 0:o.find((function(t){return t.id===e.id}));t&&d.push(t)})),"57088576-ed0f-43d6-acbc-4e280c85cbea"===Q.getStorefrontId()?[4,Z()]:[3,3])):(this.error={type:ne.NO_SHIPPING_ERROR},[2]):(this.error={type:ne.API_ERROR,data:s.firstErrorMessage},[2]);case 2:if(!(u=i.sent()).isSuccess&&["UNAUTHORIZED","MILES_SMILES_LOGIN_REQUIRED"].some((function(e){return u.errorCodes.includes(e)})))return l=Q.getCurrentRouting(),h=(null==l?void 0:l.path)?"/".concat(l.path):"",p=encodeURIComponent(this.checkoutUrl),window.location.href="".concat(h,"/account/login?redirect=").concat(p,"&ms_login_required=true"),[2];u.isSuccess&&u.data&&(this.milesSmilesDetails=u.data),i.label=3;case 3:return this.paymentGateways=e?o:d,m=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=k.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,4]:(this.setPaymentGateway(-1!==m?m:0),[3,6]);case 4:return this.step!==se.PAYMENT?[3,6]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 5:i.sent(),i.label=6;case 6:return this.step===se.PAYMENT&&(f=o.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=f,(g=document.createElement("script")).id=D,g.src=x,g.onload=function(){k.mpVM.checkMasterPass({checkout:k.checkout,store:q.getInstance()})},document.head.appendChild(g)),[2]}}))}))},this.retrieveInstallmentInfo=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:return[4,j.retrieveInstallmentInfo(e)];case 1:return t=i.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;he.store.customerStore.customer?(null===(t=he.customerAddresses)||void 0===t||t.forEach((function(e){e.checkoutSettings=he.checkoutSettings,e.shippingZones=he.shippingZones})),he.checkout.customer=new w(e(e({},he.store.customerStore.customer),{notificationsAccepted:he.store.customerStore.customer.subscriptionStatus===p.SUBSCRIBED}))):he.checkout.customer=new w(he.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){he.checkout.shippingAddress&&(he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones,he.checkout.shippingAddress.countrySettings=he.countrySettings,he.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){he.checkout.billingAddress&&(he.checkout.billingAddress.checkoutSettings=he.checkoutSettings,he.checkout.billingAddress.shippingZones=he.shippingZones,he.checkout.billingAddress.countrySettings=he.countrySettings,he.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!he.isDigitalOnly)if(he.isInStoreDelivery)he.setCheckoutShippingAddressSettings();else if(he.checkout.shippingAddress){if(he.store.customerStore.customer){var e=null==(t=he.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=he.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return he.onSelectedShippingAddressIdChange(e.id||"-1"),void he.setCheckoutShippingAddressSettings()}he.checkout.shippingAddress=new J(n(he.checkout.shippingAddress)||{}),he.setCheckoutShippingAddressSettings()}else if(he.store.customerStore.customer){var t=he.customerAddresses;he.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else he.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(he.useDifferentAddress=!!localStorage.getItem("sAddr"),he.checkout.billingAddress){if(he.store.customerStore.customer){var e=null==(t=he.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=he.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return he.onSelectedBillingAddressIdChange(e.id||"-1"),void he.setCheckoutBillingAddressSettings()}he.checkout.billingAddress=new J(n(he.checkout.billingAddress)||{}),he.setCheckoutBillingAddressSettings()}else if(he.store.customerStore.customer){var t=he.customerAddresses;he.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||he.useDifferentAddress||!he.checkout.shippingAddress||he.isInStoreDelivery||(he.checkout.billingAddress=new J(n(he.checkout.shippingAddress)),he.setCheckoutBillingAddressSettings())}else he.onSelectedBillingAddressIdChange("-1"),he.useDifferentAddress||!he.checkout.shippingAddress||he.isInStoreDelivery||(he.checkout.billingAddress=new J(n(he.checkout.shippingAddress)),he.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=e.shippingSettingsId,this.checkout.shippingZoneRateId=e.shippingZoneRateId,[4,this.saveCart()]);case 1:return(t=i.sent())&&(this.checkout=new k(t,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(e){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.checkout.stockLocationId=e.id,[2]}))}))},this.onCouponCodeApply=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a,c;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,L.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(c=null===(a=this.cardData)||void 0===a?void 0:a.cardNumber)||void 0===c?void 0:c.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:i.sent(),i.label=3;case 3:return n?(o=this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT||this.checkout.totalFinalPrice===o.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:i.sent(),this.isCampaignOfferLoaded=!0,s?X.addCouponCode(n):X.removeCouponCode(n),i.label=7;case 7:return t.isSuccess||(this.couponError=t.errorCodes[0]),[3,9];case 8:return i.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,L.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:i.sent(),i.label=3;case 3:return n?(this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:i.sent(),this.isCampaignOfferLoaded=!0,i.label=7;case 7:return[3,9];case 8:return i.sent(),[3,9];case 9:return[2]}}))}))},this.removeLoyaltyPointsFromCart=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,10,,11]),[4,L.removeLoyaltyPointsFromCart({cartId:this.checkout.id,loyaltySpendingMethodId:s})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,9];case 2:i.sent(),i.label=3;case 3:return n?(this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,9];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:return i.sent(),this.isCampaignOfferLoaded=!0,X.removeLoyaltyPoints(n),[4,this.getLoyaltyCustomerInfo()];case 7:return i.sent(),[4,this.listSpendingMethodsByCartId()];case 8:i.sent(),i.label=9;case 9:return[3,11];case 10:return i.sent(),[3,11];case 11:return[2]}}))}))},this.getAvailableShippingZones=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,$.getAvailableShippingZones({salesChannelId:Q.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(he.selectedShippingAddressId=e,"-1"===e)he.checkout.shippingAddress=new J,he.checkout.shippingAddress.countrySettings=he.countrySettings;else{var i=null===(t=he.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(he.checkout.shippingAddress=new J(i),he.checkout.shippingAddress.countrySettings=he.countrySettings)}he.checkout.shippingAddress&&(he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(he.selectedBillingAddressId=e,"-1"===e)he.checkout.billingAddress=new J,he.checkout.billingAddress.countrySettings=he.countrySettings;else{var i=null===(t=he.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(he.checkout.billingAddress=new J(i),he.checkout.billingAddress.countrySettings=he.countrySettings)}he.checkout.billingAddress&&(he.checkout.billingAddress.checkoutSettings=he.checkoutSettings,he.checkout.billingAddress.shippingZones=he.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){he.isTermsAndConditionsChecked=e,he.isIyzico&&(he.showIyzicoContainer=e)},this.onCardNumberChange=function(e){if(he.cardData){var t=(e||"").replace(/\D/g,""),i=he.previousRawValue,s=t.slice(0,8),n=he.previousBin;if(!(t.length>16)){var r=i.length<8&&t.length>=8,o=8===s.length&&s!==n;(r||o)&&8===s.length&&(he.getRetrieveInstallmentInfo(t),he.previousBin=s),t.length<8&&i.length>=8&&(he.cardData.installmentCount=1,he.installmentInfo=void 0,he.previousBin=null),he.isAmexCard(t)?he.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(t).join(" "):he.cardData.cardNumber=de(t,4).join(" "),he.previousRawValue=t}}},this.getRetrieveInstallmentInfo=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:e.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return i.sent(),(null===(t=this.cardData)||void 0===t?void 0:t.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){he.cardData&&(he.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(he.cardData&&(!(e.length>he.cardData.expirationDate.length)||ue(e))){if(0===(null===(t=he.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(he.cardData.expirationDate=de(d,2).join(" / "))}},this.onCvcChange=function(e){if(he.cardData&&(!(e.length>he.cardData.cvv.length)||ue(e))){if(he.isAmexCard()){if(e.length>4)return}else if(e.length>3)return;he.cardData.cvv=e}},this.saveAddress=function(s){return t(he,void 0,void 0,(function(){var t,r,o,a,c,d,u,l,h,p,m,f,g=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new P(e(e({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:i.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),i.label=2;case 2:return[3,4];case 3:return l=i.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.getRoutingPath=function(){var e=Q.getCurrentRouting();return(null==e?void 0:e.path)?"/".concat(e.path):""},this.getGoToCartHref=function(){var e=he.getRoutingPath();return"".concat(e,"/cart")},this.getBackToShoppingHref=function(){var e=he.getRoutingPath();return"".concat(e,"/")},this.getGoToLoginHref=function(){var e=he.getRoutingPath();return"".concat(e)+"/account/login?redirect="+encodeURIComponent(he.checkoutUrl)},this.onHandleBillingAddressOnShippingStep=function(){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new J(e({},this.checkout.shippingAddress)):this.checkout.billingAddress=new J(e({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod||this.isShowBillingAddressOnShippingStep?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(se.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(se.SHIPPING):this.changeStep(se.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(se.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(se.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!he.canPerformPayment||(he.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){he.error={type:e,data:t}},this.onCompletePaymentClick=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c;return i(this,(function(i){switch(i.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return i.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return this.isFree||!this.isIyzico?[3,4]:[4,this.saveCart()];case 3:return i.sent(),[2];case 4:if(this.isFree||!this.isHepsiPay)return[3,11];i.label=5;case 5:return i.trys.push([5,9,,10]),window.HepsipaySdk&&(null===(o=this.hepsipayFrameInitResponse)||void 0===o?void 0:o.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,7];case 6:return i.sent(),window.HepsipaySdk.initPayment(),[3,8];case 7:console.error("HepsipaySdk is not available"),i.label=8;case 8:return[3,10];case 9:return i.sent(),this.isStepLoading=!1,[2];case 10:return[2];case 11:return i.trys.push([11,17,,18]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 12:return i.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,14];case 13:i.sent(),i.label=14;case 14:return[4,this.saveCart()];case 15:return e=i.sent(),this.checkout.shippingMethod===l.SHIPMENT&&(t=null!==(a=null==e?void 0:e.availableShippingMethods)&&void 0!==a?a:[],s=null!==(c=this.checkout.availableShippingMethods)&&void 0!==c?c:[],!ee(t,s))?(this.changeStep(se.SHIPPING),[2]):!this.isFree&&this.isCustomFlowStripe?((n=document.querySelector("#stripe-form-btn"))&&n.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 16:return i.sent(),[3,18];case 17:return void 0!==typeof(r=i.sent()).type?this.error=r:this.error={type:ne.UNKNOWN},this.isStepLoading=!1,[3,18];case 18:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(he,void 0,void 0,(function(){var e,t,s;return i(this,(function(i){switch(i.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return i.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];i.label=3;case 3:return i.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(s=this.hepsipayFrameInitResponse)||void 0===s?void 0:s.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return i.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),i.label=6;case 6:return[3,8];case 7:return i.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return i.trys.push([9,13,,14]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return i.sent(),[4,this.saveCart()];case 11:return i.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 12:return i.sent(),[3,14];case 13:return(t=i.sent()).type?this.error=t:this.error={type:ne.UNKNOWN},this.isStepLoading=!1,[3,14];case 14:return[2]}}))}))},this.createSaleTransaction=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,l,h,p,m,g,y,v,S,b,k,I,P,C,A,w,O;return i(this,(function(i){switch(i.label){case 0:return t=this.mpVM.selectedCard,n=this.useMilesSmiles?{point:(null===(h=this.milesSmilesDetails)||void 0===h?void 0:h.availableMiles)||0,source:z.MILES_SMILES}:void 0,!this.isFree&&t&&(null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name)?((r=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=r),void 0===(null===(m=this.cardData)||void 0===m?void 0:m.installmentCount)?[2]:[4,j.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name},paymentGatewayId:null===(y=this.mpVM.selectedCard)||void 0===y?void 0:y.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(v=this.cardData)||void 0===v?void 0:v.threeDSecure)},metadata:{_fbp:te("_fbp"),_fbc:te("_fbc"),_ga:te("_ga")},reward:n}})]):[3,2];case 1:return s=i.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,j.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:t&&e?{phoneNumber:e,savedCardName:null===(S=this.mpVM.selectedCard)||void 0===S?void 0:S.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(b=this.checkout.selectedPaymentGateway)||void 0===b?void 0:b.id,paymentMethodDetail:this.isFree||t?void 0:(null===(k=this.checkout.selectedPaymentGateway)||void 0===k?void 0:k.paymentMethodType)===d.CREDIT_CARD&&(null===(I=this.checkout.selectedPaymentGateway)||void 0===I?void 0:I.type)===u.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:te("_fbp"),_fbc:te("_fbc"),_ga:te("_ga")},reward:n}})]:[2];case 3:s=i.sent(),i.label=4;case 4:return o=null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.transactionStatus,a=o&&[f.SUCCESS,f.AUTHORIZED].includes(o),c=o===f.PENDING,a?[4,this.getSuccessTransaction()]:[3,7];case 5:return i.sent(),[4,this.onCheckoutTransactionSuccess((null===(C=null==s?void 0:s.data)||void 0===C?void 0:C.orderId)||void 0)];case 6:return i.sent(),[3,8];case 7:if(!c||!(null===(A=null==s?void 0:s.data)||void 0===A?void 0:A.returnSlug))throw l=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(O=null===(w=s.data)||void 0===w?void 0:w.error)||void 0===O?void 0:O.code)&&(l=this.t("checkout-page:errorContactStore")),{data:l,type:ne.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,i.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(e){return t(he,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:i.sent(),i.label=2;case 2:return ie.refreshJourneyId(),this.changeStep(se.SUCCESS,e),[2]}}))}))},this.onBackToInfoClick=function(){he.changeStep(se.INFO)},this.onBackToShippingClick=function(){he.changeStep(se.SHIPPING)},this.setCustomerConsentGranted=function(e){he.checkout.customer&&(he.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(t,i){var s;he.useDifferentAddress=t,he.useDifferentAddress?(localStorage.setItem("sAddr","1"),he.checkout.billingAddress=he.checkout.billingAddress||new J,he.checkout.billingAddress.countrySettings=he.countrySettings):(localStorage.removeItem("sAddr"),he.checkout.billingAddress=new J(e({},he.checkout.shippingAddress)),he.store.customerStore.customer&&(null===(s=he.customerAddresses)||void 0===s?void 0:s.length)&&i&&he.isShowBillingAddressOnShippingStep&&he.onSelectedBillingAddressIdChange(he.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){he.shouldSaveAddress=e},this.setAddressTitle=function(e){he.addressTitle=e},this.reInitPaymentMethod=function(){return t(he,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,10];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return this.isIyzico?[4,this.createIyzicoCheckoutForm(this.checkout.selectedPaymentGateway)]:[3,10];case 9:e.sent(),e.label=10;case 10:return[2]}}))}))},this.createStripePaymentIntent=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data?(this.stripeResponse=t.data,this.stripeError=null):this.stripeError={type:ne.API_ERROR,data:t.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data?(this.klarnaResponse=t.data,this.klarnaError=null):this.klarnaError={type:ne.API_ERROR,data:t.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.adyenResponse=t.data),[2]}}))}))},this.getPayPalClientId=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.payPalClientIdResponse=t.data),[2]}}))}))},this.hepsipayFrameInit=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.hepsipayFrameInitResponse=t.data),[2]}}))}))},this.createIyzicoCheckoutForm=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this.isIyzicoLoading=!0,[4,j.createIyzicoCheckoutForm({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.iyzicoResponse=t.data),[3,4];case 2:return i.sent(),[3,4];case 3:return this.isIyzicoLoading=!1,[7];case 4:return[2]}}))}))},this.createStripeExpressCheckoutSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),[4,j.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.stripeExpressCheckoutSessionResponse=t.data),[3,4];case 2:return i.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}))},this.updateStripeExpressCheckoutSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:if(!this.stripeExpressCheckoutSessionResponse)return[2,null];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,j.updateStripeExpressCheckoutSession({input:{cartId:this.checkout.id,sessionId:"",transactionId:"",address:e.address||null,shippingSettingsId:e.shippingSettingsId||null,shippingZoneRateId:e.shippingZoneRateId||null}})];case 2:return(t=i.sent()).isSuccess&&t.data?[2,t.data]:[2,null];case 3:return i.sent(),[2,null];case 4:return[2]}}))}))},this.setShowIyzicoContainer=function(e){he.showIyzicoContainer=e},this.setPaymentGateway=function(e){return t(he,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:return this.paymentGateways.length?(t=this.paymentGateways[e],s=!0,this.step!==se.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==t.code?[3,2]:[4,this.updatePaymentGateway(t)]):[2];case 1:s=i.sent(),i.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(t)];case 4:return s=i.sent(),[3,7];case 5:return"CUSTOM"!==t.code?[3,7]:[4,this.updatePaymentGateway(t)];case 6:s=i.sent(),i.label=7;case 7:return s?"STRIPE"!==t.code&&"STRIPE_EU"!==t.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(t)]:[2];case 8:i.sent(),i.label=9;case 9:return"KLARNA"!==t.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(t)];case 10:i.sent(),i.label=11;case 11:return"ADYEN_PLATFORM"!==t.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(t)];case 12:i.sent(),i.label=13;case 13:return"PAYPAL"!==t.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(t)];case 14:i.sent(),i.label=15;case 15:return"HEPSIPAY"!==t.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(t)];case 16:i.sent(),i.label=17;case 17:return"IYZICO"!==t.code||this.iyzicoResponse?[3,19]:[4,this.createIyzicoCheckoutForm(t)];case 18:i.sent(),i.label=19;case 19:return this.checkout.selectedPaymentGateway=t,this.step!==se.SUCCESS&&(t.paymentMethodType===d.CREDIT_CARD&&t.type===u.INTERNAL&&(this.cardData=new T,this.previousRawValue="",this.previousBin=null,t.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return t(he,void 0,void 0,(function(){var t,n,r;return i(this,(function(i){switch(i.label){case 0:return this.isPaymentMethodVisible=!1,[4,L.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id,targetPageType:W.CHECKOUT})];case 1:return(t=i.sent()).isSuccess?((n=t.data)&&(r=this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){he.cardData&&(he.cardData.installmentCount=e)},this.changeStep=function(e,s){return t(he,void 0,void 0,(function(){return i(this,(function(t){return ae||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(e)),[2]}))}))},this.logout=function(){return t(he,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){he.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return t(he,void 0,void 0,(function(){var r,o,a=this;return i(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===g.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return t(a,void 0,void 0,(function(){var t,n,r,o,a,c,d,u,l;return i(this,(function(i){switch(i.label){case 0:return(t=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[t.productId],[4,_.searchProducts({input:{productIdList:n,priceListId:Q.getPriceListId(),salesChannelId:Q.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=i.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(e){return e.hasStock&&!(t.excludedVariantIdList||[]).some((function(t){return t===e.id}))})).map((function(i){if(!t.discountAmount)return i;var s=!1;return t.discountType===S.AMOUNT&&(s=!0),new E(e(e({},i),{prices:i.prices.map((function(i){var n=i.finalPrice,r=i.finalPrice-(s?t.discountAmount:i.finalPrice*t.discountAmount/100);return t.applicablePrice===b.SELL_PRICE&&(n=i.sellPrice,r=i.sellPrice-(s?t.discountAmount:i.sellPrice*t.discountAmount/100)),new O(e(e({},i),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(e(e({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:t,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===se.SUCCESS?y.POST_CHECKOUT:y.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:return e.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,L.updateCartCampaignOffer({input:e})];case 1:return(t=i.sent()).isSuccess?e.accepted?(this.changeStep(this.step===se.SUCCESS?se.PAYMENT:this.step,null===(s=t.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=t.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:i.sent(),this.isCampaignOfferLoaded=!0,i.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(e){return t(he,void 0,void 0,(function(){var t,s,n,r;return i(this,(function(i){switch(i.label){case 0:return this.checkout.customer?(t=this.checkout.customer,s=t.firstName,n=t.lastName,r=t.email,s&&n&&r?[4,M.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:e})]:[3,2]):[3,2];case 1:return[2,i.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return t(he,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==v.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,j.listProductFile({id:{in:e}})]:[3,2];case 1:(t=i.sent()).isSuccess&&(this.productFiles=t.data||[]),i.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(e){return t(he,void 0,void 0,(function(){var t,s,n,r,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),(t=this.checkout.orderLineItems.find((function(t){return t.variant.id===e.variantId})))?[4,j.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:t.id})]:[3,2];case 1:s=i.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(e.name),r.click(),r.remove()),i.label=2;case 2:return[3,4];case 3:return o=i.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=o,this.checkoutSettings=c,this.router=h,this.returnPolicy=C,this.privacyPolicy=A,this.termsOfService=V,this.imprint=re,this.shippingPolicy=oe,this.t=ce,this.customizationProps=le,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new N({currentLocale:Q.getCurrentLocale()}),this.init(),s(this)}return re.prototype.isAmexCard=function(e){var t,i=e||this.previousRawValue;return(null===(t=this.installmentInfo)||void 0===t?void 0:t.cardAssociation)===V.AMERICAN_EXPRESS||oe.test(i)},Object.defineProperty(re.prototype,"merchantSettings",{get:function(){return new A(Q.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=q.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice){var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e=e-((t.chargedAmount||0)+(t.pendingAmount||0))+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice-e}},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"finalPrice",{get:function(){if(this.step===se.SUCCESS)return this.checkout.totalFinalPrice-this.giftCardTotalPrice;var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e=e-((t.chargedAmount||0)+(t.pendingAmount||0))+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice?this.installmentPrice:e},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===ne.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==ne.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===o.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrderWithoutShippingLines",{get:function(){var e,t;return this.checkout.createdBy===o.ADMIN&&!(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"iyzicoPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"IYZICO"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"iyzicoPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"IYZICO"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isIyzico",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"IYZICO"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"store",{get:function(){return q.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible&&!(this.checkout.createdBy===o.UPSELL||this.checkout.createdBy===o.ADMIN)&&!this.isOpenEditOrderWithTransaction},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===d.CREDIT_CARD&&i.type===u.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===l.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"customerAddresses",{get:function(){var t,i,s,n=this,r=null===(t=Q.getCurrentRouting())||void 0===t?void 0:t.countryCodes;return null===(s=null===(i=this.store.customerStore.customer)||void 0===i?void 0:i.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(t){var i=new C(e({countrySettings:n.countrySettings},t));return i.checkoutSettings=n.checkoutSettings,i.shippingZones=n.shippingZones,i.getValidatedCustomerAddress(),i}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===o.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===o.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isOpenEditOrder",{get:function(){return this.checkout.status===h.OPEN&&!!this.checkout.orderNumber},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"stripeExpressPaymentGateway",{get:function(){return this.paymentGateways.find((function(e){return"STRIPE_EU"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isOpenEditOrderWithTransaction",{get:function(){var e,t;return this.checkout.status===h.OPEN&&!!this.checkout.orderNumber&&!!(null===(e=this.openEditOrderTransaction)||void 0===e?void 0:e.chargedAmount)&&(null===(t=this.openEditOrderTransaction)||void 0===t?void 0:t.chargedAmount)>0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isEPayKolayEnabled",{get:function(){var e=Q.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPoweredByHidden",{get:function(){var e=Q.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasEmailError",{get:function(){return this.isErrorsVisible&&!this.checkout.hasValidCustomerEmail},enumerable:!1,configurable:!0}),re.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},re}();function de(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function ue(e){return e&&re.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(se||(se={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(ne||(ne={}));export{se as CheckoutStep,ne as ErrorType,ce as default};
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCartCreatedBy as o,IkasCouponCodeRequirement as a,IkasCorporateInvoiceRequirement as c,IkasPaymentMethodType as d,IkasPaymentGatewayType as u,IkasOrderShippingMethod as l,IkasOrderStatus as h,IkasCustomerEmailSubscriptionStatus as p,IkasOrderPaymentStatus as m,IkasTransactionStatus as f,IkasCartCampaignOfferStatus as g,IkasCampaignOfferTargetPageType as y,IkasOrderLineItemStatus as v,IkasAmountType as S,IkasCampaignOfferProductApplicablePriceEnum as b}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as P}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as I}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as A}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as w}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as O}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as E}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as R}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import{LocalizedAddressModel as N}from"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/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/ikas-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 T from"./components/credit-card-form/model.js";import M from"../../store/customer/api.js";import j from"../../store/checkout/index.js";import L from"../../store/cart/api.js";import G,{MFS_ELEMENT_ID as D,MFS_SCRIPT_URL as x}from"./modelMasterPass.js";import _ from"../../store/product/index.js";import{TransactionCardAssociationEnum as V,SaveCartInput as F,CheckStocksLineInput as U,getLoyaltyCustomerInfo as B,listSpendingMethodsByCartId as H,LoyaltyProgramPointEarningTypeEnum as Y,listEarningMethods as K,getMilesSmilesDetails as Z,RewardSourceEnum as z,CampaignOfferTargetPageTypeEnum as W}from"@ikas/storefront-api";import{IkasBaseStore as q}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as Q}from"@ikas/storefront-config";import{Analytics as X}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import J from"../../models/data/order/address/ikas-localized-order-address.js";import $ from"../../store/location/index.js";import{isEqual as ee,getCookieValue as te}from"../../utils/helper.js";import ie from"../../analytics/ikasV3.js";var se,ne,re=/^\d+$/,oe=/^3[47]/,ae="undefined"==typeof localStorage,ce={TRY:.25,USD:.0065,EUR:.006},de=function(){function re(o,c,h,C,A,V,re,oe,ce,de){var he=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=se.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.useMilesSmiles=!1,this.milesToRedeem=0,this.milesSmilesDetails=null,this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.iyzicoResponse=null,this.isIyzicoLoading=!1,this.showIyzicoContainer=!1,this.stripeExpressCheckoutSessionResponse=null,this.isStripeExpressCheckoutSessionVisible=!1,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.storeCreditBalance=null,this.loyaltyCustomerInfo=null,this.loyaltySpendingMethods=null,this.loyaltySpendingMethodsAll=null,this.loyaltyEarningMethod=null,this.isLoyaltyPointsVisible=!1,this.showTestModal=!1,this.openEditOrderTransaction=null,this.previousRawValue="",this.previousBin=null,this.init=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,q.getInstance().customerStore.waitUntilInitialized()];case 2:return t.sent(),(e=this.isOpenEditOrder||this.checkout.edited)?[4,this.getOpenEditOrderTransaction()]:[3,4];case 3:t.sent(),t.label=4;case 4:return e&&(this.openEditOrderTransaction||this.checkout.edited)||this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 5:return t.sent(),[2]}}))}))},this.initStep=function(){return t(he,void 0,void 0,(function(){var t,s,n,r,o,c,d;return i(this,(function(i){switch(i.label){case 0:if(Q.getIsEditor())return this.step=se.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),s=t.get("step"),n=t.get("failed"),r=t.get("error"),s){if(this.step=s,this.step===se.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(se.INFO)];if(this.step!==se.PAYMENT||this.canProceedToPayment){if(this.step===se.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(se.INFO)];if(![se.INFO,se.SUCCESS,se.SHIPPING,se.PAYMENT].includes(this.step))return[2,this.changeStep(se.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings||this.isManualOrderWithoutShippingLines?[2,this.changeStep(se.INFO)]:[2,this.changeStep(se.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return i.sent(),this.step!==se.SHIPPING&&this.step!==se.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new P(e(e({},this.checkoutSettings),{couponCodeRequirement:a.DEFAULT}))),this.step!==se.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return i.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:i.sent(),this.checkShippingCountries(),i.label=4;case 4:return[4,this.getStockLocations()];case 5:return i.sent(),[4,this.getAvailableStockLocations()];case 6:i.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),i.label=7;case 7:return this.step!==se.SHIPPING||1!==(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=se.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==se.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==se.SUCCESS||this.checkout.orderPaymentStatus!==m.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:ne.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:i.sent(),i.label=9;case 9:return this.step!==se.PAYMENT&&this.step!==se.SUCCESS?[3,15]:[4,this.listPaymentGateways()];case 10:return i.sent(),this.checkout.hasCustomer?[4,this.getStoreCreditBalance()]:[3,12];case 11:i.sent(),i.label=12;case 12:return this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,14];case 13:i.sent(),i.label=14;case 14:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:ne.NO_SHIPPING_ERROR},this.isMinTransactionError&&(this.error={type:ne.API_ERROR,data:this.t("checkout-page:minTransactionErrorMessage",{value:200})}),this.isCheckoutLoaded=!0,[2];i.label=15;case 15:return this.step===se.SUCCESS?[3,23]:this.isOpenEditOrder?[3,18]:this.checkout.isComplete?[2,this.changeStep(se.SUCCESS)]:[3,16];case 16:return[4,this.initialStockCheck()];case 17:i.sent(),i.label=18;case 18:return this.checkout.hasCustomer?[4,this.getLoyaltyCustomerInfo()]:[3,22];case 19:return i.sent(),[4,this.listSpendingMethodsByCartId()];case 20:return i.sent(),[4,this.listEarningMethods()];case 21:i.sent(),i.label=22;case 22:return[3,25];case 23:return[4,this.getSuccessTransaction()];case 24:i.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),i.label=25;case 25:return n&&(this.error={type:ne.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,X.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getOpenEditOrderTransaction=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,M.listOrderTransactionsWithPrices({input:{orderId:this.checkout.id}})];case 1:return(e=t.sent()).isSuccess&&e.data&&e.data.chargedAmount&&(this.openEditOrderTransaction=e.data),[2]}}))}))},this.getSuccessTransaction=function(){return t(he,void 0,void 0,(function(){var e,t,s;return i(this,(function(i){switch(i.label){case 0:return[4,M.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=i.sent(),this.successTransactions=e.isSuccess&&(null===(t=e.data)||void 0===t?void 0:t.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,d,u,l,h,m,f,g,y,v;return i(this,(function(i){switch(i.label){case 0:return e=new F(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=i.sent(),i.label=2;case 2:return this.step!==se.INFO&&this.step!==se.SHIPPING&&this.step!==se.PAYMENT||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||this.step===se.PAYMENT||(e.billingAddress=null),e.billingAddress&&(this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress||this.useDifferentAddress&&!this.isShowBillingAddressOnShippingStep&&this.checkoutSettings.showCompanyInfoInShippingAddress)&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(o=e.shippingAddress)||void 0===o?void 0:o.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===p.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),null===(null===(c=null===(a=e.shippingAddress)||void 0===a?void 0:a.city)||void 0===c?void 0:c.code)&&""===(null===(u=null===(d=e.shippingAddress)||void 0===d?void 0:d.city)||void 0===u?void 0:u.name)&&(e.shippingAddress.city.name="-"),null===(null===(h=null===(l=e.billingAddress)||void 0===l?void 0:l.city)||void 0===h?void 0:h.code)&&""===(null===(f=null===(m=e.billingAddress)||void 0===m?void 0:m.city)||void 0===f?void 0:f.name)&&(e.billingAddress.city.name="-"),[4,L.saveCart({input:e})];case 3:if((null==(t=i.sent())?void 0:t.graphQLErrors)&&t.graphQLErrors.length)throw s=t.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(g=s.extensions)||void 0===g?void 0:g.code)?{type:ne.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(y=s.extensions)||void 0===y?void 0:y.code)?{type:ne.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(v=s.extensions)||void 0===v?void 0:v.code)?{type:ne.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:ne.API_ERROR,data:t.firstErrorMessage};return[2,t.data]}}))}))},this.inStockDeliveryInputData=function(e){return t(he,void 0,void 0,(function(){var t,s,n=this;return i(this,(function(i){return t=e,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,d,u,h,p,m,f;return i(this,(function(i){switch(i.label){case 0:return this.isManualOrder||this.isOpenEditOrderWithTransaction?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===l.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(p=Q.getStockLocationIds())||void 0===p?void 0:p.length)?Q.getStockLocationIds():null,[4,j.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(t=i.sent()).isSuccess)throw s="UPSELL"===this.checkout.createdBy,n=s?this.t("checkout-page:upsellTimeErrorMessage"):t.firstErrorMessage,{type:ne.API_ERROR,data:n};if(null==(r=null===(f=null===(m=t.data)||void 0===m?void 0:m.lines)||void 0===f?void 0:f.filter((function(e){return!e.isAvailable})))?void 0:r.length){for(o=[],a=function(e){var t=c.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&o.push({item:t,stockCount:e.stockCount})},c=this,d=0,u=r;d<u.length;d++)h=u[d],a(h);throw{type:ne.STOCK_ERROR,data:o}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(e){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.isKlarnaPaymentCompleted=e,[2]}))}))},this.setIsLoyaltyPointsVisible=function(e){he.isLoyaltyPointsVisible=e},this.removeUnavailableItems=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:t=0,s=e,i.label=1;case 1:return t<s.length?(n=s[t],[4,q.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:i.sent(),i.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,j.getAvailableShippingCountries({salesChannelId:Q.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return t(he,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:return Q.getPickupStockLocationIds()?[4,j.listStockLocation({id:{in:Q.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=i.sent()).isSuccess||!(null===(t=e.data)||void 0===t?void 0:t.length))return this.error={type:ne.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,i.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(he,void 0,void 0,(function(){var e,t,s,n=this;return i(this,(function(i){switch(i.label){case 0:return Q.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,j.getAvailableStockLocations({lines:e.map((function(e){return new U(e)})),stockLocationIdList:Q.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(t=i.sent()).isSuccess)return this.error={type:ne.API_ERROR},[2];s=Q.getCurrentRouting(),this.availableStockLocations=(t.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),i.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=he.shippingCountryIds)||void 0===e?void 0:e.length)||(he.error={type:ne.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;he.deliveryMethod!==e&&("address"===e&&(he.checkout.stockLocationId=null,(null===(t=he.customerAddresses)||void 0===t?void 0:t.length)?he.onSelectedShippingAddressIdChange(he.customerAddresses[0].id||"-1"):(he.checkout.shippingAddress=new J,he.checkout.shippingAddress.countrySettings=he.countrySettings,he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones)),he.deliveryMethod=e,he.isErrorsVisible=!1)},this.initialStockCheck=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.getStoreCreditBalance=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,j.getStoreCreditBalance()];case 1:return e=t.sent(),this.storeCreditBalance=e.data,[2]}}))}))},this.getLoyaltyCustomerInfo=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,B({cartId:this.checkout.id})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltyCustomerInfo=e.data),[2]}}))}))},this.listSpendingMethodsByCartId=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,H({cartId:this.checkout.id})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltySpendingMethods=e.data.filter((function(e){return e.isAvailable})),this.loyaltySpendingMethodsAll=e.data),[2]}}))}))},this.listEarningMethods=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,K()];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.loyaltyEarningMethod=e.data.find((function(e){return"ORDER_CREATE"===e.methodType&&e.pointEarningType===Y.DYNAMIC_ORDER_AMOUNT}))),[2]}}))}))},this.listPaymentGateways=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,o,a,c,d,u,l,h,p,m,f,g,y,v,S,b=this;return i(this,(function(i){switch(i.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,t=Q.getPaymentGateways().map((function(e){return e.id})),[4,j.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:t},locale:Q.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=i.sent()).isSuccess?(null===(g=s.data)||void 0===g?void 0:g.length)||this.isFree?(this.error=void 0,n=null===(y=s.data)||void 0===y?void 0:y.some((function(e){return"IKAS_WALLET"===e.code})),this.isMinTransactionError=n&&this.finalPrice<200&&!this.isDigitalOnly,this.isMinTransactionError?[2]:(o=s.data||[],this.step===se.PAYMENT&&(o=o.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(b.checkout.currencyCode)})),(a=null===(v=this.checkout.shippingAddress)||void 0===v?void 0:v.country)&&a.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")}))),c=null===(S=this.checkout.billingAddress)||void 0===S?void 0:S.country,!a&&c&&c.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(c.iso2||"")})))),d=[],r(Q.getPaymentGateways(),"order").forEach((function(e){var t=null==o?void 0:o.find((function(t){return t.id===e.id}));t&&d.push(t)})),this.paymentGateways=e?o:d,u=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=b.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==u?u:0),[3,4]))):(this.error={type:ne.NO_SHIPPING_ERROR},[2]):(this.error={type:ne.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==se.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:i.sent(),i.label=4;case 4:return this.step===se.PAYMENT&&(l=o.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=l,(h=document.createElement("script")).id=D,h.src=x,h.onload=function(){b.mpVM.checkMasterPass({checkout:b.checkout,store:q.getInstance()})},document.head.appendChild(h)),Q.isMilesSmilesActive()?[4,Z()]:[3,6];case 5:if(!(p=i.sent()).isSuccess&&["UNAUTHORIZED","MILES_SMILES_LOGIN_REQUIRED"].some((function(e){return p.errorCodes.includes(e)})))return m=this.getRoutingPath(),f="".concat(m,"/checkout?id=").concat(this.checkout.id,"&step=payment"),window.location.href="".concat(m,"/account/login?redirect=").concat(f,"&ms_login_required=true"),[2];p.isSuccess&&p.data&&(this.milesSmilesDetails=p.data),i.label=6;case 6:return[2]}}))}))},this.retrieveInstallmentInfo=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:return[4,j.retrieveInstallmentInfo(e)];case 1:return t=i.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;he.store.customerStore.customer?(null===(t=he.customerAddresses)||void 0===t||t.forEach((function(e){e.checkoutSettings=he.checkoutSettings,e.shippingZones=he.shippingZones})),he.checkout.customer=new w(e(e({},he.store.customerStore.customer),{notificationsAccepted:he.store.customerStore.customer.subscriptionStatus===p.SUBSCRIBED}))):he.checkout.customer=new w(he.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){he.checkout.shippingAddress&&(he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones,he.checkout.shippingAddress.countrySettings=he.countrySettings,he.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){he.checkout.billingAddress&&(he.checkout.billingAddress.checkoutSettings=he.checkoutSettings,he.checkout.billingAddress.shippingZones=he.shippingZones,he.checkout.billingAddress.countrySettings=he.countrySettings,he.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!he.isDigitalOnly)if(he.isInStoreDelivery)he.setCheckoutShippingAddressSettings();else if(he.checkout.shippingAddress){if(he.store.customerStore.customer){var e=null==(t=he.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=he.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return he.onSelectedShippingAddressIdChange(e.id||"-1"),void he.setCheckoutShippingAddressSettings()}he.checkout.shippingAddress=new J(n(he.checkout.shippingAddress)||{}),he.setCheckoutShippingAddressSettings()}else if(he.store.customerStore.customer){var t=he.customerAddresses;he.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else he.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(he.useDifferentAddress=!!localStorage.getItem("sAddr"),he.checkout.billingAddress){if(he.store.customerStore.customer){var e=null==(t=he.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=he.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return he.onSelectedBillingAddressIdChange(e.id||"-1"),void he.setCheckoutBillingAddressSettings()}he.checkout.billingAddress=new J(n(he.checkout.billingAddress)||{}),he.setCheckoutBillingAddressSettings()}else if(he.store.customerStore.customer){var t=he.customerAddresses;he.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||he.useDifferentAddress||!he.checkout.shippingAddress||he.isInStoreDelivery||(he.checkout.billingAddress=new J(n(he.checkout.shippingAddress)),he.setCheckoutBillingAddressSettings())}else he.onSelectedBillingAddressIdChange("-1"),he.useDifferentAddress||!he.checkout.shippingAddress||he.isInStoreDelivery||(he.checkout.billingAddress=new J(n(he.checkout.shippingAddress)),he.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=e.shippingSettingsId,this.checkout.shippingZoneRateId=e.shippingZoneRateId,[4,this.saveCart()]);case 1:return(t=i.sent())&&(this.checkout=new k(t,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(e){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.checkout.stockLocationId=e.id,[2]}))}))},this.onCouponCodeApply=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a,c;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,L.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(c=null===(a=this.cardData)||void 0===a?void 0:a.cardNumber)||void 0===c?void 0:c.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:i.sent(),i.label=3;case 3:return n?(o=this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT||this.checkout.totalFinalPrice===o.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:i.sent(),this.isCampaignOfferLoaded=!0,s?X.addCouponCode(n):X.removeCouponCode(n),i.label=7;case 7:return t.isSuccess||(this.couponError=t.errorCodes[0]),[3,9];case 8:return i.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,L.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:i.sent(),i.label=3;case 3:return n?(this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:i.sent(),this.isCampaignOfferLoaded=!0,i.label=7;case 7:return[3,9];case 8:return i.sent(),[3,9];case 9:return[2]}}))}))},this.removeLoyaltyPointsFromCart=function(s){return t(he,void 0,void 0,(function(){var t,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,10,,11]),[4,L.removeLoyaltyPointsFromCart({cartId:this.checkout.id,loyaltySpendingMethodId:s})];case 1:return(t=i.sent()).isSuccess&&t.data?(n=t.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===se.PAYMENT&&(null==r?void 0:r.length)&&r.length>=8&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,8),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,9];case 2:i.sent(),i.label=3;case 3:return n?(this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==se.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,9];case 4:i.sent(),i.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:return i.sent(),this.isCampaignOfferLoaded=!0,X.removeLoyaltyPoints(n),[4,this.getLoyaltyCustomerInfo()];case 7:return i.sent(),[4,this.listSpendingMethodsByCartId()];case 8:i.sent(),i.label=9;case 9:return[3,11];case 10:return i.sent(),[3,11];case 11:return[2]}}))}))},this.getAvailableShippingZones=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,$.getAvailableShippingZones({salesChannelId:Q.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(he.selectedShippingAddressId=e,"-1"===e)he.checkout.shippingAddress=new J,he.checkout.shippingAddress.countrySettings=he.countrySettings;else{var i=null===(t=he.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(he.checkout.shippingAddress=new J(i),he.checkout.shippingAddress.countrySettings=he.countrySettings)}he.checkout.shippingAddress&&(he.checkout.shippingAddress.checkoutSettings=he.checkoutSettings,he.checkout.shippingAddress.shippingZones=he.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(he.selectedBillingAddressId=e,"-1"===e)he.checkout.billingAddress=new J,he.checkout.billingAddress.countrySettings=he.countrySettings;else{var i=null===(t=he.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(he.checkout.billingAddress=new J(i),he.checkout.billingAddress.countrySettings=he.countrySettings)}he.checkout.billingAddress&&(he.checkout.billingAddress.checkoutSettings=he.checkoutSettings,he.checkout.billingAddress.shippingZones=he.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){he.isTermsAndConditionsChecked=e,he.isIyzico&&(he.showIyzicoContainer=e)},this.onCardNumberChange=function(e){if(he.cardData){var t=(e||"").replace(/\D/g,""),i=he.previousRawValue,s=t.slice(0,8),n=he.previousBin;if(!(t.length>16)){var r=i.length<8&&t.length>=8,o=8===s.length&&s!==n;(r||o)&&8===s.length&&(he.getRetrieveInstallmentInfo(t),he.previousBin=s),t.length<8&&i.length>=8&&(he.cardData.installmentCount=1,he.installmentInfo=void 0,he.previousBin=null),he.isAmexCard(t)?he.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(t).join(" "):he.cardData.cardNumber=ue(t,4).join(" "),he.previousRawValue=t}}},this.getRetrieveInstallmentInfo=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:e.slice(0,8),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return i.sent(),(null===(t=this.cardData)||void 0===t?void 0:t.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){he.cardData&&(he.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(he.cardData&&(!(e.length>he.cardData.expirationDate.length)||le(e))){if(0===(null===(t=he.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(he.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(he.cardData.expirationDate=ue(d,2).join(" / "))}},this.onCvcChange=function(e){if(he.cardData&&(!(e.length>he.cardData.cvv.length)||le(e))){if(he.isAmexCard()){if(e.length>4)return}else if(e.length>3)return;he.cardData.cvv=e}},this.saveAddress=function(s){return t(he,void 0,void 0,(function(){var t,r,o,a,c,d,u,l,h,p,m,f,g=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new I(e(e({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:i.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),i.label=2;case 2:return[3,4];case 3:return l=i.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.getRoutingPath=function(){var e=Q.getCurrentRouting();return(null==e?void 0:e.path)?"/".concat(e.path):""},this.getGoToCartHref=function(){var e=he.getRoutingPath();return"".concat(e,"/cart")},this.getBackToShoppingHref=function(){var e=he.getRoutingPath();return"".concat(e,"/")},this.getGoToLoginHref=function(){var e=he.getRoutingPath();return"".concat(e)+"/account/login?redirect="+encodeURIComponent(he.checkoutUrl)},this.onHandleBillingAddressOnShippingStep=function(){return t(he,void 0,void 0,(function(){return i(this,(function(t){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new J(e({},this.checkout.shippingAddress)):this.checkout.billingAddress=new J(e({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod||this.isShowBillingAddressOnShippingStep?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(se.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(se.SHIPPING):this.changeStep(se.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(se.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(se.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:ne.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!he.canPerformPayment||(he.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){he.error={type:e,data:t}},this.onCompletePaymentClick=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c;return i(this,(function(i){switch(i.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return i.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return this.isFree||!this.isIyzico?[3,4]:[4,this.saveCart()];case 3:return i.sent(),[2];case 4:if(this.isFree||!this.isHepsiPay)return[3,11];i.label=5;case 5:return i.trys.push([5,9,,10]),window.HepsipaySdk&&(null===(o=this.hepsipayFrameInitResponse)||void 0===o?void 0:o.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,7];case 6:return i.sent(),window.HepsipaySdk.initPayment(),[3,8];case 7:console.error("HepsipaySdk is not available"),i.label=8;case 8:return[3,10];case 9:return i.sent(),this.isStepLoading=!1,[2];case 10:return[2];case 11:return i.trys.push([11,17,,18]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 12:return i.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,14];case 13:i.sent(),i.label=14;case 14:return[4,this.saveCart()];case 15:return e=i.sent(),this.checkout.shippingMethod===l.SHIPMENT&&(t=null!==(a=null==e?void 0:e.availableShippingMethods)&&void 0!==a?a:[],s=null!==(c=this.checkout.availableShippingMethods)&&void 0!==c?c:[],!ee(t,s))?(this.changeStep(se.SHIPPING),[2]):!this.isFree&&this.isCustomFlowStripe?((n=document.querySelector("#stripe-form-btn"))&&n.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 16:return i.sent(),[3,18];case 17:return void 0!==typeof(r=i.sent()).type?this.error=r:this.error={type:ne.UNKNOWN},this.isStepLoading=!1,[3,18];case 18:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(he,void 0,void 0,(function(){var e,t,s;return i(this,(function(i){switch(i.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return i.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];i.label=3;case 3:return i.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(s=this.hepsipayFrameInitResponse)||void 0===s?void 0:s.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return i.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),i.label=6;case 6:return[3,8];case 7:return i.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return i.trys.push([9,13,,14]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return i.sent(),[4,this.saveCart()];case 11:return i.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 12:return i.sent(),[3,14];case 13:return(t=i.sent()).type?this.error=t:this.error={type:ne.UNKNOWN},this.isStepLoading=!1,[3,14];case 14:return[2]}}))}))},this.createSaleTransaction=function(){return t(he,void 0,void 0,(function(){var e,t,s,n,r,o,a,c,l,h,p,m,g,y,v,S,b,k,P,I,C,A,w,O;return i(this,(function(i){switch(i.label){case 0:return t=this.mpVM.selectedCard,n=this.useMilesSmiles?{point:this.milesToRedeem||(null===(h=this.milesSmilesDetails)||void 0===h?void 0:h.availableMiles)||0,source:z.MILES_SMILES}:void 0,!this.isFree&&t&&(null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name)?((r=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=r),void 0===(null===(m=this.cardData)||void 0===m?void 0:m.installmentCount)?[2]:[4,j.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name},paymentGatewayId:null===(y=this.mpVM.selectedCard)||void 0===y?void 0:y.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(v=this.cardData)||void 0===v?void 0:v.threeDSecure)},metadata:{_fbp:te("_fbp"),_fbc:te("_fbc"),_ga:te("_ga")},reward:n}})]):[3,2];case 1:return s=i.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,j.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:t&&e?{phoneNumber:e,savedCardName:null===(S=this.mpVM.selectedCard)||void 0===S?void 0:S.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(b=this.checkout.selectedPaymentGateway)||void 0===b?void 0:b.id,paymentMethodDetail:this.isFree||t?void 0:(null===(k=this.checkout.selectedPaymentGateway)||void 0===k?void 0:k.paymentMethodType)===d.CREDIT_CARD&&(null===(P=this.checkout.selectedPaymentGateway)||void 0===P?void 0:P.type)===u.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:te("_fbp"),_fbc:te("_fbc"),_ga:te("_ga")},reward:n}})]:[2];case 3:s=i.sent(),i.label=4;case 4:return o=null===(I=null==s?void 0:s.data)||void 0===I?void 0:I.transactionStatus,a=o&&[f.SUCCESS,f.AUTHORIZED].includes(o),c=o===f.PENDING,a?[4,this.getSuccessTransaction()]:[3,7];case 5:return i.sent(),[4,this.onCheckoutTransactionSuccess((null===(C=null==s?void 0:s.data)||void 0===C?void 0:C.orderId)||void 0)];case 6:return i.sent(),[3,8];case 7:if(!c||!(null===(A=null==s?void 0:s.data)||void 0===A?void 0:A.returnSlug))throw l=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(O=null===(w=s.data)||void 0===w?void 0:w.error)||void 0===O?void 0:O.code)&&(l=this.t("checkout-page:errorContactStore")),{data:l,type:ne.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,i.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(e){return t(he,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:i.sent(),i.label=2;case 2:return ie.refreshJourneyId(),this.changeStep(se.SUCCESS,e),[2]}}))}))},this.onBackToInfoClick=function(){he.changeStep(se.INFO)},this.onBackToShippingClick=function(){he.changeStep(se.SHIPPING)},this.setCustomerConsentGranted=function(e){he.checkout.customer&&(he.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(t,i){var s;he.useDifferentAddress=t,he.useDifferentAddress?(localStorage.setItem("sAddr","1"),he.checkout.billingAddress=he.checkout.billingAddress||new J,he.checkout.billingAddress.countrySettings=he.countrySettings):(localStorage.removeItem("sAddr"),he.checkout.billingAddress=new J(e({},he.checkout.shippingAddress)),he.store.customerStore.customer&&(null===(s=he.customerAddresses)||void 0===s?void 0:s.length)&&i&&he.isShowBillingAddressOnShippingStep&&he.onSelectedBillingAddressIdChange(he.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){he.shouldSaveAddress=e},this.setAddressTitle=function(e){he.addressTitle=e},this.reInitPaymentMethod=function(){return t(he,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,10];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return this.isIyzico?[4,this.createIyzicoCheckoutForm(this.checkout.selectedPaymentGateway)]:[3,10];case 9:e.sent(),e.label=10;case 10:return[2]}}))}))},this.createStripePaymentIntent=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data?(this.stripeResponse=t.data,this.stripeError=null):this.stripeError={type:ne.API_ERROR,data:t.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data?(this.klarnaResponse=t.data,this.klarnaError=null):this.klarnaError={type:ne.API_ERROR,data:t.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.adyenResponse=t.data),[2]}}))}))},this.getPayPalClientId=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.payPalClientIdResponse=t.data),[2]}}))}))},this.hepsipayFrameInit=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,j.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.hepsipayFrameInitResponse=t.data),[2]}}))}))},this.createIyzicoCheckoutForm=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this.isIyzicoLoading=!0,[4,j.createIyzicoCheckoutForm({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.iyzicoResponse=t.data),[3,4];case 2:return i.sent(),[3,4];case 3:return this.isIyzicoLoading=!1,[7];case 4:return[2]}}))}))},this.createStripeExpressCheckoutSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),[4,j.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 1:return(t=i.sent()).isSuccess&&t.data&&(this.stripeExpressCheckoutSessionResponse=t.data),[3,4];case 2:return i.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}))},this.updateStripeExpressCheckoutSession=function(e){return t(he,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:if(!this.stripeExpressCheckoutSessionResponse)return[2,null];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,j.updateStripeExpressCheckoutSession({input:{cartId:this.checkout.id,sessionId:"",transactionId:"",address:e.address||null,shippingSettingsId:e.shippingSettingsId||null,shippingZoneRateId:e.shippingZoneRateId||null}})];case 2:return(t=i.sent()).isSuccess&&t.data?[2,t.data]:[2,null];case 3:return i.sent(),[2,null];case 4:return[2]}}))}))},this.setShowIyzicoContainer=function(e){he.showIyzicoContainer=e},this.setPaymentGateway=function(e){return t(he,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:return this.paymentGateways.length?(t=this.paymentGateways[e],s=!0,this.step!==se.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==t.code?[3,2]:[4,this.updatePaymentGateway(t)]):[2];case 1:s=i.sent(),i.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(t)];case 4:return s=i.sent(),[3,7];case 5:return"CUSTOM"!==t.code?[3,7]:[4,this.updatePaymentGateway(t)];case 6:s=i.sent(),i.label=7;case 7:return s?"STRIPE"!==t.code&&"STRIPE_EU"!==t.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(t)]:[2];case 8:i.sent(),i.label=9;case 9:return"KLARNA"!==t.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(t)];case 10:i.sent(),i.label=11;case 11:return"ADYEN_PLATFORM"!==t.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(t)];case 12:i.sent(),i.label=13;case 13:return"PAYPAL"!==t.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(t)];case 14:i.sent(),i.label=15;case 15:return"HEPSIPAY"!==t.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(t)];case 16:i.sent(),i.label=17;case 17:return"IYZICO"!==t.code||this.iyzicoResponse?[3,19]:[4,this.createIyzicoCheckoutForm(t)];case 18:i.sent(),i.label=19;case 19:return this.checkout.selectedPaymentGateway=t,this.step!==se.SUCCESS&&(t.paymentMethodType===d.CREDIT_CARD&&t.type===u.INTERNAL&&(this.cardData=new T,this.previousRawValue="",this.previousBin=null,t.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return t(he,void 0,void 0,(function(){var t,n,r;return i(this,(function(i){switch(i.label){case 0:return this.isPaymentMethodVisible=!1,[4,L.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id,targetPageType:W.CHECKOUT})];case 1:return(t=i.sent()).isSuccess?((n=t.data)&&(r=this.checkout,this.checkout=new k(e(e({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){he.cardData&&(he.cardData.installmentCount=e)},this.changeStep=function(e,s){return t(he,void 0,void 0,(function(){return i(this,(function(t){return ae||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(e)),[2]}))}))},this.logout=function(){return t(he,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){he.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return t(he,void 0,void 0,(function(){var r,o,a=this;return i(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===g.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return t(a,void 0,void 0,(function(){var t,n,r,o,a,c,d,u,l;return i(this,(function(i){switch(i.label){case 0:return(t=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[t.productId],[4,_.searchProducts({input:{productIdList:n,priceListId:Q.getPriceListId(),salesChannelId:Q.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=i.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(e){return e.hasStock&&!(t.excludedVariantIdList||[]).some((function(t){return t===e.id}))})).map((function(i){if(!t.discountAmount)return i;var s=!1;return t.discountType===S.AMOUNT&&(s=!0),new E(e(e({},i),{prices:i.prices.map((function(i){var n=i.finalPrice,r=i.finalPrice-(s?t.discountAmount:i.finalPrice*t.discountAmount/100);return t.applicablePrice===b.SELL_PRICE&&(n=i.sellPrice,r=i.sellPrice-(s?t.discountAmount:i.sellPrice*t.discountAmount/100)),new O(e(e({},i),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(e(e({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:t,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return t(he,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===se.SUCCESS?y.POST_CHECKOUT:y.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(e){return t(he,void 0,void 0,(function(){var t,s,n;return i(this,(function(i){switch(i.label){case 0:return e.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,L.updateCartCampaignOffer({input:e})];case 1:return(t=i.sent()).isSuccess?e.accepted?(this.changeStep(this.step===se.SUCCESS?se.PAYMENT:this.step,null===(s=t.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=t.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:i.sent(),this.isCampaignOfferLoaded=!0,i.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(e){return t(he,void 0,void 0,(function(){var t,s,n,r;return i(this,(function(i){switch(i.label){case 0:return this.checkout.customer?(t=this.checkout.customer,s=t.firstName,n=t.lastName,r=t.email,s&&n&&r?[4,M.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:e})]:[3,2]):[3,2];case 1:return[2,i.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return t(he,void 0,void 0,(function(){var e,t;return i(this,(function(i){switch(i.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==v.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,j.listProductFile({id:{in:e}})]:[3,2];case 1:(t=i.sent()).isSuccess&&(this.productFiles=t.data||[]),i.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(e){return t(he,void 0,void 0,(function(){var t,s,n,r,o;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),(t=this.checkout.orderLineItems.find((function(t){return t.variant.id===e.variantId})))?[4,j.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:t.id})]:[3,2];case 1:s=i.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(e.name),r.click(),r.remove()),i.label=2;case 2:return[3,4];case 3:return o=i.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=o,this.checkoutSettings=c,this.router=h,this.returnPolicy=C,this.privacyPolicy=A,this.termsOfService=V,this.imprint=re,this.shippingPolicy=oe,this.t=ce,this.customizationProps=de,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new N({currentLocale:Q.getCurrentLocale()}),this.init(),s(this)}return re.prototype.isAmexCard=function(e){var t,i=e||this.previousRawValue;return(null===(t=this.installmentInfo)||void 0===t?void 0:t.cardAssociation)===V.AMERICAN_EXPRESS||oe.test(i)},Object.defineProperty(re.prototype,"merchantSettings",{get:function(){return new A(Q.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=q.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice){var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e=e-((t.chargedAmount||0)+(t.pendingAmount||0))+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice-e}},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"finalPrice",{get:function(){if(this.step===se.SUCCESS)return this.checkout.totalFinalPrice-this.giftCardTotalPrice;var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e=e-((t.chargedAmount||0)+(t.pendingAmount||0))+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice?this.installmentPrice:e},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===ne.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==ne.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===o.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrderWithoutShippingLines",{get:function(){var e,t;return this.checkout.createdBy===o.ADMIN&&!(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"iyzicoPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"IYZICO"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"iyzicoPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"IYZICO"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isIyzico",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"IYZICO"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice||this.isMilesSmilesFullPayment},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"milesSmilesRedeemValue",{get:function(){if(!this.useMilesSmiles)return 0;var e=ce[this.checkout.currencyCode];return e?(this.milesToRedeem||0)*e:0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isMilesSmilesFullPayment",{get:function(){return!!this.useMilesSmiles&&(!(this.finalPrice<=0)&&this.milesSmilesRedeemValue>=this.finalPrice)},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"store",{get:function(){return q.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible&&!(this.checkout.createdBy===o.UPSELL||this.checkout.createdBy===o.ADMIN)&&!this.isOpenEditOrderWithTransaction},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===d.CREDIT_CARD&&i.type===u.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===l.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"customerAddresses",{get:function(){var t,i,s,n=this,r=null===(t=Q.getCurrentRouting())||void 0===t?void 0:t.countryCodes;return null===(s=null===(i=this.store.customerStore.customer)||void 0===i?void 0:i.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(t){var i=new C(e({countrySettings:n.countrySettings},t));return i.checkoutSettings=n.checkoutSettings,i.shippingZones=n.shippingZones,i.getValidatedCustomerAddress(),i}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===o.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===o.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isOpenEditOrder",{get:function(){return this.checkout.status===h.OPEN&&!!this.checkout.orderNumber},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"stripeExpressPaymentGateway",{get:function(){return this.paymentGateways.find((function(e){return"STRIPE_EU"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isOpenEditOrderWithTransaction",{get:function(){var e,t;return this.checkout.status===h.OPEN&&!!this.checkout.orderNumber&&!!(null===(e=this.openEditOrderTransaction)||void 0===e?void 0:e.chargedAmount)&&(null===(t=this.openEditOrderTransaction)||void 0===t?void 0:t.chargedAmount)>0},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isEPayKolayEnabled",{get:function(){var e=Q.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"isPoweredByHidden",{get:function(){var e=Q.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),Object.defineProperty(re.prototype,"hasEmailError",{get:function(){return this.isErrorsVisible&&!this.checkout.hasValidCustomerEmail},enumerable:!1,configurable:!0}),re.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},re}();function ue(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function le(e){return e&&re.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(se||(se={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(ne||(ne={}));export{se as CheckoutStep,ne as ErrorType,ce as MILES_SMILES_RATE_PER_POINT,de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{Checkbox as o}from"../../components/checkbox/index.js";import n from"../../components/error/index.js";import{PaymentGateways as r}from"./payment-gateways/index.js";import{BillingAddress as a}from"./billing-address/index.js";import{Button as s}from"../../components/button/index.js";import c from"../../components/master-pass/link-card-to-client/index.js";import{PayPal as m}from"../../components/paypal/index.js";import l from"../../components/notification-box/index.js";import{createTranslationInputData as p,useTranslation as d}from"../../../../utils/i18n.js";import y from"../../components/svg/lock.js";import u from"./style.module.scss.js";import{StoreCredit as k}from"./payment-gateways/store-credit/index.js";import{MilesSmiles as f}from"./payment-gateways/miles-smiles/index.js";var g=t((function(t){var g=t.vm,v=d().t,C=e.useCallback((function(e){e.stopPropagation(),g.policyModalTitle=v("checkout-page:privacyPolicy"),g.policyModalText=g.privacyPolicy}),[g,g.privacyPolicy]),E=e.useCallback((function(e){e.stopPropagation(),g.policyModalTitle=v("checkout-page:termsOfService"),g.policyModalText=g.termsOfService}),[g,g.termsOfService]),P=i.getTranslations()["checkout-page"],h=p(P.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[u.TermsLabelSpan,g.isErrorsVisible&&!g.isTermsAndConditionsChecked?u.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?C:E},"{{ ackPrivacyPolicy }}"===t.value?v("checkout-page:ackPrivacyPolicy"):v("checkout-page:ackTermsOfService")):t.value}));return e.createElement("div",{className:[u.StepPayment,g.isPaymentMethodVisible?"":u.Disabled].join(" ")},e.createElement(n,{vm:g}),e.createElement(k,{vm:g}),g.milesSmilesDetails?e.createElement(f,{vm:g}):null,g.isFree&&e.createElement(l,{type:"success",content:v("checkout-page:freeOrderDescription")}),!g.isFree&&e.createElement(e.Fragment,null,g.mpVM.isLinkCardToClientVisible&&e.createElement(c,{vm:g}),e.createElement(r,{vm:g})),e.createElement(a,{vm:g}),g.checkoutSettings.showTermsAndConditionsCheckbox&&(!g.isIyzico||g.isFree)&&e.createElement("div",{style:{marginTop:g.useDifferentAddress?"12px":"0px"}},e.createElement(o,{value:g.isTermsAndConditionsChecked,hasError:g.isErrorsVisible&&!g.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,h),onChange:g.onTermsAndConditionsCheckedChange})),!g.isFree&&g.isPayPal?e.createElement("div",{className:u.PayPalContainer},e.createElement(m,{vm:g})):g.isIyzico&&!g.isFree?null:e.createElement(s,{style:{width:"100%",marginTop:"24px"},text:v("checkout-page:actions.completeOrder"),isLoading:g.isStepLoading,onClick:g.isDigitalOnly?g.onCompleteDigitalOnlyPaymentClick:g.onCompletePaymentClick}),!!v("checkout-page:securePaymentTooltip")&&e.createElement("div",{className:u.SecurePaymentContainer},e.createElement("span",{className:u.Lock},e.createElement(y,null)),e.createElement("span",null,v("checkout-page:securePaymentTooltip"))))}));export{g as CheckoutStepPayment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayTransactionFeeType as n,IkasPaymentGatewayAdditionalPriceType as o,IkasPaymentGatewayType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-form-data-input/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/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/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../../../models/data/storefront-popup/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as i}from"../../../components/credit-card-form/index.js";import{Installments as m}from"./installments/index.js";import l from"../../../components/select-box/index.js";import d from"./style.module.scss.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{createTranslationInputData as p,useTranslation as y}from"../../../../../utils/i18n.js";import u from"../../../components/svg/external.js";import v from"next/dynamic";import x from"../../../components/credit-card-form/model.js";import P from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as E}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import g from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import C from"../../../components/master-pass/payment-gateway/svg/visa.js";import{Checkbox as h}from"../../../components/checkbox/index.js";import w from"../../../components/svg/info.js";import{MilesSmiles as k}from"./miles-smiles/index.js";var G=v((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),I=v((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),N=v((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),T=v((function(){return import("../../../components/hepsipay/index.js").then((function(e){return e.HepsiPay}))})),S=v((function(){return import("../../../components/iyzico/index.js").then((function(e){return e.Iyzico}))})),b=t((function(v){var b=v.vm,M=y().t,A=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},R=function(t){return e.createElement("div",{className:d.AdditionalPrice},t.children)},B=function(e){return 0===e.amount?"":"".concat(e.amountType===n.AMOUNT?s(e.amount,b.checkout.currencyCode,b.checkout.currencySymbol):" %"+e.amount).concat(e.type===o.DECREMENT?" "+M("checkout-page:paymentMethodDiscount"):" "+M("checkout-page:paymentMethodAdditionalPrice"))},V=function(e){return"STRIPE"===e.code||"STRIPE_EU"===e.code},z=function(){var t,a=b.selectedPaymentGatewayIndex===b.klarnaPaymentGatewayIndex;return b.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){b.setPaymentGateway(b.klarnaPaymentGatewayIndex),b.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:b.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=b.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(b.klarnaPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!b.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:b.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":d.Hidden)},e.createElement(N,{vm:b}),b.klarnaError&&e.createElement("div",{className:d.ErrorMessage},b.klarnaError.data)))):null},D=function(){var t,a=b.selectedPaymentGatewayIndex===b.hepsiPayPaymentGatewayIndex;return b.hepsiPayPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){b.setPaymentGateway(b.hepsiPayPaymentGatewayIndex),b.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:"Kredi / Banka Kartı - Hepsipay",removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=b.hepsiPayPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(b.hepsiPayPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!b.hepsiPayPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:b.hepsiPayPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":d.Hidden)},e.createElement(T,{vm:b})))):null},L=function(){var t=b.selectedPaymentGatewayIndex===b.adyenPaymentGatewayIndex;return b.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){b.setPaymentGateway(b.adyenPaymentGatewayIndex),b.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," "),style:{paddingTop:0}},e.createElement(I,{vm:b,isSelected:t})))):null},U=function(){var t,a=b.selectedPaymentGatewayIndex===b.payPalPaymentGatewayIndex;return b.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){b.setPaymentGateway(b.payPalPaymentGatewayIndex),b.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:b.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=b.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(b.payPalPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!b.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:b.payPalPaymentGateway.logoUrl}))))))):null},_=t((function(t){var a,n=t.vm;e.useEffect((function(){n.isTermsAndConditionsChecked&&n.setShowIyzicoContainer(!0)}),[n.isTermsAndConditionsChecked]);var o=e.useCallback((function(e){e.stopPropagation(),n.policyModalTitle=M("checkout-page:privacyPolicy"),n.policyModalText=n.privacyPolicy}),[n,n.privacyPolicy]),r=e.useCallback((function(e){e.stopPropagation(),n.policyModalTitle=M("checkout-page:termsOfService"),n.policyModalText=n.termsOfService}),[n,n.termsOfService]),i=c.getTranslations()["checkout-page"],m=p(i.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[d.TermsLabelSpan,n.isErrorsVisible&&!n.isTermsAndConditionsChecked?d.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?o:r},"{{ ackPrivacyPolicy }}"===t.value?M("checkout-page:ackPrivacyPolicy"):M("checkout-page:ackTermsOfService")):t.value})),l=n.selectedPaymentGatewayIndex===n.iyzicoPaymentGatewayIndex;return n.iyzicoPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(l?f.Selected:""," ").concat(d.IyzicoBottomContent),onClick:function(){n.setPaymentGateway(n.iyzicoPaymentGatewayIndex),n.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:l,label:M("checkout-page:creditCard"),removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(a=n.iyzicoPaymentGateway.additionalPrices)||void 0===a?void 0:a.length)?e.createElement(R,null,B(n.iyzicoPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!n.iyzicoPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:n.iyzicoPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(l?f.BottomContent:""," ").concat(l?"":d.Hidden," ")},e.createElement("div",{className:d.IyzicoCheckboxContainer},e.createElement(h,{value:n.isTermsAndConditionsChecked,hasError:n.isErrorsVisible&&!n.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,m),removePadding:!0,onChange:n.onTermsAndConditionsCheckedChange})),!n.isTermsAndConditionsChecked&&e.createElement("div",{className:[d.IyzicoDescription,n.iyzicoResponse?d.WithBottomMargin:""].join(" ")},e.createElement(w,null),M("checkout-page:iyzicoDescription")),n.iyzicoResponse&&e.createElement(S,{vm:n})))):null}));return e.createElement(e.Fragment,null,b.milesSmilesDetails?e.createElement(k,{vm:b}):null,!!b.mpVM.cards.length&&b.mpVM.cards.map((function(t,n){var o,i=b.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),c=e.createElement("button",{className:d.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),b.mpVM.deleteCard({store:b.store,checkout:b.checkout,card:t})}},M("checkout-page:masterPass.paymentGatewaySelectBox.delete")),s=function(e){return t.Value1.startsWith(e)},p=s("4"),y=s("5")||s("6"),u=s("9"),v=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:d.MasterPassSelectBoxLabelLogo},p&&e.createElement(C,null),y&&e.createElement(g,null),u&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==i?void 0:i.id)&&i.paymentMethodType===a.CREDIT_CARD&&i.type===r.INTERNAL?b.installmentInfo&&e.createElement(m,{vm:b}):void 0;return e.createElement(l,{key:n,isSelected:(null===(o=b.mpVM.selectedCard)||void 0===o?void 0:o.UniqueId)===t.UniqueId,label:v,rightContent:c,bottomContent:P,onClick:function(){var e;(null===(e=b.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(b.checkout.selectedPaymentGateway=null,b.cardData=new x,b.installmentInfo=void 0,b.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&b.checkout.totalFinalPrice&&b.retrieveInstallmentInfo({input:{orderId:b.checkout.id,binNumber:t.Value1.slice(0,8),paymentGatewayId:t.paymentGatewayId,price:b.checkout.totalFinalPrice,currencyCode:b.checkout.currencyCode}}))}})})),b.paymentGateways.filter((function(e){return"in-store"!==b.deliveryMethod&&!b.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,n){var o;if(function(e){return"KLARNA"===e.code}(t)&&b.klarnaPaymentGateway)return z();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&b.adyenPaymentGateway)return L();if(function(e){return"PAYPAL"===e.code}(t)&&b.payPalPaymentGateway)return U();if(function(e){return"HEPSIPAY"===e.code}(t)&&b.hepsiPayPaymentGateway)return D();if(function(e){return"IYZICO"===e.code}(t)&&b.iyzicoPaymentGateway)return e.createElement(_,{vm:b,key:t.id});var c=t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?e.createElement(e.Fragment,null,V(t)?e.createElement(e.Fragment,null,e.createElement(G,{vm:b,pg:t}),b.stripeError&&e.createElement("div",{className:d.ErrorMessage},b.stripeError.data)):e.createElement("div",null,e.createElement(i,{vm:b}),b.isPaymentGatewayHasMasterPass&&e.createElement(P,{vm:b}),b.installmentInfo&&e.createElement(m,{vm:b}))):t.description?e.createElement(e.Fragment,null,t.type===r.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(u,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(l,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?V(t)?t.name:M("checkout-page:creditCard"):t.name,isSelected:b.selectedPaymentGatewayIndex===n,rightContent:(null===(o=t.additionalPrices)||void 0===o?void 0:o.length)?e.createElement(R,null,B(t.additionalPrices[0])):e.createElement(A,null,!!t.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:c,onClick:function(){b.selectedPaymentGatewayIndex!==n&&(b.setPaymentGateway(n),b.mpVM.selectedCard=void 0)}})})))}));export{b as PaymentGateways};
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayTransactionFeeType as n,IkasPaymentGatewayAdditionalPriceType as o,IkasPaymentGatewayType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-form-data-input/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/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/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../../../../models/data/storefront-popup/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as i}from"../../../components/credit-card-form/index.js";import{Installments as m}from"./installments/index.js";import l from"../../../components/select-box/index.js";import d from"./style.module.scss.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{createTranslationInputData as p,useTranslation as y}from"../../../../../utils/i18n.js";import u from"../../../components/svg/external.js";import v from"next/dynamic";import P from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as E}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import g from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import C from"../../../components/master-pass/payment-gateway/svg/visa.js";import{Checkbox as h}from"../../../components/checkbox/index.js";import w from"../../../components/svg/info.js";import{RewardSourceEnum as k}from"@ikas/storefront-api";var G=v((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),I=v((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),N=v((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),T=v((function(){return import("../../../components/hepsipay/index.js").then((function(e){return e.HepsiPay}))})),S=v((function(){return import("../../../components/iyzico/index.js").then((function(e){return e.Iyzico}))})),M=t((function(v){var M=v.vm,b=y().t,A=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},R=function(t){return e.createElement("div",{className:d.AdditionalPrice},t.children)},B=function(e){return 0===e.amount?"":"".concat(e.amountType===n.AMOUNT?s(e.amount,M.checkout.currencyCode,M.checkout.currencySymbol):" %"+e.amount).concat(e.type===o.DECREMENT?" "+b("checkout-page:paymentMethodDiscount"):" "+b("checkout-page:paymentMethodAdditionalPrice"))},V=function(e){return"STRIPE"===e.code||"STRIPE_EU"===e.code},z=function(){var t,a=M.selectedPaymentGatewayIndex===M.klarnaPaymentGatewayIndex;return M.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){M.setPaymentGateway(M.klarnaPaymentGatewayIndex),M.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:M.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=M.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(M.klarnaPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!M.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:M.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":d.Hidden)},e.createElement(N,{vm:M}),M.klarnaError&&e.createElement("div",{className:d.ErrorMessage},M.klarnaError.data)))):null},L=function(){var t,a=M.selectedPaymentGatewayIndex===M.hepsiPayPaymentGatewayIndex;return M.hepsiPayPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){M.setPaymentGateway(M.hepsiPayPaymentGatewayIndex),M.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:"Kredi / Banka Kartı - Hepsipay",removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=M.hepsiPayPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(M.hepsiPayPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!M.hepsiPayPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:M.hepsiPayPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":d.Hidden)},e.createElement(T,{vm:M})))):null},D=function(){var t=M.selectedPaymentGatewayIndex===M.adyenPaymentGatewayIndex;return M.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){M.setPaymentGateway(M.adyenPaymentGatewayIndex),M.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," "),style:{paddingTop:0}},e.createElement(I,{vm:M,isSelected:t})))):null},U=function(){var t,a=M.selectedPaymentGatewayIndex===M.payPalPaymentGatewayIndex;return M.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){M.setPaymentGateway(M.payPalPaymentGatewayIndex),M.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:a,label:M.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=M.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(R,null,B(M.payPalPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!M.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:M.payPalPaymentGateway.logoUrl}))))))):null},_=t((function(t){var a,n=t.vm;e.useEffect((function(){n.isTermsAndConditionsChecked&&n.setShowIyzicoContainer(!0)}),[n.isTermsAndConditionsChecked]);var o=e.useCallback((function(e){e.stopPropagation(),n.policyModalTitle=b("checkout-page:privacyPolicy"),n.policyModalText=n.privacyPolicy}),[n,n.privacyPolicy]),r=e.useCallback((function(e){e.stopPropagation(),n.policyModalTitle=b("checkout-page:termsOfService"),n.policyModalText=n.termsOfService}),[n,n.termsOfService]),i=c.getTranslations()["checkout-page"],m=p(i.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[d.TermsLabelSpan,n.isErrorsVisible&&!n.isTermsAndConditionsChecked?d.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?o:r},"{{ ackPrivacyPolicy }}"===t.value?b("checkout-page:ackPrivacyPolicy"):b("checkout-page:ackTermsOfService")):t.value})),l=n.selectedPaymentGatewayIndex===n.iyzicoPaymentGatewayIndex;return n.iyzicoPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(l?f.Selected:""," ").concat(d.IyzicoBottomContent),onClick:function(){n.setPaymentGateway(n.iyzicoPaymentGatewayIndex),n.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(E,{value:l,label:b("checkout-page:creditCard"),removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(a=n.iyzicoPaymentGateway.additionalPrices)||void 0===a?void 0:a.length)?e.createElement(R,null,B(n.iyzicoPaymentGateway.additionalPrices[0])):e.createElement(A,null,!!n.iyzicoPaymentGateway.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:n.iyzicoPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(l?f.BottomContent:""," ").concat(l?"":d.Hidden," ")},e.createElement("div",{className:d.IyzicoCheckboxContainer},e.createElement(h,{value:n.isTermsAndConditionsChecked,hasError:n.isErrorsVisible&&!n.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,m),removePadding:!0,onChange:n.onTermsAndConditionsCheckedChange})),!n.isTermsAndConditionsChecked&&e.createElement("div",{className:[d.IyzicoDescription,n.iyzicoResponse?d.WithBottomMargin:""].join(" ")},e.createElement(w,null),b("checkout-page:iyzicoDescription")),n.iyzicoResponse&&e.createElement(S,{vm:n})))):null}));return e.createElement(e.Fragment,null,!!M.mpVM.cards.length&&M.mpVM.cards.map((function(t,n){var o,i=M.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),c=e.createElement("button",{className:d.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),M.mpVM.deleteCard({store:M.store,checkout:M.checkout,card:t})}},b("checkout-page:masterPass.paymentGatewaySelectBox.delete")),s=function(e){return t.Value1.startsWith(e)},p=s("4"),y=s("5")||s("6"),u=s("9"),v=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:d.MasterPassSelectBoxLabelLogo},p&&e.createElement(C,null),y&&e.createElement(g,null),u&&e.createElement(j,null)),t.Name," ",t.Value1),x=(null==i?void 0:i.id)&&i.paymentMethodType===a.CREDIT_CARD&&i.type===r.INTERNAL?M.installmentInfo&&e.createElement(m,{vm:M}):void 0;return e.createElement(l,{key:n,isSelected:(null===(o=M.mpVM.selectedCard)||void 0===o?void 0:o.UniqueId)===t.UniqueId,label:v,rightContent:c,bottomContent:x,onClick:function(){var e;(null===(e=M.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(M.checkout.selectedPaymentGateway=null,M.cardData=new P,M.installmentInfo=void 0,M.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&M.checkout.totalFinalPrice&&M.retrieveInstallmentInfo({input:{orderId:M.checkout.id,binNumber:t.Value1.slice(0,8),paymentGatewayId:t.paymentGatewayId,price:M.checkout.totalFinalPrice,currencyCode:M.checkout.currencyCode}}))}})})),M.paymentGateways.filter((function(e){return"in-store"!==M.deliveryMethod&&!M.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,n){var o,c;if(M.useMilesSmiles&&!(null===(o=t.enabledRewardSources)||void 0===o?void 0:o.includes(k.MILES_SMILES)))return null;if(function(e){return"KLARNA"===e.code}(t)&&M.klarnaPaymentGateway)return z();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&M.adyenPaymentGateway)return D();if(function(e){return"PAYPAL"===e.code}(t)&&M.payPalPaymentGateway)return U();if(function(e){return"HEPSIPAY"===e.code}(t)&&M.hepsiPayPaymentGateway)return L();if(function(e){return"IYZICO"===e.code}(t)&&M.iyzicoPaymentGateway)return e.createElement(_,{vm:M,key:t.id});var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?e.createElement(e.Fragment,null,V(t)?e.createElement(e.Fragment,null,e.createElement(G,{vm:M,pg:t}),M.stripeError&&e.createElement("div",{className:d.ErrorMessage},M.stripeError.data)):e.createElement("div",null,e.createElement(i,{vm:M}),M.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:M}),M.installmentInfo&&e.createElement(m,{vm:M}))):t.description?e.createElement(e.Fragment,null,t.type===r.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(u,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(l,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?V(t)?t.name:b("checkout-page:creditCard"):t.name,isSelected:M.selectedPaymentGatewayIndex===n,rightContent:(null===(c=t.additionalPrices)||void 0===c?void 0:c.length)?e.createElement(R,null,B(t.additionalPrices[0])):e.createElement(A,null,!!t.logoUrl&&e.createElement("div",{className:d.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){M.selectedPaymentGatewayIndex!==n&&(M.setPaymentGateway(n),M.mpVM.selectedCard=void 0)}})})))}));export{M as PaymentGateways};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import*as e from"react";import{observer as l}from"mobx-react-lite";import{MILES_SMILES_RATE_PER_POINT as i}from"../../../../model.js";import"@ikas/storefront-config";import{formatCurrency as t}from"../../../../../../utils/currency.js";import{useTranslation as s}from"../../../../../../utils/i18n.js";import a from"./style.module.scss.js";import m from"./thy-logo.js";import{RewardSourceEnum as r}from"@ikas/storefront-api";var n=function(e){return e?e.toLocaleString("en-US"):""},c=l((function(l){var c,u=l.vm,d=s().t,p=(null===(c=u.milesSmilesDetails)||void 0===c?void 0:c.availableMiles)||0,S=u.checkout.currencyCode,v=i[S],M=u.finalPrice||0,f=v&&M>0?Math.ceil(M/v):1/0,E=v?(u.milesToRedeem||0)*v:0,g=u.milesToRedeem>p;return e.createElement("div",{className:a.MilesSmiles},e.createElement("div",{className:a.MilesSmilesHeader},e.createElement("div",{className:a.MilesSmilesHeaderLeft},e.createElement(m,{className:a.MilesSmilesLogo}),e.createElement("div",{className:a.MilesSmilesTitleWrapper},e.createElement("div",{className:a.MilesSmilesTitle},e.createElement("span",{className:a.MilesSmilesTitleBold},"Miles & Smiles")," ",e.createElement("span",null,d("checkout-page:milesSmilesUseMyMiles"))),e.createElement("div",{className:a.MilesSmilesSubtitle},d("checkout-page:milesSmilesAvailableTotal",{miles:n(p)})))),e.createElement(o,{value:u.useMilesSmiles,onChange:function(e){if(u.useMilesSmiles=e,e){var l=u.paymentGateways.filter((function(e){var l;return null===(l=e.enabledRewardSources)||void 0===l?void 0:l.includes(r.MILES_SMILES)}));if(l.length){var i=l[0].id,t=u.paymentGateways.findIndex((function(e){return e.id===i}));if(u.selectedPaymentGatewayIndex===t)return;u.setPaymentGateway(t),u.mpVM.selectedCard=void 0}}e&&!u.milesToRedeem&&(u.milesToRedeem=Math.min(p,f))}})),u.useMilesSmiles&&e.createElement(e.Fragment,null,e.createElement("div",{className:a.MilesSmilesInputRow},e.createElement("div",{className:[a.MilesSmilesInputWrapper,g?a.MilesSmilesInputError:""].join(" ")},e.createElement("input",{className:a.MilesSmilesInput,type:"text",inputMode:"numeric",value:n(u.milesToRedeem),onChange:function(e){var l=e.target.value.replace(/[^\d]/g,"");u.milesToRedeem=l?parseInt(l,10):0},onBlur:function(){var e=Math.min(p,f);u.milesToRedeem>e&&(u.milesToRedeem=e)}}),e.createElement("span",{className:a.MilesSmilesInputUnit},d("checkout-page:milesSmilesUnit"))),e.createElement("span",{className:a.MilesSmilesApprox},"≈"),e.createElement("div",{className:a.MilesSmilesPriceBox},t(E,u.checkout.currencyCode,u.checkout.currencySymbol))),g&&e.createElement("div",{className:a.MilesSmilesErrorText},d("checkout-page:milesSmilesExceedError"))))})),o=function(l){var i=l.value,t=l.onChange;return e.createElement("div",{onClick:function(){t(!i)},className:[a.ToggleSwitch,i?a.ToggleSwitchActive:""].join(" ")},e.createElement("div",{className:[a.ToggleSwitchThumb,i?a.ToggleSwitchThumbActive:""].join(" ")}))};export{c as MilesSmiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../../../../ext/style-inject/dist/style-inject.es.js';var l={MilesSmiles:"style-module_MilesSmiles__-4b7k",
|
|
1
|
+
import e from'./../../../../../../ext/style-inject/dist/style-inject.es.js';var l={MilesSmiles:"style-module_MilesSmiles__-4b7k",MilesSmilesHeader:"style-module_MilesSmilesHeader__2wEKO",MilesSmilesHeaderLeft:"style-module_MilesSmilesHeaderLeft__azBmf",MilesSmilesLogo:"style-module_MilesSmilesLogo__Cttfa",MilesSmilesTitleWrapper:"style-module_MilesSmilesTitleWrapper__iGOg2",MilesSmilesTitle:"style-module_MilesSmilesTitle__ClDIS",MilesSmilesTitleBold:"style-module_MilesSmilesTitleBold__tSEX5",MilesSmilesSubtitle:"style-module_MilesSmilesSubtitle__4XQe2",MilesSmilesInputRow:"style-module_MilesSmilesInputRow__rgpyr",MilesSmilesInputWrapper:"style-module_MilesSmilesInputWrapper__cMQ9K",MilesSmilesInputError:"style-module_MilesSmilesInputError__tidH-",MilesSmilesInput:"style-module_MilesSmilesInput__-ADNL",MilesSmilesInputUnit:"style-module_MilesSmilesInputUnit__vza1O",MilesSmilesApprox:"style-module_MilesSmilesApprox__3P4Nr",MilesSmilesPriceBox:"style-module_MilesSmilesPriceBox__Clpc3",MilesSmilesErrorText:"style-module_MilesSmilesErrorText__02yD-",ToggleSwitch:"style-module_ToggleSwitch__fSVrp",ToggleSwitchActive:"style-module_ToggleSwitchActive__vd83i",ToggleSwitchThumb:"style-module_ToggleSwitchThumb__PiPwV",ToggleSwitchThumbActive:"style-module_ToggleSwitchThumbActive__RjbIp"};e(".style-module_MilesSmiles__-4b7k {\n padding: 12px;\n border-radius: 8px;\n border: 1px solid var(--checkout-border-color);\n margin-bottom: 16px;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 10px;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesHeaderLeft__azBmf {\n display: flex;\n gap: 10px;\n align-items: center;\n flex: 1;\n min-width: 0;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesLogo__Cttfa {\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesTitleWrapper__iGOg2 {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesTitle__ClDIS {\n font-size: 16px;\n line-height: 24px;\n font-weight: 500;\n color: var(--checkout-primary-text-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesTitleBold__tSEX5 {\n font-weight: 600;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesHeader__2wEKO .style-module_MilesSmilesSubtitle__4XQe2 {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInputRow__rgpyr {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-top: 12px;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInputWrapper__cMQ9K {\n display: flex;\n align-items: center;\n border: 1px solid var(--checkout-border-color);\n border-radius: 8px;\n overflow: hidden;\n background-color: var(--checkout-primary-bg-color);\n transition: border-color 0.15s ease;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInputWrapper__cMQ9K.style-module_MilesSmilesInputError__tidH- {\n border-color: var(--checkout-error-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInput__-ADNL {\n width: 100%;\n max-width: 140px;\n padding: 6px 10px;\n border: none;\n outline: none;\n background: transparent;\n font-size: 15px;\n line-height: 20px;\n color: var(--checkout-primary-text-color);\n font-family: inherit;\n text-align: center;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInput__-ADNL::placeholder {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesInputUnit__vza1O {\n padding: 6px 10px;\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n border-left: 1px solid var(--checkout-border-color);\n background-color: var(--checkout-primary-bg-color);\n white-space: nowrap;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesApprox__3P4Nr {\n font-size: 16px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesPriceBox__Clpc3 {\n padding: 6px 10px;\n border-radius: 8px;\n background-color: var(--checkout-secondary-bg-color);\n font-size: 15px;\n line-height: 20px;\n color: var(--checkout-primary-text-color);\n white-space: nowrap;\n}\n.style-module_MilesSmiles__-4b7k .style-module_MilesSmilesErrorText__02yD- {\n margin-top: 10px;\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-error-color);\n}\n.style-module_MilesSmiles__-4b7k .style-module_ToggleSwitch__fSVrp {\n position: relative;\n width: 40px;\n height: 22px;\n background-color: #cdd5df;\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n display: flex;\n align-items: center;\n padding: 3px;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);\n flex-shrink: 0;\n}\n.style-module_MilesSmiles__-4b7k .style-module_ToggleSwitch__fSVrp.style-module_ToggleSwitchActive__vd83i {\n background-color: #1f2a37;\n}\n.style-module_MilesSmiles__-4b7k .style-module_ToggleSwitchThumb__PiPwV {\n width: 16px;\n height: 16px;\n background-color: white;\n border-radius: 50%;\n transform: translateX(0px);\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: absolute;\n}\n.style-module_MilesSmiles__-4b7k .style-module_ToggleSwitchThumb__PiPwV.style-module_ToggleSwitchThumbActive__RjbIp {\n transform: translateX(18px);\n}");export{l as default};
|
package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/thy-logo.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as C from"react";var e=function(e){var t=e.className,a=e.width,i=void 0===a?40:a,l=e.height,r=void 0===l?40:l;return C.createElement("svg",{width:i,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},C.createElement("rect",{width:"24",height:"24",rx:"6",fill:"#C90019"}),C.createElement("path",{d:"M12.9482 3.04933C17.4756 3.5207 21.0055 7.34653 21.0055 11.9945C21.0055 16.9659 16.9769 20.9945 12.0055 21C7.03411 21 3.00548 16.9714 3 12.0055C3 7.03411 7.02863 3.00548 12 3C12.3179 3 12.6358 3.01644 12.9428 3.04933H12.9482ZM13.4141 20.3697C18.0402 19.5914 21.159 15.2174 20.3806 10.5914C19.7339 6.7436 16.5987 3.93727 12.8989 3.55359C12.1535 3.47686 11.3806 3.49878 10.6023 3.62485C9.68149 3.77832 8.82095 4.07978 8.03715 4.49635C12.1151 5.87759 14.3021 7.98234 14.4555 10.1309C14.5323 11.4628 13.9129 12.422 13.1017 13.2058L18.8624 12.8057C19.0268 12.7948 19.0761 12.9866 18.8788 13.0414L5.13216 16.9823C6.52984 18.9117 8.70585 20.1943 11.1175 20.4464C11.863 20.5231 12.6358 20.5067 13.4141 20.3752V20.3697ZM9.63216 12.1973C10.3886 9.36358 9.52802 6.39829 7.46711 4.82521C4.66626 6.6011 3.04933 9.93362 3.63581 13.4086C3.82765 14.5597 4.24422 15.6121 4.8307 16.5384C7.02314 15.93 8.94702 14.7734 9.63216 12.1973Z",fill:"white"}),C.createElement("path",{d:"M20.3746 10.597C21.1529 15.2175 18.0341 19.597 13.4081 20.3753C12.6297 20.5068 11.8569 20.5288 11.1115 20.4465C8.69978 20.1944 6.52377 18.9118 5.12609 16.9825L18.8727 13.0415C19.0701 12.9867 19.0207 12.7949 18.8563 12.8059L13.0956 13.206C13.9068 12.4222 14.5262 11.463 14.4495 10.1311C14.296 7.97698 12.109 5.87772 8.03108 4.49647C8.81488 4.07991 9.67542 3.78393 10.5962 3.62498C11.3746 3.49343 12.1474 3.4715 12.8928 3.55372C16.5926 3.94288 19.7278 6.74373 20.3746 10.5915V10.597ZM3.63522 13.4088C3.82706 14.5598 4.24363 15.6122 4.83011 16.5385C7.02256 15.9301 8.94643 14.7736 9.63157 12.1974C10.388 9.36371 9.52743 6.39842 7.46653 4.82534C4.66567 6.60122 3.04874 9.93374 3.63522 13.4088Z",fill:"#C90019"}))};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/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/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../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/ikas-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{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../paypal-express-checkout/index.js";import{IkasBaseStore as l}from"../../store/base.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var c=o((function(o){var s,c,g,v=o.pageType,f=o.pageTitle,h=o.pageDescription,j=o.canonicals,x=o.disableIndex,y=o.pageSpecificData,b=o.merchantSettings,T=o.addOgpMetas,C=o.productReviewSummary,D=o.pageComponentPropValues,L=a(),O="undefined"!=typeof window,w="local"===process.env.NEXT_PUBLIC_ENV,k=L.asPath.split(/[?#]/)[0].replace("/",""),P=(k="/"===k.charAt(k.length-1)?k.slice(0,-1):k).startsWith("pages/"),R=v===r.BLOG,E=d.getCurrentRouting(),I=((null===(s=d.getMerchantSettings())||void 0===s?void 0:s.defaultLocale)||"tr")===(null==E?void 0:E.locale),S=!!y&&v===r.PRODUCT,_=!!y&&v===r.CATEGORY,V=!!y&&v===r.BRAND,A=S||_||V,M=null;(S||V||_)&&(M=y);var N=null===(c=null==M?void 0:M.translations)||void 0===c?void 0:c.find((function(e){return e.locale===(null==E?void 0:E.locale)})),B=(null==E?void 0:E.path)?"/"+E.path:"",G=w?"http://localhost:3333":"https://"+d.getDomain(),U=null===(g=d.getIndexPageSeoSettings())||void 0===g?void 0:g.find((function(e){return e.locale===d.getCurrentLocale()})),F=U?new n(U):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[v,y]);var Y=t.useMemo((function(){if(y&&y.href)return"".concat(G).concat(y.href)}),[y]),H=t.useMemo((function(){if(y&&y.href){var e=y.href;return B?"".concat(G).concat(B).concat(e):"".concat(G).concat(e)}}),[y]),z=t.useMemo((function(){var e,t,o,i=[];if(T){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:(null==F?void 0:F.pageTitle)||"https://"+d.getDomain()}),f&&i.push({property:"og:title",content:f}),h&&i.push({property:"og:description",content:h}),v===r.INDEX){var a=null,n=null;!f&&(null==F?void 0:F.pageTitle)&&(a=F.pageTitle),!h&&(null==F?void 0:F.description)&&(n=F.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v})))&&(a=u(y,v,s.titleTemplate||""),n=u(y,v,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(v===r.PRODUCT||v===r.CATEGORY||v===r.BRAND){var s,l=null,c=null;if((s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v})))&&(l=u(y,v,s.titleTemplate||""),c=u(y,v,s.descriptionTemplate||"")),!f){var p=l||A&&I&&(null==M?void 0:M.name)||A&&!I&&(null==N?void 0:N.name);p&&i.push({property:"og:title",content:p})}if(!h){var m=c||A&&!I&&(null==N?void 0:N.description);m&&i.push({property:"og:description",content:m})}}i.push({property:"og:url",content:H||(O?window.location.href:"")||"https://".concat(d.getDomain())});var g=null;if(y&&v===r.PRODUCT){var j=y.selectedVariant.mainImage;(null==j?void 0:j.image)&&(g={property:"og:image",content:j.image.src.replace(".webp",".jpg")})}if(y&&v===r.CATEGORY){var x=y;x.image&&(g={property:"og:image",content:x.image.src.replace(".webp",".jpg")})}if(y&&v===r.BRAND){var C=y;C.image&&(g={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}if(y&&v===r.BLOG_CATEGORY){var D=y;D.image&&(g={property:"og:image",content:D.image.src.replace(".webp",".jpg")})}if(y&&v===r.BLOG){var L=y;L.image&&(g={property:"og:image",content:L.image.src.replace(".webp",".jpg")})}!g&&(null==F?void 0:F.icon)&&(g={property:"og:image",content:null===(o=null==F?void 0:F.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!g&&(null==b?void 0:b.logo)&&(g={property:"og:image",content:b.logo.src.replace(".webp",".jpg")}),g&&i.push(g)}return i}),[f,y,Y,h,b,T,b]),X=t.useMemo((function(){var t=[],o=(null==F?void 0:F.pageTitle)||(null==b?void 0:b.merchantName)||"";if(b){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(b);t.push(i),t.push(a)}if(y&&v===r.PRODUCT){var n=y,s=function(t,o){var i,a,n,s,l,c;try{var p=["c7d934c7-2d44-43c3-b023-de7aa93fe435"],m=null===(i=d.getMerchantSettings())||void 0===i?void 0:i.merchantId,g=d.getCurrentRouting(),v=null==g?void 0:g.path,f=function(e){return v?"https://".concat(d.getDomain(),"/").concat(v).concat(e):"https://".concat(d.getDomain()).concat(e)},h=t.selectedVariant,j=null,x=null===(a=d.getMetaTemplates())||void 0===a?void 0:a.find((function(e){return e.locale===d.getCurrentLocale()&&r.PRODUCT}));return x&&(j=u(t,r.PRODUCT,x.descriptionTemplate||"")),e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:(null===(n=t.metaData)||void 0===n?void 0:n.description)||j,image:null===(s=h.images)||void 0===s?void 0:s.map((function(e){return e.image?e.image.src:""})),productId:h.id,sku:h.sku,mpn:(null===(l=h.barcodeList)||void 0===l?void 0:l.length)?h.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(c=t.brand)||void 0===c?void 0:c.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),p.some((function(e){return e!==m}))?{offers:t.variants.map((function(e){var o;return{"@type":"Offer",url:f(t.productHref+"?vid="+e.id),priceCurrency:e.price.currency||"TRY",price:(null!==(o=e.campaignPrice)&&void 0!==o?o:e.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:e.stock>0||e.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}))}:{})}catch(e){}}(n,C||null);if(s&&t.push(s),n.categories.length)(c=p(n.categories[0],o,n))&&t.push(c)}if(y&&v===r.CATEGORY){var l=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),c=p(y,o),g=m(D);l&&t.push(l),c&&t.push(c),g&&t.push(g)}y&&v===r.BRAND&&((g=m(D))&&t.push(g));if(y&&v===r.BLOG){var f=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a="".concat(t.writer.firstName," ").concat(t.writer.lastName),r=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:new Date(t.createdAt).toISOString(),dateCreated:new Date(t.createdAt).toISOString(),dateModified:new Date(t.updatedAt).toISOString(),description:t.shortDescription,articleBody:r,author:{"@type":"Person",name:a}})}catch(e){}}(y);f&&t.push(f)}return t}),[y,b]),W=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.titleTemplate||""):null}),[v,y]),J=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===v}));return t?u(y,v,t.descriptionTemplate||""):null}),[v,y]),q=t.useMemo((function(){return!d.getFavicon()&&(null==F?void 0:F.favIcon)?F.favIcon:null}),[]),K=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){K.push({routing:e,hrefLang:e.locale+"-"+t})})):K.push({routing:e,hrefLang:e.locale})}));var Q=function(e){var t,o,i,a,r,n=y,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=K.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},Z=l.getInstance();return t.createElement(i,null,t.createElement("title",null,f||W||(A?I?(null==M?void 0:M.name)||"":(null==N?void 0:N.name)||"":(null==F?void 0:F.pageTitle)||"")),t.createElement("meta",{name:"description",content:h||J||(A?(null==N?void 0:N.description)||"":(null==F?void 0:F.description)||"")}),K.length>1&&!P&&!R&&t.createElement(t.Fragment,null,K.filter((function(e){return!P||e.routing.id===(null==E?void 0:E.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(G+(e.routing.path?"/"+e.routing.path:""),"/").concat(Q(e.routing))})})),t.createElement("link",{rel:"alternate",hrefLang:"x-default",href:"".concat(G,"/").concat(k)})),!!x&&t.createElement("meta",{name:"robots",content:"noindex"}),!!T&&z.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!j&&j.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(G).concat(B).concat(e)})})),q&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(q,"/image_180.webp"),type:"image/webp"}),!j&&Z.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(G).concat(B,"/").concat(k)}),!!X.length&&X.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=l.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},c=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(c=c.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:c.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&c.push({"@type":"ListItem",position:c.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:c}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",c=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{c as IkasPageHead};
|
|
1
|
+
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/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/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../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/ikas-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{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../paypal-express-checkout/index.js";import{IkasBaseStore as l}from"../../store/base.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var c=o((function(o){var s,c,g,v,f,h,j,x=o.pageType,y=o.pageTitle,b=o.pageDescription,C=o.canonicals,T=o.disableIndex,D=o.pageSpecificData,L=o.merchantSettings,O=o.addOgpMetas,R=o.productReviewSummary,w=o.pageComponentPropValues,k=a(),P="undefined"!=typeof window,E="local"===process.env.NEXT_PUBLIC_ENV,I=k.asPath.split(/[?#]/)[0].replace("/",""),S=(I="/"===I.charAt(I.length-1)?I.slice(0,-1):I).startsWith("pages/"),_=x===r.BLOG,V=d.getCurrentRouting(),A=((null===(s=d.getMerchantSettings())||void 0===s?void 0:s.defaultLocale)||"tr")===(null==V?void 0:V.locale),M=!!D&&x===r.PRODUCT,N=!!D&&x===r.CATEGORY,B=!!D&&x===r.BRAND,G=M||N||B,U=null;(M||B||N)&&(U=D);var F=null===(c=null==U?void 0:U.translations)||void 0===c?void 0:c.find((function(e){return e.locale===(null==V?void 0:V.locale)})),Y=(null==V?void 0:V.path)?"/"+V.path:"",H=E?"http://localhost:3333":"https://"+d.getDomain(),z=null===(g=d.getIndexPageSeoSettings())||void 0===g?void 0:g.find((function(e){return e.locale===d.getCurrentLocale()})),X=z?new n(z):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[x,D]);var W=t.useMemo((function(){if(D&&D.href)return"".concat(H).concat(D.href)}),[D]),J=t.useMemo((function(){if(D&&D.href){var e=D.href;return Y?"".concat(H).concat(Y).concat(e):"".concat(H).concat(e)}}),[D]),q=t.useMemo((function(){var e,t,o,i=[];if(O){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:(null==X?void 0:X.pageTitle)||"https://"+d.getDomain()}),y&&i.push({property:"og:title",content:y}),b&&i.push({property:"og:description",content:b}),x===r.INDEX){var a=null,n=null;!y&&(null==X?void 0:X.pageTitle)&&(a=X.pageTitle),!b&&(null==X?void 0:X.description)&&(n=X.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===x})))&&(a=u(D,x,s.titleTemplate||""),n=u(D,x,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(x===r.PRODUCT||x===r.CATEGORY||x===r.BRAND){var s,l=null,c=null;if((s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===x})))&&(l=u(D,x,s.titleTemplate||""),c=u(D,x,s.descriptionTemplate||"")),!y){var p=l||G&&A&&(null==U?void 0:U.name)||G&&!A&&(null==F?void 0:F.name);p&&i.push({property:"og:title",content:p})}if(!b){var m=c||G&&!A&&(null==F?void 0:F.description);m&&i.push({property:"og:description",content:m})}}i.push({property:"og:url",content:J||(P?window.location.href:"")||"https://".concat(d.getDomain())});var g=null;if(D&&x===r.PRODUCT){var v=D.selectedVariant.mainImage;(null==v?void 0:v.image)&&(g={property:"og:image",content:v.image.src.replace(".webp",".jpg")})}if(D&&x===r.CATEGORY){var f=D;f.image&&(g={property:"og:image",content:f.image.src.replace(".webp",".jpg")})}if(D&&x===r.BRAND){var h=D;h.image&&(g={property:"og:image",content:h.image.src.replace(".webp",".jpg")})}if(D&&x===r.BLOG_CATEGORY){var j=D;j.image&&(g={property:"og:image",content:j.image.src.replace(".webp",".jpg")})}if(D&&x===r.BLOG){var C=D;C.image&&(g={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}!g&&(null==X?void 0:X.icon)&&(g={property:"og:image",content:null===(o=null==X?void 0:X.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!g&&(null==L?void 0:L.logo)&&(g={property:"og:image",content:L.logo.src.replace(".webp",".jpg")}),g&&i.push(g)}return i}),[y,D,W,b,L,O,L]),K=t.useMemo((function(){var t=[],o=(null==X?void 0:X.pageTitle)||(null==L?void 0:L.merchantName)||"";if(L){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(L);t.push(i),t.push(a)}if(D&&x===r.PRODUCT){var n=D,s=function(t,o){var i,a,n,s,l,c;try{var p=["c7d934c7-2d44-43c3-b023-de7aa93fe435"],m=null===(i=d.getMerchantSettings())||void 0===i?void 0:i.merchantId,g=d.getCurrentRouting(),v=null==g?void 0:g.path,f=function(e){return v?"https://".concat(d.getDomain(),"/").concat(v).concat(e):"https://".concat(d.getDomain()).concat(e)},h=t.selectedVariant,j=null,x=null===(a=d.getMetaTemplates())||void 0===a?void 0:a.find((function(e){return e.locale===d.getCurrentLocale()&&r.PRODUCT}));return x&&(j=u(t,r.PRODUCT,x.descriptionTemplate||"")),e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:(null===(n=t.metaData)||void 0===n?void 0:n.description)||j,image:null===(s=h.images)||void 0===s?void 0:s.map((function(e){return e.image?e.image.src:""})),productId:h.id,sku:h.sku,mpn:(null===(l=h.barcodeList)||void 0===l?void 0:l.length)?h.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(c=t.brand)||void 0===c?void 0:c.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),p.some((function(e){return e!==m}))?{offers:t.variants.map((function(e){var o;return{"@type":"Offer",url:f(t.productHref+"?vid="+e.id),priceCurrency:e.price.currency||"TRY",price:(null!==(o=e.campaignPrice)&&void 0!==o?o:e.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:e.stock>0||e.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}))}:{})}catch(e){}}(n,R||null);if(s&&t.push(s),n.categories.length)(c=p(n.categories[0],o,n))&&t.push(c)}if(D&&x===r.CATEGORY){var l=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(D),c=p(D,o),g=m(w);l&&t.push(l),c&&t.push(c),g&&t.push(g)}D&&x===r.BRAND&&((g=m(w))&&t.push(g));if(D&&x===r.BLOG){var v=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a="".concat(t.writer.firstName," ").concat(t.writer.lastName),r=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:new Date(t.createdAt).toISOString(),dateCreated:new Date(t.createdAt).toISOString(),dateModified:new Date(t.updatedAt).toISOString(),description:t.shortDescription,articleBody:r,author:{"@type":"Person",name:a}})}catch(e){}}(D);v&&t.push(v)}return t}),[D,L]),Q=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===x}));return t?u(D,x,t.titleTemplate||""):null}),[x,D]),Z=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===x}));return t?u(D,x,t.descriptionTemplate||""):null}),[x,D]),$=t.useMemo((function(){return!d.getFavicon()&&(null==X?void 0:X.favIcon)?X.favIcon:null}),[]),ee=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){ee.push({routing:e,hrefLang:e.locale+"-"+t})})):ee.push({routing:e,hrefLang:e.locale})}));var te=function(e){var t,o,i,a,r,n=D,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=ee.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""};console.log("routeData",ee),console.log("currentRouting",V),console.log("currentPath",I),console.log("currentRoutingPath",Y),console.log("domain",H),console.log("getroutings",d.getRoutings()),console.log("getcurrentrouting",d.getCurrentRouting()),console.log("product",D);var oe=null===(v=ee.find((function(e){return!e.routing.path})))||void 0===v?void 0:v.routing.locale,ie=(null===(j=null===(h=null===(f=null==D?void 0:D.metaData)||void 0===f?void 0:f.translations)||void 0===h?void 0:h.find((function(e){return e.locale===oe})))||void 0===j?void 0:j.slug)||"",ae=l.getInstance();return t.createElement(i,null,t.createElement("title",null,y||Q||(G?A?(null==U?void 0:U.name)||"":(null==F?void 0:F.name)||"":(null==X?void 0:X.pageTitle)||"")),t.createElement("meta",{name:"description",content:b||Z||(G?(null==F?void 0:F.description)||"":(null==X?void 0:X.description)||"")}),ee.length>1&&!S&&!_&&t.createElement(t.Fragment,null,ee.filter((function(e){return!S||e.routing.id===(null==V?void 0:V.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(H+(e.routing.path?"/"+e.routing.path:""),"/").concat(te(e.routing))})})),t.createElement("link",{rel:"alternate",hrefLang:"x-default",href:"".concat(H,"/").concat(ie)})),!!T&&t.createElement("meta",{name:"robots",content:"noindex"}),!!O&&q.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!C&&C.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(H).concat(Y).concat(e)})})),$&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat($,"/image_180.webp"),type:"image/webp"}),!C&&ae.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(H).concat(Y,"/").concat(I)}),!!K.length&&K.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=l.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},c=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(c=c.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:c.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&c.push({"@type":"ListItem",position:c.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:c}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",c=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{c as IkasPageHead};
|
|
@@ -3,6 +3,7 @@ import { IkasBaseModel } from "../base";
|
|
|
3
3
|
import { IkasPaymentGatewayTranslation } from "./translation";
|
|
4
4
|
import { IkasPaymentGatewaySettings } from "./settings";
|
|
5
5
|
import { IkasPaymentGatewayType, IkasPaymentMethod, IkasPaymentMethodType, IkasPaymentGateway as IPaymentGateway } from "@ikas/storefront-models";
|
|
6
|
+
import { RewardSourceEnum } from "@ikas/storefront-api";
|
|
6
7
|
export declare class IkasPaymentGateway extends IkasBaseModel implements IPaymentGateway {
|
|
7
8
|
additionalPrices: IkasPaymentGatewayAdditionalPrice[] | null;
|
|
8
9
|
availableCountries: string[] | null;
|
|
@@ -19,6 +20,7 @@ export declare class IkasPaymentGateway extends IkasBaseModel implements IPaymen
|
|
|
19
20
|
paymentMethodType: IkasPaymentMethodType;
|
|
20
21
|
settings?: IkasPaymentGatewaySettings[] | null;
|
|
21
22
|
translations?: IkasPaymentGatewayTranslation[] | null;
|
|
23
|
+
enabledRewardSources: RewardSourceEnum[] | null;
|
|
22
24
|
constructor(data: IPaymentGateway);
|
|
23
25
|
}
|
|
24
26
|
export { IkasPaymentGatewayType, IkasPaymentMethodType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasPaymentGatewayAdditionalPrice as t}from"./additional-price/index.js";import{IkasBaseModel as n}from"../base/index.js";import{IkasPaymentGatewaySettings as o}from"./settings/index.js";import{IkasPaymentGatewayType as
|
|
1
|
+
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasPaymentGatewayAdditionalPrice as t}from"./additional-price/index.js";import{IkasBaseModel as n}from"../base/index.js";import{IkasPaymentGatewaySettings as o}from"./settings/index.js";import{IkasPaymentGatewayType as r,IkasPaymentMethodType as s}from"@ikas/storefront-models";export{IkasPaymentGatewayType,IkasPaymentMethodType}from"@ikas/storefront-models";import{makeObservable as a,observable as i}from"mobx";var l=function(n){function l(e){var l,d,p=this;return(p=n.call(this,e)||this).additionalPrices=(null===(l=e.additionalPrices)||void 0===l?void 0:l.map((function(e){return new t(e)})))||null,p.availableCountries=e.availableCountries||[],p.code=e.code||"",p.description=e.description||null,p.logoUrl=e.logoUrl||null,p.masterPassClientId=e.masterPassClientId||null,p.name=e.name||"",p.paymentGatewayProviderId=e.paymentGatewayProviderId||null,p.supportedCurrencies=e.supportedCurrencies||[],p.testMode=e.testMode||null,p.type=e.type||r.INTERNAL,p.paymentMethods=e.paymentMethods||[],p.paymentMethodType=e.paymentMethodType||s.OTHER,p.settings=(null===(d=e.settings)||void 0===d?void 0:d.map((function(e){return new o(e)})))||null,p.translations=e.translations||null,p.enabledRewardSources=e.enabledRewardSources||null,a(p,{additionalPrices:i,availableCountries:i,code:i,description:i,logoUrl:i,masterPassClientId:i,name:i,paymentGatewayProviderId:i,supportedCurrencies:i,testMode:i,type:i,paymentMethods:i,paymentMethodType:i,settings:i,translations:i}),p}return e(l,n),l}(n);export{l as IkasPaymentGateway};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.321",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"swiper": "11.0.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
29
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
30
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
26
|
+
"@ikas/storefront-api": "^6.1.0-beta.321",
|
|
27
|
+
"@ikas/storefront-config": "^6.1.0-beta.321",
|
|
28
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.321",
|
|
29
|
+
"@ikas/storefront-models": "^6.1.0-beta.321",
|
|
30
|
+
"@ikas/storefront-providers": "^6.1.0-beta.321",
|
|
31
31
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
32
32
|
"@adyen/adyen-web": "^5.57.0",
|
|
33
33
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
65
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
68
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
69
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
65
|
+
"@ikas/storefront-api": "^6.1.0-beta.321",
|
|
66
|
+
"@ikas/storefront-config": "^6.1.0-beta.321",
|
|
67
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.321",
|
|
68
|
+
"@ikas/storefront-models": "^6.1.0-beta.321",
|
|
69
|
+
"@ikas/storefront-providers": "^6.1.0-beta.321",
|
|
70
70
|
"mobx": "^6.1.3",
|
|
71
71
|
"mobx-react-lite": "^3.1.5",
|
|
72
72
|
"next": "12.2.0",
|