@ikas/storefront 6.1.0-beta.75 → 6.1.0-beta.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/analytics/googleTagManager.js +1 -1
- package/build/components/image/index.d.ts +1 -0
- package/build/components/image/index.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/models/data/product/variant/index.d.ts +1 -0
- package/build/models/data/product/variant/index.js +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";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"../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{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@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{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as a}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"@ikas/storefront-config";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)})),customer:e.customer}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t,o){var a,d,n;if(!(o&&t===r.INFO&&o.isAccountRequired&&(null===(a=e.customer)||void 0===a?void 0:a.isGuestCheckout))){var m=i(e);null===(d=m.shippingAddress)||void 0===d||delete d.checkoutSettings,null===(n=m.billingAddress)||void 0===n||delete n.checkoutSettings;var c="";t===r.INFO?c="checkout_info-GTM":t===r.SHIPPING?c="checkout_shipping-GTM":t===r.PAYMENT?c="checkout_payment-GTM":t===r.SUCCESS&&(c="checkout_success-GTM");try{var p={event:c,ecommerce:{cart:m}};return!s&&window.dataLayer&&window.dataLayer.push(p),p}catch(e){console.error(e)}}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
|
1
|
+
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}from"mobx";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"../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{IkasProduct as o}from"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import"@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{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"@ikas/storefront-config";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as a}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",sellPrice:e.selectedVariant.sellPrice,discountPrice:e.selectedVariant.discountPrice||0}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)})),customer:e.customer}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t,o){var a,d,n;if(!(o&&t===r.INFO&&o.isAccountRequired&&(null===(a=e.customer)||void 0===a?void 0:a.isGuestCheckout))){var m=i(e);null===(d=m.shippingAddress)||void 0===d||delete d.checkoutSettings,null===(n=m.billingAddress)||void 0===n||delete n.checkoutSettings;var c="";t===r.INFO?c="checkout_info-GTM":t===r.SHIPPING?c="checkout_shipping-GTM":t===r.PAYMENT?c="checkout_payment-GTM":t===r.SUCCESS&&(c="checkout_success-GTM");try{var p={event:c,ecommerce:{cart:m}};return!s&&window.dataLayer&&window.dataLayer.push(p),p}catch(e){console.error(e)}}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import s from"next/image.js";import{IkasImageFunctions as o}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as a}from"@ikas/storefront-config";var l=[180,360,540,720,900,1080,1296,1512,1728,1950,2560,3840],i=function(i){var m=i.image,n=i.useBlur,u=i.lossless,f=e(i,["image","useBlur","lossless"]),c=o.getDefaultSrc,d=o.getSrc;return m?t.createElement(s,r({},f,{loader:function(e){var r=e.width,t=l.reduce((function(e,t){return Math.abs(t-r)<Math.abs(e-r)?t:e})),s=u||a.getIsLosslessImageEnabled();return d(m,t,s)},quality:100,src:c(m),alt:f.alt||"Image",placeholder:n?"blur":"empty",blurDataURL:n?d(m,10):void 0})):null};export{i as Image};
|
package/build/hooks/useStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/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"@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"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as o}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"
|
|
1
|
+
import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"@ikas/storefront-config";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/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"@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"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as o}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";function t(){return o.getInstance()}export{t as useStore};
|
|
@@ -68,6 +68,7 @@ export declare class IkasProductVariant implements IProductVariant {
|
|
|
68
68
|
formattedSellPriceWithQuantity: string;
|
|
69
69
|
formattedFinalPrice: string;
|
|
70
70
|
formattedFinalPriceWithQuantity: string;
|
|
71
|
+
salesChannelIds: string[] | null;
|
|
71
72
|
}[];
|
|
72
73
|
saveBackInStockReminder(email: string): Promise<boolean>;
|
|
73
74
|
toJSON(): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as r}from"./price/index.js";import{IkasVariantValue as n}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as o}from"../attribute-value/index.js";import{IkasProductImage as u}from"../image/index.js";import{IkasBundleSettings as c}from"./bundle-settings/index.js";import{IkasCustomerPriceListRuleValueType as l,IkasCampaignType as a,IkasCampaignFilterType as s,IkasCampaignApplicablePrice as d,IkasCustomerPriceListRuleFilterType as p}from"@ikas/storefront-models";import{IkasProductVariantFunctions as f,IkasProductPriceFunctions as m}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as b}from"@ikas/storefront-config";import{saveProductBackInStockRemind as v,listProductBackInStockRemind as g}from"@ikas/storefront-api";import h from"lodash/groupBy";import y from"lodash/sortBy";import{IkasProductVariantUnit as P}from"./unit/index.js";import{formatCurrency as I}from"../../../../utils/currency.js";import{makeAutoObservable as S}from"mobx";import{IkasBaseStore as O}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";var j=function(){function j(e){void 0===e&&(e={}),this._backInStockReminderSaved=!1,this.product=null,this.id=e.id||Date.now()+"",this.productId=e.productId||"",this.sku=e.sku||null,this.barcodeList=e.barcodeList||[],this.baseBundlePrices=e.baseBundlePrices?e.baseBundlePrices.map((function(e){return new r(e)})):[],this.bundleSettings=e.bundleSettings?new c(e.bundleSettings):null,this.variantValues=e.variantValues?e.variantValues.map((function(e){return new n(e)})):[],this.images=e.images?e.images.map((function(e){return new u(e)})):[],this.attributes=e.attributes?e.attributes.map((function(e){return new o(e)})):[],this.prices=e.prices?e.prices.map((function(e){return new r(e)})):[],this.stock=e.stock||0,this.isActive=void 0===e.isActive||e.isActive,this.campaigns=e.campaigns||[],this.unit=e.unit?new P(e.unit):null,this.sellIfOutOfStock=e.sellIfOutOfStock||!1,this.images=y(this.images,"order"),S(this)}return Object.defineProperty(j.prototype,"mainImage",{get:function(){var e=f.getMainImage(this);return e?new u(e):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStock",{get:function(){return f.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockEnabled",{get:function(){return b.isBackInStockEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockCustomerLoginRequired",{get:function(){return b.isCustomerLoginRequiredForBackInStock()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockReminderSaved",{get:function(){return this._backInStockReminderSaved},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"groupedAttributeValues",{get:function(){var e,t=h(this.attributes,"productAttributeId");return(null===(e=this.attributes)||void 0===e?void 0:e.map((function(e){var i=e.productAttributeId;if(i){var r=t[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(e){return!!e})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"b2bPriceRule",{get:function(){var e,t,i=this,r=O.getInstance().customerStore.customer,n=null==r?void 0:r.priceListRules,o=function(e){var t,r,n,o;if(e.type===p.CATEGORY)return u=null===(t=e.valueList)||void 0===t?void 0:t.some((function(e){var t;return null===(t=i.product)||void 0===t?void 0:t.categories.find((function(t){return t.id===e}))}));if(e.type===p.PRODUCT)return u=null===(r=e.valueList)||void 0===r?void 0:r.some((function(e){return i.id===e}));if(e.type===p.PRODUCT_BRAND){var u=null===(n=e.valueList)||void 0===n?void 0:n.some((function(e){var t,r;return(null===(r=null===(t=i.product)||void 0===t?void 0:t.brand)||void 0===r?void 0:r.id)===e}));return u}if(e.type===p.PRODUCT_TAG){u=null===(o=e.valueList)||void 0===o?void 0:o.some((function(e){var t,r;return null===(r=null===(t=i.product)||void 0===t?void 0:t.tags)||void 0===r?void 0:r.find((function(t){return t.id===e}))}));return u}};if(n){for(var u=0,c=n;u<c.length;u++){var l=c[u];if(l.shouldMatchAllFilters?null===(e=l.filters)||void 0===e?void 0:e.every(o):null===(t=l.filters)||void 0===t?void 0:t.some(o))return l}return null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"price",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.prices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return null===(t=this.prices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"bundlePrice",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.baseBundlePrices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return(null===(t=this.baseBundlePrices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId})))||this.price},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){var e=0;this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?e=m.getFinalPrice(this.bundlePrice)+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.finalPriceWithQuantity:0)}),0):e=m.getFinalPrice(this.price);if(!this.b2bPriceRule)return e;switch(this.b2bPriceRule.valueType){case l.DISCOUNT_RATE:return e*((100-this.b2bPriceRule.value)/100);case l.DISCOUNT_AMOUNT:return e-this.b2bPriceRule.value;case l.FIXED_PRICE:return this.b2bPriceRule.value;default:return e}},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPrice",{get:function(){return I(this.finalPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPrice",{get:function(){return this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?this.bundlePrice.sellPrice+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.sellPriceWithQuantity:0)}),0):this.price.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPrice",{get:function(){return I(this.sellPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedBuyPrice",{get:function(){return I(this.price.buyPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"appliedCampaignAmount",{get:function(){var e,t,i,r,n,o,u=this;if(!(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignId))return null;var c=(null===(r=null===(i=null===(t=this.product)||void 0===t?void 0:t.campaigns)||void 0===i?void 0:i.find((function(e){var t;return e.campaign.id===(null===(t=u.price.campaignPrice)||void 0===t?void 0:t.campaignId)})))||void 0===r?void 0:r.campaign)||null;if(!c)return null;var l={type:c.type,formattedPrice:null,discountPercentage:null},s=c.tieredDiscount&&c.tieredDiscount.rules&&c.tieredDiscount.rules.length>0&&c.tieredDiscount.rules[0].amount;return c.type===a.FIXED_AMOUNT&&(l.formattedPrice=I(c.fixedDiscount?(null===(n=c.fixedDiscount)||void 0===n?void 0:n.amount)||0:s||0,this.price.currency||"",this.price.currencySymbol||"")),c.type===a.RATIO&&(l.discountPercentage=c.fixedDiscount?(null===(o=c.fixedDiscount.amount)||void 0===o?void 0:o.toString())||null:s?s.toString():null),l},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignPrice",{get:function(){var e;return(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignPrice)||null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedCampaignPrice",{get:function(){return I(this.campaignPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPrice",{get:function(){return this.finalPrice===this.sellPrice?null:this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedDiscountPrice",{get:function(){return I(this.discountPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasDiscount",{get:function(){return this.finalPrice!==this.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountAmount",{get:function(){return this.hasDiscount?this.sellPrice-this.finalPrice:0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPercentage",{get:function(){return this.hasDiscount?(100-100*this.finalPrice/this.sellPrice).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPriceWithCampaignOffers",{get:function(){var e,t;return this.finalPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.finalPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPriceWithCampaignOffers",{get:function(){return I(this.finalPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPriceWithCampaignOffers",{get:function(){var e,t;return this.sellPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.sellPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPriceWithCampaignOffers",{get:function(){return I(this.sellPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignOffersDiscountPercentage",{get:function(){return this.finalPriceWithCampaignOffers!==this.sellPriceWithCampaignOffers?(100-100*this.finalPriceWithCampaignOffers/this.sellPriceWithCampaignOffers).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"tieredDiscountProducts",{get:function(){var e,t,i,r,n=this,o=null===(i=null===(t=null===(e=this.product)||void 0===e?void 0:e.campaigns)||void 0===t?void 0:t.find((function(e){return!!e.campaign.tieredDiscount})))||void 0===i?void 0:i.campaign,u=null===(r=null==o?void 0:o.tieredDiscount)||void 0===r?void 0:r.filters;if(u){var c=u.find((function(e){return e.type===s.PRODUCT_AND_VARIANT}));if(c){var l=[];if(c.idList.map((function(e){l.push(e.replace("p:","").replace("v:",""))})),!l.some((function(e){return n.id===e||n.productId===e})))return[]}}return o&&o.tieredDiscount?o.tieredDiscount.rules.every((function(e){return!e.lineItemQuantityRange}))?[]:o.tieredDiscount.rules.map((function(e){var t,i,r,u,c=o.applicablePrice===d.SELL_PRICE?n.sellPrice:n.finalPrice,l=c*((null===(t=e.lineItemQuantityRange)||void 0===t?void 0:t.min)||1),s=I(c,n.price.currency||"",n.price.currencySymbol||""),p=I(l,n.price.currency||"",n.price.currencySymbol||""),f=o.type===a.RATIO?c-c*(e.amount||1)/100:c,m=f*((null===(i=e.lineItemQuantityRange)||void 0===i?void 0:i.min)||1)-(o.type===a.FIXED_AMOUNT&&e.amount||0),b=I(f,n.price.currency||"",n.price.currencySymbol||""),v=I(m,n.price.currency||"",n.price.currencySymbol||"");return{amount:e.amount,lineItemQuantityRange:{min:(null===(r=e.lineItemQuantityRange)||void 0===r?void 0:r.min)||0,max:(null===(u=e.lineItemQuantityRange)||void 0===u?void 0:u.max)||0},type:o.type,sellPrice:c,finalPrice:f,sellPriceWithQuantity:l,finalPriceWithQuantity:m,formattedSellPrice:s,formattedSellPriceWithQuantity:p,formattedFinalPrice:b,formattedFinalPriceWithQuantity:v}})):[]},enumerable:!1,configurable:!0}),j.prototype.saveBackInStockReminder=function(i){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,g({email:{eq:i},productId:{eq:this.productId},variantId:{eq:this.id}})];case 1:return(e=t.sent())&&(null===(r=e.data)||void 0===r?void 0:r.length)?(this._backInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,v({input:{email:i,productId:this.productId,variantId:this.id}})];case 3:return t.sent().isSuccess?(this._backInStockReminderSaved=!0,[2,!0]):(this._backInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))},j.prototype.toJSON=function(){var e=i({},this);return delete e.product,e},j}();export{j as IkasProductVariant};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as r}from"./price/index.js";import{IkasVariantValue as n}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as o}from"../attribute-value/index.js";import{IkasProductImage as u}from"../image/index.js";import{IkasBundleSettings as c}from"./bundle-settings/index.js";import{IkasCustomerPriceListRuleValueType as l,IkasCampaignType as a,IkasCampaignFilterType as s,IkasCampaignApplicablePrice as d,IkasCustomerPriceListRuleFilterType as p}from"@ikas/storefront-models";import{IkasProductVariantFunctions as f,IkasProductPriceFunctions as m}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as b}from"@ikas/storefront-config";import{saveProductBackInStockRemind as v,listProductBackInStockRemind as h}from"@ikas/storefront-api";import g from"lodash/groupBy";import y from"lodash/sortBy";import{IkasProductVariantUnit as P}from"./unit/index.js";import{formatCurrency as I}from"../../../../utils/currency.js";import{makeAutoObservable as S}from"mobx";import{IkasBaseStore as O}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";var j=function(){function j(e){void 0===e&&(e={}),this._backInStockReminderSaved=!1,this.product=null,this.id=e.id||Date.now()+"",this.productId=e.productId||"",this.sku=e.sku||null,this.barcodeList=e.barcodeList||[],this.baseBundlePrices=e.baseBundlePrices?e.baseBundlePrices.map((function(e){return new r(e)})):[],this.bundleSettings=e.bundleSettings?new c(e.bundleSettings):null,this.variantValues=e.variantValues?e.variantValues.map((function(e){return new n(e)})):[],this.images=e.images?e.images.map((function(e){return new u(e)})):[],this.attributes=e.attributes?e.attributes.map((function(e){return new o(e)})):[],this.prices=e.prices?e.prices.map((function(e){return new r(e)})):[],this.stock=e.stock||0,this.isActive=void 0===e.isActive||e.isActive,this.campaigns=e.campaigns||[],this.unit=e.unit?new P(e.unit):null,this.sellIfOutOfStock=e.sellIfOutOfStock||!1,this.images=y(this.images,"order"),S(this)}return Object.defineProperty(j.prototype,"mainImage",{get:function(){var e=f.getMainImage(this);return e?new u(e):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStock",{get:function(){return f.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockEnabled",{get:function(){return b.isBackInStockEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockCustomerLoginRequired",{get:function(){return b.isCustomerLoginRequiredForBackInStock()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockReminderSaved",{get:function(){return this._backInStockReminderSaved},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"groupedAttributeValues",{get:function(){var e,t=g(this.attributes,"productAttributeId");return(null===(e=this.attributes)||void 0===e?void 0:e.map((function(e){var i=e.productAttributeId;if(i){var r=t[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(e){return!!e})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"b2bPriceRule",{get:function(){var e,t,i=this,r=O.getInstance().customerStore.customer,n=null==r?void 0:r.priceListRules,o=function(e){var t,r,n,o;if(e.type===p.CATEGORY)return u=null===(t=e.valueList)||void 0===t?void 0:t.some((function(e){var t;return null===(t=i.product)||void 0===t?void 0:t.categories.find((function(t){return t.id===e}))}));if(e.type===p.PRODUCT)return u=null===(r=e.valueList)||void 0===r?void 0:r.some((function(e){return i.id===e}));if(e.type===p.PRODUCT_BRAND){var u=null===(n=e.valueList)||void 0===n?void 0:n.some((function(e){var t,r;return(null===(r=null===(t=i.product)||void 0===t?void 0:t.brand)||void 0===r?void 0:r.id)===e}));return u}if(e.type===p.PRODUCT_TAG){u=null===(o=e.valueList)||void 0===o?void 0:o.some((function(e){var t,r;return null===(r=null===(t=i.product)||void 0===t?void 0:t.tags)||void 0===r?void 0:r.find((function(t){return t.id===e}))}));return u}};if(n){for(var u=0,c=n;u<c.length;u++){var l=c[u];if(l.shouldMatchAllFilters?null===(e=l.filters)||void 0===e?void 0:e.every(o):null===(t=l.filters)||void 0===t?void 0:t.some(o))return l}return null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"price",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.prices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return null===(t=this.prices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"bundlePrice",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.baseBundlePrices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return(null===(t=this.baseBundlePrices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId})))||this.price},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){var e=0;this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?e=m.getFinalPrice(this.bundlePrice)+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.finalPriceWithQuantity:0)}),0):e=m.getFinalPrice(this.price);if(!this.b2bPriceRule)return e;switch(this.b2bPriceRule.valueType){case l.DISCOUNT_RATE:return e*((100-this.b2bPriceRule.value)/100);case l.DISCOUNT_AMOUNT:return e-this.b2bPriceRule.value;case l.FIXED_PRICE:return this.b2bPriceRule.value;default:return e}},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPrice",{get:function(){return I(this.finalPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPrice",{get:function(){return this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?this.bundlePrice.sellPrice+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.sellPriceWithQuantity:0)}),0):this.price.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPrice",{get:function(){return I(this.sellPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedBuyPrice",{get:function(){return I(this.price.buyPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"appliedCampaignAmount",{get:function(){var e,t,i,r,n,o,u=this;if(!(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignId))return null;var c=(null===(r=null===(i=null===(t=this.product)||void 0===t?void 0:t.campaigns)||void 0===i?void 0:i.find((function(e){var t;return e.campaign.id===(null===(t=u.price.campaignPrice)||void 0===t?void 0:t.campaignId)})))||void 0===r?void 0:r.campaign)||null;if(!c)return null;var l={type:c.type,formattedPrice:null,discountPercentage:null},s=c.tieredDiscount&&c.tieredDiscount.rules&&c.tieredDiscount.rules.length>0&&c.tieredDiscount.rules[0].amount;return c.type===a.FIXED_AMOUNT&&(l.formattedPrice=I(c.fixedDiscount?(null===(n=c.fixedDiscount)||void 0===n?void 0:n.amount)||0:s||0,this.price.currency||"",this.price.currencySymbol||"")),c.type===a.RATIO&&(l.discountPercentage=c.fixedDiscount?(null===(o=c.fixedDiscount.amount)||void 0===o?void 0:o.toString())||null:s?s.toString():null),l},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignPrice",{get:function(){var e;return(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignPrice)||null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedCampaignPrice",{get:function(){return I(this.campaignPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPrice",{get:function(){return this.finalPrice===this.sellPrice?null:this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedDiscountPrice",{get:function(){return I(this.discountPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasDiscount",{get:function(){return this.finalPrice!==this.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountAmount",{get:function(){return this.hasDiscount?this.sellPrice-this.finalPrice:0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPercentage",{get:function(){return this.hasDiscount?(100-100*this.finalPrice/this.sellPrice).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPriceWithCampaignOffers",{get:function(){var e,t;return this.finalPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.finalPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPriceWithCampaignOffers",{get:function(){return I(this.finalPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPriceWithCampaignOffers",{get:function(){var e,t;return this.sellPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.sellPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPriceWithCampaignOffers",{get:function(){return I(this.sellPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignOffersDiscountPercentage",{get:function(){return this.finalPriceWithCampaignOffers!==this.sellPriceWithCampaignOffers?(100-100*this.finalPriceWithCampaignOffers/this.sellPriceWithCampaignOffers).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"tieredDiscountProducts",{get:function(){var e,t,i,r,n=this,o=null===(i=null===(t=null===(e=this.product)||void 0===e?void 0:e.campaigns)||void 0===t?void 0:t.find((function(e){return!!e.campaign.tieredDiscount})))||void 0===i?void 0:i.campaign,u=null===(r=null==o?void 0:o.tieredDiscount)||void 0===r?void 0:r.filters;if(u){var c=u.find((function(e){return e.type===s.PRODUCT_AND_VARIANT}));if(c){var l=[];if(c.idList.map((function(e){l.push(e.replace("p:","").replace("v:",""))})),!l.some((function(e){return n.id===e||n.productId===e})))return[]}}return o&&o.tieredDiscount?o.tieredDiscount.rules.every((function(e){return!e.lineItemQuantityRange}))?[]:o.tieredDiscount.rules.map((function(e){var t,i,r,u,c=o.applicablePrice===d.SELL_PRICE?n.sellPrice:n.finalPrice,l=c*((null===(t=e.lineItemQuantityRange)||void 0===t?void 0:t.min)||1),s=I(c,n.price.currency||"",n.price.currencySymbol||""),p=I(l,n.price.currency||"",n.price.currencySymbol||""),f=o.type===a.RATIO?c-c*(e.amount||1)/100:c,m=f*((null===(i=e.lineItemQuantityRange)||void 0===i?void 0:i.min)||1)-(o.type===a.FIXED_AMOUNT&&e.amount||0),b=I(f,n.price.currency||"",n.price.currencySymbol||""),v=I(m,n.price.currency||"",n.price.currencySymbol||"");return{amount:e.amount,lineItemQuantityRange:{min:(null===(r=e.lineItemQuantityRange)||void 0===r?void 0:r.min)||0,max:(null===(u=e.lineItemQuantityRange)||void 0===u?void 0:u.max)||0},type:o.type,sellPrice:c,finalPrice:f,sellPriceWithQuantity:l,finalPriceWithQuantity:m,formattedSellPrice:s,formattedSellPriceWithQuantity:p,formattedFinalPrice:b,formattedFinalPriceWithQuantity:v,salesChannelIds:o.salesChannelIds}})):[]},enumerable:!1,configurable:!0}),j.prototype.saveBackInStockReminder=function(i){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,h({email:{eq:i},productId:{eq:this.productId},variantId:{eq:this.id}})];case 1:return(e=t.sent())&&(null===(r=e.data)||void 0===r?void 0:r.length)?(this._backInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,v({input:{email:i,productId:this.productId,variantId:this.id}})];case 3:return t.sent().isSuccess?(this._backInStockReminderSaved=!0,[2,!0]):(this._backInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))},j.prototype.toJSON=function(){var e=i({},this);return delete e.product,e},j}();export{j as IkasProductVariant};
|
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.76",
|
|
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.
|
|
25
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
26
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
27
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
28
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
24
|
+
"@ikas/storefront-api": "^6.1.0-beta.76",
|
|
25
|
+
"@ikas/storefront-config": "^6.1.0-beta.76",
|
|
26
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.76",
|
|
27
|
+
"@ikas/storefront-models": "^6.1.0-beta.76",
|
|
28
|
+
"@ikas/storefront-providers": "^6.1.0-beta.76",
|
|
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.
|
|
64
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
65
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
66
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
67
|
-
"@ikas/storefront-providers": "^6.1.0-beta.
|
|
63
|
+
"@ikas/storefront-api": "^6.1.0-beta.76",
|
|
64
|
+
"@ikas/storefront-config": "^6.1.0-beta.76",
|
|
65
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.76",
|
|
66
|
+
"@ikas/storefront-models": "^6.1.0-beta.76",
|
|
67
|
+
"@ikas/storefront-providers": "^6.1.0-beta.76",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|