@ikas/storefront 6.1.0-beta.23 → 6.1.0-beta.231

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.
Files changed (197) hide show
  1. package/build/analytics/analytics.d.ts +6 -3
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/events.d.ts +4 -1
  4. package/build/analytics/events.js +1 -1
  5. package/build/analytics/googleAnalytics.d.ts +2 -2
  6. package/build/analytics/googleAnalytics.js +1 -1
  7. package/build/analytics/googleTagManager.d.ts +3 -2
  8. package/build/analytics/googleTagManager.js +1 -1
  9. package/build/analytics/ikasV3.d.ts +6 -0
  10. package/build/analytics/ikasV3.js +1 -1
  11. package/build/components/checkout/components/address-form/index.js +1 -1
  12. package/build/components/checkout/components/address-form/model.d.ts +5 -0
  13. package/build/components/checkout/components/address-form/model.js +1 -1
  14. package/build/components/checkout/components/adyen/index.js +1 -1
  15. package/build/components/checkout/components/button/index.d.ts +1 -0
  16. package/build/components/checkout/components/button/index.js +1 -1
  17. package/build/components/checkout/components/button/style.module.scss.js +1 -1
  18. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  19. package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
  20. package/build/components/checkout/components/cart-summary/index.d.ts +2 -1
  21. package/build/components/checkout/components/cart-summary/index.js +1 -1
  22. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  23. package/build/components/checkout/components/customer-addresses/index.d.ts +1 -0
  24. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  25. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  26. package/build/components/checkout/components/form-item/index.js +1 -1
  27. package/build/components/checkout/components/form-item/model.d.ts +5 -3
  28. package/build/components/checkout/components/form-item/model.js +1 -1
  29. package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
  30. package/build/components/checkout/components/hepsipay/index.d.ts +9 -0
  31. package/build/components/checkout/components/hepsipay/index.js +1 -0
  32. package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
  33. package/build/components/checkout/components/modal/index.d.ts +1 -0
  34. package/build/components/checkout/components/modal/index.js +1 -1
  35. package/build/components/checkout/components/modal/style.module.scss.js +1 -1
  36. package/build/components/checkout/components/offer-product/index.js +1 -1
  37. package/build/components/checkout/components/offer-product/style.module.scss.js +1 -1
  38. package/build/components/checkout/components/phone-number-input/index.d.ts +1 -1
  39. package/build/components/checkout/components/phone-number-input/index.js +1 -1
  40. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  41. package/build/components/checkout/components/quick-registration/index.js +1 -1
  42. package/build/components/checkout/components/stripe/checkout-form.js +1 -1
  43. package/build/components/checkout/components/svg/coupon-code-tag.d.ts +6 -0
  44. package/build/components/checkout/components/svg/coupon-code-tag.js +1 -0
  45. package/build/components/checkout/components/svg/credit-balance.d.ts +6 -0
  46. package/build/components/checkout/components/svg/credit-balance.js +1 -0
  47. package/build/components/checkout/components/svg/gift-cart-tag.d.ts +6 -0
  48. package/build/components/checkout/components/svg/gift-cart-tag.js +1 -0
  49. package/build/components/checkout/components/svg/store-credit-tag.d.ts +6 -0
  50. package/build/components/checkout/components/svg/store-credit-tag.js +1 -0
  51. package/build/components/checkout/components/svg/subscription.d.ts +6 -0
  52. package/build/components/checkout/components/svg/subscription.js +1 -0
  53. package/build/components/checkout/index.js +1 -1
  54. package/build/components/checkout/model.d.ts +29 -7
  55. package/build/components/checkout/model.js +1 -1
  56. package/build/components/checkout/steps/step-info/index.js +1 -1
  57. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  58. package/build/components/checkout/steps/step-payment/index.js +1 -1
  59. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  60. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.d.ts +7 -0
  61. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/index.js +1 -0
  62. package/build/components/checkout/steps/step-payment/payment-gateways/store-credit/style.module.scss.js +1 -0
  63. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  64. package/build/components/checkout/steps/step-success/index.js +1 -1
  65. package/build/components/image/index.d.ts +1 -0
  66. package/build/components/image/index.js +1 -1
  67. package/build/components/index.d.ts +3 -0
  68. package/build/components/page/head.js +1 -1
  69. package/build/components/page/index.d.ts +1 -1
  70. package/build/components/page/index.js +1 -1
  71. package/build/components/page/widgets/common.d.ts +2 -0
  72. package/build/components/page/widgets/common.js +1 -0
  73. package/build/components/page/widgets/loyaltyWidget.d.ts +8 -0
  74. package/build/components/page/widgets/loyaltyWidget.js +1 -0
  75. package/build/components/page/widgets/popupWidget.d.ts +13 -0
  76. package/build/components/page/widgets/popupWidget.js +1 -0
  77. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  78. package/build/components/page-editor/model.js +1 -1
  79. package/build/components/pay-with-ikas/index.d.ts +8 -0
  80. package/build/components/pay-with-ikas/index.js +1 -0
  81. package/build/components/paypal-express-checkout/index.d.ts +9 -0
  82. package/build/components/paypal-express-checkout/index.js +1 -0
  83. package/build/components/plain-image/index.d.ts +13 -0
  84. package/build/components/plain-image/index.js +1 -0
  85. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
  86. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
  87. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
  88. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
  89. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
  90. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
  91. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
  92. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
  93. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
  94. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
  95. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
  96. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
  97. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
  98. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
  99. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
  100. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
  101. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -1
  102. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
  103. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
  104. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
  105. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
  106. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
  107. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -1
  108. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -1
  109. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
  110. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -1
  111. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -1
  112. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
  113. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
  114. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +1 -1
  115. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -1
  116. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -1
  117. package/build/hooks/useCustomerReviews.d.ts +2 -0
  118. package/build/hooks/useCustomerReviews.js +1 -1
  119. package/build/hooks/useStore.js +1 -1
  120. package/build/index.js +1 -1
  121. package/build/models/data/checkout-settings/index.d.ts +1 -0
  122. package/build/models/data/checkout-settings/index.js +1 -1
  123. package/build/models/data/customer/review/index.d.ts +4 -1
  124. package/build/models/data/customer/review/index.js +1 -1
  125. package/build/models/data/index.d.ts +1 -0
  126. package/build/models/data/order/adjustment/index.d.ts +3 -1
  127. package/build/models/data/order/adjustment/index.js +1 -1
  128. package/build/models/data/order/gift-card-line/index.d.ts +2 -1
  129. package/build/models/data/order/gift-card-line/index.js +1 -1
  130. package/build/models/data/order/index.d.ts +4 -0
  131. package/build/models/data/order/index.js +1 -1
  132. package/build/models/data/order/line-item/bundle-product-settings/index.d.ts +7 -0
  133. package/build/models/data/order/line-item/bundle-product-settings/index.js +1 -0
  134. package/build/models/data/order/line-item/index.d.ts +4 -0
  135. package/build/models/data/order/line-item/index.js +1 -1
  136. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.d.ts +8 -0
  137. package/build/models/data/order/line-item/order-line-item-subscription-plan/index.js +1 -0
  138. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.d.ts +6 -0
  139. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-discount/index.js +1 -0
  140. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.d.ts +14 -0
  141. package/build/models/data/order/line-item/order-line-item-subscription-plan/order-line-item-subscription-plan-period/index.js +1 -0
  142. package/build/models/data/order/loyalty-line/index.d.ts +9 -0
  143. package/build/models/data/order/loyalty-line/index.js +1 -0
  144. package/build/models/data/order/order-transaction-with-prices/index.d.ts +1 -0
  145. package/build/models/data/order/order-transaction-with-prices/index.js +1 -1
  146. package/build/models/data/product/campaign-offer/index.d.ts +2 -0
  147. package/build/models/data/product/campaign-offer/index.js +1 -1
  148. package/build/models/data/product/filter/index.d.ts +2 -0
  149. package/build/models/data/product/filter/index.js +1 -1
  150. package/build/models/data/product/index.d.ts +8 -0
  151. package/build/models/data/product/index.js +1 -1
  152. package/build/models/data/product/translations/index.d.ts +7 -0
  153. package/build/models/data/product/translations/index.js +1 -0
  154. package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -1
  155. package/build/models/data/product/variant/index.d.ts +3 -0
  156. package/build/models/data/product/variant/index.js +1 -1
  157. package/build/models/data/product/variant/subscription-plan/index.d.ts +12 -0
  158. package/build/models/data/product/variant/subscription-plan/index.js +1 -0
  159. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-discount/index.d.ts +6 -0
  160. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.d.ts +23 -0
  161. package/build/models/data/product/variant/subscription-plan/product-subscription-plan-period/index.js +1 -0
  162. package/build/models/data/store-credit-balance/index.d.ts +26 -0
  163. package/build/models/data/store-credit-balance/index.js +1 -0
  164. package/build/models/data/theme-json/component/prop/index.d.ts +1 -0
  165. package/build/models/data/theme-json/component/prop/index.js +1 -1
  166. package/build/models/data/theme-json/custom-data/index.d.ts +1 -0
  167. package/build/models/data/theme-json/custom-data/index.js +1 -1
  168. package/build/models/ui/customer-review-list/index.d.ts +8 -0
  169. package/build/models/ui/customer-review-list/index.js +1 -1
  170. package/build/models/ui/product-list/index.d.ts +17 -0
  171. package/build/models/ui/product-list/index.js +1 -1
  172. package/build/models/ui/validator/form/login.d.ts +20 -6
  173. package/build/models/ui/validator/form/login.js +1 -1
  174. package/build/models/ui/validator/form/register.d.ts +15 -6
  175. package/build/models/ui/validator/form/register.js +1 -1
  176. package/build/pages/checkout.js +1 -1
  177. package/build/store/cart/api.d.ts +3 -1
  178. package/build/store/cart/api.js +1 -1
  179. package/build/store/cart/index.d.ts +25 -1
  180. package/build/store/cart/index.js +1 -1
  181. package/build/store/checkout/index.d.ts +4 -1
  182. package/build/store/checkout/index.js +1 -1
  183. package/build/store/customer/api.d.ts +16 -3
  184. package/build/store/customer/api.js +1 -1
  185. package/build/store/customer/index.d.ts +40 -5
  186. package/build/store/customer/index.js +1 -1
  187. package/build/store/index.d.ts +1 -0
  188. package/build/store/product/index.d.ts +2 -1
  189. package/build/store/product/index.js +1 -1
  190. package/build/utils/helper.d.ts +1 -0
  191. package/build/utils/helper.js +1 -1
  192. package/package.json +14 -12
  193. package/build/components/popup/index.js +0 -1
  194. package/build/components/popup/renderer/index.js +0 -1
  195. package/build/components/popup/renderer/model.js +0 -1
  196. package/build/components/popup/utils/index.js +0 -1
  197. package/build/store/storefront-popup/index.js +0 -1
