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

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.
@@ -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};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-form-data-input/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-display-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{CreditCardForm as d}from"../../../components/credit-card-form/index.js";import{Installments as m}from"./installments/index.js";import i from"../../../components/select-box/index.js";import s from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as l}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import u from"next/dynamic";import y from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as f}from"../../../components/toggle/index.js";import v from"../../../components/select-box/style.module.scss.js";import j from"../../../components/master-pass/payment-gateway/svg/master-card.js";import E from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=u((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=u((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),h=u((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),C=t((function(t){var u=t.vm,C=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:s.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?l(e.amount,u.checkout.currencyCode,u.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+C("checkout-page:paymentMethodDiscount"):" "+C("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code||"STRIPE_EU"===e.code},M=function(){var t,a=u.selectedPaymentGatewayIndex===u.klarnaPaymentGatewayIndex;return u.klarnaPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(a?v.Selected:""),onClick:function(){u.setPaymentGateway(u.klarnaPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent},e.createElement(f,{value:a,label:u.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:v.RightContent},(null===(t=u.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(u.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!u.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:u.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?v.BottomContent:""," ").concat(a?"":s.Hidden)},e.createElement(h,{vm:u}),u.klarnaError&&e.createElement("div",{className:s.ErrorMessage},u.klarnaError.data)))):null},T=function(){var t=u.selectedPaymentGatewayIndex===u.adyenPaymentGatewayIndex;return u.adyenPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(v.AdyenSelectBox),onClick:function(){u.setPaymentGateway(u.adyenPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent}),e.createElement("div",{className:"".concat(t?v.BottomContent:""," "),style:{paddingTop:0}},e.createElement(w,{vm:u,isSelected:t})))):null},b=function(){var t,a=u.selectedPaymentGatewayIndex===u.payPalPaymentGatewayIndex;return u.payPalPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(a?v.Selected:""),onClick:function(){u.setPaymentGateway(u.payPalPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent},e.createElement(f,{value:a,label:u.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:v.RightContent},(null===(t=u.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(u.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!u.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:u.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!u.mpVM.cards.length&&u.mpVM.cards.map((function(t,o){var r,d=u.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),l=e.createElement("button",{className:s.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),u.mpVM.deleteCard({store:u.store,checkout:u.checkout,card:t})}},C("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),f=c("9"),v=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:s.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(j,null),f&&e.createElement(E,null)),t.Name," ",t.Value1),P=(null==d?void 0:d.id)&&d.paymentMethodType===a.CREDIT_CARD&&d.type===n.INTERNAL?u.installmentInfo&&e.createElement(m,{vm:u}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=u.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:v,rightContent:l,bottomContent:P,onClick:function(){var e;(null===(e=u.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(u.checkout.selectedPaymentGateway=null,u.cardData=new y,u.installmentInfo=void 0,u.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&u.checkout.totalFinalPrice&&u.retrieveInstallmentInfo({input:{orderId:u.checkout.id,binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:u.checkout.totalFinalPrice,currencyCode:u.checkout.currencyCode}}))}})})),u.paymentGateways.filter((function(e){return"in-store"!==u.deliveryMethod&&!u.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&u.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&u.adyenPaymentGateway)return T();if(function(e){return"PAYPAL"===e.code}(t)&&u.payPalPaymentGateway)return b();var l=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:u,pg:t}),u.stripeError&&e.createElement("div",{className:s.ErrorMessage},u.stripeError.data)):e.createElement("div",null,e.createElement(d,{vm:u}),u.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:u}),u.installmentInfo&&e.createElement(m,{vm:u}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":C("checkout-page:creditCard"):t.name,isSelected:u.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:l,onClick:function(){u.selectedPaymentGatewayIndex!==o&&(u.setPaymentGateway(o),u.mpVM.selectedCard=void 0)}})})))}));export{C as PaymentGateways};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/customer-form-data-input/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/order-transaction-with-prices/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/storefront-popup/storefront-popup-display-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{CreditCardForm as d}from"../../../components/credit-card-form/index.js";import{Installments as m}from"./installments/index.js";import i from"../../../components/select-box/index.js";import s from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as l}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import u from"next/dynamic";import y from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as f}from"../../../components/toggle/index.js";import v from"../../../components/select-box/style.module.scss.js";import j from"../../../components/master-pass/payment-gateway/svg/master-card.js";import E from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=u((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=u((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),h=u((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),C=t((function(t){var u=t.vm,C=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:s.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?l(e.amount,u.checkout.currencyCode,u.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+C("checkout-page:paymentMethodDiscount"):" "+C("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code||"STRIPE_EU"===e.code},M=function(){var t,a=u.selectedPaymentGatewayIndex===u.klarnaPaymentGatewayIndex;return u.klarnaPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(a?v.Selected:""),onClick:function(){u.setPaymentGateway(u.klarnaPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent},e.createElement(f,{value:a,label:u.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:v.RightContent},(null===(t=u.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(u.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!u.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:u.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?v.BottomContent:""," ").concat(a?"":s.Hidden)},e.createElement(h,{vm:u}),u.klarnaError&&e.createElement("div",{className:s.ErrorMessage},u.klarnaError.data)))):null},T=function(){var t=u.selectedPaymentGatewayIndex===u.adyenPaymentGatewayIndex;return u.adyenPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(v.AdyenSelectBox),onClick:function(){u.setPaymentGateway(u.adyenPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent}),e.createElement("div",{className:"".concat(t?v.BottomContent:""," "),style:{paddingTop:0}},e.createElement(w,{vm:u,isSelected:t})))):null},b=function(){var t,a=u.selectedPaymentGatewayIndex===u.payPalPaymentGatewayIndex;return u.payPalPaymentGateway?e.createElement("div",{className:v.SelectBoxContainer},e.createElement("div",{className:"".concat(v.SelectBox," ").concat(a?v.Selected:""),onClick:function(){u.setPaymentGateway(u.payPalPaymentGatewayIndex),u.mpVM.selectedCard=void 0}},e.createElement("div",{className:v.TopContent},e.createElement(f,{value:a,label:u.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:v.RightContent},(null===(t=u.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(u.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!u.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:u.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!u.mpVM.cards.length&&u.mpVM.cards.map((function(t,o){var r,d=u.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),l=e.createElement("button",{className:s.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),u.mpVM.deleteCard({store:u.store,checkout:u.checkout,card:t})}},C("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),f=c("9"),v=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:s.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(j,null),f&&e.createElement(E,null)),t.Name," ",t.Value1),P=(null==d?void 0:d.id)&&d.paymentMethodType===a.CREDIT_CARD&&d.type===n.INTERNAL?u.installmentInfo&&e.createElement(m,{vm:u}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=u.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:v,rightContent:l,bottomContent:P,onClick:function(){var e;(null===(e=u.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(u.checkout.selectedPaymentGateway=null,u.cardData=new y,u.installmentInfo=void 0,u.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&u.checkout.totalFinalPrice&&u.retrieveInstallmentInfo({input:{orderId:u.checkout.id,binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:u.checkout.totalFinalPrice,currencyCode:u.checkout.currencyCode}}))}})})),u.paymentGateways.filter((function(e){return"in-store"!==u.deliveryMethod&&!u.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&u.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&u.adyenPaymentGateway)return T();if(function(e){return"PAYPAL"===e.code}(t)&&u.payPalPaymentGateway)return b();var l=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:u,pg:t}),u.stripeError&&e.createElement("div",{className:s.ErrorMessage},u.stripeError.data)):e.createElement("div",null,e.createElement(d,{vm:u}),u.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:u}),u.installmentInfo&&e.createElement(m,{vm:u}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?t.name:C("checkout-page:creditCard"):t.name,isSelected:u.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:l,onClick:function(){u.selectedPaymentGatewayIndex!==o&&(u.setPaymentGateway(o),u.mpVM.selectedCard=void 0)}})})))}));export{C as PaymentGateways};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.3",
3
+ "version": "6.1.0-beta.4",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -21,11 +21,11 @@
21
21
  "swiper": "11.0.6"
22
22
  },
23
23
  "devDependencies": {
24
- "@ikas/storefront-api": "^6.1.0-beta.3",
25
- "@ikas/storefront-config": "^6.1.0-beta.3",
26
- "@ikas/storefront-model-functions": "^6.1.0-beta.3",
27
- "@ikas/storefront-models": "^6.1.0-beta.3",
28
- "@ikas/storefront-providers": "^6.1.0-beta.3",
24
+ "@ikas/storefront-api": "^6.1.0-beta.4",
25
+ "@ikas/storefront-config": "^6.1.0-beta.4",
26
+ "@ikas/storefront-model-functions": "^6.1.0-beta.4",
27
+ "@ikas/storefront-models": "^6.1.0-beta.4",
28
+ "@ikas/storefront-providers": "^6.1.0-beta.4",
29
29
  "@ikas/localized-address": "1.0.0-beta.6",
30
30
  "@adyen/adyen-web": "^5.57.0",
31
31
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -60,11 +60,11 @@
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@ikas/localized-address": "1.0.0-beta.6",
63
- "@ikas/storefront-api": "^6.1.0-beta.3",
64
- "@ikas/storefront-config": "^6.1.0-beta.3",
65
- "@ikas/storefront-model-functions": "^6.1.0-beta.3",
66
- "@ikas/storefront-models": "^6.1.0-beta.3",
67
- "@ikas/storefront-providers": "^6.1.0-beta.3",
63
+ "@ikas/storefront-api": "^6.1.0-beta.4",
64
+ "@ikas/storefront-config": "^6.1.0-beta.4",
65
+ "@ikas/storefront-model-functions": "^6.1.0-beta.4",
66
+ "@ikas/storefront-models": "^6.1.0-beta.4",
67
+ "@ikas/storefront-providers": "^6.1.0-beta.4",
68
68
  "mobx": "^6.1.3",
69
69
  "mobx-react-lite": "^3.1.5",
70
70
  "next": "12.2.0",