@ikas/storefront 6.1.0-beta.274 → 6.1.0-beta.276
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{makeAutoObservable as e}from"mobx";var t=function(){function t(t){void 0===t&&(t={});var r=this;this.installmentCount=1,this.toInput=function(){var e=r.expirationDate.split(" / "),t=parseInt(e[0]),
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";var t,r=(t=[0,2,4,6,8,1,3,5,7,9],function(e){for(var r,a=e.replace(/\D/g,""),n=a.length,i=1,o=0;n;)r=parseInt(a.charAt(--n),10),o+=(i^=1)?t[r]:r;return!!o&&o%10==0});function a(e){var t=null==e?void 0:e.match(/^(\d{2})\s*\/\s*(\d{2})$/);if(!t)return!1;var r=parseInt(t[1],10),a=parseInt(t[2],10);if(r<1||r>12)return!1;var n=2e3+a,i=new Date,o=i.getFullYear(),u=i.getMonth()+1;return n>o||n===o&&r>=u}var n=function(){function t(t){void 0===t&&(t={});var r=this;this.installmentCount=1,this.toInput=function(){var e=r.expirationDate.split(" / "),t=parseInt(e[0]),a=parseInt(e[1]);return{cardNumber:r.cardNumber.split(" ").join(""),cardHolderName:r.cardHolderName,cvv:r.cvv,expiredMonth:t,expiredYear:a,installmentCount:r.installmentCount,threeDSecure:r.threeDSecure}},this.cardNumber=t.cardNumber||"",this.cardHolderName=t.cardHolderName||"",this.expirationDate=t.expirationDate||"",this.cvv=t.cvv||"",this.installmentCount=t.installmentCount||1,this.threeDSecure=t.threeDSecure||!1,e(this)}return Object.defineProperty(t.prototype,"validationResult",{get:function(){var e,t,n=null!==(t=null===(e=this.cardNumber)||void 0===e?void 0:e.replace(/\D/g,""))&&void 0!==t?t:"";return{cardNumber:!!this.cardNumber&&(19===this.cardNumber.length||17===this.cardNumber.length)&&r(n),cardHolderName:!!this.cardHolderName,expirationDate:!!this.expirationDate&&7===this.expirationDate.length&&a(this.expirationDate),cvv:!!this.cvv}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return Object.values(this.validationResult).every((function(e){return e}))},enumerable:!1,configurable:!0}),t}();export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import s from"../../style.module.scss.js";import r from"../select-box/index.js";import{AddressForm as d}from"../address-form/index.js";import{Checkbox as i}from"../checkbox/index.js";import{FormItem as o}from"../form-item/index.js";import{FormItemType as a}from"../form-item/model.js";import n from"./style.module.scss.js";import l from"../../styles/common.module.scss.js";import{Button as c}from"../button/index.js";import{IkasStorefrontConfig as m}from"@ikas/storefront-config";import{useTranslation as u}from"../../../../utils/i18n.js";import v from"../delivery-methods/index.js";import{CheckoutStep as p}from"../../model.js";var h=t((function(t){var d,i=t.vm,o=t.showBillingAddressOnShippingStep,a=u().t,h=e.useMemo((function(){return e.createElement("div",null,e.createElement(g,{vm:i}),e.createElement(k,{vm:i}))}),[i]),C=e.useMemo((function(){return e.createElement("div",null,e.createElement(E,{vm:i}))}),[i]),f=e.useState("-1"),A=f[0],y=f[1];e.useEffect((function(){i.vm.checkout.stockLocationId&&y(i.vm.checkout.stockLocationId)}),[]);var b=function(e){if(!e.address)return"";var t=[];return e.address.address&&t.push(e.address.address),e.address.postalCode&&t.push(e.address.postalCode),e.address.district&&e.address.district.name&&t.push(e.address.district.name),e.address.city&&e.address.city.name&&t.push(e.address.city.name),e.address.state&&e.address.state.name&&"Default"!==e.address.state.name&&t.push(e.address.state.name),e.address.country&&e.address.country.name&&t.push(e.address.country.name),t.join(", ")};return e.createElement(e.Fragment,null,!!m.getPickupStockLocationIds()&&!i.vm.isDigitalOnly&&i.vm.availableStockLocations.length>0&&i.vm.step!==p.PAYMENT&&!o&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:deliveryMethod"))),e.createElement(v,{deliveryMethod:i.vm.deliveryMethod,onClick:function(e){"address"===e&&y("-1"),i.vm.onDeliveryMethodChange(e)}})),e.createElement("div",{className:l.FormSectionTitle},"address"===i.vm.deliveryMethod?e.createElement("div",{className:l.Title},i.editingCustomerAddress?a("checkout-page:editAddress"):"billing"===i.addressType?a("checkout-page:billingAddress"):a("checkout-page:shippingAddress")):i.vm.step===p.PAYMENT||o?e.createElement("div",{className:l.Title},a("checkout-page:billingAddress")):e.createElement("div",{className:l.Title},a("checkout-page:pickUpLocation"),e.createElement("span",{className:n.ErrorMessage},i.vm.isErrorsVisible&&!i.vm.checkout.stockLocationId&&a("checkout-page:errorPickupLocationRequired"))),!!i.editingCustomerAddress&&e.createElement("div",{className:n.CancelEdit,onClick:i.onCancelEditAddressClick},a("checkout-page:actions.cancel"))),!!i.vm.store.customerStore.customer&&!i.editingCustomerAddress&&("address"===i.vm.deliveryMethod||i.vm.step===p.PAYMENT&&"in-store"===i.vm.deliveryMethod||o)&&e.createElement("div",{className:s.RowPB},null===(d=i.vm.customerAddresses)||void 0===d?void 0:d.map((function(t){return e.createElement(r,{key:t.id,label:t.title||"",isSelected:t.id===i.selectedAddressId,rightContent:e.createElement("div",{onClick:function(){return i.onEditAddressClick(t)}},a("checkout-page:actions.edit")),bottomContent:e.createElement("div",{className:n.AddressContent},e.createElement("div",{className:n.AddressText},t.firstName," ",t.lastName),e.createElement("div",{className:n.AddressText},t.addressText)),bottomContentVisible:!0,hasError:!t.isValidAddress,errorText:a("checkout-page:missingAddressFields"),onClick:function(){return t.id!==i.selectedAddressId&&i.onAddressSelect(t)}})})),e.createElement(r,{label:a("checkout-page:newAddress"),isSelected:"-1"===i.selectedAddressId,bottomContent:h,onClick:function(){return"-1"!==i.selectedAddressId&&i.onAddressSelect()}})),i.vm.store.customerStore.customer||i.vm.step!==p.INFO||"address"!==i.vm.deliveryMethod?(o&&!i.vm.store.customerStore.customer||i.vm.step===p.PAYMENT&&!i.vm.store.customerStore.customer)&&h:h,"in-store"===i.vm.deliveryMethod&&!o&&e.createElement("div",{className:s.RowPB},i.vm.stockLocations.map((function(t){return function(e){return e.address&&e.address.address&&e.address.city&&e.address.country&&i.vm.availableStockLocations.find((function(t){return t.id===e.id}))}(t)&&e.createElement(r,{key:t.id,label:t.name||"",isSelected:A===t.id,bottomContent:e.createElement("div",null,e.createElement("div",{className:n.AddressText},b(t)),t.deliveryTime&&e.createElement("div",{className:n.DeliveryTime},a("checkout-page:stockLocation.deliveryTime.".concat(t.deliveryTime)))),bottomContentVisible:!0,onClick:function(){i.vm.onStockLocationChange(t),y(t.id)}})}))),"in-store"===i.vm.deliveryMethod&&i.vm.step!==p.PAYMENT&&!o&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:recipientsInfo"))),C),!!i.editingCustomerAddress&&e.createElement(g,{vm:i}),!!i.editingCustomerAddress&&e.createElement("div",{className:n.EditAddressActions},e.createElement(c,{style:{width:"100%"},text:a("checkout-page:deleteAddress"),isLine:!0,isLoading:i.isDeleteAddressLoading,isDisabled:i.isEditAddressLoading,onClick:i.onDeleteAddressClick}),e.createElement(c,{style:{width:"100%",marginTop:i.vm.store.customerStore.customer?"0px":"32px"},text:a("checkout-page:actions.save"),isLoading:i.isEditAddressLoading,isDisabled:i.isDeleteAddressLoading,onClick:i.onSaveAddressClick})))})),g=t((function(t){var s,r=t.vm,i=e.useRef(null),o=r.isEditAddressErrorsVisible||r.vm.isErrorsVisible;e.useEffect((function(){o&&i.current&&i.current.scrollIntoView({behavior:"smooth",block:"center"})}),[o]);var a=(!!(null===(s=r.vm.checkout.customer)||void 0===s?void 0:s.isGuestCheckout)||!!r.vm.store.customerStore.customer)&&r.vm.isCorporateInvoiceVisible&&!!r.vm.checkoutSettings.showCompanyInfoInShippingAddress;return e.createElement("div",{ref:i},e.createElement(d,{address:r.editingCustomerAddress||r.address,isErrorsVisible:o,allowedCountryIds:r.vm.shippingCountryIds||void 0,allowCorporateInfo:"billing"===r.addressType?"in-store"===r.vm.deliveryMethod||(r.vm.isDigitalOnly?a:!a):a,firstNameChangeCallback:r.firstNameChangeCallback,lastNameChangeCallback:r.lastNameChangeCallback,allowTitleChange:!!r.editingCustomerAddress,deliveryMethod:"address",isShippingAddress:"shipping"===r.addressType}))})),E=t((function(t){var s=t.vm;return e.createElement(d,{address:s.editingCustomerAddress||s.address,isErrorsVisible:s.isEditAddressErrorsVisible||s.vm.isErrorsVisible,firstNameChangeCallback:s.firstNameChangeCallback,lastNameChangeCallback:s.lastNameChangeCallback,deliveryMethod:"in-store"})})),k=t((function(t){var s=t.vm,r=u().t;return s.vm.store.customerStore.customer&&"-1"===s.selectedAddressId?e.createElement("div",{style:{marginTop:"12px"}},e.createElement(i,{value:s.vm.shouldSaveAddress,label:r("checkout-page:saveAddressCta"),onChange:s.vm.setShouldSaveAddress}),s.vm.shouldSaveAddress&&e.createElement("div",{style:{marginTop:"8px"}},e.createElement(o,{name:"addressTitle",type:a.TEXT,label:r("checkout-page:addressTitle"),value:s.vm.addressTitle,onChange:s.vm.setAddressTitle}))):null}));export{g as CustomerAddressForm,E as RecipientForm,k as SaveAddressCheckboxAndTitle,h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import{FormItem as o}from"../../components/form-item/index.js";import{FormItemType as i,FormItemInputMode as n}from"../../components/form-item/model.js";import{Button as
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import{FormItem as o}from"../../components/form-item/index.js";import{FormItemType as i,FormItemInputMode as n}from"../../components/form-item/model.js";import{Button as r}from"../../components/button/index.js";import{Checkbox as s}from"../../components/checkbox/index.js";import c from"../../components/error/index.js";import m from"../../styles/common.module.scss.js";import l from"../../components/customer-addresses/index.js";import a from"../../components/customer-addresses/model.js";import"@ikas/storefront-config";import{useTranslation as u}from"../../../../utils/i18n.js";var p=t((function(t){var p,d,h=t.vm,g=u().t,f=e.useRef(null),k=e.useState(0),v=k[0],E=k[1],S=h.isErrorsVisible&&!h.checkout.hasValidCustomerEmail;e.useEffect((function(){S&&f.current&&f.current.scrollIntoView({behavior:"smooth",block:"center"})}),[S,v]);var C=e.useCallback((function(e){h.checkout.customer&&(h.checkout.customer.email=e?e.trim():e)}),[h,h.checkout,h.checkout.customer]),b=e.useMemo((function(){return h.isDigitalOnly?new a(h,"billing"):new a(h,"shipping")}),[h]),x=e.useCallback((function(e){e.preventDefault(),E((function(e){return e+1})),h.isStepLoading||b.editingCustomerAddress||(h.isDigitalOnly?h.onProceedToDigitalOnlyPaymentClick():h.onProceedToShippingClick())}),[h,b.editingCustomerAddress]);return e.createElement("form",{onSubmit:x,autoComplete:"on"},e.createElement(c,{vm:h}),!h.checkout.hasCustomer&&e.createElement("div",{style:{marginTop:"8px",marginBottom:"40px"}},e.createElement("div",{className:m.FormSectionTitle},e.createElement("div",{className:m.Title},g("checkout-page:contactInfo"))),e.createElement("div",{ref:f},e.createElement(o,{name:"email",type:i.TEXT,inputMode:n.EMAIL,label:g("checkout-page:email"),autocomplete:"shipping email",value:(null===(p=h.checkout.customer)||void 0===p?void 0:p.email)||"",onChange:C,hasError:S,errorText:g("checkout-page:emailError"),tooltipText:g("checkout-page:guestEmailTooltip"),autocapitalize:"off",autocorrect:"off",spellcheck:"false"})),e.createElement(s,{value:(null===(d=h.checkout.customer)||void 0===d?void 0:d.notificationsAccepted)||!1,label:g("checkout-page:customerConsentCta"),onChange:h.setCustomerConsentGranted})),e.createElement(l,{vm:b}),h.isShowBillingAddressOnShippingStep&&"address"===h.deliveryMethod&&!h.isDigitalOnly&&e.createElement(s,{value:!h.useDifferentAddress,hasError:h.isErrorsVisible&&!h.isTermsAndConditionsChecked,label:g("checkout-page:useShippingForBilling"),onChange:function(e){return h.setUseDifferentAddress(!e,!0)}}),h.isShowBillingAddressOnShippingStep&&(h.useDifferentAddress||"in-store"===h.deliveryMethod)&&e.createElement(l,{vm:new a(h,"billing"),showBillingAddressOnShippingStep:!0}),!b.editingCustomerAddress&&e.createElement(r,{type:"submit",style:{width:"100%",marginTop:h.store.customerStore.customer&&!h.isShowBillingAddressOnShippingStep?"0px":"32px"},text:"address"!==h.deliveryMethod||h.isDigitalOnly?g("checkout-page:actions.continueWithPayment"):g("checkout-page:actions.continueWithShipping"),isLoading:h.isStepLoading}))}));export{p as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.276",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"swiper": "11.0.6"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
29
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
30
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
26
|
+
"@ikas/storefront-api": "^6.1.0-beta.276",
|
|
27
|
+
"@ikas/storefront-config": "^6.1.0-beta.276",
|
|
28
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.276",
|
|
29
|
+
"@ikas/storefront-models": "^6.1.0-beta.276",
|
|
30
|
+
"@ikas/storefront-providers": "^6.1.0-beta.276",
|
|
31
31
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
32
32
|
"@adyen/adyen-web": "^5.57.0",
|
|
33
33
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
65
|
-
"@ikas/storefront-api": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
68
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
69
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
65
|
+
"@ikas/storefront-api": "^6.1.0-beta.276",
|
|
66
|
+
"@ikas/storefront-config": "^6.1.0-beta.276",
|
|
67
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.276",
|
|
68
|
+
"@ikas/storefront-models": "^6.1.0-beta.276",
|
|
69
|
+
"@ikas/storefront-providers": "^6.1.0-beta.276",
|
|
70
70
|
"mobx": "^6.1.3",
|
|
71
71
|
"mobx-react-lite": "^3.1.5",
|
|
72
72
|
"next": "12.2.0",
|