@ikas/storefront 4.7.0-beta.3 → 4.7.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*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../button/index.js";import r from"./select/index.js";import n from"../svg/cross.js";import{useTranslation as c}from"../../../../utils/i18n.js";import{formatCurrency as i}from"../../../../utils/currency.js";import{IkasCampaignOfferProductApplicablePriceEnum as o}from"@ikas/storefront-models";import m from"./style.module.scss.js";var d=function(t){var a=t.seconds,r=t.rejectOffer,n=c().t,i=e.useState(a),o=i[0],d=i[1];e.useEffect((function(){var e=o>0&&setInterval((function(){return d(o-1)}),1e3);return 0===o&&r(),function(){return clearInterval(e)}}),[o]);return e.createElement("div",{className:m.CountdownContainer},e.createElement("div",{className:m.CountdownText},n("checkout-page:timeRemaining",{value:function(e){var t=Math.floor(e/60/60),a=Math.floor(e/60)-60*t,r=e%60;return 0!==t?t.toString().padStart(2,"0")+":":a.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}(o)})))},f=t((function(t){var f,l,s=t.vm,u=t.campaignOffer,p=c().t,v=e.useState(u.variants[0]),g=v[0],E=v[1],I=function(){s.updateCartCampaignOffer({accepted:!1,cartId:s.checkout.id,campaignOfferId:u.campaignOffer.campaignOfferId,campaignOfferProductId:u.offer.id,productId:u.offer.productId,variantId:g.id})},C=Math.round(((new Date).getTime()-new Date(u.campaignOffer.offerStartDate).getTime())/1e3);return e.createElement("div",{className:m.Container},u.offer.countdownMinutes&&e.createElement(d,{seconds:C>60*u.offer.countdownMinutes?0:60*u.offer.countdownMinutes-C,rejectOffer:I}),e.createElement("div",{className:m.ContentContainer},e.createElement("div",{className:m.Header},e.createElement("div",{className:m.Title},u.offer.title),e.createElement("div",{className:m.RejectButton,onClick:I},e.createElement(n,null))),e.createElement("div",{className:m.ProductContainer},e.createElement("div",{className:m.ImageContainer},e.createElement("img",{className:m.Image,src:null===(l=null===(f=g.mainImage)||void 0===f?void 0:f.image)||void 0===l?void 0:l.thumbnailSrc})),e.createElement("div",{className:m.ProductDetails},e.createElement("div",{className:m.ProductName},u.product.name),u.product.hasVariant&&1===u.variants.length&&e.createElement("div",{className:m.VariantName},g.variantValues.map((function(e){return e.name})).join(", ")),u.product.brand&&e.createElement("div",{className:m.Brand},u.product.brand.name),e.createElement("div",{className:m.ProductPrice},0!==u.offer.discountAmount&&e.createElement("span",{className:m.Discount},u.offer.applicablePrice===o.SELL_PRICE?g.price.formattedSellPrice:g.price.formattedFinalPrice," "),i(u.offer.applicablePrice===o.SELL_PRICE?g.price.sellPrice-g.price.sellPrice*(u.offer.discountAmount||0)/100:g.price.finalPrice-g.price.finalPrice*(u.offer.discountAmount||0)/100,s.checkout.currencyCode,s.checkout.currencySymbol)),e.createElement("div",{className:m.Actions},u.variants.length>1&&e.createElement(r,{value:g.id,onSelectChange:function(e){var t=u.variants.find((function(t){return t.id===e}));t&&E(t)},options:u.variants.map((function(e){return{label:e.variantValues.map((function(e){return e.name})).join(", "),value:e.id}}))}),e.createElement(a,{style:{width:"100%",height:44,fontSize:14},text:p("checkout-page:actions.addToCart"),onClick:function(){s.updateCartCampaignOffer({accepted:!0,cartId:s.checkout.id,campaignOfferId:u.campaignOffer.campaignOfferId,campaignOfferProductId:u.offer.id,productId:u.offer.productId,variantId:g.id})}}))))))}));export{f as default};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../button/index.js";import r from"./select/index.js";import n from"../svg/cross.js";import{useTranslation as i}from"../../../../utils/i18n.js";import{formatCurrency as c}from"../../../../utils/currency.js";import{IkasCampaignOfferProductApplicablePriceEnum as o}from"@ikas/storefront-models";import m from"./style.module.scss.js";var d=function(t){var a=t.seconds,r=t.rejectOffer,n=i().t,c=e.useState(a),o=c[0],d=c[1];e.useEffect((function(){var e=o>0&&setInterval((function(){return d(o-1)}),1e3);return 0===o&&r(),function(){return clearInterval(e)}}),[o]);return e.createElement("div",{className:m.CountdownContainer},e.createElement("div",{className:m.CountdownText},n("checkout-page:timeRemaining",{value:function(e){var t=Math.floor(e/60/60),a=Math.floor(e/60)-60*t,r=e%60;return 0!==t?t.toString().padStart(2,"0")+":":a.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}(o)})))},l=t((function(t){var l,f,s,u,p,v=t.vm,g=t.campaignOffer,E=i().t,I=e.useState(g.variants[0]),h=I[0],C=I[1],N=function(){v.updateCartCampaignOffer({accepted:!1,cartId:v.checkout.id,campaignOfferId:g.campaignOffer.campaignOfferId,campaignOfferProductId:g.offer.id,productId:g.offer.productId,variantId:h.id})},P=Math.round(((new Date).getTime()-new Date(g.campaignOffer.offerStartDate).getTime())/1e3),S=null===(l=h.images)||void 0===l?void 0:l.filter((function(e){return!e.isVideo})),O=(null===(f=h.mainImage)||void 0===f?void 0:f.isVideo)?(null==S?void 0:S.length)?null===(s=S[0].image)||void 0===s?void 0:s.thumbnailSrc:void 0:null===(p=null===(u=h.mainImage)||void 0===u?void 0:u.image)||void 0===p?void 0:p.thumbnailSrc;return e.createElement("div",{className:m.Container},g.offer.countdownMinutes&&e.createElement(d,{seconds:P>60*g.offer.countdownMinutes?0:60*g.offer.countdownMinutes-P,rejectOffer:N}),e.createElement("div",{className:m.ContentContainer},e.createElement("div",{className:m.Header},e.createElement("div",{className:m.Title},g.offer.title),e.createElement("div",{className:m.RejectButton,onClick:N},e.createElement(n,null))),e.createElement("div",{className:m.ProductContainer},e.createElement("div",{className:m.ImageContainer},e.createElement("img",{className:m.Image,src:O})),e.createElement("div",{className:m.ProductDetails},e.createElement("div",{className:m.ProductName},g.product.name),g.product.hasVariant&&1===g.variants.length&&e.createElement("div",{className:m.VariantName},h.variantValues.map((function(e){return e.name})).join(", ")),g.product.brand&&e.createElement("div",{className:m.Brand},g.product.brand.name),e.createElement("div",{className:m.ProductPrice},0!==g.offer.discountAmount&&e.createElement("span",{className:m.Discount},g.offer.applicablePrice===o.SELL_PRICE?h.price.formattedSellPrice:h.price.formattedFinalPrice," "),c(g.offer.applicablePrice===o.SELL_PRICE?h.price.sellPrice-h.price.sellPrice*(g.offer.discountAmount||0)/100:h.price.finalPrice-h.price.finalPrice*(g.offer.discountAmount||0)/100,v.checkout.currencyCode,v.checkout.currencySymbol)),e.createElement("div",{className:m.Actions},g.variants.length>1&&e.createElement(r,{value:h.id,onSelectChange:function(e){var t=g.variants.find((function(t){return t.id===e}));t&&C(t)},options:g.variants.map((function(e){return{label:e.variantValues.map((function(e){return e.name})).join(", "),value:e.id}}))}),e.createElement(a,{style:{width:"100%",height:44,fontSize:14},text:E("checkout-page:actions.addToCart"),onClick:function(){v.updateCartCampaignOffer({accepted:!0,cartId:v.checkout.id,campaignOfferId:g.campaignOffer.campaignOfferId,campaignOfferProductId:g.offer.id,productId:g.offer.productId,variantId:h.id})}}))))))}));export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.7.0-beta.3",
3
+ "version": "4.7.0-beta.4",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,11 +17,11 @@
17
17
  "build": "rm -rf build && rollup -c"