@@ -9,10 +9,11 @@ import { TFunction } from "../../utils/i18n";
9
9
  import { IkasCheckoutCustomizationProps } from ".";
10
10
  import MasterPassModel from "./modelMasterPass";
11
11
  import { APIResponse } from "@ikas/fe-api-client";
12
- import { CreateStripePaymentIntentResponse, RetrieveInstallmentInfoResponse, UpdateCartCampaignOfferInput, CreateKlarnaTokenResponse, GetPaypalClientIdResponse, CreatePaypalOrderResponse, CreateAdyenPlatformSessionResponse } from "@ikas/storefront-api";
12
+ import { CreateStripePaymentIntentResponse, RetrieveInstallmentInfoResponse, UpdateCartCampaignOfferInput, CreateKlarnaTokenResponse, GetPaypalClientIdResponse, CreatePaypalOrderResponse, CreateAdyenPlatformSessionResponse, HepsipayFrameInitResponse } from "@ikas/storefront-api";
13
13
  import { IkasBaseStore } from "../../store";
14
14
  import { RetrieveInstallmentInfoQueryParams, SaveCartInput } from "@ikas/storefront-api";
15
15
  import { LocalizedAddressModel } from "@ikas/localized-address";
16
+ import { IkasOrderTransactionWithPrices, IkasStoreCreditBalance } from "@ikas/storefront-models";
16
17
  export declare type IUnavailableItems = {
17
18
  item: IkasOrderLineItem;
18
19
  stockCount: number;
@@ -53,6 +54,7 @@ export default class CheckoutViewModel {
53
54
  adyenDropinElement: any;
54
55
  payPalClientIdResponse: GetPaypalClientIdResponse | null;
55
56
  paypalOrderResponse: CreatePaypalOrderResponse | null;
57
+ hepsipayFrameInitResponse: HepsipayFrameInitResponse | null;
56
58
  campaignOffers: CampaignOfferType[] | undefined;
57
59
  isCampaignOfferLoaded: boolean;
58
60
  countrySettings: LocalizedAddressModel;
@@ -68,12 +70,18 @@ export default class CheckoutViewModel {
68
70
  couponError?: string | null;
69
71
  successTransaction?: IkasOrderTransaction;
70
72
  successTransactions?: IkasOrderTransaction[];
73
+ storeCreditBalance?: IkasStoreCreditBalance | null;
74
+ isMinTransactionError?: boolean;
71
75
  mpVM: MasterPassModel;
72
76
  showTestModal: boolean;
77
+ openEditOrderTransaction?: IkasOrderTransactionWithPrices | null;
78
+ private previousRawValue;
79
+ private previousBin;
73
80
  t: TFunction;
74
81
  constructor(checkout: IkasCheckout, checkoutSettings: IkasCheckoutSettings, router: NextRouter, returnPolicy: string, privacyPolicy: string, termsOfService: string, imprint: string, shippingPolicy: string, t: TFunction, customizationProps: IkasCheckoutCustomizationProps);
75
82
  init: () => Promise<void>;
76
83
  initStep: () => Promise<void>;
84
+ getOpenEditOrderTransaction: () => Promise<void>;
77
85
  getSuccessTransaction: () => Promise<void>;
78
86
  get merchantSettings(): IkasMerchantSettings;
79
87
  get selectedPaymentGatewayIndex(): number;
@@ -91,10 +99,11 @@ export default class CheckoutViewModel {
91
99
  get isPaymentGatewayHasMasterPass(): boolean;
92
100
  get hasQuickRegistration(): boolean | null;
93
101
  get canProceedToShipping(): boolean | undefined;
94
- get canProceedToInStoreDelivery(): boolean;
102
+ get canProceedToInStoreDelivery(): boolean | undefined;
95
103
  get canProceedToPayment(): boolean | "" | null | undefined;
96
104
  get isValidShippingSettings(): boolean | "" | null | undefined;
97
105
  get isManualOrderWithShippingLines(): boolean | 0 | undefined;
106
+ get isManualOrderWithoutShippingLines(): boolean;
98
107
  get isInStoreDelivery(): boolean;
99
108
  get klarnaPaymentGateway(): IkasPaymentGateway | undefined;
100
109
  get klarnaPaymentGatewayIndex(): number;
@@ -102,10 +111,13 @@ export default class CheckoutViewModel {
102
111
  get adyenPaymentGatewayIndex(): number;
103
112
  get payPalPaymentGateway(): IkasPaymentGateway | undefined;
104
113
  get payPalPaymentGatewayIndex(): number;
114
+ get hepsiPayPaymentGateway(): IkasPaymentGateway | undefined;
115
+ get hepsiPayPaymentGatewayIndex(): number;
105
116
  get isCustomFlowStripe(): boolean | null | undefined;
106
117
  get isKlarna(): boolean | null | undefined;
107
118
  get isAdyen(): boolean | null | undefined;
108
119
  get isPayPal(): boolean | null | undefined;
120
+ get isHepsiPay(): boolean | null | undefined;
109
121
  get isFree(): boolean;
110
122
  get store(): IkasBaseStore;
111
123
  get isCouponCodeRequirementDefult(): boolean;
@@ -113,11 +125,14 @@ export default class CheckoutViewModel {
113
125
  get isCouponCodeRequirementInvisible(): boolean;
114
126
  get isCouponCodeVisible(): boolean;
115
127
  get isCorporateInvoiceVisible(): boolean;
128
+ get isShowBillingAddressOnShippingStep(): boolean | null;
116
129
  get canPerformPayment(): boolean | undefined;
117
130
  get isDigitalOnly(): boolean;
118
131
  get customerAddresses(): IkasLocalizedCustomerAddress[] | undefined;
119
132
  get isManualOrder(): boolean;
120
133
  get isUpsellOrder(): boolean;
134
+ get isOpenEditOrder(): boolean;
135
+ get isOpenEditOrderWithTransaction(): boolean;
121
136
  get isEPayKolayEnabled(): boolean;
122
137
  get isPoweredByHidden(): boolean;
123
138
  saveCart: () => Promise<import("../../models").IkasCart | null | undefined>;
@@ -131,6 +146,7 @@ export default class CheckoutViewModel {
131
146
  checkShippingCountries: () => void;
132
147
  onDeliveryMethodChange: (deliveryMethod: "address" | "in-store") => void;
133
148
  initialStockCheck: () => Promise<void>;
149
+ getStoreCreditBalance: () => Promise<void>;
134
150
  listPaymentGateways: () => Promise<void>;
135
151
  retrieveInstallmentInfo: (params: RetrieveInstallmentInfoQueryParams) => Promise<void>;
136
152
  createCustomer: () => void;
@@ -140,8 +156,9 @@ export default class CheckoutViewModel {
140
156
  createBillingAddress: () => void;
141
157
  onShippingMethodChange: (shippingMethod: IkasAvailableShippingMethod) => Promise<void>;
142
158
  onStockLocationChange: (location: IkasStockLocation) => Promise<void>;
143
- onCouponCodeApply: () => Promise<void>;
159
+ onCouponCodeApply: (isAddingCoupon?: boolean) => Promise<void>;
144
160
  removeGiftCardLine: (giftCardId: string | null) => Promise<void>;
161
+ removeLoyaltyPointsFromCart: (loyaltySpendingMethodId: string) => Promise<void>;
145
162
  getAvailableShippingZones: () => Promise<void>;
146
163
  onSelectedShippingAddressIdChange: (value: string) => void;
147
164
  onSelectedBillingAddressIdChange: (value: string) => void;
@@ -152,9 +169,11 @@ export default class CheckoutViewModel {
152
169
  onExpirationDateChange: (value: string) => void;
153
170
  onCvcChange: (value: string) => void;
154
171
  saveAddress: (type: "billing" | "shipping") => Promise<void>;
155
- onGoToCartClick: () => void;
156
- onBackToShoppingClick: () => void;
157
- onGoToLoginClick: () => void;
172
+ private getRoutingPath;
173
+ getGoToCartHref: () => string;
174
+ getBackToShoppingHref: () => string;
175
+ getGoToLoginHref: () => string;
176
+ onHandleBillingAddressOnShippingStep: () => Promise<void>;
158
177
  onProceedToShippingClick: () => Promise<void>;
159
178
  onProceedToDigitalOnlyPaymentClick: () => Promise<void>;
160
179
  onProceedToPaymentClick: () => Promise<void>;
@@ -167,7 +186,7 @@ export default class CheckoutViewModel {
167
186
  onBackToInfoClick: () => void;
168
187
  onBackToShippingClick: () => void;
169
188
  setCustomerConsentGranted: (value: boolean) => void;
170
- setUseDifferentAddress: (value: boolean) => void;
189
+ setUseDifferentAddress: (value: boolean, isShippingStep?: boolean) => void;
171
190
  setShouldSaveAddress: (value: boolean) => void;
172
191
  setAddressTitle: (value: string) => void;
173
192
  reInitPaymentMethod: () => Promise<void>;
@@ -175,6 +194,7 @@ export default class CheckoutViewModel {
175
194
  createKlarnaClientToken: (paymentGateway: IkasPaymentGateway) => Promise<void>;
176
195
  createAdyenBalancePlatformPaymentSession: (paymentGateway: IkasPaymentGateway) => Promise<void>;
177
196
  getPayPalClientId: (paymentGateway: IkasPaymentGateway) => Promise<void>;
197
+ hepsipayFrameInit: (paymentGateway: IkasPaymentGateway) => Promise<void>;
178
198
  setPaymentGateway: (index: number) => Promise<void>;
179
199
  updatePaymentGateway: (paymentGateway: IkasPaymentGateway) => Promise<boolean>;
180
200
  setInstallmentCount: (count: number) => void;
@@ -186,6 +206,8 @@ export default class CheckoutViewModel {
186
206
  updateCartCampaignOffer: (input: UpdateCartCampaignOfferInput) => Promise<void>;
187
207
  registerCustomer: (password: string) => Promise<APIResponse<{
188
208
  customer: import("../../models").IkasCustomer | null;
209
+ flowId: string | null;
210
+ otpSend: boolean | null;
189
211
  token: string;
190
212
  tokenExpiry: number;
191
213
  } | null> | undefined>;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign 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{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderPaymentStatus as p,IkasTransactionStatus as m,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as g,IkasOrderLineItemStatus as v,IkasAmountType as y,IkasCampaignOfferProductApplicablePriceEnum as S}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 b}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 I}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 A}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 w}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-filter/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 O}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 N from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import T from"../../store/checkout/index.js";import D from"../../store/cart/api.js";import G,{MFS_ELEMENT_ID as M,MFS_SCRIPT_URL as L}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as _,SaveCartInput as V,CheckStocksLineInput as U}from"@ikas/storefront-api";import{IkasBaseStore as F}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";import{Analytics as K}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Y from"../../models/data/order/address/ikas-localized-order-address.js";import Z from"../../store/location/index.js";import{getCookieValue as H}from"../../utils/helper.js";var q,W,Q=/^\d+$/,z="undefined"==typeof localStorage,X=function(){function Q(a,d,C,I,Q,X,ee,te,ie,se){var ne=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=q.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],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.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(ne,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,F.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(ne,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(B.getIsEditor())return this.step=q.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===q.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(q.INFO)];if(this.step!==q.PAYMENT||this.canProceedToPayment){if(this.step===q.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(q.INFO)];if(![q.INFO,q.SUCCESS,q.SHIPPING,q.PAYMENT].includes(this.step))return[2,this.changeStep(q.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(q.INFO)]:[2,this.changeStep(q.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),n&&(this.error={type:W.PAYMENT_ERROR,data:r||null}),this.step!==q.SHIPPING&&this.step!==q.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new b(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==q.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==q.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=q.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==q.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==q.SUCCESS||this.checkout.orderPaymentStatus!==p.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==q.PAYMENT&&this.step!==q.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===q.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(q.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return this.isCheckoutLoaded=!0,K.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(ne,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.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 e(ne,void 0,void 0,(function(){var e,i,s,n,r,a;return t(this,(function(t){switch(t.label){case 0:return e=new V(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return this.step!==q.INFO&&this.step!==q.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,D.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type:W.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(r=s.extensions)||void 0===r?void 0:r.code)?{type:W.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(a=s.extensions)||void 0===a?void 0:a.code)?{type:W.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:W.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ne,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(u=B.getStockLocationIds())||void 0===u?void 0:u.length)?B.getStockLocationIds():null,[4,T.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:W.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:W.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ne,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,F.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getAvailableShippingCountries({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?[4,T.listStockLocation({id:{in:B.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:W.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,T.getAvailableStockLocations({lines:e.map((function(e){return new U(e)})),stockLocationIdList:B.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:W.API_ERROR},[2];s=B.getCurrentRouting(),this.availableStockLocations=(i.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))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=ne.shippingCountryIds)||void 0===e?void 0:e.length)||(ne.error={type:W.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ne.deliveryMethod!==e&&("address"===e&&(ne.checkout.stockLocationId=null,(null===(t=ne.customerAddresses)||void 0===t?void 0:t.length)?ne.onSelectedShippingAddressIdChange(ne.customerAddresses[0].id||"-1"):(ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)),ne.deliveryMethod=e,ne.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ne,void 0,void 0,(function(){var e;return t(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:W.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,f=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=B.getPaymentGateways().map((function(e){return e.id})),[4,T.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:B.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(h=s.data)||void 0===h?void 0:h.length)||this.isFree?(this.error=void 0,n=s.data||[],this.step===q.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(f.checkout.currencyCode)})),(o=null===(p=this.checkout.shippingAddress)||void 0===p?void 0:p.country)&&o.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(o.iso2||"")}))),a=null===(m=this.checkout.billingAddress)||void 0===m?void 0:m.country,!o&&a&&a.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")})))),c=[],r(B.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&c.push(t)})),this.paymentGateways=e?n:c,d=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=f.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==d?d:0),[3,4])):(this.error={type:W.NO_SHIPPING_ERROR},[2]):(this.error={type:W.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==q.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===q.PAYMENT&&(u=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=u,(l=document.createElement("script")).id=M,l.src=L,l.onload=function(){f.mpVM.checkMasterPass({checkout:f.checkout,store:F.getInstance()})},document.head.appendChild(l)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ne,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.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 e;ne.store.customerStore.customer?(null===(e=ne.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ne.checkoutSettings,e.shippingZones=ne.shippingZones})),ne.checkout.customer=new A(i(i({},ne.store.customerStore.customer),{notificationsAccepted:ne.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ne.checkout.customer=new A(ne.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones,ne.checkout.billingAddress.countrySettings=ne.countrySettings,ne.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ne.isDigitalOnly)if(ne.isInStoreDelivery)ne.setCheckoutShippingAddressSettings();else if(ne.checkout.shippingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedShippingAddressIdChange(e.id||"-1"),void ne.setCheckoutShippingAddressSettings()}ne.checkout.shippingAddress=new Y(n(ne.checkout.shippingAddress)||{}),ne.setCheckoutShippingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ne.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ne.useDifferentAddress=!!localStorage.getItem("sAddr"),ne.checkout.billingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedBillingAddressIdChange(e.id||"-1"),void ne.setCheckoutBillingAddressSettings()}ne.checkout.billingAddress=new Y(n(ne.checkout.billingAddress)||{}),ne.setCheckoutBillingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())}else ne.onSelectedBillingAddressIdChange("-1"),ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(ne,void 0,void 0,(function(){var e,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),[4,D.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(s=e.data,n=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===q.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.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,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,5];case 2:t.sent(),t.label=3;case 3:return s?(r=this.checkout,this.checkout=new k(i(i({},s),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==q.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,5];case 4:t.sent(),t.label=5;case 5:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(ne,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),[4,D.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.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===q.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),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,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,5];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==q.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,5];case 4:t.sent(),t.label=5;case 5:return[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Z.getAvailableShippingZones({salesChannelId:B.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(ne.selectedShippingAddressId=e,"-1"===e)ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.shippingAddress=new Y(i),ne.checkout.shippingAddress.countrySettings=ne.countrySettings)}ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ne.selectedBillingAddressId=e,"-1"===e)ne.checkout.billingAddress=new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.billingAddress=new Y(i),ne.checkout.billingAddress.countrySettings=ne.countrySettings)}ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ne.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.cardNumber.length)||J(e))){var i=(ne.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!ne.installmentInfo?ne.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(ne.cardData.installmentCount=1,ne.installmentInfo=void 0),(null===(t=ne.installmentInfo)||void 0===t?void 0:t.cardAssociation)===_.AMERICAN_EXPRESS?ne.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}(s).join(" "):ne.cardData.cardNumber=$(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){ne.cardData&&(ne.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.expirationDate.length)||J(e))){if(0===(null===(t=ne.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(ne.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(ne.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(ne.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ne.cardData.expirationDate=$(d,2).join(" / "))}},this.onCvcChange=function(e){if(ne.cardData&&(!(e.length>ne.cardData.cvv.length)||J(e))){if(ne.installmentInfo){if(ne.installmentInfo.cardAssociation===_.AMERICAN_EXPRESS&&e.length>4)return;if(ne.installmentInfo.cardAssociation!==_.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ne.cardData.cvv=e}},this.saveAddress=function(s){return e(ne,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new P(i(i({},e),{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:t.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"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){ne.router.push("/cart")},this.onBackToShoppingClick=function(){ne.router.push("/")},this.onGoToLoginClick=function(){ne.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0: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=1;case 1:return t.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:t.sent(),t.label=3;case 3:return[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(q.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(q.SHIPPING):this.changeStep(q.PAYMENT),[3,7]);case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ne,void 0,void 0,(function(){var e;return t(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.changeStep(q.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ne,void 0,void 0,(function(){var e;return t(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(q.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ne.canPerformPayment||(ne.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ne.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.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 t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6:return t.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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.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 t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return t.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),[4,this.saveCart()];case 4:return t.sent(),this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return t.sent(),[3,7];case 6:return(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,f,g,v,y,S,k,b,P;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(c=this.mpVM.selectedCard)||void 0===c?void 0:c.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(d=this.cardData)||void 0===d?void 0:d.installmentCount)?[2]:[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(h=this.mpVM.selectedCard)||void 0===h?void 0:h.Name},paymentGatewayId:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.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===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:H("_fbp"),_fbc:H("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(v=this.checkout.selectedPaymentGateway)||void 0===v?void 0:v.id,paymentMethodDetail:this.isFree||i?void 0:(null===(y=this.checkout.selectedPaymentGateway)||void 0===y?void 0:y.paymentMethodType)===u.CREDIT_CARD&&(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:H("_fbp"),_fbc:H("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(k=null==s?void 0:s.data)||void 0===k?void 0:k.transactionStatus,o=r&&[m.SUCCESS,m.AUTHORIZED].includes(r),a=r===m.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(b=null==s?void 0:s.data)||void 0===b?void 0:b.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.returnSlug))throw{data:s.firstErrorMessage,type:W.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(ne,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.changeStep(q.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ne.changeStep(q.INFO)},this.onBackToShippingClick=function(){ne.changeStep(q.SHIPPING)},this.setCustomerConsentGranted=function(e){ne.checkout.customer&&(ne.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){ne.useDifferentAddress=e,ne.useDifferentAddress?(localStorage.setItem("sAddr","1"),ne.checkout.billingAddress=ne.checkout.billingAddress||new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings):(localStorage.removeItem("sAddr"),ne.checkout.billingAddress=new Y(i({},ne.checkout.shippingAddress)))},this.setShouldSaveAddress=function(e){ne.shouldSaveAddress=e},this.setAddressTitle=function(e){ne.addressTitle=e},this.reInitPaymentMethod=function(){return e(ne,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,6];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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(ne,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==q.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return this.checkout.selectedPaymentGateway=e,this.step!==q.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new N,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ne,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,D.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},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){ne.cardData&&(ne.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return z||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ne,void 0,void 0,(function(){return t(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){ne.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ne,void 0,void 0,(function(){var r,o,a=this;return t(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===f.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 e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,x.searchProducts({input:{productIdList:n,priceListId:B.getPriceListId(),salesChannelId:B.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.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(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===y.AMOUNT&&(s=!0),new E(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===S.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,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 e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===q.SUCCESS?g.POST_CHECKOUT:g.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ne,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,D.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===q.SUCCESS?q.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(ne,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.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,T.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(ne,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,T.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.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""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=C,this.returnPolicy=I,this.privacyPolicy=Q,this.termsOfService=X,this.imprint=ee,this.shippingPolicy=te,this.t=ie,this.customizationProps=se,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new O({currentLocale:B.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(Q.prototype,"merchantSettings",{get:function(){return new I(B.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.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(Q.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=F.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(Q.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(Q.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(Q.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-(this.checkout.totalFinalPrice-this.giftCardTotalPrice)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"finalPrice",{get:function(){return this.step===q.SUCCESS?this.checkout.totalFinalPrice-this.giftCardTotalPrice:this.installmentPrice?this.installmentPrice:this.checkout.totalFinalPrice-this.giftCardTotalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===W.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly?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)!==W.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.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(Q.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"store",{get:function(){return F.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)===u.CREDIT_CARD&&i.type===l.INTERNAL?!!this.isCustomFlowStripe||(!(!this.isKlarna&&!this.isPayPal)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=B.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.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(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEPayKolayEnabled",{get:function(){var e=B.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPoweredByHidden",{get:function(){var e=B.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),Q.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},Q}();function $(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function J(e){return e&&Q.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(q||(q={})),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"}(W||(W={}));export{q as CheckoutStep,W as ErrorType,X as default};
1
+ import{__awaiter as e,__generator as t,__assign 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{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderStatus as p,IkasOrderPaymentStatus as m,IkasTransactionStatus as g,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as v,IkasOrderLineItemStatus as y,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 A}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 I}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 O}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 w}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-filter/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 j from"../../store/customer/api.js";import M 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,CampaignOfferTargetPageTypeEnum as B}from"@ikas/storefront-api";import{IkasBaseStore as H}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as Y}from"@ikas/storefront-config";import{Analytics as K}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Z from"../../models/data/order/address/ikas-localized-order-address.js";import W from"../../store/location/index.js";import{isEqual as q,getCookieValue as Q}from"../../utils/helper.js";import z from"../../analytics/ikasV3.js";var X,J,$=/^\d+$/,ee="undefined"==typeof localStorage,te=function(){function $(a,d,p,C,I,$,te,ne,re,oe){var ae=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=X.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],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.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.storeCreditBalance=null,this.showTestModal=!1,this.openEditOrderTransaction=null,this.previousRawValue="",this.previousBin=null,this.init=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,H.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 e(ae,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(Y.getIsEditor())return this.step=X.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===X.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(X.INFO)];if(this.step!==X.PAYMENT||this.canProceedToPayment){if(this.step===X.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(X.INFO)];if(![X.INFO,X.SUCCESS,X.SHIPPING,X.PAYMENT].includes(this.step))return[2,this.changeStep(X.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings||this.isManualOrderWithoutShippingLines?[2,this.changeStep(X.INFO)]:[2,this.changeStep(X.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),this.step!==X.SHIPPING&&this.step!==X.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new P(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==X.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==X.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=X.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==X.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==X.SUCCESS||this.checkout.orderPaymentStatus!==m.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:J.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==X.PAYMENT&&this.step!==X.SUCCESS?[3,15]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.checkout.hasCustomer?[4,this.getStoreCreditBalance()]:[3,12];case 11:t.sent(),t.label=12;case 12:return this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,14];case 13:t.sent(),t.label=14;case 14:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:J.NO_SHIPPING_ERROR},this.isMinTransactionError&&(this.error={type:J.API_ERROR,data:this.t("checkout-page:minTransactionErrorMessage",{value:200})}),this.isCheckoutLoaded=!0,[2];t.label=15;case 15:return this.step===X.SUCCESS?[3,19]:this.isOpenEditOrder?[3,18]:this.checkout.isComplete?[2,this.changeStep(X.SUCCESS)]:[3,16];case 16:return[4,this.initialStockCheck()];case 17:t.sent(),t.label=18;case 18:return[3,21];case 19:return[4,this.getSuccessTransaction()];case 20:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=21;case 21:return n&&(this.error={type:J.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,K.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getOpenEditOrderTransaction=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,j.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 e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.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 e(ae,void 0,void 0,(function(){var e,i,s,n,r,a,c,d,u,l,h,p,m,g,f,v,y;return t(this,(function(t){switch(t.label){case 0:return e=new F(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return console.log("input 1",e),console.log("this.checkout",this.checkout),this.step!==X.INFO&&this.step!==X.SHIPPING&&this.step!==X.PAYMENT||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||this.step===X.PAYMENT||(e.billingAddress=null),e.billingAddress&&(this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress||this.useDifferentAddress&&!this.isShowBillingAddressOnShippingStep&&this.checkoutSettings.showCompanyInfoInShippingAddress)&&(console.log("input.billingAddress 1",e.billingAddress),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===(a=e.shippingAddress)||void 0===a?void 0:a.taxOffice)||null)),console.log("input.billingAddress 2",e.billingAddress),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),null===(null===(d=null===(c=e.shippingAddress)||void 0===c?void 0:c.city)||void 0===d?void 0:d.code)&&""===(null===(l=null===(u=e.shippingAddress)||void 0===u?void 0:u.city)||void 0===l?void 0:l.name)&&(e.shippingAddress.city.name="-"),null===(null===(p=null===(h=e.billingAddress)||void 0===h?void 0:h.city)||void 0===p?void 0:p.code)&&""===(null===(g=null===(m=e.billingAddress)||void 0===m?void 0:m.city)||void 0===g?void 0:g.name)&&(e.billingAddress.city.name="-"),[4,L.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(f=s.extensions)||void 0===f?void 0:f.code)?{type:J.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(v=s.extensions)||void 0===v?void 0:v.code)?{type:J.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(y=s.extensions)||void 0===y?void 0:y.code)?{type:J.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:J.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ae,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p,m,g;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder||this.isOpenEditOrderWithTransaction?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(p=Y.getStockLocationIds())||void 0===p?void 0:p.length)?Y.getStockLocationIds():null,[4,M.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw s="UPSELL"===this.checkout.createdBy,n=s?this.t("checkout-page:upsellTimeErrorMessage"):i.firstErrorMessage,{type:J.API_ERROR,data:n};if(null==(r=null===(g=null===(m=i.data)||void 0===m?void 0:m.lines)||void 0===g?void 0:g.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++)l=u[d],a(l);throw{type:J.STOCK_ERROR,data:o}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,H.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.getAvailableShippingCountries({salesChannelId:Y.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return Y.getPickupStockLocationIds()?[4,M.listStockLocation({id:{in:Y.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:J.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return Y.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,M.getAvailableStockLocations({lines:e.map((function(e){return new U(e)})),stockLocationIdList:Y.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:J.API_ERROR},[2];s=Y.getCurrentRouting(),this.availableStockLocations=(i.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))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=ae.shippingCountryIds)||void 0===e?void 0:e.length)||(ae.error={type:J.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ae.deliveryMethod!==e&&("address"===e&&(ae.checkout.stockLocationId=null,(null===(t=ae.customerAddresses)||void 0===t?void 0:t.length)?ae.onSelectedShippingAddressIdChange(ae.customerAddresses[0].id||"-1"):(ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)),ae.deliveryMethod=e,ae.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ae,void 0,void 0,(function(){var e;return t(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:J.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.getStoreCreditBalance=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.getStoreCreditBalance()];case 1:return e=t.sent(),this.storeCreditBalance=e.data,[2]}}))}))},this.listPaymentGateways=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,g,f,v=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=Y.getPaymentGateways().map((function(e){return e.id})),[4,M.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:Y.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(p=s.data)||void 0===p?void 0:p.length)||this.isFree?(this.error=void 0,n=null===(m=s.data)||void 0===m?void 0:m.some((function(e){return"IKAS_WALLET"===e.code})),this.isMinTransactionError=n&&this.finalPrice<200&&!this.isDigitalOnly,this.isMinTransactionError?[2]:(o=s.data||[],this.step===X.PAYMENT&&(o=o.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(v.checkout.currencyCode)})),(a=null===(g=this.checkout.shippingAddress)||void 0===g?void 0:g.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===(f=this.checkout.billingAddress)||void 0===f?void 0:f.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(Y.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=v.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==u?u:0),[3,4]))):(this.error={type:J.NO_SHIPPING_ERROR},[2]):(this.error={type:J.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==X.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===X.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(){v.mpVM.checkMasterPass({checkout:v.checkout,store:H.getInstance()})},document.head.appendChild(h)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,M.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.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 e;ae.store.customerStore.customer?(null===(e=ae.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ae.checkoutSettings,e.shippingZones=ae.shippingZones})),ae.checkout.customer=new O(i(i({},ae.store.customerStore.customer),{notificationsAccepted:ae.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ae.checkout.customer=new O(ae.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones,ae.checkout.billingAddress.countrySettings=ae.countrySettings,ae.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ae.isDigitalOnly)if(ae.isInStoreDelivery)ae.setCheckoutShippingAddressSettings();else if(ae.checkout.shippingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedShippingAddressIdChange(e.id||"-1"),void ae.setCheckoutShippingAddressSettings()}ae.checkout.shippingAddress=new Z(n(ae.checkout.shippingAddress)||{}),ae.setCheckoutShippingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ae.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ae.useDifferentAddress=!!localStorage.getItem("sAddr"),ae.checkout.billingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedBillingAddressIdChange(e.id||"-1"),void ae.setCheckoutBillingAddressSettings()}ae.checkout.billingAddress=new Z(n(ae.checkout.billingAddress)||{}),ae.setCheckoutBillingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())}else ae.onSelectedBillingAddressIdChange("-1"),ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(s){return e(ae,void 0,void 0,(function(){var e,n,r,o,a,c;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,L.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.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===X.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),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,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(o=this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT||this.checkout.totalFinalPrice===o.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,s?K.addCouponCode(n):K.removeCouponCode(n),t.label=7;case 7:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(ae,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,L.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.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===X.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),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,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeLoyaltyPointsFromCart=function(s){return e(ae,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,L.removeLoyaltyPointsFromCart({cartId:this.checkout.id,loyaltySpendingMethodId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.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===X.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),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,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,K.removeLoyaltyPoints(n),t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,W.getAvailableShippingZones({salesChannelId:Y.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(ae.selectedShippingAddressId=e,"-1"===e)ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.shippingAddress=new Z(i),ae.checkout.shippingAddress.countrySettings=ae.countrySettings)}ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ae.selectedBillingAddressId=e,"-1"===e)ae.checkout.billingAddress=new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.billingAddress=new Z(i),ae.checkout.billingAddress.countrySettings=ae.countrySettings)}ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ae.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ae.cardData){var i=(e||"").replace(/\D/g,""),s=ae.previousRawValue,n=i.slice(0,6),r=ae.previousBin;if(!(i.length>16)){var o=s.length<6&&i.length>=6,a=6===n.length&&n!==r;(o||a)&&6===n.length&&(ae.getRetrieveInstallmentInfo(i),ae.previousBin=n),i.length<6&&s.length>=6&&(ae.cardData.installmentCount=1,ae.installmentInfo=void 0,ae.previousBin=null),(null===(t=ae.installmentInfo)||void 0===t?void 0:t.cardAssociation)===V.AMERICAN_EXPRESS?ae.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}(i).join(" "):ae.cardData.cardNumber=ie(i,4).join(" "),ae.previousRawValue=i}}},this.getRetrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){ae.cardData&&(ae.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ae.cardData&&(!(e.length>ae.cardData.expirationDate.length)||se(e))){if(0===(null===(t=ae.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(ae.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(ae.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(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ae.cardData.expirationDate=ie(d,2).join(" / "))}},this.onCvcChange=function(e){if(ae.cardData&&(!(e.length>ae.cardData.cvv.length)||se(e))){if(ae.installmentInfo){if(ae.installmentInfo.cardAssociation===V.AMERICAN_EXPRESS&&e.length>4)return;if(ae.installmentInfo.cardAssociation!==V.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ae.cardData.cvv=e}},this.saveAddress=function(s){return e(ae,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,g,f=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new A(i(i({},e),{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:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=f.checkoutSettings,e.shippingZones=f.shippingZones})),c=null===(g=this.customerAddresses)||void 0===g?void 0:g.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"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.getRoutingPath=function(){var e=Y.getCurrentRouting();return(null==e?void 0:e.path)?"/".concat(e.path):""},this.getGoToCartHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/cart")},this.getBackToShoppingHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/")},this.getGoToLoginHref=function(){var e=ae.getRoutingPath();return"".concat(e)+"/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)},this.onHandleBillingAddressOnShippingStep=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new Z(i({},this.checkout.shippingAddress)):this.checkout.billingAddress=new Z(i({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(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?[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(X.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(X.SHIPPING):this.changeStep(X.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(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(X.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(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(X.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ae.canPerformPayment||(ae.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ae.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c;return t(this,(function(t){switch(t.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 t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(o=this.hepsipayFrameInitResponse)||void 0===o?void 0:o.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,15,,16]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,12];case 11:t.sent(),t.label=12;case 12:return[4,this.saveCart()];case 13:return e=t.sent(),this.checkout.shippingMethod===h.SHIPMENT&&(i=null!==(a=null==e?void 0:e.availableShippingMethods)&&void 0!==a?a:[],s=null!==(c=this.checkout.availableShippingMethods)&&void 0!==c?c:[],!q(i,s))?(this.changeStep(X.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 14:return t.sent(),[3,16];case 15:return void 0!==typeof(r=t.sent()).type?this.error=r:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,16];case 16:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.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 t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.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 t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,13,,14]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),[4,this.saveCart()];case 11:return t.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 t.sent(),[3,14];case 13:return(i=t.sent()).type?this.error=i:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,14];case 14:return[2]}}))}))},this.createSaleTransaction=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,m,f,v,y,S,b,k,P,A,C,I;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,M.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.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===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,M.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(v=this.mpVM.selectedCard)||void 0===v?void 0:v.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(y=this.checkout.selectedPaymentGateway)||void 0===y?void 0:y.id,paymentMethodDetail:this.isFree||i?void 0:(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.paymentMethodType)===u.CREDIT_CARD&&(null===(b=this.checkout.selectedPaymentGateway)||void 0===b?void 0:b.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(k=null==s?void 0:s.data)||void 0===k?void 0:k.transactionStatus,o=r&&[g.SUCCESS,g.AUTHORIZED].includes(r),a=r===g.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(A=null==s?void 0:s.data)||void 0===A?void 0:A.returnSlug))throw c=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(I=null===(C=s.data)||void 0===C?void 0:C.error)||void 0===I?void 0:I.code)&&(c=this.t("checkout-page:errorContactStore")),{data:c,type:J.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return z.refreshJourneyId(),this.changeStep(X.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ae.changeStep(X.INFO)},this.onBackToShippingClick=function(){ae.changeStep(X.SHIPPING)},this.setCustomerConsentGranted=function(e){ae.checkout.customer&&(ae.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e,t){var s;ae.useDifferentAddress=e,ae.useDifferentAddress?(localStorage.setItem("sAddr","1"),ae.checkout.billingAddress=ae.checkout.billingAddress||new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings):(localStorage.removeItem("sAddr"),ae.checkout.billingAddress=new Z(i({},ae.checkout.shippingAddress)),ae.store.customerStore.customer&&(null===(s=ae.customerAddresses)||void 0===s?void 0:s.length)&&t&&ae.isShowBillingAddressOnShippingStep&&ae.onSelectedBillingAddressIdChange(ae.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){ae.shouldSaveAddress=e},this.setAddressTitle=function(e){ae.addressTitle=e},this.reInitPaymentMethod=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,8];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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.hepsipayFrameInit=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,M.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.hepsipayFrameInitResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==X.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return"HEPSIPAY"!==e.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(e)];case 16:t.sent(),t.label=17;case 17:return this.checkout.selectedPaymentGateway=e,this.step!==X.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new T,this.previousRawValue="",this.previousBin=null,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ae,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,L.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id,targetPageType:B.CHECKOUT})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},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){ae.cardData&&(ae.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return ee||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ae,void 0,void 0,(function(){return t(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){ae.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ae,void 0,void 0,(function(){var r,o,a=this;return t(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===f.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 e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,_.searchProducts({input:{productIdList:n,priceListId:Y.getPriceListId(),salesChannelId:Y.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.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(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===S.AMOUNT&&(s=!0),new E(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===b.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,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 e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===X.SUCCESS?v.POST_CHECKOUT:v.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,L.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===X.SUCCESS?X.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==y.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,M.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,M.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.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""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=p,this.returnPolicy=C,this.privacyPolicy=I,this.termsOfService=$,this.imprint=te,this.shippingPolicy=ne,this.t=re,this.customizationProps=oe,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new N({currentLocale:Y.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty($.prototype,"merchantSettings",{get:function(){return new I(Y.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.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($.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=H.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($.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($.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($.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($.prototype,"finalPrice",{get:function(){if(this.step===X.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($.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===J.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty($.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)!==J.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.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($.prototype,"isManualOrderWithoutShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.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($.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.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($.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"store",{get:function(){return H.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty($.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)===u.CREDIT_CARD&&i.type===l.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($.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=Y.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.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(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrder",{get:function(){return this.checkout.status===p.OPEN&&!!this.checkout.orderNumber},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrderWithTransaction",{get:function(){var e,t;return this.checkout.status===p.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($.prototype,"isEPayKolayEnabled",{get:function(){var e=Y.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPoweredByHidden",{get:function(){var e=Y.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),$.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},$}();function ie(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function se(e){return e&&$.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(X||(X={})),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"}(J||(J={}));export{X as CheckoutStep,J as ErrorType,te as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{FormItem as o}from"../../components/form-item/index.js";import{FormItemType as i,FormItemInputMode as r}from"../../components/form-item/model.js";import{Button as n}from"../../components/button/index.js";import{Checkbox as c}from"../../components/checkbox/index.js";import m from"../../components/error/index.js";import s from"../../styles/common.module.scss.js";import a from"../../components/customer-addresses/index.js";import l from"../../components/customer-addresses/model.js";import"@ikas/storefront-config";import{useTranslation as u}from"../../../../utils/i18n.js";var p=t((function(t){var p,d,h=t.vm,g=u().t,f=e.useCallback((function(e){h.checkout.customer&&(h.checkout.customer.email=e?e.trim():e)}),[h,h.checkout,h.checkout.customer]),k=e.useMemo((function(){return h.isDigitalOnly?new l(h,"billing"):new l(h,"shipping")}),[h]);return e.createElement("div",null,e.createElement(m,{vm:h}),!h.checkout.hasCustomer&&e.createElement("div",{style:{marginTop:"8px",marginBottom:"40px"}},e.createElement("div",{className:s.FormSectionTitle},e.createElement("div",{className:s.Title},g("checkout-page:contactInfo"))),e.createElement(o,{type:i.TEXT,inputMode:r.EMAIL,label:g("checkout-page:email"),autocomplete:"email",value:(null===(p=h.checkout.customer)||void 0===p?void 0:p.email)||"",onChange:f,hasError:h.isErrorsVisible&&!h.checkout.hasValidCustomerEmail,errorText:g("checkout-page:emailError"),tooltipText:g("checkout-page:guestEmailTooltip")}),e.createElement(c,{value:(null===(d=h.checkout.customer)||void 0===d?void 0:d.notificationsAccepted)||!1,label:g("checkout-page:customerConsentCta"),onChange:h.setCustomerConsentGranted})),e.createElement(a,{vm:k}),!k.editingCustomerAddress&&e.createElement(n,{style:{width:"100%",marginTop:h.store.customerStore.customer?"0px":"32px"},text:"address"!==h.deliveryMethod||h.isDigitalOnly?g("checkout-page:actions.continueWithPayment"):g("checkout-page:actions.continueWithShipping"),isLoading:h.isStepLoading,onClick:h.isDigitalOnly?h.onProceedToDigitalOnlyPaymentClick:h.onProceedToShippingClick}))}));export{p as default};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{FormItem as o}from"../../components/form-item/index.js";import{FormItemType as i,FormItemInputMode as n}from"../../components/form-item/model.js";import{Button as s}from"../../components/button/index.js";import{Checkbox as r}from"../../components/checkbox/index.js";import c from"../../components/error/index.js";import m from"../../styles/common.module.scss.js";import l from"../../components/customer-addresses/index.js";import a from"../../components/customer-addresses/model.js";import"@ikas/storefront-config";import{useTranslation as p}from"../../../../utils/i18n.js";var d=t((function(t){var d,u,h=t.vm,g=p().t,f=e.useCallback((function(e){h.checkout.customer&&(h.checkout.customer.email=e?e.trim():e)}),[h,h.checkout,h.checkout.customer]),k=e.useMemo((function(){return h.isDigitalOnly?new a(h,"billing"):new a(h,"shipping")}),[h]),v=e.useCallback((function(e){e.preventDefault(),h.isStepLoading||k.editingCustomerAddress||(h.isDigitalOnly?h.onProceedToDigitalOnlyPaymentClick():h.onProceedToShippingClick())}),[h,k.editingCustomerAddress]);return e.createElement("form",{onSubmit:v,autoComplete:"on"},e.createElement(c,{vm:h}),!h.checkout.hasCustomer&&e.createElement("div",{style:{marginTop:"8px",marginBottom:"40px"}},e.createElement("div",{className:m.FormSectionTitle},e.createElement("div",{className:m.Title},g("checkout-page:contactInfo"))),e.createElement(o,{name:"email",type:i.TEXT,inputMode:n.EMAIL,label:g("checkout-page:email"),autocomplete:"shipping email",value:(null===(d=h.checkout.customer)||void 0===d?void 0:d.email)||"",onChange:f,hasError:h.isErrorsVisible&&!h.checkout.hasValidCustomerEmail,errorText:g("checkout-page:emailError"),tooltipText:g("checkout-page:guestEmailTooltip"),autocapitalize:"off",autocorrect:"off",spellcheck:"false"}),e.createElement(r,{value:(null===(u=h.checkout.customer)||void 0===u?void 0:u.notificationsAccepted)||!1,label:g("checkout-page:customerConsentCta"),onChange:h.setCustomerConsentGranted})),e.createElement(l,{vm:k}),h.isShowBillingAddressOnShippingStep&&"address"===h.deliveryMethod&&!h.isDigitalOnly&&e.createElement(r,{value:!h.useDifferentAddress,hasError:h.isErrorsVisible&&!h.isTermsAndConditionsChecked,label:g("checkout-page:useShippingForBilling"),onChange:function(e){return h.setUseDifferentAddress(!e,!0)}}),h.isShowBillingAddressOnShippingStep&&(h.useDifferentAddress||"in-store"===h.deliveryMethod)&&e.createElement(l,{vm:new a(h,"billing"),showBillingAddressOnShippingStep:!0}),!k.editingCustomerAddress&&e.createElement(s,{type:"submit",style:{width:"100%",marginTop:h.store.customerStore.customer&&!h.isShowBillingAddressOnShippingStep?"0px":"32px"},text:"address"!==h.deliveryMethod||h.isDigitalOnly?g("checkout-page:actions.continueWithPayment"):g("checkout-page:actions.continueWithShipping"),isLoading:h.isStepLoading}))}));export{d as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as r}from"mobx-react-lite";import{Checkbox as t}from"../../../components/checkbox/index.js";import s from"../../../components/customer-addresses/model.js";import o from"../../../components/customer-addresses/index.js";import"@ikas/storefront-config";import{useTranslation as i}from"../../../../../utils/i18n.js";var n=r((function(r){var n=r.vm,m=i().t,d=e.useMemo((function(){return new s(n,"billing")}),[n]);return e.useEffect((function(){"in-store"===n.deliveryMethod&&n.setUseDifferentAddress(!0)}),[n]),e.createElement(e.Fragment,null,e.createElement("div",{style:{marginTop:"32px",marginBottom:n.useDifferentAddress?"24px":"0px"}},"address"===n.deliveryMethod&&!n.isDigitalOnly&&n.isCorporateInvoiceVisible&&e.createElement(t,{value:!n.useDifferentAddress,hasError:n.isErrorsVisible&&!n.isTermsAndConditionsChecked,label:m("checkout-page:useShippingForBilling"),onChange:function(e){return n.setUseDifferentAddress(!e)}})),n.useDifferentAddress&&e.createElement(o,{vm:d}))}));export{n as BillingAddress};
1
+ import*as e from"react";import{observer as r}from"mobx-react-lite";import{Checkbox as s}from"../../../components/checkbox/index.js";import i from"../../../components/customer-addresses/model.js";import t from"../../../components/customer-addresses/index.js";import"@ikas/storefront-config";import{useTranslation as n}from"../../../../../utils/i18n.js";var o=r((function(r){var o=r.vm,m=n().t,d=e.useMemo((function(){return new i(o,"billing")}),[o]);return e.useEffect((function(){"in-store"===o.deliveryMethod&&o.setUseDifferentAddress(!0)}),[o]),e.createElement(e.Fragment,null,e.createElement("div",{style:{marginTop:"32px",marginBottom:o.useDifferentAddress?"24px":"0px"}},"address"===o.deliveryMethod&&!o.isDigitalOnly&&o.isCorporateInvoiceVisible&&!o.isShowBillingAddressOnShippingStep&&e.createElement(s,{value:!o.useDifferentAddress,hasError:o.isErrorsVisible&&!o.isTermsAndConditionsChecked,label:m("checkout-page:useShippingForBilling"),onChange:function(e){return o.setUseDifferentAddress(!e)}})),o.useDifferentAddress&&!o.isShowBillingAddressOnShippingStep&&e.createElement(t,{vm:d}))}));export{o as BillingAddress};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import{Checkbox as i}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 c}from"../../components/button/index.js";import s from"../../components/master-pass/link-card-to-client/index.js";import{PayPal as l}from"../../components/paypal/index.js";import m from"../../components/notification-box/index.js";import{createTranslationInputData as p,useTranslation as d}from"../../../../utils/i18n.js";import u from"../../components/svg/lock.js";import y from"./style.module.scss.js";var k=t((function(t){var k=t.vm,f=d().t,g=e.useCallback((function(e){e.stopPropagation(),k.policyModalTitle=f("checkout-page:privacyPolicy"),k.policyModalText=k.privacyPolicy}),[k,k.privacyPolicy]),v=e.useCallback((function(e){e.stopPropagation(),k.policyModalTitle=f("checkout-page:termsOfService"),k.policyModalText=k.termsOfService}),[k,k.termsOfService]),C=o.getTranslations()["checkout-page"],P=p(C.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[y.TermsLabelSpan,k.isErrorsVisible&&!k.isTermsAndConditionsChecked?y.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?g:v},"{{ ackPrivacyPolicy }}"===t.value?f("checkout-page:ackPrivacyPolicy"):f("checkout-page:ackTermsOfService")):t.value}));return e.createElement("div",{className:[y.StepPayment,k.isPaymentMethodVisible?"":y.Disabled].join(" ")},e.createElement(n,{vm:k}),k.isFree&&e.createElement(m,{type:"success",content:f("checkout-page:freeOrderDescription")}),!k.isFree&&e.createElement(e.Fragment,null,k.mpVM.isLinkCardToClientVisible&&e.createElement(s,{vm:k}),e.createElement(r,{vm:k})),e.createElement(a,{vm:k}),k.checkoutSettings.showTermsAndConditionsCheckbox&&e.createElement("div",{style:{marginTop:k.useDifferentAddress?"12px":"0px"}},e.createElement(i,{value:k.isTermsAndConditionsChecked,hasError:k.isErrorsVisible&&!k.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,P),onChange:k.onTermsAndConditionsCheckedChange})),!k.isFree&&k.isPayPal?e.createElement("div",{className:y.PayPalContainer},e.createElement(l,{vm:k})):e.createElement(c,{style:{width:"100%",marginTop:"24px"},text:f("checkout-page:actions.completeOrder"),isLoading:k.isStepLoading,onClick:k.isDigitalOnly?k.onCompleteDigitalOnlyPaymentClick:k.onCompletePaymentClick}),!!f("checkout-page:securePaymentTooltip")&&e.createElement("div",{className:y.SecurePaymentContainer},e.createElement("span",{className:y.Lock},e.createElement(u,null)),e.createElement("span",null,f("checkout-page:securePaymentTooltip"))))}));export{k as CheckoutStepPayment};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import{Checkbox as i}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 c}from"../../components/button/index.js";import s 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";var f=t((function(t){var f=t.vm,g=d().t,v=e.useCallback((function(e){e.stopPropagation(),f.policyModalTitle=g("checkout-page:privacyPolicy"),f.policyModalText=f.privacyPolicy}),[f,f.privacyPolicy]),C=e.useCallback((function(e){e.stopPropagation(),f.policyModalTitle=g("checkout-page:termsOfService"),f.policyModalText=f.termsOfService}),[f,f.termsOfService]),E=o.getTranslations()["checkout-page"],P=p(E.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[u.TermsLabelSpan,f.isErrorsVisible&&!f.isTermsAndConditionsChecked?u.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?v:C},"{{ ackPrivacyPolicy }}"===t.value?g("checkout-page:ackPrivacyPolicy"):g("checkout-page:ackTermsOfService")):t.value}));return e.createElement("div",{className:[u.StepPayment,f.isPaymentMethodVisible?"":u.Disabled].join(" ")},e.createElement(n,{vm:f}),e.createElement(k,{vm:f}),f.isFree&&e.createElement(l,{type:"success",content:g("checkout-page:freeOrderDescription")}),!f.isFree&&e.createElement(e.Fragment,null,f.mpVM.isLinkCardToClientVisible&&e.createElement(s,{vm:f}),e.createElement(r,{vm:f})),e.createElement(a,{vm:f}),f.checkoutSettings.showTermsAndConditionsCheckbox&&e.createElement("div",{style:{marginTop:f.useDifferentAddress?"12px":"0px"}},e.createElement(i,{value:f.isTermsAndConditionsChecked,hasError:f.isErrorsVisible&&!f.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,P),onChange:f.onTermsAndConditionsCheckedChange})),!f.isFree&&f.isPayPal?e.createElement("div",{className:u.PayPalContainer},e.createElement(m,{vm:f})):e.createElement(c,{style:{width:"100%",marginTop:"24px"},text:g("checkout-page:actions.completeOrder"),isLoading:f.isStepLoading,onClick:f.isDigitalOnly?f.onCompleteDigitalOnlyPaymentClick:f.onCompletePaymentClick}),!!g("checkout-page:securePaymentTooltip")&&e.createElement("div",{className:u.SecurePaymentContainer},e.createElement("span",{className:u.Lock},e.createElement(y,null)),e.createElement("span",null,g("checkout-page:securePaymentTooltip"))))}));export{f as CheckoutStepPayment};