@anker-in/headless-ui 1.0.26-alpha.1763111166215 → 1.0.26-alpha.1763367560339

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.
Files changed (100) hide show
  1. package/dist/cjs/biz-components/DownLoad/index.js +1 -1
  2. package/dist/cjs/biz-components/DownLoad/index.js.map +2 -2
  3. package/dist/cjs/biz-components/Features/index.js +1 -1
  4. package/dist/cjs/biz-components/Features/index.js.map +2 -2
  5. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +23 -7
  6. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
  7. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +3 -3
  8. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +5 -2
  9. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +5 -5
  10. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  11. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +6 -2
  12. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +6 -2
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  16. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
  17. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +6 -2
  18. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  19. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
  20. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +6 -2
  21. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
  22. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +3 -3
  23. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +6 -2
  24. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
  25. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
  26. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +6 -2
  27. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  28. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  29. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +43 -12
  30. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.js +1 -1
  31. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +2 -2
  32. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +6 -2
  33. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  34. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  35. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  36. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  37. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.d.ts +6 -2
  38. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  39. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
  40. package/dist/cjs/biz-components/SelectStore/index.js +1 -1
  41. package/dist/cjs/biz-components/SelectStore/index.js.map +2 -2
  42. package/dist/cjs/components/ExposureDetector.d.ts +45 -0
  43. package/dist/cjs/components/ExposureDetector.js +2 -0
  44. package/dist/cjs/components/ExposureDetector.js.map +7 -0
  45. package/dist/cjs/components/index.d.ts +1 -0
  46. package/dist/cjs/components/index.js +1 -1
  47. package/dist/cjs/components/index.js.map +3 -3
  48. package/dist/cjs/hooks/useExposureDetection.d.ts +69 -0
  49. package/dist/cjs/hooks/useExposureDetection.js +2 -0
  50. package/dist/cjs/hooks/useExposureDetection.js.map +7 -0
  51. package/dist/esm/biz-components/DownLoad/index.js +1 -1
  52. package/dist/esm/biz-components/DownLoad/index.js.map +2 -2
  53. package/dist/esm/biz-components/Features/index.js +1 -1
  54. package/dist/esm/biz-components/Features/index.js.map +2 -2
  55. package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +23 -7
  56. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
  57. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +3 -3
  58. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +5 -2
  59. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +5 -5
  60. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  61. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +6 -2
  62. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  63. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
  64. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +6 -2
  65. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  66. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
  67. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +6 -2
  68. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  69. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +3 -3
  70. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +6 -2
  71. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
  72. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +3 -3
  73. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +6 -2
  74. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js +1 -1
  75. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.js.map +3 -3
  76. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +6 -2
  77. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  78. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  79. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +43 -12
  80. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +2 -2
  81. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +6 -2
  82. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  83. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  84. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  85. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  86. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.d.ts +6 -2
  87. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  88. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +3 -3
  89. package/dist/esm/biz-components/SelectStore/index.js +1 -1
  90. package/dist/esm/biz-components/SelectStore/index.js.map +2 -2
  91. package/dist/esm/components/ExposureDetector.d.ts +45 -0
  92. package/dist/esm/components/ExposureDetector.js +2 -0
  93. package/dist/esm/components/ExposureDetector.js.map +7 -0
  94. package/dist/esm/components/index.d.ts +1 -0
  95. package/dist/esm/components/index.js +1 -1
  96. package/dist/esm/components/index.js.map +3 -3
  97. package/dist/esm/hooks/useExposureDetection.d.ts +69 -0
  98. package/dist/esm/hooks/useExposureDetection.js +2 -0
  99. package/dist/esm/hooks/useExposureDetection.js.map +7 -0
  100. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{Fragment as k,jsx as o,jsxs as i}from"react/jsx-runtime";import{Text as c,Picture as y}from"../../../../../../components";import{cn as m}from"../../../../../../helpers/index.js";import{useState as N}from"react";import{useBizProductContext as b}from"../../../../BizProductProvider.js";import{useAiuiContext as h}from"../../../../../AiuiProvider/index.js";import{handle as w}from"../../../../utils/helper.js";const _=()=>{const{product:d,selectedOptions:r,setSelectedOptions:a,setJoinedRecommendBuyProducts:u}=b(),{storeDomain:l}=h(),[p,f]=N({});return d.options.length?o("div",{className:"flex flex-col gap-12",children:d.options.map(t=>{const v=t.name.toLowerCase();return["color","colour","couleur"].some(e=>v.includes(e))?i("div",{className:"ipc-product-detail-options",children:[o(c,{as:"p",size:3,className:"font-bold",html:"Select Color: "+r[t.name]}),o("div",{className:"flex items-center gap-4 mt-4 ml-1",children:t.values.map(({label:e},s)=>{const x=`https://${l}/cdn/shop/files/${w(e)}.png`;return i("div",{className:"relative ipc-product-detail-options-value",children:[o("button",{"aria-label":`switch to ${e}`,title:e,onClick:()=>{a(n=>({...n,[t.name]:e})),u?.({gift:void 0,bundle:void 0})},className:m("flex size-[30px] items-center justify-center rounded-full bg-center bg-no-repeat outline outline-2 outline-offset-4 outline-white",{"outline-brand":r[t.name]===e}),children:!p[e]&&o(k,{children:o(y,{className:"w-full",source:x,onError:({currentTarget:n})=>{n.onerror=null,f(g=>({...g,[e]:!0}))}})})}),o("div",{className:"pointer-events-none absolute inset-0 rounded-full shadow-[inset_0_0_4px_rgba(0,0,0,0.08),inset_0_2px_2px_rgba(0,0,0,0.12)]"})]},e+s)})})]},t.id):i("div",{className:"ipc-product-detail-options",children:[o(c,{as:"p",size:3,className:"font-bold",html:t.name}),o("div",{className:"flex items-center gap-4 mt-4",children:t.values.map(({label:e})=>o("button",{onClick:()=>{a(s=>({...s,[t.name]:e}))},className:m("w-1/2 text-left font-bold px-4 py-6 rounded-box border-[#E4E5E6] border-2",{"border-brand":r[t.name]===e}),children:e},e))})]},t.id)})}):null};var $=_;export{$ as default};
1
+ import{Fragment as E,jsx as o,jsxs as i}from"react/jsx-runtime";import{Text as m,Picture as y}from"../../../../../../components";import{cn as c}from"../../../../../../helpers/index.js";import{useState as N}from"react";import{useBizProductContext as h}from"../../../../BizProductProvider.js";import{useAiuiContext as b}from"../../../../../AiuiProvider/index.js";import{handle as w}from"../../../../utils/helper.js";import{withLayout as _}from"../../../../../../shared/Styles.js";const k=()=>{const{product:d,selectedOptions:r,setSelectedOptions:a,setJoinedRecommendBuyProducts:u}=h(),{storeDomain:l}=b(),[p,f]=N({});return d.options.length?o("div",{className:"flex flex-col gap-12",children:d.options.map(t=>{const v=t.name.toLowerCase();return["color","colour","couleur"].some(e=>v.includes(e))?i("div",{className:"ipc-product-detail-options",children:[o(m,{as:"p",size:3,className:"font-bold",html:"Select Color: "+r[t.name]}),o("div",{className:"flex items-center gap-4 mt-4 ml-1",children:t.values.map(({label:e},s)=>{const x=`https://${l}/cdn/shop/files/${w(e)}.png`;return i("div",{className:"relative ipc-product-detail-options-value",children:[o("button",{"aria-label":`switch to ${e}`,title:e,onClick:()=>{a(n=>({...n,[t.name]:e})),u?.({gift:void 0,bundle:void 0})},className:c("flex size-[30px] items-center justify-center rounded-full bg-center bg-no-repeat outline outline-2 outline-offset-4 outline-white",{"outline-brand":r[t.name]===e}),children:!p[e]&&o(E,{children:o(y,{className:"w-full",source:x,onError:({currentTarget:n})=>{n.onerror=null,f(g=>({...g,[e]:!0}))}})})}),o("div",{className:"pointer-events-none absolute inset-0 rounded-full shadow-[inset_0_0_4px_rgba(0,0,0,0.08),inset_0_2px_2px_rgba(0,0,0,0.12)]"})]},e+s)})})]},t.id):i("div",{className:"ipc-product-detail-options",children:[o(m,{as:"p",size:3,className:"font-bold",html:t.name}),o("div",{className:"flex items-center gap-4 mt-4",children:t.values.map(({label:e})=>o("button",{onClick:()=>{a(s=>({...s,[t.name]:e}))},className:c("w-1/2 text-left font-bold px-4 py-6 rounded-box border-[#E4E5E6] border-2",{"border-brand":r[t.name]===e}),children:e},e))})]},t.id)})}):null};var A=_(k);export{A as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.tsx"],
4
- "sourcesContent": ["import { Text, Picture, Button } from '../../../../../../components'\nimport type { ProductOptionsProps } from '../types'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useState } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport { handle } from '../../../../utils/helper.js'\n\nconst ProductOptions = () => {\n const { product, selectedOptions, setSelectedOptions, setJoinedRecommendBuyProducts } =\n useBizProductContext()\n const { storeDomain } = useAiuiContext()\n const [imgLoadError, setImgLoadError] = useState({})\n if (!product.options.length) return null\n return (\n <div className=\"flex flex-col gap-12\">\n {product.options.map(option => {\n const lowercasedName = option.name.toLowerCase()\n const colorKeywords = ['color', 'colour', 'couleur']\n if (colorKeywords.some(keyword => lowercasedName.includes(keyword))) {\n return (\n <div key={option.id} className=\"ipc-product-detail-options\">\n <Text as=\"p\" size={3} className=\"font-bold\" html={'Select Color: ' + selectedOptions[option.name]} />\n <div className=\"flex items-center gap-4 mt-4 ml-1\">\n {option.values.map(({ label }, index) => {\n const imagePath = `https://${storeDomain}/cdn/shop/files/${handle(label)}.png`\n return (\n <div key={label + index} className=\"relative ipc-product-detail-options-value\">\n <button\n aria-label={`switch to ${label}`}\n title={label}\n onClick={() => {\n setSelectedOptions(prev => ({ ...prev, [option.name]: label }))\n setJoinedRecommendBuyProducts?.({ gift: undefined, bundle: undefined })\n }}\n className={cn(\n 'flex size-[30px] items-center justify-center rounded-full bg-center bg-no-repeat outline outline-2 outline-offset-4 outline-white',\n {\n 'outline-brand': selectedOptions[option.name] === label,\n }\n )}\n >\n {!imgLoadError[label as keyof typeof imgLoadError] && (\n <>\n <Picture\n className=\"w-full\"\n source={imagePath}\n onError={({ currentTarget }) => {\n currentTarget.onerror = null // prevents looping\n setImgLoadError(prev => ({ ...prev, [label]: true }))\n }}\n />\n </>\n )}\n </button>\n <div className=\"pointer-events-none absolute inset-0 rounded-full shadow-[inset_0_0_4px_rgba(0,0,0,0.08),inset_0_2px_2px_rgba(0,0,0,0.12)]\"></div>\n </div>\n )\n })}\n </div>\n </div>\n )\n } else {\n return (\n <div key={option.id} className=\"ipc-product-detail-options\">\n <Text as=\"p\" size={3} className=\"font-bold\" html={option.name} />\n <div className=\"flex items-center gap-4 mt-4\">\n {option.values.map(({ label }) => (\n <button\n key={label}\n onClick={() => {\n setSelectedOptions(prev => ({ ...prev, [option.name]: label }))\n // setProductSummaryStatus?.({ giftSummary: false, bundleSummary: false })\n }}\n className={cn('w-1/2 text-left font-bold px-4 py-6 rounded-box border-[#E4E5E6] border-2', {\n 'border-brand': selectedOptions[option.name] === label,\n })}\n >\n {label}\n </button>\n ))}\n </div>\n </div>\n )\n }\n })}\n </div>\n )\n}\n\nexport default ProductOptions\n"],
5
- "mappings": "AAsBc,OAqBY,YAAAA,EArBZ,OAAAC,EAKM,QAAAC,MALN,oBAtBd,OAAS,QAAAC,EAAM,WAAAC,MAAuB,+BAEtC,OAAS,MAAAC,MAAU,qCACnB,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,CACC,UAAU,SACV,OAAQmB,EACR,QAAS,CAAC,CAAE,cAAAE,CAAc,IAAM,CAC9BA,EAAc,QAAU,KACxBR,EAAgBO,IAAS,CAAE,GAAGA,EAAM,CAACH,CAAK,EAAG,EAAK,EAAE,CACtD,EACF,EACF,EAEJ,EACApB,EAAC,OAAI,UAAU,6HAA6H,IA5BpIoB,EAAQC,CA6BlB,CAEJ,CAAC,EACH,IAtCQJ,EAAO,EAuCjB,EAIAhB,EAAC,OAAoB,UAAU,6BAC7B,UAAAD,EAACE,EAAA,CAAK,GAAG,IAAI,KAAM,EAAG,UAAU,YAAY,KAAMe,EAAO,KAAM,EAC/DjB,EAAC,OAAI,UAAU,+BACZ,SAAAiB,EAAO,OAAO,IAAI,CAAC,CAAE,MAAAG,CAAM,IAC1BpB,EAAC,UAEC,QAAS,IAAM,CACbY,EAAmBW,IAAS,CAAE,GAAGA,EAAM,CAACN,EAAO,IAAI,EAAGG,CAAM,EAAE,CAEhE,EACA,UAAWhB,EAAG,4EAA6E,CACzF,eAAgBO,EAAgBM,EAAO,IAAI,IAAMG,CACnD,CAAC,EAEA,SAAAA,GATIA,CAUP,CACD,EACH,IAjBQH,EAAO,EAkBjB,CAGN,CAAC,EACH,EAzEkC,IA2EtC,EAEA,IAAOQ,EAAQhB",
6
- "names": ["Fragment", "jsx", "jsxs", "Text", "Picture", "cn", "useState", "useBizProductContext", "useAiuiContext", "handle", "ProductOptions", "product", "selectedOptions", "setSelectedOptions", "setJoinedRecommendBuyProducts", "storeDomain", "imgLoadError", "setImgLoadError", "option", "lowercasedName", "keyword", "label", "index", "imagePath", "prev", "currentTarget", "ProductOptions_default"]
4
+ "sourcesContent": ["import { Text, Picture, Button } from '../../../../../../components'\nimport type { ProductOptionsProps } from '../types'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useState } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport { handle } from '../../../../utils/helper.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\n\nconst ProductOptions = () => {\n const { product, selectedOptions, setSelectedOptions, setJoinedRecommendBuyProducts } =\n useBizProductContext()\n const { storeDomain } = useAiuiContext()\n const [imgLoadError, setImgLoadError] = useState({})\n if (!product.options.length) return null\n return (\n <div className=\"flex flex-col gap-12\">\n {product.options.map(option => {\n const lowercasedName = option.name.toLowerCase()\n const colorKeywords = ['color', 'colour', 'couleur']\n if (colorKeywords.some(keyword => lowercasedName.includes(keyword))) {\n return (\n <div key={option.id} className=\"ipc-product-detail-options\">\n <Text as=\"p\" size={3} className=\"font-bold\" html={'Select Color: ' + selectedOptions[option.name]} />\n <div className=\"flex items-center gap-4 mt-4 ml-1\">\n {option.values.map(({ label }, index) => {\n const imagePath = `https://${storeDomain}/cdn/shop/files/${handle(label)}.png`\n return (\n <div key={label + index} className=\"relative ipc-product-detail-options-value\">\n <button\n aria-label={`switch to ${label}`}\n title={label}\n onClick={() => {\n setSelectedOptions(prev => ({ ...prev, [option.name]: label }))\n setJoinedRecommendBuyProducts?.({ gift: undefined, bundle: undefined })\n }}\n className={cn(\n 'flex size-[30px] items-center justify-center rounded-full bg-center bg-no-repeat outline outline-2 outline-offset-4 outline-white',\n {\n 'outline-brand': selectedOptions[option.name] === label,\n }\n )}\n >\n {!imgLoadError[label as keyof typeof imgLoadError] && (\n <>\n <Picture\n className=\"w-full\"\n source={imagePath}\n onError={({ currentTarget }) => {\n currentTarget.onerror = null // prevents looping\n setImgLoadError(prev => ({ ...prev, [label]: true }))\n }}\n />\n </>\n )}\n </button>\n <div className=\"pointer-events-none absolute inset-0 rounded-full shadow-[inset_0_0_4px_rgba(0,0,0,0.08),inset_0_2px_2px_rgba(0,0,0,0.12)]\"></div>\n </div>\n )\n })}\n </div>\n </div>\n )\n } else {\n return (\n <div key={option.id} className=\"ipc-product-detail-options\">\n <Text as=\"p\" size={3} className=\"font-bold\" html={option.name} />\n <div className=\"flex items-center gap-4 mt-4\">\n {option.values.map(({ label }) => (\n <button\n key={label}\n onClick={() => {\n setSelectedOptions(prev => ({ ...prev, [option.name]: label }))\n // setProductSummaryStatus?.({ giftSummary: false, bundleSummary: false })\n }}\n className={cn('w-1/2 text-left font-bold px-4 py-6 rounded-box border-[#E4E5E6] border-2', {\n 'border-brand': selectedOptions[option.name] === label,\n })}\n >\n {label}\n </button>\n ))}\n </div>\n </div>\n )\n }\n })}\n </div>\n )\n}\n\nexport default withLayout(ProductOptions)\n"],
5
+ "mappings": "AAuBc,OAqBY,YAAAA,EArBZ,OAAAC,EAKM,QAAAC,MALN,oBAvBd,OAAS,QAAAC,EAAM,WAAAC,MAAuB,+BAEtC,OAAS,MAAAC,MAAU,qCACnB,OAAS,YAAAC,MAAgB,QACzB,OAAS,wBAAAC,MAA4B,oCACrC,OAAS,kBAAAC,MAAsB,uCAC/B,OAAS,UAAAC,MAAc,8BACvB,OAAS,cAAAC,MAAkB,qCAE3B,MAAMC,EAAiB,IAAM,CAC3B,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,mBAAAC,EAAoB,8BAAAC,CAA8B,EAClFR,EAAqB,EACjB,CAAE,YAAAS,CAAY,EAAIR,EAAe,EACjC,CAACS,EAAcC,CAAe,EAAIZ,EAAS,CAAC,CAAC,EACnD,OAAKM,EAAQ,QAAQ,OAEnBX,EAAC,OAAI,UAAU,uBACZ,SAAAW,EAAQ,QAAQ,IAAIO,GAAU,CAC7B,MAAMC,EAAiBD,EAAO,KAAK,YAAY,EAE/C,MADsB,CAAC,QAAS,SAAU,SAAS,EACjC,KAAKE,GAAWD,EAAe,SAASC,CAAO,CAAC,EAE9DnB,EAAC,OAAoB,UAAU,6BAC7B,UAAAD,EAACE,EAAA,CAAK,GAAG,IAAI,KAAM,EAAG,UAAU,YAAY,KAAM,iBAAmBU,EAAgBM,EAAO,IAAI,EAAG,EACnGlB,EAAC,OAAI,UAAU,oCACZ,SAAAkB,EAAO,OAAO,IAAI,CAAC,CAAE,MAAAG,CAAM,E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zEkC,IA2EtC,EAEA,IAAOQ,EAAQjB,EAAWC,CAAc",
6
+ "names": ["Fragment", "jsx", "jsxs", "Text", "Picture", "cn", "useState", "useBizProductContext", "useAiuiContext", "handle", "withLayout", "ProductOptions", "product", "selectedOptions", "setSelectedOptions", "setJoinedRecommendBuyProducts", "storeDomain", "imgLoadError", "setImgLoadError", "option", "lowercasedName", "keyword", "label", "index", "imagePath", "prev", "currentTarget", "ProductOptions_default"]
7
7
  }