18
18
  },
19
19
  "devDependencies": {
20
- "@ikas/storefront-api": "^4.7.0-beta.3",
21
- "@ikas/storefront-config": "^4.7.0-beta.3",
22
- "@ikas/storefront-model-functions": "^4.7.0-beta.3",
23
- "@ikas/storefront-models": "^4.7.0-beta.3",
24
- "@ikas/storefront-providers": "^4.7.0-beta.3",
20
+ "@ikas/storefront-api": "^4.7.0-beta.4",
21
+ "@ikas/storefront-config": "^4.7.0-beta.4",
22
+ "@ikas/storefront-model-functions": "^4.7.0-beta.4",
23
+ "@ikas/storefront-models": "^4.7.0-beta.4",
24
+ "@ikas/storefront-providers": "^4.7.0-beta.4",
25
25
  "@ikas/localized-address": "^1.0.0-beta.3",
26
26
  "@adyen/adyen-web": "^5.28.2",
27
27
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -55,11 +55,11 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@ikas/localized-address": "^1.0.0-beta.3",
58
- "@ikas/storefront-api": "^4.7.0-beta.3",
59
- "@ikas/storefront-config": "^4.7.0-beta.3",
60
- "@ikas/storefront-model-functions": "^4.7.0-beta.3",
61
- "@ikas/storefront-models": "^4.7.0-beta.3",
62
- "@ikas/storefront-providers": "^4.7.0-beta.3",
58
+ "@ikas/storefront-api": "^4.7.0-beta.4",
59
+ "@ikas/storefront-config": "^4.7.0-beta.4",
60
+ "@ikas/storefront-model-functions": "^4.7.0-beta.4",
61
+ "@ikas/storefront-models": "^4.7.0-beta.4",
62
+ "@ikas/storefront-providers": "^4.7.0-beta.4",
63
63
  "mobx": "^6.1.3",
64
64
  "mobx-react-lite": "^3.1.5",
65
65
  "next": "12.2.0",