@ikas/storefront 6.1.0-beta.3 → 6.1.0-beta.31

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.
@@ -124,13 +124,18 @@ interface CustomerDetail {
124
124
  export default class IkasAnalytics {
125
125
  static SESSION_ID_KEY: string;
126
126
  static VISITOR_ID_KEY: string;
127
+ static JOURNEY_ID_KEY: string;
127
128
  static EXPIRY_LENGTH: number;
128
129
  static sessionId?: string | null;
129
130
  static visitorId?: string | null;
131
+ static journeyId?: string | null;
130
132
  static createUUID(): Promise<string>;
131
133
  static createSessionId(): Promise<void>;
134
+ static createJourneyId(): Promise<void>;
132
135
  static checkSessionId(): Promise<void>;
136
+ static checkJourneyId(): Promise<void>;
133
137
  static checkVisitorId(): Promise<void>;
138
+ static refreshJourneyId(): void;
134
139
  static getPageType(pageType: IkasThemeJsonPageType): StorefrontEventPageType | undefined;
135
140
  static getCustomerData(): {
136
141
  id: string | undefined;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-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"@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{getCookieValue as n}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/generate-id/1"))];case 1:return[4,t.sent().json()];case 2:return[2,t.sent().data[0]]}}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.getPageType=function(t){switch(t){case o.INDEX:return d.INDEX;case o.CATEGORY:return d.CATEGORY;case o.BRAND:return d.BRAND;case o.PRODUCT:return d.PRODUCT;case o.CUSTOM:return d.CUSTOM;case o.ACCOUNT:return d.ACCOUNT;case o.ADDRESSES:return d.ADDRESSES;case o.ORDERS:return d.ORDERS;case o.ORDER_DETAIL:return d.ORDER_DETAIL;case o.LOGIN:return d.LOGIN;case o.REGISTER:return d.REGISTER;case o.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case o.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case o.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case o.CART:return d.CART;case o.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case o.SEARCH:return d.SEARCH;case o.NOT_FOUND:return d.NOT_FOUND;case o.BLOG:return d.BLOG;case o.BLOG_INDEX:return d.BLOG_INDEX;case o.BLOG_CATEGORY:return d.BLOG_CATEGORY;case o.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:n("_fbp"),fbc:n("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(o){var n,a,d,u,m,l,p,E,v;return t(this,void 0,void 0,(function(){var t,h,C;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),h={e:o,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(n=t.customerStore.customer)||void 0===n?void 0:n.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName)?{fn:null===(v=t.customerStore.customer)||void 0===v?void 0:v.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(h),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 4:return e.sent(),[3,6];case 5:return C=e.sent(),console.error(C),[3,6];case 6:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return t=i.categories&&i.categories.length>0?i.categories[0].path.map((function(t){return t.name})):[],o={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})}})},[4,this.sendEvents([o])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,o,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:o.id,c:o.currencyCode,pr:o.totalFinalPrice,il:this.getOrderLineItem(o)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},o?{r:o}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{IkasBaseStore as s}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-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"@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{getCookieValue as o}from"../utils/helper.js";var a,d;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(a||(a={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT",t[t.ACTIVATE_CUSTOMER=21]="ACTIVATE_CUSTOMER"}(d||(d={}));var c=process.env.NEXT_PUBLIC_ANALYTICS_URL?"".concat(process.env.NEXT_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",u=function(){function u(){}return u.createUUID=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/generate-id/1"))];case 1:return[4,t.sent().json()];case 2:return[2,t.sent().data[0]]}}))}))},u.createSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),i={},[4,this.createUUID()];case 1:return i.id=e.sent(),i.expiry=Date.now()+this.EXPIRY_LENGTH,t=i,localStorage.setItem(this.SESSION_ID_KEY,JSON.stringify(t)),this.sessionId=t.id,[4,this.sessionStart()];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},u.createJourneyId=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.createUUID()];case 1:return t=e.sent(),localStorage.setItem(this.JOURNEY_ID_KEY,t),this.journeyId=t,[2]}}))}))},u.checkSessionId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(this.SESSION_ID_KEY))?(r=JSON.parse(t)).expiry<Date.now()||r.id.length<=13?[4,this.createSessionId()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:this.sessionId=r.id,e.label=3;case 3:return[3,6];case 4:return[4,this.createSessionId()];case 5:e.sent(),e.label=6;case 6:return i.init({sessionId:this.sessionId||""}),[3,8];case 7:return s=e.sent(),console.error(s),[3,8];case 8:return[2]}}))}))},u.checkJourneyId=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.JOURNEY_ID_KEY))?(this.journeyId=t,[3,3]):[3,1];case 1:return[4,this.createJourneyId()];case 2:e.sent(),e.label=3;case 3:return i.init({journeyId:this.journeyId||""}),[3,5];case 4:return r=e.sent(),console.error(r),[3,5];case 5:return[2]}}))}))},u.checkVisitorId=function(){return t(this,void 0,void 0,(function(){var t,r,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(this.VISITOR_ID_KEY))&&t.length>13?(this.visitorId=t,[3,3]):[3,1];case 1:return r=this,[4,this.createUUID()];case 2:r.visitorId=e.sent(),localStorage.setItem(this.VISITOR_ID_KEY,this.visitorId),e.label=3;case 3:return i.init({visitorId:this.visitorId}),[3,5];case 4:return s=e.sent(),console.error(s),[3,5];case 5:return[2]}}))}))},u.refreshJourneyId=function(){localStorage.removeItem(this.JOURNEY_ID_KEY),this.journeyId=void 0,this.checkJourneyId()},u.getPageType=function(t){switch(t){case n.INDEX:return d.INDEX;case n.CATEGORY:return d.CATEGORY;case n.BRAND:return d.BRAND;case n.PRODUCT:return d.PRODUCT;case n.CUSTOM:return d.CUSTOM;case n.ACCOUNT:return d.ACCOUNT;case n.ADDRESSES:return d.ADDRESSES;case n.ORDERS:return d.ORDERS;case n.ORDER_DETAIL:return d.ORDER_DETAIL;case n.LOGIN:return d.LOGIN;case n.REGISTER:return d.REGISTER;case n.FORGOT_PASSWORD:return d.FORGOT_PASSWORD;case n.RECOVER_PASSWORD:return d.RECOVER_PASSWORD;case n.ACTIVATE_CUSTOMER:return d.ACTIVATE_CUSTOMER;case n.CART:return d.CART;case n.FAVORITE_PRODUCTS:return d.FAVORITE_PRODUCTS;case n.SEARCH:return d.SEARCH;case n.NOT_FOUND:return d.NOT_FOUND;case n.BLOG:return d.BLOG;case n.BLOG_INDEX:return d.BLOG_INDEX;case n.BLOG_CATEGORY:return d.BLOG_CATEGORY;case n.CHECKOUT:return d.CHECKOUT}},u.getCustomerData=function(){var t=s.getInstance(),e=t.customerStore.customer;return{id:(null==e?void 0:e.id)||void 0,e:(null==e?void 0:e.email)||void 0,c:t.customerStore.customerConsentGranted}},u.getCommonEventData=function(){var t=s.getInstance();return{u:window.location.href,r:document.referrer,pt:t.currentPageType?this.getPageType(t.currentPageType):void 0,m:{fbp:o("_fbp"),fbc:o("_fbc")}}},u.getOrderLineItem=function(t){return t.orderLineItems.map((function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}))},u.getCartItem=function(t){return r(r(r(r({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})},u.sendEvents=function(n){var o,a,d,u,m,l,p,E,h;return t(this,void 0,void 0,(function(){var t,v,O;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,(t=s.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),[4,this.checkSessionId()];case 2:return e.sent(),[4,this.checkVisitorId()];case 3:return e.sent(),[4,this.checkJourneyId()];case 4:return e.sent(),v={e:n,scid:i.getSalesChannelId(),sfid:i.getStorefrontId(),sid:this.sessionId,jid:this.journeyId,vid:this.visitorId,sfrid:i.getStorefrontRoutingId()||"",ud:r(r(r(r({id:null===(o=t.customerStore.customer)||void 0===o?void 0:o.id},(null===(a=t.customerStore.customer)||void 0===a?void 0:a.email)?{em:null===(d=t.customerStore.customer)||void 0===d?void 0:d.email}:{}),(null===(u=t.customerStore.customer)||void 0===u?void 0:u.phone)?{ph:null===(m=t.customerStore.customer)||void 0===m?void 0:m.phone}:{}),(null===(l=t.customerStore.customer)||void 0===l?void 0:l.lastName)?{ln:null===(p=t.customerStore.customer)||void 0===p?void 0:p.lastName}:{}),(null===(E=t.customerStore.customer)||void 0===E?void 0:E.firstName)?{fn:null===(h=t.customerStore.customer)||void 0===h?void 0:h.firstName}:{}),v:3},[4,fetch(c,{method:"POST",body:JSON.stringify(v),headers:{"Content-Type":"application/json","x-api-key":i.getApiKey()}})];case 5:return e.sent(),[3,7];case 6:return O=e.sent(),console.error(O),[3,7];case 7:return[2]}}))}))},u.sessionStart=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.SESSION_START,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.pageView=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.PAGE_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{pt:this.getPageType(i)})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.productView=function(i,s){return t(this,void 0,void 0,(function(){var t,n;return e(this,(function(e){switch(e.label){case 0:return t=i.categories&&i.categories.length>0?i.categories[0].path.map((function(t){return t.name})):[],n={id:s,t:a.PRODUCT_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:r({id:i.id,vid:i.selectedVariant.id,cp:t,n:i.name,pr:i.selectedVariant.finalPrice},i.selectedVariant.price.currency?{c:i.selectedVariant.price.currency}:{})}})},[4,this.sendEvents([n])];case 1:return e.sent(),[2]}}))}))},u.addToCart=function(i,s,n,o){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:o,t:a.ADD_TO_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:n.id,c:n.currencyCode,pr:n.totalFinalPrice,il:this.getOrderLineItem(n)},crtItm:this.getCartItem(i)}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCart=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.VIEW_CART,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.orderSuccess=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.ORDER_SUCCESS,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:"success",p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[4,this.createSessionId()];case 2:return e.sent(),[2]}}))}))},u.beginCheckout=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.BEGIN_CHECKOUT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.checkoutStep=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CHECKOUT_STEP,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{chk:{id:i.id,s:s,p:i.totalFinalPrice,c:i.currencyCode,il:this.getOrderLineItem(i)}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerRegister=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CUSTOMER_REGISTER,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerLogin=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_LOGIN,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.customerVisit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.CUSTOMER_VISIT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewBrand=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.BRAND_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),br:{id:i.id}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewCategory=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:n,t:a.CATEGORY_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData(),ctg:{id:i.id,cp:s}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.viewPopup=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={t:a.POPUP_VIEW,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{cst:this.getCustomerData()},m:{sfpid:i}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.search=function(i,s,n){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.SEARCH,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{src:r({s:i},n?{r:n}:{})}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.contactForm=function(i){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:i,t:a.CONTACT_FORM,ts:Date.now(),d:r({},this.getCommonEventData())},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.addToWishlist=function(i,s){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={id:s,t:a.FAVORITE_PRODUCT,ts:Date.now(),d:r(r({},this.getCommonEventData()),{d:{pr:{id:i}}})},[4,this.sendEvents([t])];case 1:return e.sent(),[2]}}))}))},u.SESSION_ID_KEY="ikas_session_id",u.VISITOR_ID_KEY="ikas_visitor_id",u.JOURNEY_ID_KEY="ikas_journey_id",u.EXPIRY_LENGTH=18e5,u}();export{u as default};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i,__assign as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import s 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"@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"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-form-data-input/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import{IkasOrderAddressCity as r}from"../../../../models/data/order/address/city/index.js";import{IkasOrderAddressCountry as n}from"../../../../models/data/order/address/country/index.js";import{IkasOrderAddressDistrict as d}from"../../../../models/data/order/address/district/index.js";import{IkasOrderAddressRegion as a}from"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-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"@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{stringSorter as l,capitalize as u}from"../../../../utils/helper.js";import{FREE_TEXT_CITY_COUNTRY_LIST as c,DISTRICT_HIDDEN_COUNTRY_LIST as m}from"../../../../utils/constants.js";import p from"../../../../store/location/index.js";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";var f=function(){function f(e){var s=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(s,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(s,void 0,void 0,(function(){var t,e,o,s,r,n,d,a,l=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:[4,p.getMyCountry()];case 1:t=i.sent(),this.myCountryCode=t.data,i.label=2;case 2:return[4,p.listCountry({id:(null===(d=this.allowedCountryIds)||void 0===d?void 0:d.length)?{in:this.allowedCountryIds}:void 0,locale:h.getCurrentLocale()})];case 3:return e=i.sent(),o=e.data||[],s=h.getCurrentRouting(),(null===(a=null==s?void 0:s.countryCodes)||void 0===a?void 0:a.length)?o=o.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(r=h.getRoutings().filter((function(t){return t.id!==h.getStorefrontRoutingId()})),o=o.filter((function(t){return t.iso2&&!r.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=o,1!==this.countries.length||this.country?this.countries.length&&this.myCountryCode&&!this.country&&((n=this.countries.find((function(t){return t.iso2===l.myCountryCode})))?this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id)):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(s,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listState({countryId:{eq:this.country.id},locale:h.getCurrentLocale()})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(s,void 0,void 0,(function(){var t,e,o;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id)||!(null===(o=this.country)||void 0===o?void 0:o.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listCity({stateId:{eq:this.state.id},countryId:{eq:this.country.id}})];case 2:return t=i.sent(),this.cities=t.data||[],[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(s,void 0,void 0,(function(){var t,e,o,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id)||this.isDistrictHidden)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listDistrict({cityId:{eq:this.city.id},stateId:(null===(o=this.state)||void 0===o?void 0:o.id)?{eq:null===(s=this.state)||void 0===s?void 0:s.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){s.firstNameChangeCallback&&s.firstNameChangeCallback(t),s.address.firstName=t},this.onLastNameChange=function(t){s.lastNameChangeCallback&&s.lastNameChangeCallback(t),s.address.lastName=t},this.onPhoneChange=function(t){s.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(s.address.identityNumber=t):s.address.identityNumber=""},this.onAddressTitleChange=function(t){s.address.title=t},this.onAddressLine1Change=function(t){s.address.addressLine1=t},this.onAddressLine2Change=function(t){s.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){s.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=s.country)||void 0===i?void 0:i.id)!==t){var e=s.countries.find((function(i){return i.id===t}));s.address.country=new n({id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||"",code:(null==e?void 0:e.iso3)||null,iso2:(null==e?void 0:e.iso2)||null,iso3:(null==e?void 0:e.iso3)||null}),s.address.state=null,s.address.city=null,s.address.district=null,s.address.phone=null,s.states=[],s.cities=[],s.districts=[],s.listStates()}},this.onStateChange=function(t){var i;if((null===(i=s.state)||void 0===i?void 0:i.id)!==t){var e=s.states.find((function(i){return i.id===t}));s.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},s.address.isFreeTextCity||(s.address.city=null,s.cities=[],s.listCities()),s.address.isFreeTextDistrict||(s.address.district=null,s.districts=[])}},this.onCityChange=function(t){var i;if((null===(i=s.city)||void 0===i?void 0:i.id)!==t){var e=s.cities.find((function(i){return i.id===t}));s.address.city=new r({id:e.id,name:e.name}),s.address.isFreeTextDistrict||(s.address.district=null,s.districts=[],s.listDistricts())}},this.onCityInputChange=function(t){s.districts=[],s.address.city=new r({id:void 0,name:t})},this.onDistrictChange=function(t){var i;if((null===(i=s.district)||void 0===i?void 0:i.id)!==t){var e=s.districts.find((function(i){return i.id===t}));s.address.district=new d({id:e.id,name:e.name}),s.address.region=null}},this.onDistrictInputChange=function(t){s.address.district=new d({id:void 0,name:t})},this.onRegionChange=function(t){var i,e,o;if((null===(i=s.region)||void 0===i?void 0:i.id)!==t){var r=null===(o=null===(e=s.shippingZoneDistrict)||void 0===e?void 0:e.regions)||void 0===o?void 0:o.find((function(i){return i.id===t}));s.address.region=new a({id:r.id,name:r.name})}},this.onCorporateChange=function(t){s.isCorporate=t,t||(s.address.company=null,s.address.taxNumber=null,s.address.taxOffice=null)},this.onCompanyChange=function(t){s.address.company=t},this.onTaxNumberChange=function(t){s.address.taxNumber=t},this.onTaxOfficeChange=function(t){s.address.taxOffice=t},this.address=e.address,this.isCorporate=e.isCorporate||!1,this.isErrorsVisible=e.isErrorsVisible||!1,this.isCustomerAddress=e.isCustomerAddress||!1,this.allowedCountryIds=e.allowedCountryIds,this.allowCorporateInfo=e.allowCorporateInfo||!1,this.allowTitleChange=e.allowTitleChange||!1,this.firstNameChangeCallback=e.firstNameChangeCallback||null,this.lastNameChangeCallback=e.lastNameChangeCallback||null,o(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(f.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZone",{get:function(){var t,i=this;return null===(t=this.address.shippingZones)||void 0===t?void 0:t.find((function(t){var e;return t.countryId===(null===(e=i.address.country)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneState",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.state)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneCity",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.city)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneDistrict",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.district)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneRegions",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.region)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"region",{get:function(){return this.address.region},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return l(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"stateOptions",{get:function(){var t,i,e=this,o=this.states.map(this.modelToOption);return this.shippingZone&&!this.shippingZone.showAllStates&&(null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.length)&&(o=o.filter((function(t){var i,o;return null===(o=null===(i=e.shippingZone)||void 0===i?void 0:i.states)||void 0===o?void 0:o.some((function(i){return i.id===t.value}))}))),o.sort((function(t,i){return l(t.label,i.label)})),o},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"cityOptions",{get:function(){var t,i,e,o=this,r=s(this.cities,"order").map(this.modelToOption);return this.shippingZone&&!(null===(t=this.shippingZoneState)||void 0===t?void 0:t.showAllCities)&&(null===(e=null===(i=this.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.length)&&(r=r.filter((function(t){var i,e;return null===(e=null===(i=o.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"districtOptions",{get:function(){var t,i,o,s=this,r=this.districts.map((function(t){return e(e({},t),{name:u(t.name)})})).map(this.modelToOption);return this.shippingZone&&!(null===(t=this.shippingZoneCity)||void 0===t?void 0:t.showAllDistricts)&&(null===(o=null===(i=this.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===o?void 0:o.length)&&(r=r.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),r.sort((function(t,i){return l(t.label,i.label)})),r},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"regionOptions",{get:function(){var t,i,e=(null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.map(this.modelToOption))||[];return e.sort((function(t,i){return l(t.label,i.label)})),e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isFreeTextCity",{get:function(){var t=this;return c.some((function(i){var e,o;return(null===(o=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===o?void 0:o.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isDistrictHidden",{get:function(){var t=this;return m.some((function(i){var e,o;return(null===(o=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===o?void 0:o.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),f}();export{f as default};
1
+ import{__awaiter as t,__generator as i,__assign as e}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import s 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"@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"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/region/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/customer-form-data-input/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import{IkasOrderAddressCity as r}from"../../../../models/data/order/address/city/index.js";import{IkasOrderAddressCountry as n}from"../../../../models/data/order/address/country/index.js";import{IkasOrderAddressDistrict as d}from"../../../../models/data/order/address/district/index.js";import{IkasOrderAddressRegion as a}from"../../../../models/data/order/address/region/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/option/value/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/transaction/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/campaign-offer/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/stock-location/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/storefront-popup/storefront-popup-display-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"@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{stringSorter as l,capitalize as u}from"../../../../utils/helper.js";import{FREE_TEXT_CITY_COUNTRY_LIST as c,DISTRICT_HIDDEN_COUNTRY_LIST as m}from"../../../../utils/constants.js";import p from"../../../../store/location/index.js";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";var f=function(){function f(e){var s=this;this.isCorporate=!1,this.isErrorsVisible=!1,this.allowedCountryIds=null,this.allowCorporateInfo=!1,this.allowTitleChange=!1,this.firstNameChangeCallback=null,this.lastNameChangeCallback=null,this.countries=[],this.states=[],this.cities=[],this.districts=[],this.myCountryCode=null,this.fillDropdownOptions=function(){return t(s,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.listCountries()];case 1:return t.sent(),[4,this.listStates()];case 2:return t.sent(),[4,this.listCities()];case 3:return t.sent(),[4,this.listDistricts()];case 4:return t.sent(),[2]}}))}))},this.listCountries=function(){return t(s,void 0,void 0,(function(){var t,e,o,s,r,n,d,a,l=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.myCountryCode?[3,2]:[4,p.getMyCountry()];case 1:t=i.sent(),this.myCountryCode=t.data,i.label=2;case 2:return[4,p.listCountry({id:(null===(d=this.allowedCountryIds)||void 0===d?void 0:d.length)?{in:this.allowedCountryIds}:void 0,locale:h.getCurrentLocale()})];case 3:return e=i.sent(),o=e.data||[],s=h.getCurrentRouting(),(null===(a=null==s?void 0:s.countryCodes)||void 0===a?void 0:a.length)?o=o.filter((function(t){var i;return t.iso2&&(null===(i=s.countryCodes)||void 0===i?void 0:i.includes(t.iso2))})):(r=h.getRoutings().filter((function(t){return t.id!==h.getStorefrontRoutingId()})),o=o.filter((function(t){return t.iso2&&!r.some((function(i){var e;return null===(e=i.countryCodes)||void 0===e?void 0:e.includes(t.iso2)}))}))),this.countries=o,1!==this.countries.length||this.country?this.countries.length&&this.myCountryCode&&!this.country&&((n=this.countries.find((function(t){return t.iso2===l.myCountryCode})))?this.onCountryChange(n.id):this.onCountryChange(this.countries[0].id)):this.onCountryChange(this.countries[0].id),[3,5];case 4:return i.sent(),[3,5];case 5:return[2]}}))}))},this.listStates=function(){return t(s,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listState({countryId:{eq:this.country.id},locale:h.getCurrentLocale()})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listCities=function(){return t(s,void 0,void 0,(function(){var t,e,o;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.state)||void 0===e?void 0:e.id)||!(null===(o=this.country)||void 0===o?void 0:o.id))return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listCity({stateId:{eq:this.state.id},countryId:{eq:this.country.id}})];case 2:return t=i.sent(),this.cities=t.data||[],[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.listDistricts=function(){return t(s,void 0,void 0,(function(){var t,e,o,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.city)||void 0===e?void 0:e.id)||this.isDistrictHidden)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,p.listDistrict({cityId:{eq:this.city.id},stateId:(null===(o=this.state)||void 0===o?void 0:o.id)?{eq:null===(s=this.state)||void 0===s?void 0:s.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],this.districts.length?this.address.isDistrictRequired=!0:this.address.isDistrictRequired=!1,[3,4];case 3:return i.sent(),[3,4];case 4:return[2]}}))}))},this.modelToOption=function(t){return{label:t.name,value:t.id+""}},this.onFirstNameChange=function(t){s.firstNameChangeCallback&&s.firstNameChangeCallback(t),s.address.firstName=t},this.onLastNameChange=function(t){s.lastNameChangeCallback&&s.lastNameChangeCallback(t),s.address.lastName=t},this.onPhoneChange=function(t){s.address.phone=t},this.onIdentityNumberChange=function(t){t?t.length<=11&&(s.address.identityNumber=t):s.address.identityNumber=""},this.onAddressTitleChange=function(t){s.address.title=t},this.onAddressLine1Change=function(t){s.address.addressLine1=t},this.onAddressLine2Change=function(t){s.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){s.address.postalCode=t},this.onCountryChange=function(t){var i;if((null===(i=s.country)||void 0===i?void 0:i.id)!==t){var e=s.countries.find((function(i){return i.id===t}));s.address.country=new n({id:(null==e?void 0:e.id)||null,name:(null==e?void 0:e.name)||"",code:(null==e?void 0:e.iso3)||null,iso2:(null==e?void 0:e.iso2)||null,iso3:(null==e?void 0:e.iso3)||null}),s.address.state=null,s.address.city=null,s.address.district=null,s.address.phone=null,s.states=[],s.cities=[],s.districts=[],s.listStates()}},this.onStateChange=function(t){var i;if((null===(i=s.state)||void 0===i?void 0:i.id)!==t){var e=s.states.find((function(i){return i.id===t}));s.address.state={id:e.id,name:null==e?void 0:e.name,code:null==e?void 0:e.stateCode},s.address.isFreeTextCity||(s.address.city=null,s.cities=[],s.listCities()),s.address.isFreeTextDistrict||(s.address.district=null,s.districts=[])}},this.onCityChange=function(t){var i;if((null===(i=s.city)||void 0===i?void 0:i.id)!==t){var e=s.cities.find((function(i){return i.id===t}));s.address.city=new r({id:e.id,name:e.name,code:e.cityCode}),s.address.isFreeTextDistrict||(s.address.district=null,s.districts=[],s.listDistricts())}},this.onCityInputChange=function(t){s.districts=[],s.address.city=new r({id:void 0,name:t})},this.onDistrictChange=function(t){var i;if((null===(i=s.district)||void 0===i?void 0:i.id)!==t){var e=s.districts.find((function(i){return i.id===t}));s.address.district=new d({id:e.id,name:e.name}),s.address.region=null}},this.onDistrictInputChange=function(t){s.address.district=new d({id:void 0,name:t})},this.onRegionChange=function(t){var i,e,o;if((null===(i=s.region)||void 0===i?void 0:i.id)!==t){var r=null===(o=null===(e=s.shippingZoneDistrict)||void 0===e?void 0:e.regions)||void 0===o?void 0:o.find((function(i){return i.id===t}));s.address.region=new a({id:r.id,name:r.name})}},this.onCorporateChange=function(t){s.isCorporate=t,t||(s.address.company=null,s.address.taxNumber=null,s.address.taxOffice=null)},this.onCompanyChange=function(t){s.address.company=t},this.onTaxNumberChange=function(t){s.address.taxNumber=t},this.onTaxOfficeChange=function(t){s.address.taxOffice=t},this.address=e.address,this.isCorporate=e.isCorporate||!1,this.isErrorsVisible=e.isErrorsVisible||!1,this.isCustomerAddress=e.isCustomerAddress||!1,this.allowedCountryIds=e.allowedCountryIds,this.allowCorporateInfo=e.allowCorporateInfo||!1,this.allowTitleChange=e.allowTitleChange||!1,this.firstNameChangeCallback=e.firstNameChangeCallback||null,this.lastNameChangeCallback=e.lastNameChangeCallback||null,o(this,{firstNameChangeCallback:!1,lastNameChangeCallback:!1}),this.fillDropdownOptions()}return Object.defineProperty(f.prototype,"firstName",{get:function(){return this.address.firstName},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastName",{get:function(){return this.address.lastName},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phone",{get:function(){return this.address.phone},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"identityNumber",{get:function(){return this.address.identityNumber},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZone",{get:function(){var t,i=this;return null===(t=this.address.shippingZones)||void 0===t?void 0:t.find((function(t){var e;return t.countryId===(null===(e=i.address.country)||void 0===e?void 0:e.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneState",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.state)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneCity",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneState)||void 0===t?void 0:t.cities)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.city)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneDistrict",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneCity)||void 0===t?void 0:t.districts)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.district)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"shippingZoneRegions",{get:function(){var t,i,e=this;return null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.find((function(t){var i;return t.id===(null===(i=e.address.region)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"country",{get:function(){return this.address.country},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"state",{get:function(){return this.address.state},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"city",{get:function(){return this.address.city},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"district",{get:function(){return this.address.district},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"region",{get:function(){return this.address.region},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"countryOptions",{get:function(){var t=this.countries.map(this.modelToOption);return t.sort((function(t,i){return l(t.label,i.label)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"stateOptions",{get:function(){var t,i,e=this,o=this.states.map(this.modelToOption);return this.shippingZone&&!this.shippingZone.showAllStates&&(null===(i=null===(t=this.shippingZone)||void 0===t?void 0:t.states)||void 0===i?void 0:i.length)&&(o=o.filter((function(t){var i,o;return null===(o=null===(i=e.shippingZone)||void 0===i?void 0:i.states)||void 0===o?void 0:o.some((function(i){return i.id===t.value}))}))),o.sort((function(t,i){return l(t.label,i.label)})),o},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"cityOptions",{get:function(){var t,i,e,o=this,r=s(this.cities,"order").map(this.modelToOption);return this.shippingZone&&!(null===(t=this.shippingZoneState)||void 0===t?void 0:t.showAllCities)&&(null===(e=null===(i=this.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.length)&&(r=r.filter((function(t){var i,e;return null===(e=null===(i=o.shippingZoneState)||void 0===i?void 0:i.cities)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"districtOptions",{get:function(){var t,i,o,s=this,r=this.districts.map((function(t){return e(e({},t),{name:u(t.name)})})).map(this.modelToOption);return this.shippingZone&&!(null===(t=this.shippingZoneCity)||void 0===t?void 0:t.showAllDistricts)&&(null===(o=null===(i=this.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===o?void 0:o.length)&&(r=r.filter((function(t){var i,e;return null===(e=null===(i=s.shippingZoneCity)||void 0===i?void 0:i.districts)||void 0===e?void 0:e.some((function(i){return i.id===t.value}))}))),r.sort((function(t,i){return l(t.label,i.label)})),r},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"regionOptions",{get:function(){var t,i,e=(null===(i=null===(t=this.shippingZoneDistrict)||void 0===t?void 0:t.regions)||void 0===i?void 0:i.map(this.modelToOption))||[];return e.sort((function(t,i){return l(t.label,i.label)})),e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isFreeTextCity",{get:function(){var t=this;return c.some((function(i){var e,o;return(null===(o=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===o?void 0:o.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isDistrictHidden",{get:function(){var t=this;return m.some((function(i){var e,o;return(null===(o=null===(e=t.address.country)||void 0===e?void 0:e.iso2)||void 0===o?void 0:o.toLowerCase())===i.toLowerCase()}))},enumerable:!1,configurable:!0}),f}();export{f as default};
@@ -19,6 +19,8 @@ declare type CouponProps = {
19
19
  setCouponError: (value: boolean) => void;
20
20
  setCouponErrorCode: (value: CouponErrorCode | null) => void;
21
21
  isOpenCouponCode?: boolean;
22
+ isMobile?: boolean;
23
+ showOnlyMobile?: boolean;
22
24
  } & CommonProps;
23
25
  export declare const Coupon: React.FC<CouponProps>;
24
26
  export {};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as n}from"mobx-react-lite";import a from"lodash/sortBy";import c from"../input-with-button/index.js";import r from"../notification-box/index.js";import{CheckoutStep as l}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as s}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import{CartItem as m}from"./cart-item/index.js";import{FormItem as p}from"../form-item/index.js";import{FormItemType as d}from"../form-item/model.js";import C from"../tooltip/index.js";import E from"../svg/arrow-down.js";import h from"../svg/cross.js";import v from"../svg/gift.js";import f from"../../styles/common.module.scss.js";import g from"./style.module.scss.js";import k from"../svg/ikas.js";import{Button as N}from"../button/index.js";var y;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS"}(y||(y={}));var S=n((function(e){var t,n,a=e.vm,c=e.allowExpand,p=e.isSuccessPageSummary,d=a.checkout,C=u().t,h=o.useState(!c),v=h[0],f=h[1],N=o.useState(!1),S=N[0],j=N[1],_=o.useState(null),I=_[0],w=_[1],A=o.useState(0),D=A[0],R=A[1],B=o.useState(null),U=B[0],L=B[1],F=o.useState(!1),M=F[0],X=F[1],V=o.useState(!1),G=V[0],H=V[1],q=o.useState(!1),z=q[0],$=q[1];o.useEffect((function(){c&&(v?U&&R(U.getBoundingClientRect().height):R(0))}),[v,U,c,M,G,S,z]);var K=o.useMemo((function(){switch(I){case y.COUPON_CODE_NOT_EXIST:return C("checkout-page:giftCodeErrorDescription");case y.COUPON_CODE_NOT_EXIST_FOR_GUESS:return C("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[I]),Q=[g.CartSummary,c?g.HideOnDesktop:"",p?g.SuccessPageCartSummary:""].join(" "),J=c?{height:D+"px"}:void 0,W=[g.ArrowDown,v?g.Rotated:""].join(" ");return d?o.createElement(o.Fragment,null,!!c&&o.createElement(o.Fragment,null,o.createElement("div",{id:"checkout-mobile-summary-header"}),o.createElement("div",{className:g.ExpandHeader,onClick:function(){if(!v){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}f(!v)}},o.createElement("div",{className:g.Left},C("checkout-page:summary")),o.createElement("div",{className:g.Price},o.createElement("span",{className:g.PriceText},"".concat(s(a.finalPrice||0,d.currencyCode,d.currencySymbol)," (").concat(d.itemQuantity," ").concat(C("checkout-page:cartItemProduct"),")")),o.createElement("span",{className:W},o.createElement(E,null))))),o.createElement("div",{className:Q},o.createElement("div",{className:[g.DetailsContainer,p?g.SuccessPageDetailContainer:""].join(" "),style:J},o.createElement("div",{className:g.Details,ref:L},o.createElement("div",{className:g.ItemsContainer},o.createElement("div",null,d.items.map((function(e,t){return o.createElement(m,{key:t,vm:a,cartItem:e,currencyCode:d.currencyCode,onChange:$,isSuccessPageSummary:p})})))),o.createElement("div",{className:g.Divider}),o.createElement("div",{className:g.SubTotalInfo},S&&o.createElement("div",{className:g.NotificationContainer},o.createElement(r,{type:"warning",title:C("checkout-page:giftCodeErrorTitle"),content:K,onClose:function(){j(!1),w(null)}})),o.createElement(T,{label:C("checkout-page:subtotal"),value:d.formattedTotalPrice,tooltipText:C("checkout-page:subtotalTooltip"),hideMarginBottom:!a.isCouponCodeVisible}),!!(null===(t=d.shippingLines)||void 0===t?void 0:t.length)&&(a.step===l.SUCCESS?o.createElement(T,{label:C("checkout-page:cartShippingTitle"),value:d.shippingTotal?d.formattedShippingTotal:C("checkout-page:free")}):d.shippingLines.map((function(e,t){return o.createElement(T,{key:t,label:e.paymentMethod?e.title:C("checkout-page:cartShippingTitle"),value:e.finalPrice?s(e.finalPrice,d.currencyCode,d.currencySymbol):C("checkout-page:free")})}))),!!a.installmentExtraPrice&&o.createElement(T,{label:C("checkout-page:cartInterest"),value:s(a.installmentExtraPrice,d.currencyCode,d.currencySymbol)}),o.createElement(b,{vm:a}),o.createElement(x,{vm:a}),(a.step===l.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==l.SUCCESS)&&a.isCouponCodeVisible&&o.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement(O,{vm:a,isAddingCoupon:G,setAddingCoupon:H,setCouponError:j,setCouponErrorCode:w}),o.createElement(P,{vm:a,isAddingNote:M,setAddingNote:X})),o.createElement("div",{className:[g.TotalContainer,p?g.SuccessPageTotalContainer:""].join(" ")},o.createElement("div",{className:g.TitleContainer},o.createElement("div",{className:g.Title},C("checkout-page:total"))),o.createElement("div",null,o.createElement("div",{className:g.TotalPricesContainer},o.createElement("div",{className:g.TotalPrice},s(a.finalPrice||0,d.currencyCode,d.currencySymbol)),!!d.$totalTax&&!!(null===(n=a.customizationProps)||void 0===n?void 0:n.showTax)&&o.createElement("div",{className:[g.TotalTax].join(" ")},C("checkout-page:cartTaxTitle")+" "+d.$formattedTotalTax)))),!p&&!a.isPoweredByHidden&&o.createElement("div",{className:g.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===i.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(k,null))))))):null})),T=n((function(e){var t=e.label,n=e.value,a=e.tooltipText,c=e.hideMarginBottom;return o.createElement("div",{className:[g.InfoRow,c?g.hideMb:""].join(" ")},o.createElement("div",{className:g.Label},o.createElement("span",null,t),!!a&&o.createElement(C,{text:a,style:{marginLeft:"8px"}})),o.createElement("div",{className:g.Value},n))})),b=n((function(e){var t=e.vm,n=u().t;return t.checkout?o.createElement(o.Fragment,null,a(t.checkout.nonCouponAdjustments||[],"order").map((function(e,a){return o.createElement("div",{className:g.InfoRow,key:a},o.createElement("div",{className:g.Label},"INTEREST"===e.name?n("checkout-page:cartInterest"):e.name),o.createElement("div",{className:g.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,s(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),x=n((function(e){var t,n=e.vm,a=u().t;return n.checkout?o.createElement(o.Fragment,null,null===(t=n.checkout.giftPackageLines)||void 0===t?void 0:t.map((function(e,t){return o.createElement("div",{className:g.InfoRow,key:t},o.createElement("div",{className:g.Label},o.createElement("div",{className:g.GiftLabel},o.createElement(v,{style:{position:"relative",top:"-1px"}}),o.createElement("span",null,a("checkout-page:giftPackage")))),o.createElement("div",{className:g.Value},o.createElement("span",null,s(e.price,n.checkout.currencyCode,n.checkout.currencySymbol))))}))):null})),O=n((function(n){var a=n.vm,r=n.isAddingCoupon,i=n.setAddingCoupon,m=n.setCouponError,C=n.setCouponErrorCode,E=n.isOpenCouponCode,v=u().t,k=o.useState(""),y=k[0],S=k[1],T=o.useState(!1),b=T[0],x=T[1],O=o.useRef(null);o.useEffect((function(){r&&O.current&&O.current.focus()}),[r]);var P=function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=y,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),x(!1),S(""),!a.checkout.appliedCouponCode||a.couponError?[3,3]:(i(!1),m(!1),C(null),[4,a.reInitPaymentMethod()]);case 2:return e.sent(),[3,4];case 3:a.checkout.couponCode=null,m(!0),C(a.couponError),e.label=4;case 4:return[2]}}))}))},j=function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=null,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!1),[2]}}))}))},_=a.step===l.SUCCESS,I=a.step===l.SHIPPING;if(_&&!a.checkout.appliedCouponCode)return null;var w=a.checkout.couponAdjustment,A=!(!a.checkout.appliedCouponCode||r),D=!!a.checkout.appliedCouponCode&&E;return o.createElement(o.Fragment,null,!!E&&o.createElement(o.Fragment,null,o.createElement("div",{className:[g.CartSummary,g.OpenCouponCodeSummary].join(" ")},o.createElement("div",{className:f.FormSectionTitle},o.createElement("div",{style:{paddingBottom:D?0:6},className:f.Title},v("checkout-page:couponCode")),D&&o.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},o.createElement("span",{className:[g.AppliedCoupon,g.AppliedCouponBgGray].join(" ")},o.createElement("span",{className:g.CouponCode},a.checkout.appliedCouponCode),!_&&o.createElement("span",{className:g.ClearCoupon,onClick:j},o.createElement(h,null))))))),A&&!I&&!a.isCouponCodeRequirementDefult&&o.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement("div",{className:g.InfoRow},!a.checkout.appliedCouponCode&&!r&&a.isCouponCodeVisible&&o.createElement("div",{className:g.ActionTextBtn,onClick:function(){return i(!0)}},v("checkout-page:addCouponCode")),r&&!E&&o.createElement(c,{value:y,placeholder:v("checkout-page:couponCode"),buttonLabel:v("checkout-page:actions.apply"),inputRef:O,onClick:P,isLoading:b,onChange:S}),E&&!D&&o.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&P()},className:g.OpenCouponCodeMain},o.createElement(p,{label:v("checkout-page:couponCode"),type:d.TEXT,value:y,onChange:S}),o.createElement(N,{style:{width:"33%"},text:v("checkout-page:actions.apply"),isLoading:b,onClick:P})),A&&o.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},v("checkout-page:couponCode"),o.createElement("span",{className:[g.AppliedCoupon,a.isCouponCodeRequirementDefult?"":g.NotClosed].join(" ")},o.createElement("span",{className:g.CouponCode},a.checkout.appliedCouponCode),a.step!==l.SUCCESS&&a.isCouponCodeRequirementDefult&&o.createElement("span",{className:g.ClearCoupon,onClick:j},o.createElement(h,null)))),A&&o.createElement("div",{className:g.Value},o.createElement("span",null,"DECREMENT"===(null==w?void 0:w.type)?"- ":"")," ",o.createElement("span",null,s((null==w?void 0:w.amount)||0,a.checkout.currencyCode,a.checkout.currencySymbol)))))})),P=n((function(e){var t=e.vm,n=e.isAddingNote,a=e.setAddingNote,c=u().t,r=o.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=o.useCallback((function(){a(!0)}),[]),s=o.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var m=t.step===l.SUCCESS;return m&&!t.checkout.note?null:o.createElement("div",{className:g.InfoRow},!n&&!m&&o.createElement("div",{className:g.ActionTextBtn,onClick:i},r),(n||m)&&o.createElement("div",{className:[g.CheckoutNoteContainer,m?g.Success:""].join(" ")},o.createElement("div",{className:g.Title},c("checkout-page:orderNote")),m?o.createElement("div",{className:g.CheckoutNoteDisplay},t.checkout.note):o.createElement(p,{style:{width:"100%"},type:d.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:s,maxLength:320})))}));export{S as CartSummary,O as Coupon,y as CouponErrorCode};
1
+ import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as o}from"mobx-react-lite";import a from"lodash/sortBy";import c from"../input-with-button/index.js";import r from"../notification-box/index.js";import{CheckoutStep as l}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as u}from"../../../../utils/currency.js";import{useTranslation as s}from"../../../../utils/i18n.js";import{CartItem as m}from"./cart-item/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as p}from"../form-item/model.js";import C from"../tooltip/index.js";import E from"../svg/arrow-down.js";import h from"../svg/cross.js";import f from"../svg/gift.js";import v from"../../styles/common.module.scss.js";import g from"./style.module.scss.js";import k from"../svg/ikas.js";import{Button as N}from"../button/index.js";import y from"../../../../hooks/useDimension.js";var S;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS"}(S||(S={}));var T=o((function(e){var t,o,a=e.vm,c=e.allowExpand,d=e.isSuccessPageSummary,p=a.checkout,C=s().t,h=n.useState(!c),f=h[0],v=h[1],N=n.useState(!1),T=N[0],P=N[1],w=n.useState(null),_=w[0],L=w[1],R=n.useState(0),D=R[0],A=R[1],M=n.useState(null),B=M[0],U=M[1],F=n.useState(!1),G=F[0],V=F[1],X=n.useState(!1),q=X[0],H=X[1],z=n.useState(!1),$=z[0],K=z[1];y().isMobile,n.useEffect((function(){c&&(f?B&&A(B.getBoundingClientRect().height):A(0))}),[f,B,c,G,q,T,$]);var Q=n.useMemo((function(){switch(_){case S.COUPON_CODE_NOT_EXIST:return C("checkout-page:giftCodeErrorDescription");case S.COUPON_CODE_NOT_EXIST_FOR_GUESS:return C("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[_]),W=[g.CartSummary,c?g.HideOnDesktop:"",d?g.SuccessPageCartSummary:""].join(" "),J=c?{height:D+"px"}:void 0,Y=[g.ArrowDown,f?g.Rotated:""].join(" ");return p?n.createElement(n.Fragment,null,!!c&&n.createElement(n.Fragment,null,n.createElement("div",{id:"checkout-mobile-summary-header"}),n.createElement("div",{className:g.ExpandHeader,onClick:function(){if(!f){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}v(!f)}},n.createElement("div",{className:g.Left},C("checkout-page:summary")),n.createElement("div",{className:g.Price},n.createElement("span",{className:g.PriceText},"".concat(u(a.finalPrice||0,p.currencyCode,p.currencySymbol)," (").concat(p.itemQuantity," ").concat(C("checkout-page:cartItemProduct"),")")),n.createElement("span",{className:Y},n.createElement(E,null))))),n.createElement("div",{className:W},n.createElement("div",{className:[g.DetailsContainer,d?g.SuccessPageDetailContainer:""].join(" "),style:J},n.createElement("div",{className:g.Details,ref:U},n.createElement("div",{className:g.ItemsContainer},n.createElement("div",null,p.items.map((function(e,t){return n.createElement(m,{key:t,vm:a,cartItem:e,currencyCode:p.currencyCode,onChange:K,isSuccessPageSummary:d})})))),n.createElement("div",{className:g.Divider}),n.createElement("div",{className:g.SubTotalInfo},T&&n.createElement("div",{className:g.NotificationContainer},n.createElement(r,{type:"warning",title:C("checkout-page:giftCodeErrorTitle"),content:Q,onClose:function(){P(!1),L(null)}})),n.createElement(b,{label:C("checkout-page:subtotal"),value:p.formattedTotalPrice,tooltipText:C("checkout-page:subtotalTooltip"),hideMarginBottom:!a.isCouponCodeVisible}),!!(null===(t=p.shippingLines)||void 0===t?void 0:t.length)&&(a.step===l.SUCCESS?n.createElement(b,{label:C("checkout-page:cartShippingTitle"),value:p.shippingTotal?p.formattedShippingTotal:C("checkout-page:free")}):p.shippingLines.map((function(e,t){return n.createElement(b,{key:t,label:e.paymentMethod?e.title:C("checkout-page:cartShippingTitle"),value:e.finalPrice?u(e.finalPrice,p.currencyCode,p.currencySymbol):C("checkout-page:free")})}))),n.createElement(x,{vm:a}),n.createElement(O,{vm:a}),(a.step===l.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==l.SUCCESS)&&a.isCouponCodeVisible&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(j,{vm:a,isAddingCoupon:q,setAddingCoupon:H,setCouponError:P,setCouponErrorCode:L}),n.createElement(I,{vm:a,isAddingNote:G,setAddingNote:V}),!!a.installmentExtraPrice&&n.createElement(n.Fragment,null,n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(b,{label:C("checkout-page:cartInterest"),value:u(a.installmentExtraPrice,p.currencyCode,p.currencySymbol)}))),n.createElement("div",{className:[g.TotalContainer,d?g.SuccessPageTotalContainer:""].join(" ")},n.createElement("div",{className:g.TitleContainer},n.createElement("div",{className:g.Title},C("checkout-page:total"))),n.createElement("div",null,n.createElement("div",{className:g.TotalPricesContainer},n.createElement("div",{className:g.TotalPrice},u(a.finalPrice||0,p.currencyCode,p.currencySymbol)),!!p.$totalTax&&!!(null===(o=a.customizationProps)||void 0===o?void 0:o.showTax)&&n.createElement("div",{className:[g.TotalTax].join(" ")},C("checkout-page:cartTaxTitle")+" "+p.$formattedTotalTax)))),!d&&!a.isPoweredByHidden&&n.createElement("div",{className:g.PoweredBy},n.createElement("span",null,"powered by"),n.createElement("a",{href:"https://ikas.com"+("tr"===i.getCurrentLocale()?"/tr":""),target:"_blank"},n.createElement(k,null))))))):null})),b=o((function(e){var t=e.label,o=e.value,a=e.tooltipText,c=e.hideMarginBottom;return n.createElement("div",{className:[g.InfoRow,c?g.hideMb:""].join(" ")},n.createElement("div",{className:g.Label},n.createElement("span",null,t),!!a&&n.createElement(C,{text:a,style:{marginLeft:"8px"}})),n.createElement("div",{className:g.Value},o))})),x=o((function(e){var t=e.vm,o=s().t;return t.checkout?n.createElement(n.Fragment,null,a(t.checkout.nonCouponAdjustments||[],"order").map((function(e,a){return n.createElement("div",{className:g.InfoRow,key:a},n.createElement("div",{className:g.Label},"INTEREST"===e.name?o("checkout-page:cartInterest"):e.name),n.createElement("div",{className:g.Value},n.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",n.createElement("span",null,u(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),O=o((function(e){var t,o=e.vm,a=s().t;return o.checkout?n.createElement(n.Fragment,null,null===(t=o.checkout.giftPackageLines)||void 0===t?void 0:t.map((function(e,t){return n.createElement("div",{className:g.InfoRow,key:t},n.createElement("div",{className:g.Label},n.createElement("div",{className:g.GiftLabel},n.createElement(f,{style:{position:"relative",top:"-1px"}}),n.createElement("span",null,a("checkout-page:giftPackage")))),n.createElement("div",{className:g.Value},n.createElement("span",null,u(e.price,o.checkout.currencyCode,o.checkout.currencySymbol))))}))):null})),j=o((function(o){var a=o.vm,r=o.isAddingCoupon,i=o.setAddingCoupon,u=o.setCouponError,m=o.setCouponErrorCode,C=o.isOpenCouponCode,E=o.isMobile,h=o.showOnlyMobile,f=s().t,k=n.useState(""),y=k[0],S=k[1],T=n.useState(!1),b=T[0],x=T[1],O=n.useRef(null);n.useEffect((function(){r&&O.current&&O.current.focus()}),[r]);var j=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return a.checkout.couponCode=y,x(!0),[4,a.onCouponCodeApply()];case 1:return t.sent(),x(!1),S(""),e=a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length,a.couponError?[3,4]:a.checkout.appliedCouponCode||e?(u(!1),m(null),[4,a.reInitPaymentMethod()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:a.checkout.couponCode=null,u(!0),m(a.couponError),t.label=5;case 5:return[2]}}))}))},I=function(n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return x(!0),[4,a.removeGiftCardLine(n)];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!1),[2]}}))}))};a.step,l.SUCCESS;var w=a.step===l.SHIPPING,_=!!a.checkout.appliedCouponCode||!!(a.checkout.giftCardLines&&a.checkout.giftCardLines.length>0),L=!!a.checkout.appliedCouponCode&&C,R=!r&&a.isCouponCodeVisible&&!a.isCouponCodeRequirementOpen&&a.step!==l.SUCCESS,D=_&&(!C||E);return n.createElement(n.Fragment,null,!!C&&n.createElement(n.Fragment,null,n.createElement("div",{className:[g.CartSummary,g.OpenCouponCodeSummary].join(" ")},n.createElement("div",{className:v.FormSectionTitle},n.createElement("div",{style:{paddingBottom:L?0:6},className:v.Title},f("checkout-page:couponCode"))))),_&&!w&&!a.isCouponCodeRequirementDefult&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement("div",{className:R?g.InfoRow:""},R&&n.createElement("div",{className:g.ActionTextBtn,onClick:function(){return i(!0)}},f("checkout-page:addCouponCode")),r&&!C&&n.createElement("div",{style:{marginBottom:"10px"}},n.createElement(c,{value:y,placeholder:f("checkout-page:couponCode"),buttonLabel:f("checkout-page:actions.apply"),inputRef:O,onClick:j,isLoading:b,onChange:S})),C&&n.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&j()},className:[g.OpenCouponCodeMain,D?g.OpenCouponCodeMainWithMb:""].join(" ")},n.createElement(d,{label:f("checkout-page:couponCode"),type:p.TEXT,value:y,onChange:S}),n.createElement(N,{style:{width:"33%"},text:f("checkout-page:actions.apply"),isLoading:b,onClick:j}))),D&&n.createElement(n.Fragment,null,!!a.checkout.appliedCouponCode&&n.createElement("div",{className:[g.InfoRow,h?g.InfoRowGiftCardMobile:""].join(" ")},n.createElement(P,{vm:a,onClearCouponCode:function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=null,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!1),[2]}}))}))},couponCode:a.checkout.appliedCouponCode})),!!a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length&&a.checkout.giftCardLines.map((function(e){return n.createElement("div",{className:[g.InfoRow,h?g.InfoRowGiftCardMobile:""].join(" ")},n.createElement(P,{vm:a,onClearGiftCode:I,couponCode:e.code,giftCardLine:e}))}))))})),P=o((function(e){var t=e.vm,o=e.onClearCouponCode,a=e.couponCode,c=e.giftCardLine,r=e.onClearGiftCode,i=t.checkout.couponAdjustment,m=s().t;return n.createElement(n.Fragment,null,n.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},m(c?"checkout-page:giftCode":"checkout-page:couponCode"),n.createElement("span",{className:[g.AppliedCoupon,t.isCouponCodeRequirementDefult?"":g.NotClosed].join(" ")},n.createElement("span",{className:g.CouponCode},a),t.step!==l.SUCCESS&&t.isCouponCodeRequirementDefult&&n.createElement("span",{className:g.ClearCoupon,onClick:function(){return c?r&&r(c.giftCardId):o&&o()}},n.createElement(h,null)))),n.createElement("div",null,c?n.createElement("div",{className:g.Value},n.createElement("span",null,"-")," ",n.createElement("span",null,u((null==c?void 0:c.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol))):n.createElement("div",{className:g.Value},n.createElement("span",null,"DECREMENT"===(null==i?void 0:i.type)?"- ":"")," ",n.createElement("span",null,u((null==i?void 0:i.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol)))))})),I=o((function(e){var t=e.vm,o=e.isAddingNote,a=e.setAddingNote,c=s().t,r=n.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=n.useCallback((function(){a(!0)}),[]),u=n.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var m=t.step===l.SUCCESS;return m&&!t.checkout.note?null:n.createElement("div",{className:g.InfoRow},!o&&!m&&n.createElement("div",{className:g.ActionTextBtn,onClick:i},r),(o||m)&&n.createElement("div",{className:[g.CheckoutNoteContainer,m?g.Success:""].join(" ")},n.createElement("div",{className:g.Title},c("checkout-page:orderNote")),m?n.createElement("div",{className:g.CheckoutNoteDisplay},t.checkout.note):n.createElement(d,{style:{width:"100%"},type:p.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:u,maxLength:320})))}));export{T as CartSummary,j as Coupon,S as CouponErrorCode};
@@ -1 +1 @@
1
- import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var n={ExpandHeader:"style-module_ExpandHeader__LQwWm",Left:"style-module_Left__-N12h",Price:"style-module_Price__OT1Wh",PriceText:"style-module_PriceText__bq1pk",ArrowDown:"style-module_ArrowDown__YhRny",Rotated:"style-module_Rotated__ZPfId",CartSummary:"style-module_CartSummary__m77tn",OpenCouponCodeSummary:"style-module_OpenCouponCodeSummary__ua9wx",HideOnDesktop:"style-module_HideOnDesktop__Vs5AV",ItemsContainer:"style-module_ItemsContainer__QFKQV",DetailsContainer:"style-module_DetailsContainer__PK33m",SuccessPageDetailContainer:"style-module_SuccessPageDetailContainer__-p8kJ",Details:"style-module_Details__hWJ9o",Divider:"style-module_Divider__MNDti",ActionTextBtn:"style-module_ActionTextBtn__7yua4",NoUnderline:"style-module_NoUnderline__FphKn",Light:"style-module_Light__dIcW-",SubTotalInfo:"style-module_SubTotalInfo__JMqK9",InfoRow:"style-module_InfoRow__oAvZS",hideMb:"style-module_hideMb__j7VBr",Label:"style-module_Label__28Bij",Value:"style-module_Value__7rELF",TotalContainer:"style-module_TotalContainer__sGR7d",TitleContainer:"style-module_TitleContainer__LgmJI",Title:"style-module_Title__oMVSD",TotalPricesContainer:"style-module_TotalPricesContainer__-PsOD",TotalPrice:"style-module_TotalPrice__QBdM1",TotalTax:"style-module_TotalTax__9pA4Y",SuccessPageTotalContainer:"style-module_SuccessPageTotalContainer__NZGFF",AppliedCoupon:"style-module_AppliedCoupon__UNo1h",AppliedCouponBgGray:"style-module_AppliedCouponBgGray__MYoYu",NotClosed:"style-module_NotClosed__E-N9z",CouponCode:"style-module_CouponCode__UKPmf",ClearCoupon:"style-module_ClearCoupon__CBAzl",NotificationContainer:"style-module_NotificationContainer__AXfJT",CheckoutNoteContainer:"style-module_CheckoutNoteContainer__d-z4m",CheckoutNoteDisplay:"style-module_CheckoutNoteDisplay__DtnXo",Success:"style-module_Success__VI2Bw",GiftLabel:"style-module_GiftLabel__cazrS",PoweredBy:"style-module_PoweredBy__DKBJF",SuccessPageCartSummary:"style-module_SuccessPageCartSummary__pjgea",OpenCouponCodeMain:"style-module_OpenCouponCodeMain__lZtb3"};e(".style-module_ExpandHeader__LQwWm {\n position: sticky;\n top: 0;\n z-index: 10;\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n padding: 0 24px;\n width: 100%;\n border-top: 1px solid var(--checkout-border-color);\n border-bottom: 1px solid var(--checkout-border-color);\n transition: border-bottom 0.3s;\n user-select: none;\n background-color: var(--checkout-primary-bg-color);\n}\n@media only screen and (min-width: 1000px) {\n .style-module_ExpandHeader__LQwWm {\n display: none;\n }\n}\n.style-module_ExpandHeader__LQwWm .style-module_Left__-N12h {\n display: flex;\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh {\n font-weight: 600;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_PriceText__bq1pk {\n font-weight: 600;\n margin-right: 8px;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny {\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny.style-module_Rotated__ZPfId {\n transform: rotate(-180deg);\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn {\n width: 100%;\n background-color: var(--checkout-card-bg-color);\n }\n .style-module_CartSummary__m77tn.style-module_OpenCouponCodeSummary__ua9wx {\n background-color: #fff;\n }\n}\n@media only screen and (min-width: 1000px) {\n .style-module_CartSummary__m77tn.style-module_HideOnDesktop__Vs5AV {\n display: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: 50vh;\n overflow-y: auto;\n margin-bottom: 24px;\n /* Track */\n /* Handle */\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: unset;\n overflow-y: unset;\n margin-bottom: 0;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar {\n width: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-track {\n box-shadow: inset 0 0 20px 20px #e3e7ef;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 20px 20px #000000;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n overflow: hidden;\n width: 100%;\n transition: height 0.3s ease-in-out;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n padding: 0 24px;\n box-shadow: 1px 2px 5px 0px rgba(0, 0, 0, 0.2);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ {\n padding: 0;\n box-shadow: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ .style-module_Details__hWJ9o {\n padding-top: 0;\n}\n.style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n overflow: hidden;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n padding-top: 24px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_Divider__MNDti {\n width: 100%;\n height: 1px;\n margin: auto;\n background-color: var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 {\n padding: 24px 0;\n border-bottom: 1px solid var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS:last-of-type {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n display: flex;\n justify-content: space-between;\n margin-top: 12px;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TitleContainer__LgmJI .style-module_Title__oMVSD {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPricesContainer__-PsOD {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPrice__QBdM1 {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalTax__9pA4Y {\n font-size: 14px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n height: 64px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF {\n height: unset;\n margin-top: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_Title__oMVSD {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_TotalPrice__QBdM1 {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_AppliedCouponBgGray__MYoYu {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n.style-module_CartSummary__m77tn .style-module_NotificationContainer__AXfJT {\n margin-bottom: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 24px;\n width: calc(100% - 2px);\n margin-left: 1px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_Title__oMVSD {\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n margin-bottom: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_CheckoutNoteDisplay__DtnXo {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m.style-module_Success__VI2Bw {\n margin-top: 0;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 0px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS {\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS span {\n margin-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n width: 100%;\n height: 50px;\n justify-content: center;\n align-items: center;\n color: var(--checkout-primary-text-color);\n display: none;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n display: flex;\n }\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF span {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n margin-right: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF a {\n display: flex;\n align-items: center;\n}\n\n.style-module_SuccessPageCartSummary__pjgea {\n background-color: #fff;\n}\n\n.style-module_OpenCouponCodeMain__lZtb3 {\n display: flex;\n}\n.style-module_OpenCouponCodeMain__lZtb3 input {\n width: calc(100% - 12px);\n}");export{n as default};
1
+ import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var n={ExpandHeader:"style-module_ExpandHeader__LQwWm",Left:"style-module_Left__-N12h",Price:"style-module_Price__OT1Wh",PriceText:"style-module_PriceText__bq1pk",ArrowDown:"style-module_ArrowDown__YhRny",Rotated:"style-module_Rotated__ZPfId",CartSummary:"style-module_CartSummary__m77tn",OpenCouponCodeSummary:"style-module_OpenCouponCodeSummary__ua9wx",HideOnDesktop:"style-module_HideOnDesktop__Vs5AV",ItemsContainer:"style-module_ItemsContainer__QFKQV",DetailsContainer:"style-module_DetailsContainer__PK33m",SuccessPageDetailContainer:"style-module_SuccessPageDetailContainer__-p8kJ",Details:"style-module_Details__hWJ9o",Divider:"style-module_Divider__MNDti",ActionTextBtn:"style-module_ActionTextBtn__7yua4",NoUnderline:"style-module_NoUnderline__FphKn",Light:"style-module_Light__dIcW-",SubTotalInfo:"style-module_SubTotalInfo__JMqK9",InfoRow:"style-module_InfoRow__oAvZS",hideMb:"style-module_hideMb__j7VBr",Label:"style-module_Label__28Bij",Value:"style-module_Value__7rELF",TotalContainer:"style-module_TotalContainer__sGR7d",TitleContainer:"style-module_TitleContainer__LgmJI",Title:"style-module_Title__oMVSD",TotalPricesContainer:"style-module_TotalPricesContainer__-PsOD",TotalPrice:"style-module_TotalPrice__QBdM1",TotalTax:"style-module_TotalTax__9pA4Y",SuccessPageTotalContainer:"style-module_SuccessPageTotalContainer__NZGFF",AppliedCoupon:"style-module_AppliedCoupon__UNo1h",AppliedCouponBgGray:"style-module_AppliedCouponBgGray__MYoYu",NotClosed:"style-module_NotClosed__E-N9z",CouponCode:"style-module_CouponCode__UKPmf",ClearCoupon:"style-module_ClearCoupon__CBAzl",NotificationContainer:"style-module_NotificationContainer__AXfJT",CheckoutNoteContainer:"style-module_CheckoutNoteContainer__d-z4m",CheckoutNoteDisplay:"style-module_CheckoutNoteDisplay__DtnXo",Success:"style-module_Success__VI2Bw",GiftLabel:"style-module_GiftLabel__cazrS",PoweredBy:"style-module_PoweredBy__DKBJF",SuccessPageCartSummary:"style-module_SuccessPageCartSummary__pjgea",OpenCouponCodeMain:"style-module_OpenCouponCodeMain__lZtb3",OpenCouponCodeMainWithMb:"style-module_OpenCouponCodeMainWithMb__DqVmh",InfoRowGiftCardMobile:"style-module_InfoRowGiftCardMobile__Kp-zh",Deneme:"style-module_Deneme__4H1Cb"};e(".style-module_ExpandHeader__LQwWm {\n position: sticky;\n top: 0;\n z-index: 10;\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n padding: 0 24px;\n width: 100%;\n border-top: 1px solid var(--checkout-border-color);\n border-bottom: 1px solid var(--checkout-border-color);\n transition: border-bottom 0.3s;\n user-select: none;\n background-color: var(--checkout-primary-bg-color);\n}\n@media only screen and (min-width: 1000px) {\n .style-module_ExpandHeader__LQwWm {\n display: none;\n }\n}\n.style-module_ExpandHeader__LQwWm .style-module_Left__-N12h {\n display: flex;\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh {\n font-weight: 600;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_PriceText__bq1pk {\n font-weight: 600;\n margin-right: 8px;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny {\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny.style-module_Rotated__ZPfId {\n transform: rotate(-180deg);\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn {\n width: 100%;\n background-color: var(--checkout-card-bg-color);\n }\n .style-module_CartSummary__m77tn.style-module_OpenCouponCodeSummary__ua9wx {\n background-color: #fff;\n }\n}\n@media only screen and (min-width: 1000px) {\n .style-module_CartSummary__m77tn.style-module_HideOnDesktop__Vs5AV {\n display: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: 50vh;\n overflow-y: auto;\n margin-bottom: 24px;\n /* Track */\n /* Handle */\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: unset;\n overflow-y: unset;\n margin-bottom: 0;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar {\n width: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-track {\n box-shadow: inset 0 0 20px 20px #e3e7ef;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 20px 20px #000000;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n overflow: hidden;\n width: 100%;\n transition: height 0.3s ease-in-out;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n padding: 0 24px;\n box-shadow: 1px 2px 5px 0px rgba(0, 0, 0, 0.2);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ {\n padding: 0;\n box-shadow: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ .style-module_Details__hWJ9o {\n padding-top: 0;\n}\n.style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n overflow: hidden;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n padding-top: 24px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_Divider__MNDti {\n width: 100%;\n height: 1px;\n margin: auto;\n background-color: var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 {\n padding: 24px 0;\n border-bottom: 1px solid var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS:last-of-type {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n display: flex;\n justify-content: space-between;\n margin-top: 12px;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TitleContainer__LgmJI .style-module_Title__oMVSD {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPricesContainer__-PsOD {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPrice__QBdM1 {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalTax__9pA4Y {\n font-size: 14px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n height: 64px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF {\n height: unset;\n margin-top: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_Title__oMVSD {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_TotalPrice__QBdM1 {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_AppliedCouponBgGray__MYoYu {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n.style-module_CartSummary__m77tn .style-module_NotificationContainer__AXfJT {\n margin-bottom: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 24px;\n width: calc(100% - 2px);\n margin-left: 1px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_Title__oMVSD {\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n margin-bottom: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_CheckoutNoteDisplay__DtnXo {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m.style-module_Success__VI2Bw {\n margin-top: 0;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 0px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS {\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS span {\n margin-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n width: 100%;\n height: 50px;\n justify-content: center;\n align-items: center;\n color: var(--checkout-primary-text-color);\n display: none;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n display: flex;\n }\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF span {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n margin-right: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF a {\n display: flex;\n align-items: center;\n}\n\n.style-module_SuccessPageCartSummary__pjgea {\n background-color: #fff;\n}\n\n.style-module_OpenCouponCodeMain__lZtb3 {\n display: flex;\n}\n.style-module_OpenCouponCodeMain__lZtb3 input {\n width: calc(100% - 12px);\n}\n.style-module_OpenCouponCodeMain__lZtb3.style-module_OpenCouponCodeMainWithMb__DqVmh {\n margin-bottom: 12px;\n}\n\n.style-module_InfoRowGiftCardMobile__Kp-zh {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh:last-of-type {\n margin-bottom: 0;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h.style-module_AppliedCoupon__UNo1h {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n\n.style-module_Deneme__4H1Cb {\n margin-top: 10px;\n}");export{n as default};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as n}from"mobx-react-lite";import{ErrorType as a}from"../../model.js";import{PayPalScriptProvider as o,usePayPalScriptReducer as l,PayPalButtons as i}from"@paypal/react-paypal-js";import c from"../../../../store/checkout/index.js";import s from"./style.module.scss.js";var d=n((function(n){var d=n.vm;if(!d.payPalClientIdResponse)return null;var p={"client-id":d.payPalClientIdResponse.clientId,currency:d.checkout.currencyCode,"merchant-id":d.payPalClientIdResponse.merchantId};return r.createElement(r.Fragment,null,r.createElement("div",null,r.createElement(o,{options:p},r.createElement((function(){return l()[0].isPending?r.createElement("div",{className:s.Main},r.createElement("div",{className:s.loader})):r.createElement(i,{style:{layout:"horizontal"},onClick:function(e,t){return d.checkPaypalButtonAvailable()?t.resolve():t.reject()},onCancel:function(e,t){d.paypalOrderResponse&&(window.location.href="".concat(d.paypalOrderResponse.failUrl)),d.isStepLoading=!1},createOrder:function(r,n){return e(void 0,void 0,void 0,(function(){var e,r,n;return t(this,(function(t){switch(t.label){case 0:return d.isDigitalOnly?[4,d.onCompleteDigitalOnlyPaymentClick()]:[3,2];case 1:return t.sent(),[3,4];case 2:return[4,d.onCompletePaymentClick()];case 3:t.sent(),t.label=4;case 4:return[4,c.createPayPalOrder({input:{cartId:d.checkout.id,paymentGatewayId:(null===(r=d.checkout.selectedPaymentGateway)||void 0===r?void 0:r.id)||""}})];case 5:return!(e=t.sent()).isSuccess&&e.errors.length&&(d.error={type:a.PAYMENT_ERROR,data:e.errors[0]}),e.data&&(d.paypalOrderResponse=e.data),[2,e&&(null===(n=e.data)||void 0===n?void 0:n.sessionToken)||""]}}))}))},onApprove:function(r,n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d.paypalOrderResponse&&(window.location.href="".concat(d.paypalOrderResponse.returnUrl)),[2]}))}))}})}),null))))}));export{d as PayPal};
1
+ import{__assign as e,__awaiter as t,__generator as n}from'./../../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as a}from"mobx-react-lite";import{ErrorType as o}from"../../model.js";import{PayPalScriptProvider as l,usePayPalScriptReducer as i,PayPalButtons as c}from"@paypal/react-paypal-js";import s from"../../../../store/checkout/index.js";import d from"./style.module.scss.js";var u=a((function(a){var u=a.vm;if(!u.payPalClientIdResponse)return null;var p={"client-id":u.payPalClientIdResponse.clientId,currency:u.checkout.currencyCode,"merchant-id":u.payPalClientIdResponse.merchantId};return r.createElement(r.Fragment,null,r.createElement("div",null,r.createElement(l,{options:p},r.createElement((function(){var a,l,p,m,v=function(e){var t,n=null===(t=u.checkout.selectedPaymentGateway)||void 0===t?void 0:t.settings;if(n)return n.find((function(t){return t.label===e}))};return i()[0].isPending?r.createElement("div",{className:d.Main},r.createElement("div",{className:d.loader})):r.createElement(c,{style:e(e(e(e({layout:"horizontal"},v("color")?{color:null===(a=v("color"))||void 0===a?void 0:a.value}:{}),v("shape")?{shape:null===(l=v("shape"))||void 0===l?void 0:l.value}:{}),v("label")?{label:null===(p=v("label"))||void 0===p?void 0:p.value}:{}),v("tagline")?{tagline:"true"===(null===(m=v("tagline"))||void 0===m?void 0:m.value)}:{}),onClick:function(e,t){return u.checkPaypalButtonAvailable()?t.resolve():t.reject()},onCancel:function(e,t){u.paypalOrderResponse&&(window.location.href="".concat(u.paypalOrderResponse.failUrl)),u.isStepLoading=!1},createOrder:function(e,r){return t(void 0,void 0,void 0,(function(){var e,t,r;return n(this,(function(n){switch(n.label){case 0:return u.isDigitalOnly?[4,u.onCompleteDigitalOnlyPaymentClick()]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,u.onCompletePaymentClick()];case 3:n.sent(),n.label=4;case 4:return[4,s.createPayPalOrder({input:{cartId:u.checkout.id,paymentGatewayId:(null===(t=u.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)||""}})];case 5:return!(e=n.sent()).isSuccess&&e.errors.length&&(u.error={type:o.PAYMENT_ERROR,data:e.errors[0]}),e.data&&(u.paypalOrderResponse=e.data),[2,e&&(null===(r=e.data)||void 0===r?void 0:r.sessionToken)||""]}}))}))},onApprove:function(e,r){return t(void 0,void 0,void 0,(function(){return n(this,(function(e){return u.paypalOrderResponse&&(window.location.href="".concat(u.paypalOrderResponse.returnUrl)),[2]}))}))}})}),null))))}));export{u as PayPal};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import n from"next/link.js";import a from"react-tooltip";import s,{CheckoutStep as l}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as f}from"./steps/step-payment/index.js";import{CouponErrorCode as g,Coupon as v,CartSummary as h}from"./components/cart-summary/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as E}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-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"@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{ContactForm as y}from"../../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{StepSuccess as x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import j from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import N from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import b,{Step as O}from"./components/step-container/index.js";import{StockError as S}from"./components/error/stock-error/index.js";import{FullscreenLoading as F}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as U}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import _ from"./components/offer-product/offer-arrows/index.js";import H from"./components/offer-product/useCampaignOffer.js";var G=r((function(e){var t,r,n,m,p,u,f,g=e.checkout,v=e.checkoutSettings,y=e.customizationProps,b=e.returnPolicy,O=e.privacyPolicy,M=e.termsOfService,T=e.imprint,w=e.shippingPolicy,G=d().t,X=i(),K=o.useState((function(){return new s(g,v,X,b,O,M,T,w,G,y||{})}))[0],Z=H(K),$=Z.setShowDetailPage,ee=Z.setActiveIndex,te=Z.setIsActiveOverlay,oe=Z.handlePrev,re=Z.handleNext,ie=Z.isPopupClosedIndexPage,ne=Z.isPopupShowIndexPage,ae=Z.isShowSuccessPageMiddlePhase,se=Z.activeIndex;o.useMemo((function(){return Date.now()}),[]);return K.step,l.PAYMENT,o.useEffect((function(){K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&X.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==l.SUCCESS&&U.beginCheckout(K.checkout),U.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==e?void 0:e.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(y)}),[y]),K.isCheckoutLoaded&&K.store.customerStore.initialized?K.checkout.hasCustomer&&(null===(t=K.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=K.checkout.customer)||void 0===r?void 0:r.id)?(X.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(n=K.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+G("checkout-page:securePayment"),pageDescription:G("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},ae?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(m=K.customizationProps)||void 0===m?void 0:m.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:K.customizationProps.logo,sizes:"360px"})):(null===(p=K.merchantSettings)||void 0===p?void 0:p.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:K.merchantSettings.logo,sizes:"360px"})):(null===(u=K.merchantSettings)||void 0===u?void 0:u.merchantName)||""),o.createElement("div",{className:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(R,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},G("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},G("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:V.OfferButton,isLine:!0,text:G("checkout-page:actions.goOrderDetailPage"),onClick:function(){$(!1)}}))),o.createElement("div",null,K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},desktopMiddlePhase:!0,step:K.step})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{vm:K,activeIndex:se}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(Y,{vm:K}),K.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(S,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==l.SUCCESS&&o.createElement(h,{vm:K,allowExpand:!0}),K.step===l.SUCCESS?o.createElement(x,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(L,{vm:K}),ne&&o.createElement("div",{className:[V.MiddlePhaseOverlay,ne?V.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:[V.CampaignOfferMain,ne?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},step:K.step,isPopupClosed:ie,isPopupShow:ne,closePopup:function(){return te(!1)},showPopup:function(){return te(!0)}})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ne,vm:K,activeIndex:se})),K.isCouponCodeRequirementOpen&&o.createElement(W,{vm:K}),o.createElement(q,{vm:K}))),o.createElement("div",{className:V.Space})),o.createElement(J,{vm:K}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(h,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!K.policyModalText&&o.createElement(k,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""}}),K.isContactModalVisible&&o.createElement(Q,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(j,{vm:K,visible:K.mpVM.isOtpModalVisible,type:K.mpVM.otpModalType,onClose:K.mpVM.hideOtpModal}),K.mpVM.isResponseModalVisible&&o.createElement(C,{visible:K.mpVM.isResponseModalVisible,text:K.mpVM.mfsResponseModalText,onClose:K.mpVM.onResponseModalClose}),K.mpVM.isSuccessModalVisible&&o.createElement(N,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(F,null)})),Y=r((function(e){var t,r,i,a,s=e.vm,l=d().t;return o.createElement("div",{className:V.Header},o.createElement(n,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(r=s.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},l("checkout-page:alreadyHaveAnAccount")),o.createElement(n,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:V.LoginBtn},l("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},s.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),W=r((function(e){var t=e.vm,r=d().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),l=s[0],c=s[1],m=o.useMemo((function(){switch(l){case g.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case g.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[l]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(M,{type:"warning",title:r("checkout-page:giftCodeErrorTitle"),content:m,onClose:function(){a(!1),c(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:n?12:0}},o.createElement(v,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:c})))})),q=r((function(e){var t=e.vm,r=d().t,i=o.useMemo((function(){switch(t.step){case l.INFO:return o.createElement(p,{vm:t});case l.SHIPPING:return o.createElement(u,{vm:t});case l.PAYMENT:return o.createElement(f,{vm:t});case l.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),n=[new O(r("checkout-page:address"),t.step===l.INFO,t.step!==l.INFO,t.step!==l.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(X,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==l.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(X,{vm:t})):void 0),new O(r("checkout-page:payment"),t.step===l.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new O(r("checkout-page:shipping"),t.step===l.SHIPPING,t.step===l.PAYMENT,t.step===l.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement(K,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===l.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:n,stepContent:i})})),X=r((function(e){var t,r,i,n,a,s,l,c,m,p=e.vm,u=d().t,f=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=p.checkout.billingAddress)||void 0===r?void 0:r.lastName)||""):((null===(i=p.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(l=p.checkout.shippingAddress)||void 0===l?void 0:l.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):m(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),J=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:imprint"),t.policyModalText=t.imprint}},r("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},r("checkout-page:shippingPolicy"))))})),Q=r((function(r){var i,n,a,s=r.vm,l=r.setVisible,c=d().t,m=o.useState(!1),p=m[0],u=m[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(i=s.checkout.customer)||void 0===i?void 0:i.email)||"",h.firstName=(null===(n=s.checkout.customer)||void 0===n?void 0:n.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var E=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return g?[2,l(!1)]:(u(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&v(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(k,{title:c("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(M,{type:"success",title:c("checkout-page:contactFormSent"),content:c("checkout-page:contactFormDescription")})),o.createElement(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:c(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:E})),onClose:function(){return l(!1)}})}));export{G as default};
1
+ import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import n from"next/link.js";import a from"react-tooltip";import s,{CheckoutStep as l}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as f}from"./steps/step-payment/index.js";import{CouponErrorCode as g,Coupon as v,CartSummary as h}from"./components/cart-summary/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as E}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-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"@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{ContactForm as y}from"../../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{StepSuccess as x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import j from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import N from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import O,{Step as b}from"./components/step-container/index.js";import{StockError as M}from"./components/error/stock-error/index.js";import{FullscreenLoading as S}from"./components/fullscreen-loading/index.js";import F from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as U}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import _ from"./components/offer-product/offer-arrows/index.js";import H from"./components/offer-product/useCampaignOffer.js";import G from"../../hooks/useDimension.js";var Y=r((function(e){var t,r,n,m,p,u,f,g=e.checkout,v=e.checkoutSettings,y=e.customizationProps,O=e.returnPolicy,b=e.privacyPolicy,F=e.termsOfService,T=e.imprint,w=e.shippingPolicy,G=d().t,Y=i();console.log("checkout.campaignOffers 1",g.campaignOffers);var K=o.useState((function(){return new s(g,v,Y,O,b,F,T,w,G,y||{})}))[0];console.log("checkout.campaignOffers 2",g.campaignOffers),console.log("vm.campaignOffers",K.campaignOffers);var J=H(K),$=J.setShowDetailPage,ee=J.setActiveIndex,te=J.setIsActiveOverlay,oe=J.handlePrev,re=J.handleNext,ie=J.isPopupClosedIndexPage,ne=J.isPopupShowIndexPage,ae=J.isShowSuccessPageMiddlePhase,se=J.activeIndex;o.useMemo((function(){return Date.now()}),[]);return K.step,l.PAYMENT,o.useEffect((function(){K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&Y.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==l.SUCCESS&&U.beginCheckout(K.checkout),U.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==e?void 0:e.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(y)}),[y]),K.isCheckoutLoaded&&K.store.customerStore.initialized?K.checkout.hasCustomer&&(null===(t=K.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=K.checkout.customer)||void 0===r?void 0:r.id)?(Y.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(n=K.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+G("checkout-page:securePayment"),pageDescription:G("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},ae?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(m=K.customizationProps)||void 0===m?void 0:m.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:K.customizationProps.logo,sizes:"360px"})):(null===(p=K.merchantSettings)||void 0===p?void 0:p.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:K.merchantSettings.logo,sizes:"360px"})):(null===(u=K.merchantSettings)||void 0===u?void 0:u.merchantName)||""),o.createElement("div",{className:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(R,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},G("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},G("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:V.OfferButton,isLine:!0,text:G("checkout-page:actions.goOrderDetailPage"),onClick:function(){$(!1)}}))),o.createElement("div",null,K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},desktopMiddlePhase:!0,step:K.step})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{vm:K,activeIndex:se}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(W,{vm:K}),K.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(M,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==l.SUCCESS&&o.createElement(h,{vm:K,allowExpand:!0}),K.step===l.SUCCESS?o.createElement(x,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(L,{vm:K}),ne&&o.createElement("div",{className:[V.MiddlePhaseOverlay,ne?V.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:[V.CampaignOfferMain,ne?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},step:K.step,isPopupClosed:ie,isPopupShow:ne,closePopup:function(){return te(!1)},showPopup:function(){return te(!0)}})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ne,vm:K,activeIndex:se})),K.isCouponCodeRequirementOpen&&o.createElement(q,{vm:K}),o.createElement(X,{vm:K}))),o.createElement("div",{className:V.Space})),o.createElement(Q,{vm:K}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(h,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!K.policyModalText&&o.createElement(k,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""}}),K.isContactModalVisible&&o.createElement(Z,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(j,{vm:K,visible:K.mpVM.isOtpModalVisible,type:K.mpVM.otpModalType,onClose:K.mpVM.hideOtpModal}),K.mpVM.isResponseModalVisible&&o.createElement(C,{visible:K.mpVM.isResponseModalVisible,text:K.mpVM.mfsResponseModalText,onClose:K.mpVM.onResponseModalClose}),K.mpVM.isSuccessModalVisible&&o.createElement(N,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(S,null)})),W=r((function(e){var t,r,i,a,s=e.vm,l=d().t;return o.createElement("div",{className:V.Header},o.createElement(n,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(r=s.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},l("checkout-page:alreadyHaveAnAccount")),o.createElement(n,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:V.LoginBtn},l("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},s.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),q=r((function(e){var t=e.vm,r=d().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),l=s[0],c=s[1],m=G().isMobile,p=o.useMemo((function(){switch(l){case g.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case g.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[l]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(F,{type:"warning",title:r("checkout-page:giftCodeErrorTitle"),content:p,onClose:function(){a(!1),c(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:n?12:0}},o.createElement(v,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:c,showOnlyMobile:!0,isMobile:m})))})),X=r((function(e){var t=e.vm,r=d().t,i=o.useMemo((function(){switch(t.step){case l.INFO:return o.createElement(p,{vm:t});case l.SHIPPING:return o.createElement(u,{vm:t});case l.PAYMENT:return o.createElement(f,{vm:t});case l.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),n=[new b(r("checkout-page:address"),t.step===l.INFO,t.step!==l.INFO,t.step!==l.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(K,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==l.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0),new b(r("checkout-page:payment"),t.step===l.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new b(r("checkout-page:shipping"),t.step===l.SHIPPING,t.step===l.PAYMENT,t.step===l.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement(J,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===l.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(J,{vm:t})):void 0)),o.createElement(O,{steps:n,stepContent:i})})),K=r((function(e){var t,r,i,n,a,s,l,c,m,p=e.vm,u=d().t,f=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=p.checkout.billingAddress)||void 0===r?void 0:r.lastName)||""):((null===(i=p.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(l=p.checkout.shippingAddress)||void 0===l?void 0:l.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),J=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):m(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),Q=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:imprint"),t.policyModalText=t.imprint}},r("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},r("checkout-page:shippingPolicy"))))})),Z=r((function(r){var i,n,a,s=r.vm,l=r.setVisible,c=d().t,m=o.useState(!1),p=m[0],u=m[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(i=s.checkout.customer)||void 0===i?void 0:i.email)||"",h.firstName=(null===(n=s.checkout.customer)||void 0===n?void 0:n.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var E=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return g?[2,l(!1)]:(u(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&v(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(k,{title:c("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(F,{type:"success",title:c("checkout-page:contactFormSent"),content:c("checkout-page:contactFormDescription")})),o.createElement(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:c(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:E})),onClose:function(){return l(!1)}})}));export{Y as default};
@@ -67,6 +67,7 @@ export default class CheckoutViewModel {
67
67
  error?: CheckoutError | null;
68
68
  couponError?: string | null;
69
69
  successTransaction?: IkasOrderTransaction;
70
+ successTransactions?: IkasOrderTransaction[];
70
71
  mpVM: MasterPassModel;
71
72
  showTestModal: boolean;
72
73
  t: TFunction;
@@ -83,6 +84,7 @@ export default class CheckoutViewModel {
83
84
  value: string;
84
85
  }[];
85
86
  get installmentPrice(): number | null | undefined;
87
+ get giftCardTotalPrice(): number;
86
88
  get installmentExtraPrice(): number | undefined;
87
89
  get finalPrice(): number;
88
90
  get hasStockError(): boolean;
@@ -139,6 +141,7 @@ export default class CheckoutViewModel {
139
141
  onShippingMethodChange: (shippingMethod: IkasAvailableShippingMethod) => Promise<void>;
140
142
  onStockLocationChange: (location: IkasStockLocation) => Promise<void>;
141
143
  onCouponCodeApply: () => Promise<void>;
144
+ removeGiftCardLine: (giftCardId: string | null) => Promise<void>;
142
145
  getAvailableShippingZones: () => Promise<void>;
143
146
  onSelectedShippingAddressIdChange: (value: string) => void;
144
147
  onSelectedBillingAddressIdChange: (value: string) => void;