@anker-in/headless-ui 1.1.9-temp.120205 → 1.1.9-temp.120301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/AiuiProvider/index.d.ts +5 -0
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js.map +2 -2
- package/dist/cjs/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/cjs/biz-components/Category/SwiperCategory.js.map +1 -1
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Category/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/couponType.d.ts +50 -0
- package/dist/cjs/biz-components/ShelfDisplay/couponType.js +2 -0
- package/dist/cjs/biz-components/ShelfDisplay/couponType.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/couponUtils.d.ts +37 -0
- package/dist/cjs/biz-components/ShelfDisplay/couponUtils.js +2 -0
- package/dist/cjs/biz-components/ShelfDisplay/couponUtils.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/handleCoupon.d.ts +28 -0
- package/dist/cjs/biz-components/ShelfDisplay/handleCoupon.js +2 -0
- package/dist/cjs/biz-components/ShelfDisplay/handleCoupon.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/useUDCGroup.d.ts +0 -0
- package/dist/cjs/biz-components/ShelfDisplay/useUDCGroup.js +2 -0
- package/dist/cjs/biz-components/ShelfDisplay/useUDCGroup.js.map +7 -0
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js.map +2 -2
- package/dist/esm/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/esm/biz-components/Category/SwiperCategory.js.map +1 -1
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Category/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/couponType.js +1 -0
- package/dist/esm/biz-components/ShelfDisplay/couponType.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/couponUtils.js +2 -0
- package/dist/esm/biz-components/ShelfDisplay/couponUtils.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/handleCoupon.js +2 -0
- package/dist/esm/biz-components/ShelfDisplay/handleCoupon.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/useUDCGroup.js +2 -0
- package/dist/esm/biz-components/ShelfDisplay/useUDCGroup.js.map +7 -0
- package/package.json +1 -1
|
@@ -6,6 +6,11 @@ interface AiuiContextType {
|
|
|
6
6
|
pathname?: string;
|
|
7
7
|
storeDomain?: string;
|
|
8
8
|
isLogin?: boolean;
|
|
9
|
+
inApp?: boolean;
|
|
10
|
+
udcGroupIds?: number[];
|
|
11
|
+
udcWhiteGroupIds?: number[];
|
|
12
|
+
targetCode?: string;
|
|
13
|
+
channel?: string;
|
|
9
14
|
currencyCode?: string;
|
|
10
15
|
}
|
|
11
16
|
export declare const AiuiContext: React.Context<AiuiContextType>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty;var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var k=(n,e)=>{for(var o in e)p(n,o,{get:e[o],enumerable:!0})},x=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!v.call(n,t)&&t!==o&&p(n,t,{get:()=>e[t],enumerable:!(s=A(e,t))||s.enumerable});return n};var C=n=>x(p({},"__esModule",{value:!0}),n);var T={};k(T,{AiuiContext:()=>c,default:()=>P,useAiuiContext:()=>_});module.exports=C(T);var b=require("react/jsx-runtime"),g=require("../../shared/track.js"),r=require("react");const c=(0,r.createContext)({trackingData:{},locale:void 0,copyWriting:{}}),_=()=>{if(!(0,r.useContext)(c))throw new Error("useAiui must be used in <AiuiProvider>");return(0,r.useContext)(c)},E=({children:n,...e})=>((0,r.useEffect)(()=>{const o=(t,a)=>{const i={};if(!a||!a.attributes)return i;for(const y of Array.from(a.attributes)){const u=y?.name;u?.startsWith("data-headless-")&&(i[u]=a.getAttribute(u))}const h=i?.["data-headless-sku"],l=i?.["data-headless-type-name"]?.split?.("#"),d=i?.["data-headless-title-desc-button"]?.split?.("#"),m=i?.["data-headless-nav-postion"]?.split?.("#");(0,g.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e?.trackingData?.pageGroup||"Home Page",component_type:l?.[0]||"",component_name:l?.[1]||"",position:m?.[1]||"",navigation:m?.[0]||"",button_name:d?.[2]||"",SKU:h||"",component_title:d?.[0]||"",component_description:d?.[1]||""}})},s=new MutationObserver(()=>{document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",a=>o(a,t)),t.setAttribute("data-headless-track-bound","true"))})});return s.observe(document.body,{childList:!0,subtree:!0}),document.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",a=>o(a,t)),t.setAttribute("data-headless-track-bound","true"))}),()=>s.disconnect()},[]),(0,b.jsx)(c.Provider,{value:e,children:n}));var P=E;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/AiuiProvider/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { gaTrack } from '../../shared/track.js'\nimport React, { createContext, useContext, useEffect } from 'react'\n\ninterface AiuiContextType {\n trackingData: Record<string, any>\n locale?: string\n copyWriting?: Record<string, string>\n pathname?: string\n storeDomain?: string\n isLogin?: boolean\n currencyCode?: string\n}\n\nexport const AiuiContext = createContext<AiuiContextType>({\n trackingData: {},\n locale: undefined,\n copyWriting: {},\n})\n\nexport const useAiuiContext = () => {\n const context = useContext(AiuiContext)\n if (!context) {\n throw new Error('useAiui must be used in <AiuiProvider>')\n }\n return useContext(AiuiContext)\n}\n\nconst AiuiProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & AiuiContextType) => {\n useEffect(() => {\n const handleTrackClick = (e: any, el: any) => {\n // e?.stopPropagation?.()\n const out: any = {}\n if (!el || !el.attributes) return out\n for (const attr of Array.from(el.attributes)) {\n const name = (attr as any)?.name\n if (name?.startsWith('data-headless-')) {\n out[name] = el.getAttribute(name)\n }\n }\n const sku = out?.['data-headless-sku']\n const nameType = out?.['data-headless-type-name']?.split?.('#')\n const titleDesc = out?.['data-headless-title-desc-button']?.split?.('#')\n const navPosition = out?.['data-headless-nav-postion']?.split?.('#')\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: rest?.trackingData?.pageGroup || 'Home Page',\n component_type: nameType?.[0] || '',\n component_name: nameType?.[1] || '',\n position: navPosition?.[1] || '',\n navigation: navPosition?.[0] || '',\n button_name: titleDesc?.[2] || '',\n SKU: sku || '',\n component_title: titleDesc?.[0] || '',\n component_description: titleDesc?.[1] || '',\n },\n })\n }\n const observer = new MutationObserver(() => {\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true') // \u907F\u514D\u91CD\u590D\u7ED1\u5B9A\n }\n })\n })\n observer.observe(document.body, { childList: true, subtree: true })\n // \u521D\u59CB\u5316\u4E00\u6B21\u73B0\u6709\u8282\u70B9\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true')\n }\n })\n return () => observer.disconnect()\n }, [])\n\n return <AiuiContext.Provider value={rest}>{children}</AiuiContext.Provider>\n}\n\nexport default AiuiProvider\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAL,
|
|
4
|
+
"sourcesContent": ["import { gaTrack } from '../../shared/track.js'\nimport React, { createContext, useContext, useEffect } from 'react'\n\ninterface AiuiContextType {\n trackingData: Record<string, any>\n locale?: string\n copyWriting?: Record<string, string>\n pathname?: string\n storeDomain?: string\n isLogin?: boolean\n inApp?: boolean\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n targetCode?: string\n channel?: string\n currencyCode?: string\n}\n\nexport const AiuiContext = createContext<AiuiContextType>({\n trackingData: {},\n locale: undefined,\n copyWriting: {},\n})\n\nexport const useAiuiContext = () => {\n const context = useContext(AiuiContext)\n if (!context) {\n throw new Error('useAiui must be used in <AiuiProvider>')\n }\n return useContext(AiuiContext)\n}\n\nconst AiuiProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & AiuiContextType) => {\n useEffect(() => {\n const handleTrackClick = (e: any, el: any) => {\n // e?.stopPropagation?.()\n const out: any = {}\n if (!el || !el.attributes) return out\n for (const attr of Array.from(el.attributes)) {\n const name = (attr as any)?.name\n if (name?.startsWith('data-headless-')) {\n out[name] = el.getAttribute(name)\n }\n }\n const sku = out?.['data-headless-sku']\n const nameType = out?.['data-headless-type-name']?.split?.('#')\n const titleDesc = out?.['data-headless-title-desc-button']?.split?.('#')\n const navPosition = out?.['data-headless-nav-postion']?.split?.('#')\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: rest?.trackingData?.pageGroup || 'Home Page',\n component_type: nameType?.[0] || '',\n component_name: nameType?.[1] || '',\n position: navPosition?.[1] || '',\n navigation: navPosition?.[0] || '',\n button_name: titleDesc?.[2] || '',\n SKU: sku || '',\n component_title: titleDesc?.[0] || '',\n component_description: titleDesc?.[1] || '',\n },\n })\n }\n const observer = new MutationObserver(() => {\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true') // \u907F\u514D\u91CD\u590D\u7ED1\u5B9A\n }\n })\n })\n observer.observe(document.body, { childList: true, subtree: true })\n // \u521D\u59CB\u5316\u4E00\u6B21\u73B0\u6709\u8282\u70B9\n document.querySelectorAll('[data-headless-type-name]').forEach(el => {\n if (!el.hasAttribute('data-headless-track-bound')) {\n el.addEventListener('click', e => handleTrackClick(e, el))\n el.setAttribute('data-headless-track-bound', 'true')\n }\n })\n return () => observer.disconnect()\n }, [])\n\n return <AiuiContext.Provider value={rest}>{children}</AiuiContext.Provider>\n}\n\nexport default AiuiProvider\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAL,GAwFS,IAAAM,EAAA,6BAxFTC,EAAwB,iCACxBC,EAA4D,iBAiBrD,MAAMN,KAAc,iBAA+B,CACxD,aAAc,CAAC,EACf,OAAQ,OACR,YAAa,CAAC,CAChB,CAAC,EAEYE,EAAiB,IAAM,CAElC,GAAI,IADY,cAAWF,CAAW,EAEpC,MAAM,IAAI,MAAM,wCAAwC,EAE1D,SAAO,cAAWA,CAAW,CAC/B,EAEMO,EAAe,CAAC,CACpB,SAAAC,EACA,GAAGC,CACL,QAGE,aAAU,IAAM,CACd,MAAMC,EAAmB,CAACC,EAAQC,IAAY,CAE5C,MAAMC,EAAW,CAAC,EAClB,GAAI,CAACD,GAAM,CAACA,EAAG,WAAY,OAAOC,EAClC,UAAWC,KAAQ,MAAM,KAAKF,EAAG,UAAU,EAAG,CAC5C,MAAMG,EAAQD,GAAc,KACxBC,GAAM,WAAW,gBAAgB,IACnCF,EAAIE,CAAI,EAAIH,EAAG,aAAaG,CAAI,EAEpC,CACA,MAAMC,EAAMH,IAAM,mBAAmB,EAC/BI,EAAWJ,IAAM,yBAAyB,GAAG,QAAQ,GAAG,EACxDK,EAAYL,IAAM,iCAAiC,GAAG,QAAQ,GAAG,EACjEM,EAAcN,IAAM,2BAA2B,GAAG,QAAQ,GAAG,KACnE,WAAQ,CACN,MAAO,WACP,WAAY,kBACZ,iBAAkB,CAChB,WAAYJ,GAAM,cAAc,WAAa,YAC7C,eAAgBQ,IAAW,CAAC,GAAK,GACjC,eAAgBA,IAAW,CAAC,GAAK,GACjC,SAAUE,IAAc,CAAC,GAAK,GAC9B,WAAYA,IAAc,CAAC,GAAK,GAChC,YAAaD,IAAY,CAAC,GAAK,GAC/B,IAAKF,GAAO,GACZ,gBAAiBE,IAAY,CAAC,GAAK,GACnC,sBAAuBA,IAAY,CAAC,GAAK,EAC3C,CACF,CAAC,CACH,EACME,EAAW,IAAI,iBAAiB,IAAM,CAC1C,SAAS,iBAAiB,2BAA2B,EAAE,QAAQR,GAAM,CAC9DA,EAAG,aAAa,2BAA2B,IAC9CA,EAAG,iBAAiB,QAASD,GAAKD,EAAiBC,EAAGC,CAAE,CAAC,EACzDA,EAAG,aAAa,4BAA6B,MAAM,EAEvD,CAAC,CACH,CAAC,EACD,OAAAQ,EAAS,QAAQ,SAAS,KAAM,CAAE,UAAW,GAAM,QAAS,EAAK,CAAC,EAElE,SAAS,iBAAiB,2BAA2B,EAAE,QAAQR,GAAM,CAC9DA,EAAG,aAAa,2BAA2B,IAC9CA,EAAG,iBAAiB,QAASD,GAAKD,EAAiBC,EAAGC,CAAE,CAAC,EACzDA,EAAG,aAAa,4BAA6B,MAAM,EAEvD,CAAC,EACM,IAAMQ,EAAS,WAAW,CACnC,EAAG,CAAC,CAAC,KAEE,OAACpB,EAAY,SAAZ,CAAqB,MAAOS,EAAO,SAAAD,EAAS,GAGtD,IAAOP,EAAQM",
|
|
6
6
|
"names": ["AiuiProvider_exports", "__export", "AiuiContext", "AiuiProvider_default", "useAiuiContext", "__toCommonJS", "import_jsx_runtime", "import_track", "import_react", "AiuiProvider", "children", "rest", "handleTrackClick", "e", "el", "out", "attr", "name", "sku", "nameType", "titleDesc", "navPosition", "observer"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var m=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var M=(e,i)=>{for(var r in i)a(e,r,{get:i[r],enumerable:!0})},d=(e,i,r,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of S(i))!P.call(e,o)&&o!==r&&a(e,o,{get:()=>i[o],enumerable:!(l=u(i,o))||l.enumerable});return e};var y=(e,i,r)=>(r=e!=null?m(g(e)):{},d(i||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e)),B=e=>d(a({},"__esModule",{value:!0}),e);var b={};M(b,{default:()=>h});module.exports=B(b);var t=require("react/jsx-runtime"),c=y(require("react")),n=require("swiper/react"),s=require("swiper/modules"),k=require("swiper/css"),G=require("swiper/css/pagination");const f=c.default.forwardRef(({data:e,Slide:i,id:r,pagination:l},o)=>(0,t.jsx)(n.Swiper,{freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,dynamicBullets:!1},className:"!overflow-visible",modules:[s.FreeMode,s.Mousewheel,s.Pagination],breakpoints:{0:{spaceBetween:16,freeMode:!1,slidesPerView:
|
|
1
|
+
"use strict";"use client";var m=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var M=(e,i)=>{for(var r in i)a(e,r,{get:i[r],enumerable:!0})},d=(e,i,r,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of S(i))!P.call(e,o)&&o!==r&&a(e,o,{get:()=>i[o],enumerable:!(l=u(i,o))||l.enumerable});return e};var y=(e,i,r)=>(r=e!=null?m(g(e)):{},d(i||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e)),B=e=>d(a({},"__esModule",{value:!0}),e);var b={};M(b,{default:()=>h});module.exports=B(b);var t=require("react/jsx-runtime"),c=y(require("react")),n=require("swiper/react"),s=require("swiper/modules"),k=require("swiper/css"),G=require("swiper/css/pagination");const f=c.default.forwardRef(({data:e,Slide:i,id:r,pagination:l},o)=>(0,t.jsx)(n.Swiper,{freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,dynamicBullets:!1},className:"!overflow-visible",modules:[s.FreeMode,s.Mousewheel,s.Pagination],breakpoints:{0:{spaceBetween:16,freeMode:!1,slidesPerView:2,slidesPerGroup:1},376:{spaceBetween:16,freeMode:!1,slidesPerView:2,slidesPerGroup:1},767:{spaceBetween:16,freeMode:!1,slidesPerView:4,slidesPerGroup:4},1441:{spaceBetween:16,freeMode:!1,slidesPerView:Math.min(6,e?.list?.length),slidesPerGroup:Math.min(6,e?.list?.length)}},children:e?.list?.map((w,p)=>(0,t.jsx)(n.SwiperSlide,{className:"!h-[unset]",children:(0,t.jsx)(i,{data:w,configuration:{...e?.configuration,index:p}})},r+"SwiperSlide"+p))}));f.displayName="SwiperBox";var h=f;
|
|
2
2
|
//# sourceMappingURL=SwiperCategory.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Category/SwiperCategory.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\nimport 'swiper/css'\nimport 'swiper/css/pagination' // \u5206\u9875\u5668\u6837\u5F0F\n\nexport interface SwiperBoxProps {\n data: {\n list: any[]\n configuration?: any\n }\n pagination?: any\n id: string\n className?: string\n breakpoints?: Record<number, Object>\n Slide: React.ComponentType<{ data: any; configuration?: any }>\n}\n\nconst SwiperBox = React.forwardRef<HTMLDivElement, SwiperBoxProps>(({ data, Slide, id, pagination }, ref) => {\n return (\n <Swiper\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n pagination={{\n clickable: true,\n dynamicBullets: false,\n }}\n className=\"!overflow-visible\"\n modules={[FreeMode, Mousewheel, Pagination]}\n breakpoints={{\n 0: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView:
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\nimport 'swiper/css'\nimport 'swiper/css/pagination' // \u5206\u9875\u5668\u6837\u5F0F\n\nexport interface SwiperBoxProps {\n data: {\n list: any[]\n configuration?: any\n }\n pagination?: any\n id: string\n className?: string\n breakpoints?: Record<number, Object>\n Slide: React.ComponentType<{ data: any; configuration?: any }>\n}\n\nconst SwiperBox = React.forwardRef<HTMLDivElement, SwiperBoxProps>(({ data, Slide, id, pagination }, ref) => {\n return (\n <Swiper\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n pagination={{\n clickable: true,\n dynamicBullets: false,\n }}\n className=\"!overflow-visible\"\n modules={[FreeMode, Mousewheel, Pagination]}\n breakpoints={{\n 0: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2,\n slidesPerGroup: 1,\n },\n 376: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2,\n slidesPerGroup: 1,\n },\n 767: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n slidesPerGroup: 4,\n },\n 1441: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: Math.min(6, data?.list?.length),\n slidesPerGroup: Math.min(6, data?.list?.length),\n },\n }}\n >\n {data?.list?.map((item, jIndex) => (\n <SwiperSlide key={id + 'SwiperSlide' + jIndex} className=\"!h-[unset]\">\n <Slide data={item} configuration={{ ...data?.configuration, index: jIndex }} />\n </SwiperSlide>\n ))}\n </Swiper>\n )\n})\n\nSwiperBox.displayName = 'SwiperBox'\n\nexport default SwiperBox\n"],
|
|
5
5
|
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA6DU,IAAAI,EAAA,6BA5DVC,EAAkB,oBAClBA,EAAoC,wBACpCC,EAAiD,0BACjDC,EAAO,sBACPC,EAAO,iCAcP,MAAMC,EAAY,EAAAC,QAAM,WAA2C,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAAC,EAAI,WAAAC,CAAW,EAAGC,OAEjG,OAAC,UACC,SAAU,GACV,WAAY,CACV,YAAa,EACf,EACA,WAAY,CACV,UAAW,GACX,eAAgB,EAClB,EACA,UAAU,oBACV,QAAS,CAAC,WAAU,aAAY,YAAU,EAC1C,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,EACf,eAAgB,CAClB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,EACf,eAAgB,CAClB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,EACf,eAAgB,CAClB,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,KAAK,IAAI,EAAGJ,GAAM,MAAM,MAAM,EAC7C,eAAgB,KAAK,IAAI,EAAGA,GAAM,MAAM,MAAM,CAChD,CACF,EAEC,SAAAA,GAAM,MAAM,IAAI,CAACK,EAAMC,OACtB,OAAC,eAA8C,UAAU,aACvD,mBAACL,EAAA,CAAM,KAAMI,EAAM,cAAe,CAAE,GAAGL,GAAM,cAAe,MAAOM,CAAO,EAAG,GAD7DJ,EAAK,cAAgBI,CAEvC,CACD,EACH,CAEH,EAEDR,EAAU,YAAc,YAExB,IAAOP,EAAQO",
|
|
6
6
|
"names": ["SwiperCategory_exports", "__export", "SwiperCategory_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_modules", "import_css", "import_pagination", "SwiperBox", "React", "data", "Slide", "id", "pagination", "ref", "item", "jIndex"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var I=Object.create;var d=Object.defineProperty;var
|
|
1
|
+
"use strict";"use client";var I=Object.create;var d=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var _=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},b=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D(t))!T.call(e,n)&&n!==o&&d(e,n,{get:()=>t[n],enumerable:!(r=$(t,n))||r.enumerable});return e};var u=(e,t,o)=>(o=e!=null?I(S(e)):{},b(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),H=e=>b(d({},"__esModule",{value:!0}),e);var B={};_(B,{default:()=>R});module.exports=H(B);var a=require("react/jsx-runtime"),l=u(require("react")),i=require("../../helpers/utils.js"),g=u(require("../../components/picture.js")),k=require("../../shared/Styles.js"),C=u(require("../Title/index.js")),x=u(require("./SwiperCategory.js")),f=require("../../hooks/useExposure.js"),h=require("../../shared/trackUrlRef.js"),w=require("../../components/heading.js");const p="image",c="category_banner",j=(e,t)=>{const o=[];for(let r=0;r<e.length;r+=t)o.push(e.slice(r,r+t));return o},L=({data:e,configuration:t})=>{const o=(0,l.useRef)(null);return(0,f.useExposure)(o,{componentType:p,componentName:c,componentTitle:e?.name,position:t?.index+1}),(0,a.jsxs)("div",{ref:o,className:(0,i.cn)("tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]","tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8","bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[(0,a.jsx)("div",{className:"transition-all duration-300 group-hover:scale-110",children:(0,a.jsx)("a",{"aria-label":e?.name,href:(0,h.trackUrlRef)(e?.link,`${p}_${c}`),"data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${e?.name}`,onClick:()=>t?.event?.primaryButton(e,t?.index),children:(0,a.jsx)(g.default,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover"})})}),(0,a.jsx)(w.Heading,{as:"h3",className:"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold",children:e?.name})]})},M=({data:e,configuration:t,index:o})=>{const r=(0,l.useRef)(null);(0,f.useExposure)(r,{componentType:p,componentName:c,componentTitle:e?.name,position:t?.index+1});const s=(t?.totalCategories??0)<6,m=o===0;return(0,a.jsxs)("div",{ref:r,className:(0,i.cn)("bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer duration-300",s?(0,i.cn)("p-4",m?"aspect-h-[252] row-span-2":"aspect-h-[120]"):"max-h-[126px] px-3 py-4",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[(0,a.jsx)("a",{href:(0,h.trackUrlRef)(e?.link,`${p}_${c}`),"data-headless-type-name":`${p}#${c}`,"data-headless-title-desc-button":`${e?.name}`,"data-headless-nav-postion":`''#${t?.index+1}`,onClick:()=>t?.event?.primaryButton(e,t?.index+1),children:(0,a.jsx)(g.default,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:(0,i.cn)("m-auto mb-2 flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",s?(0,i.cn)(m?"max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]"):"size-[72px]")})}),(0,a.jsx)("p",{className:(0,i.cn)("text-info-primary text-center text-sm font-bold",s?"line-clamp-2":"shrink-0 truncate"),children:e?.name})]})},E=({data:e,configuration:t})=>(0,a.jsx)("div",{className:"flex h-full flex-col gap-3",children:e?.map((o,r)=>(0,a.jsx)(M,{index:r,data:o,configuration:t},r))}),z=l.default.forwardRef((e,t)=>{const{data:o,className:r="",key:n,event:s}=e,m=(o?.isShowSelect?o?.products:o?.productData)||[],y=m.length,N=j(m,3),v=(0,l.useRef)(null);return(0,l.useImperativeHandle)(t,()=>v.current),(0,a.jsxs)("div",{ref:v,className:(0,i.cn)("w-full overflow-hidden",r,{"aiui-dark":o?.theme==="dark"}),children:[o?.title&&(0,a.jsx)(C.default,{data:{title:o?.title},className:"text-4xl"}),(0,a.jsx)("div",{className:"tablet:block hidden",children:(0,a.jsx)(x.default,{id:`Category${n}`,Slide:L,data:{list:m,configuration:{shape:o?.shape,event:s,title:o?.title,totalCategories:y}}})}),(0,a.jsx)("div",{className:"tablet:hidden block",children:(0,a.jsx)(x.default,{id:`Category1${n}`,Slide:E,data:{list:N,configuration:{shape:o?.shape,event:s,title:o?.title,totalCategories:y}}})}),(0,a.jsx)("div",{className:"h-7"})]})});var R=(0,k.withLayout)(z);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Category/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'category_banner'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: Img\n name: string\n link?: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n data: {\n isShowSelect: boolean\n products: CategoryItem[]\n productData: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n theme?: 'light' | 'dark'\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["Category_exports", "__export", "Category_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_Title", "import_SwiperCategory", "import_useExposure", "import_trackUrlRef", "import_heading", "componentType", "componentName", "chunkArray", "arr", "size", "chunks", "i", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'category_banner'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: Img\n name: string\n link?: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n data: {\n isShowSelect: boolean\n products: CategoryItem[]\n productData: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n theme?: 'light' | 'dark'\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (v: any, index: number) => void\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst CategoryPcItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.name,\n position: configuration?.index + 1,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]',\n 'tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8',\n 'bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <div className=\"transition-all duration-300 group-hover:scale-110\">\n <a\n aria-label={data?.name}\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.name}`}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index)}\n >\n <Picture\n alt={data?.image?.alt || ''}\n source={data?.image?.url || ''}\n className=\"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover\"\n />\n </a>\n </div>\n <Heading\n as=\"h3\"\n className=\"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold\"\n >\n {data?.name}\n </Heading>\n </div>\n )\n}\n\n// \u79FB\u52A8\u7AEF\u54C1\u7C7B\u5C55\u793A\u7EC4\u4EF6\nconst SingleMobileItem = ({\n data,\n configuration,\n index,\n}: {\n data: CategoryItem\n configuration?: any\n index: number\n}) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.name,\n position: configuration?.index + 1,\n })\n\n const totalCategories = configuration?.totalCategories ?? 0\n // \u5F53\u6570\u91CF\u5C11\u4E8E\u5BB9\u5668\u65F6\uFF0C\u7B2C\u4E00\u4E2A\u9879\u76EE\u4F1A\u5360\u636E\u66F4\u5927\u7A7A\u95F4\n const isFirstItemLarger = totalCategories < 6\n const isFirstItem = index === 0\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden',\n 'hover:bg-info-white cursor-pointer duration-300',\n // \u5F53\u7B2C\u4E00\u4E2A\u9879\u76EE\u9700\u8981\u66F4\u5927\u7A7A\u95F4\u65F6\u8C03\u6574\u6837\u5F0F\n isFirstItemLarger\n ? cn('p-4', isFirstItem ? 'aspect-h-[252] row-span-2' : 'aspect-h-[120]')\n : 'max-h-[126px] px-3 py-4',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <a\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.name}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n onClick={() => configuration?.event?.primaryButton(data, configuration?.index + 1)}\n >\n <Picture\n source={data?.image?.url || ''}\n alt={data?.image?.alt || ''}\n className={cn(\n 'm-auto mb-2 flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover',\n // \u5F53\u7B2C\u4E00\u4E2A\u9879\u76EE\u9700\u8981\u66F4\u5927\u7A7A\u95F4\u65F6\u8C03\u6574\u56FE\u7247\u5C3A\u5BF8\n isFirstItemLarger\n ? cn(isFirstItem ? 'max-h-[146px] overflow-hidden' : 'max-h-[72px] max-w-[72px]')\n : 'size-[72px]'\n )}\n />\n </a>\n <p\n className={cn(\n 'text-info-primary text-center text-sm font-bold',\n // \u5F53\u7B2C\u4E00\u4E2A\u9879\u76EE\u9700\u8981\u66F4\u5927\u7A7A\u95F4\u65F6\u8C03\u6574\u6587\u5B57\u663E\u793A\n isFirstItemLarger ? 'line-clamp-2' : 'shrink-0 truncate'\n )}\n >\n {data?.name}\n </p>\n </div>\n )\n}\n\n// \u79FB\u52A8\u7AEF\u54C1\u7C7B\u5C55\u793A\nconst CategoryMobileItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <div className=\"flex h-full flex-col gap-3\">\n {data?.map((item, index) => (\n <SingleMobileItem key={index} index={index} data={item} configuration={configuration} />\n ))}\n </div>\n )\n}\n\nconst Category = React.forwardRef<HTMLDivElement, CategoryProps>((props, ref) => {\n const { data, className = '', key, event } = props\n // soundcore\u54C1\u724C\u54C1\u7C7B\u4E0D\u8D85\u8FC75\u4E2A\uFF0C\u5355\u72EC\u505A\u6837\u5F0F\u5904\u7406\n const currentData = (data?.isShowSelect ? data?.products : data?.productData) || []\n const totalCategories = currentData.length\n const mobileSlides = chunkArray(currentData, 3)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n return (\n <div ref={innerRef} className={cn('w-full overflow-hidden', className, { 'aiui-dark': data?.theme === 'dark' })}>\n {data?.title && <Title data={{ title: data?.title }} className=\"text-4xl\" />}\n <div className=\"tablet:block hidden\">\n <SwiperBox\n id={`Category${key}`}\n Slide={CategoryPcItem}\n data={{\n list: currentData,\n configuration: { shape: data?.shape, event: event, title: data?.title, totalCategories },\n }}\n />\n </div>\n <div className=\"tablet:hidden block\">\n <SwiperBox\n id={`Category1${key}`}\n Slide={CategoryMobileItem}\n data={{\n list: mobileSlides,\n configuration: { shape: data?.shape, event: event, title: data?.title, totalCategories },\n }}\n />\n </div>\n <div className=\"h-7\" />\n </div>\n )\n})\n\nexport default withLayout(Category)\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Category_exports", "__export", "Category_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_Title", "import_SwiperCategory", "import_useExposure", "import_trackUrlRef", "import_heading", "componentType", "componentName", "chunkArray", "arr", "size", "chunks", "i", "CategoryPcItem", "data", "configuration", "ref", "Picture", "SingleMobileItem", "index", "isFirstItemLarger", "isFirstItem", "CategoryMobileItem", "item", "Category", "React", "props", "className", "key", "event", "currentData", "totalCategories", "mobileSlides", "innerRef", "Title", "SwiperBox"]
|
|
7
7
|
}
|
|
@@ -15,7 +15,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
15
15
|
} | undefined;
|
|
16
16
|
slug: string;
|
|
17
17
|
payload?: any;
|
|
18
|
-
} & Omit<import("../../types/graphql.js").Product, "media" | "
|
|
18
|
+
} & Omit<import("../../types/graphql.js").Product, "media" | "options" | "metafields" | "price" | "images" | "variants"> & {
|
|
19
19
|
variant: ProductVariant;
|
|
20
20
|
})[];
|
|
21
21
|
variant: ProductVariant;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type SellingPlans = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
options: {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
export type ProductOption = {
|
|
10
|
+
__typename?: 'MultipleChoiceOption';
|
|
11
|
+
id: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
values: ProductOptionValues[];
|
|
14
|
+
};
|
|
15
|
+
export type ProductOptionValues = {
|
|
16
|
+
label: string;
|
|
17
|
+
hexColors?: string[];
|
|
18
|
+
};
|
|
19
|
+
export type SellingPlanAllocations = {
|
|
20
|
+
priceAdjustments: [];
|
|
21
|
+
sellingPlan: SellingPlans;
|
|
22
|
+
}[];
|
|
23
|
+
export type ProductVariant = {
|
|
24
|
+
id: string | number;
|
|
25
|
+
options: ProductOption[];
|
|
26
|
+
availableForSale?: boolean;
|
|
27
|
+
quantityAvailable: number;
|
|
28
|
+
metafields?: Record<string, any>;
|
|
29
|
+
sellingPlanAllocations?: SellingPlanAllocations;
|
|
30
|
+
price: number;
|
|
31
|
+
listPrice: number;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
export type VariantCoupon = {
|
|
35
|
+
title: string;
|
|
36
|
+
starts_at: string;
|
|
37
|
+
ends_at: string | null;
|
|
38
|
+
variant_shopify_id: number;
|
|
39
|
+
value_type: 'percentage' | 'fixed' | 'fixed_amount' | 'fix_discount_amount';
|
|
40
|
+
value: string;
|
|
41
|
+
currency: string;
|
|
42
|
+
fixed_value: string;
|
|
43
|
+
value_style: string;
|
|
44
|
+
variant_price4wscode: number;
|
|
45
|
+
discount_type: string;
|
|
46
|
+
amazon_deal: boolean;
|
|
47
|
+
cdi_id: number;
|
|
48
|
+
cdi_updated_at: string;
|
|
49
|
+
variant_price?: string;
|
|
50
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var p=(n,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of s(t))!o.call(n,e)&&e!==r&&a(n,e,{get:()=>t[e],enumerable:!(i=l(t,e))||i.enumerable});return n};var u=n=>p(a({},"__esModule",{value:!0}),n);var g={};module.exports=u(g);
|
|
2
|
+
//# sourceMappingURL=couponType.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/ShelfDisplay/couponType.ts"],
|
|
4
|
+
"sourcesContent": ["export type SellingPlans = {\n id: string\n name: string\n options: {\n name: string\n value: string\n }[]\n}\n\nexport type ProductOption = {\n __typename?: 'MultipleChoiceOption'\n id: string\n displayName: string\n values: ProductOptionValues[]\n}\n\nexport type ProductOptionValues = {\n label: string\n hexColors?: string[]\n}\n\nexport type SellingPlanAllocations = {\n priceAdjustments: []\n sellingPlan: SellingPlans\n}[]\n\nexport type ProductVariant = {\n id: string | number\n options: ProductOption[]\n availableForSale?: boolean\n quantityAvailable: number\n metafields?: Record<string, any>\n sellingPlanAllocations?: SellingPlanAllocations\n price: number\n listPrice: number\n [key: string]: any\n}\n\nexport type VariantCoupon = {\n title: string\n starts_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n ends_at: string | null // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\u6216 null\n variant_shopify_id: number\n value_type: 'percentage' | 'fixed' | 'fixed_amount' | 'fix_discount_amount' // \u5047\u8BBE value_type \u53EA\u6709 'percentage' \u548C 'fixed' \u4E24\u79CD\u53EF\u80FD\u503C\n value: string // \u8D1F\u6570\u7684\u767E\u5206\u6BD4\u503C\n currency: string\n fixed_value: string // \u56FA\u5B9A\u503C\n value_style: string // \u5E26\u6709\u8D27\u5E01\u7B26\u53F7\u7684\u503C\n variant_price4wscode: number\n discount_type: string // \u5047\u8BBE discount_type \u662F\u4E00\u4E2A\u5B57\u7B26\u4E32\n amazon_deal: boolean\n cdi_id: number\n cdi_updated_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n variant_price?: string\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["couponType_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ProductVariant, VariantCoupon } from './couponType';
|
|
2
|
+
export declare enum CouponType {
|
|
3
|
+
hideChannel = "wsch",
|
|
4
|
+
appChannel = "wsap",
|
|
5
|
+
udcChannel = "wsuc"
|
|
6
|
+
}
|
|
7
|
+
export declare function atobID(id: any): any;
|
|
8
|
+
export interface GetValidCustomCouponProps {
|
|
9
|
+
/** custom_data item */
|
|
10
|
+
customDataItem: {
|
|
11
|
+
udcGroups: number[];
|
|
12
|
+
whiteGroups: number[];
|
|
13
|
+
discount: VariantCoupon;
|
|
14
|
+
};
|
|
15
|
+
/** 人群分组,来自 get_user_in_group 接口 */
|
|
16
|
+
udcGroupIds?: number[];
|
|
17
|
+
udcWhiteGroupIds?: number[];
|
|
18
|
+
}
|
|
19
|
+
declare class CouponUtils {
|
|
20
|
+
/** 是否为隐藏渠道优惠券 */
|
|
21
|
+
static isHideChannelCoupon(couponTitle?: string): boolean;
|
|
22
|
+
/** 是否为 App 渠道优惠券 */
|
|
23
|
+
static isAppChannelCoupon(couponTitle?: string): boolean;
|
|
24
|
+
/** 是否为 UDC 渠道优惠券 */
|
|
25
|
+
static isUDCChannelCoupon(couponTitle?: string): boolean;
|
|
26
|
+
/** 检查优惠券是否在有效期内 */
|
|
27
|
+
static isCouponInValidPeriod(coupon: VariantCoupon): boolean;
|
|
28
|
+
/** 检查优惠券是否匹配指定的隐藏渠道 */
|
|
29
|
+
static getMatchChannelCoupons(activeCoupons: VariantCoupon[], channel?: string): VariantCoupon[];
|
|
30
|
+
/** 检查优惠券是否匹配变体ID */
|
|
31
|
+
static isCouponMatchVariant(coupon: VariantCoupon, variant: ProductVariant | undefined): boolean;
|
|
32
|
+
/** 验证是否有 coupons 或者 custom_coupons */
|
|
33
|
+
static validateVariantCoupon(variant: ProductVariant | undefined): boolean;
|
|
34
|
+
/** 获取 custom_data 中符合 UDC 人群分组的折扣 */
|
|
35
|
+
static getValidCustomCoupon({ customDataItem, udcGroupIds, udcWhiteGroupIds }: GetValidCustomCouponProps): boolean;
|
|
36
|
+
}
|
|
37
|
+
export { CouponUtils };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of d(t))!h.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(o=C(t,s))||o.enumerable});return e};var V=e=>f(i({},"__esModule",{value:!0}),e);var w={};m(w,{CouponType:()=>p,CouponUtils:()=>l,atobID:()=>c});module.exports=V(w);var p=(o=>(o.hideChannel="wsch",o.appChannel="wsap",o.udcChannel="wsuc",o))(p||{});function c(e){return e?typeof e=="string"&&e.includes("/")?e?.split("/")?.pop()?.split("?")?.shift():e:null}class l{static isHideChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsch")}static isAppChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsap")}static isUDCChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsuc")}static isCouponInValidPeriod(t){const n=new Date().getTime(),o=t?.ends_at===null||t?.ends_at===void 0,s=new Date(t?.ends_at).getTime()>n,a=new Date(t?.starts_at).getTime()<=n;return(o||s)&&a}static getMatchChannelCoupons(t,n){if(!n||t.length===0)return[];const o=n.toLowerCase(),s=[];for(const a of t){const r=a?.title.toLowerCase();if(r===o)return[a];r.includes(o)&&s.push(a)}return s}static isCouponMatchVariant(t,n){return t?.variant_shopify_id===+c(n?.id)}static validateVariantCoupon(t){const n=t?.metafields?.coupons||[],o=t?.metafields?.custom_coupons,s=Array.isArray(n)&&n.length>0,a=Array.isArray(o)&&o.length>0;return s||a}static getValidCustomCoupon({customDataItem:t,udcGroupIds:n,udcWhiteGroupIds:o}){const{udcGroups:s,whiteGroups:a}=t;return s?.some(u=>n?.includes(u))?!0:a?.some(u=>o?.includes(u))}}
|
|
2
|
+
//# sourceMappingURL=couponUtils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/ShelfDisplay/couponUtils.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ProductVariant, VariantCoupon } from './couponType'\n\nexport enum CouponType {\n hideChannel = 'wsch',\n appChannel = 'wsap',\n udcChannel = 'wsuc',\n}\n\nexport function atobID(id: any) {\n if (!id) {\n return null\n }\n if (typeof id === 'string' && id.includes('/')) {\n return id?.split('/')?.pop()?.split('?')?.shift()\n }\n return id\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nclass CouponUtils {\n /** \u662F\u5426\u4E3A\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238 */\n static isHideChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.hideChannel)\n }\n\n /** \u662F\u5426\u4E3A App \u6E20\u9053\u4F18\u60E0\u5238 */\n static isAppChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.appChannel)\n }\n\n /** \u662F\u5426\u4E3A UDC \u6E20\u9053\u4F18\u60E0\u5238 */\n static isUDCChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.udcChannel)\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5728\u6709\u6548\u671F\u5185 */\n static isCouponInValidPeriod(coupon: VariantCoupon): boolean {\n const now = new Date().getTime()\n const hasNoEndDate = coupon?.ends_at === null || coupon?.ends_at === undefined\n const isNotExpired = new Date(coupon?.ends_at as string).getTime() > now\n const hasStarted = new Date(coupon?.starts_at).getTime() <= now\n\n return (hasNoEndDate || isNotExpired) && hasStarted\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u6307\u5B9A\u7684\u9690\u85CF\u6E20\u9053 */\n static getMatchChannelCoupons(activeCoupons: VariantCoupon[], channel?: string): VariantCoupon[] {\n if (!channel || activeCoupons.length === 0) {\n return []\n }\n\n const lowerChannel = channel.toLowerCase()\n const result: VariantCoupon[] = []\n\n for (const coupon of activeCoupons) {\n const couponTitle = coupon?.title.toLowerCase()\n\n // \u5B8C\u5168\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\uFF0C\u627E\u5230\u5C31\u7ACB\u5373\u8FD4\u56DE\n if (couponTitle === lowerChannel) {\n return [coupon]\n }\n\n // \u6536\u96C6\u90E8\u5206\u5339\u914D\u7684\u4F18\u60E0\u5238\uFF08\u539F\u903B\u8F91\uFF1AWSCH****\uFF09\n if (couponTitle.includes(lowerChannel)) {\n result.push(coupon)\n }\n }\n\n return result\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u53D8\u4F53ID */\n static isCouponMatchVariant(coupon: VariantCoupon, variant: ProductVariant | undefined): boolean {\n return coupon?.variant_shopify_id === +atobID(variant?.id)\n }\n\n /** \u9A8C\u8BC1\u662F\u5426\u6709 coupons \u6216\u8005 custom_coupons */\n static validateVariantCoupon(variant: ProductVariant | undefined): boolean {\n const coupons = variant?.metafields?.coupons || []\n const customCoupons = variant?.metafields?.custom_coupons\n const hasValidCoupons = Array.isArray(coupons) && coupons.length > 0\n const hasValidCustomCoupons = Array.isArray(customCoupons) && customCoupons.length > 0\n\n return hasValidCoupons || hasValidCustomCoupons\n }\n\n /** \u83B7\u53D6 custom_data \u4E2D\u7B26\u5408 UDC \u4EBA\u7FA4\u5206\u7EC4\u7684\u6298\u6263 */\n static getValidCustomCoupon({ customDataItem, udcGroupIds, udcWhiteGroupIds }: GetValidCustomCouponProps): boolean {\n const { udcGroups, whiteGroups } = customDataItem\n\n // \u5148\u68C0\u67E5 udcGroups \u5728\u63A5\u53E3\u91CC\u6709\u6CA1\u6709\n const hasUDCGroupMatch = udcGroups?.some(id => udcGroupIds?.includes(id))\n\n if (hasUDCGroupMatch) {\n return true\n }\n\n // \u6CA1\u6709\u7684\u8BDD\u518D\u68C0\u67E5 whiteGroups\n return whiteGroups?.some(id => udcWhiteGroupIds?.includes(id))\n }\n}\n\nexport { CouponUtils }\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,gBAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAL,GAEO,IAAKE,OACVA,EAAA,YAAc,OACdA,EAAA,WAAa,OACbA,EAAA,WAAa,OAHHA,OAAA,IAML,SAASE,EAAOE,EAAS,CAC9B,OAAKA,EAGD,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EACpCA,GAAI,MAAM,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAE3CA,EALE,IAMX,CAcA,MAAMH,CAAY,CAEhB,OAAO,oBAAoBI,EAA+B,CACxD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAsB,CACvE,CAGA,OAAO,mBAAmBA,EAA+B,CACvD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAqB,CACtE,CAGA,OAAO,mBAAmBA,EAA+B,CACvD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAqB,CACtE,CAGA,OAAO,sBAAsBC,EAAgC,CAC3D,MAAMC,EAAM,IAAI,KAAK,EAAE,QAAQ,EACzBC,EAAeF,GAAQ,UAAY,MAAQA,GAAQ,UAAY,OAC/DG,EAAe,IAAI,KAAKH,GAAQ,OAAiB,EAAE,QAAQ,EAAIC,EAC/DG,EAAa,IAAI,KAAKJ,GAAQ,SAAS,EAAE,QAAQ,GAAKC,EAE5D,OAAQC,GAAgBC,IAAiBC,CAC3C,CAGA,OAAO,uBAAuBC,EAAgCC,EAAmC,CAC/F,GAAI,CAACA,GAAWD,EAAc,SAAW,EACvC,MAAO,CAAC,EAGV,MAAME,EAAeD,EAAQ,YAAY,EACnCE,EAA0B,CAAC,EAEjC,UAAWR,KAAUK,EAAe,CAClC,MAAMN,EAAcC,GAAQ,MAAM,YAAY,EAG9C,GAAID,IAAgBQ,EAClB,MAAO,CAACP,CAAM,EAIZD,EAAY,SAASQ,CAAY,GACnCC,EAAO,KAAKR,CAAM,CAEtB,CAEA,OAAOQ,CACT,CAGA,OAAO,qBAAqBR,EAAuBS,EAA8C,CAC/F,OAAOT,GAAQ,qBAAuB,CAACJ,EAAOa,GAAS,EAAE,CAC3D,CAGA,OAAO,sBAAsBA,EAA8C,CACzE,MAAMC,EAAUD,GAAS,YAAY,SAAW,CAAC,EAC3CE,EAAgBF,GAAS,YAAY,eACrCG,EAAkB,MAAM,QAAQF,CAAO,GAAKA,EAAQ,OAAS,EAC7DG,EAAwB,MAAM,QAAQF,CAAa,GAAKA,EAAc,OAAS,EAErF,OAAOC,GAAmBC,CAC5B,CAGA,OAAO,qBAAqB,CAAE,eAAAC,EAAgB,YAAAC,EAAa,iBAAAC,CAAiB,EAAuC,CACjH,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAKnC,OAFyBG,GAAW,KAAKnB,GAAMiB,GAAa,SAASjB,CAAE,CAAC,EAG/D,GAIFoB,GAAa,KAAKpB,GAAMkB,GAAkB,SAASlB,CAAE,CAAC,CAC/D,CACF",
|
|
6
|
+
"names": ["couponUtils_exports", "__export", "CouponType", "CouponUtils", "atobID", "__toCommonJS", "id", "couponTitle", "coupon", "now", "hasNoEndDate", "isNotExpired", "hasStarted", "activeCoupons", "channel", "lowerChannel", "result", "variant", "coupons", "customCoupons", "hasValidCoupons", "hasValidCustomCoupons", "customDataItem", "udcGroupIds", "udcWhiteGroupIds", "udcGroups", "whiteGroups"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ProductVariant, VariantCoupon } from './couponType';
|
|
2
|
+
interface GetCouponFromVariantProps {
|
|
3
|
+
/** 变体 */
|
|
4
|
+
variant: ProductVariant | undefined;
|
|
5
|
+
/** 隐藏渠道 */
|
|
6
|
+
channel?: string;
|
|
7
|
+
/** 是否在app中 */
|
|
8
|
+
inApp?: boolean;
|
|
9
|
+
/** UDC人群分组 */
|
|
10
|
+
udcGroupIds?: number[];
|
|
11
|
+
/** UDC白名单人群分组 */
|
|
12
|
+
udcWhiteGroupIds?: number[];
|
|
13
|
+
/** 目标代码 */
|
|
14
|
+
targetCode?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GetValidCustomCouponProps {
|
|
17
|
+
/** custom_data item */
|
|
18
|
+
customDataItem: {
|
|
19
|
+
udcGroups: number[];
|
|
20
|
+
whiteGroups: number[];
|
|
21
|
+
discount: VariantCoupon;
|
|
22
|
+
};
|
|
23
|
+
/** 人群分组,来自 get_user_in_group 接口 */
|
|
24
|
+
udcGroupIds?: number[];
|
|
25
|
+
udcWhiteGroupIds?: number[];
|
|
26
|
+
}
|
|
27
|
+
export declare function getCouponFromVariant({ variant, channel, inApp, udcGroupIds, udcWhiteGroupIds, targetCode, }: GetCouponFromVariantProps): VariantCoupon | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var C=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var g=(n,t)=>{for(var i in t)C(n,i,{get:t[i],enumerable:!0})},b=(n,t,i,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of P(t))!I.call(n,u)&&u!==i&&C(n,u,{get:()=>t[u],enumerable:!(a=G(t,u))||a.enumerable});return n};var D=n=>b(C({},"__esModule",{value:!0}),n);var U={};g(U,{getCouponFromVariant:()=>M});module.exports=D(U);var e=require("./couponUtils");function M({variant:n,channel:t,inApp:i,udcGroupIds:a,udcWhiteGroupIds:u,targetCode:c}){if(!e.CouponUtils.validateVariantCoupon(n))return;const d=n.metafields?.coupons||[],f=(n.metafields?.custom_coupons||[])?.filter(o=>a||u?e.CouponUtils.getValidCustomCoupon({customDataItem:o,udcGroupIds:a,udcWhiteGroupIds:u}):!0)?.map(o=>o?.discount?.title),l=d?.find(o=>{const r=e.CouponUtils.isCouponInValidPeriod(o),s=e.CouponUtils.isCouponMatchVariant(o,n);return f?.includes(o.title)&&r&&s});if(i&&l)return l;const p=d.filter(o=>{const r=e.CouponUtils.isCouponInValidPeriod(o),s=e.CouponUtils.isCouponMatchVariant(o,n),h=e.CouponUtils.isUDCChannelCoupon(o.title);return r&&s&&!h}),m=e.CouponUtils.getMatchChannelCoupons(p,t);if(m.length>0)return m[0];const V=c?p.filter(o=>o.title?.toLocaleUpperCase()===c?.toLocaleUpperCase()):void 0;return(V||p.filter(o=>{const r=e.CouponUtils.isHideChannelCoupon(o.title),s=e.CouponUtils.isAppChannelCoupon(o.title);return i?!r:!r&&!s}))[0]}
|
|
2
|
+
//# sourceMappingURL=handleCoupon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/ShelfDisplay/handleCoupon.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable import/extensions */\nimport { CouponUtils } from './couponUtils'\n\nimport type { ProductVariant, VariantCoupon } from './couponType'\n\ninterface GetCouponFromVariantProps {\n /** \u53D8\u4F53 */\n variant: ProductVariant | undefined\n /** \u9690\u85CF\u6E20\u9053 */\n channel?: string\n /** \u662F\u5426\u5728app\u4E2D */\n inApp?: boolean\n /** UDC\u4EBA\u7FA4\u5206\u7EC4 */\n udcGroupIds?: number[]\n /** UDC\u767D\u540D\u5355\u4EBA\u7FA4\u5206\u7EC4 */\n udcWhiteGroupIds?: number[]\n /** \u76EE\u6807\u4EE3\u7801 */\n targetCode?: string\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nexport function getCouponFromVariant({\n variant,\n channel,\n inApp,\n udcGroupIds,\n udcWhiteGroupIds,\n targetCode,\n}: GetCouponFromVariantProps): VariantCoupon | undefined {\n // \u9A8C\u8BC1\u8F93\u5165\u53C2\u6570\n if (!CouponUtils.validateVariantCoupon(variant)) {\n return undefined\n }\n\n const coupons: any = variant!.metafields?.coupons || []\n const customCoupons: any = variant!.metafields?.custom_coupons || []\n\n // udc_groups \u4EBA\u7FA4\u5206\u7EC4\u4F18\u60E0\u5238\uFF0C\u627E\u51FA\u6240\u6709\u5339\u914D\u7684\u6298\u6263\u7801\n const udcGroupCouponTitleList: string[] | undefined = customCoupons\n ?.filter((item: GetValidCustomCouponProps['customDataItem']) => {\n if (udcGroupIds || udcWhiteGroupIds) {\n return CouponUtils.getValidCustomCoupon({\n customDataItem: item,\n udcGroupIds,\n udcWhiteGroupIds,\n })\n }\n return true\n })\n ?.map((item: GetValidCustomCouponProps['customDataItem']) => item?.discount?.title)\n\n // custom_data \u4E2D\u7684 title \u53EA\u662F\u8868\u660E\u4ED6\u547D\u4E2D\u4E86\u8FD9\u4E2A udc \u6298\u6263\uFF0C\u6700\u7EC8\u4EE5 coupons \u7684\u6570\u636E\u4E3A\u51C6\n // \u547D\u4E2D\u7684\u6240\u6709\u6298\u6263\u7801\u9010\u4E00\u9A8C\u8BC1\uFF0C\u627E\u5230\u6700\u5148\u5339\u914D\u7684\u6298\u6263\u7801\uFF0C\u56E0\u4E3A coupons \u4E2D\u6298\u6263\u5927\u7684\u9760\u524D\n const udcGroupCoupon = coupons?.find((item: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(item)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(item, variant)\n return udcGroupCouponTitleList?.includes(item.title) && isInValidPeriod && isMatchVariant\n })\n\n // \u627E\u5230 UDC \u6298\u6263\u5C31\u76F4\u63A5\u7528\n // TODO UDC \u6298\u6263\u76EE\u524D\u7EA6\u5B9A\u4EC5\u5728 app \u4F7F\u7528\n if (inApp && udcGroupCoupon) {\n return udcGroupCoupon\n }\n\n // \u8FC7\u6EE4\u51FA\u6240\u6709\u6709\u6548\u7684\u4F18\u60E0\u5238\n const activeCoupons = coupons.filter((coupon: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(coupon)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(coupon, variant)\n const isUDCChannel = CouponUtils.isUDCChannelCoupon(coupon.title)\n\n return isInValidPeriod && isMatchVariant && !isUDCChannel\n })\n\n // \u8FC7\u6EE4\u51FA\u9690\u85CF\u6E20\u9053\u7684\u4F18\u60E0\u5238\n const matchChannelCoupons = CouponUtils.getMatchChannelCoupons(activeCoupons, channel)\n\n // \u5982\u679C\u6709\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\u5219\u4F18\u5148\u4F7F\u7528\n if (matchChannelCoupons.length > 0) {\n return matchChannelCoupons[0]\n }\n\n // \u5982\u679C\u6709\u76EE\u6807\u4EE3\u7801\u5219\u8FC7\u6EE4\u51FA\u76EE\u6807\u4EE3\u7801\u7684\u4F18\u60E0\u5238\n const targetCoupons = targetCode\n ? activeCoupons.filter(\n (coupon: VariantCoupon) => coupon.title?.toLocaleUpperCase() === targetCode?.toLocaleUpperCase()\n )\n : undefined\n\n const finalCoupons = targetCoupons\n ? targetCoupons\n : activeCoupons.filter((coupon: VariantCoupon) => {\n const isHideChannelCoupon = CouponUtils.isHideChannelCoupon(coupon.title)\n const isAppChannelCoupon = CouponUtils.isAppChannelCoupon(coupon.title)\n\n // app \u4E0B\u53EA\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\n if (inApp) {\n return !isHideChannelCoupon\n }\n\n // \u5B98\u7F51\u4E0B\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u548C\u975E app \u6E20\u9053\u4F18\u60E0\u5238\n return !isHideChannelCoupon && !isAppChannelCoupon\n })\n\n return finalCoupons[0]\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA4B,yBA+BrB,SAASF,EAAqB,CACnC,QAAAG,EACA,QAAAC,EACA,MAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,WAAAC,CACF,EAAyD,CAEvD,GAAI,CAAC,cAAY,sBAAsBL,CAAO,EAC5C,OAGF,MAAMM,EAAeN,EAAS,YAAY,SAAW,CAAC,EAIhDO,GAHqBP,EAAS,YAAY,gBAAkB,CAAC,IAI/D,OAAQQ,GACJL,GAAeC,EACV,cAAY,qBAAqB,CACtC,eAAgBI,EAChB,YAAAL,EACA,iBAAAC,CACF,CAAC,EAEI,EACR,GACC,IAAKI,GAAsDA,GAAM,UAAU,KAAK,EAI9EC,EAAiBH,GAAS,KAAME,GAAwB,CAC5D,MAAME,EAAkB,cAAY,sBAAsBF,CAAI,EACxDG,EAAiB,cAAY,qBAAqBH,EAAMR,CAAO,EACrE,OAAOO,GAAyB,SAASC,EAAK,KAAK,GAAKE,GAAmBC,CAC7E,CAAC,EAID,GAAIT,GAASO,EACX,OAAOA,EAIT,MAAMG,EAAgBN,EAAQ,OAAQO,GAA0B,CAC9D,MAAMH,EAAkB,cAAY,sBAAsBG,CAAM,EAC1DF,EAAiB,cAAY,qBAAqBE,EAAQb,CAAO,EACjEc,EAAe,cAAY,mBAAmBD,EAAO,KAAK,EAEhE,OAAOH,GAAmBC,GAAkB,CAACG,CAC/C,CAAC,EAGKC,EAAsB,cAAY,uBAAuBH,EAAeX,CAAO,EAGrF,GAAIc,EAAoB,OAAS,EAC/B,OAAOA,EAAoB,CAAC,EAI9B,MAAMC,EAAgBX,EAClBO,EAAc,OACXC,GAA0BA,EAAO,OAAO,kBAAkB,IAAMR,GAAY,kBAAkB,CACjG,EACA,OAiBJ,OAfqBW,GAEjBJ,EAAc,OAAQC,GAA0B,CAC9C,MAAMI,EAAsB,cAAY,oBAAoBJ,EAAO,KAAK,EAClEK,EAAqB,cAAY,mBAAmBL,EAAO,KAAK,EAGtE,OAAIX,EACK,CAACe,EAIH,CAACA,GAAuB,CAACC,CAClC,CAAC,GAEe,CAAC,CACvB",
|
|
6
|
+
"names": ["handleCoupon_exports", "__export", "getCouponFromVariant", "__toCommonJS", "import_couponUtils", "variant", "channel", "inApp", "udcGroupIds", "udcWhiteGroupIds", "targetCode", "coupons", "udcGroupCouponTitleList", "item", "udcGroupCoupon", "isInValidPeriod", "isMatchVariant", "activeCoupons", "coupon", "isUDCChannel", "matchChannelCoupons", "targetCoupons", "isHideChannelCoupon", "isAppChannelCoupon"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var re=Object.create;var F=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var ue=(e,t)=>{for(var i in t)F(e,i,{get:t[i],enumerable:!0})},ie=(e,t,i,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of ce(t))!de.call(e,c)&&c!==i&&F(e,c,{get:()=>t[c],enumerable:!(m=pe(t,c))||m.enumerable});return e};var Q=(e,t,i)=>(i=e!=null?re(me(e)):{},ie(t||!e||!e.__esModule?F(i,"default",{value:e,enumerable:!0}):i,e)),xe=e=>ie(F({},"__esModule",{value:!0}),e);var ve={};ue(ve,{ShelfDisplayHorizontalItem:()=>he,ShelfDisplayWrapItem:()=>fe,getProductImage:()=>ae});module.exports=xe(ve);var s=require("react/jsx-runtime"),X=require("../AiuiProvider/index.js"),Y=require("./shelfDisplay.js"),M=Q(require("../../components/picture.js")),R=Q(require("../../components/badge.js")),f=require("../../helpers/utils.js"),Z=require("../../components/text.js"),j=Q(require("../../components/button.js")),ee=require("../../shared/track.js"),te=require("../../shared/trackUrlRef.js"),se=require("../../components/heading.js"),le=require("./handleCoupon.js"),oe=require("../../hooks/useExposure.js"),a=require("react");const A="image",G="product_shelf",ne=999999999e-2,ae=e=>{const t=e?.sku,i=e?.variants,m=i?.find(y=>y?.sku===t),c=m?.image?.url||i?.[0]?.image?.url||"",b=m?.image?.altText||i?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:c,altText:b}},fe=({data:e,configuration:t})=>{const{isDisplayBackImage:i=!1,itemShape:m,metafields:c,isTopTag:b=!1,isShowTag:y,isShowOriginalPrice:h}=t||{},{locale:v="us",copyWriting:O,inApp:_,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}=(0,X.useAiuiContext)(),{discounts:U,discountsCopy:I}=c||{},z=(0,a.useRef)(null),[H,r]=(0,a.useState)([]),[L,V]=(0,a.useState)(""),q=(l,x,u)=>t?.event?.primaryButton?.(l,x+1,u),D=(l,x,u)=>t?.event?.secondaryButton?.(l,x+1,u),n=(0,a.useMemo)(()=>{const l=e?.variants||[];if(l.length)return e?.sku&&l.find(x=>x?.sku===e?.sku)||l[0]},[e?.sku,e?.variants]),W=!n?.availableForSale&&n?.price?.amount===ne,P=(0,a.useMemo)(()=>(0,le.getCouponFromVariant)({variant:n,inApp:_,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}),[n,_,S,N,B,C]),$=!!(h&&P),E=e?.price?.currencyCode||"USD",w=(0,a.useMemo)(()=>(0,Y.formatVariantPrice)({locale:v,amount:$?P?.variant_price4wscode:n?.price,baseAmount:$?n?.price:0,currencyCode:E}),[E,v,$,P?.variant_price4wscode,n]),{price:J,basePrice:K,discount:d}=w,{imageUrl:k,altText:T}=ae(e),g=e?.custom_name||e?.title,o=e?.custom_description||e?.description;(0,a.useEffect)(()=>{let l=[];if(d){const u=`${d}${U?.off||I?.off||""}`;V(u),l.push(u)}const x=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,d?1:2);r(l.concat(x))},[e?.tags,d,U?.off,I?.off]),(0,oe.useExposure)(z,{componentType:A,componentName:G,componentTitle:g,componentDescription:o,position:t?.index+1});const p=()=>(0,s.jsxs)(s.Fragment,{children:[y&&H?.length>0?(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:H?.map?.((l,x)=>(0,s.jsx)(R.default,{className:"shelf-items-tag",children:l},x))}):null,g?(0,s.jsx)(se.Heading,{as:"h3",title:g||"",size:2,className:"shelf-display-product-title line-clamp-2",html:g||""}):null,o?(0,s.jsx)(Z.Text,{size:2,className:"lg-desktop:text-lg desktop:text-base shelf-display-product-description line-clamp-1 text-sm",html:o||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-4 flex items-center",children:W?(0,s.jsx)("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:O?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:n?.availableForSale&&J||""}),(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:n?.availableForSale&&K||""})]})}),(0,s.jsxs)("div",{className:(0,f.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?(0,s.jsx)(j.default,{variant:"secondary",onClick:()=>D(e,t?.index,t),className:`
|
|
2
2
|
${t.direction==="vertical"?"w-full":""}
|
|
3
|
-
`,children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(
|
|
3
|
+
`,children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(j.default,{variant:"primary",onClick:()=>q(e,t?.index,t),className:`
|
|
4
4
|
${t.direction==="vertical"?"w-full":""}
|
|
5
|
-
`,children:t?.primaryButton||""}):null]})]});return(0,s.jsx)("div",{ref:
|
|
5
|
+
`,children:t?.primaryButton||""}):null]})]});return(0,s.jsx)("div",{ref:z,className:(0,f.cn)("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",m==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px] shelf-display-item"),children:i?(0,s.jsx)("div",{className:"absolute inset-0 box-border overflow-hidden",children:(0,s.jsxs)("div",{className:"relative inset-0 size-full",children:[(0,s.jsx)(M.default,{source:k,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"}),(0,s.jsx)("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:p()})]})}):(0,s.jsxs)("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[L&&b&&(0,s.jsx)(R.default,{className:"shelf-prices-tag absolute left-4 top-4 z-10",children:L||""}),(0,s.jsx)("div",{className:(0,f.cn)("lg-desktop:h-[195px] shelf-display-item-image relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:(0,s.jsx)("a",{"aria-label":g,target:t?.target,href:(0,te.trackUrlRef)(`${v==="us"||!v?"":`/${v}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{(0,ee.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:(0,s.jsx)(M.default,{source:k,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),p()]})},e?.id||e?.handle)},he=({data:e,configuration:t})=>{const{itemShape:i,itemLength:m,metafields:c}=t||{},{discounts:b,discountsCopy:y}=c||{},{locale:h="us",copyWriting:v,inApp:O,udcGroupIds:_,udcWhiteGroupIds:S,targetCode:N,channel:B}=(0,X.useAiuiContext)(),[C,U]=(0,a.useState)([]),I=(0,a.useRef)(null),z=(o,p,l)=>t?.event?.primaryButton?.(o,p+1,l),H=(o,p,l)=>t?.event?.secondaryButton?.(o,p+1,l),r=(0,a.useMemo)(()=>{const o=e?.variants||[];if(o.length)return e?.sku&&o.find(p=>p?.sku===e?.sku)||o[0]},[e?.sku,e?.variants]),L=!r?.availableForSale&&r?.price?.amount===ne,V=t?.isShowTag,q=t?.isShowOriginalPrice,D=(0,a.useMemo)(()=>(0,le.getCouponFromVariant)({variant:r,inApp:O,udcGroupIds:_,udcWhiteGroupIds:S,targetCode:N,channel:B}),[r,O,_,S,N,B]),n=!!(q&&D),W=e?.price?.currencyCode||"USD",P=(0,a.useMemo)(()=>(0,Y.formatVariantPrice)({locale:h,amount:n?D?.variant_price4wscode:r?.price,baseAmount:n?r?.price:0,currencyCode:W}),[W,h,n,D?.variant_price4wscode,r]),{price:$,basePrice:E,discount:w}=P,{imageUrl:J,altText:K}=ae(e),d=e?.custom_name||e?.title,k=e?.custom_description||e?.description;(0,oe.useExposure)(I,{componentType:A,componentName:G,componentTitle:d,componentDescription:k,position:t?.index+1});const T=()=>m>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},g=()=>m>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col";return(0,a.useEffect)(()=>{let o=[];if(w){const l=`${w}${b?.off||y?.off||""}`;o.push(l)}const p=e?.tags?.filter?.(l=>l?.startsWith?.("CLtag"))?.map?.(l=>l?.replace?.("CLtag:",""))?.slice?.(0,w?1:2);U(o.concat(p))},[e?.tags,w,b?.off,y?.off]),(0,s.jsx)("div",{ref:I,className:(0,f.cn)(T().wrap,i==="round"?"rounded-2xl":"rounded-none","shelf-display-item","bg-container-secondary-1 tablet:hover:bg-info-white gap-6 duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden"),children:(0,s.jsxs)("div",{className:(0,f.cn)(g(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,f.cn)(T().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden"),children:(0,s.jsx)("a",{"aria-label":d,target:t?.target,href:(0,te.trackUrlRef)(`${h==="us"||!h?"":`/${h}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{(0,ee.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||r?.sku,item_name:e?.name,item_variant:r?.name,price:r?.price,index:t?.index+1}]}})},children:(0,s.jsx)(M.default,{source:J,alt:K,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,s.jsxs)("div",{className:(0,f.cn)("flex flex-col items-start justify-center",T().boxItem),children:[V&&C?.length>0?(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:C?.map?.((o,p)=>(0,s.jsx)(R.default,{className:"shelf-items-tag",children:o},p))}):null,d?(0,s.jsx)(se.Heading,{as:"h3",title:d||"",size:2,className:"shelf-display-product-title mb-1 line-clamp-2",html:d||""}):null,k?(0,s.jsx)(Z.Text,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description line-clamp-1 h-5 text-sm",html:k||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-5 flex items-center",children:L?(0,s.jsx)("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:v?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:r?.availableForSale&&$||""}),(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:r?.availableForSale&&E||""})]})}),(0,s.jsxs)("div",{className:(0,f.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?(0,s.jsx)(j.default,{variant:"secondary",onClick:()=>H(e,t?.index,t),className:`
|
|
6
6
|
${t.direction==="vertical"?"w-full":""}
|
|
7
|
-
`,children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(
|
|
7
|
+
`,children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(j.default,{variant:"primary",onClick:()=>z(e,t?.index,t),className:`
|
|
8
8
|
${t.direction==="vertical"?"w-full":""}
|
|
9
9
|
`,children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};
|
|
10
10
|
//# sourceMappingURL=shelfDisplayItem.js.map
|