@anker-in/headless-ui 1.0.20-alpha.1761126577041 → 1.0.20-alpha.1761134202138
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/Listing/ProductProvider.d.ts +57 -1
- package/dist/cjs/biz-components/Listing/ProductProvider.js +1 -1
- package/dist/cjs/biz-components/Listing/ProductProvider.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.d.ts +10 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.d.ts +25 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +12 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.d.ts +30 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/type.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.d.ts +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.js +2 -0
- package/dist/cjs/biz-components/Listing/components/PaidShipping/utils.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +40 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +22 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.d.ts +50 -0
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +2 -0
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +7 -0
- package/dist/cjs/biz-components/Listing/hooks/useCopy.d.ts +3 -6
- package/dist/cjs/biz-components/Listing/hooks/useCopy.js +1 -1
- package/dist/cjs/biz-components/Listing/hooks/useCopy.js.map +3 -3
- package/dist/cjs/biz-components/Listing/index.js +1 -1
- package/dist/cjs/biz-components/Listing/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/utils/helper.d.ts +15 -0
- package/dist/cjs/biz-components/Listing/utils/helper.js +1 -1
- package/dist/cjs/biz-components/Listing/utils/helper.js.map +3 -3
- package/dist/cjs/biz-components/Listing/utils/textFormat.d.ts +73 -0
- package/dist/cjs/biz-components/Listing/utils/textFormat.js +2 -0
- package/dist/cjs/biz-components/Listing/utils/textFormat.js.map +7 -0
- package/dist/cjs/biz-components/index.d.ts +2 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/ProductProvider.d.ts +57 -1
- package/dist/esm/biz-components/Listing/ProductProvider.js +1 -1
- package/dist/esm/biz-components/Listing/ProductProvider.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.d.ts +10 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.d.ts +25 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +12 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.d.ts +30 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/type.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.d.ts +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.js +2 -0
- package/dist/esm/biz-components/Listing/components/PaidShipping/utils.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +40 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +22 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/hooks/useBenefits.d.ts +50 -0
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +2 -0
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +7 -0
- package/dist/esm/biz-components/Listing/hooks/useCopy.d.ts +3 -6
- package/dist/esm/biz-components/Listing/hooks/useCopy.js +1 -1
- package/dist/esm/biz-components/Listing/hooks/useCopy.js.map +3 -3
- package/dist/esm/biz-components/Listing/index.js +1 -1
- package/dist/esm/biz-components/Listing/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/utils/helper.d.ts +15 -0
- package/dist/esm/biz-components/Listing/utils/helper.js +1 -1
- package/dist/esm/biz-components/Listing/utils/helper.js.map +3 -3
- package/dist/esm/biz-components/Listing/utils/textFormat.d.ts +73 -0
- package/dist/esm/biz-components/Listing/utils/textFormat.js +2 -0
- package/dist/esm/biz-components/Listing/utils/textFormat.js.map +7 -0
- package/dist/esm/biz-components/index.d.ts +2 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/biz-components/Listing/hooks/useCopy.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["useCopy_exports", "__export", "useCopy_default", "__toCommonJS", "
|
|
4
|
+
"sourcesContent": ["import clipboard from 'copy-to-clipboard'\nimport { useCallback, useEffect, useRef, useState } from 'react'\n\nconst useCopy = () => {\n const copyTimer = useRef<any>()\n const [copied, setCopied] = useState(false)\n\n const copy = useCallback((val: string) => {\n clipboard(val)\n\n if (copyTimer.current) {\n clearTimeout(copyTimer.current)\n }\n\n setCopied(true)\n copyTimer.current = setTimeout(() => {\n setCopied(false)\n }, 2000)\n }, [])\n\n useEffect(() => {\n return () => {\n if (copyTimer.current) {\n clearTimeout(copyTimer.current)\n }\n }\n }, [])\n\n return {\n copy,\n copied,\n }\n}\n\nexport default useCopy\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsB,gCACtBC,EAAyD,iBAEzD,MAAMC,EAAU,IAAM,CACpB,MAAMC,KAAY,UAAY,EACxB,CAACC,EAAQC,CAAS,KAAI,YAAS,EAAK,EAEpCC,KAAO,eAAaC,GAAgB,IACxC,EAAAC,SAAUD,CAAG,EAETJ,EAAU,SACZ,aAAaA,EAAU,OAAO,EAGhCE,EAAU,EAAI,EACdF,EAAU,QAAU,WAAW,IAAM,CACnCE,EAAU,EAAK,CACjB,EAAG,GAAI,CACT,EAAG,CAAC,CAAC,EAEL,sBAAU,IACD,IAAM,CACPF,EAAU,SACZ,aAAaA,EAAU,OAAO,CAElC,EACC,CAAC,CAAC,EAEE,CACL,KAAAG,EACA,OAAAF,CACF,CACF,EAEA,IAAON,EAAQI",
|
|
6
|
+
"names": ["useCopy_exports", "__export", "useCopy_default", "__toCommonJS", "import_copy_to_clipboard", "import_react", "useCopy", "copyTimer", "copied", "setCopied", "copy", "val", "clipboard"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var z=Object.create;var d=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var V=(e,o)=>{for(var t in o)d(e,t,{get:o[t],enumerable:!0})},p=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of J(o))!Q.call(e,r)&&r!==t&&d(e,r,{get:()=>o[r],enumerable:!(n=F(o,r))||n.enumerable});return e};var E=(e,o,t)=>(t=e!=null?z(K(e)):{},p(o||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e)),H=e=>p(d({},"__esModule",{value:!0}),e);var W={};V(W,{default:()=>U});module.exports=H(W);var i=require("react/jsx-runtime"),m=require("../AiuiProvider/index.js"),c=require("./components/index.js"),u=E(require("./ProductProvider.js")),y=require("./components/index.js"),a=require("react-responsive");const l=({product:e,renderRating:o,variant:t,selectedOptions:n,setSelectedOptions:r,isLogin:X,finalPrice:f,coupon:P,comparePrice:v,totalSavings:C,savingDetail:S,freeGift:g,bundle:h,checkedBundle:k,checkedGift:N,setCheckedBundle:x,setCheckedGift:B,compareData:I,selectedVariants:A,onAddToCart:D,onBuyNow:b,openModal:w,setSavingDetail:M,openSignInPopup:R,openAuthCodePopup:G,renderAffirm:L,renderKlarna:O,renderPaypal:T})=>{const{locale:Y}=(0,m.useAiuiContext)(),s=(0,a.useMediaQuery)({query:"(max-width: 768px)"}),q=(0,a.useMediaQuery)({query:"(min-width: 1440px)"});return(0,i.jsx)(u.default,{product:e,isMobile:s,isDesktop:q,freeGift:g,renderRating:o,finalPrice:f,comparePrice:v,totalSavings:C,savingDetail:S,variant:t,selectedOptions:n,setSelectedOptions:r,bundle:h,coupon:P,checkedBundle:k,checkedGift:N,setCheckedBundle:x,setCheckedGift:B,compareData:I,selectedVariants:A,onAddToCart:D,onBuyNow:b,openModal:w,setSavingDetail:M,openSignInPopup:R,openAuthCodePopup:G,renderAffirm:L,renderKlarna:O,renderPaypal:T,children:(0,i.jsxs)("div",{id:"ipc-listing",children:[(0,i.jsx)(c.PurchaseBar,{onSpyNavItemClick:j=>{console.log(j)}}),s&&(0,i.jsx)("div",{className:"fixed bottom-0 left-0 w-full z-[60]",children:(0,i.jsx)(c.ProductActions,{})}),(0,i.jsx)(y.ProductCard,{})]})})};l.displayName="Listing";var U=l;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Listing/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useAiuiContext } from '../AiuiProvider/index.js'\nimport { PurchaseBar, ProductActions } from './components/index.js'\nimport type { ScrollSpyNavItem } from './components/PurchaseBar/types.js'\nimport ProductProvider, { type ProductContextType } from './ProductProvider.js'\nimport { ProductCard } from './components/index.js'\n\nimport { useMediaQuery } from 'react-responsive'\n\nconst Listing: React.FC<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>> = ({\n product,\n renderRating,\n variant,\n selectedOptions,\n setSelectedOptions,\n isLogin,\n finalPrice,\n coupon,\n comparePrice,\n totalSavings,\n savingDetail,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n}) => {\n const { locale } = useAiuiContext()\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isDesktop = useMediaQuery({ query: '(min-width: 1440px)' })\n\n const onSpyNavItemClick = (tab: ScrollSpyNavItem) => {\n console.log(tab)\n }\n\n return (\n <ProductProvider\n product={product}\n isMobile={isMobile}\n isDesktop={isDesktop}\n freeGift={freeGift}\n renderRating={renderRating}\n finalPrice={finalPrice}\n comparePrice={comparePrice}\n totalSavings={totalSavings}\n savingDetail={savingDetail}\n variant={variant}\n selectedOptions={selectedOptions}\n setSelectedOptions={setSelectedOptions}\n bundle={bundle}\n coupon={coupon}\n checkedBundle={checkedBundle}\n checkedGift={checkedGift}\n setCheckedBundle={setCheckedBundle}\n setCheckedGift={setCheckedGift}\n compareData={compareData}\n selectedVariants={selectedVariants}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n >\n <div id=\"ipc-listing\">\n <PurchaseBar onSpyNavItemClick={onSpyNavItemClick} />\n {isMobile && (\n <div className=\"fixed bottom-0 left-0 w-full z-[60]\">\n <ProductActions />\n </div>\n )}\n <ProductCard />\n </div>\n </ProductProvider>\n )\n}\n\nListing.displayName = 'Listing'\n\nexport default Listing\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["Listing_exports", "__export", "Listing_default", "__toCommonJS", "import_jsx_runtime", "import_AiuiProvider", "import_components", "import_ProductProvider", "import_react_responsive", "Listing", "product", "renderRating", "variant", "selectedOptions", "setSelectedOptions", "isLogin", "finalPrice", "coupon", "comparePrice", "totalSavings", "savingDetail", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "compareData", "selectedVariants", "onAddToCart", "onBuyNow", "locale", "isMobile", "isDesktop", "ProductProvider", "tab"]
|
|
4
|
+
"sourcesContent": ["import { useAiuiContext } from '../AiuiProvider/index.js'\nimport { PurchaseBar, ProductActions } from './components/index.js'\nimport type { ScrollSpyNavItem } from './components/PurchaseBar/types.js'\nimport ProductProvider, { type ProductContextType } from './ProductProvider.js'\nimport { ProductCard } from './components/index.js'\n\nimport { useMediaQuery } from 'react-responsive'\n\nconst Listing: React.FC<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>> = ({\n product,\n renderRating,\n variant,\n selectedOptions,\n setSelectedOptions,\n isLogin,\n finalPrice,\n coupon,\n comparePrice,\n totalSavings,\n savingDetail,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n openModal,\n setSavingDetail,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n}) => {\n const { locale } = useAiuiContext()\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isDesktop = useMediaQuery({ query: '(min-width: 1440px)' })\n\n const onSpyNavItemClick = (tab: ScrollSpyNavItem) => {\n console.log(tab)\n }\n\n return (\n <ProductProvider\n product={product}\n isMobile={isMobile}\n isDesktop={isDesktop}\n freeGift={freeGift}\n renderRating={renderRating}\n finalPrice={finalPrice}\n comparePrice={comparePrice}\n totalSavings={totalSavings}\n savingDetail={savingDetail}\n variant={variant}\n selectedOptions={selectedOptions}\n setSelectedOptions={setSelectedOptions}\n bundle={bundle}\n coupon={coupon}\n checkedBundle={checkedBundle}\n checkedGift={checkedGift}\n setCheckedBundle={setCheckedBundle}\n setCheckedGift={setCheckedGift}\n compareData={compareData}\n selectedVariants={selectedVariants}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n openModal={openModal}\n setSavingDetail={setSavingDetail}\n openSignInPopup={openSignInPopup}\n openAuthCodePopup={openAuthCodePopup}\n renderAffirm={renderAffirm}\n renderKlarna={renderKlarna}\n renderPaypal={renderPaypal}\n >\n <div id=\"ipc-listing\">\n <PurchaseBar onSpyNavItemClick={onSpyNavItemClick} />\n {isMobile && (\n <div className=\"fixed bottom-0 left-0 w-full z-[60]\">\n <ProductActions />\n </div>\n )}\n <ProductCard />\n </div>\n </ProductProvider>\n )\n}\n\nListing.displayName = 'Listing'\n\nexport default Listing\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+EM,IAAAI,EAAA,6BA/ENC,EAA+B,oCAC/BC,EAA4C,iCAE5CC,EAAyD,mCACzDD,EAA4B,iCAE5BE,EAA8B,4BAE9B,MAAMC,EAA8G,CAAC,CACnH,QAAAC,EACA,aAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,WAAAC,EACA,OAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,IAAM,CACJ,KAAM,CAAE,OAAAC,CAAO,KAAI,kBAAe,EAE5BC,KAAW,iBAAc,CAAE,MAAO,oBAAqB,CAAC,EACxDC,KAAY,iBAAc,CAAE,MAAO,qBAAsB,CAAC,EAMhE,SACE,OAAC,EAAAC,QAAA,CACC,QAAS/B,EACT,SAAU6B,EACV,UAAWC,EACX,SAAUnB,EACV,aAAcV,EACd,WAAYK,EACZ,aAAcE,EACd,aAAcC,EACd,aAAcC,EACd,QAASR,EACT,gBAAiBC,EACjB,mBAAoBC,EACpB,OAAQQ,EACR,OAAQL,EACR,cAAeM,EACf,YAAaC,EACb,iBAAkBC,EAClB,eAAgBC,EAChB,YAAaC,EACb,iBAAkBC,EAClB,YAAaC,EACb,SAAUC,EACV,UAAWC,EACX,gBAAiBC,EACjB,gBAAiBC,EACjB,kBAAmBC,EACnB,aAAcC,EACd,aAAcC,EACd,aAAcC,EAEd,oBAAC,OAAI,GAAG,cACN,oBAAC,eAAY,kBArCQK,GAA0B,CACnD,QAAQ,IAAIA,CAAG,CACjB,EAmCyD,EAClDH,MACC,OAAC,OAAI,UAAU,sCACb,mBAAC,mBAAe,EAClB,KAEF,OAAC,gBAAY,GACf,EACF,CAEJ,EAEA9B,EAAQ,YAAc,UAEtB,IAAOP,EAAQO",
|
|
6
|
+
"names": ["Listing_exports", "__export", "Listing_default", "__toCommonJS", "import_jsx_runtime", "import_AiuiProvider", "import_components", "import_ProductProvider", "import_react_responsive", "Listing", "product", "renderRating", "variant", "selectedOptions", "setSelectedOptions", "isLogin", "finalPrice", "coupon", "comparePrice", "totalSavings", "savingDetail", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "compareData", "selectedVariants", "onAddToCart", "onBuyNow", "openModal", "setSavingDetail", "openSignInPopup", "openAuthCodePopup", "renderAffirm", "renderKlarna", "renderPaypal", "locale", "isMobile", "isDesktop", "ProductProvider", "tab"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Product, ProductMedia, ProductVariant } from '../types/product';
|
|
2
|
+
export type SchemaVariant = {
|
|
3
|
+
variant: {
|
|
4
|
+
handle: string;
|
|
5
|
+
sku: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
2
8
|
export declare function isObjEmpty(obj?: Record<string, any>): boolean;
|
|
3
9
|
export declare function atobID(id: string): string | undefined;
|
|
4
10
|
export declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
|
|
@@ -19,3 +25,12 @@ export declare function getVariantMediaList({ product, variant }: {
|
|
|
19
25
|
variant: ProductVariant;
|
|
20
26
|
product: Product;
|
|
21
27
|
}): ProductMedia[];
|
|
28
|
+
export declare const checkItemAvailableForProduct: ({ product, item, variant, }: {
|
|
29
|
+
product: Product;
|
|
30
|
+
variant: ProductVariant;
|
|
31
|
+
item?: {
|
|
32
|
+
includeTags?: string[];
|
|
33
|
+
includeProducts?: SchemaVariant[];
|
|
34
|
+
excludeProducts?: SchemaVariant[];
|
|
35
|
+
};
|
|
36
|
+
}) => string | boolean | SchemaVariant | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of l(t))!f.call(e,a)&&a!==r&&u(e,a,{get:()=>t[a],enumerable:!(n=d(t,a))||n.enumerable});return e};var m=e=>p(u({},"__esModule",{value:!0}),e);var I={};g(I,{atobID:()=>P,btoaID:()=>x,checkItemAvailableForProduct:()=>v,getNormalCoupon:()=>V,getThemeLocale:()=>y,getVariantImageIndex:()=>o,getVariantMediaList:()=>k,handle:()=>b,isObjEmpty:()=>h,replaceUmlaut:()=>c});module.exports=m(I);var s=require("../const");function h(e){return e?Object.keys(e).length===0:!0}function P(e){return e&&typeof e=="string"&&e.includes("/")?e.split("/").pop()?.split("?")?.shift():e}function x(e,t="ProductVariant"){return`gid://shopify/${t}/${e}`}const y=e=>e==="eu-de"?"de":e==="eu-en"?"eu":e==="au"?"au":e,V=({variant:e})=>e?.coupons?.find(t=>t.discount_type!==s.CouponChannel.WSCH),i={\u00DC:"U",\u00C4:"A",\u00D6:"O",\u00FC:"u",\u00E4:"a",\u00F6:"o",\u00DF:"ss",\u00E8:"e"};function c(e){return e.replace(/[\u00dc|\u00c4|\u00d6][a-z]/g,t=>{const r=i[t.slice(0,1)];return r.charAt(0)+r.charAt(1).toLowerCase()+t.slice(1)}).replace(new RegExp("["+Object.keys(i).join("|")+"]","g"),t=>i[t])}function b(e){return c(e).replace(/ /g,"-").replace(/[^a-zA-Z0-9-]/g,"").toLowerCase()}function o({mediaList:e,variant:t}){const r=t?.image?.url;return r?e.map(n=>n.image?.url).findIndex(n=>n==r):null}function k({product:e,variant:t}){const r=o({mediaList:e.media,variant:t});if(r!==null){const n=e.variants.filter(a=>t.id!==a.id).map(a=>o({mediaList:e.media,variant:a})).find(a=>a!==null&&a>r)||-1;return e.media.slice(r,n===-1?e.media.length:n)}else return e.media}const v=({product:e,item:t,variant:r})=>t?Number(t?.includeTags?.length)>0?e.tags?.find(n=>t?.includeTags?.includes(n)):Number(t?.includeProducts?.length)>0?t.includeProducts?.find(n=>n?.variant?.handle===e.handle&&n?.variant?.sku===r.sku):Number(t?.excludeProducts?.length)>0?!t.excludeProducts?.find(n=>n?.variant?.handle===e.handle&&n?.variant?.sku===r.sku):!0:!1;
|
|
2
2
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/biz-components/Listing/utils/helper.ts"],
|
|
4
|
-
"sourcesContent": ["// \u6539\u7EC4\u4EF6\u5BA2\u6237\u7AEF\u6267\u884C\n// import { SchemaVariant } from '@projectTypes/template'\nimport type { Product, ProductMedia, ProductVariant } from '../types/product'\nimport { CouponChannel } from '../const'\n// import Cookies from 'js-cookie'\n// import { Attribute, HasMetafieldsIdentifier } from 'lib/shopify/gql'\n// import { HasMetafieldQueryRoot } from 'lib/shopify/types/fetcher'\n// import { useEffect, useState } from 'react'\n\n// import { PartialRecord } from './type-helper'\n\n// \u5224\u65AD\u5BF9\u8C61\u662F\u5426\u4E3A\u7A7A\nexport function isObjEmpty(obj?: Record<string, any>) {\n if (!obj) return true\n else {\n return Object.keys(obj).length === 0\n }\n}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n\nexport function btoaID(id: string, type: 'ProductVariant' | 'Product' = 'ProductVariant') {\n return `gid://shopify/${type}/${id}`\n}\n\n// \u76AE\u80A4\u7AD9\u4E09\u7EA7\u57DF\u540D\nexport const getThemeLocale = (locale: string) => {\n if (locale === 'eu-de') return 'de'\n if (locale === 'eu-en') return 'eu'\n if (locale === 'au') return 'au'\n return locale\n}\n\n/**\n * \u751F\u6210 metafieldIdentifiers \u67E5\u8BE2\u53C2\u6570\n */\n// export function constructMetafieldIdentifiersQueryParams<T extends HasMetafieldQueryRoot>(\n// metafieldIdentifiers: PartialRecord<T, HasMetafieldsIdentifier[]> = {},\n// ): PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]> {\n// const identifiers = Object.entries(metafieldIdentifiers).reduce(\n// (queryInput, [key, value]) => {\n// const metafieldIdentifiers = value as HasMetafieldsIdentifier[]\n// queryInput[`${key}MetafieldIdentifiers`] = metafieldIdentifiers\n// .filter((item) => !item.namespace.startsWith(metafieldNamespacePrefix))\n// .map((item) => ({\n// namespace: `${metafieldNamespacePrefix}combo`,\n// key: item.namespace,\n// }))\n// .concat(metafieldIdentifiers)\n// return queryInput\n// },\n// {} as PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]>,\n// )\n// return identifiers\n// }\n\n// export function cleanShopKey(shop: Shop) {\n// const { privacyPolicy, refundPolicy, shippingPolicy, termsOfService, subscriptionPolicy, ...otherShop } = shop\n// return otherShop\n// }\n\n// export const delHtmlTag = (str?: string) => {\n// return str ? String(str).replace(/<[^>]+>/g, '') : ''\n// }\n\nexport const getNormalCoupon = ({ variant }: { variant?: ProductVariant }) => {\n return variant?.coupons?.find(coupon => coupon.discount_type !== CouponChannel.WSCH)\n}\n\n// export const setCartSecretCookie = ({ cart }) => {\n// const key = cart.id.split('?key=')[1]\n// const id = cart.id.split('?key=')[0].split('gid://shopify/Cart/')[1]\n// Cookies.set(id, key, {\n// Domain: window.location.hostname.split('.').reverse().slice(0, 2).reverse().join('.'),\n// })\n// }\n\n// export const languageCode = (locale: string) =>\n// ({\n// us: 'US',\n// uk: 'GB',\n// ca: 'CA',\n// fr: 'FR',\n// au: 'AU',\n// my: 'MY',\n// vn: 'VN',\n// it: 'IT',\n// de: 'DE',\n// cl: 'CL',\n// })[locale] || 'US'\n\n// shopify \u7684\u7279\u6B8A\u6587\u4EF6\u8F6C\u6362\u89C4\u5219\nconst umlautMap = {\n '\\u00dc': 'U',\n '\\u00c4': 'A',\n '\\u00d6': 'O',\n '\\u00fc': 'u',\n '\\u00e4': 'a',\n '\\u00f6': 'o',\n '\\u00df': 'ss',\n '\\u00E8': 'e',\n}\n\n// \u66FF\u6362\u5B57\u7B26\u4E32\u4E2D\u7684\u7279\u6B8A\u5B57\u7B26\nexport function replaceUmlaut(str: string) {\n return str\n .replace(/[\\u00dc|\\u00c4|\\u00d6][a-z]/g, a => {\n const big = umlautMap[a.slice(0, 1) as keyof typeof umlautMap]\n return big.charAt(0) + big.charAt(1).toLowerCase() + a.slice(1)\n })\n .replace(new RegExp('[' + Object.keys(umlautMap).join('|') + ']', 'g'), a => umlautMap[a as keyof typeof umlautMap])\n}\n\n// \u5C06\u5B57\u7B26\u4E32\u8F6C\u6362\u4E3A slug\nexport function handle(str: string) {\n return replaceUmlaut(str)\n .replace(/ /g, '-')\n .replace(/[^a-zA-Z0-9-]/g, '')\n .toLowerCase()\n}\n\n// get variant image index\nexport function getVariantImageIndex({\n mediaList,\n variant,\n}: {\n variant: ProductVariant\n mediaList: ProductMedia[]\n}): null | number {\n const src = variant?.image?.url\n return src ? mediaList.map(media => media.image?.url).findIndex(imageSrc => imageSrc == src) : null\n}\n\n// get images belong to variant\nexport function getVariantMediaList({ product, variant }: { variant: ProductVariant; product: Product }) {\n const currentVariantImageIndex = getVariantImageIndex({ mediaList: product.media, variant })\n\n if (currentVariantImageIndex !== null) {\n const nextVariantImageIndex =\n product.variants\n .filter(v => variant.id !== v.id)\n .map(v => getVariantImageIndex({ mediaList: product.media, variant: v }))\n .find(index => index !== null && index > currentVariantImageIndex) || -1\n\n // current variant images, if no next variant found, return images from current index to the end\n return product.media.slice(\n currentVariantImageIndex,\n nextVariantImageIndex === -1 ? product.media.length : nextVariantImageIndex\n )\n } else {\n // if no variant image found, return all images\n return product.media\n }\n}\n\n// // \u901A\u8FC7\u9009\u62E9 option \u83B7\u53D6 variant\n// export function getVariantFromSelectedOptions({\n// product,\n// selectedOptions,\n// }: {\n// product: Product\n// selectedOptions: Record<string, string>\n// }) {\n// return product.variants.find((variant) => {\n// return Object.entries(selectedOptions).every(([key, value]) =>\n// variant.options.find((option) => {\n// if (option.__typename === 'MultipleChoiceOption' && option.name === key) {\n// return option.values.find((v) => v.label === value)\n// }\n// }),\n// )\n// })\n// }\n\n// export const getURLParameter = (name, url = window.location.href) => {\n// name = name.replace(/[\\[\\]]/g, '\\\\$&') // \u5C06\u65B9\u62EC\u53F7\u8F6C\u4E49\uFF0C\u4EE5\u4FBF\u5728\u6B63\u5219\u8868\u8FBE\u5F0F\u4E2D\u4F7F\u7528\n// var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)') // \u521B\u5EFA\u5339\u914D\u53C2\u6570\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\n// var results = regex.exec(url) // \u5728URL\u4E2D\u67E5\u627E\u5339\u914D\u7684\u53C2\u6570\n// if (!results) return null // \u5982\u679C\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u53C2\u6570\uFF0C\u5219\u8FD4\u56DEnull\n// if (!results[2]) return '' // \u5982\u679C\u53C2\u6570\u7684\u503C\u4E3A\u7A7A\uFF0C\u5219\u8FD4\u56DE\u7A7A\u5B57\u7B26\u4E32\n// return decodeURIComponent(results[2]) // \u8FD4\u56DE\u89E3\u7801\u540E\u7684\u53C2\u6570\u503C\n// }\n\n// export const checkItemAvailableForProduct = ({\n// product,\n// item,\n// variant,\n// }: {\n// product: Product\n// variant: ProductVariant\n// item?: {\n// includeTags?: string[]\n// includeProducts?: SchemaVariant[]\n// excludeProducts?: SchemaVariant[]\n// }\n// }) => {\n// if (item) {\n// if (Number(item?.includeTags?.length) > 0) {\n// return product.tags?.find((tag) => item?.includeTags?.includes(tag))\n// } else if (Number(item?.includeProducts?.length) > 0) {\n// return item.includeProducts?.find((p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku)\n// } else if (Number(item?.excludeProducts?.length) > 0) {\n// return !item.excludeProducts?.find(\n// (p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku,\n// )\n// } else {\n// return true\n// }\n// } else {\n// return false\n// }\n// }\n// export const getReferralAttributes = () => {\n// const inviteCode = Cookies.get('invite_code')\n// const playModeId = Cookies.get('playModeId')\n// const popup = Cookies.get('_popup')\n// if (inviteCode && playModeId) {\n// return popup\n// ? [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// { key: '_popup', value: popup },\n// ]\n// : [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// ]\n// }\n// return []\n// }\n\n// export function useH2Toc(htmlContent: string) {\n// const [toc, setToc] = useState<{ updatedHtmlContent: string; dataList: { url: string; text: string }[] }>({\n// updatedHtmlContent: htmlContent,\n// dataList: [],\n// })\n\n// useEffect(() => {\n// if (typeof window === 'undefined' || typeof document === 'undefined') return\n// const div = document.createElement('div')\n// div.innerHTML = htmlContent\n// const h2s = div.querySelectorAll('h2')\n// const dataList: { url: string; text: string }[] = []\n// h2s.forEach((h2, idx) => {\n// const text = (h2.textContent || '').trim()\n// if (!text) return\n// const id = encodeURIComponent(text).replace(/'/g, ''')\n// h2.setAttribute('id', id)\n// dataList.push({ url: id, text })\n// })\n// setToc({ updatedHtmlContent: div.innerHTML, dataList })\n// }, [htmlContent])\n\n// return toc\n// }\n\n// export const isAttributesEqual = (oldAttributes: Attribute[], newAttributes: Attribute[]) => {\n// // \u6BD4\u5BF9\u4E24\u4E2A\u6570\u636E\u662F\u5426\u5B8C\u5168\u76F8\u540C\n// // \u68C0\u67E5\u6570\u7EC4\u957F\u5EA6\u662F\u5426\u76F8\u540C\n// if (oldAttributes?.length !== newAttributes?.length) {\n// return false\n// }\n\n// // \u5C06\u6570\u7EC4\u8F6C\u6362\u4E3A Map \u4EE5\u4FBF\u5FEB\u901F\u67E5\u627E\n// const oldMap = new Map(oldAttributes.map((attr) => [attr.key, attr.value]))\n// const newMap = new Map(newAttributes.map((attr) => [attr.key, attr.value]))\n\n// // \u68C0\u67E5\u6240\u6709 key \u662F\u5426\u90FD\u5B58\u5728\u4E14\u503C\u76F8\u540C\n// for (const [key, value] of newMap) {\n// if (!oldMap.has(key) || oldMap.get(key) !== value) {\n// return false\n// }\n// }\n\n// return true\n// }\n\n// // \u68C0\u67E5\u8F93\u5165\u6846\u4E2D\u7684\u7279\u6B8A\u7B26\u53F7\n// export function validateSpecialCharacters(input: string): { isValid: boolean; invalidChars: string[] } {\n// // \u5B9A\u4E49\u4E0D\u5141\u8BB8\u7684\u7279\u6B8A\u7B26\u53F7\n// const invalidSpecialChars = /[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?`~]/g\n\n// const matches = input.match(invalidSpecialChars)\n// const invalidChars = matches ? [...new Set(matches)] : []\n\n// return {\n// isValid: invalidChars.length === 0,\n// invalidChars,\n// }\n// }\n\n// // \u83B7\u53D6\u7279\u6B8A\u7B26\u53F7\u7684\u9519\u8BEF\u63D0\u793A\u4FE1\u606F\n// export function getSpecialCharErrorMessage(invalidChars: string[]): string {\n// if (invalidChars.length === 0) return ''\n\n// const uniqueChars = [...new Set(invalidChars)]\n// if (uniqueChars.length === 1) {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u7279\u6B8A\u7B26\u53F7: ${uniqueChars[0]}`\n// } else {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u4EE5\u4E0B\u7279\u6B8A\u7B26\u53F7: ${uniqueChars.join(', ')}`\n// }\n// }"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,WAAAC,EAAA,oBAAAC,EAAA,mBAAAC,EAAA,yBAAAC,EAAA,wBAAAC,EAAA,WAAAC,EAAA,eAAAC,EAAA,kBAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["helper_exports", "__export", "atobID", "btoaID", "getNormalCoupon", "getThemeLocale", "getVariantImageIndex", "getVariantMediaList", "handle", "isObjEmpty", "replaceUmlaut", "__toCommonJS", "import_const", "obj", "id", "type", "locale", "variant", "coupon", "umlautMap", "str", "a", "big", "mediaList", "src", "media", "imageSrc", "product", "currentVariantImageIndex", "nextVariantImageIndex", "v", "index"]
|
|
4
|
+
"sourcesContent": ["// \u6539\u7EC4\u4EF6\u5BA2\u6237\u7AEF\u6267\u884C\n// import { SchemaVariant } from '@projectTypes/template'\nimport type { Product, ProductMedia, ProductVariant } from '../types/product'\nimport { CouponChannel } from '../const'\n// import Cookies from 'js-cookie'\n// import { Attribute, HasMetafieldsIdentifier } from 'lib/shopify/gql'\n// import { HasMetafieldQueryRoot } from 'lib/shopify/types/fetcher'\n// import { useEffect, useState } from 'react'\n\n// import { PartialRecord } from './type-helper'\n\nexport type SchemaVariant = {\n variant: {\n handle: string\n sku: string\n }\n}\n\n// \u5224\u65AD\u5BF9\u8C61\u662F\u5426\u4E3A\u7A7A\nexport function isObjEmpty(obj?: Record<string, any>) {\n if (!obj) return true\n else {\n return Object.keys(obj).length === 0\n }\n}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n\nexport function btoaID(id: string, type: 'ProductVariant' | 'Product' = 'ProductVariant') {\n return `gid://shopify/${type}/${id}`\n}\n\n// \u76AE\u80A4\u7AD9\u4E09\u7EA7\u57DF\u540D\nexport const getThemeLocale = (locale: string) => {\n if (locale === 'eu-de') return 'de'\n if (locale === 'eu-en') return 'eu'\n if (locale === 'au') return 'au'\n return locale\n}\n\n/**\n * \u751F\u6210 metafieldIdentifiers \u67E5\u8BE2\u53C2\u6570\n */\n// export function constructMetafieldIdentifiersQueryParams<T extends HasMetafieldQueryRoot>(\n// metafieldIdentifiers: PartialRecord<T, HasMetafieldsIdentifier[]> = {},\n// ): PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]> {\n// const identifiers = Object.entries(metafieldIdentifiers).reduce(\n// (queryInput, [key, value]) => {\n// const metafieldIdentifiers = value as HasMetafieldsIdentifier[]\n// queryInput[`${key}MetafieldIdentifiers`] = metafieldIdentifiers\n// .filter((item) => !item.namespace.startsWith(metafieldNamespacePrefix))\n// .map((item) => ({\n// namespace: `${metafieldNamespacePrefix}combo`,\n// key: item.namespace,\n// }))\n// .concat(metafieldIdentifiers)\n// return queryInput\n// },\n// {} as PartialRecord<`${T}MetafieldIdentifiers`, HasMetafieldsIdentifier[]>,\n// )\n// return identifiers\n// }\n\n// export function cleanShopKey(shop: Shop) {\n// const { privacyPolicy, refundPolicy, shippingPolicy, termsOfService, subscriptionPolicy, ...otherShop } = shop\n// return otherShop\n// }\n\n// export const delHtmlTag = (str?: string) => {\n// return str ? String(str).replace(/<[^>]+>/g, '') : ''\n// }\n\nexport const getNormalCoupon = ({ variant }: { variant?: ProductVariant }) => {\n return variant?.coupons?.find(coupon => coupon.discount_type !== CouponChannel.WSCH)\n}\n\n// export const setCartSecretCookie = ({ cart }) => {\n// const key = cart.id.split('?key=')[1]\n// const id = cart.id.split('?key=')[0].split('gid://shopify/Cart/')[1]\n// Cookies.set(id, key, {\n// Domain: window.location.hostname.split('.').reverse().slice(0, 2).reverse().join('.'),\n// })\n// }\n\n// export const languageCode = (locale: string) =>\n// ({\n// us: 'US',\n// uk: 'GB',\n// ca: 'CA',\n// fr: 'FR',\n// au: 'AU',\n// my: 'MY',\n// vn: 'VN',\n// it: 'IT',\n// de: 'DE',\n// cl: 'CL',\n// })[locale] || 'US'\n\n// shopify \u7684\u7279\u6B8A\u6587\u4EF6\u8F6C\u6362\u89C4\u5219\nconst umlautMap = {\n '\\u00dc': 'U',\n '\\u00c4': 'A',\n '\\u00d6': 'O',\n '\\u00fc': 'u',\n '\\u00e4': 'a',\n '\\u00f6': 'o',\n '\\u00df': 'ss',\n '\\u00E8': 'e',\n}\n\n// \u66FF\u6362\u5B57\u7B26\u4E32\u4E2D\u7684\u7279\u6B8A\u5B57\u7B26\nexport function replaceUmlaut(str: string) {\n return str\n .replace(/[\\u00dc|\\u00c4|\\u00d6][a-z]/g, a => {\n const big = umlautMap[a.slice(0, 1) as keyof typeof umlautMap]\n return big.charAt(0) + big.charAt(1).toLowerCase() + a.slice(1)\n })\n .replace(new RegExp('[' + Object.keys(umlautMap).join('|') + ']', 'g'), a => umlautMap[a as keyof typeof umlautMap])\n}\n\n// \u5C06\u5B57\u7B26\u4E32\u8F6C\u6362\u4E3A slug\nexport function handle(str: string) {\n return replaceUmlaut(str)\n .replace(/ /g, '-')\n .replace(/[^a-zA-Z0-9-]/g, '')\n .toLowerCase()\n}\n\n// get variant image index\nexport function getVariantImageIndex({\n mediaList,\n variant,\n}: {\n variant: ProductVariant\n mediaList: ProductMedia[]\n}): null | number {\n const src = variant?.image?.url\n return src ? mediaList.map(media => media.image?.url).findIndex(imageSrc => imageSrc == src) : null\n}\n\n// get images belong to variant\nexport function getVariantMediaList({ product, variant }: { variant: ProductVariant; product: Product }) {\n const currentVariantImageIndex = getVariantImageIndex({ mediaList: product.media, variant })\n\n if (currentVariantImageIndex !== null) {\n const nextVariantImageIndex =\n product.variants\n .filter(v => variant.id !== v.id)\n .map(v => getVariantImageIndex({ mediaList: product.media, variant: v }))\n .find(index => index !== null && index > currentVariantImageIndex) || -1\n\n // current variant images, if no next variant found, return images from current index to the end\n return product.media.slice(\n currentVariantImageIndex,\n nextVariantImageIndex === -1 ? product.media.length : nextVariantImageIndex\n )\n } else {\n // if no variant image found, return all images\n return product.media\n }\n}\n\n// // \u901A\u8FC7\u9009\u62E9 option \u83B7\u53D6 variant\n// export function getVariantFromSelectedOptions({\n// product,\n// selectedOptions,\n// }: {\n// product: Product\n// selectedOptions: Record<string, string>\n// }) {\n// return product.variants.find((variant) => {\n// return Object.entries(selectedOptions).every(([key, value]) =>\n// variant.options.find((option) => {\n// if (option.__typename === 'MultipleChoiceOption' && option.name === key) {\n// return option.values.find((v) => v.label === value)\n// }\n// }),\n// )\n// })\n// }\n\n// export const getURLParameter = (name, url = window.location.href) => {\n// name = name.replace(/[\\[\\]]/g, '\\\\$&') // \u5C06\u65B9\u62EC\u53F7\u8F6C\u4E49\uFF0C\u4EE5\u4FBF\u5728\u6B63\u5219\u8868\u8FBE\u5F0F\u4E2D\u4F7F\u7528\n// var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)') // \u521B\u5EFA\u5339\u914D\u53C2\u6570\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\n// var results = regex.exec(url) // \u5728URL\u4E2D\u67E5\u627E\u5339\u914D\u7684\u53C2\u6570\n// if (!results) return null // \u5982\u679C\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u53C2\u6570\uFF0C\u5219\u8FD4\u56DEnull\n// if (!results[2]) return '' // \u5982\u679C\u53C2\u6570\u7684\u503C\u4E3A\u7A7A\uFF0C\u5219\u8FD4\u56DE\u7A7A\u5B57\u7B26\u4E32\n// return decodeURIComponent(results[2]) // \u8FD4\u56DE\u89E3\u7801\u540E\u7684\u53C2\u6570\u503C\n// }\n\nexport const checkItemAvailableForProduct = ({\n product,\n item,\n variant,\n}: {\n product: Product\n variant: ProductVariant\n item?: {\n includeTags?: string[]\n includeProducts?: SchemaVariant[]\n excludeProducts?: SchemaVariant[]\n }\n}) => {\n if (item) {\n if (Number(item?.includeTags?.length) > 0) {\n return product.tags?.find((tag) => item?.includeTags?.includes(tag))\n } else if (Number(item?.includeProducts?.length) > 0) {\n return item.includeProducts?.find((p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku)\n } else if (Number(item?.excludeProducts?.length) > 0) {\n return !item.excludeProducts?.find(\n (p) => p?.variant?.handle === product.handle && p?.variant?.sku === variant.sku,\n )\n } else {\n return true\n }\n } else {\n return false\n }\n}\n// export const getReferralAttributes = () => {\n// const inviteCode = Cookies.get('invite_code')\n// const playModeId = Cookies.get('playModeId')\n// const popup = Cookies.get('_popup')\n// if (inviteCode && playModeId) {\n// return popup\n// ? [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// { key: '_popup', value: popup },\n// ]\n// : [\n// { key: '_invite_code', value: inviteCode ? inviteCode : '' },\n// { key: '_play_mode_id', value: playModeId ? playModeId : '' },\n// ]\n// }\n// return []\n// }\n\n// export function useH2Toc(htmlContent: string) {\n// const [toc, setToc] = useState<{ updatedHtmlContent: string; dataList: { url: string; text: string }[] }>({\n// updatedHtmlContent: htmlContent,\n// dataList: [],\n// })\n\n// useEffect(() => {\n// if (typeof window === 'undefined' || typeof document === 'undefined') return\n// const div = document.createElement('div')\n// div.innerHTML = htmlContent\n// const h2s = div.querySelectorAll('h2')\n// const dataList: { url: string; text: string }[] = []\n// h2s.forEach((h2, idx) => {\n// const text = (h2.textContent || '').trim()\n// if (!text) return\n// const id = encodeURIComponent(text).replace(/'/g, ''')\n// h2.setAttribute('id', id)\n// dataList.push({ url: id, text })\n// })\n// setToc({ updatedHtmlContent: div.innerHTML, dataList })\n// }, [htmlContent])\n\n// return toc\n// }\n\n// export const isAttributesEqual = (oldAttributes: Attribute[], newAttributes: Attribute[]) => {\n// // \u6BD4\u5BF9\u4E24\u4E2A\u6570\u636E\u662F\u5426\u5B8C\u5168\u76F8\u540C\n// // \u68C0\u67E5\u6570\u7EC4\u957F\u5EA6\u662F\u5426\u76F8\u540C\n// if (oldAttributes?.length !== newAttributes?.length) {\n// return false\n// }\n\n// // \u5C06\u6570\u7EC4\u8F6C\u6362\u4E3A Map \u4EE5\u4FBF\u5FEB\u901F\u67E5\u627E\n// const oldMap = new Map(oldAttributes.map((attr) => [attr.key, attr.value]))\n// const newMap = new Map(newAttributes.map((attr) => [attr.key, attr.value]))\n\n// // \u68C0\u67E5\u6240\u6709 key \u662F\u5426\u90FD\u5B58\u5728\u4E14\u503C\u76F8\u540C\n// for (const [key, value] of newMap) {\n// if (!oldMap.has(key) || oldMap.get(key) !== value) {\n// return false\n// }\n// }\n\n// return true\n// }\n\n// // \u68C0\u67E5\u8F93\u5165\u6846\u4E2D\u7684\u7279\u6B8A\u7B26\u53F7\n// export function validateSpecialCharacters(input: string): { isValid: boolean; invalidChars: string[] } {\n// // \u5B9A\u4E49\u4E0D\u5141\u8BB8\u7684\u7279\u6B8A\u7B26\u53F7\n// const invalidSpecialChars = /[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?`~]/g\n\n// const matches = input.match(invalidSpecialChars)\n// const invalidChars = matches ? [...new Set(matches)] : []\n\n// return {\n// isValid: invalidChars.length === 0,\n// invalidChars,\n// }\n// }\n\n// // \u83B7\u53D6\u7279\u6B8A\u7B26\u53F7\u7684\u9519\u8BEF\u63D0\u793A\u4FE1\u606F\n// export function getSpecialCharErrorMessage(invalidChars: string[]): string {\n// if (invalidChars.length === 0) return ''\n\n// const uniqueChars = [...new Set(invalidChars)]\n// if (uniqueChars.length === 1) {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u7279\u6B8A\u7B26\u53F7: ${uniqueChars[0]}`\n// } else {\n// return `\u4E0D\u5141\u8BB8\u4F7F\u7528\u4EE5\u4E0B\u7279\u6B8A\u7B26\u53F7: ${uniqueChars.join(', ')}`\n// }\n// }"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,WAAAC,EAAA,iCAAAC,EAAA,oBAAAC,EAAA,mBAAAC,EAAA,yBAAAC,EAAA,wBAAAC,EAAA,WAAAC,EAAA,eAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAZ,GAGA,IAAAa,EAA8B,oBAgBvB,SAASH,EAAWI,EAA2B,CACpD,OAAKA,EAEI,OAAO,KAAKA,CAAG,EAAE,SAAW,EAFpB,EAInB,CAEO,SAASZ,EAAOa,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX,CAEO,SAASZ,EAAOY,EAAYC,EAAqC,iBAAkB,CACxF,MAAO,iBAAiBA,CAAI,IAAID,CAAE,EACpC,CAGO,MAAMT,EAAkBW,GACzBA,IAAW,QAAgB,KAC3BA,IAAW,QAAgB,KAC3BA,IAAW,KAAa,KACrBA,EAmCIZ,EAAkB,CAAC,CAAE,QAAAa,CAAQ,IACjCA,GAAS,SAAS,KAAKC,GAAUA,EAAO,gBAAkB,gBAAc,IAAI,EA0B/EC,EAAY,CAChB,OAAU,IACV,OAAU,IACV,OAAU,IACV,OAAU,IACV,OAAU,IACV,OAAU,IACV,OAAU,KACV,OAAU,GACZ,EAGO,SAAST,EAAcU,EAAa,CACzC,OAAOA,EACJ,QAAQ,+BAAgCC,GAAK,CAC5C,MAAMC,EAAMH,EAAUE,EAAE,MAAM,EAAG,CAAC,CAA2B,EAC7D,OAAOC,EAAI,OAAO,CAAC,EAAIA,EAAI,OAAO,CAAC,EAAE,YAAY,EAAID,EAAE,MAAM,CAAC,CAChE,CAAC,EACA,QAAQ,IAAI,OAAO,IAAM,OAAO,KAAKF,CAAS,EAAE,KAAK,GAAG,EAAI,IAAK,GAAG,EAAGE,GAAKF,EAAUE,CAA2B,CAAC,CACvH,CAGO,SAASb,EAAOY,EAAa,CAClC,OAAOV,EAAcU,CAAG,EACrB,QAAQ,KAAM,GAAG,EACjB,QAAQ,iBAAkB,EAAE,EAC5B,YAAY,CACjB,CAGO,SAASd,EAAqB,CACnC,UAAAiB,EACA,QAAAN,CACF,EAGkB,CAChB,MAAMO,EAAMP,GAAS,OAAO,IAC5B,OAAOO,EAAMD,EAAU,IAAIE,GAASA,EAAM,OAAO,GAAG,EAAE,UAAUC,GAAYA,GAAYF,CAAG,EAAI,IACjG,CAGO,SAASjB,EAAoB,CAAE,QAAAoB,EAAS,QAAAV,CAAQ,EAAkD,CACvG,MAAMW,EAA2BtB,EAAqB,CAAE,UAAWqB,EAAQ,MAAO,QAAAV,CAAQ,CAAC,EAE3F,GAAIW,IAA6B,KAAM,CACrC,MAAMC,EACJF,EAAQ,SACL,OAAOG,GAAKb,EAAQ,KAAOa,EAAE,EAAE,EAC/B,IAAIA,GAAKxB,EAAqB,CAAE,UAAWqB,EAAQ,MAAO,QAASG,CAAE,CAAC,CAAC,EACvE,KAAKC,GAASA,IAAU,MAAQA,EAAQH,CAAwB,GAAK,GAG1E,OAAOD,EAAQ,MAAM,MACnBC,EACAC,IAA0B,GAAKF,EAAQ,MAAM,OAASE,CACxD,CACF,KAEE,QAAOF,EAAQ,KAEnB,CA8BO,MAAMxB,EAA+B,CAAC,CAC3C,QAAAwB,EACA,KAAAK,EACA,QAAAf,CACF,IASMe,EACE,OAAOA,GAAM,aAAa,MAAM,EAAI,EAC/BL,EAAQ,MAAM,KAAMM,GAAQD,GAAM,aAAa,SAASC,CAAG,CAAC,EAC1D,OAAOD,GAAM,iBAAiB,MAAM,EAAI,EAC1CA,EAAK,iBAAiB,KAAME,GAAMA,GAAG,SAAS,SAAWP,EAAQ,QAAUO,GAAG,SAAS,MAAQjB,EAAQ,GAAG,EACxG,OAAOe,GAAM,iBAAiB,MAAM,EAAI,EAC1C,CAACA,EAAK,iBAAiB,KAC3BE,GAAMA,GAAG,SAAS,SAAWP,EAAQ,QAAUO,GAAG,SAAS,MAAQjB,EAAQ,GAC9E,EAEO,GAGF",
|
|
6
|
+
"names": ["helper_exports", "__export", "atobID", "btoaID", "checkItemAvailableForProduct", "getNormalCoupon", "getThemeLocale", "getVariantImageIndex", "getVariantMediaList", "handle", "isObjEmpty", "replaceUmlaut", "__toCommonJS", "import_const", "obj", "id", "type", "locale", "variant", "coupon", "umlautMap", "str", "a", "big", "mediaList", "src", "media", "imageSrc", "product", "currentVariantImageIndex", "nextVariantImageIndex", "v", "index", "item", "tag", "p"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 字符串模板替换工具函数
|
|
3
|
+
* 使用单次遍历和正则表达式缓存来提高性能
|
|
4
|
+
*/
|
|
5
|
+
type ReplacementMap = Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* 字符串模板替换函数
|
|
8
|
+
* @param template 模板字符串,如 "Hello {name}, you have {count} messages"
|
|
9
|
+
* @param replacements 替换对象,如 { name: "John", count: "5" }
|
|
10
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
11
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
12
|
+
* @returns 替换后的字符串
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* replaceTemplate("Hello {name}!", { name: "World" })
|
|
17
|
+
* // => "Hello World!"
|
|
18
|
+
*
|
|
19
|
+
* replaceTemplate("Price: {{amount}}", { amount: "$100" }, "{{", "}}")
|
|
20
|
+
* // => "Price: $100"
|
|
21
|
+
*
|
|
22
|
+
* replaceTemplate("You have {count} items", { count: "5", unused: "test" })
|
|
23
|
+
* // => "You have 5 items" (unused 键会被忽略)
|
|
24
|
+
*
|
|
25
|
+
* replaceTemplate("Hello ${name}!", { name: "World" }, "${", "}")
|
|
26
|
+
* // => "Hello World!"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function replaceTemplate(template: string, replacements: ReplacementMap, beginSeg?: string, endSeg?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* 批量字符串模板替换函数(用于一次性替换多个模板)
|
|
32
|
+
* @param templates 模板字符串数组
|
|
33
|
+
* @param replacements 替换对象
|
|
34
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
35
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
36
|
+
* @returns 替换后的字符串数组
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* replaceTemplates(
|
|
41
|
+
* ["Hello {name}!", "You have {count} items"],
|
|
42
|
+
* { name: "John", count: "5" }
|
|
43
|
+
* )
|
|
44
|
+
* // => ["Hello John!", "You have 5 items"]
|
|
45
|
+
*
|
|
46
|
+
* replaceTemplates(
|
|
47
|
+
* ["Hello {{name}}!", "Price: {{amount}}"],
|
|
48
|
+
* { name: "John", amount: "$100" },
|
|
49
|
+
* "{{",
|
|
50
|
+
* "}}"
|
|
51
|
+
* )
|
|
52
|
+
* // => ["Hello John!", "Price: $100"]
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function replaceTemplates(templates: string[], replacements: ReplacementMap, beginSeg?: string, endSeg?: string): string[];
|
|
56
|
+
/**
|
|
57
|
+
* 从模板字符串中提取所有占位符键名
|
|
58
|
+
* @param template 模板字符串
|
|
59
|
+
* @param beginSeg 占位符开始符号,默认为 "{"
|
|
60
|
+
* @param endSeg 占位符结束符号,默认为 "}"
|
|
61
|
+
* @returns 占位符键名数组(去重)
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* extractPlaceholders("Hello {name}, you have {count} new {count} messages")
|
|
66
|
+
* // => ["name", "count"]
|
|
67
|
+
*
|
|
68
|
+
* extractPlaceholders("Hello {{name}}, price is {{amount}}", "{{", "}}")
|
|
69
|
+
* // => ["name", "amount"]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractPlaceholders(template: string, beginSeg?: string, endSeg?: string): string[];
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var R=(e,n)=>{for(var r in n)i(e,r,{get:n[r],enumerable:!0})},d=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of f(n))!l.call(e,t)&&t!==r&&i(e,t,{get:()=>n[t],enumerable:!(s=x(n,t))||s.enumerable});return e};var h=e=>d(i({},"__esModule",{value:!0}),e);var y={};R(y,{extractPlaceholders:()=>$,replaceTemplate:()=>u,replaceTemplates:()=>E});module.exports=h(y);const c=new Map;function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e,n){const r=`${e}|${n}`;if(c.has(r))return c.get(r);const s=o(e),t=o(n),g=new RegExp(`${s}([a-zA-Z0-9_-]+)${t}`,"g");return c.set(r,g),g}function u(e,n,r="{",s="}"){if(!e||!n||Object.keys(n).length===0)return e;const t=p(r,s);return e.replace(t,(g,a)=>n[a]!==void 0?n[a]:g)}function E(e,n,r="{",s="}"){return e.map(t=>u(t,n,r,s))}function $(e,n="{",r="}"){if(!e)return[];const s=p(n,r),t=new Set;let g;for(;(g=s.exec(e))!==null;)t.add(g[1]);return Array.from(t)}
|
|
2
|
+
//# sourceMappingURL=textFormat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/biz-components/Listing/utils/textFormat.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u5DE5\u5177\u51FD\u6570\n * \u4F7F\u7528\u5355\u6B21\u904D\u5386\u548C\u6B63\u5219\u8868\u8FBE\u5F0F\u7F13\u5B58\u6765\u63D0\u9AD8\u6027\u80FD\n */\n\ntype ReplacementMap = Record<string, string>\n\n// \u7F13\u5B58\u6B63\u5219\u8868\u8FBE\u5F0F\u4EE5\u63D0\u9AD8\u6027\u80FD\nconst regexCache = new Map<string, RegExp>()\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nfunction escapeRegExp(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u83B7\u53D6\u6216\u521B\u5EFA\u6B63\u5219\u8868\u8FBE\u5F0F\uFF08\u5E26\u7F13\u5B58\uFF09\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u5982 \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u5982 \"}\"\n * @returns \u7F16\u8BD1\u540E\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\n */\nfunction getRegex(beginSeg: string, endSeg: string): RegExp {\n const cacheKey = `${beginSeg}|${endSeg}`\n\n if (regexCache.has(cacheKey)) {\n return regexCache.get(cacheKey)!\n }\n\n // \u8F6C\u4E49\u7279\u6B8A\u5B57\u7B26\uFF0C\u6784\u5EFA\u6B63\u5219\u8868\u8FBE\u5F0F\n // \u5339\u914D beginSeg + key + endSeg\uFF0Ckey \u53EF\u4EE5\u662F\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u8FDE\u5B57\u7B26\n const escapedBegin = escapeRegExp(beginSeg)\n const escapedEnd = escapeRegExp(endSeg)\n const regex = new RegExp(`${escapedBegin}([a-zA-Z0-9_-]+)${escapedEnd}`, 'g')\n\n regexCache.set(cacheKey, regex)\n return regex\n}\n\n/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u51FD\u6570\n * @param template \u6A21\u677F\u5B57\u7B26\u4E32\uFF0C\u5982 \"Hello {name}, you have {count} messages\"\n * @param replacements \u66FF\u6362\u5BF9\u8C61\uFF0C\u5982 { name: \"John\", count: \"5\" }\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\n *\n * @example\n * ```ts\n * replaceTemplate(\"Hello {name}!\", { name: \"World\" })\n * // => \"Hello World!\"\n *\n * replaceTemplate(\"Price: {{amount}}\", { amount: \"$100\" }, \"{{\", \"}}\")\n * // => \"Price: $100\"\n *\n * replaceTemplate(\"You have {count} items\", { count: \"5\", unused: \"test\" })\n * // => \"You have 5 items\" (unused \u952E\u4F1A\u88AB\u5FFD\u7565)\n *\n * replaceTemplate(\"Hello ${name}!\", { name: \"World\" }, \"${\", \"}\")\n * // => \"Hello World!\"\n * ```\n */\nexport function replaceTemplate(\n template: string,\n replacements: ReplacementMap,\n beginSeg: string = '{',\n endSeg: string = '}',\n): string {\n if (!template) return template\n if (!replacements || Object.keys(replacements).length === 0) return template\n\n const regex = getRegex(beginSeg, endSeg)\n\n // \u4F7F\u7528 replace \u65B9\u6CD5\u8FDB\u884C\u66FF\u6362\uFF0C\u6027\u80FD\u4F18\u4E8E\u624B\u52A8\u904D\u5386\n return template.replace(regex, (match, key) => {\n // \u5982\u679C key \u5B58\u5728\u4E8E replacements \u4E2D\uFF0C\u5219\u8FD4\u56DE\u5BF9\u5E94\u7684\u503C\n // \u5426\u5219\u4FDD\u6301\u539F\u6837\uFF08\u8FD4\u56DE\u6574\u4E2A\u5339\u914D\u5185\u5BB9\uFF09\n return replacements[key] !== undefined ? replacements[key] : match\n })\n}\n\n/**\n * \u6279\u91CF\u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362\u51FD\u6570\uFF08\u7528\u4E8E\u4E00\u6B21\u6027\u66FF\u6362\u591A\u4E2A\u6A21\u677F\uFF09\n * @param templates \u6A21\u677F\u5B57\u7B26\u4E32\u6570\u7EC4\n * @param replacements \u66FF\u6362\u5BF9\u8C61\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\u6570\u7EC4\n *\n * @example\n * ```ts\n * replaceTemplates(\n * [\"Hello {name}!\", \"You have {count} items\"],\n * { name: \"John\", count: \"5\" }\n * )\n * // => [\"Hello John!\", \"You have 5 items\"]\n *\n * replaceTemplates(\n * [\"Hello {{name}}!\", \"Price: {{amount}}\"],\n * { name: \"John\", amount: \"$100\" },\n * \"{{\",\n * \"}}\"\n * )\n * // => [\"Hello John!\", \"Price: $100\"]\n * ```\n */\nexport function replaceTemplates(\n templates: string[],\n replacements: ReplacementMap,\n beginSeg: string = '{',\n endSeg: string = '}',\n): string[] {\n return templates.map((template) => replaceTemplate(template, replacements, beginSeg, endSeg))\n}\n\n/**\n * \u4ECE\u6A21\u677F\u5B57\u7B26\u4E32\u4E2D\u63D0\u53D6\u6240\u6709\u5360\u4F4D\u7B26\u952E\u540D\n * @param template \u6A21\u677F\u5B57\u7B26\u4E32\n * @param beginSeg \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"{\"\n * @param endSeg \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4\u4E3A \"}\"\n * @returns \u5360\u4F4D\u7B26\u952E\u540D\u6570\u7EC4\uFF08\u53BB\u91CD\uFF09\n *\n * @example\n * ```ts\n * extractPlaceholders(\"Hello {name}, you have {count} new {count} messages\")\n * // => [\"name\", \"count\"]\n *\n * extractPlaceholders(\"Hello {{name}}, price is {{amount}}\", \"{{\", \"}}\")\n * // => [\"name\", \"amount\"]\n * ```\n */\nexport function extractPlaceholders(template: string, beginSeg: string = '{', endSeg: string = '}'): string[] {\n if (!template) return []\n\n const regex = getRegex(beginSeg, endSeg)\n const keys = new Set<string>()\n let match: RegExpExecArray | null\n\n // \u4F7F\u7528 exec \u5FAA\u73AF\u66FF\u4EE3 matchAll \u4EE5\u4FDD\u8BC1\u517C\u5BB9\u6027\n while ((match = regex.exec(template)) !== null) {\n keys.add(match[1])\n }\n\n return Array.from(keys)\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,oBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAL,GAQA,MAAMM,EAAa,IAAI,IAOvB,SAASC,EAAaC,EAAqB,CACzC,OAAOA,EAAI,QAAQ,sBAAuB,MAAM,CAClD,CAQA,SAASC,EAASC,EAAkBC,EAAwB,CAC1D,MAAMC,EAAW,GAAGF,CAAQ,IAAIC,CAAM,GAEtC,GAAIL,EAAW,IAAIM,CAAQ,EACzB,OAAON,EAAW,IAAIM,CAAQ,EAKhC,MAAMC,EAAeN,EAAaG,CAAQ,EACpCI,EAAaP,EAAaI,CAAM,EAChCI,EAAQ,IAAI,OAAO,GAAGF,CAAY,mBAAmBC,CAAU,GAAI,GAAG,EAE5E,OAAAR,EAAW,IAAIM,EAAUG,CAAK,EACvBA,CACT,CAyBO,SAASZ,EACda,EACAC,EACAP,EAAmB,IACnBC,EAAiB,IACT,CAER,GADI,CAACK,GACD,CAACC,GAAgB,OAAO,KAAKA,CAAY,EAAE,SAAW,EAAG,OAAOD,EAEpE,MAAMD,EAAQN,EAASC,EAAUC,CAAM,EAGvC,OAAOK,EAAS,QAAQD,EAAO,CAACG,EAAOC,IAG9BF,EAAaE,CAAG,IAAM,OAAYF,EAAaE,CAAG,EAAID,CAC9D,CACH,CA2BO,SAASd,EACdgB,EACAH,EACAP,EAAmB,IACnBC,EAAiB,IACP,CACV,OAAOS,EAAU,IAAKJ,GAAab,EAAgBa,EAAUC,EAAcP,EAAUC,CAAM,CAAC,CAC9F,CAkBO,SAAST,EAAoBc,EAAkBN,EAAmB,IAAKC,EAAiB,IAAe,CAC5G,GAAI,CAACK,EAAU,MAAO,CAAC,EAEvB,MAAMD,EAAQN,EAASC,EAAUC,CAAM,EACjCU,EAAO,IAAI,IACjB,IAAIH,EAGJ,MAAQA,EAAQH,EAAM,KAAKC,CAAQ,KAAO,MACxCK,EAAK,IAAIH,EAAM,CAAC,CAAC,EAGnB,OAAO,MAAM,KAAKG,CAAI,CACxB",
|
|
6
|
+
"names": ["textFormat_exports", "__export", "extractPlaceholders", "replaceTemplate", "replaceTemplates", "__toCommonJS", "regexCache", "escapeRegExp", "str", "getRegex", "beginSeg", "endSeg", "cacheKey", "escapedBegin", "escapedEnd", "regex", "template", "replacements", "match", "key", "templates", "keys"]
|
|
7
|
+
}
|
|
@@ -53,6 +53,8 @@ export { default as ProductGridBox } from './Listing/components/ProductCard/Prod
|
|
|
53
53
|
export { default as ProductGallery } from './Listing/components/ProductCard/ProductGallery/index.js';
|
|
54
54
|
export { default as ProductDetail } from './Listing/components/ProductCard/ProductDetail/index.js';
|
|
55
55
|
export { default as ProductSummary } from './Listing/components/ProductCard/ProductSummary/index.js';
|
|
56
|
+
export { default as BenefitsTab } from './Listing/components/ProductCard/ProductDetail/BenefitsTab';
|
|
57
|
+
export { default as PaidShipping } from './Listing/components/PaidShipping/index.js';
|
|
56
58
|
export { default as GraphicMore } from './GraphicMore/index.js';
|
|
57
59
|
export { default as Features } from './Features/index.js';
|
|
58
60
|
export { default as AplusDesc } from './AplusDesc/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var he=Object.create;var l=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var Ge=(r,t)=>{for(var a in t)l(r,a,{get:t[a],enumerable:!0})},d=(r,t,a,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of Be(t))!Ce.call(r,f)&&f!==a&&l(r,f,{get:()=>t[f],enumerable:!(p=ye(t,f))||p.enumerable});return r};var e=(r,t,a)=>(a=r!=null?he(ge(r)):{},d(t||!r||!r.__esModule?l(a,"default",{value:r,enumerable:!0}):a,r)),Me=r=>d(l({},"__esModule",{value:!0}),r);var Se={};Ge(Se,{AccordionCards:()=>B.default,AiuiProvider:()=>H.default,AplusDesc:()=>se.default,BenefitsTab:()=>le.default,BrandEquity:()=>s.default,Category:()=>h.default,CollectionShelves:()=>K.default,CollectionsBanner:()=>z.default,CollectionsFilters:()=>W.default,CreativeModule:()=>I.default,DownLoad:()=>ie.default,Evaluate:()=>P.default,Faq:()=>A.default,Features:()=>de.default,FilterCardWrap:()=>O.default,FilterCardWrapItem:()=>_.default,FilterHeader:()=>N.default,FilterList:()=>w.default,FootCharger:()=>ce.default,FooterNavigation:()=>k.default,GiftBox:()=>me.default,Graphic:()=>g.default,GraphicAttractionBlock:()=>q.default,GraphicMore:()=>pe.default,GraphicOverlay:()=>j.default,HeaderNavigation:()=>v.default,HeroBanner:()=>y.default,IPC_SEARCH_PAGE:()=>u.IPC_SEARCH_PAGE,Listing:()=>L.default,Marquee:()=>S.default,MarqueeImageContent:()=>o.MarqueeImageContent,MarqueeItem:()=>o.MarqueeItem,MarqueeTextContent:()=>o.MarqueeTextContent,MediaPlayerBase:()=>C.default,MediaPlayerMulti:()=>M.default,MediaPlayerSticky:()=>G.default,MemberEquity:()=>m.default,MultiLayoutGraphicBlock:()=>T.default,Paginator:()=>R.default,PaidShipping:()=>ue.default,ProductActions:()=>V.default,ProductBenefitsTabs:()=>Y.default,ProductBundle:()=>re.default,ProductCard:()=>X.default,ProductDetail:()=>oe.default,ProductFreeGift:()=>$.default,ProductGallery:()=>ae.default,ProductGridBox:()=>te.default,ProductHighlight:()=>Z.default,ProductOptions:()=>ee.default,ProductProvider:()=>Q.default,ProductSummary:()=>fe.default,PurchaseBar:()=>U.default,SearchPage:()=>b.default,SearchPageTabType:()=>u.SearchPageTabType,SelectStore:()=>xe.default,ShelfDisplay:()=>n.default,Slogan:()=>x.default,Spacer:()=>c.default,Specs:()=>ne.default,TabGroup:()=>Pe.default,Tabs:()=>D.default,TextMarquee:()=>J.default,Title:()=>i.default,WhyChoose:()=>F.default,withLayout:()=>E.withLayout});module.exports=Me(Se);var s=e(require("./BrandEquity/index.js")),m=e(require("./MemberEquity/index.js")),x=e(require("./Slogan/index.js")),i=e(require("./Title/index.js")),c=e(require("./Spacer/index.js")),n=e(require("./ShelfDisplay/index.js")),P=e(require("./Evaluate/index.js")),h=e(require("./Category/index.js")),y=e(require("./HeroBanner/index.js")),B=e(require("./AccordionCards/index.js")),g=e(require("./Graphic/index.js")),C=e(require("./MediaPlayerBase/index.js")),G=e(require("./MediaPlayerSticky/index.js")),M=e(require("./MediaPlayerMulti/index.js")),S=e(require("./Marquee/index.js")),F=e(require("./WhyChoose/index.js")),A=e(require("./Faq/index.js")),o=require("./Marquee/index.js"),T=e(require("./MultiLayoutGraphicBlock/index.js")),q=e(require("./GraphicAttractionBlock/index.js")),v=e(require("./HeaderNavigation/index.js")),k=e(require("./FooterNavigation/index.js")),L=e(require("./Listing/index.js")),b=e(require("./SearchPage/index.js")),u=require("./SearchPage/types.js"),E=require("../shared/Styles.js"),H=e(require("./AiuiProvider/index.js")),D=e(require("./Tabs/index.js")),I=e(require("./CreativeModule/index.js")),j=e(require("./GraphicOverlay/index.js")),W=e(require("./CollectionsFilters/index.js")),w=e(require("./CollectionsFilters/FilterList.js")),N=e(require("./CollectionsFilters/FilterHeader.js")),O=e(require("./CollectionsFilters/FilterCardWrap.js")),_=e(require("./CollectionsFilters/FilterCardWrapItem.js")),R=e(require("./Paginator/index.js")),z=e(require("./CollectionsBanner/index.js")),J=e(require("./TextMarquee/index.js")),K=e(require("./CollectionShelves/index.js")),Q=e(require("./Listing/ProductProvider.js")),U=e(require("./Listing/components/PurchaseBar/index.js")),V=e(require("./Listing/components/PurchaseBar/ProductActions/index.js")),X=e(require("./Listing/components/ProductCard/index.js")),Y=e(require("./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js")),Z=e(require("./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js")),$=e(require("./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js")),ee=e(require("./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js")),re=e(require("./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js")),te=e(require("./Listing/components/ProductCard/ProductGridBox.js")),ae=e(require("./Listing/components/ProductCard/ProductGallery/index.js")),oe=e(require("./Listing/components/ProductCard/ProductDetail/index.js")),fe=e(require("./Listing/components/ProductCard/ProductSummary/index.js")),le=e(require("./Listing/components/ProductCard/ProductDetail/BenefitsTab")),ue=e(require("./Listing/components/PaidShipping/index.js")),pe=e(require("./GraphicMore/index.js")),de=e(require("./Features/index.js")),se=e(require("./AplusDesc/index.js")),me=e(require("./GiftBox/index.js")),xe=e(require("./SelectStore/index.js")),ie=e(require("./DownLoad/index.js")),ce=e(require("./FootCharger/index.js")),ne=e(require("./Specs/index.js")),Pe=e(require("./TabsGroup/index.js"));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/biz-components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { default as HeaderNavigation } from './HeaderNavigation/index.js'\nexport { default as FooterNavigation } from './FooterNavigation/index.js'\nexport { default as Listing } from './Listing/index.js'\nexport { default as SearchPage } from './SearchPage/index.js'\nexport type { SearchPageProps } from './SearchPage/types.js'\nexport { IPC_SEARCH_PAGE, SearchPageTabType } from './SearchPage/types.js'\n\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\nexport { default as GraphicOverlay } from './GraphicOverlay/index.js'\nexport { default as CollectionsFilters } from './CollectionsFilters/index.js'\nexport { default as FilterList } from './CollectionsFilters/FilterList.js'\nexport { default as FilterHeader } from './CollectionsFilters/FilterHeader.js'\nexport { default as FilterCardWrap } from './CollectionsFilters/FilterCardWrap.js'\nexport { default as FilterCardWrapItem } from './CollectionsFilters/FilterCardWrapItem.js'\nexport { default as Paginator } from './Paginator/index.js'\nexport { default as CollectionsBanner } from './CollectionsBanner/index.js'\nexport { default as TextMarquee } from './TextMarquee/index.js'\nexport { default as CollectionShelves } from './CollectionShelves/index.js'\nexport { default as ProductProvider } from './Listing/ProductProvider.js'\nexport { default as PurchaseBar } from './Listing/components/PurchaseBar/index.js'\nexport { default as ProductActions } from './Listing/components/PurchaseBar/ProductActions/index.js'\nexport { default as ProductCard } from './Listing/components/ProductCard/index.js'\nexport { default as ProductBenefitsTabs } from './Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js'\nexport { default as ProductHighlight } from './Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js'\nexport { default as ProductFreeGift } from './Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js'\nexport { default as ProductOptions } from './Listing/components/ProductCard/ProductDetail/ProductOptions/index.js'\nexport { default as ProductBundle } from './Listing/components/ProductCard/ProductDetail/ProductBundle/index.js'\nexport { default as ProductGridBox } from './Listing/components/ProductCard/ProductGridBox.js'\nexport { default as ProductGallery } from './Listing/components/ProductCard/ProductGallery/index.js'\nexport { default as ProductDetail } from './Listing/components/ProductCard/ProductDetail/index.js'\nexport { default as ProductSummary } from './Listing/components/ProductCard/ProductSummary/index.js'\nexport { default as GraphicMore } from './GraphicMore/index.js'\nexport { default as Features } from './Features/index.js'\nexport { default as AplusDesc } from './AplusDesc/index.js'\nexport { default as GiftBox } from './GiftBox/index.js'\nexport { default as SelectStore } from './SelectStore/index.js'\nexport { default as DownLoad } from './DownLoad/index.js'\nexport { default as FootCharger } from './FootCharger/index.js'\nexport { default as Specs } from './Specs/index.js'\nexport { default as TabGroup } from './TabsGroup/index.js'\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,
|
|
6
|
-
"names": ["biz_components_exports", "__export", "__toCommonJS", "import_BrandEquity", "import_MemberEquity", "import_Slogan", "import_Title", "import_Spacer", "import_ShelfDisplay", "import_Evaluate", "import_Category", "import_HeroBanner", "import_AccordionCards", "import_Graphic", "import_MediaPlayerBase", "import_MediaPlayerSticky", "import_MediaPlayerMulti", "import_Marquee", "import_WhyChoose", "import_Faq", "import_MultiLayoutGraphicBlock", "import_GraphicAttractionBlock", "import_HeaderNavigation", "import_FooterNavigation", "import_Listing", "import_SearchPage", "import_types", "import_Styles", "import_AiuiProvider", "import_Tabs", "import_CreativeModule", "import_GraphicOverlay", "import_CollectionsFilters", "import_FilterList", "import_FilterHeader", "import_FilterCardWrap", "import_FilterCardWrapItem", "import_Paginator", "import_CollectionsBanner", "import_TextMarquee", "import_CollectionShelves", "import_ProductProvider", "import_PurchaseBar", "import_ProductActions", "import_ProductCard", "import_ProductBenefitsTabs", "import_ProductHighlight", "import_ProductFreeGift", "import_ProductOptions", "import_ProductBundle", "import_ProductGridBox", "import_ProductGallery", "import_ProductDetail", "import_ProductSummary", "import_GraphicMore", "import_Features", "import_AplusDesc", "import_GiftBox", "import_SelectStore", "import_DownLoad", "import_FootCharger", "import_Specs", "import_TabsGroup"]
|
|
4
|
+
"sourcesContent": ["export { default as BrandEquity } from './BrandEquity/index.js'\nexport { default as MemberEquity } from './MemberEquity/index.js'\nexport { default as Slogan } from './Slogan/index.js'\nexport { default as Title } from './Title/index.js'\nexport { default as Spacer } from './Spacer/index.js'\nexport { default as ShelfDisplay } from './ShelfDisplay/index.js'\nexport { default as Evaluate } from './Evaluate/index.js'\nexport { default as Category } from './Category/index.js'\nexport { default as HeroBanner } from './HeroBanner/index.js'\nexport { default as AccordionCards } from './AccordionCards/index.js'\nexport { default as Graphic } from './Graphic/index.js'\nexport { default as MediaPlayerBase } from './MediaPlayerBase/index.js'\nexport { default as MediaPlayerSticky } from './MediaPlayerSticky/index.js'\nexport { default as MediaPlayerMulti } from './MediaPlayerMulti/index.js'\nexport { default as Marquee } from './Marquee/index.js'\nexport { default as WhyChoose } from './WhyChoose/index.js'\nexport { default as Faq } from './Faq/index.js'\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee/index.js'\nexport { default as MultiLayoutGraphicBlock } from './MultiLayoutGraphicBlock/index.js'\nexport type { MultiLayoutGraphicBlockProps } from './MultiLayoutGraphicBlock/index.js'\nexport { default as GraphicAttractionBlock } from './GraphicAttractionBlock/index.js'\nexport type { GraphicAttractionBlockProps } from './GraphicAttractionBlock/index.js'\nexport { default as HeaderNavigation } from './HeaderNavigation/index.js'\nexport { default as FooterNavigation } from './FooterNavigation/index.js'\nexport { default as Listing } from './Listing/index.js'\nexport { default as SearchPage } from './SearchPage/index.js'\nexport type { SearchPageProps } from './SearchPage/types.js'\nexport { IPC_SEARCH_PAGE, SearchPageTabType } from './SearchPage/types.js'\n\nexport { withLayout } from '../shared/Styles.js'\nexport { default as AiuiProvider } from './AiuiProvider/index.js'\nexport { default as Tabs } from './Tabs/index.js'\nexport { default as CreativeModule } from './CreativeModule/index.js'\nexport { default as GraphicOverlay } from './GraphicOverlay/index.js'\nexport { default as CollectionsFilters } from './CollectionsFilters/index.js'\nexport { default as FilterList } from './CollectionsFilters/FilterList.js'\nexport { default as FilterHeader } from './CollectionsFilters/FilterHeader.js'\nexport { default as FilterCardWrap } from './CollectionsFilters/FilterCardWrap.js'\nexport { default as FilterCardWrapItem } from './CollectionsFilters/FilterCardWrapItem.js'\nexport { default as Paginator } from './Paginator/index.js'\nexport { default as CollectionsBanner } from './CollectionsBanner/index.js'\nexport { default as TextMarquee } from './TextMarquee/index.js'\nexport { default as CollectionShelves } from './CollectionShelves/index.js'\nexport { default as ProductProvider } from './Listing/ProductProvider.js'\nexport { default as PurchaseBar } from './Listing/components/PurchaseBar/index.js'\nexport { default as ProductActions } from './Listing/components/PurchaseBar/ProductActions/index.js'\nexport { default as ProductCard } from './Listing/components/ProductCard/index.js'\nexport { default as ProductBenefitsTabs } from './Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js'\nexport { default as ProductHighlight } from './Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js'\nexport { default as ProductFreeGift } from './Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js'\nexport { default as ProductOptions } from './Listing/components/ProductCard/ProductDetail/ProductOptions/index.js'\nexport { default as ProductBundle } from './Listing/components/ProductCard/ProductDetail/ProductBundle/index.js'\nexport { default as ProductGridBox } from './Listing/components/ProductCard/ProductGridBox.js'\nexport { default as ProductGallery } from './Listing/components/ProductCard/ProductGallery/index.js'\nexport { default as ProductDetail } from './Listing/components/ProductCard/ProductDetail/index.js'\nexport { default as ProductSummary } from './Listing/components/ProductCard/ProductSummary/index.js'\nexport { default as BenefitsTab } from './Listing/components/ProductCard/ProductDetail/BenefitsTab'\nexport { default as PaidShipping } from './Listing/components/PaidShipping/index.js'\nexport { default as GraphicMore } from './GraphicMore/index.js'\nexport { default as Features } from './Features/index.js'\nexport { default as AplusDesc } from './AplusDesc/index.js'\nexport { default as GiftBox } from './GiftBox/index.js'\nexport { default as SelectStore } from './SelectStore/index.js'\nexport { default as DownLoad } from './DownLoad/index.js'\nexport { default as FootCharger } from './FootCharger/index.js'\nexport { default as Specs } from './Specs/index.js'\nexport { default as TabGroup } from './TabsGroup/index.js'\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,q1DAAAE,GAAAF,IAAA,IAAAG,EAAuC,qCACvCC,EAAwC,sCACxCC,EAAkC,gCAClCC,EAAiC,+BACjCC,EAAkC,gCAClCC,EAAwC,sCACxCC,EAAoC,kCACpCC,EAAoC,kCACpCC,EAAsC,oCACtCC,EAA0C,wCAC1CC,EAAmC,iCACnCC,EAA2C,yCAC3CC,EAA6C,2CAC7CC,EAA4C,0CAC5CC,EAAmC,iCACnCC,EAAqC,mCACrCC,EAA+B,6BAC/BF,EAAqE,8BACrEG,EAAmD,iDAEnDC,EAAkD,gDAElDC,EAA4C,0CAC5CC,EAA4C,0CAC5CC,EAAmC,iCACnCC,EAAsC,oCAEtCC,EAAmD,iCAEnDC,EAA2B,+BAC3BC,EAAwC,sCACxCC,EAAgC,8BAChCC,EAA0C,wCAC1CC,EAA0C,wCAC1CC,EAA8C,4CAC9CC,EAAsC,iDACtCC,EAAwC,mDACxCC,EAA0C,qDAC1CC,EAA8C,yDAC9CC,EAAqC,mCACrCC,EAA6C,2CAC7CC,EAAuC,qCACvCC,EAA6C,2CAC7CC,EAA2C,2CAC3CC,EAAuC,wDACvCC,EAA0C,uEAC1CC,EAAuC,wDACvCC,EAA+C,0FAC/CC,EAA4C,uFAC5CC,EAA2C,sFAC3CC,GAA0C,qFAC1CC,GAAyC,oFACzCC,GAA0C,iEAC1CC,GAA0C,uEAC1CC,GAAyC,sEACzCC,GAA0C,uEAC1CC,GAAuC,yEACvCC,GAAwC,yDACxCC,GAAuC,qCACvCC,GAAoC,kCACpCC,GAAqC,mCACrCC,GAAmC,iCACnCC,GAAuC,qCACvCC,GAAoC,kCACpCC,GAAuC,qCACvCC,GAAiC,+BACjCC,GAAoC",
|
|
6
|
+
"names": ["biz_components_exports", "__export", "__toCommonJS", "import_BrandEquity", "import_MemberEquity", "import_Slogan", "import_Title", "import_Spacer", "import_ShelfDisplay", "import_Evaluate", "import_Category", "import_HeroBanner", "import_AccordionCards", "import_Graphic", "import_MediaPlayerBase", "import_MediaPlayerSticky", "import_MediaPlayerMulti", "import_Marquee", "import_WhyChoose", "import_Faq", "import_MultiLayoutGraphicBlock", "import_GraphicAttractionBlock", "import_HeaderNavigation", "import_FooterNavigation", "import_Listing", "import_SearchPage", "import_types", "import_Styles", "import_AiuiProvider", "import_Tabs", "import_CreativeModule", "import_GraphicOverlay", "import_CollectionsFilters", "import_FilterList", "import_FilterHeader", "import_FilterCardWrap", "import_FilterCardWrapItem", "import_Paginator", "import_CollectionsBanner", "import_TextMarquee", "import_CollectionShelves", "import_ProductProvider", "import_PurchaseBar", "import_ProductActions", "import_ProductCard", "import_ProductBenefitsTabs", "import_ProductHighlight", "import_ProductFreeGift", "import_ProductOptions", "import_ProductBundle", "import_ProductGridBox", "import_ProductGallery", "import_ProductDetail", "import_ProductSummary", "import_BenefitsTab", "import_PaidShipping", "import_GraphicMore", "import_Features", "import_AplusDesc", "import_GiftBox", "import_SelectStore", "import_DownLoad", "import_FootCharger", "import_Specs", "import_TabsGroup"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import React, { type Dispatch, type SetStateAction, type PropsWithChildren } from 'react';
|
|
2
2
|
import type { Product, ProductPrice, ProductVariant, VariantCoupon, Options, FreeGift, BundleListItem, Bundle } from './types/product';
|
|
3
3
|
import type { CompareData } from './types.js';
|
|
4
|
+
type Country = {
|
|
5
|
+
id?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
code?: string;
|
|
8
|
+
};
|
|
9
|
+
export type UserProfile = {
|
|
10
|
+
user_id: string;
|
|
11
|
+
email: string;
|
|
12
|
+
nick_name?: string;
|
|
13
|
+
full_name?: string;
|
|
14
|
+
first_name?: string;
|
|
15
|
+
last_name?: string;
|
|
16
|
+
dob?: string;
|
|
17
|
+
gender?: string;
|
|
18
|
+
phone_number?: string;
|
|
19
|
+
phone_account?: string;
|
|
20
|
+
country?: Country;
|
|
21
|
+
is_subscribe?: boolean;
|
|
22
|
+
avatar?: string;
|
|
23
|
+
can_change_password?: boolean;
|
|
24
|
+
invitation_code?: string;
|
|
25
|
+
phone_carrier?: string;
|
|
26
|
+
dob_programmed?: boolean;
|
|
27
|
+
activated?: boolean;
|
|
28
|
+
registed_at?: number;
|
|
29
|
+
activated_at?: number;
|
|
30
|
+
token?: string;
|
|
31
|
+
};
|
|
4
32
|
export type SavingDetail = {
|
|
5
33
|
coupon: number;
|
|
6
34
|
bundle: number;
|
|
@@ -11,16 +39,36 @@ export type SavingDetail = {
|
|
|
11
39
|
type variantWithFinalPrice = ProductVariant & {
|
|
12
40
|
finalPrice?: ProductPrice;
|
|
13
41
|
};
|
|
42
|
+
export type FunctionMemberPriceResult = {
|
|
43
|
+
hasMemberPrice: boolean;
|
|
44
|
+
originalPrice: number;
|
|
45
|
+
withCouponMemberTotalSave: number;
|
|
46
|
+
withoutCouponMaxMemberTotalSave?: number;
|
|
47
|
+
labels: {
|
|
48
|
+
key: string;
|
|
49
|
+
value: string;
|
|
50
|
+
desc: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
export type ModalData = {
|
|
54
|
+
needClickAway?: boolean;
|
|
55
|
+
className?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
content?: string;
|
|
58
|
+
domContent?: React.ReactNode;
|
|
59
|
+
};
|
|
14
60
|
export interface ProductContextType {
|
|
15
61
|
isLogin?: boolean;
|
|
16
62
|
isMobile?: boolean;
|
|
17
63
|
isDesktop?: boolean;
|
|
18
64
|
product: Product;
|
|
65
|
+
profile?: UserProfile;
|
|
19
66
|
variant: ProductVariant;
|
|
20
67
|
selectedVariants: Array<variantWithFinalPrice>;
|
|
21
68
|
renderRating?: React.ReactNode;
|
|
22
69
|
coupon?: VariantCoupon;
|
|
23
70
|
savingDetail: SavingDetail;
|
|
71
|
+
setSavingDetail: Dispatch<SetStateAction<SavingDetail>>;
|
|
24
72
|
finalPrice: number;
|
|
25
73
|
comparePrice: number;
|
|
26
74
|
totalSavings: number;
|
|
@@ -45,8 +93,16 @@ export interface ProductContextType {
|
|
|
45
93
|
compareData?: CompareData['data'];
|
|
46
94
|
onAddToCart?: () => void;
|
|
47
95
|
onBuyNow?: () => void;
|
|
96
|
+
creditsRedemptionAmount?: number;
|
|
97
|
+
memberFunctionResult?: FunctionMemberPriceResult;
|
|
98
|
+
openModal: ({ title, content, domContent }: ModalData) => void;
|
|
99
|
+
openSignInPopup?: () => void;
|
|
100
|
+
openAuthCodePopup?: () => void;
|
|
101
|
+
renderAffirm?: React.ReactNode;
|
|
102
|
+
renderKlarna?: React.ReactNode;
|
|
103
|
+
renderPaypal?: React.ReactNode;
|
|
48
104
|
}
|
|
49
105
|
export declare const ProductContext: React.Context<ProductContextType>;
|
|
50
106
|
export declare const useProductContext: () => ProductContextType;
|
|
51
|
-
declare const ProductProvider: ({ product, isLogin, isMobile, isDesktop, children, renderRating, freeGift, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, savingDetail, selectedVariants, onAddToCart, onBuyNow, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts">>) => import("react/jsx-runtime").JSX.Element;
|
|
107
|
+
declare const ProductProvider: ({ product, isLogin, profile, isMobile, isDesktop, children, renderRating, freeGift, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, savingDetail, setSavingDetail, selectedVariants, onAddToCart, onBuyNow, creditsRedemptionAmount, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, renderAffirm, renderKlarna, renderPaypal, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts">>) => import("react/jsx-runtime").JSX.Element;
|
|
52
108
|
export default ProductProvider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as j}from"react/jsx-runtime";import{createContext as G,useContext as n,useState as O}from"react";const e=G({}),K=()=>{if(!n(e))throw new Error("useProductContext must be used in <ProductProvider>");return n(e)},W=({product:t,isLogin:o,profile:r,isMobile:i,isDesktop:a,children:d,renderRating:c,freeGift:u,bundle:s,checkedBundle:l,checkedGift:p,setCheckedBundle:m,setCheckedGift:P,variant:b,selectedOptions:g,setSelectedOptions:f,compareData:y,coupon:C,finalPrice:h,comparePrice:v,totalSavings:S,savingDetail:R,setSavingDetail:x,selectedVariants:B,onAddToCart:D,onBuyNow:_,creditsRedemptionAmount:A,memberFunctionResult:V,openModal:k,openSignInPopup:M,openAuthCodePopup:w,renderAffirm:F,renderKlarna:I,renderPaypal:L})=>{const[N,T]=O({bundle:void 0,gift:void 0});return j(e.Provider,{value:{product:t,variant:b,isMobile:i,isDesktop:a,isLogin:o,profile:r,coupon:C,renderRating:c,finalPrice:h,comparePrice:v,savingDetail:R,setSavingDetail:x,totalSavings:S,selectedOptions:g,setSelectedOptions:f,freeGift:u,checkedGift:p,setCheckedGift:P,checkedBundle:l,setCheckedBundle:m,bundle:s,compareData:y,selectedVariants:B,onAddToCart:D,onBuyNow:_,joinedRecommendBuyProducts:N,setJoinedRecommendBuyProducts:T,creditsRedemptionAmount:A,memberFunctionResult:V,openModal:k,openSignInPopup:M,openAuthCodePopup:w,renderAffirm:F,renderKlarna:I,renderPaypal:L},children:d})};var q=W;export{e as ProductContext,q as default,K as useProductContext};
|
|
2
2
|
//# sourceMappingURL=ProductProvider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Listing/ProductProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData } from './types.js'\n\nexport type SavingDetail = { coupon: number; bundle: number; member: number; freeGift: number; compare: number }\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n variant: ProductVariant\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n // productSummaryStatus: {\n // bundleSummary: boolean\n // giftSummary: boolean\n // }\n joinedRecommendBuyProducts: { bundle?: BundleListItem; gift?: ProductVariant }\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<{ bundle?: BundleListItem; gift?: ProductVariant }>>\n // setProductSummaryStatus?: Dispatch<SetStateAction<{ bundleSummary: boolean; giftSummary: boolean }>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const ProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useProductContext = () => {\n const context = useContext(ProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(ProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<{ bundle?: BundleListItem; gift?: ProductVariant }>({\n bundle: undefined,\n gift: undefined,\n })\n return (\n <ProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n }}\n >\n {children}\n </ProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "createContext", "useContext", "useState", "ProductContext", "useProductContext", "ProductProvider", "product", "isLogin", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "ProductProvider_default"]
|
|
4
|
+
"sourcesContent": ["import React, {\n createContext,\n useCallback,\n useContext,\n type Dispatch,\n type SetStateAction,\n type PropsWithChildren,\n useState,\n} from 'react'\nimport type {\n Product,\n ProductPrice,\n ProductVariant,\n VariantCoupon,\n Options,\n FreeGift,\n BundleListItem,\n Bundle,\n} from './types/product'\nimport type { CompareData } from './types.js'\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n\nexport type SavingDetail = { coupon: number; bundle: number; member: number; freeGift: number; compare: number }\n\ntype variantWithFinalPrice = ProductVariant & { finalPrice?: ProductPrice }\n\nexport type FunctionMemberPriceResult = {\n hasMemberPrice: boolean\n originalPrice: number\n withCouponMemberTotalSave: number\n withoutCouponMaxMemberTotalSave?: number\n labels: {\n key: string\n value: string\n desc: string\n }[]\n}\n\nexport type ModalData = {\n needClickAway?: boolean\n className?: string\n title?: string\n content?: string\n domContent?: React.ReactNode\n}\nexport interface ProductContextType {\n isLogin?: boolean\n isMobile?: boolean\n isDesktop?: boolean\n product: Product\n profile?: UserProfile\n variant: ProductVariant\n selectedVariants: Array<variantWithFinalPrice>\n renderRating?: React.ReactNode\n coupon?: VariantCoupon\n savingDetail: SavingDetail\n setSavingDetail: Dispatch<SetStateAction<SavingDetail>>\n finalPrice: number\n comparePrice: number\n totalSavings: number\n selectedOptions: Options\n setSelectedOptions: Dispatch<SetStateAction<Options>>\n freeGift?: FreeGift\n checkedGift?: ProductVariant\n setCheckedGift?: Dispatch<SetStateAction<ProductVariant | undefined>>\n checkedBundle?: BundleListItem\n setCheckedBundle: Dispatch<SetStateAction<BundleListItem | undefined>>\n // productSummaryStatus: {\n // bundleSummary: boolean\n // giftSummary: boolean\n // }\n joinedRecommendBuyProducts: { bundle?: BundleListItem; gift?: ProductVariant }\n setJoinedRecommendBuyProducts?: Dispatch<SetStateAction<{ bundle?: BundleListItem; gift?: ProductVariant }>>\n // setProductSummaryStatus?: Dispatch<SetStateAction<{ bundleSummary: boolean; giftSummary: boolean }>>\n checkedCareBundle?: ProductVariant\n setCheckedCareBundle?: Dispatch<SetStateAction<ProductVariant | undefined>>\n bundle?: Bundle\n compareData?: CompareData['data']\n onAddToCart?: () => void\n onBuyNow?: () => void\n creditsRedemptionAmount?: number\n memberFunctionResult?: FunctionMemberPriceResult\n openModal: ({ title, content, domContent }: ModalData) => void\n openSignInPopup?: () => void\n openAuthCodePopup?: () => void\n renderAffirm?: React.ReactNode\n renderKlarna?: React.ReactNode\n renderPaypal?: React.ReactNode\n}\n\n// const initialState: ProductContextType = {\n// isLogin: false,\n// isMobile: false,\n// product: {} as Product,\n// variant: {} as ProductVariant,\n// savingDetail: { coupon: 0, bundle: 0, member: 0, freeGift: 0, compare: 0 },\n// finalPrice: 0,\n// comparePrice: 0,\n// totalSavings: 0,\n// renderRating: null,\n// selectedOptions: {} as Options,\n// setSelectedOptions: () => {},\n// checkedBundle: undefined,\n// checkedGift: undefined,\n// setCheckedBundle: () => {},\n// setCheckedGift: () => {},\n// checkedCareBundle: undefined,\n// setCheckedCareBundle: () => {},\n// }\n\nexport const ProductContext = createContext<ProductContextType>({} as ProductContextType)\n\nexport const useProductContext = () => {\n const context = useContext(ProductContext)\n if (!context) {\n throw new Error('useProductContext must be used in <ProductProvider>')\n }\n return useContext(ProductContext)\n}\n\nconst ProductProvider = ({\n product,\n isLogin,\n profile,\n isMobile,\n isDesktop,\n children,\n renderRating,\n freeGift,\n bundle,\n checkedBundle,\n checkedGift,\n setCheckedBundle,\n setCheckedGift,\n variant,\n selectedOptions,\n setSelectedOptions,\n compareData,\n coupon,\n finalPrice,\n comparePrice,\n totalSavings,\n savingDetail,\n setSavingDetail,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n}: PropsWithChildren<Omit<ProductContextType, 'joinedRecommendBuyProducts' | 'setJoinedRecommendBuyProducts'>>) => {\n const [joinedRecommendBuyProducts, setJoinedRecommendBuyProducts] = useState<{ bundle?: BundleListItem; gift?: ProductVariant }>({\n bundle: undefined,\n gift: undefined,\n })\n return (\n <ProductContext.Provider\n value={{\n product,\n variant,\n isMobile,\n isDesktop,\n isLogin,\n profile,\n coupon,\n renderRating,\n finalPrice,\n comparePrice,\n savingDetail,\n setSavingDetail,\n totalSavings,\n selectedOptions,\n setSelectedOptions,\n freeGift,\n checkedGift,\n setCheckedGift,\n checkedBundle,\n setCheckedBundle,\n bundle,\n compareData,\n selectedVariants,\n onAddToCart,\n onBuyNow,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n creditsRedemptionAmount,\n memberFunctionResult,\n openModal,\n openSignInPopup,\n openAuthCodePopup,\n renderAffirm,\n renderKlarna,\n renderPaypal,\n }}\n >\n {children}\n </ProductContext.Provider>\n )\n}\n\nexport default ProductProvider\n"],
|
|
5
|
+
"mappings": "AA8LI,cAAAA,MAAA,oBA9LJ,OACE,iBAAAC,EAEA,cAAAC,EAIA,YAAAC,MACK,QAmIA,MAAMC,EAAiBH,EAAkC,CAAC,CAAuB,EAE3EI,EAAoB,IAAM,CAErC,GAAI,CADYH,EAAWE,CAAc,EAEvC,MAAM,IAAI,MAAM,qDAAqD,EAEvE,OAAOF,EAAWE,CAAc,CAClC,EAEME,EAAkB,CAAC,CACvB,QAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAAC,EACA,cAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,wBAAAC,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,IAAmH,CACjH,KAAM,CAACC,EAA4BC,CAA6B,EAAIvC,EAA6D,CAC/H,OAAQ,OACR,KAAM,MACR,CAAC,EACD,OACEH,EAACI,EAAe,SAAf,CACC,MAAO,CACL,QAAAG,EACA,QAAAa,EACA,SAAAV,EACA,UAAAC,EACA,QAAAH,EACA,QAAAC,EACA,OAAAe,EACA,aAAAX,EACA,WAAAY,EACA,aAAAC,EACA,aAAAE,EACA,gBAAAC,EACA,aAAAF,EACA,gBAAAN,EACA,mBAAAC,EACA,SAAAR,EACA,YAAAG,EACA,eAAAE,EACA,cAAAH,EACA,iBAAAE,EACA,OAAAH,EACA,YAAAQ,EACA,iBAAAO,EACA,YAAAC,EACA,SAAAC,EACA,2BAAAS,EACA,8BAAAC,EACA,wBAAAT,EACA,qBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,CACF,EAEC,SAAA5B,EACH,CAEJ,EAEA,IAAO+B,EAAQrC",
|
|
6
|
+
"names": ["jsx", "createContext", "useContext", "useState", "ProductContext", "useProductContext", "ProductProvider", "product", "isLogin", "profile", "isMobile", "isDesktop", "children", "renderRating", "freeGift", "bundle", "checkedBundle", "checkedGift", "setCheckedBundle", "setCheckedGift", "variant", "selectedOptions", "setSelectedOptions", "compareData", "coupon", "finalPrice", "comparePrice", "totalSavings", "savingDetail", "setSavingDetail", "selectedVariants", "onAddToCart", "onBuyNow", "creditsRedemptionAmount", "memberFunctionResult", "openModal", "openSignInPopup", "openAuthCodePopup", "renderAffirm", "renderKlarna", "renderPaypal", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "ProductProvider_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as a,Text as n}from"../../../../components/index.js";import{useAiuiContext as x}from"../../../AiuiProvider/index.js";import{cn as c}from"../../../../helpers/index.js";const m=p=>{const{className:r,setOpenShippingPolicyModal:t,metafields:l}=p,{trackingData:s}=x(),o=s?.common?.copywriting;return i("div",{tabIndex:-1,className:c("from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]","flex flex-col",r),children:[i("div",{className:"flex w-full items-center justify-between",children:[e(n,{size:2,className:"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]",children:"Learn about Express Shipping Policy"}),e(a,{variant:"link",className:"hidden whitespace-nowrap laptop:inline-flex",onClick:()=>{t(!0)},children:o?.learnMore})]}),e(n,{size:1,as:"p",className:"text-[12px] text-[#6D6D6F] laptop:text-[14px]",children:l?.loginBeforeCheckoutNote}),e(a,{variant:"link",className:"inline-flex px-0 laptop:hidden",onClick:()=>{t(!0)},children:o?.learnMore})]})};var g=m;export{g as default};
|
|
2
|
+
//# sourceMappingURL=LearnMore.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/LearnMore.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Text } from '../../../../components/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\n\nconst LearnMore = (props: any) => {\n const { className, setOpenShippingPolicyModal, metafields } = props\n const { trackingData } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n tabIndex={-1}\n className={cn(\n 'from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]',\n 'flex flex-col',\n className,\n )}\n >\n <div className='flex w-full items-center justify-between'>\n <Text size={2} className='text-[14px] laptop:text-[16px] lg-desktop:text-[18px]'>\n Learn about Express Shipping Policy\n </Text>\n <Button\n variant='link'\n className='hidden whitespace-nowrap laptop:inline-flex'\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n\n <Text size={1} as='p' className='text-[12px] text-[#6D6D6F] laptop:text-[14px]'>\n {metafields?.loginBeforeCheckoutNote}\n </Text>\n\n <Button\n variant='link'\n className='inline-flex px-0 laptop:hidden'\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n )\n}\n\nexport default LearnMore\n"],
|
|
5
|
+
"mappings": "AAkBM,OACE,OAAAA,EADF,QAAAC,MAAA,oBAlBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,kCAC7B,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,MAAAC,MAAU,+BAEnB,MAAMC,EAAaC,GAAe,CAChC,KAAM,CAAE,UAAAC,EAAW,2BAAAC,EAA4B,WAAAC,CAAW,EAAIH,EACxD,CAAE,aAAAI,CAAa,EAAIP,EAAe,EAClCQ,EAAaD,GAAc,QAAQ,YAEzC,OACEV,EAAC,OACC,SAAU,GACV,UAAWI,EACT,yOACA,gBACAG,CACF,EAEA,UAAAP,EAAC,OAAI,UAAU,2CACb,UAAAD,EAACG,EAAA,CAAK,KAAM,EAAG,UAAU,wDAAwD,+CAEjF,EACAH,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,8CACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,EAEAZ,EAACG,EAAA,CAAK,KAAM,EAAG,GAAG,IAAI,UAAU,gDAC7B,SAAAO,GAAY,wBACf,EAEAV,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,iCACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,CAEJ,EAEA,IAAOC,EAAQP",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "useAiuiContext", "cn", "LearnMore", "props", "className", "setOpenShippingPolicyModal", "metafields", "trackingData", "shopCommon", "LearnMore_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const ShippingMethod: ({ item, index, active, toggleShipping, currencyCode, metafields, className, }: {
|
|
2
|
+
item: any;
|
|
3
|
+
index: number;
|
|
4
|
+
active: boolean;
|
|
5
|
+
toggleShipping: (item: any, index: number) => void;
|
|
6
|
+
currencyCode: string;
|
|
7
|
+
metafields: any;
|
|
8
|
+
className?: string;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default ShippingMethod;
|