@@ -1,5 +1,9 @@
1
- declare const ProductGallery: () => import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
2
  export interface ProductGalleryTabRef {
3
3
  scrollToTab: (index: number) => void;
4
4
  }
5
- export default ProductGallery;
5
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<object, keyof import("../../../../../shared/Styles.js").StylesProps> & Partial<import("../../../../../shared/Styles.js").StylesProps & import("../../../../../shared/Styles.js").ContainerProps> & {
6
+ className?: string | undefined;
7
+ data?: Record<string, any> | undefined;
8
+ } & import("react").RefAttributes<any>>;
9
+ export default _default;
@@ -1,2 +1,2 @@
1
- import{Fragment as ce,jsx as e,jsxs as h}from"react/jsx-runtime";import{useAiuiContext as W}from"../../../../AiuiProvider/index.js";import{Text as Z,Picture as V,Badge as K}from"../../../../../components";import{useCallback as w,useMemo as z,useState as v,forwardRef as Y,useRef as M,useEffect as A,useImperativeHandle as J}from"react";import{Swiper as _,SwiperSlide as D}from"swiper/react";import{Navigation as B,Mousewheel as $,Thumbs as H,Pagination as O}from"swiper/modules";import{cn as S}from"../../../../../helpers/index.js";import{GalleryTabType as G}from"./types.js";import{Content as Q,List as X,Root as ee,Trigger as te}from"@radix-ui/react-tabs";import{useBizProductContext as F}from"../../../BizProductProvider.js";import{useVariantMedia as le}from"../../../hooks/use-variant-media.js";import{SpecsModal as ae}from"./components/SpecsModal.js";import ie from"./components/CompareModal.js";import{formatPrice as oe}from"../../../utils/index.js";const q=t=>h("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),e("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),U=t=>h("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),e("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),re=()=>{const{copyWriting:t}=W(),{product:o,variant:p,selectedOptions:N}=F(),u=le({product:o,variant:p}),[s,y]=v(null),L=M(null),n=p?.metafields?.component?.custom_media_list;let g,T,P,x;n&&n?.available?(g=n?.product||[],T=n?.scenarios||[],P=n?.keyFeatures||[],x=n?.video||[]):(g=u?.productList,T=u?.sceneList,P=u?.keyFeaturesList,x=u?.videoList);const a=z(()=>[...g,...T,...x],[g,T,x]),c={productList:g,sceneList:T,keyFeaturesList:P,videoList:x},l=z(()=>(o?.payload?.components?.find(d=>d.componentKey==="ProductGallery")?.data||[])?.map(d=>({...d,galleries:c[d?.galleries]||[]})).filter(d=>d.galleries.length>0),[o?.payload,c]),[f,k]=v(l?.[0]),[b,I]=v(0),[E,i]=v(null),m=w(()=>{const r=(b+1)%l.length;I(r),k(l[r]),i(0)},[b,l]),C=w(()=>{const r=b===0?l.length-1:b-1;I(r),k(l[r]);const d=l[r]?.galleries||[];i(d.length-1)},[b,l]);A(()=>{b!=null&&requestAnimationFrame(()=>{L.current?.scrollToTab(b)})},[b]),A(()=>{k(l[0]),I(0)},[p?.id]);const R=(r,d)=>{switch(r?.galleryTabType){case G.GALLERY_IMAGE_MAIN:return e(j,{...r,index:d,onNextTab:m,onPrevTab:C,targetSlideIndex:E,onSlideChange:()=>i(null)});case G.GALLERY_IMAGE_FEATURES:return e(j,{...r,index:d,onNextTab:m,onPrevTab:C,targetSlideIndex:E,onSlideChange:()=>i(null)});case G.GALLERY_IMAGE_SCENE:return e(j,{...r,index:d,onNextTab:m,onPrevTab:C,targetSlideIndex:E,onSlideChange:()=>i(null)});case G.GALLERY_VIDEO:return e(ne,{...r,onNextTab:m,onPrevTab:C,targetSlideIndex:E,onSlideChange:()=>i(null)});default:return null}};return e("div",{id:"ipc-product-gallery",children:h(ee,{className:"relative",value:f?.tabValue,defaultValue:l?.[0]?.tabValue,children:[e("div",{className:"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative ",children:l.map((r,d)=>e(Q,{className:"h-full",value:r.tabValue,children:R(r,d)},r.tabValue))}),e(se,{ref:L,galleryTabs:l,activeGalleryTab:f,setActiveGalleryTab:k,setActiveTabIndex:I,setTargetSlideIndex:i})]})})},se=Y((t,o)=>{const{galleryTabs:p,activeGalleryTab:N,setActiveGalleryTab:u,setActiveTabIndex:s,setTargetSlideIndex:y}=t,{product:L}=F(),n=M(null),g=M(new Map),T=w((a,c,l)=>{u(c),s(l),y(0),P(a)},[u,s,y]),P=w(a=>{if(n.current){const c=n.current,l=a.currentTarget,f=l.offsetLeft-c.offsetWidth/2+l.offsetWidth/2;c.scrollTo({left:f,behavior:"smooth"})}},[]),x=w(a=>{if(n.current&&p[a]){const c=n.current,l=p[a],f=g.current.get(l.tabValue);if(f){const k=f.offsetLeft-c.offsetWidth/2+f.offsetWidth/2;c.scrollTo({left:k,behavior:"smooth"})}}},[p]);return J(o,()=>({scrollToTab:x})),h("div",{className:"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static",children:[e(X,{ref:n,className:"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e("div",{className:"whitespace-nowrap",children:p?.map((a,c)=>e(te,{ref:l=>{l?g.current.set(a.tabValue,l):g.current.delete(a.tabValue)},className:S("lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",a.tabValue===N?.tabValue&&"bg-white"),onClick:l=>T(l,a,c),value:a.tabValue,children:a.tabLabel},a.tabValue))})}),e("div",{className:"laptop:gap-2 hidden laptop:flex",children:L.metafields?.global?.specifications&&h(ce,{children:[e(ae,{})," | ",e(ie,{})]})})]})}),j=Y((t,o)=>{const{locale:p="us",copyWriting:N}=W(),{variant:u,totalSavings:s}=F(),y=M(null),[L,n]=v(null),[g,T]=v(!0),[P,x]=v(!1),[a,c]=v(null),l=M(null),[f,k]=v(!1),b=z(()=>{if(t?.galleryTabType===G.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===G.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,G.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),I=w(()=>{a?.isBeginning?t.onPrevTab?.():a?.slidePrev()},[a,t]),E=w(()=>{a?.isEnd?t.onNextTab?.():a?.slideNext()},[a,t]);return A(()=>{a&&t.targetSlideIndex&&(a.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[a,t.targetSlideIndex,t]),A(()=>{if(l.current){const i=l.current,m=i.scrollHeight,C=i.clientHeight,R=m>C;k(R)}},[]),h("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[e(_,{ref:o,className:"h-full",onSwiper:c,onProgress:i=>{T(i.isBeginning),x(i.isEnd)},onTouchEnd:(i,m)=>{i.isBeginning&&i.swipeDirection==="prev"?I():i.isEnd&&i.swipeDirection==="next"&&E()},pagination:{clickable:!0,el:y.current},thumbs:{swiper:L},modules:[$,H,B,O],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((i,m)=>e(D,{className:"h-full",children:e(V,{source:i?.image?.url,alt:i?.image?.altText,className:S("h-full",b),imgClassName:"object-cover h-full"})},t?.id+"SwiperSlideItem"+m))}),u.availableForSale&&!!s&&!t.index&&e(K,{size:"lg",className:"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6",children:`${oe({amount:s,currencyCode:u?.price?.currencyCode,locale:p})} ${N?.off}`}),e("div",{className:S("hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:I,children:e(q,{className:S("tablet:size-10 lg-desktop:size-12")})}),e("div",{className:S("hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:E,children:e(U,{className:S("tablet:size-10 lg-desktop:size-12")})}),h("div",{className:"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6",children:[e("div",{className:"hidden tablet:block",children:e(_,{className:"flex items-center justify-between",onSwiper:n,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[B,H],children:t?.galleries?.map((i,m)=>e(D,{className:"!w-auto border [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand",children:e(V,{source:i.image?.url,alt:i.image?.altText,className:"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded",imgClassName:"object-contain h-full"})},t?.id+"SwiperSlideThumbItem"+m))})}),!t?.index&&h("div",{className:"flex items-center gap-2",children:[e(V,{source:t?.comment?.avatar?.url,className:"size-8 laptop:size-10 rounded-full shrink-0",imgClassName:"object-cover "}),e("div",{className:"overflow-hidden max-w-[528px] relative",children:e("div",{ref:l,className:S("h-10 lg-desktop:h-12",f?"animate-marquee-scroll":""),style:{animationDuration:"3s"},children:e(Z,{html:t?.comment?.content,className:"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]"})})})]})]}),e("div",{ref:y,className:"tablet:hidden [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100 [&_.swiper-pagination-bullet]:bg-white text-center absolute !bottom-[70px] left-4 right-4 z-10"})]})}),ne=t=>{const[o,p]=v(null),N=w(()=>{o?.isBeginning?t.onPrevTab?.():o?.slidePrev()},[o,t]),u=w(()=>{o?.isEnd?t.onNextTab?.():o?.slideNext()},[o,t]);return A(()=>{o&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(o.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[o,t.targetSlideIndex,t]),h("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[e(_,{className:"h-full",onSwiper:p,onTouchEnd:(s,y)=>{s.isBeginning&&s.swipeDirection==="prev"?N():s.isEnd&&s.swipeDirection==="next"&&u()},modules:[$,H,B,O],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((s,y)=>e(D,{className:"h-full",children:h("video",{controls:!0,className:"size-full object-cover",children:[e("track",{kind:"captions"}),e("source",{src:s?.sources?.[0]?.url,type:"video/mp4"}),e("source",{src:s?.sources?.[0]?.url,type:"video/webm"}),e("source",{src:s?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+y))}),e("div",{className:S("hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:N,children:e(q,{className:"tablet:size-10 lg-desktop:size-12"})}),e("div",{className:S("hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:u,children:e(U,{className:"tablet:size-10 lg-desktop:size-12"})})]})},ke=t=>e("div",{children:"3D View"});var Ne=re;export{Ne as default};
1
+ import{Fragment as ve,jsx as e,jsxs as y}from"react/jsx-runtime";import{useAiuiContext as q}from"../../../../AiuiProvider/index.js";import{Text as ee,Picture as z,Badge as te}from"../../../../../components";import{useCallback as S,useMemo as D,useState as h,forwardRef as U,useRef as R,useEffect as V,useImperativeHandle as le}from"react";import{Swiper as B,SwiperSlide as $}from"swiper/react";import{Navigation as H,Mousewheel as Z,Thumbs as F,Pagination as J}from"swiper/modules";import{cn as k}from"../../../../../helpers/index.js";import{GalleryTabType as C}from"./types.js";import{Content as ae,List as oe,Root as ie,Trigger as re}from"@radix-ui/react-tabs";import{useBizProductContext as j}from"../../../BizProductProvider.js";import{useVariantMedia as se}from"../../../hooks/use-variant-media.js";import{SpecsModal as ne}from"./components/SpecsModal.js";import ce from"./components/CompareModal.js";import{formatPrice as de}from"../../../utils/index.js";import{withLayout as ue}from"../../../../../shared/Styles.js";import{gaTrack as pe}from"../../../../../shared/track.js";import{ExposureDetector as be}from"../../../../../components/index.js";const Q=t=>y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),e("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),X=t=>y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),e("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),me=()=>{const{copyWriting:t}=q(),{product:s,variant:m,selectedOptions:G}=j(),d=se({product:s,variant:m}),[c,T]=h(null),I=R(null),u=m?.metafields?.component?.custom_media_list;let f,x,M,w;u&&u?.available?(f=u?.product||[],x=u?.scenarios||[],M=u?.keyFeatures||[],w=u?.video||[]):(f=d?.productList,x=d?.sceneList,M=d?.keyFeaturesList,w=d?.videoList);const o=D(()=>[...f,...x,...w],[f,x,w]),p={productList:f,sceneList:x,keyFeaturesList:M,videoList:w},l=D(()=>(s?.payload?.components?.find(r=>r.componentKey==="ProductGallery")?.data||[])?.map(r=>{let Y=p[r?.galleries]||[];if(r?.images&&Array.isArray(r.images)&&r.images.length>0){const O=r.images.map(n=>{const _=[];if(n.image_390&&n.image_390.trim()&&_.push(`${n.image_390} 390`),n.image_768&&n.image_768.trim()&&_.push(`${n.image_768} 768`),n.image_1024&&n.image_1024.trim()&&_.push(`${n.image_1024} 1024`),n.image_1440&&n.image_1440.trim()&&_.push(`${n.image_1440} 1440`),n.image_1920&&n.image_1920.trim()&&_.push(`${n.image_1920} 1920`),_.length>0){const K=_.join(", ");return{image:{url:K,altText:r.comment?.content||""},_fromImages:!0,_responsiveSource:K}}return null}).filter(n=>n!==null);O.length>0&&(Y=O)}return{...r,galleries:Y}}).filter(r=>r.galleries.length>0),[s?.payload,p]),[v,E]=h(l?.[0]),[g,P]=h(0),[L,a]=h(null),b=S(()=>{const i=(g+1)%l.length;P(i),E(l[i]),a(0)},[g,l]),N=S(()=>{const i=g===0?l.length-1:g-1;P(i),E(l[i]);const r=l[i]?.galleries||[];a(r.length-1)},[g,l]);V(()=>{g!=null&&requestAnimationFrame(()=>{I.current?.scrollToTab(g)})},[g]),V(()=>{E(l[0]),P(0)},[m?.id]);const A=(i,r)=>{switch(i?.galleryTabType){case C.GALLERY_IMAGE_MAIN:return e(W,{...i,index:r,onNextTab:b,onPrevTab:N,targetSlideIndex:L,onSlideChange:()=>a(null)});case C.GALLERY_IMAGE_FEATURES:return e(W,{...i,index:r,onNextTab:b,onPrevTab:N,targetSlideIndex:L,onSlideChange:()=>a(null)});case C.GALLERY_IMAGE_SCENE:return e(W,{...i,index:r,onNextTab:b,onPrevTab:N,targetSlideIndex:L,onSlideChange:()=>a(null)});case C.GALLERY_VIDEO:return e(fe,{...i,onNextTab:b,onPrevTab:N,targetSlideIndex:L,onSlideChange:()=>a(null)});default:return null}};return e("div",{id:"ipc-product-gallery",children:y(ie,{className:"relative",value:v?.tabValue,defaultValue:l?.[0]?.tabValue,children:[e("div",{className:"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative ",children:l.map((i,r)=>e(ae,{className:"h-full",value:i.tabValue,children:A(i,r)},i.tabValue))}),e(ge,{ref:I,galleryTabs:l,activeGalleryTab:v,setActiveGalleryTab:E,setActiveTabIndex:P,setTargetSlideIndex:a})]})})},ge=U((t,s)=>{const{galleryTabs:m,activeGalleryTab:G,setActiveGalleryTab:d,setActiveTabIndex:c,setTargetSlideIndex:T}=t,{product:I}=j(),u=R(null),f=R(new Map),x=S((o,p,l)=>{d(p),c(l),T(0),M(o)},[d,c,T]),M=S(o=>{if(u.current){const p=u.current,l=o.currentTarget,v=l.offsetLeft-p.offsetWidth/2+l.offsetWidth/2;p.scrollTo({left:v,behavior:"smooth"})}},[]),w=S(o=>{if(u.current&&m[o]){const p=u.current,l=m[o],v=f.current.get(l.tabValue);if(v){const E=v.offsetLeft-p.offsetWidth/2+v.offsetWidth/2;p.scrollTo({left:E,behavior:"smooth"})}}},[m]);return le(s,()=>({scrollToTab:w})),y("div",{className:"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static",children:[e(oe,{ref:u,className:"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e("div",{className:"whitespace-nowrap",children:m?.map((o,p)=>e(re,{ref:l=>{l?f.current.set(o.tabValue,l):f.current.delete(o.tabValue)},className:k("lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight",o.tabValue===G?.tabValue&&"bg-white"),onClick:l=>x(l,o,p),value:o.tabValue,children:o.tabLabel},o.tabValue))})}),e("div",{className:"laptop:gap-2 hidden laptop:flex",children:I.metafields?.global?.specifications&&y(ve,{children:[e(ne,{})," | ",e(ce,{})]})})]})}),W=U((t,s)=>{const{locale:m="us",copyWriting:G}=q(),{variant:d,totalSavings:c}=j(),T=R(null),[I,u]=h(null),[f,x]=h(!0),[M,w]=h(!1),[o,p]=h(null),l=R(null),[v,E]=h(!1),g=D(()=>{if(t?.galleryTabType===C.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";t?.galleryTabType===C.GALLERY_IMAGE_FEATURES||(t?.galleryTabType,C.GALLERY_IMAGE_SCENE)},[t?.galleryTabType]),P=S(()=>{o?.isBeginning?t.onPrevTab?.():o?.slidePrev()},[o,t]),L=S(()=>{o?.isEnd?t.onNextTab?.():o?.slideNext()},[o,t]);return V(()=>{o&&t.targetSlideIndex&&(o.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[o,t.targetSlideIndex,t]),V(()=>{if(l.current){const a=l.current,b=a.scrollHeight,N=a.clientHeight,A=b>N;E(A)}},[]),y("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[e(B,{ref:s,className:"h-full",onSwiper:p,onProgress:a=>{x(a.isBeginning),w(a.isEnd)},onTouchEnd:(a,b)=>{a.isBeginning&&a.swipeDirection==="prev"?P():a.isEnd&&a.swipeDirection==="next"&&L()},pagination:{clickable:!0,el:T.current},thumbs:{swiper:I},modules:[Z,F,H,J],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((a,b)=>{const N=`${t.id}-${b}`,A=()=>{pe({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${d.sku}`,component_type:"image",component_name:t?.tabLabel||"",position:b+1,creative_id:"",component_title:"",component_description:"",navigation:""}})},i=a?._responsiveSource||a?.image?.url||"";return console.log("item",a?._responsiveSource),e($,{className:"h-full",children:e(be,{onExposure:A,exposureKey:N,threshold:.5,duration:2e3,className:"h-full",children:e(z,{source:i,alt:a?.image?.altText,className:k("h-full",g),imgClassName:"object-cover h-full"})})},t?.id+"SwiperSlideItem"+b)})}),d.availableForSale&&!!c&&!t.index&&e(te,{size:"lg",className:"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6",children:`${de({amount:c,currencyCode:d?.price?.currencyCode,locale:m})} ${G?.off}`}),e("div",{className:k("hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:P,children:e(Q,{className:k("tablet:size-10 lg-desktop:size-12")})}),e("div",{className:k("hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer","swiper-button"),onClick:L,children:e(X,{className:k("tablet:size-10 lg-desktop:size-12")})}),y("div",{className:"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6",children:[e("div",{className:"hidden tablet:block",children:e(B,{className:"flex items-center justify-between",onSwiper:u,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[H,F],children:t?.galleries?.map((a,b)=>e($,{className:"!w-auto border border-transparent cursor-pointer [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand",children:e(z,{source:a.image?.url,alt:a.image?.altText,className:"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded",imgClassName:"object-contain h-full"})},t?.id+"SwiperSlideThumbItem"+b))})}),!t?.index&&y("div",{className:"flex items-center gap-2",children:[e(z,{source:t?.comment?.avatar?.url,className:"size-8 laptop:size-10 rounded-full shrink-0",imgClassName:"object-cover "}),e("div",{className:"overflow-hidden max-w-[528px] relative",children:e("div",{ref:l,className:k("h-10 lg-desktop:h-12",v?"animate-marquee-scroll":""),style:{animationDuration:"3s"},children:e(ee,{html:t?.comment?.content,className:"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]"})})})]})]}),e("div",{ref:T,className:"tablet:hidden [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100 [&_.swiper-pagination-bullet]:bg-white text-center absolute !bottom-[70px] left-4 right-4 z-10"})]})}),fe=t=>{const[s,m]=h(null),G=S(()=>{s?.isBeginning?t.onPrevTab?.():s?.slidePrev()},[s,t]),d=S(()=>{s?.isEnd?t.onNextTab?.():s?.slideNext()},[s,t]);return V(()=>{s&&t.targetSlideIndex!==null&&t.targetSlideIndex!==void 0&&(s.slideTo(t.targetSlideIndex,0),t.onSlideChange?.())},[s,t.targetSlideIndex,t]),y("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[e(B,{className:"h-full",onSwiper:m,onTouchEnd:(c,T)=>{c.isBeginning&&c.swipeDirection==="prev"?G():c.isEnd&&c.swipeDirection==="next"&&d()},modules:[Z,F,H,J],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:t?.galleries?.map((c,T)=>e($,{className:"h-full",children:y("video",{controls:!0,className:"size-full object-cover",children:[e("track",{kind:"captions"}),e("source",{src:c?.sources?.[0]?.url,type:"video/mp4"}),e("source",{src:c?.sources?.[0]?.url,type:"video/webm"}),e("source",{src:c?.sources?.[0]?.url,type:"video/ogg"})]})},t?.id+"SwiperSlideItem"+T))}),e("div",{className:k("hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:G,children:e(Q,{className:"tablet:size-10 lg-desktop:size-12"})}),e("div",{className:k("hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer"),onClick:d,children:e(X,{className:"tablet:size-10 lg-desktop:size-12"})})]})},Re=t=>e("div",{children:"3D View"});var Ve=ue(me);export{Ve as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductGallery/index.tsx"],
4
- "sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { Text, Picture, Button, Badge } from '../../../../../components'\nimport {\n useCallback,\n useMemo,\n useState,\n forwardRef,\n useRef,\n type RefObject,\n useEffect,\n type Dispatch,\n type SetStateAction,\n useImperativeHandle,\n} from 'react'\nimport { Swiper, SwiperSlide, type SwiperRef } from 'swiper/react'\nimport { Navigation, Mousewheel, Thumbs, Pagination } from 'swiper/modules'\nimport { cn } from '../../../../../helpers/index.js'\nimport { GalleryTabType } from './types.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useVariantMedia } from '../../../hooks/use-variant-media.js'\nimport { SpecsModal } from './components/SpecsModal.js'\nimport CompareModal from './components/CompareModal.js'\nimport { formatPrice } from '../../../utils/index.js'\n\nimport type { Swiper as SwiperType } from 'swiper'\nimport type { ImageMedia, VideoMedia } from '../../../hooks/use-variant-media.js'\nimport type { ProductGalleryProps, ProductGalleryTabItemProps, GalleryTabItemProps } from './types.js'\n\nconst SwiperLeftButtonIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <rect x=\"48\" y=\"48\" width=\"48\" height=\"48\" rx=\"24\" transform=\"rotate(-180 48 48)\" fill=\"white\" />\n <path\n d=\"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nconst SwiperRightButtonIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <rect width=\"48\" height=\"48\" rx=\"24\" transform=\"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)\" fill=\"white\" />\n <path\n d=\"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nconst ProductGallery = () => {\n const { copyWriting } = useAiuiContext()\n const { product, variant, selectedOptions } = useBizProductContext()\n const defaultMediaData = useVariantMedia({ product, variant })\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n const productGalleryTabRef = useRef<ProductGalleryTabRef>(null)\n\n const customMediaList = variant?.metafields?.component?.custom_media_list\n let productList: ImageMedia[], sceneList: ImageMedia[], keyFeaturesList: ImageMedia[], videoList: VideoMedia[]\n\n if (customMediaList && customMediaList?.available) {\n productList = customMediaList?.product || []\n sceneList = customMediaList?.scenarios || []\n keyFeaturesList = customMediaList?.keyFeatures || []\n videoList = customMediaList?.video || []\n } else {\n productList = defaultMediaData?.productList\n sceneList = defaultMediaData?.sceneList\n keyFeaturesList = defaultMediaData?.keyFeaturesList\n videoList = defaultMediaData?.videoList\n }\n\n const allMedia = useMemo(() => [...productList, ...sceneList, ...videoList], [productList, sceneList, videoList])\n\n const galleryMap: Record<string, ImageMedia[] | VideoMedia[]> = {\n productList: productList,\n sceneList: sceneList,\n keyFeaturesList: keyFeaturesList,\n videoList: videoList,\n }\n\n const galleryTabs = useMemo(() => {\n const productTab =\n product?.payload?.components?.find((item: any) => item.componentKey === 'ProductGallery')?.data || []\n\n return productTab\n ?.map((item: any) => ({\n ...item,\n galleries: galleryMap[item?.galleries] || [],\n }))\n .filter((item: any) => item.galleries.length > 0)\n }, [product?.payload, galleryMap])\n\n const [activeGalleryTab, setActiveGalleryTab] = useState<GalleryTabItemProps>(galleryTabs?.[0])\n const [activeTabIndex, setActiveTabIndex] = useState(0)\n const [targetSlideIndex, setTargetSlideIndex] = useState<number | null>(null)\n\n // \u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\uFF08\u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\uFF09\n const handleNextTab = useCallback(() => {\n const nextIndex = (activeTabIndex + 1) % galleryTabs.length\n setActiveTabIndex(nextIndex)\n setActiveGalleryTab(galleryTabs[nextIndex])\n setTargetSlideIndex(0) // \u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\n }, [activeTabIndex, galleryTabs])\n\n // \u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\uFF08\u8DF3\u8F6C\u5230\u6700\u540E\u4E00\u5F20\uFF09\n const handlePrevTab = useCallback(() => {\n const prevIndex = activeTabIndex === 0 ? galleryTabs.length - 1 : activeTabIndex - 1\n setActiveTabIndex(prevIndex)\n setActiveGalleryTab(galleryTabs[prevIndex])\n // \u8DF3\u8F6C\u5230\u4E0A\u4E00\u4E2A tab \u7684\u6700\u540E\u4E00\u5F20\n const prevTabGalleries = galleryTabs[prevIndex]?.galleries || []\n setTargetSlideIndex(prevTabGalleries.length - 1)\n }, [activeTabIndex, galleryTabs])\n\n // \u5F53 activeTabIndex \u53D8\u5316\u65F6\uFF0C\u81EA\u52A8\u6EDA\u52A8\u5230\u5BF9\u5E94\u7684 tab\n useEffect(() => {\n if (activeTabIndex !== null && activeTabIndex !== undefined) {\n // \u4F7F\u7528 requestAnimationFrame \u786E\u4FDD DOM \u5DF2\u66F4\u65B0\n requestAnimationFrame(() => {\n productGalleryTabRef.current?.scrollToTab(activeTabIndex)\n })\n }\n }, [activeTabIndex])\n\n useEffect(() => {\n // \u5F53 variant \u53D8\u5316\u65F6\uFF0C\u5207\u6362\u5230\u7B2C\u4E00\u4E2A tab\n setActiveGalleryTab(galleryTabs[0])\n setActiveTabIndex(0)\n }, [variant?.id])\n\n // \u4E3A\u6BCF\u4E2A tab \u6E32\u67D3\u5BF9\u5E94\u7684\u7EC4\u4EF6\n const renderGalleryForTab = (tab: any, index: number) => {\n switch (tab?.galleryTabType) {\n case GalleryTabType.GALLERY_IMAGE_MAIN:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_IMAGE_FEATURES:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_IMAGE_SCENE:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_VIDEO:\n return (\n <ProductGalleryTabVideo\n {...tab}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n default:\n return null\n }\n }\n\n return (\n <div id=\"ipc-product-gallery\">\n <Root className=\"relative\" value={activeGalleryTab?.tabValue} defaultValue={galleryTabs?.[0]?.tabValue}>\n <div className=\"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative \">\n {galleryTabs.map((item: any, index: number) => {\n return (\n <Content key={item.tabValue} className=\"h-full\" value={item.tabValue}>\n {renderGalleryForTab(item, index)}\n </Content>\n )\n })}\n </div>\n <ProductGalleryTab\n ref={productGalleryTabRef}\n galleryTabs={galleryTabs}\n activeGalleryTab={activeGalleryTab}\n setActiveGalleryTab={setActiveGalleryTab}\n setActiveTabIndex={setActiveTabIndex}\n setTargetSlideIndex={setTargetSlideIndex}\n />\n </Root>\n </div>\n )\n}\n\nexport interface ProductGalleryTabRef {\n scrollToTab: (index: number) => void\n}\n\nconst ProductGalleryTab = forwardRef<\n ProductGalleryTabRef,\n {\n galleryTabs: GalleryTabItemProps[]\n activeGalleryTab: GalleryTabItemProps\n setActiveGalleryTab: Dispatch<SetStateAction<GalleryTabItemProps>>\n setActiveTabIndex: Dispatch<SetStateAction<number>>\n setTargetSlideIndex: Dispatch<SetStateAction<number | null>>\n }\n>((props, ref) => {\n const { galleryTabs, activeGalleryTab, setActiveGalleryTab, setActiveTabIndex, setTargetSlideIndex } = props\n const { product } = useBizProductContext()\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const triggerRefs = useRef<Map<string, HTMLButtonElement>>(new Map())\n\n const handleGalleryTabClick = useCallback(\n (el: React.MouseEvent<HTMLButtonElement>, item: GalleryTabItemProps, index: number) => {\n setActiveGalleryTab(item)\n setActiveTabIndex(index)\n setTargetSlideIndex(0) // \u624B\u52A8\u70B9\u51FB tab \u65F6\uFF0C\u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\n scrollToEvent(el)\n },\n [setActiveGalleryTab, setActiveTabIndex, setTargetSlideIndex]\n )\n\n const scrollToEvent = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = event.currentTarget\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }, [])\n\n // \u6EDA\u52A8\u5230\u6307\u5B9A\u7D22\u5F15\u7684 tab\n const scrollToTab = useCallback(\n (index: number) => {\n if (scrollContainerRef.current && galleryTabs[index]) {\n const container = scrollContainerRef.current\n const tabItem = galleryTabs[index]\n const button = triggerRefs.current.get(tabItem.tabValue)\n\n if (button) {\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }\n },\n [galleryTabs]\n )\n\n useImperativeHandle(ref, () => ({\n scrollToTab,\n }))\n\n return (\n <div className=\"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static\">\n <List\n ref={scrollContainerRef}\n className=\"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n <div className=\"whitespace-nowrap\">\n {galleryTabs?.map((item, index) => {\n return (\n <Trigger\n ref={el => {\n if (el) {\n triggerRefs.current.set(item.tabValue, el)\n } else {\n triggerRefs.current.delete(item.tabValue)\n }\n }}\n className={cn(\n 'lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n item.tabValue === activeGalleryTab?.tabValue && 'bg-white'\n )}\n onClick={el => handleGalleryTabClick(el, item, index)}\n key={item.tabValue}\n value={item.tabValue}\n >\n {item.tabLabel}\n </Trigger>\n )\n })}\n </div>\n </List>\n <div className=\"laptop:gap-2 hidden laptop:flex\">\n {product.metafields?.global?.specifications && (\n <>\n <SpecsModal /> | <CompareModal />\n </>\n )}\n </div>\n </div>\n )\n})\n\nconst ProductGalleryTabImage = forwardRef<SwiperRef, ProductGalleryTabItemProps>((props, ref) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, totalSavings } = useBizProductContext()\n const paginationRef = useRef<HTMLDivElement>(null)\n const [thumbsSwiper, setThumbsSwiper] = useState<SwiperType | null>(null)\n const [isStart, setStart] = useState(true)\n const [isEnd, setEnd] = useState(false)\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n const commentRef = useRef<HTMLDivElement>(null)\n const [shouldScroll, setShouldScroll] = useState(false)\n\n const imageClassName = useMemo(() => {\n if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_MAIN) {\n return 'size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]'\n } else if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_FEATURES) {\n // return '420px'\n } else if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_SCENE) {\n // return '560px'\n }\n }, [props?.galleryTabType])\n\n // \u5904\u7406\u5DE6\u53F3\u6309\u94AE\u70B9\u51FB\uFF0C\u652F\u6301\u8DE8 tab \u5FAA\u73AF\n const handlePrevClick = useCallback(() => {\n if (swiper?.isBeginning) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u7B2C\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\n props.onPrevTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slidePrev()\n }\n }, [swiper, props])\n\n const handleNextClick = useCallback(() => {\n if (swiper?.isEnd) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\n props.onNextTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slideNext()\n }\n }, [swiper, props])\n\n // \u76D1\u542C targetSlideIndex\uFF0C\u5F53 tab \u5207\u6362\u65F6\u8DF3\u8F6C\u5230\u6307\u5B9A\u7684 slide\n useEffect(() => {\n if (swiper && !!props.targetSlideIndex) {\n swiper.slideTo(props.targetSlideIndex, 0) // 0 \u8868\u793A\u7ACB\u5373\u8DF3\u8F6C\uFF0C\u65E0\u52A8\u753B\n props.onSlideChange?.() // \u6E05\u9664 targetSlideIndex\n }\n }, [swiper, props.targetSlideIndex, props])\n\n // \u68C0\u6D4B\u6587\u672C\u5185\u5BB9\u662F\u5426\u8D85\u8FC7\u5BB9\u5668\u9AD8\u5EA6\uFF0C\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6EDA\u52A8\n useEffect(() => {\n if (commentRef.current) {\n const container = commentRef.current\n const contentHeight = container.scrollHeight\n const containerHeight = container.clientHeight\n const needsScroll = contentHeight > containerHeight\n setShouldScroll(needsScroll)\n }\n }, [])\n\n return (\n <div className=\"h-full [&_.swiper-button]:hover:opacity-100\">\n <Swiper\n ref={ref}\n className=\"h-full\"\n // navigation={{\n // nextEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n // prevEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n // }}\n onSwiper={setSwiper}\n onProgress={swiper => {\n setStart(swiper.isBeginning)\n setEnd(swiper.isEnd)\n }}\n onTouchEnd={(swiper, event) => {\n if (swiper.isBeginning && swiper.swipeDirection === 'prev') {\n handlePrevClick()\n } else if (swiper.isEnd && swiper.swipeDirection === 'next') {\n handleNextClick()\n }\n }}\n pagination={{\n clickable: true,\n el: paginationRef.current,\n }}\n thumbs={{ swiper: thumbsSwiper }}\n modules={[Mousewheel, Thumbs, Navigation, Pagination]}\n mousewheel={{\n forceToAxis: true,\n }}\n breakpoints={{\n 0: {\n slidesPerView: 1,\n freeMode: false,\n },\n }}\n >\n {props?.galleries?.map((item, jIndex) => {\n return (\n <SwiperSlide className=\"h-full\" key={props?.id + 'SwiperSlideItem' + jIndex}>\n <Picture\n source={item?.image?.url}\n alt={item?.image?.altText}\n className={cn('h-full', imageClassName)}\n imgClassName=\"object-cover h-full\"\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n {variant.availableForSale && !!totalSavings && !props.index && (\n <Badge\n size=\"lg\"\n className=\"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6\"\n >\n {`${formatPrice({\n amount: totalSavings,\n currencyCode: variant?.price?.currencyCode,\n locale: locale,\n })} ${copyWriting?.off}`}\n </Badge>\n )}\n <div\n className={cn(\n 'hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer',\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n `swiper-button`\n )}\n onClick={handlePrevClick}\n >\n <SwiperLeftButtonIcon className={cn('tablet:size-10 lg-desktop:size-12')} />\n </div>\n <div\n className={cn(\n 'hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer',\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n `swiper-button`\n )}\n onClick={handleNextClick}\n >\n <SwiperRightButtonIcon className={cn('tablet:size-10 lg-desktop:size-12')} />\n </div>\n {/* {props?.galleries?.map((item, jIndex) => {\n return (\n <Picture\n key={props?.id + 'SwiperSlideItem' + jIndex}\n source={item?.image?.url}\n alt={item?.image?.altText}\n className=\"h-full\"\n imgClassName=\"object-cover h-full\"\n />\n )\n })} */}\n <div className=\"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6\">\n <div className=\"hidden tablet:block\">\n <Swiper\n className=\"flex items-center justify-between\"\n onSwiper={setThumbsSwiper}\n spaceBetween={12}\n slidesPerView={6}\n freeMode={true}\n watchSlidesProgress={true}\n modules={[Navigation, Thumbs]}\n >\n {props?.galleries?.map((item, jIndex) => (\n <SwiperSlide\n key={props?.id + 'SwiperSlideThumbItem' + jIndex}\n className=\"!w-auto border [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand\"\n >\n <Picture\n source={item.image?.url}\n alt={item.image?.altText}\n className=\"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded\"\n imgClassName=\"object-contain h-full\"\n />\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n {!props?.index && (\n <div className=\"flex items-center gap-2\">\n <Picture\n source={props?.comment?.avatar?.url}\n className=\"size-8 laptop:size-10 rounded-full shrink-0\"\n imgClassName=\"object-cover \"\n />\n <div className=\"overflow-hidden max-w-[528px] relative\">\n <div\n ref={commentRef}\n className={cn('h-10 lg-desktop:h-12', shouldScroll ? 'animate-marquee-scroll' : '')}\n style={{\n animationDuration: `3s`,\n }}\n >\n <Text\n html={props?.comment?.content}\n className=\"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n <div\n ref={paginationRef}\n className=\"tablet:hidden [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100 [&_.swiper-pagination-bullet]:bg-white text-center absolute !bottom-[70px] left-4 right-4 z-10\"\n />\n </div>\n )\n})\n\nconst ProductGalleryTabVideo = (props: ProductGalleryTabItemProps) => {\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n\n // \u5904\u7406\u5DE6\u53F3\u6309\u94AE\u70B9\u51FB\uFF0C\u652F\u6301\u8DE8 tab \u5FAA\u73AF\n const handlePrevClick = useCallback(() => {\n if (swiper?.isBeginning) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u7B2C\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\n props.onPrevTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slidePrev()\n }\n }, [swiper, props])\n\n const handleNextClick = useCallback(() => {\n if (swiper?.isEnd) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\n props.onNextTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slideNext()\n }\n }, [swiper, props])\n\n // \u76D1\u542C targetSlideIndex\uFF0C\u5F53 tab \u5207\u6362\u65F6\u8DF3\u8F6C\u5230\u6307\u5B9A\u7684 slide\n useEffect(() => {\n if (swiper && props.targetSlideIndex !== null && props.targetSlideIndex !== undefined) {\n swiper.slideTo(props.targetSlideIndex, 0) // 0 \u8868\u793A\u7ACB\u5373\u8DF3\u8F6C\uFF0C\u65E0\u52A8\u753B\n props.onSlideChange?.() // \u6E05\u9664 targetSlideIndex\n }\n }, [swiper, props.targetSlideIndex, props])\n\n return (\n <div className=\"h-full [&_.swiper-button]:hover:opacity-100\">\n <Swiper\n className=\"h-full\"\n onSwiper={setSwiper}\n onTouchEnd={(swiper, event) => {\n if (swiper.isBeginning && swiper.swipeDirection === 'prev') {\n handlePrevClick()\n } else if (swiper.isEnd && swiper.swipeDirection === 'next') {\n handleNextClick()\n }\n }}\n // navigation={{\n // nextEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n // prevEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n // }}\n modules={[Mousewheel, Thumbs, Navigation, Pagination]}\n mousewheel={{\n forceToAxis: true,\n }}\n breakpoints={{\n 0: {\n slidesPerView: 1,\n freeMode: false,\n },\n }}\n >\n {props?.galleries?.map((item, jIndex) => {\n return (\n <SwiperSlide className=\"h-full\" key={props?.id + 'SwiperSlideItem' + jIndex}>\n <video controls className=\"size-full object-cover\">\n <track kind=\"captions\" />\n <source src={item?.sources?.[0]?.url} type=\"video/mp4\" />\n <source src={item?.sources?.[0]?.url} type=\"video/webm\" />\n <source src={item?.sources?.[0]?.url} type=\"video/ogg\" />\n </video>\n </SwiperSlide>\n )\n })}\n </Swiper>\n <div\n className={cn(\n 'hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer'\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-prev`\n )}\n onClick={handlePrevClick}\n >\n <SwiperLeftButtonIcon className=\"tablet:size-10 lg-desktop:size-12\" />\n </div>\n <div\n className={cn(\n 'hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer'\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-next`\n )}\n onClick={handleNextClick}\n >\n <SwiperRightButtonIcon className=\"tablet:size-10 lg-desktop:size-12\" />\n </div>\n </div>\n )\n}\n\nconst ProductGalleryTab3DView = (props: ProductGalleryTabItemProps) => {\n return <div>3D View</div>\n}\n\nexport default ProductGallery\n"],
5
- "mappings": "AA+BI,OAyRM,YAAAA,GAxRJ,OAAAC,EADF,QAAAC,MAAA,oBA/BJ,OAAS,kBAAAC,MAAsB,oCAC/B,OAAS,QAAAC,EAAM,WAAAC,EAAiB,SAAAC,MAAa,4BAC7C,OACE,eAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,UAAAC,EAEA,aAAAC,EAGA,uBAAAC,MACK,QACP,OAAS,UAAAC,EAAQ,eAAAC,MAAmC,eACpD,OAAS,cAAAC,EAAY,cAAAC,EAAY,UAAAC,EAAQ,cAAAC,MAAkB,iBAC3D,OAAS,MAAAC,MAAU,kCACnB,OAAS,kBAAAC,MAAsB,aAC/B,OAAS,WAAAC,EAAS,QAAAC,EAAM,QAAAC,GAAM,WAAAC,OAAe,uBAC7C,OAAS,wBAAAC,MAA4B,iCACrC,OAAS,mBAAAC,OAAuB,sCAChC,OAAS,cAAAC,OAAkB,6BAC3B,OAAOC,OAAkB,+BACzB,OAAS,eAAAC,OAAmB,0BAM5B,MAAMC,EAAwBC,GAE1B9B,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA8B,GAAG8B,EACjG,UAAA/B,EAAC,QAAK,EAAE,KAAK,EAAE,KAAK,MAAM,KAAK,OAAO,KAAK,GAAG,KAAK,UAAU,qBAAqB,KAAK,QAAQ,EAC/FA,EAAC,QACC,EAAE,4TACF,KAAK,eACP,GACF,EAIEgC,EAAyBD,GAE3B9B,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA8B,GAAG8B,EACjG,UAAA/B,EAAC,QAAK,MAAM,KAAK,OAAO,KAAK,GAAG,KAAK,UAA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B,EACT,uIAEF,EACA,QAAS2E,EAET,SAAA9F,EAACgC,EAAA,CAAsB,UAAU,oCAAoC,EACvE,GACF,CAEJ,EAEMmE,GAA2BpE,GACxB/B,EAAC,OAAI,mBAAO,EAGrB,IAAOoG,GAAQnE",
6
- "names": ["Fragment", "jsx", "jsxs", "useAiuiContext", "Text", "Picture", "Badge", "useCallback", "useMemo", "useState", "forwardRef", "useRef", "useEffect", "useImperativeHandle", "Swiper", "SwiperSlide", "Navigation", "Mousewheel", "Thumbs", "Pagination", "cn", "GalleryTabType", "Content", "List", "Root", "Trigger", "useBizProductContext", "useVariantMedia", "SpecsModal", "CompareModal", "formatPrice", "SwiperLeftButtonIcon", "props", "SwiperRightButtonIcon", "ProductGallery", "copyWriting", "product", "variant", "selectedOptions", "defaultMediaData", "swiper", "setSwiper", "productGalleryTabRef", "customMediaList", "productList", "sceneList", "keyFeaturesList", "videoList", "allMedia", "galleryMap", "galleryTabs", "item", "activeGalleryTab", "setActiveGalleryTab", "activeTabIndex", "setActiveTabIndex", "targetSlideIndex", "setTargetSlideIndex", "handleNextTab", "nextIndex", "handlePrevTab", "prevIndex", "prevTabGalleries", "renderGalleryForTab", "tab", "index", "ProductGalleryTabImage", "ProductGalleryTabVideo", "ProductGalleryTab", "ref", "scrollContainerRef", "triggerRefs", "handleGalleryTabClick", "el", "scrollToEvent", "event", "container", "button", "scrollLeft", "scrollToTab", "tabItem", "locale", "totalSavings", "paginationRef", "thumbsSwiper", "setThumbsSwiper", "isStart", "setStart", "isEnd", "setEnd", "commentRef", "shouldScroll", "setShouldScroll", "imageClassName", "handlePrevClick", "handleNextClick", "contentHeight", "containerHeight", "needsScroll", "jIndex", "ProductGalleryTab3DView", "ProductGallery_default"]
4
+ "sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { Text, Picture, Button, Badge } from '../../../../../components'\nimport {\n useCallback,\n useMemo,\n useState,\n forwardRef,\n useRef,\n type RefObject,\n useEffect,\n type Dispatch,\n type SetStateAction,\n useImperativeHandle,\n} from 'react'\nimport { Swiper, SwiperSlide, type SwiperRef } from 'swiper/react'\nimport { Navigation, Mousewheel, Thumbs, Pagination } from 'swiper/modules'\nimport { cn } from '../../../../../helpers/index.js'\nimport { GalleryTabType } from './types.js'\nimport { Content, List, Root, Trigger } from '@radix-ui/react-tabs'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useVariantMedia } from '../../../hooks/use-variant-media.js'\nimport { SpecsModal } from './components/SpecsModal.js'\nimport CompareModal from './components/CompareModal.js'\nimport { formatPrice } from '../../../utils/index.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { gaTrack } from '../../../../../shared/track.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\n\nimport type { Swiper as SwiperType } from 'swiper'\nimport type { ImageMedia, VideoMedia } from '../../../hooks/use-variant-media.js'\nimport type { ProductGalleryProps, ProductGalleryTabItemProps, GalleryTabItemProps } from './types.js'\n\nconst SwiperLeftButtonIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <rect x=\"48\" y=\"48\" width=\"48\" height=\"48\" rx=\"24\" transform=\"rotate(-180 48 48)\" fill=\"white\" />\n <path\n d=\"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nconst SwiperRightButtonIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <rect width=\"48\" height=\"48\" rx=\"24\" transform=\"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)\" fill=\"white\" />\n <path\n d=\"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z\"\n fill=\"currentColor\"\n />\n </svg>\n )\n}\n\nconst ProductGallery = () => {\n const { copyWriting } = useAiuiContext()\n const { product, variant, selectedOptions } = useBizProductContext()\n const defaultMediaData = useVariantMedia({ product, variant })\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n const productGalleryTabRef = useRef<ProductGalleryTabRef>(null)\n\n const customMediaList = variant?.metafields?.component?.custom_media_list\n let productList: ImageMedia[], sceneList: ImageMedia[], keyFeaturesList: ImageMedia[], videoList: VideoMedia[]\n\n if (customMediaList && customMediaList?.available) {\n productList = customMediaList?.product || []\n sceneList = customMediaList?.scenarios || []\n keyFeaturesList = customMediaList?.keyFeatures || []\n videoList = customMediaList?.video || []\n } else {\n productList = defaultMediaData?.productList\n sceneList = defaultMediaData?.sceneList\n keyFeaturesList = defaultMediaData?.keyFeaturesList\n videoList = defaultMediaData?.videoList\n }\n\n const allMedia = useMemo(() => [...productList, ...sceneList, ...videoList], [productList, sceneList, videoList])\n\n const galleryMap: Record<string, ImageMedia[] | VideoMedia[]> = {\n productList: productList,\n sceneList: sceneList,\n keyFeaturesList: keyFeaturesList,\n videoList: videoList,\n }\n\n const galleryTabs = useMemo(() => {\n const productTab: ProductGalleryProps =\n product?.payload?.components?.find((item: any) => item.componentKey === 'ProductGallery')?.data || []\n\n return productTab\n ?.map((item: any) => {\n // \u5982\u679C\u5B58\u5728 images \u6570\u7EC4\u4E14\u6709\u6709\u6548\u503C\uFF0C\u4F18\u5148\u4F7F\u7528 images \u521B\u5EFA\u54CD\u5E94\u5F0F\u56FE\u7247\u6570\u636E\n let galleries = galleryMap[item?.galleries] || []\n \n if (item?.images && Array.isArray(item.images) && item.images.length > 0) {\n // \u5904\u7406 images \u6570\u7EC4\uFF0C\u4E3A\u6BCF\u5F20\u56FE\u7247\u751F\u6210\u54CD\u5E94\u5F0F source\n const imageGalleries = item.images\n .map((imageItem: any) => {\n // \u4ECE\u5355\u4E2A\u56FE\u7247\u5BF9\u8C61\u751F\u6210\u54CD\u5E94\u5F0F\u56FE\u7247\u7684 source \u5B57\u7B26\u4E32\n const imageSourceParts: string[] = []\n if (imageItem.image_390 && imageItem.image_390.trim()) {\n imageSourceParts.push(`${imageItem.image_390} 390`)\n }\n if (imageItem.image_768 && imageItem.image_768.trim()) {\n imageSourceParts.push(`${imageItem.image_768} 768`)\n }\n if (imageItem.image_1024 && imageItem.image_1024.trim()) {\n imageSourceParts.push(`${imageItem.image_1024} 1024`)\n }\n if (imageItem.image_1440 && imageItem.image_1440.trim()) {\n imageSourceParts.push(`${imageItem.image_1440} 1440`)\n }\n if (imageItem.image_1920 && imageItem.image_1920.trim()) {\n imageSourceParts.push(`${imageItem.image_1920} 1920`)\n }\n \n // \u5982\u679C\u751F\u6210\u4E86\u6709\u6548\u7684\u54CD\u5E94\u5F0F source\uFF0C\u8FD4\u56DE\u56FE\u7247\u5BF9\u8C61\n if (imageSourceParts.length > 0) {\n const responsiveSource = imageSourceParts.join(', ')\n return {\n image: {\n url: responsiveSource,\n altText: item.comment?.content || '',\n },\n // \u6807\u8BB0\u8FD9\u662F\u4ECE images \u751F\u6210\u7684\uFF0C\u7528\u4E8E\u540E\u7EED\u5904\u7406\n _fromImages: true,\n _responsiveSource: responsiveSource,\n } as any\n }\n return null\n })\n .filter((gallery: any) => gallery !== null) // \u8FC7\u6EE4\u6389\u65E0\u6548\u7684\u56FE\u7247\n \n // \u5982\u679C\u4ECE images \u6570\u7EC4\u751F\u6210\u4E86\u6709\u6548\u7684\u56FE\u7247\uFF0C\u4F7F\u7528\u5B83\u4EEC\uFF1B\u5426\u5219\u56DE\u9000\u5230\u539F\u6709\u7684 galleries\n if (imageGalleries.length > 0) {\n galleries = imageGalleries\n }\n // \u5982\u679C images \u5B58\u5728\u4F46\u90FD\u662F\u7A7A\u503C\uFF0C\u5219\u56DE\u9000\u5230\u539F\u6709\u7684 galleries \u903B\u8F91\n }\n \n return {\n ...item,\n galleries,\n }\n })\n .filter((item: any) => item.galleries.length > 0)\n }, [product?.payload, galleryMap])\n\n const [activeGalleryTab, setActiveGalleryTab] = useState<GalleryTabItemProps>(galleryTabs?.[0])\n const [activeTabIndex, setActiveTabIndex] = useState(0)\n const [targetSlideIndex, setTargetSlideIndex] = useState<number | null>(null)\n\n // \u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\uFF08\u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\uFF09\n const handleNextTab = useCallback(() => {\n const nextIndex = (activeTabIndex + 1) % galleryTabs.length\n setActiveTabIndex(nextIndex)\n setActiveGalleryTab(galleryTabs[nextIndex])\n setTargetSlideIndex(0) // \u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\n }, [activeTabIndex, galleryTabs])\n\n // \u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\uFF08\u8DF3\u8F6C\u5230\u6700\u540E\u4E00\u5F20\uFF09\n const handlePrevTab = useCallback(() => {\n const prevIndex = activeTabIndex === 0 ? galleryTabs.length - 1 : activeTabIndex - 1\n setActiveTabIndex(prevIndex)\n setActiveGalleryTab(galleryTabs[prevIndex])\n // \u8DF3\u8F6C\u5230\u4E0A\u4E00\u4E2A tab \u7684\u6700\u540E\u4E00\u5F20\n const prevTabGalleries = galleryTabs[prevIndex]?.galleries || []\n setTargetSlideIndex(prevTabGalleries.length - 1)\n }, [activeTabIndex, galleryTabs])\n\n // \u5F53 activeTabIndex \u53D8\u5316\u65F6\uFF0C\u81EA\u52A8\u6EDA\u52A8\u5230\u5BF9\u5E94\u7684 tab\n useEffect(() => {\n if (activeTabIndex !== null && activeTabIndex !== undefined) {\n // \u4F7F\u7528 requestAnimationFrame \u786E\u4FDD DOM \u5DF2\u66F4\u65B0\n requestAnimationFrame(() => {\n productGalleryTabRef.current?.scrollToTab(activeTabIndex)\n })\n }\n }, [activeTabIndex])\n\n useEffect(() => {\n // \u5F53 variant \u53D8\u5316\u65F6\uFF0C\u5207\u6362\u5230\u7B2C\u4E00\u4E2A tab\n setActiveGalleryTab(galleryTabs[0])\n setActiveTabIndex(0)\n }, [variant?.id])\n\n // \u4E3A\u6BCF\u4E2A tab \u6E32\u67D3\u5BF9\u5E94\u7684\u7EC4\u4EF6\n const renderGalleryForTab = (tab: any, index: number) => {\n switch (tab?.galleryTabType) {\n case GalleryTabType.GALLERY_IMAGE_MAIN:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_IMAGE_FEATURES:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_IMAGE_SCENE:\n return (\n <ProductGalleryTabImage\n {...tab}\n index={index}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n case GalleryTabType.GALLERY_VIDEO:\n return (\n <ProductGalleryTabVideo\n {...tab}\n onNextTab={handleNextTab}\n onPrevTab={handlePrevTab}\n targetSlideIndex={targetSlideIndex}\n onSlideChange={() => setTargetSlideIndex(null)}\n />\n )\n default:\n return null\n }\n }\n\n return (\n <div id=\"ipc-product-gallery\">\n <Root className=\"relative\" value={activeGalleryTab?.tabValue} defaultValue={galleryTabs?.[0]?.tabValue}>\n <div className=\"h-[420px] overflow-hidden tablet:h-[620px] desktop:rounded-2xl desktop:h-[560px] lg-desktop:h-[700px] bg-[#EAEAEC] desktop:relative \">\n {galleryTabs.map((item: any, index: number) => {\n return (\n <Content key={item.tabValue} className=\"h-full\" value={item.tabValue}>\n {renderGalleryForTab(item, index)}\n </Content>\n )\n })}\n </div>\n <ProductGalleryTab\n ref={productGalleryTabRef}\n galleryTabs={galleryTabs}\n activeGalleryTab={activeGalleryTab}\n setActiveGalleryTab={setActiveGalleryTab}\n setActiveTabIndex={setActiveTabIndex}\n setTargetSlideIndex={setTargetSlideIndex}\n />\n </Root>\n </div>\n )\n}\n\nexport interface ProductGalleryTabRef {\n scrollToTab: (index: number) => void\n}\n\nconst ProductGalleryTab = forwardRef<\n ProductGalleryTabRef,\n {\n galleryTabs: GalleryTabItemProps[]\n activeGalleryTab: GalleryTabItemProps\n setActiveGalleryTab: Dispatch<SetStateAction<GalleryTabItemProps>>\n setActiveTabIndex: Dispatch<SetStateAction<number>>\n setTargetSlideIndex: Dispatch<SetStateAction<number | null>>\n }\n>((props, ref) => {\n const { galleryTabs, activeGalleryTab, setActiveGalleryTab, setActiveTabIndex, setTargetSlideIndex } = props\n const { product } = useBizProductContext()\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const triggerRefs = useRef<Map<string, HTMLButtonElement>>(new Map())\n\n const handleGalleryTabClick = useCallback(\n (el: React.MouseEvent<HTMLButtonElement>, item: GalleryTabItemProps, index: number) => {\n setActiveGalleryTab(item)\n setActiveTabIndex(index)\n setTargetSlideIndex(0) // \u624B\u52A8\u70B9\u51FB tab \u65F6\uFF0C\u8DF3\u8F6C\u5230\u7B2C\u4E00\u5F20\n scrollToEvent(el)\n },\n [setActiveGalleryTab, setActiveTabIndex, setTargetSlideIndex]\n )\n\n const scrollToEvent = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n if (scrollContainerRef.current) {\n const container = scrollContainerRef.current\n const button = event.currentTarget\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }, [])\n\n // \u6EDA\u52A8\u5230\u6307\u5B9A\u7D22\u5F15\u7684 tab\n const scrollToTab = useCallback(\n (index: number) => {\n if (scrollContainerRef.current && galleryTabs[index]) {\n const container = scrollContainerRef.current\n const tabItem = galleryTabs[index]\n const button = triggerRefs.current.get(tabItem.tabValue)\n\n if (button) {\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }\n },\n [galleryTabs]\n )\n\n useImperativeHandle(ref, () => ({\n scrollToTab,\n }))\n\n return (\n <div className=\"absolute z-[2] bottom-4 left-4 right-4 laptop:left-16 laptop:right-16 flex justify-between items-center tablet:mt-3 desktop:static\">\n <List\n ref={scrollContainerRef}\n className=\"rounded-full bg-[#EAEAEC] p-1 laptop:p-0 desktop:p-1 overflow-x-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n <div className=\"whitespace-nowrap\">\n {galleryTabs?.map((item, index) => {\n return (\n <Trigger\n ref={el => {\n if (el) {\n triggerRefs.current.set(item.tabValue, el)\n } else {\n triggerRefs.current.delete(item.tabValue)\n }\n }}\n className={cn(\n 'lg-desktop:px-7 lg-desktop:pb-[14px] rounded-full font-bold lg-desktop:pt-[15px] lg-desktop:text-[16px] px-5 pb-[10px] pt-[11px] text-[14px] leading-tight',\n item.tabValue === activeGalleryTab?.tabValue && 'bg-white'\n )}\n onClick={el => handleGalleryTabClick(el, item, index)}\n key={item.tabValue}\n value={item.tabValue}\n >\n {item.tabLabel}\n </Trigger>\n )\n })}\n </div>\n </List>\n <div className=\"laptop:gap-2 hidden laptop:flex\">\n {product.metafields?.global?.specifications && (\n <>\n <SpecsModal /> | <CompareModal />\n </>\n )}\n </div>\n </div>\n )\n})\n\nconst ProductGalleryTabImage = forwardRef<SwiperRef, ProductGalleryTabItemProps>((props, ref) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, totalSavings } = useBizProductContext()\n const paginationRef = useRef<HTMLDivElement>(null)\n const [thumbsSwiper, setThumbsSwiper] = useState<SwiperType | null>(null)\n const [isStart, setStart] = useState(true)\n const [isEnd, setEnd] = useState(false)\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n const commentRef = useRef<HTMLDivElement>(null)\n const [shouldScroll, setShouldScroll] = useState(false)\n\n const imageClassName = useMemo(() => {\n if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_MAIN) {\n return 'size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]'\n } else if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_FEATURES) {\n // return '420px'\n } else if (props?.galleryTabType === GalleryTabType.GALLERY_IMAGE_SCENE) {\n // return '560px'\n }\n }, [props?.galleryTabType])\n\n // \u5904\u7406\u5DE6\u53F3\u6309\u94AE\u70B9\u51FB\uFF0C\u652F\u6301\u8DE8 tab \u5FAA\u73AF\n const handlePrevClick = useCallback(() => {\n if (swiper?.isBeginning) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u7B2C\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\n props.onPrevTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slidePrev()\n }\n }, [swiper, props])\n\n const handleNextClick = useCallback(() => {\n if (swiper?.isEnd) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\n props.onNextTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slideNext()\n }\n }, [swiper, props])\n\n // \u76D1\u542C targetSlideIndex\uFF0C\u5F53 tab \u5207\u6362\u65F6\u8DF3\u8F6C\u5230\u6307\u5B9A\u7684 slide\n useEffect(() => {\n if (swiper && !!props.targetSlideIndex) {\n swiper.slideTo(props.targetSlideIndex, 0) // 0 \u8868\u793A\u7ACB\u5373\u8DF3\u8F6C\uFF0C\u65E0\u52A8\u753B\n props.onSlideChange?.() // \u6E05\u9664 targetSlideIndex\n }\n }, [swiper, props.targetSlideIndex, props])\n\n\n // \u68C0\u6D4B\u6587\u672C\u5185\u5BB9\u662F\u5426\u8D85\u8FC7\u5BB9\u5668\u9AD8\u5EA6\uFF0C\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6EDA\u52A8\n useEffect(() => {\n if (commentRef.current) {\n const container = commentRef.current\n const contentHeight = container.scrollHeight\n const containerHeight = container.clientHeight\n const needsScroll = contentHeight > containerHeight\n setShouldScroll(needsScroll)\n }\n }, [])\n\n return (\n <div className=\"h-full [&_.swiper-button]:hover:opacity-100\">\n <Swiper\n ref={ref}\n className=\"h-full\"\n // navigation={{\n // nextEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n // prevEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n // }}\n onSwiper={setSwiper}\n onProgress={swiper => {\n setStart(swiper.isBeginning)\n setEnd(swiper.isEnd)\n }}\n onTouchEnd={(swiper, event) => {\n if (swiper.isBeginning && swiper.swipeDirection === 'prev') {\n handlePrevClick()\n } else if (swiper.isEnd && swiper.swipeDirection === 'next') {\n handleNextClick()\n }\n }}\n pagination={{\n clickable: true,\n el: paginationRef.current,\n }}\n thumbs={{ swiper: thumbsSwiper }}\n modules={[Mousewheel, Thumbs, Navigation, Pagination]}\n mousewheel={{\n forceToAxis: true,\n }}\n breakpoints={{\n 0: {\n slidesPerView: 1,\n freeMode: false,\n },\n }}\n >\n {props?.galleries?.map((item, jIndex) => {\n // \u751F\u6210\u552F\u4E00\u7684\u66DD\u5149 key\uFF08tabId + index\uFF09\n const exposureKey = `${props.id}-${jIndex}`\n\n // \u66DD\u5149\u68C0\u6D4B\u56DE\u8C03\n const handleExposure = () => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`, \n component_type: 'image', \n component_name: props?.tabLabel || '', \n position: jIndex + 1,\n creative_id: '', \n component_title: '', \n component_description: '', \n navigation: '',\n },\n })\n }\n\n // \u4F18\u5148\u4F7F\u7528\u4ECE images \u751F\u6210\u7684\u54CD\u5E94\u5F0F source\uFF0C\u5426\u5219\u4F7F\u7528\u539F\u6709\u7684 image.url\n const pictureSource = (item as any)?._responsiveSource || item?.image?.url || ''\n console.log('item', (item as any)?._responsiveSource)\n \n return (\n <SwiperSlide className=\"h-full\" key={props?.id + 'SwiperSlideItem' + jIndex}>\n <ExposureDetector\n onExposure={handleExposure}\n exposureKey={exposureKey}\n threshold={0.5}\n duration={2000}\n className=\"h-full\"\n >\n <Picture\n source={pictureSource}\n alt={item?.image?.altText}\n className={cn('h-full', imageClassName)}\n imgClassName=\"object-cover h-full\"\n />\n </ExposureDetector>\n </SwiperSlide>\n )\n })}\n </Swiper>\n {variant.availableForSale && !!totalSavings && !props.index && (\n <Badge\n size=\"lg\"\n className=\"absolute bg-brand text-white top-3 laptop:left-16 laptop:top-5 left-4 z-[2] desktop:left-6 desktop:top-6\"\n >\n {`${formatPrice({\n amount: totalSavings,\n currencyCode: variant?.price?.currencyCode,\n locale: locale,\n })} ${copyWriting?.off}`}\n </Badge>\n )}\n <div\n className={cn(\n 'hidden tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 desktop:left-6 z-10 -translate-y-1/2 cursor-pointer',\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n `swiper-button`\n )}\n onClick={handlePrevClick}\n >\n <SwiperLeftButtonIcon className={cn('tablet:size-10 lg-desktop:size-12')} />\n </div>\n <div\n className={cn(\n 'hidden tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 z-10 desktop:right-6 -translate-y-1/2 cursor-pointer',\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n `swiper-button`\n )}\n onClick={handleNextClick}\n >\n <SwiperRightButtonIcon className={cn('tablet:size-10 lg-desktop:size-12')} />\n </div>\n {/* {props?.galleries?.map((item, jIndex) => {\n return (\n <Picture\n key={props?.id + 'SwiperSlideItem' + jIndex}\n source={item?.image?.url}\n alt={item?.image?.altText}\n className=\"h-full\"\n imgClassName=\"object-cover h-full\"\n />\n )\n })} */}\n <div className=\"absolute bottom-[94px] tablet:bottom-[70px] left-4 right-4 z-10 items-center tablet:flex justify-between laptop:left-16 laptop:right-16 desktop:bottom-[20px] desktop:right-6 desktop:left-6\">\n <div className=\"hidden tablet:block\">\n <Swiper\n className=\"flex items-center justify-between\"\n onSwiper={setThumbsSwiper}\n spaceBetween={12}\n slidesPerView={6}\n freeMode={true}\n watchSlidesProgress={true}\n modules={[Navigation, Thumbs]}\n >\n {props?.galleries?.map((item, jIndex) => (\n <SwiperSlide\n key={props?.id + 'SwiperSlideThumbItem' + jIndex}\n className=\"!w-auto border border-transparent cursor-pointer [&.swiper-slide-thumb-active]:rounded [&.swiper-slide-thumb-active]:border-brand\"\n >\n <Picture\n source={item.image?.url}\n alt={item.image?.altText}\n className=\"size-10 lg-desktop:size-12 overflow-hidden bg-white rounded\"\n imgClassName=\"object-contain h-full\"\n />\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n {!props?.index && (\n <div className=\"flex items-center gap-2\">\n <Picture\n source={props?.comment?.avatar?.url}\n className=\"size-8 laptop:size-10 rounded-full shrink-0\"\n imgClassName=\"object-cover \"\n />\n <div className=\"overflow-hidden max-w-[528px] relative\">\n <div\n ref={commentRef}\n className={cn('h-10 lg-desktop:h-12', shouldScroll ? 'animate-marquee-scroll' : '')}\n style={{\n animationDuration: `3s`,\n }}\n >\n <Text\n html={props?.comment?.content}\n className=\"text-sm lg-desktop:text-base font-bold text-[#1D1D1F]\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n <div\n ref={paginationRef}\n className=\"tablet:hidden [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100 [&_.swiper-pagination-bullet]:bg-white text-center absolute !bottom-[70px] left-4 right-4 z-10\"\n />\n </div>\n )\n})\n\nconst ProductGalleryTabVideo = (props: ProductGalleryTabItemProps) => {\n const [swiper, setSwiper] = useState<SwiperType | null>(null)\n\n // \u5904\u7406\u5DE6\u53F3\u6309\u94AE\u70B9\u51FB\uFF0C\u652F\u6301\u8DE8 tab \u5FAA\u73AF\n const handlePrevClick = useCallback(() => {\n if (swiper?.isBeginning) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u7B2C\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0A\u4E00\u4E2A tab\n props.onPrevTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slidePrev()\n }\n }, [swiper, props])\n\n const handleNextClick = useCallback(() => {\n if (swiper?.isEnd) {\n // \u5F53\u524D tab \u5DF2\u7ECF\u662F\u6700\u540E\u4E00\u5F20\uFF0C\u5207\u6362\u5230\u4E0B\u4E00\u4E2A tab\n props.onNextTab?.()\n } else {\n // \u5426\u5219\u5728\u5F53\u524D tab \u5185\u5207\u6362\n swiper?.slideNext()\n }\n }, [swiper, props])\n\n // \u76D1\u542C targetSlideIndex\uFF0C\u5F53 tab \u5207\u6362\u65F6\u8DF3\u8F6C\u5230\u6307\u5B9A\u7684 slide\n useEffect(() => {\n if (swiper && props.targetSlideIndex !== null && props.targetSlideIndex !== undefined) {\n swiper.slideTo(props.targetSlideIndex, 0) // 0 \u8868\u793A\u7ACB\u5373\u8DF3\u8F6C\uFF0C\u65E0\u52A8\u753B\n props.onSlideChange?.() // \u6E05\u9664 targetSlideIndex\n }\n }, [swiper, props.targetSlideIndex, props])\n\n return (\n <div className=\"h-full [&_.swiper-button]:hover:opacity-100\">\n <Swiper\n className=\"h-full\"\n onSwiper={setSwiper}\n onTouchEnd={(swiper, event) => {\n if (swiper.isBeginning && swiper.swipeDirection === 'prev') {\n handlePrevClick()\n } else if (swiper.isEnd && swiper.swipeDirection === 'next') {\n handleNextClick()\n }\n }}\n // navigation={{\n // nextEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-next`,\n // prevEl: `.ipc-product-gallery-${props?.id}-custom-swiper-button-prev`,\n // }}\n modules={[Mousewheel, Thumbs, Navigation, Pagination]}\n mousewheel={{\n forceToAxis: true,\n }}\n breakpoints={{\n 0: {\n slidesPerView: 1,\n freeMode: false,\n },\n }}\n >\n {props?.galleries?.map((item, jIndex) => {\n return (\n <SwiperSlide className=\"h-full\" key={props?.id + 'SwiperSlideItem' + jIndex}>\n <video controls className=\"size-full object-cover\">\n <track kind=\"captions\" />\n <source src={item?.sources?.[0]?.url} type=\"video/mp4\" />\n <source src={item?.sources?.[0]?.url} type=\"video/webm\" />\n <source src={item?.sources?.[0]?.url} type=\"video/ogg\" />\n </video>\n </SwiperSlide>\n )\n })}\n </Swiper>\n <div\n className={cn(\n 'hidden swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 -translate-y-1/2 cursor-pointer'\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-prev`\n )}\n onClick={handlePrevClick}\n >\n <SwiperLeftButtonIcon className=\"tablet:size-10 lg-desktop:size-12\" />\n </div>\n <div\n className={cn(\n 'hidden tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 -translate-y-1/2 cursor-pointer'\n // `ipc-product-gallery-${props?.id}-custom-swiper-button-next`\n )}\n onClick={handleNextClick}\n >\n <SwiperRightButtonIcon className=\"tablet:size-10 lg-desktop:size-12\" />\n </div>\n </div>\n )\n}\n\nconst ProductGalleryTab3DView = (props: ProductGalleryTabItemProps) => {\n return <div>3D View</div>\n}\n\nexport default withLayout(ProductGallery)\n"],
5
+ "mapp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EAET,SAAAtG,EAACiC,EAAA,CAAqB,UAAU,oCAAoC,EACtE,EACAjC,EAAC,OACC,UAAWmB,EACT,uIAEF,EACA,QAASoF,EAET,SAAAvG,EAACmC,EAAA,CAAsB,UAAU,oCAAoC,EACvE,GACF,CAEJ,EAEM4E,GAA2B7E,GACxBlC,EAAC,OAAI,mBAAO,EAGrB,IAAOgH,GAAQlF,GAAWM,EAAc",
6
+ "names": ["Fragment", "jsx", "jsxs", "useAiuiContext", "Text", "Picture", "Badge", "useCallback", "useMemo", "useState", "forwardRef", "useRef", "useEffect", "useImperativeHandle", "Swiper", "SwiperSlide", "Navigation", "Mousewheel", "Thumbs", "Pagination", "cn", "GalleryTabType", "Content", "List", "Root", "Trigger", "useBizProductContext", "useVariantMedia", "SpecsModal", "CompareModal", "formatPrice", "withLayout", "gaTrack", "ExposureDetector", "SwiperLeftButtonIcon", "props", "SwiperRightButtonIcon", "ProductGallery", "copyWriting", "product", "variant", "selectedOptions", "defaultMediaData", "swiper", "setSwiper", "productGalleryTabRef", "customMediaList", "productList", "sceneList", "keyFeaturesList", "videoList", "allMedia", "galleryMap", "galleryTabs", "item", "galleries", "imageGalleries", "imageItem", "imageSourceParts", "responsiveSource", "gallery", "activeGalleryTab", "setActiveGalleryTab", "activeTabIndex", "setActiveTabIndex", "targetSlideIndex", "setTargetSlideIndex", "handleNextTab", "nextIndex", "handlePrevTab", "prevIndex", "prevTabGalleries", "renderGalleryForTab", "tab", "index", "ProductGalleryTabImage", "ProductGalleryTabVideo", "ProductGalleryTab", "ref", "scrollContainerRef", "triggerRefs", "handleGalleryTabClick", "el", "scrollToEvent", "event", "container", "button", "scrollLeft", "scrollToTab", "tabItem", "locale", "totalSavings", "paginationRef", "thumbsSwiper", "setThumbsSwiper", "isStart", "setStart", "isEnd", "setEnd", "commentRef", "shouldScroll", "setShouldScroll", "imageClassName", "handlePrevClick", "handleNextClick", "contentHeight", "containerHeight", "needsScroll", "jIndex", "exposureKey", "handleExposure", "pictureSource", "ProductGalleryTab3DView", "ProductGallery_default"]
7
7
  }
@@ -1,12 +1,33 @@
1
1
  import type { Img } from '../../../../../types/props.js';
2
2
  import type { ImageMedia, VideoMedia } from '../../../hooks/use-variant-media.js';
3
- export interface ProductGalleryProps {
4
- data: {
5
- gallerySections: {
6
- title: string;
7
- }[];
3
+ export declare enum GalleryTabType {
4
+ GALLERY_IMAGE_MAIN = "ipc-gallery-tab-image-main",
5
+ GALLERY_IMAGE_FEATURES = "ipc-gallery-tab-image-features",
6
+ GALLERY_IMAGE_SCENE = "ipc-gallery-tab-image-scene",
7
+ GALLERY_VIDEO = "ipc-gallery-tab-video",
8
+ GALLERY_3D_VIEW = "ipc-gallery-tab-3d-view"
9
+ }
10
+ export interface ProductGalleryTabData {
11
+ tabLabel: string;
12
+ tabValue: string;
13
+ galleries: 'productList' | 'keyFeaturesList' | 'sceneList' | 'videoList';
14
+ galleryTabType: GalleryTabType | string;
15
+ images?: Array<{
16
+ image_390?: string;
17
+ image_768?: string;
18
+ image_1024?: string;
19
+ image_1440?: string;
20
+ image_1920?: string;
21
+ }>;
22
+ comment?: {
23
+ avatar: {
24
+ url: string;
25
+ };
26
+ content: string;
8
27
  };
28
+ id?: string;
9
29
  }
30
+ export type ProductGalleryProps = ProductGalleryTabData[];
10
31
  export interface ProductGalleryTabItemProps {
11
32
  index?: number;
12
33
  realIndex?: number;
@@ -18,6 +39,12 @@ export interface ProductGalleryTabItemProps {
18
39
  onPrevTab?: () => void;
19
40
  targetSlideIndex?: number | null;
20
41
  onSlideChange?: () => void;
42
+ onImageExposure?: (data: {
43
+ imageUrl: string;
44
+ imageAlt?: string;
45
+ index: number;
46
+ tabId: string;
47
+ }) => void;
21
48
  id: string;
22
49
  comment?: {
23
50
  content: string;
@@ -32,11 +59,15 @@ export interface GalleryTabItemProps {
32
59
  id: string;
33
60
  galleryTabType: GalleryTabType;
34
61
  galleries: ImageMedia[] | VideoMedia[];
35
- }
36
- export declare enum GalleryTabType {
37
- GALLERY_IMAGE_MAIN = "ipc-gallery-tab-image-main",
38
- GALLERY_IMAGE_FEATURES = "ipc-gallery-tab-image-features",
39
- GALLERY_IMAGE_SCENE = "ipc-gallery-tab-image-scene",
40
- GALLERY_VIDEO = "ipc-gallery-tab-video",
41
- GALLERY_3D_VIEW = "ipc-gallery-tab-3d-view"
62
+ images?: {
63
+ image_390?: string;
64
+ image_768?: string;
65
+ image_1024?: string;
66
+ image_1440?: string;
67
+ image_1920?: string;
68
+ };
69
+ comment?: {
70
+ avatar: Img;
71
+ content: string;
72
+ };
42
73
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductGallery/types.ts"],
4
- "sourcesContent": ["import type { Img, Video } from '../../../../../types/props.js'\nimport type { ImageMedia, VideoMedia } from '../../../hooks/use-variant-media.js'\n\nexport interface ProductGalleryProps {\n data: {\n gallerySections: {\n title: string\n }[]\n }\n}\n\nexport interface ProductGalleryTabItemProps {\n index?: number\n realIndex?: number\n galleryTabType: GalleryTabType\n galleries: ImageMedia[] | VideoMedia[]\n onCurrentTabLoopStart?: (index: number) => void\n onCurrentTabLoopEnd?: (index: number) => void\n onNextTab?: () => void\n onPrevTab?: () => void\n targetSlideIndex?: number | null\n onSlideChange?: () => void\n id: string\n comment?: {\n content: string\n avatar: Img\n }\n tabLabel: string\n tabValue: string\n // galleryImgs?: Img[]\n // galleryVideo?: Video\n // gallery3DView?: Video\n}\n\nexport interface GalleryTabItemProps {\n tabLabel: string\n tabValue: string\n id: string\n galleryTabType: GalleryTabType\n galleries: ImageMedia[] | VideoMedia[]\n}[]\n\nexport enum GalleryTabType {\n GALLERY_IMAGE_MAIN = 'ipc-gallery-tab-image-main',\n GALLERY_IMAGE_FEATURES = 'ipc-gallery-tab-image-features',\n GALLERY_IMAGE_SCENE = 'ipc-gallery-tab-image-scene',\n GALLERY_VIDEO = 'ipc-gallery-tab-video',\n GALLERY_3D_VIEW = 'ipc-gallery-tab-3d-view',\n}\n"],
5
- "mappings": "AA0CO,IAAKA,OACVA,EAAA,mBAAqB,6BACrBA,EAAA,uBAAyB,iCACzBA,EAAA,oBAAsB,8BACtBA,EAAA,cAAgB,wBAChBA,EAAA,gBAAkB,0BALRA,OAAA",
4
+ "sourcesContent": ["import type { Img, Video } from '../../../../../types/props.js'\nimport type { ImageMedia, VideoMedia } from '../../../hooks/use-variant-media.js'\n\nexport enum GalleryTabType {\n GALLERY_IMAGE_MAIN = 'ipc-gallery-tab-image-main',\n GALLERY_IMAGE_FEATURES = 'ipc-gallery-tab-image-features',\n GALLERY_IMAGE_SCENE = 'ipc-gallery-tab-image-scene',\n GALLERY_VIDEO = 'ipc-gallery-tab-video',\n GALLERY_3D_VIEW = 'ipc-gallery-tab-3d-view',\n}\n\n// \u8F93\u5165\u6570\u636E\u7684\u7C7B\u578B\u5B9A\u4E49\uFF08\u4ECE product.payload.components \u4E2D\u83B7\u53D6\u7684\u539F\u59CB\u6570\u636E\u683C\u5F0F\uFF09\nexport interface ProductGalleryTabData {\n tabLabel: string\n tabValue: string\n galleries: 'productList' | 'keyFeaturesList' | 'sceneList' | 'videoList'\n galleryTabType: GalleryTabType | string\n images?: Array<{\n image_390?: string\n image_768?: string\n image_1024?: string\n image_1440?: string\n image_1920?: string\n }>\n comment?: {\n avatar: {\n url: string\n }\n content: string\n }\n id?: string\n}\n\nexport type ProductGalleryProps = ProductGalleryTabData[]\n\nexport interface ProductGalleryTabItemProps {\n index?: number\n realIndex?: number\n galleryTabType: GalleryTabType\n galleries: ImageMedia[] | VideoMedia[]\n onCurrentTabLoopStart?: (index: number) => void\n onCurrentTabLoopEnd?: (index: number) => void\n onNextTab?: () => void\n onPrevTab?: () => void\n targetSlideIndex?: number | null\n onSlideChange?: () => void\n onImageExposure?: (data: { imageUrl: string; imageAlt?: string; index: number; tabId: string }) => void\n id: string\n comment?: {\n content: string\n avatar: Img\n }\n tabLabel: string\n tabValue: string\n // galleryImgs?: Img[]\n // galleryVideo?: Video\n // gallery3DView?: Video\n}\n\nexport interface GalleryTabItemProps {\n tabLabel: string\n tabValue: string\n id: string\n galleryTabType: GalleryTabType\n galleries: ImageMedia[] | VideoMedia[]\n images?: {\n image_390?: string\n image_768?: string\n image_1024?: string\n image_1440?: string\n image_1920?: string\n }\n comment?: {\n avatar: Img\n content: string\n }\n}\n"],
5
+ "mappings": "AAGO,IAAKA,OACVA,EAAA,mBAAqB,6BACrBA,EAAA,uBAAyB,iCACzBA,EAAA,oBAAsB,8BACtBA,EAAA,cAAgB,wBAChBA,EAAA,gBAAkB,0BALRA,OAAA",
6
6
  "names": ["GalleryTabType"]
7
7
  }
@@ -1,2 +1,6 @@
1
- declare const ProductSummary: () => import("react/jsx-runtime").JSX.Element | null;
2
- export default ProductSummary;
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<object, keyof import("../../../../../shared/Styles.js").StylesProps> & Partial<import("../../../../../shared/Styles.js").StylesProps & import("../../../../../shared/Styles.js").ContainerProps> & {
3
+ className?: string | undefined;
4
+ data?: Record<string, any> | undefined;
5
+ } & import("react").RefAttributes<any>>;
6
+ export default _default;
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Text as s,Button as k,Grid as W,GridItem as R,Picture as y,Heading as _}from"../../../../../components";import{useBizProductContext as P}from"../../../BizProductProvider";import{useEffect as q,useMemo as K,useState as Q}from"react";import{formatPrice as x}from"../../../utils";import{useAiuiContext as w}from"../../../../AiuiProvider";import V from"decimal.js";import{replaceTemplate as U}from"../../../utils/textFormat";const X=()=>{const{locale:d="us",copyWriting:t}=w(),{product:c,variant:o,finalPrice:u,comparePrice:m,coupon:h,selectedOptions:p,selectedVariants:l,totalSavings:C,onAddToCart:E,onBuyNow:B,savingDetail:g,checkedBundle:O,joinedRecommendBuyProducts:a,setJoinedRecommendBuyProducts:f,setSavingDetail:D,addToCartLoading:v,buyNowLoading:z,profile:j}=P(),[N]=l,F=K(()=>{const r=O?.variants.find(H=>H.variant.sku===N?.sku),M=new V(N?.price?.amount||0).minus(r?.price||N?.price?.amount).toNumber();let A=new V(N?.price?.amount||0);j?.email&&(A=A.minus(g?.member||0));const J=A.minus(g?.coupon).minus(M).toNumber();return Math.floor(J*100)/100},[N,O,j,g?.member,g?.coupon]);if(!o.availableForSale)return null;const{bundleVariant:L,giftVariant:G,exchangeVariant:S}=Y()||{},[i,b]=Q();return q(()=>{b({bundle:a.bundle?.value?void 0:L,gift:a.gift?.value?void 0:G,exchange:a.exchange?.value?void 0:S})},[L,G,S,a]),e("div",{className:"ipc-product-summary laptop:px-16 desktop:px-0 mt-16 desktop:mt-[96px] lg-desktop:mt-[128px]",children:e("div",{className:"bg-[#F5F5F7] laptop:rounded-2xl",children:n(W,{className:"px-4 pt-6 tablet:p-8 tablet:!pb-0",children:[n(R,{className:"col-span-12 laptop:col-start-1 laptop:col-span-5 gap-4 flex flex-col justify-between",children:[e(_,{className:"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]",html:`${c.title} is ready <br/><span>Just the way you want it.</span>`}),e("div",{className:"",children:e(y,{source:o.image?.url||c?.images?.[0]?.url,className:"lg-desktop:aspect-[644/368] desktop:aspect-[503/272] laptop:aspect-[331/191] tablet:aspect-[704/380] aspect-[358/192]",imgClassName:"object-cover h-full object-[center_36%]"})})]}),n(R,{className:"col-span-12 mt-8 pb-6 tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 flex flex-col gap-6 justify-between",children:[n("div",{children:[n("div",{className:"flex flex-col gap-4",children:[n("div",{className:"flex items-center justify-between",children:[n("div",{className:"shrink-0 flex items-center gap-4",children:[e(y,{source:o.image?.url||c?.images?.[0]?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(s,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:c.title}),e(s,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]",html:`x1 | ${p.color||p.colour||p.couleur}`})]})]}),n("div",{className:"flex items-center gap-1",children:[e(s,{className:"text-base desktop:text-2xl font-bold",html:x({amount:F,currencyCode:o.price.currencyCode,locale:d})}),F<o?.price?.amount&&e(s,{className:"text-base desktop:text-2xl laptop:text-xl font-bold line-through text-[#6D6D6F]",html:x({amount:o?.price?.amount,currencyCode:o.price.currencyCode,locale:d})})]})]}),a?.gift?.value&&e(T,{giftOperation:r=>{f?.({...a,gift:{value:void 0,canOperate:!0}}),b?.({...i,gift:r})},status:!!a?.gift,gift:a?.gift?.value,canOperate:a?.gift?.canOperate}),a?.bundle?.value&&e(I,{bundleOperation:r=>{f?.({...a,bundle:{value:void 0,canOperate:!0}}),b?.({...i,bundle:r})},status:!!a?.bundle,bundleListItem:a?.bundle?.value,canOperate:a?.bundle?.canOperate}),a?.exchange?.value&&e($,{exchangeOperation:r=>{f?.({...a,exchange:{value:void 0,canOperate:!0}}),b?.({...i,exchange:r})},status:!!a?.exchange,canOperate:a?.exchange?.canOperate,exchange:a?.exchange?.value})]}),(i?.bundle||i?.gift||i?.exchange)&&n("div",{className:"mt-6",children:[e(s,{className:"text-sm desktop:text-[18px] font-bold",html:"Recommend Buy"}),n("div",{className:"flex flex-col gap-6 mt-6",children:[i?.exchange&&e($,{exchangeOperation:r=>{f?.({...a,exchange:{value:r,canOperate:!0}}),b?.({...i,exchange:void 0})},canOperate:a?.exchange?.canOperate,status:!i?.exchange,exchange:i?.exchange}),i?.bundle&&e(I,{bundleOperation:r=>{D?.({...g,exchangePurchase:0}),f?.({...a,bundle:{value:r,canOperate:!0}}),b?.({...i,bundle:void 0})},canOperate:a?.bundle?.canOperate,status:!i?.bundle,bundleListItem:i?.bundle}),i?.gift&&e(T,{giftOperation:r=>{f?.({...a,gift:{value:r,canOperate:!0}}),b?.({...i,gift:void 0})},canOperate:a?.gift?.canOperate,status:!i?.gift,gift:i?.gift})]})]})]}),n("div",{className:"text-right",children:[e(s,{className:"laptop:text-xl desktop:text-2xl font-bold text-right",html:`${U(t?.totalPrice||"",{amount:x({amount:Math.floor(u*100)/100,currencyCode:o.price.currencyCode,locale:d})})}`}),C>0&&e(s,{className:"text-base laptop:text-xl desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]",html:x({amount:m,currencyCode:o.price.currencyCode,locale:d})}),n("div",{className:"flex gap-3 mt-2 justify-end",children:[e(k,{size:"lg",variant:"secondary",loading:v,className:"w-1/2 tablet:w-auto laptop:w-1/2 desktop:w-auto",onClick:()=>E?.(),children:t?.addToCart}),e(k,{size:"lg",loading:z,variant:"primary",className:"w-1/2 tablet:w-auto laptop:w-1/2 desktop:w-auto",onClick:()=>B?.(),children:t?.shopNow})]})]})]})]})})})},Y=()=>{const{bundle:d,variant:t,checkedBundle:c,freeGift:o,checkedGift:u,exchangePurchase:m,checkedExchangePurchase:h}=P();let p,l,C;const{bundleList:E}=d||{},{giftList:B=[]}=o||{},{giftList:g=[]}=m||{},O=E?.filter(v=>v.variants.slice(1,v.variants.length).every(z=>z.variant.availableForSale))||[],[a]=O;p=c||a;const[f]=B?.filter(v=>v.availableForSale);l=u||f;const[D]=g?.filter(v=>v.availableForSale);return C=h||D,{bundleVariant:p,giftVariant:l,exchangeVariant:C}},I=({bundleOperation:d,bundleListItem:t,canOperate:c,status:o})=>{const{locale:u="us"}=w(),{variant:m,setCheckedBundle:h}=P(),p=t?.variants.filter(l=>l.variant.sku!==m.sku);return e("div",{className:"",children:p?.map(l=>n("div",{className:"flex items-center gap-4 justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(y,{source:l?.variant?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),e("div",{className:"flex flex-col gap-[6px] line-clamp-2 max-w-[178px] tablet:max-w-none",children:e(s,{className:"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]",html:l.variant.product.title})})]}),n("div",{className:"flex flex-col items-end gap-1 justify-center",children:[!!t&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"text-base desktop:text-2xl font-bold",html:x({amount:l?.price||0,locale:u,currencyCode:l.variant?.price?.currencyCode||""})}),l.price<l.variant.price.amount&&e(s,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:x({amount:l.variant.price.amount||0,locale:u,currencyCode:l.variant?.price?.currencyCode||""})})]}),c&&e(k,{size:"icon",variant:"link",onClick:()=>{h?.(o?void 0:t),d?.(t)},className:"shrink-0 size-auto underline",children:o?"Remove":"Add"})]})]},l.variant.id))})},T=({giftOperation:d,gift:t,status:c,canOperate:o})=>{const{locale:u="us"}=w(),{freeGift:m,setCheckedGift:h}=P(),{freeLabel:p,count:l}=m||{};return n("div",{className:"flex items-center justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(y,{source:t?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(s,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:t?.product?.title}),e(s,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]",html:`x${l} | ${p}`})]})]}),n("div",{className:"flex flex-col items-end gap-2 justify-center",children:[!!t&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"text-base desktop:text-2xl font-bold",html:p}),e(s,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:x({amount:t.price.amount,locale:u,currencyCode:t.price.currencyCode})})]}),o&&e(k,{size:"icon",variant:"link",onClick:()=>{h?.(c?void 0:t),d(t)},className:"shrink-0 size-auto underline",children:c?"Remove":"Add"})]})]})},$=({exchangeOperation:d,exchange:t,canOperate:c,status:o})=>{const{locale:u="us"}=w(),{setCheckedExchangePurchase:m}=P();return n("div",{className:"flex items-center justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(y,{source:t?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(s,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:t?.product?.title}),e(s,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]"})]})]}),n("div",{className:"flex flex-col items-end gap-2 justify-center",children:[!!t&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"text-base desktop:text-2xl font-bold",html:x({amount:t.finalPrice?.amount||0,locale:u,currencyCode:t.price.currencyCode})}),e(s,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:x({amount:t.price?.amount||0,locale:u,currencyCode:t.price.currencyCode})})]}),c&&e(k,{size:"icon",variant:"link",onClick:()=>{m?.(o?void 0:t),d(t)},className:"shrink-0 size-auto underline",children:o?"Remove":"Add"})]})]})};var ce=X;export{ce as default};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Text as r,Button as O,Grid as X,GridItem as T,Picture as w,Heading as Y}from"../../../../../components";import{useBizProductContext as B}from"../../../BizProductProvider";import{useEffect as J,useMemo as M,useState as H}from"react";import{formatPrice as g}from"../../../utils";import{useAiuiContext as A}from"../../../../AiuiProvider";import K from"decimal.js";import{replaceTemplate as Z}from"../../../utils/textFormat";import{withLayout as ee}from"../../../../../shared/Styles.js";import{ExposureDetector as te}from"../../../../../components/index.js";import{gaTrack as ae}from"../../../../../shared/track.js";const ne=()=>{const{locale:u="us",copyWriting:a}=A(),{product:d,variant:o,finalPrice:p,comparePrice:f,coupon:C,selectedOptions:m,selectedVariants:l,totalSavings:D,onAddToCart:j,onBuyNow:F,savingDetail:h,checkedBundle:z,joinedRecommendBuyProducts:t,setJoinedRecommendBuyProducts:v,setSavingDetail:L,addToCartLoading:b,buyNowLoading:G,profile:S}=B(),[E]=l,R=M(()=>{const c=z?.variants.find(P=>P.variant.sku===E?.sku),s=new K(E?.price?.amount||0).minus(c?.price||E?.price?.amount).toNumber();let x=new K(E?.price?.amount||0);S?.email&&(x=x.minus(h?.member||0));const y=x.minus(h?.coupon).minus(s).toNumber();return Math.floor(y*100)/100},[E,z,S,h?.member,h?.coupon]);if(!o.availableForSale)return null;const{bundleVariant:V,giftVariant:_,exchangeVariant:I}=oe()||{},[i,N]=H(),[$,k]=H([]);J(()=>{N({bundle:t.bundle?.value?void 0:V,gift:t.gift?.value?void 0:_,exchange:t.exchange?.value?void 0:I})},[V,_,I,t]);const U=M(()=>{const c=[];return $.forEach((s,x)=>{t[s]?.value&&c.push({type:s,key:`${s}-${x}`})}),c},[$,t]);return J(()=>{k([])},[o?.id]),e("div",{className:"ipc-product-summary laptop:px-16 desktop:px-0 mt-16 desktop:mt-[96px] lg-desktop:mt-[128px]",children:e("div",{className:"bg-[#F5F5F7] laptop:rounded-2xl",children:n(X,{className:"px-4 pt-6 tablet:p-8 tablet:!pb-0",children:[n(T,{className:"col-span-12 laptop:col-start-1 laptop:col-span-5 gap-4 flex flex-col justify-between",children:[e(Y,{className:"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]",html:`${d.title} is ready <br/><span>Just the way you want it.</span>`}),e("div",{className:"",children:e(w,{source:o.image?.url||d?.images?.[0]?.url,className:"lg-desktop:aspect-[644/368] desktop:aspect-[503/272] laptop:aspect-[331/191] tablet:aspect-[704/380] aspect-[358/192]",imgClassName:"object-cover h-full object-[center_36%]"})})]}),n(T,{className:"col-span-12 mt-8 pb-6 tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 flex flex-col gap-6 justify-between",children:[n("div",{children:[n("div",{className:"flex flex-col gap-4",children:[e(te,{exposureKey:"listing_selector",onExposure:()=>{ae({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${o.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:n("div",{className:"flex items-center justify-between",children:[n("div",{className:"shrink-0 flex items-center gap-4",children:[e(w,{source:o.image?.url||d?.images?.[0]?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(r,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:d.title}),e(r,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]",html:`x1 | ${m.color||m.colour||m.couleur}`})]})]}),n("div",{className:"flex items-center gap-1",children:[e(r,{className:"text-base desktop:text-2xl font-bold",html:g({amount:R,currencyCode:o.price.currencyCode,locale:u})}),R<o?.price?.amount&&e(r,{className:"text-base desktop:text-2xl laptop:text-xl font-bold line-through text-[#6D6D6F]",html:g({amount:o?.price?.amount,currencyCode:o.price.currencyCode,locale:u})})]})]})}),U.map(({type:c,key:s})=>c==="gift"&&t?.gift?.value?e(q,{giftOperation:x=>{v?.({...t,gift:{value:void 0,canOperate:!0}}),N?.({...i,gift:x}),k(y=>y.filter(P=>P!=="gift"))},status:!!t?.gift,gift:t?.gift?.value,canOperate:t?.gift?.canOperate},s):c==="bundle"&&t?.bundle?.value?e(W,{bundleOperation:x=>{v?.({...t,bundle:{value:void 0,canOperate:!0}}),N?.({...i,bundle:x}),k(y=>y.filter(P=>P!=="bundle"))},status:!!t?.bundle,bundleListItem:t?.bundle?.value,canOperate:t?.bundle?.canOperate},s):c==="exchange"&&t?.exchange?.value?e(Q,{exchangeOperation:x=>{v?.({...t,exchange:{value:void 0,canOperate:!0}}),N?.({...i,exchange:x}),k(y=>y.filter(P=>P!=="exchange"))},status:!!t?.exchange,canOperate:t?.exchange?.canOperate,exchange:t?.exchange?.value},s):null)]}),(i?.bundle||i?.gift||i?.exchange)&&n("div",{className:"mt-6",children:[e(r,{className:"text-sm desktop:text-[18px] font-bold",html:"Recommend Buy"}),n("div",{className:"flex flex-col gap-6 mt-6",children:[i?.exchange&&e(Q,{exchangeOperation:c=>{v?.({...t,exchange:{value:c,canOperate:!0}}),N?.({...i,exchange:void 0}),k(s=>[...s,"exchange"])},canOperate:t?.exchange?.canOperate,status:!i?.exchange,exchange:i?.exchange}),i?.bundle&&e(W,{bundleOperation:c=>{L?.({...h,exchangePurchase:0}),v?.({...t,bundle:{value:c,canOperate:!0}}),N?.({...i,bundle:void 0}),k(s=>[...s,"bundle"])},canOperate:t?.bundle?.canOperate,status:!i?.bundle,bundleListItem:i?.bundle}),i?.gift&&e(q,{giftOperation:c=>{v?.({...t,gift:{value:c,canOperate:!0}}),N?.({...i,gift:void 0}),k(s=>[...s,"gift"])},canOperate:t?.gift?.canOperate,status:!i?.gift,gift:i?.gift})]})]})]}),n("div",{className:"text-right",children:[e(r,{className:"laptop:text-xl desktop:text-2xl font-bold text-right",html:`${Z(a?.totalPrice||"",{amount:g({amount:Math.floor(p*100)/100,currencyCode:o.price.currencyCode,locale:u})})}`}),D>0&&e(r,{className:"text-base laptop:text-xl desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]",html:g({amount:f,currencyCode:o.price.currencyCode,locale:u})}),n("div",{className:"flex gap-3 mt-2 justify-end",children:[e(O,{size:"lg",variant:"secondary",loading:b,className:"w-1/2 tablet:w-auto laptop:w-1/2 desktop:w-auto",onClick:()=>j?.(),children:a?.addToCart}),e(O,{size:"lg",loading:G,variant:"primary",className:"w-1/2 tablet:w-auto laptop:w-1/2 desktop:w-auto",onClick:()=>F?.(),children:a?.shopNow})]})]})]})]})})})},oe=()=>{const{bundle:u,variant:a,checkedBundle:d,freeGift:o,checkedGift:p,exchangePurchase:f,checkedExchangePurchase:C}=B();let m,l,D;const{bundleList:j}=u||{},{giftList:F=[]}=o||{},{giftList:h=[]}=f||{},z=j?.filter(b=>b.variants.slice(1,b.variants.length).every(G=>G.variant.availableForSale))||[],[t]=z;m=d||t;const[v]=F?.filter(b=>b.availableForSale);l=p||v;const[L]=h?.filter(b=>b.availableForSale);return D=C||L,{bundleVariant:m,giftVariant:l,exchangeVariant:D}},W=({bundleOperation:u,bundleListItem:a,canOperate:d,status:o})=>{const{locale:p="us"}=A(),{variant:f,setCheckedBundle:C}=B(),m=a?.variants.filter(l=>l.variant.sku!==f.sku);return e("div",{className:"",children:m?.map(l=>n("div",{className:"flex items-center gap-4 justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(w,{source:l?.variant?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),e("div",{className:"flex flex-col gap-[6px] line-clamp-2 max-w-[178px] tablet:max-w-none",children:e(r,{className:"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]",html:l.variant.product.title})})]}),n("div",{className:"flex flex-col items-end gap-1 justify-center",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(r,{className:"text-base desktop:text-2xl font-bold",html:g({amount:l?.price||0,locale:p,currencyCode:l.variant?.price?.currencyCode||""})}),l.price<l.variant.price.amount&&e(r,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:g({amount:l.variant.price.amount||0,locale:p,currencyCode:l.variant?.price?.currencyCode||""})})]}),d&&e(O,{size:"icon",variant:"link",onClick:()=>{C?.(o?void 0:a),u?.(a)},className:"shrink-0 size-auto underline",children:o?"Remove":"Add"})]})]},l.variant.id))})},q=({giftOperation:u,gift:a,status:d,canOperate:o})=>{const{locale:p="us"}=A(),{freeGift:f,setCheckedGift:C}=B(),{freeLabel:m,count:l}=f||{};return n("div",{className:"flex items-center justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(w,{source:a?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(r,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:a?.product?.title}),e(r,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]",html:`x${l} | ${m}`})]})]}),n("div",{className:"flex flex-col items-end gap-2 justify-center",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(r,{className:"text-base desktop:text-2xl font-bold",html:m}),e(r,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:g({amount:a.price.amount,locale:p,currencyCode:a.price.currencyCode})})]}),o&&e(O,{size:"icon",variant:"link",onClick:()=>{C?.(d?void 0:a),u(a)},className:"shrink-0 size-auto underline",children:d?"Remove":"Add"})]})]})},Q=({exchangeOperation:u,exchange:a,canOperate:d,status:o})=>{const{locale:p="us"}=A(),{setCheckedExchangePurchase:f}=B();return n("div",{className:"flex items-center justify-between",children:[n("div",{className:"flex items-center gap-4",children:[e(w,{source:a?.image?.url,className:"size-10 laptop:size-12 p-2 lg-desktop:size-16 object-cover border-1 border-[#E4E5E6] bg-[#EAEAEC] rounded-[5px] rounded-lg"}),n("div",{className:"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none",children:[e(r,{className:"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]",html:a?.product?.title}),e(r,{className:"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]"})]})]}),n("div",{className:"flex flex-col items-end gap-2 justify-center",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(r,{className:"text-base desktop:text-2xl font-bold",html:g({amount:a.finalPrice?.amount||0,locale:p,currencyCode:a.price.currencyCode})}),e(r,{className:"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]",html:g({amount:a.price?.amount||0,locale:p,currencyCode:a.price.currencyCode})})]}),d&&e(O,{size:"icon",variant:"link",onClick:()=>{f?.(o?void 0:a),u(a)},className:"shrink-0 size-auto underline",children:o?"Remove":"Add"})]})]})};var ve=ee(ne);export{ve as default};
2
2
  //# sourceMappingURL=index.js.map