@iheartjane/dm-sdk 2.25.0 → 2.26.0
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/chunk-HXMWTQAO.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{smartSort-Bzn30738.d.cts → smartSort-C7l2wPes.d.cts} +4 -0
- package/dist/{smartSort-Bzn30738.d.ts → smartSort-C7l2wPes.d.ts} +4 -0
- package/dist/test-utils.cjs +1 -1
- package/dist/test-utils.d.cts +1 -1
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-TGCEYA6I.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Q=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var Z=(u,i,c,t)=>{for(var o=t>1?void 0:t?U(i,c):i,a=u.length-1,p;a>=0;a--)(p=u[a])&&(o=(t?p(i,c,o):p(o))||o);return t&&o&&Q(i,c,o),o};var d=(t=>(t.All="all",t.Default="default",t.Off="off",t))(d||{}),m=(s=>(s.Bloom="bloom",s.Default="default",s.Embedded="embedded",s.FramelessEmbed="framelessEmbed",s.Headless="headless",s.Kiosk="kiosk",s.OperatorEmbed="operatorEmbed",s.WhiteLabel="whiteLabel",s))(m||{}),l=(t=>(t.Desktop="desktop",t.Kiosk="kiosk",t.Mobile="mobile",t))(l||{}),g=(i=>(i.UserOptOut="user-opt-out",i))(g||{});var _=(c=>(c.Featured="featured",c.Midgrid="midgrid",c))(_||{}),P=(r=>(r.BestSelling="best_selling",r.BrandSpecials="brand_specials",r.BuyAgainRow="buy_again_row",r.CartToppers="cart_toppers",r.CustomImageRow="custom_image_row",r.FeaturedRow="featured_row",r.MenuDynamicRow="menu_dynamic_row",r.MenuInline="menu_inline",r.MenuInlineTable="menu_inline_table",r.MenuTopRow="menu_top_row",r.PdpRow="pdp_row",r.Sale="sale",r.Specials="specials",r))(P||{}),R=(n=>(n.Edible="edible",n.Extract="extract",n.Flower="flower",n.Gear="gear",n.Grow="grow",n.Merch="merch",n.PreRoll="pre-roll",n.Tincture="tincture",n.Topical="topical",n.Vape="vape",n))(R||{}),b=(t=>(t.Rating="rating",t.Recent="recent",t.Upvote="upvote",t))(b||{}),x=(e=>(e.BestSellerRank="best-seller-rank",e.CategoryAndNameAsc="category-and-name-asc",e.CbdDosageAsc="cbd-dosage-asc",e.CbdDosageDesc="cbd-dosage-desc",e.Default="default",e.PriceAsc="price-asc",e.PriceDesc="price-desc",e.PriceEighthOunceAsc="price-eighth-ounce-asc",e.PriceEighthOunceDesc="price-eighth-ounce-desc",e.PriceGramAsc="price-gram-asc",e.PriceGramDesc="price-gram-desc",e.PriceHalfGramAsc="price-half-gram-asc",e.PriceHalfGramDesc="price-half-gram-desc",e.PriceHalfOunceAsc="price-half-ounce-asc",e.PriceHalfOunceDesc="price-half-ounce-desc",e.PriceOunceAsc="price-ounce-asc",e.PriceOunceDesc="price-ounce-desc",e.PriceQuarterOunceAsc="price-quarter-ounce-asc",e.PriceQuarterOunceDesc="price-quarter-ounce-desc",e.PriceTwoGramAsc="price-two-gram-asc",e.PriceTwoGramDesc="price-two-gram-desc",e.Rating="rating",e.Recommendation="recommendation",e.ThcDosageAsc="thc-dosage-asc",e.ThcDosageDesc="thc-dosage-desc",e.ThcPotencyAsc="thc-potency-asc",e.ThcPotencyDesc="thc-potency-desc",e))(x||{});var z=50;var f="best-seller-rank",w="category-and-name-asc",v="default",y="price-asc",h="price-desc",C="price-eighth-ounce-asc",I="price-eighth-ounce-desc",D="price-gram-asc",q="price-gram-desc",A="price-half-gram-asc",O="price-half-gram-desc",S="price-half-ounce-asc",T="price-half-ounce-desc",M="price-ounce-asc",F="price-ounce-desc",k="price-quarter-ounce-asc",B="price-quarter-ounce-desc",G="price-two-gram-asc",E="price-two-gram-desc",j="rating",H="recommendation",N="thc-potency-asc",V="thc-potency-desc",J=[f,w,v,y,h,C,I,D,q,A,O,S,T,M,F,k,B,G,E,j,H,N,V];var L={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};export{Z as a,L as b,d as c,m as d,l as e,g as f,_ as g,P as h,R as i,b as j,x as k,z as l,f as m,w as n,v as o,y as p,h as q,C as r,I as s,D as t,q as u,A as v,O as w,S as x,T as y,M as z,F as A,k as B,B as C,G as D,E,j as F,H as G,N as H,V as I,J};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Xe=Object.create;var ne=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,e)=>{for(var r in e)ne(t,r,{get:e[r],enumerable:!0})},Me=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of We(e))!et.call(t,o)&&o!==r&&ne(t,o,{get:()=>e[o],enumerable:!(s=Ae(e,o))||s.enumerable});return t};var rt=(t,e,r)=>(r=t!=null?Xe(Ye(t)):{},Me(e||!t||!t.__esModule?ne(r,"default",{value:t,enumerable:!0}):r,t)),st=t=>Me(ne({},"__esModule",{value:!0}),t),_=(t,e,r,s)=>{for(var o=s>1?void 0:s?Ae(e,r):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ne(e,r,o),o};var Ct={};tt(Ct,{AdMode:()=>F,AppMode:()=>ae,BrandSpecials:()=>ue,DEFAULT_PAGE_SIZE:()=>de,IntendedDisplay:()=>le,JaneDM:()=>R,JaneDeviceIdSentinel:()=>ce,PageContextEnum:()=>Pe,Placement:()=>C,ProductKindEnum:()=>ge,ReviewSortEnum:()=>he,SearchSortEnum:()=>pe,SmartSort:()=>D,SmartSortProduct:()=>x,Specials:()=>me,bestSellerRank:()=>T,categoryAndNameAsc:()=>A,defaultOrder:()=>M,priceAsc:()=>O,priceDesc:()=>q,priceEighthOunceAsc:()=>E,priceEighthOunceDesc:()=>j,priceGramAsc:()=>U,priceGramDesc:()=>N,priceHalfGramAsc:()=>G,priceHalfGramDesc:()=>B,priceHalfOunceAsc:()=>z,priceHalfOunceDesc:()=>L,priceOunceAsc:()=>J,priceOunceDesc:()=>H,priceQuarterOunceAsc:()=>K,priceQuarterOunceDesc:()=>Q,priceTwoGramAsc:()=>V,priceTwoGramDesc:()=>$,rating:()=>Z,recommendation:()=>X,searchSorts:()=>we,thcPotencyAsc:()=>W,thcPotencyDesc:()=>Y});module.exports=st(Ct);var P={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};var F=(s=>(s.All="all",s.Default="default",s.Off="off",s))(F||{}),ae=(c=>(c.Bloom="bloom",c.Default="default",c.Embedded="embedded",c.FramelessEmbed="framelessEmbed",c.Headless="headless",c.Kiosk="kiosk",c.OperatorEmbed="operatorEmbed",c.WhiteLabel="whiteLabel",c))(ae||{}),le=(s=>(s.Desktop="desktop",s.Kiosk="kiosk",s.Mobile="mobile",s))(le||{}),ce=(e=>(e.UserOptOut="user-opt-out",e))(ce||{});var Pe=(r=>(r.Featured="featured",r.Midgrid="midgrid",r))(Pe||{}),C=(d=>(d.BestSelling="best_selling",d.BrandSpecials="brand_specials",d.BuyAgainRow="buy_again_row",d.CartToppers="cart_toppers",d.CustomImageRow="custom_image_row",d.FeaturedRow="featured_row",d.MenuDynamicRow="menu_dynamic_row",d.MenuInline="menu_inline",d.MenuInlineTable="menu_inline_table",d.MenuTopRow="menu_top_row",d.PdpRow="pdp_row",d.Sale="sale",d.Specials="specials",d))(C||{}),ge=(p=>(p.Edible="edible",p.Extract="extract",p.Flower="flower",p.Gear="gear",p.Grow="grow",p.Merch="merch",p.PreRoll="pre-roll",p.Tincture="tincture",p.Topical="topical",p.Vape="vape",p))(ge||{}),he=(s=>(s.Rating="rating",s.Recent="recent",s.Upvote="upvote",s))(he||{}),pe=(m=>(m.BestSellerRank="best-seller-rank",m.CategoryAndNameAsc="category-and-name-asc",m.Default="default",m.PriceAsc="price-asc",m.PriceDesc="price-desc",m.PriceEighthOunceAsc="price-eighth-ounce-asc",m.PriceEighthOunceDesc="price-eighth-ounce-desc",m.PriceGramAsc="price-gram-asc",m.PriceGramDesc="price-gram-desc",m.PriceHalfGramAsc="price-half-gram-asc",m.PriceHalfGramDesc="price-half-gram-desc",m.PriceHalfOunceAsc="price-half-ounce-asc",m.PriceHalfOunceDesc="price-half-ounce-desc",m.PriceOunceAsc="price-ounce-asc",m.PriceOunceDesc="price-ounce-desc",m.PriceQuarterOunceAsc="price-quarter-ounce-asc",m.PriceQuarterOunceDesc="price-quarter-ounce-desc",m.PriceTwoGramAsc="price-two-gram-asc",m.PriceTwoGramDesc="price-two-gram-desc",m.Rating="rating",m.Recommendation="recommendation",m.ThcPotencyAsc="thc-potency-asc",m.ThcPotencyDesc="thc-potency-desc",m))(pe||{});var de=50;var T="best-seller-rank",A="category-and-name-asc",M="default",O="price-asc",q="price-desc",E="price-eighth-ounce-asc",j="price-eighth-ounce-desc",U="price-gram-asc",N="price-gram-desc",G="price-half-gram-asc",B="price-half-gram-desc",z="price-half-ounce-asc",L="price-half-ounce-desc",J="price-ounce-asc",H="price-ounce-desc",K="price-quarter-ounce-asc",Q="price-quarter-ounce-desc",V="price-two-gram-asc",$="price-two-gram-desc",Z="rating",X="recommendation",W="thc-potency-asc",Y="thc-potency-desc",we=[T,A,M,O,q,E,j,U,N,G,B,z,L,J,H,K,Q,V,$,Z,X,W,Y];var qe="2.25.0";var Ie=(t,e)=>{let{apiKey:r,source:s}=e,o=new URL(t);return o.searchParams.set("jdm_source",s),o.searchParams.set("jdm_version",qe),r&&o.searchParams.set("jdm_api_key",r),o.searchParams.sort(),o.toString()},f=(t,e,r)=>{let s=new URL(t+e);return Ie(s.toString(),r)},ee=(t,e)=>{let r=new URL(t+P.click),s=new URL(t+P.impression);return{clickEndpoint:Ie(r.toString(),e),impressionEndpoint:Ie(s.toString(),e)}},ve=class extends Error{response;constructor(e,r){super(e),this.response=r}},Ee=async t=>{if(t.ok){if(t.status===204)return null}else throw new ve("Api Request Failed",t);try{return await t.json()}catch{}},ot=async(t,e)=>{let r=await fetch(t,{body:JSON.stringify(e),headers:{Accept:"application/json","Content-Type":"text/plain"},method:"POST"});return Ee(r)},it=async(t,e={})=>{let{headers:r,...s}=e,o=await fetch(t,{...s,headers:{Accept:"application/json",...r},method:"GET"});return Ee(o)},h={get:it,post:ot};var Ce=require("nanoid");var I=()=>typeof window<"u"&&typeof document<"u";var nt=(...t)=>{console.error("[JaneDmSDK]",...t)},at=(...t)=>{console.info("[JaneDmSDK]",...t)},ct=(...t)=>{console.log("[JaneDmSDK]",...t)},v={error:nt,info:at,log:ct};var pt=t=>{let e=localStorage.getItem(t);return e!==null?mt(e):e},dt=(t,e)=>localStorage.setItem(t,lt(e)),ut=t=>localStorage.removeItem(t),k={get:pt,remove:ut,set:dt},mt=t=>je(t)?t.substring(1,t.length-1):t,lt=t=>je(t)?t:`"${t}"`,je=t=>{let r=t.length-1;return t[0]==='"'&&t[r]==='"'};var ke="j_fp_last_run",Pt=1440*60*1e3,gt=20,xe=new Set,ht=(t,e)=>`${t}:${e.apiKey}:${e.source}`;var ft=t=>typeof t=="object"&&t!==null&&typeof t.token=="string"&&typeof t.endpoint=="string"&&typeof t.scriptUrlPattern=="string",Rt=async(t,e)=>{try{let r=f(t,P.fingerprint,e),s=await h.get(r);return ft(s)?s:null}catch(r){return v.error("Failed to fetch fingerprint token:",r),null}},_t=async(t,e,r,s)=>{try{let o=await import("@fingerprintjs/fingerprintjs-pro"),i=await o.load({apiKey:t,endpoint:[e,o.defaultEndpoint],region:"us",scriptUrlPattern:[r,o.defaultScriptUrlPattern],storageKey:"eyeD"}),a={tag:{isDmSdk:!0}};s?.linkedId&&(a.linkedId=s.linkedId);let c=await i.get(a);return!c||!c.visitorId?(v.error("Fingerprint JS did not return a valid visitorId"),null):{visitorId:c.visitorId}}catch(o){return v.error("Failed to run Fingerprint JS:",o),null}},Ue=async(t,e,r)=>{if(!I())return(0,Ce.nanoid)();let s=k.get("jdid");if(!s)return await Be(t,e,r)??(0,Ce.nanoid)();if(s.length!==gt)return await De(t,e,{linkedId:s}),s;let o=await Ge(t,e,r);if(o)return o;if(Ne()==="error")try{k.set(ke,Date.now().toString())}catch{}return s},Ne=()=>{try{let t=k.get(ke);if(!t)return"missing";let e=parseInt(t,10);return Number.isNaN(e)?"missing":Date.now()-e>=Pt?"expired":"valid"}catch{return"error"}},Ge=async(t,e,r)=>{let s=Ne();return s==="valid"||s==="error"?null:Be(t,e,r)},Be=async(t,e,r)=>{let s=ht(t,e);if(xe.has(s))return null;xe.add(s);try{let o=await Rt(t,e);if(!o)return null;let n=await _t(o.token,o.endpoint,o.scriptUrlPattern,r);if(!n)return null;try{k.set(ke,Date.now().toString())}catch{}return n.visitorId}catch(o){return v.error("Failed to run fingerprint:",o),null}finally{xe.delete(s)}},De=async(t,e,r)=>{if(I()&&r?.linkedId!=="user-opt-out")try{await Ge(t,e,r)}catch(s){v.error("Failed to run SSR fingerprint:",s)}};var b=class t extends Error{constructor(e){super(`[Jane DM SDK]: ${e}`),this.name="SdkError",Object.setPrototypeOf(this,t.prototype)}};var Fe=t=>{switch(t){case T:return"best-seller-rank";case A:return"category-and-name-asc";case O:return"price-asc";case q:return"price-desc";case E:return"price-eighth-ounce-asc";case j:return"price-eighth-ounce-desc";case U:return"price-gram-asc";case N:return"price-gram-desc";case G:return"price-half-gram-asc";case B:return"price-half-gram-desc";case z:return"price-half-ounce-asc";case L:return"price-half-ounce-desc";case J:return"price-ounce-asc";case H:return"price-ounce-desc";case K:return"price-quarter-ounce-asc";case Q:return"price-quarter-ounce-desc";case V:return"price-two-gram-asc";case $:return"price-two-gram-desc";case Z:return"rating";case X:return"recommendation";case W:return"thc-potency-asc";case Y:return"thc-potency-desc";case M:default:return"default"}};var fe=t=>JSON.parse(t);var Te=class t{isSponsored;objectId;clickPayload;clickUrl;impressPayload;impressUrl;constructor(e){this.objectId=e.objectId,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored}static fromJSON(e){return new t(fe(e))}serialize(){return{clickPayload:this.clickPayload,clickUrl:this.clickUrl,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},x=class t{attributes;isSponsored;objectId;clickPayload;clickUrl;hasBeenImpressed;impressPayload;impressPromise;impressUrl;constructor(e){this.objectId=e.objectId,this.attributes=e.attributes,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored,this.hasBeenImpressed=e.hasBeenImpressed??!1}static fromJSON(e){return new t(fe(e))}click(e={isAddToCart:!1}){let{isAddToCart:r=!1}=e,s={...this.clickPayload,isAddToCart:r};return h.post(this.clickUrl,s)}impress(){return this.hasBeenImpressed?Promise.resolve():(this.impressPromise??=h.post(this.impressUrl,this.impressPayload).then(()=>{this.hasBeenImpressed=!0}).finally(()=>{this.impressPromise=void 0}),this.impressPromise)}serialize(){return{attributes:this.attributes,clickPayload:this.clickPayload,clickUrl:this.clickUrl,hasBeenImpressed:this.hasBeenImpressed,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},D=class t{customImages;placement;products;rowId;searchFacets;title;totalProducts;creativeIds;cachedProducts;config;loadPromise;nextPageProps;nextPageUrl;constructor(e){this.rowId=e.rowId,this.searchFacets=e.searchFacets,this.nextPageUrl=e.nextPageUrl,this.nextPageProps=e.nextPageProps,this.products=e.products.map(r=>new x(r)),this.cachedProducts=e.cachedProducts.map(r=>new Te(r)),this.totalProducts=e.totalProducts,this.title=e.title,this.creativeIds=e.creativeIds,this.config=e.config,this.customImages=e.customImages??[],this.placement=e.placement,I()&&!this.config.skipAutoSmartSortOnLoad&&this.onLoad().catch(r=>v.error("Failed to run onLoad:",r))}static fromJSON(e){return new t(fe(e))}hasNextPage(){return this.cachedProducts.length>0}async nextPage(){if(!this.hasNextPage())return;let e=this.cachedProducts.slice(0,this.nextPageProps.pageSize),r={app_mode:this.config.appMode,jane_device_id:this.config.identifier.jdid,object_ids:e.map(n=>n.objectId),search_attributes:this.nextPageProps.searchAttributes},s=await h.post(this.nextPageUrl,r),o=new Map(s.products?.map(n=>[n.object_id,n.search_attributes]));e.forEach(n=>{let i=o.get(n.objectId);i!==void 0&&this.products.push(new x({...n.serialize(),attributes:i}))}),this.cachedProducts=this.cachedProducts.slice(this.nextPageProps.pageSize)}async onLoad(){return this.loadPromise?this.loadPromise:(this.loadPromise=(async()=>{if(!I())return;let e={apiKey:this.config.apiKey,source:this.config.source};await De(this.config.eventsEndpoint,e,{linkedId:this.config.identifier.jdid})})(),this.loadPromise)}serialize(){return{cachedProducts:this.cachedProducts.map(e=>e.serialize()),config:this.config,creativeIds:this.creativeIds,customImages:this.customImages,nextPageProps:this.nextPageProps,nextPageUrl:this.nextPageUrl,placement:this.placement,products:this.products.map(e=>e.serialize()),rowId:this.rowId,searchFacets:this.searchFacets,title:this.title,totalProducts:this.totalProducts}}toJSON(){return JSON.stringify(this.serialize())}},te=class{async createSmartSort(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=f(e.config.endpoint,P.smart,r),o=f(e.config.pageEndpoint,P.page,r),n=this.buildSmartRequest(e),i=await h.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=ee(e.config.eventsEndpoint,r),{creative_ids:g,custom_images:p,products:l,row_id:u,search_facets:d,title:w}=i,{cachedProducts:re,products:se}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:l}),oe=(p??[]).map(ie=>this.massageCustomImageData(ie)).filter(ie=>ie!==void 0);return new D({cachedProducts:re,config:e.config,creativeIds:g,customImages:oe,nextPageProps:{pageSize:"page_size"in n?n.page_size??60:60,searchAttributes:n.search_attributes??e.searchAttributes},nextPageUrl:o,placement:e.placement,products:se,rowId:u,searchFacets:d,title:w,totalProducts:i.nb_hits??0})}generateProducts(e){let{clickUrl:r,identifier:s,impressUrl:o,products:n}=e,i={cachedProducts:[],products:[]};return n?.forEach(a=>{let c={clickPayload:{adToken:a.ad_token,distinctId:s.mixpanelDistinctId??s.jdid,isAddToCart:!1,janeDeviceId:s.jdid,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id,storeId:a.store_id},clickUrl:r,impressPayload:{distinctId:s.mixpanelDistinctId??s.jdid,engagements:[{adToken:a.ad_token,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id}],janeDeviceId:s.jdid},impressUrl:o,isSponsored:!!a.flight_id,objectId:a.object_id};a.search_attributes!==void 0?i.products.push({...c,attributes:a.search_attributes}):i.cachedProducts.push(c)}),i}massageCustomImageData(e){if(e)return{headline:e.headline,imageUrl:e.image_url,intendedDisplay:e.intended_display,logoUrl:e.logo_url,overlayColor:e.overlay_color,positionX:e.position_x,positionY:e.position_y,scaleNumber:e.scale_number,textColor:e.text_color}}buildSmartRequest(e){let{config:r,searchAttributes:s,...o}=e,n={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,user_id:r.identifier.userId};switch(o.placement){case"cart_toppers":{let{cartProductIds:i,posCartProductIds:a,storeId:c}=o;return{...n,cart_pos_product_ids:a,cart_product_ids:i,placement:"cart_toppers",store_id:c}}case"custom_image_row":{let{searchFilter:i,storeId:a}=o;return{...n,placement:"custom_image_row",search_filter:i,store_id:a}}case"menu_dynamic_row":{let{adMode:i,filterContext:a,pageContext:c,storeId:g}=o;return{...n,ad_mode:i??"default",filter_context:a,page_context:c,placement:"menu_dynamic_row",store_id:g}}case"menu_inline":{let{adMode:i,distinctByProduct:a,metadata:c,numColumns:g,searchFilter:p,searchQuery:l,searchSort:u,storeId:d,storeIds:w}=o;return{...n,ad_mode:i??"default",distinct_by_product:a,metadata:c,num_columns:g,placement:"menu_inline",search_filter:p,search_query:l,search_sort:Fe(u),store_ids:w||[d]}}case"menu_inline_table":{let{disableAds:i,distinctByProduct:a,maxProducts:c,metadata:g,numColumns:p,pageSize:l,searchFacets:u,searchFilter:d,searchQuery:w,searchSort:re,storeId:se,storeIds:oe}=o;return{...n,disable_ads:i,distinct_by_product:a,max_products:c,metadata:g,num_columns:p,page_size:l,placement:"menu_inline_table",search_attributes:s,search_facets:u,search_filter:d,search_query:w,search_sort:Fe(re),store_ids:oe||[se]}}case"menu_top_row":{let{searchFilter:i,storeId:a}=o,c=this.extractValidCreativeIds(e);return{...n,exclude_creative_ids:c,placement:"menu_top_row",search_filter:i,store_id:a}}case"pdp_row":{let{posProductId:i,productId:a,storeId:c}=o;return{...n,placement:"pdp_row",pos_product_id:i,product_id:a,store_id:c}}default:throw new b(`Invalid Smart Sort Placement: ${o.placement}`)}}extractValidCreativeIds(e){if(e.placement==="menu_top_row"&&"excludeCreativeIds"in e&&Array.isArray(e.excludeCreativeIds))return e.excludeCreativeIds.filter(r=>typeof r=="number")}};var St=t=>t.placement==="specials",yt=t=>t.placement==="brand_specials",ue=class{placement;title;constructor(e){this.title=e,this.placement="brand_specials"}},me=class{placement;title;constructor(e){this.title=e,this.placement="specials"}},Re=class extends te{async createMultiPlacement(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=f(e.config.endpoint,P.multi,r),o=f(e.config.pageEndpoint,P.page,r),n=this.buildMultiRequest(e),i=await h.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=ee(e.config.eventsEndpoint,r),g=[];for(let[p,l]of(i.placements||[]).entries())if(St(l))g.push(new me(l.title));else if(yt(l))g.push(new ue(l.title));else{let{creative_ids:u,custom_images:d,placement:w,products:re,row_id:se,search_facets:oe,title:ie}=l,{cachedProducts:Ve,products:$e}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:re}),Ze=(d??[]).map(be=>this.massageCustomImageData(be)).filter(be=>be!==void 0);g.push(new D({cachedProducts:Ve,config:{...e.config,skipAutoSmartSortOnLoad:p===0?e.config.skipAutoSmartSortOnLoad:!0},creativeIds:u,customImages:Ze,nextPageProps:{pageSize:60,searchAttributes:n.search_attributes||[]},nextPageUrl:o,placement:w,products:$e,rowId:se,searchFacets:oe,title:ie,totalProducts:l.nb_hits??0}))}return g}buildMultiRequest(e){let{config:r,numColumns:s,searchAttributes:o,storeId:n,...i}=e,a={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,num_columns:s,pos_user_id:r.identifier.posUserId,search_attributes:o,store_id:n,user_id:r.identifier.userId};switch(i.multiRequestType){case"custom":return{...a,placements:this.massageCustomPlacements(i.placements),type:"custom"};case"featured":return{...a,exclude_menu_top_row:i.excludeMenuTopRow??!1,type:"featured"};default:throw new b(`Invalid Multi Type: ${i.multiRequestType}`)}}massageCustomPlacements(e){let r=[];for(let s of e)switch(s.placement){case"best_selling":r.push({placement:"best_selling",title:s.title});break;case"brand_specials":r.push({placement:"brand_specials",title:s.title});break;case"buy_again_row":r.push({placement:"buy_again_row",title:s.title});break;case"custom_image_row":r.push({placement:"custom_image_row",search_filter:s.searchFilter});break;case"featured_row":r.push({placement:"featured_row",row_id:s.rowId});break;case"menu_dynamic_row":r.push({ad_mode:s.adMode??"default",filter_context:s.filterContext,page_context:s.pageContext,placement:"menu_dynamic_row"});break;case"menu_inline":r.push({ad_mode:s.adMode??"default",metadata:s.metadata,placement:"menu_inline",search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_inline_table":r.push({disable_ads:s.disableAds,max_products:s.maxProducts,metadata:s.metadata,page_size:s.pageSize,placement:"menu_inline_table",search_facets:s.searchFacets,search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_top_row":r.push({placement:"menu_top_row",search_filter:s.searchFilter});break;case"sale":r.push({placement:"sale",title:s.title});break;case"specials":r.push({placement:"specials",title:s.title});break;default:throw new b(`Invalid Custom Placement: ${s.placement}`)}return r}};var Qe=require("nanoid");var ze=async t=>{let{apiKey:e,appMode:r,endpoint:s,identifier:o,searchFacets:n,searchFilter:i,searchQuery:a,source:c,storeId:g}=t,{jdid:p}=o||{},l=f(s,P.facets,{apiKey:e,source:c}),u={appMode:r,janeDeviceId:p,searchFacets:n,searchFilter:i,searchQuery:a,storeId:g};return(await h.post(l,u)).searchFacets??{}};var Le=async t=>{let{apiKey:e,endpoint:r,identifier:s,source:o,storeId:n,...i}=t,a=f(r,P.externalCheckout,{apiKey:e,source:o}),c={janeDeviceId:s.jdid,posOrderId:i.posOrderId,posUserId:i.posUserId||s.posUserId,products:i.products,storeId:n};return await h.post(a,c)};var _e=class{async create(e){let{config:r,searchAttributes:s,storeId:o,...n}=e,i={apiKey:r.apiKey,source:r.source},a=f(r.endpoint,P.product,i),{clickEndpoint:c,impressionEndpoint:g}=ee(r.eventsEndpoint,i),p={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,store_id:o,user_id:r.identifier.userId},l=n.productId!==void 0?{...p,product_id:n.productId}:{...p,pos_product_id:n.posProductId},u=await h.post(a,l);return new x({attributes:u.search_attributes,clickPayload:{adToken:u.ad_token,distinctId:r.identifier.mixpanelDistinctId,isAddToCart:!1,janeDeviceId:r.identifier.jdid,kevelToken:u.kevel_token,myHighD:u.my_high_d,productId:u.product_id,storeId:o},clickUrl:c,impressPayload:{distinctId:r.identifier.mixpanelDistinctId??r.identifier.jdid,engagements:[{adToken:u.ad_token,kevelToken:u.kevel_token,myHighD:u.my_high_d,productId:u.product_id}],janeDeviceId:r.identifier.jdid},impressUrl:g,isSponsored:!!u.flight_id,objectId:u.object_id})}};var bt=t=>({activities:t.activities,avatar:t.avatar,comment:t.comment,createdAt:t.created_at,feelings:t.feelings,hasComment:t.has_comment,id:t.id,nickname:t.nickname,productId:t.product_id,rating:t.rating,storeId:t.store_id,storeName:t.store_name,updatedAt:t.updated_at,upvoteCount:t.upvote_count}),wt=t=>({activitiesDistribution:t.activities_distribution,averageRating:t.average_rating,distribution:t.distribution,feelingsDistribution:t.feelings_distribution,reviewCount:t.review_count}),It=(t,e,r)=>{let s=t.total_count,o=Math.max(1,Math.ceil(s/r));return{aggregate:wt(t.aggregate),aiSummary:t.ai_summary,items:t.reviews.map(bt),pagination:{currentPage:e,hasNextPage:e<o,hasPreviousPage:e>1,pageSize:r,totalCount:s,totalPages:o},productId:t.product_id}},Je=async t=>{let{activities:e,config:r,feelings:s,hasComment:o,page:n,pageSize:i,productId:a,ratings:c,sort:g}=t,p=n??1,l=i??50,u=f(r.endpoint,P.productReviews,{apiKey:r.apiKey,source:r.source}),d={activities:e,feelings:s,has_comment:o||void 0,page:n,page_size:i,product_id:a,ratings:c,sort:g},w=await h.post(u,d);return It(w,p,l)},He=t=>{let e={[Symbol.asyncIterator]:async function*(){let r=1;for(;;){let s=await t(r);if(yield s,!s.pagination.hasNextPage)return;r+=1}}};return{pages:e,[Symbol.asyncIterator]:async function*(){for await(let r of e)yield*r.items}}};var Ke=async t=>{let{apiKey:e,eventsEndpoint:r,identifier:s,source:o,...n}=t,i=f(r,P.sessionEvent,{apiKey:e,source:o}),a={distinctId:s.mixpanelDistinctId,events:n.events,janeDeviceId:s.jdid};return await h.post(i,a)};function S(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...o){return await this.init(),s.apply(this,o)},r}function y(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...o){if(!this.rateLimiter)throw new Error("throttle decorator can only be used on JaneDM class methods");return this.rateLimiter.schedule(async()=>s.apply(this,o))},r}var Se=class{burst;intervalMs;rate;tat=0;toleranceMs;constructor(e,r=1){if(e<=0)throw new b("rate must be > 0");if(r<1)throw new b("burst must be >= 1");this.rate=e,this.burst=Math.floor(r),this.intervalMs=1e3/this.rate,this.toleranceMs=(this.burst-1)*this.intervalMs}async schedule(e){let r=Date.now(),s=Math.max(0,this.tat-this.toleranceMs-r);this.tat=Math.max(this.tat,r)+this.intervalMs;let o=async()=>e();return s>0?new Promise((n,i)=>setTimeout(()=>o().then(n).catch(i),s)):o()}};var vt=/^https?:\/\//,xt=/^(https?:\/\/)?(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}|localhost)(:\d+)?(\/.*)?$/,ye=(t,e)=>{let s=vt.test(t??e)?t??e:`https://${t}`,o=new URL(s);return xt.test(o.toString())?o.protocol+"//"+o.host:e};var R=class{config;rateLimiter;initialized=!1;multiClient;productClient;smartSortClient;userProvidedJdid=!1;constructor(e,r){let{apiKey:s,endpoint:o,identifier:n}=e,{appMode:i="headless",eventsEndpoint:a,pageEndpoint:c,skipAutoSmartSortOnLoad:g=!1,source:p="sdk"}=r??{},l=ye(o,"https://dmerch.iheartjane.com"),u=ye(a,l),d=ye(c,l);this.userProvidedJdid=!!n?.jdid,this.config={apiKey:s,appMode:i,endpoint:l,eventsEndpoint:u,identifier:n??{jdid:""},pageEndpoint:d,skipAutoSmartSortOnLoad:g,source:p},this.smartSortClient=new te,this.multiClient=new Re,this.productClient=new _e,this.rateLimiter=new Se(10,20)}static generateJaneDeviceId(){return(0,Qe.nanoid)()}async fetchCartTopperRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"cart_toppers"})}async fetchCustomImageRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"custom_image_row"})}async fetchCustomPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"custom",...e})}async fetchFacets(e){return ze({...e,...this.config})}async fetchFeaturedPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"featured",...e})}async fetchMenuRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline"})}async fetchMenuTopRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_top_row"})}async fetchProduct(e){return this.productClient.create({config:this.config,...e})}async fetchProductReviews(e){return Je({config:this.config,...e})}async fetchRecommendedPDPRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"pdp_row"})}async fetchRecommendedRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_dynamic_row"})}async fetchRecommendedSort(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline_table"})}getJaneDeviceId(){return this.config.identifier.jdid}async init(){this.initialized||(I()&&!this.userProvidedJdid&&await this.initializeClientSideJdid(),this.initialized=!0)}iterateProductReviews(e){return He(r=>this.fetchProductReviews({...e,page:r}))}async sendPosCheckout(e){return Le({...e,...this.config})}async sendSessionEvent(e){return Ke({...e,...this.config})}async initializeClientSideJdid(){let e={apiKey:this.config.apiKey,source:this.config.source},r=await Ue(this.config.eventsEndpoint,e);k.set("jdid",r),this.config.identifier.jdid=r}};_([S,y],R.prototype,"fetchCartTopperRow",1),_([S,y],R.prototype,"fetchCustomImageRow",1),_([S,y],R.prototype,"fetchCustomPlacements",1),_([S,y],R.prototype,"fetchFacets",1),_([S,y],R.prototype,"fetchFeaturedPlacements",1),_([S,y],R.prototype,"fetchMenuRow",1),_([S,y],R.prototype,"fetchMenuTopRow",1),_([S,y],R.prototype,"fetchProduct",1),_([S,y],R.prototype,"fetchProductReviews",1),_([S,y],R.prototype,"fetchRecommendedPDPRow",1),_([S,y],R.prototype,"fetchRecommendedRow",1),_([S,y],R.prototype,"fetchRecommendedSort",1);0&&(module.exports={AdMode,AppMode,BrandSpecials,DEFAULT_PAGE_SIZE,IntendedDisplay,JaneDM,JaneDeviceIdSentinel,PageContextEnum,Placement,ProductKindEnum,ReviewSortEnum,SearchSortEnum,SmartSort,SmartSortProduct,Specials,bestSellerRank,categoryAndNameAsc,defaultOrder,priceAsc,priceDesc,priceEighthOunceAsc,priceEighthOunceDesc,priceGramAsc,priceGramDesc,priceHalfGramAsc,priceHalfGramDesc,priceHalfOunceAsc,priceHalfOunceDesc,priceOunceAsc,priceOunceDesc,priceQuarterOunceAsc,priceQuarterOunceDesc,priceTwoGramAsc,priceTwoGramDesc,rating,recommendation,searchSorts,thcPotencyAsc,thcPotencyDesc});
|
|
1
|
+
"use strict";var Xe=Object.create;var ae=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,e)=>{for(var r in e)ae(t,r,{get:e[r],enumerable:!0})},Me=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of We(e))!et.call(t,o)&&o!==r&&ae(t,o,{get:()=>e[o],enumerable:!(s=Ae(e,o))||s.enumerable});return t};var rt=(t,e,r)=>(r=t!=null?Xe(Ye(t)):{},Me(e||!t||!t.__esModule?ae(r,"default",{value:t,enumerable:!0}):r,t)),st=t=>Me(ae({},"__esModule",{value:!0}),t),_=(t,e,r,s)=>{for(var o=s>1?void 0:s?Ae(e,r):e,n=t.length-1,i;n>=0;n--)(i=t[n])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ae(e,r,o),o};var kt={};tt(kt,{AdMode:()=>F,AppMode:()=>ce,BrandSpecials:()=>ue,DEFAULT_PAGE_SIZE:()=>pe,IntendedDisplay:()=>le,JaneDM:()=>R,JaneDeviceIdSentinel:()=>de,PageContextEnum:()=>Pe,Placement:()=>C,ProductKindEnum:()=>ge,ReviewSortEnum:()=>he,SearchSortEnum:()=>T,SmartSort:()=>D,SmartSortProduct:()=>x,Specials:()=>me,bestSellerRank:()=>A,categoryAndNameAsc:()=>M,defaultOrder:()=>O,priceAsc:()=>q,priceDesc:()=>E,priceEighthOunceAsc:()=>j,priceEighthOunceDesc:()=>U,priceGramAsc:()=>N,priceGramDesc:()=>G,priceHalfGramAsc:()=>B,priceHalfGramDesc:()=>z,priceHalfOunceAsc:()=>L,priceHalfOunceDesc:()=>J,priceOunceAsc:()=>H,priceOunceDesc:()=>K,priceQuarterOunceAsc:()=>Q,priceQuarterOunceDesc:()=>V,priceTwoGramAsc:()=>$,priceTwoGramDesc:()=>Z,rating:()=>X,recommendation:()=>W,searchSorts:()=>we,thcPotencyAsc:()=>Y,thcPotencyDesc:()=>ee});module.exports=st(kt);var P={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};var F=(s=>(s.All="all",s.Default="default",s.Off="off",s))(F||{}),ce=(c=>(c.Bloom="bloom",c.Default="default",c.Embedded="embedded",c.FramelessEmbed="framelessEmbed",c.Headless="headless",c.Kiosk="kiosk",c.OperatorEmbed="operatorEmbed",c.WhiteLabel="whiteLabel",c))(ce||{}),le=(s=>(s.Desktop="desktop",s.Kiosk="kiosk",s.Mobile="mobile",s))(le||{}),de=(e=>(e.UserOptOut="user-opt-out",e))(de||{});var Pe=(r=>(r.Featured="featured",r.Midgrid="midgrid",r))(Pe||{}),C=(u=>(u.BestSelling="best_selling",u.BrandSpecials="brand_specials",u.BuyAgainRow="buy_again_row",u.CartToppers="cart_toppers",u.CustomImageRow="custom_image_row",u.FeaturedRow="featured_row",u.MenuDynamicRow="menu_dynamic_row",u.MenuInline="menu_inline",u.MenuInlineTable="menu_inline_table",u.MenuTopRow="menu_top_row",u.PdpRow="pdp_row",u.Sale="sale",u.Specials="specials",u))(C||{}),ge=(d=>(d.Edible="edible",d.Extract="extract",d.Flower="flower",d.Gear="gear",d.Grow="grow",d.Merch="merch",d.PreRoll="pre-roll",d.Tincture="tincture",d.Topical="topical",d.Vape="vape",d))(ge||{}),he=(s=>(s.Rating="rating",s.Recent="recent",s.Upvote="upvote",s))(he||{}),T=(p=>(p.BestSellerRank="best-seller-rank",p.CategoryAndNameAsc="category-and-name-asc",p.CbdDosageAsc="cbd-dosage-asc",p.CbdDosageDesc="cbd-dosage-desc",p.Default="default",p.PriceAsc="price-asc",p.PriceDesc="price-desc",p.PriceEighthOunceAsc="price-eighth-ounce-asc",p.PriceEighthOunceDesc="price-eighth-ounce-desc",p.PriceGramAsc="price-gram-asc",p.PriceGramDesc="price-gram-desc",p.PriceHalfGramAsc="price-half-gram-asc",p.PriceHalfGramDesc="price-half-gram-desc",p.PriceHalfOunceAsc="price-half-ounce-asc",p.PriceHalfOunceDesc="price-half-ounce-desc",p.PriceOunceAsc="price-ounce-asc",p.PriceOunceDesc="price-ounce-desc",p.PriceQuarterOunceAsc="price-quarter-ounce-asc",p.PriceQuarterOunceDesc="price-quarter-ounce-desc",p.PriceTwoGramAsc="price-two-gram-asc",p.PriceTwoGramDesc="price-two-gram-desc",p.Rating="rating",p.Recommendation="recommendation",p.ThcDosageAsc="thc-dosage-asc",p.ThcDosageDesc="thc-dosage-desc",p.ThcPotencyAsc="thc-potency-asc",p.ThcPotencyDesc="thc-potency-desc",p))(T||{});var pe=50;var A="best-seller-rank",M="category-and-name-asc",O="default",q="price-asc",E="price-desc",j="price-eighth-ounce-asc",U="price-eighth-ounce-desc",N="price-gram-asc",G="price-gram-desc",B="price-half-gram-asc",z="price-half-gram-desc",L="price-half-ounce-asc",J="price-half-ounce-desc",H="price-ounce-asc",K="price-ounce-desc",Q="price-quarter-ounce-asc",V="price-quarter-ounce-desc",$="price-two-gram-asc",Z="price-two-gram-desc",X="rating",W="recommendation",Y="thc-potency-asc",ee="thc-potency-desc",we=[A,M,O,q,E,j,U,N,G,B,z,L,J,H,K,Q,V,$,Z,X,W,Y,ee];var qe="2.26.0";var Ie=(t,e)=>{let{apiKey:r,source:s}=e,o=new URL(t);return o.searchParams.set("jdm_source",s),o.searchParams.set("jdm_version",qe),r&&o.searchParams.set("jdm_api_key",r),o.searchParams.sort(),o.toString()},f=(t,e,r)=>{let s=new URL(t+e);return Ie(s.toString(),r)},te=(t,e)=>{let r=new URL(t+P.click),s=new URL(t+P.impression);return{clickEndpoint:Ie(r.toString(),e),impressionEndpoint:Ie(s.toString(),e)}},ve=class extends Error{response;constructor(e,r){super(e),this.response=r}},Ee=async t=>{if(t.ok){if(t.status===204)return null}else throw new ve("Api Request Failed",t);try{return await t.json()}catch{}},ot=async(t,e)=>{let r=await fetch(t,{body:JSON.stringify(e),headers:{Accept:"application/json","Content-Type":"text/plain"},method:"POST"});return Ee(r)},it=async(t,e={})=>{let{headers:r,...s}=e,o=await fetch(t,{...s,headers:{Accept:"application/json",...r},method:"GET"});return Ee(o)},h={get:it,post:ot};var Ce=require("nanoid");var I=()=>typeof window<"u"&&typeof document<"u";var nt=(...t)=>{console.error("[JaneDmSDK]",...t)},at=(...t)=>{console.info("[JaneDmSDK]",...t)},ct=(...t)=>{console.log("[JaneDmSDK]",...t)},v={error:nt,info:at,log:ct};var dt=t=>{let e=localStorage.getItem(t);return e!==null?mt(e):e},pt=(t,e)=>localStorage.setItem(t,lt(e)),ut=t=>localStorage.removeItem(t),k={get:dt,remove:ut,set:pt},mt=t=>je(t)?t.substring(1,t.length-1):t,lt=t=>je(t)?t:`"${t}"`,je=t=>{let r=t.length-1;return t[0]==='"'&&t[r]==='"'};var ke="j_fp_last_run",Pt=1440*60*1e3,gt=20,xe=new Set,ht=(t,e)=>`${t}:${e.apiKey}:${e.source}`;var ft=t=>typeof t=="object"&&t!==null&&typeof t.token=="string"&&typeof t.endpoint=="string"&&typeof t.scriptUrlPattern=="string",Rt=async(t,e)=>{try{let r=f(t,P.fingerprint,e),s=await h.get(r);return ft(s)?s:null}catch(r){return v.error("Failed to fetch fingerprint token:",r),null}},_t=async(t,e,r,s)=>{try{let o=await import("@fingerprintjs/fingerprintjs-pro"),i=await o.load({apiKey:t,endpoint:[e,o.defaultEndpoint],region:"us",scriptUrlPattern:[r,o.defaultScriptUrlPattern],storageKey:"eyeD"}),a={tag:{isDmSdk:!0}};s?.linkedId&&(a.linkedId=s.linkedId);let c=await i.get(a);return!c||!c.visitorId?(v.error("Fingerprint JS did not return a valid visitorId"),null):{visitorId:c.visitorId}}catch(o){return v.error("Failed to run Fingerprint JS:",o),null}},Ue=async(t,e,r)=>{if(!I())return(0,Ce.nanoid)();let s=k.get("jdid");if(!s)return await Be(t,e,r)??(0,Ce.nanoid)();if(s.length!==gt)return await De(t,e,{linkedId:s}),s;let o=await Ge(t,e,r);if(o)return o;if(Ne()==="error")try{k.set(ke,Date.now().toString())}catch{}return s},Ne=()=>{try{let t=k.get(ke);if(!t)return"missing";let e=parseInt(t,10);return Number.isNaN(e)?"missing":Date.now()-e>=Pt?"expired":"valid"}catch{return"error"}},Ge=async(t,e,r)=>{let s=Ne();return s==="valid"||s==="error"?null:Be(t,e,r)},Be=async(t,e,r)=>{let s=ht(t,e);if(xe.has(s))return null;xe.add(s);try{let o=await Rt(t,e);if(!o)return null;let n=await _t(o.token,o.endpoint,o.scriptUrlPattern,r);if(!n)return null;try{k.set(ke,Date.now().toString())}catch{}return n.visitorId}catch(o){return v.error("Failed to run fingerprint:",o),null}finally{xe.delete(s)}},De=async(t,e,r)=>{if(I()&&r?.linkedId!=="user-opt-out")try{await Ge(t,e,r)}catch(s){v.error("Failed to run SSR fingerprint:",s)}};var y=class t extends Error{constructor(e){super(`[Jane DM SDK]: ${e}`),this.name="SdkError",Object.setPrototypeOf(this,t.prototype)}};var St=new Set(Object.values(T)),Fe=t=>{switch(t){case A:return"best-seller-rank";case M:return"category-and-name-asc";case O:return"default";case q:return"price-asc";case E:return"price-desc";case j:return"price-eighth-ounce-asc";case U:return"price-eighth-ounce-desc";case N:return"price-gram-asc";case G:return"price-gram-desc";case B:return"price-half-gram-asc";case z:return"price-half-gram-desc";case L:return"price-half-ounce-asc";case J:return"price-half-ounce-desc";case H:return"price-ounce-asc";case K:return"price-ounce-desc";case Q:return"price-quarter-ounce-asc";case V:return"price-quarter-ounce-desc";case $:return"price-two-gram-asc";case Z:return"price-two-gram-desc";case X:return"rating";case W:return"recommendation";case Y:return"thc-potency-asc";case ee:return"thc-potency-desc";default:return St.has(t)?t:"default"}};var fe=t=>JSON.parse(t);var Te=class t{isSponsored;objectId;clickPayload;clickUrl;impressPayload;impressUrl;constructor(e){this.objectId=e.objectId,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored}static fromJSON(e){return new t(fe(e))}serialize(){return{clickPayload:this.clickPayload,clickUrl:this.clickUrl,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},x=class t{attributes;isSponsored;objectId;clickPayload;clickUrl;hasBeenImpressed;impressPayload;impressPromise;impressUrl;constructor(e){this.objectId=e.objectId,this.attributes=e.attributes,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored,this.hasBeenImpressed=e.hasBeenImpressed??!1}static fromJSON(e){return new t(fe(e))}click(e={isAddToCart:!1}){let{isAddToCart:r=!1}=e,s={...this.clickPayload,isAddToCart:r};return h.post(this.clickUrl,s)}impress(){return this.hasBeenImpressed?Promise.resolve():(this.impressPromise??=h.post(this.impressUrl,this.impressPayload).then(()=>{this.hasBeenImpressed=!0}).finally(()=>{this.impressPromise=void 0}),this.impressPromise)}serialize(){return{attributes:this.attributes,clickPayload:this.clickPayload,clickUrl:this.clickUrl,hasBeenImpressed:this.hasBeenImpressed,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},D=class t{customImages;placement;products;rowId;searchFacets;title;totalProducts;creativeIds;cachedProducts;config;loadPromise;nextPageProps;nextPageUrl;constructor(e){this.rowId=e.rowId,this.searchFacets=e.searchFacets,this.nextPageUrl=e.nextPageUrl,this.nextPageProps=e.nextPageProps,this.products=e.products.map(r=>new x(r)),this.cachedProducts=e.cachedProducts.map(r=>new Te(r)),this.totalProducts=e.totalProducts,this.title=e.title,this.creativeIds=e.creativeIds,this.config=e.config,this.customImages=e.customImages??[],this.placement=e.placement,I()&&!this.config.skipAutoSmartSortOnLoad&&this.onLoad().catch(r=>v.error("Failed to run onLoad:",r))}static fromJSON(e){return new t(fe(e))}hasNextPage(){return this.cachedProducts.length>0}async nextPage(){if(!this.hasNextPage())return;let e=this.cachedProducts.slice(0,this.nextPageProps.pageSize),r={app_mode:this.config.appMode,jane_device_id:this.config.identifier.jdid,object_ids:e.map(n=>n.objectId),search_attributes:this.nextPageProps.searchAttributes},s=await h.post(this.nextPageUrl,r),o=new Map(s.products?.map(n=>[n.object_id,n.search_attributes]));e.forEach(n=>{let i=o.get(n.objectId);i!==void 0&&this.products.push(new x({...n.serialize(),attributes:i}))}),this.cachedProducts=this.cachedProducts.slice(this.nextPageProps.pageSize)}async onLoad(){return this.loadPromise?this.loadPromise:(this.loadPromise=(async()=>{if(!I())return;let e={apiKey:this.config.apiKey,source:this.config.source};await De(this.config.eventsEndpoint,e,{linkedId:this.config.identifier.jdid})})(),this.loadPromise)}serialize(){return{cachedProducts:this.cachedProducts.map(e=>e.serialize()),config:this.config,creativeIds:this.creativeIds,customImages:this.customImages,nextPageProps:this.nextPageProps,nextPageUrl:this.nextPageUrl,placement:this.placement,products:this.products.map(e=>e.serialize()),rowId:this.rowId,searchFacets:this.searchFacets,title:this.title,totalProducts:this.totalProducts}}toJSON(){return JSON.stringify(this.serialize())}},re=class{async createSmartSort(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=f(e.config.endpoint,P.smart,r),o=f(e.config.pageEndpoint,P.page,r),n=this.buildSmartRequest(e),i=await h.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=te(e.config.eventsEndpoint,r),{creative_ids:g,custom_images:d,products:l,row_id:m,search_facets:u,title:w}=i,{cachedProducts:se,products:oe}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:l}),ie=(d??[]).map(ne=>this.massageCustomImageData(ne)).filter(ne=>ne!==void 0);return new D({cachedProducts:se,config:e.config,creativeIds:g,customImages:ie,nextPageProps:{pageSize:"page_size"in n?n.page_size??60:60,searchAttributes:n.search_attributes??e.searchAttributes},nextPageUrl:o,placement:e.placement,products:oe,rowId:m,searchFacets:u,title:w,totalProducts:i.nb_hits??0})}generateProducts(e){let{clickUrl:r,identifier:s,impressUrl:o,products:n}=e,i={cachedProducts:[],products:[]};return n?.forEach(a=>{let c={clickPayload:{adToken:a.ad_token,distinctId:s.mixpanelDistinctId??s.jdid,isAddToCart:!1,janeDeviceId:s.jdid,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id,storeId:a.store_id},clickUrl:r,impressPayload:{distinctId:s.mixpanelDistinctId??s.jdid,engagements:[{adToken:a.ad_token,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id}],janeDeviceId:s.jdid},impressUrl:o,isSponsored:!!a.flight_id,objectId:a.object_id};a.search_attributes!==void 0?i.products.push({...c,attributes:a.search_attributes}):i.cachedProducts.push(c)}),i}massageCustomImageData(e){if(e)return{headline:e.headline,imageUrl:e.image_url,intendedDisplay:e.intended_display,logoUrl:e.logo_url,overlayColor:e.overlay_color,positionX:e.position_x,positionY:e.position_y,scaleNumber:e.scale_number,textColor:e.text_color}}buildSmartRequest(e){let{config:r,searchAttributes:s,...o}=e,n={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,user_id:r.identifier.userId};switch(o.placement){case"cart_toppers":{let{cartProductIds:i,posCartProductIds:a,storeId:c}=o;return{...n,cart_pos_product_ids:a,cart_product_ids:i,placement:"cart_toppers",store_id:c}}case"custom_image_row":{let{searchFilter:i,storeId:a}=o;return{...n,placement:"custom_image_row",search_filter:i,store_id:a}}case"menu_dynamic_row":{let{adMode:i,filterContext:a,pageContext:c,storeId:g}=o;return{...n,ad_mode:i??"default",filter_context:a,page_context:c,placement:"menu_dynamic_row",store_id:g}}case"menu_inline":{let{adMode:i,distinctByProduct:a,metadata:c,numColumns:g,searchFilter:d,searchQuery:l,searchSort:m,storeId:u,storeIds:w}=o;return{...n,ad_mode:i??"default",distinct_by_product:a,metadata:c,num_columns:g,placement:"menu_inline",search_filter:d,search_query:l,search_sort:Fe(m),store_ids:w||[u]}}case"menu_inline_table":{let{disableAds:i,distinctByProduct:a,maxProducts:c,metadata:g,numColumns:d,pageSize:l,searchFacets:m,searchFilter:u,searchQuery:w,searchSort:se,storeId:oe,storeIds:ie}=o;return{...n,disable_ads:i,distinct_by_product:a,max_products:c,metadata:g,num_columns:d,page_size:l,placement:"menu_inline_table",search_attributes:s,search_facets:m,search_filter:u,search_query:w,search_sort:Fe(se),store_ids:ie||[oe]}}case"menu_top_row":{let{searchFilter:i,storeId:a}=o,c=this.extractValidCreativeIds(e);return{...n,exclude_creative_ids:c,placement:"menu_top_row",search_filter:i,store_id:a}}case"pdp_row":{let{posProductId:i,productId:a,storeId:c}=o;return{...n,placement:"pdp_row",pos_product_id:i,product_id:a,store_id:c}}default:throw new y(`Invalid Smart Sort Placement: ${o.placement}`)}}extractValidCreativeIds(e){if(e.placement==="menu_top_row"&&"excludeCreativeIds"in e&&Array.isArray(e.excludeCreativeIds))return e.excludeCreativeIds.filter(r=>typeof r=="number")}};var bt=t=>t.placement==="specials",yt=t=>t.placement==="brand_specials",ue=class{placement;title;constructor(e){this.title=e,this.placement="brand_specials"}},me=class{placement;title;constructor(e){this.title=e,this.placement="specials"}},Re=class extends re{async createMultiPlacement(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=f(e.config.endpoint,P.multi,r),o=f(e.config.pageEndpoint,P.page,r),n=this.buildMultiRequest(e),i=await h.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=te(e.config.eventsEndpoint,r),g=[];for(let[d,l]of(i.placements||[]).entries())if(bt(l))g.push(new me(l.title));else if(yt(l))g.push(new ue(l.title));else{let{creative_ids:m,custom_images:u,placement:w,products:se,row_id:oe,search_facets:ie,title:ne}=l,{cachedProducts:Ve,products:$e}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:se}),Ze=(u??[]).map(ye=>this.massageCustomImageData(ye)).filter(ye=>ye!==void 0);g.push(new D({cachedProducts:Ve,config:{...e.config,skipAutoSmartSortOnLoad:d===0?e.config.skipAutoSmartSortOnLoad:!0},creativeIds:m,customImages:Ze,nextPageProps:{pageSize:60,searchAttributes:n.search_attributes||[]},nextPageUrl:o,placement:w,products:$e,rowId:oe,searchFacets:ie,title:ne,totalProducts:l.nb_hits??0}))}return g}buildMultiRequest(e){let{config:r,numColumns:s,searchAttributes:o,storeId:n,...i}=e,a={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,num_columns:s,pos_user_id:r.identifier.posUserId,search_attributes:o,store_id:n,user_id:r.identifier.userId};switch(i.multiRequestType){case"custom":return{...a,placements:this.massageCustomPlacements(i.placements),type:"custom"};case"featured":return{...a,exclude_menu_top_row:i.excludeMenuTopRow??!1,type:"featured"};default:throw new y(`Invalid Multi Type: ${i.multiRequestType}`)}}massageCustomPlacements(e){let r=[];for(let s of e)switch(s.placement){case"best_selling":r.push({placement:"best_selling",title:s.title});break;case"brand_specials":r.push({placement:"brand_specials",title:s.title});break;case"buy_again_row":r.push({placement:"buy_again_row",title:s.title});break;case"custom_image_row":r.push({placement:"custom_image_row",search_filter:s.searchFilter});break;case"featured_row":r.push({placement:"featured_row",row_id:s.rowId});break;case"menu_dynamic_row":r.push({ad_mode:s.adMode??"default",filter_context:s.filterContext,page_context:s.pageContext,placement:"menu_dynamic_row"});break;case"menu_inline":r.push({ad_mode:s.adMode??"default",metadata:s.metadata,placement:"menu_inline",search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_inline_table":r.push({disable_ads:s.disableAds,max_products:s.maxProducts,metadata:s.metadata,page_size:s.pageSize,placement:"menu_inline_table",search_facets:s.searchFacets,search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_top_row":r.push({placement:"menu_top_row",search_filter:s.searchFilter});break;case"sale":r.push({placement:"sale",title:s.title});break;case"specials":r.push({placement:"specials",title:s.title});break;default:throw new y(`Invalid Custom Placement: ${s.placement}`)}return r}};var Qe=require("nanoid");var ze=async t=>{let{apiKey:e,appMode:r,endpoint:s,identifier:o,searchFacets:n,searchFilter:i,searchQuery:a,source:c,storeId:g}=t,{jdid:d}=o||{},l=f(s,P.facets,{apiKey:e,source:c}),m={appMode:r,janeDeviceId:d,searchFacets:n,searchFilter:i,searchQuery:a,storeId:g};return(await h.post(l,m)).searchFacets??{}};var Le=async t=>{let{apiKey:e,endpoint:r,identifier:s,source:o,storeId:n,...i}=t,a=f(r,P.externalCheckout,{apiKey:e,source:o}),c={janeDeviceId:s.jdid,posOrderId:i.posOrderId,posUserId:i.posUserId||s.posUserId,products:i.products,storeId:n};return await h.post(a,c)};var _e=class{async create(e){let{config:r,searchAttributes:s,storeId:o,...n}=e,i={apiKey:r.apiKey,source:r.source},a=f(r.endpoint,P.product,i),{clickEndpoint:c,impressionEndpoint:g}=te(r.eventsEndpoint,i),d={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,store_id:o,user_id:r.identifier.userId},l=n.productId!==void 0?{...d,product_id:n.productId}:{...d,pos_product_id:n.posProductId},m=await h.post(a,l);return new x({attributes:m.search_attributes,clickPayload:{adToken:m.ad_token,distinctId:r.identifier.mixpanelDistinctId,isAddToCart:!1,janeDeviceId:r.identifier.jdid,kevelToken:m.kevel_token,myHighD:m.my_high_d,productId:m.product_id,storeId:o},clickUrl:c,impressPayload:{distinctId:r.identifier.mixpanelDistinctId??r.identifier.jdid,engagements:[{adToken:m.ad_token,kevelToken:m.kevel_token,myHighD:m.my_high_d,productId:m.product_id}],janeDeviceId:r.identifier.jdid},impressUrl:g,isSponsored:!!m.flight_id,objectId:m.object_id})}};var wt=t=>({activities:t.activities,avatar:t.avatar,comment:t.comment,createdAt:t.created_at,feelings:t.feelings,hasComment:t.has_comment,id:t.id,nickname:t.nickname,productId:t.product_id,rating:t.rating,storeId:t.store_id,storeName:t.store_name,updatedAt:t.updated_at,upvoteCount:t.upvote_count}),It=t=>({activitiesDistribution:t.activities_distribution,averageRating:t.average_rating,distribution:t.distribution,feelingsDistribution:t.feelings_distribution,reviewCount:t.review_count}),vt=(t,e,r)=>{let s=t.total_count,o=Math.max(1,Math.ceil(s/r));return{aggregate:It(t.aggregate),aiSummary:t.ai_summary,items:t.reviews.map(wt),pagination:{currentPage:e,hasNextPage:e<o,hasPreviousPage:e>1,pageSize:r,totalCount:s,totalPages:o},productId:t.product_id}},Je=async t=>{let{activities:e,config:r,feelings:s,hasComment:o,page:n,pageSize:i,productId:a,ratings:c,sort:g}=t,d=n??1,l=i??50,m=f(r.endpoint,P.productReviews,{apiKey:r.apiKey,source:r.source}),u={activities:e,feelings:s,has_comment:o||void 0,page:n,page_size:i,product_id:a,ratings:c,sort:g},w=await h.post(m,u);return vt(w,d,l)},He=t=>{let e={[Symbol.asyncIterator]:async function*(){let r=1;for(;;){let s=await t(r);if(yield s,!s.pagination.hasNextPage)return;r+=1}}};return{pages:e,[Symbol.asyncIterator]:async function*(){for await(let r of e)yield*r.items}}};var Ke=async t=>{let{apiKey:e,eventsEndpoint:r,identifier:s,source:o,...n}=t,i=f(r,P.sessionEvent,{apiKey:e,source:o}),a={distinctId:s.mixpanelDistinctId,events:n.events,janeDeviceId:s.jdid};return await h.post(i,a)};function S(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...o){return await this.init(),s.apply(this,o)},r}function b(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...o){if(!this.rateLimiter)throw new Error("throttle decorator can only be used on JaneDM class methods");return this.rateLimiter.schedule(async()=>s.apply(this,o))},r}var Se=class{burst;intervalMs;rate;tat=0;toleranceMs;constructor(e,r=1){if(e<=0)throw new y("rate must be > 0");if(r<1)throw new y("burst must be >= 1");this.rate=e,this.burst=Math.floor(r),this.intervalMs=1e3/this.rate,this.toleranceMs=(this.burst-1)*this.intervalMs}async schedule(e){let r=Date.now(),s=Math.max(0,this.tat-this.toleranceMs-r);this.tat=Math.max(this.tat,r)+this.intervalMs;let o=async()=>e();return s>0?new Promise((n,i)=>setTimeout(()=>o().then(n).catch(i),s)):o()}};var xt=/^https?:\/\//,Ct=/^(https?:\/\/)?(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}|localhost)(:\d+)?(\/.*)?$/,be=(t,e)=>{let s=xt.test(t??e)?t??e:`https://${t}`,o=new URL(s);return Ct.test(o.toString())?o.protocol+"//"+o.host:e};var R=class{config;rateLimiter;initialized=!1;multiClient;productClient;smartSortClient;userProvidedJdid=!1;constructor(e,r){let{apiKey:s,endpoint:o,identifier:n}=e,{appMode:i="headless",eventsEndpoint:a,pageEndpoint:c,skipAutoSmartSortOnLoad:g=!1,source:d="sdk"}=r??{},l=be(o,"https://dmerch.iheartjane.com"),m=be(a,l),u=be(c,l);this.userProvidedJdid=!!n?.jdid,this.config={apiKey:s,appMode:i,endpoint:l,eventsEndpoint:m,identifier:n??{jdid:""},pageEndpoint:u,skipAutoSmartSortOnLoad:g,source:d},this.smartSortClient=new re,this.multiClient=new Re,this.productClient=new _e,this.rateLimiter=new Se(10,20)}static generateJaneDeviceId(){return(0,Qe.nanoid)()}async fetchCartTopperRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"cart_toppers"})}async fetchCustomImageRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"custom_image_row"})}async fetchCustomPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"custom",...e})}async fetchFacets(e){return ze({...e,...this.config})}async fetchFeaturedPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"featured",...e})}async fetchMenuRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline"})}async fetchMenuTopRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_top_row"})}async fetchProduct(e){return this.productClient.create({config:this.config,...e})}async fetchProductReviews(e){return Je({config:this.config,...e})}async fetchRecommendedPDPRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"pdp_row"})}async fetchRecommendedRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_dynamic_row"})}async fetchRecommendedSort(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline_table"})}getJaneDeviceId(){return this.config.identifier.jdid}async init(){this.initialized||(I()&&!this.userProvidedJdid&&await this.initializeClientSideJdid(),this.initialized=!0)}iterateProductReviews(e){return He(r=>this.fetchProductReviews({...e,page:r}))}async sendPosCheckout(e){return Le({...e,...this.config})}async sendSessionEvent(e){return Ke({...e,...this.config})}async initializeClientSideJdid(){let e={apiKey:this.config.apiKey,source:this.config.source},r=await Ue(this.config.eventsEndpoint,e);k.set("jdid",r),this.config.identifier.jdid=r}};_([S,b],R.prototype,"fetchCartTopperRow",1),_([S,b],R.prototype,"fetchCustomImageRow",1),_([S,b],R.prototype,"fetchCustomPlacements",1),_([S,b],R.prototype,"fetchFacets",1),_([S,b],R.prototype,"fetchFeaturedPlacements",1),_([S,b],R.prototype,"fetchMenuRow",1),_([S,b],R.prototype,"fetchMenuTopRow",1),_([S,b],R.prototype,"fetchProduct",1),_([S,b],R.prototype,"fetchProductReviews",1),_([S,b],R.prototype,"fetchRecommendedPDPRow",1),_([S,b],R.prototype,"fetchRecommendedRow",1),_([S,b],R.prototype,"fetchRecommendedSort",1);0&&(module.exports={AdMode,AppMode,BrandSpecials,DEFAULT_PAGE_SIZE,IntendedDisplay,JaneDM,JaneDeviceIdSentinel,PageContextEnum,Placement,ProductKindEnum,ReviewSortEnum,SearchSortEnum,SmartSort,SmartSortProduct,Specials,bestSellerRank,categoryAndNameAsc,defaultOrder,priceAsc,priceDesc,priceEighthOunceAsc,priceEighthOunceDesc,priceGramAsc,priceGramDesc,priceHalfGramAsc,priceHalfGramDesc,priceHalfOunceAsc,priceHalfOunceDesc,priceOunceAsc,priceOunceDesc,priceQuarterOunceAsc,priceQuarterOunceDesc,priceTwoGramAsc,priceTwoGramDesc,rating,recommendation,searchSorts,thcPotencyAsc,thcPotencyDesc});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Placement, A as AdMode, F as FilterContext, a as PageContextEnum, S as SearchSortEnum, C as CustomImageData, b as SmartSortProductProps, c as SmartSortClickIntent, d as SmartSortProps, e as ConversionExternalProduct, f as SessionEvent, R as RequiredConfig, J as JaneDMPublicConfig, g as JaneDMInternalConfig, h as FetchCartTopperRowProps, i as FetchCustomImageRowProps, j as Facets, k as FetchMenuRowProps, l as FetchMenuTopRowProps, m as FetchProductReviewsProps, n as ProductReviewsResponse, o as FetchRecommendedPDPRowProps, p as FetchRecommendedRowProps, q as FetchRecommendedSortProps, I as IterateProductReviewsProps, r as ProductReviewsIterable } from './smartSort-
|
|
2
|
-
export { s as AppMode, D as DEFAULT_PAGE_SIZE, t as FetchCartTopperRowByPosProductId, u as FetchCartTopperRowByProductProps, v as FetchRecommendedPDPRowByPosProductId, w as FetchRecommendedPDPRowByProductId, x as IntendedDisplay, y as JaneDMConfig, z as JaneDMIdentifiers, B as JaneDeviceIdSentinel, E as PaginationInfo, G as ProductKindEnum, H as ProductReview, K as ProductReviewsAggregate, L as ReviewSortEnum, M as SearchSort, N as SmartSortNextPageProps, O as bestSellerRank, Q as categoryAndNameAsc, T as defaultOrder, U as priceAsc, V as priceDesc, W as priceEighthOunceAsc, X as priceEighthOunceDesc, Y as priceGramAsc, Z as priceGramDesc, _ as priceHalfGramAsc, $ as priceHalfGramDesc, a0 as priceHalfOunceAsc, a1 as priceHalfOunceDesc, a2 as priceOunceAsc, a3 as priceOunceDesc, a4 as priceQuarterOunceAsc, a5 as priceQuarterOunceDesc, a6 as priceTwoGramAsc, a7 as priceTwoGramDesc, a8 as rating, a9 as recommendation, aa as searchSorts, ab as thcPotencyAsc, ac as thcPotencyDesc } from './smartSort-
|
|
1
|
+
import { P as Placement, A as AdMode, F as FilterContext, a as PageContextEnum, S as SearchSortEnum, C as CustomImageData, b as SmartSortProductProps, c as SmartSortClickIntent, d as SmartSortProps, e as ConversionExternalProduct, f as SessionEvent, R as RequiredConfig, J as JaneDMPublicConfig, g as JaneDMInternalConfig, h as FetchCartTopperRowProps, i as FetchCustomImageRowProps, j as Facets, k as FetchMenuRowProps, l as FetchMenuTopRowProps, m as FetchProductReviewsProps, n as ProductReviewsResponse, o as FetchRecommendedPDPRowProps, p as FetchRecommendedRowProps, q as FetchRecommendedSortProps, I as IterateProductReviewsProps, r as ProductReviewsIterable } from './smartSort-C7l2wPes.cjs';
|
|
2
|
+
export { s as AppMode, D as DEFAULT_PAGE_SIZE, t as FetchCartTopperRowByPosProductId, u as FetchCartTopperRowByProductProps, v as FetchRecommendedPDPRowByPosProductId, w as FetchRecommendedPDPRowByProductId, x as IntendedDisplay, y as JaneDMConfig, z as JaneDMIdentifiers, B as JaneDeviceIdSentinel, E as PaginationInfo, G as ProductKindEnum, H as ProductReview, K as ProductReviewsAggregate, L as ReviewSortEnum, M as SearchSort, N as SmartSortNextPageProps, O as bestSellerRank, Q as categoryAndNameAsc, T as defaultOrder, U as priceAsc, V as priceDesc, W as priceEighthOunceAsc, X as priceEighthOunceDesc, Y as priceGramAsc, Z as priceGramDesc, _ as priceHalfGramAsc, $ as priceHalfGramDesc, a0 as priceHalfOunceAsc, a1 as priceHalfOunceDesc, a2 as priceOunceAsc, a3 as priceOunceDesc, a4 as priceQuarterOunceAsc, a5 as priceQuarterOunceDesc, a6 as priceTwoGramAsc, a7 as priceTwoGramDesc, a8 as rating, a9 as recommendation, aa as searchSorts, ab as thcPotencyAsc, ac as thcPotencyDesc } from './smartSort-C7l2wPes.cjs';
|
|
3
3
|
|
|
4
4
|
interface CustomBestSellingProps {
|
|
5
5
|
placement: Placement.BestSelling;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as Placement, A as AdMode, F as FilterContext, a as PageContextEnum, S as SearchSortEnum, C as CustomImageData, b as SmartSortProductProps, c as SmartSortClickIntent, d as SmartSortProps, e as ConversionExternalProduct, f as SessionEvent, R as RequiredConfig, J as JaneDMPublicConfig, g as JaneDMInternalConfig, h as FetchCartTopperRowProps, i as FetchCustomImageRowProps, j as Facets, k as FetchMenuRowProps, l as FetchMenuTopRowProps, m as FetchProductReviewsProps, n as ProductReviewsResponse, o as FetchRecommendedPDPRowProps, p as FetchRecommendedRowProps, q as FetchRecommendedSortProps, I as IterateProductReviewsProps, r as ProductReviewsIterable } from './smartSort-
|
|
2
|
-
export { s as AppMode, D as DEFAULT_PAGE_SIZE, t as FetchCartTopperRowByPosProductId, u as FetchCartTopperRowByProductProps, v as FetchRecommendedPDPRowByPosProductId, w as FetchRecommendedPDPRowByProductId, x as IntendedDisplay, y as JaneDMConfig, z as JaneDMIdentifiers, B as JaneDeviceIdSentinel, E as PaginationInfo, G as ProductKindEnum, H as ProductReview, K as ProductReviewsAggregate, L as ReviewSortEnum, M as SearchSort, N as SmartSortNextPageProps, O as bestSellerRank, Q as categoryAndNameAsc, T as defaultOrder, U as priceAsc, V as priceDesc, W as priceEighthOunceAsc, X as priceEighthOunceDesc, Y as priceGramAsc, Z as priceGramDesc, _ as priceHalfGramAsc, $ as priceHalfGramDesc, a0 as priceHalfOunceAsc, a1 as priceHalfOunceDesc, a2 as priceOunceAsc, a3 as priceOunceDesc, a4 as priceQuarterOunceAsc, a5 as priceQuarterOunceDesc, a6 as priceTwoGramAsc, a7 as priceTwoGramDesc, a8 as rating, a9 as recommendation, aa as searchSorts, ab as thcPotencyAsc, ac as thcPotencyDesc } from './smartSort-
|
|
1
|
+
import { P as Placement, A as AdMode, F as FilterContext, a as PageContextEnum, S as SearchSortEnum, C as CustomImageData, b as SmartSortProductProps, c as SmartSortClickIntent, d as SmartSortProps, e as ConversionExternalProduct, f as SessionEvent, R as RequiredConfig, J as JaneDMPublicConfig, g as JaneDMInternalConfig, h as FetchCartTopperRowProps, i as FetchCustomImageRowProps, j as Facets, k as FetchMenuRowProps, l as FetchMenuTopRowProps, m as FetchProductReviewsProps, n as ProductReviewsResponse, o as FetchRecommendedPDPRowProps, p as FetchRecommendedRowProps, q as FetchRecommendedSortProps, I as IterateProductReviewsProps, r as ProductReviewsIterable } from './smartSort-C7l2wPes.js';
|
|
2
|
+
export { s as AppMode, D as DEFAULT_PAGE_SIZE, t as FetchCartTopperRowByPosProductId, u as FetchCartTopperRowByProductProps, v as FetchRecommendedPDPRowByPosProductId, w as FetchRecommendedPDPRowByProductId, x as IntendedDisplay, y as JaneDMConfig, z as JaneDMIdentifiers, B as JaneDeviceIdSentinel, E as PaginationInfo, G as ProductKindEnum, H as ProductReview, K as ProductReviewsAggregate, L as ReviewSortEnum, M as SearchSort, N as SmartSortNextPageProps, O as bestSellerRank, Q as categoryAndNameAsc, T as defaultOrder, U as priceAsc, V as priceDesc, W as priceEighthOunceAsc, X as priceEighthOunceDesc, Y as priceGramAsc, Z as priceGramDesc, _ as priceHalfGramAsc, $ as priceHalfGramDesc, a0 as priceHalfOunceAsc, a1 as priceHalfOunceDesc, a2 as priceOunceAsc, a3 as priceOunceDesc, a4 as priceQuarterOunceAsc, a5 as priceQuarterOunceDesc, a6 as priceTwoGramAsc, a7 as priceTwoGramDesc, a8 as rating, a9 as recommendation, aa as searchSorts, ab as thcPotencyAsc, ac as thcPotencyDesc } from './smartSort-C7l2wPes.js';
|
|
3
3
|
|
|
4
4
|
interface CustomBestSellingProps {
|
|
5
5
|
placement: Placement.BestSelling;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as oe,B as ne,C as ae,D as ce,E as de,F as ue,G as pe,H as me,I as le,J as Je,a as f,b as p,c as L,d as Ie,e as ze,f as we,g as Ge,h as A,i as Ke,j as Le,k as be,l as J,m as B,n as H,o as Q,p as V,q as $,r as Z,s as X,t as Y,u as W,v as ee,w as te,x as re,y as se,z as ie}from"./chunk-TGCEYA6I.js";var ve="2.25.0";var he=(t,e)=>{let{apiKey:r,source:s}=e,i=new URL(t);return i.searchParams.set("jdm_source",s),i.searchParams.set("jdm_version",ve),r&&i.searchParams.set("jdm_api_key",r),i.searchParams.sort(),i.toString()},h=(t,e,r)=>{let s=new URL(t+e);return he(s.toString(),r)},k=(t,e)=>{let r=new URL(t+p.click),s=new URL(t+p.impression);return{clickEndpoint:he(r.toString(),e),impressionEndpoint:he(s.toString(),e)}},Pe=class extends Error{response;constructor(e,r){super(e),this.response=r}},_e=async t=>{if(t.ok){if(t.status===204)return null}else throw new Pe("Api Request Failed",t);try{return await t.json()}catch{}},Be=async(t,e)=>{let r=await fetch(t,{body:JSON.stringify(e),headers:{Accept:"application/json","Content-Type":"text/plain"},method:"POST"});return _e(r)},He=async(t,e={})=>{let{headers:r,...s}=e,i=await fetch(t,{...s,headers:{Accept:"application/json",...r},method:"GET"});return _e(i)},l={get:He,post:Be};import{nanoid as ke}from"nanoid";var b=()=>typeof window<"u"&&typeof document<"u";var Qe=(...t)=>{console.error("[JaneDmSDK]",...t)},Ve=(...t)=>{console.info("[JaneDmSDK]",...t)},$e=(...t)=>{console.log("[JaneDmSDK]",...t)},v={error:Qe,info:Ve,log:$e};var Ze=t=>{let e=localStorage.getItem(t);return e!==null?We(e):e},Xe=(t,e)=>localStorage.setItem(t,et(e)),Ye=t=>localStorage.removeItem(t),_={get:Ze,remove:Ye,set:Xe},We=t=>Ce(t)?t.substring(1,t.length-1):t,et=t=>Ce(t)?t:`"${t}"`,Ce=t=>{let r=t.length-1;return t[0]==='"'&&t[r]==='"'};var fe="j_fp_last_run",tt=1440*60*1e3,rt=20,ge=new Set,st=(t,e)=>`${t}:${e.apiKey}:${e.source}`;var it=t=>typeof t=="object"&&t!==null&&typeof t.token=="string"&&typeof t.endpoint=="string"&&typeof t.scriptUrlPattern=="string",ot=async(t,e)=>{try{let r=h(t,p.fingerprint,e),s=await l.get(r);return it(s)?s:null}catch(r){return v.error("Failed to fetch fingerprint token:",r),null}},nt=async(t,e,r,s)=>{try{let i=await import("@fingerprintjs/fingerprintjs-pro"),o=await i.load({apiKey:t,endpoint:[e,i.defaultEndpoint],region:"us",scriptUrlPattern:[r,i.defaultScriptUrlPattern],storageKey:"eyeD"}),a={tag:{isDmSdk:!0}};s?.linkedId&&(a.linkedId=s.linkedId);let c=await o.get(a);return!c||!c.visitorId?(v.error("Fingerprint JS did not return a valid visitorId"),null):{visitorId:c.visitorId}}catch(i){return v.error("Failed to run Fingerprint JS:",i),null}},xe=async(t,e,r)=>{if(!b())return ke();let s=_.get("jdid");if(!s)return await Ee(t,e,r)??ke();if(s.length!==rt)return await Se(t,e,{linkedId:s}),s;let i=await De(t,e,r);if(i)return i;if(Fe()==="error")try{_.set(fe,Date.now().toString())}catch{}return s},Fe=()=>{try{let t=_.get(fe);if(!t)return"missing";let e=parseInt(t,10);return Number.isNaN(e)?"missing":Date.now()-e>=tt?"expired":"valid"}catch{return"error"}},De=async(t,e,r)=>{let s=Fe();return s==="valid"||s==="error"?null:Ee(t,e,r)},Ee=async(t,e,r)=>{let s=st(t,e);if(ge.has(s))return null;ge.add(s);try{let i=await ot(t,e);if(!i)return null;let n=await nt(i.token,i.endpoint,i.scriptUrlPattern,r);if(!n)return null;try{_.set(fe,Date.now().toString())}catch{}return n.visitorId}catch(i){return v.error("Failed to run fingerprint:",i),null}finally{ge.delete(s)}},Se=async(t,e,r)=>{if(b()&&r?.linkedId!=="user-opt-out")try{await De(t,e,r)}catch(s){v.error("Failed to run SSR fingerprint:",s)}};var I=class t extends Error{constructor(e){super(`[Jane DM SDK]: ${e}`),this.name="SdkError",Object.setPrototypeOf(this,t.prototype)}};var Re=t=>{switch(t){case B:return"best-seller-rank";case H:return"category-and-name-asc";case V:return"price-asc";case $:return"price-desc";case Z:return"price-eighth-ounce-asc";case X:return"price-eighth-ounce-desc";case Y:return"price-gram-asc";case W:return"price-gram-desc";case ee:return"price-half-gram-asc";case te:return"price-half-gram-desc";case re:return"price-half-ounce-asc";case se:return"price-half-ounce-desc";case ie:return"price-ounce-asc";case oe:return"price-ounce-desc";case ne:return"price-quarter-ounce-asc";case ae:return"price-quarter-ounce-desc";case ce:return"price-two-gram-asc";case de:return"price-two-gram-desc";case ue:return"rating";case pe:return"recommendation";case me:return"thc-potency-asc";case le:return"thc-potency-desc";case Q:default:return"default"}};var O=t=>JSON.parse(t);var ye=class t{isSponsored;objectId;clickPayload;clickUrl;impressPayload;impressUrl;constructor(e){this.objectId=e.objectId,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored}static fromJSON(e){return new t(O(e))}serialize(){return{clickPayload:this.clickPayload,clickUrl:this.clickUrl,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},C=class t{attributes;isSponsored;objectId;clickPayload;clickUrl;hasBeenImpressed;impressPayload;impressPromise;impressUrl;constructor(e){this.objectId=e.objectId,this.attributes=e.attributes,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored,this.hasBeenImpressed=e.hasBeenImpressed??!1}static fromJSON(e){return new t(O(e))}click(e={isAddToCart:!1}){let{isAddToCart:r=!1}=e,s={...this.clickPayload,isAddToCart:r};return l.post(this.clickUrl,s)}impress(){return this.hasBeenImpressed?Promise.resolve():(this.impressPromise??=l.post(this.impressUrl,this.impressPayload).then(()=>{this.hasBeenImpressed=!0}).finally(()=>{this.impressPromise=void 0}),this.impressPromise)}serialize(){return{attributes:this.attributes,clickPayload:this.clickPayload,clickUrl:this.clickUrl,hasBeenImpressed:this.hasBeenImpressed,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},x=class t{customImages;placement;products;rowId;searchFacets;title;totalProducts;creativeIds;cachedProducts;config;loadPromise;nextPageProps;nextPageUrl;constructor(e){this.rowId=e.rowId,this.searchFacets=e.searchFacets,this.nextPageUrl=e.nextPageUrl,this.nextPageProps=e.nextPageProps,this.products=e.products.map(r=>new C(r)),this.cachedProducts=e.cachedProducts.map(r=>new ye(r)),this.totalProducts=e.totalProducts,this.title=e.title,this.creativeIds=e.creativeIds,this.config=e.config,this.customImages=e.customImages??[],this.placement=e.placement,b()&&!this.config.skipAutoSmartSortOnLoad&&this.onLoad().catch(r=>v.error("Failed to run onLoad:",r))}static fromJSON(e){return new t(O(e))}hasNextPage(){return this.cachedProducts.length>0}async nextPage(){if(!this.hasNextPage())return;let e=this.cachedProducts.slice(0,this.nextPageProps.pageSize),r={app_mode:this.config.appMode,jane_device_id:this.config.identifier.jdid,object_ids:e.map(n=>n.objectId),search_attributes:this.nextPageProps.searchAttributes},s=await l.post(this.nextPageUrl,r),i=new Map(s.products?.map(n=>[n.object_id,n.search_attributes]));e.forEach(n=>{let o=i.get(n.objectId);o!==void 0&&this.products.push(new C({...n.serialize(),attributes:o}))}),this.cachedProducts=this.cachedProducts.slice(this.nextPageProps.pageSize)}async onLoad(){return this.loadPromise?this.loadPromise:(this.loadPromise=(async()=>{if(!b())return;let e={apiKey:this.config.apiKey,source:this.config.source};await Se(this.config.eventsEndpoint,e,{linkedId:this.config.identifier.jdid})})(),this.loadPromise)}serialize(){return{cachedProducts:this.cachedProducts.map(e=>e.serialize()),config:this.config,creativeIds:this.creativeIds,customImages:this.customImages,nextPageProps:this.nextPageProps,nextPageUrl:this.nextPageUrl,placement:this.placement,products:this.products.map(e=>e.serialize()),rowId:this.rowId,searchFacets:this.searchFacets,title:this.title,totalProducts:this.totalProducts}}toJSON(){return JSON.stringify(this.serialize())}},F=class{async createSmartSort(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=h(e.config.endpoint,p.smart,r),i=h(e.config.pageEndpoint,p.page,r),n=this.buildSmartRequest(e),o=await l.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=k(e.config.eventsEndpoint,r),{creative_ids:m,custom_images:P,products:u,row_id:d,search_facets:y,title:w}=o,{cachedProducts:D,products:E}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:u}),T=(P??[]).map(M=>this.massageCustomImageData(M)).filter(M=>M!==void 0);return new x({cachedProducts:D,config:e.config,creativeIds:m,customImages:T,nextPageProps:{pageSize:"page_size"in n?n.page_size??60:60,searchAttributes:n.search_attributes??e.searchAttributes},nextPageUrl:i,placement:e.placement,products:E,rowId:d,searchFacets:y,title:w,totalProducts:o.nb_hits??0})}generateProducts(e){let{clickUrl:r,identifier:s,impressUrl:i,products:n}=e,o={cachedProducts:[],products:[]};return n?.forEach(a=>{let c={clickPayload:{adToken:a.ad_token,distinctId:s.mixpanelDistinctId??s.jdid,isAddToCart:!1,janeDeviceId:s.jdid,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id,storeId:a.store_id},clickUrl:r,impressPayload:{distinctId:s.mixpanelDistinctId??s.jdid,engagements:[{adToken:a.ad_token,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id}],janeDeviceId:s.jdid},impressUrl:i,isSponsored:!!a.flight_id,objectId:a.object_id};a.search_attributes!==void 0?o.products.push({...c,attributes:a.search_attributes}):o.cachedProducts.push(c)}),o}massageCustomImageData(e){if(e)return{headline:e.headline,imageUrl:e.image_url,intendedDisplay:e.intended_display,logoUrl:e.logo_url,overlayColor:e.overlay_color,positionX:e.position_x,positionY:e.position_y,scaleNumber:e.scale_number,textColor:e.text_color}}buildSmartRequest(e){let{config:r,searchAttributes:s,...i}=e,n={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,user_id:r.identifier.userId};switch(i.placement){case"cart_toppers":{let{cartProductIds:o,posCartProductIds:a,storeId:c}=i;return{...n,cart_pos_product_ids:a,cart_product_ids:o,placement:"cart_toppers",store_id:c}}case"custom_image_row":{let{searchFilter:o,storeId:a}=i;return{...n,placement:"custom_image_row",search_filter:o,store_id:a}}case"menu_dynamic_row":{let{adMode:o,filterContext:a,pageContext:c,storeId:m}=i;return{...n,ad_mode:o??"default",filter_context:a,page_context:c,placement:"menu_dynamic_row",store_id:m}}case"menu_inline":{let{adMode:o,distinctByProduct:a,metadata:c,numColumns:m,searchFilter:P,searchQuery:u,searchSort:d,storeId:y,storeIds:w}=i;return{...n,ad_mode:o??"default",distinct_by_product:a,metadata:c,num_columns:m,placement:"menu_inline",search_filter:P,search_query:u,search_sort:Re(d),store_ids:w||[y]}}case"menu_inline_table":{let{disableAds:o,distinctByProduct:a,maxProducts:c,metadata:m,numColumns:P,pageSize:u,searchFacets:d,searchFilter:y,searchQuery:w,searchSort:D,storeId:E,storeIds:T}=i;return{...n,disable_ads:o,distinct_by_product:a,max_products:c,metadata:m,num_columns:P,page_size:u,placement:"menu_inline_table",search_attributes:s,search_facets:d,search_filter:y,search_query:w,search_sort:Re(D),store_ids:T||[E]}}case"menu_top_row":{let{searchFilter:o,storeId:a}=i,c=this.extractValidCreativeIds(e);return{...n,exclude_creative_ids:c,placement:"menu_top_row",search_filter:o,store_id:a}}case"pdp_row":{let{posProductId:o,productId:a,storeId:c}=i;return{...n,placement:"pdp_row",pos_product_id:o,product_id:a,store_id:c}}default:throw new I(`Invalid Smart Sort Placement: ${i.placement}`)}}extractValidCreativeIds(e){if(e.placement==="menu_top_row"&&"excludeCreativeIds"in e&&Array.isArray(e.excludeCreativeIds))return e.excludeCreativeIds.filter(r=>typeof r=="number")}};var ct=t=>t.placement==="specials",dt=t=>t.placement==="brand_specials",j=class{placement;title;constructor(e){this.title=e,this.placement="brand_specials"}},U=class{placement;title;constructor(e){this.title=e,this.placement="specials"}},q=class extends F{async createMultiPlacement(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=h(e.config.endpoint,p.multi,r),i=h(e.config.pageEndpoint,p.page,r),n=this.buildMultiRequest(e),o=await l.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=k(e.config.eventsEndpoint,r),m=[];for(let[P,u]of(o.placements||[]).entries())if(ct(u))m.push(new U(u.title));else if(dt(u))m.push(new j(u.title));else{let{creative_ids:d,custom_images:y,placement:w,products:D,row_id:E,search_facets:T,title:M}=u,{cachedProducts:Ue,products:qe}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:D}),Ne=(y??[]).map(K=>this.massageCustomImageData(K)).filter(K=>K!==void 0);m.push(new x({cachedProducts:Ue,config:{...e.config,skipAutoSmartSortOnLoad:P===0?e.config.skipAutoSmartSortOnLoad:!0},creativeIds:d,customImages:Ne,nextPageProps:{pageSize:60,searchAttributes:n.search_attributes||[]},nextPageUrl:i,placement:w,products:qe,rowId:E,searchFacets:T,title:M,totalProducts:u.nb_hits??0}))}return m}buildMultiRequest(e){let{config:r,numColumns:s,searchAttributes:i,storeId:n,...o}=e,a={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,num_columns:s,pos_user_id:r.identifier.posUserId,search_attributes:i,store_id:n,user_id:r.identifier.userId};switch(o.multiRequestType){case"custom":return{...a,placements:this.massageCustomPlacements(o.placements),type:"custom"};case"featured":return{...a,exclude_menu_top_row:o.excludeMenuTopRow??!1,type:"featured"};default:throw new I(`Invalid Multi Type: ${o.multiRequestType}`)}}massageCustomPlacements(e){let r=[];for(let s of e)switch(s.placement){case"best_selling":r.push({placement:"best_selling",title:s.title});break;case"brand_specials":r.push({placement:"brand_specials",title:s.title});break;case"buy_again_row":r.push({placement:"buy_again_row",title:s.title});break;case"custom_image_row":r.push({placement:"custom_image_row",search_filter:s.searchFilter});break;case"featured_row":r.push({placement:"featured_row",row_id:s.rowId});break;case"menu_dynamic_row":r.push({ad_mode:s.adMode??"default",filter_context:s.filterContext,page_context:s.pageContext,placement:"menu_dynamic_row"});break;case"menu_inline":r.push({ad_mode:s.adMode??"default",metadata:s.metadata,placement:"menu_inline",search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_inline_table":r.push({disable_ads:s.disableAds,max_products:s.maxProducts,metadata:s.metadata,page_size:s.pageSize,placement:"menu_inline_table",search_facets:s.searchFacets,search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_top_row":r.push({placement:"menu_top_row",search_filter:s.searchFilter});break;case"sale":r.push({placement:"sale",title:s.title});break;case"specials":r.push({placement:"specials",title:s.title});break;default:throw new I(`Invalid Custom Placement: ${s.placement}`)}return r}};import{nanoid as Pt}from"nanoid";var Te=async t=>{let{apiKey:e,appMode:r,endpoint:s,identifier:i,searchFacets:n,searchFilter:o,searchQuery:a,source:c,storeId:m}=t,{jdid:P}=i||{},u=h(s,p.facets,{apiKey:e,source:c}),d={appMode:r,janeDeviceId:P,searchFacets:n,searchFilter:o,searchQuery:a,storeId:m};return(await l.post(u,d)).searchFacets??{}};var Me=async t=>{let{apiKey:e,endpoint:r,identifier:s,source:i,storeId:n,...o}=t,a=h(r,p.externalCheckout,{apiKey:e,source:i}),c={janeDeviceId:s.jdid,posOrderId:o.posOrderId,posUserId:o.posUserId||s.posUserId,products:o.products,storeId:n};return await l.post(a,c)};var N=class{async create(e){let{config:r,searchAttributes:s,storeId:i,...n}=e,o={apiKey:r.apiKey,source:r.source},a=h(r.endpoint,p.product,o),{clickEndpoint:c,impressionEndpoint:m}=k(r.eventsEndpoint,o),P={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,store_id:i,user_id:r.identifier.userId},u=n.productId!==void 0?{...P,product_id:n.productId}:{...P,pos_product_id:n.posProductId},d=await l.post(a,u);return new C({attributes:d.search_attributes,clickPayload:{adToken:d.ad_token,distinctId:r.identifier.mixpanelDistinctId,isAddToCart:!1,janeDeviceId:r.identifier.jdid,kevelToken:d.kevel_token,myHighD:d.my_high_d,productId:d.product_id,storeId:i},clickUrl:c,impressPayload:{distinctId:r.identifier.mixpanelDistinctId??r.identifier.jdid,engagements:[{adToken:d.ad_token,kevelToken:d.kevel_token,myHighD:d.my_high_d,productId:d.product_id}],janeDeviceId:r.identifier.jdid},impressUrl:m,isSponsored:!!d.flight_id,objectId:d.object_id})}};var ut=t=>({activities:t.activities,avatar:t.avatar,comment:t.comment,createdAt:t.created_at,feelings:t.feelings,hasComment:t.has_comment,id:t.id,nickname:t.nickname,productId:t.product_id,rating:t.rating,storeId:t.store_id,storeName:t.store_name,updatedAt:t.updated_at,upvoteCount:t.upvote_count}),pt=t=>({activitiesDistribution:t.activities_distribution,averageRating:t.average_rating,distribution:t.distribution,feelingsDistribution:t.feelings_distribution,reviewCount:t.review_count}),mt=(t,e,r)=>{let s=t.total_count,i=Math.max(1,Math.ceil(s/r));return{aggregate:pt(t.aggregate),aiSummary:t.ai_summary,items:t.reviews.map(ut),pagination:{currentPage:e,hasNextPage:e<i,hasPreviousPage:e>1,pageSize:r,totalCount:s,totalPages:i},productId:t.product_id}},Ae=async t=>{let{activities:e,config:r,feelings:s,hasComment:i,page:n,pageSize:o,productId:a,ratings:c,sort:m}=t,P=n??1,u=o??50,d=h(r.endpoint,p.productReviews,{apiKey:r.apiKey,source:r.source}),y={activities:e,feelings:s,has_comment:i||void 0,page:n,page_size:o,product_id:a,ratings:c,sort:m},w=await l.post(d,y);return mt(w,P,u)},Oe=t=>{let e={[Symbol.asyncIterator]:async function*(){let r=1;for(;;){let s=await t(r);if(yield s,!s.pagination.hasNextPage)return;r+=1}}};return{pages:e,[Symbol.asyncIterator]:async function*(){for await(let r of e)yield*r.items}}};var je=async t=>{let{apiKey:e,eventsEndpoint:r,identifier:s,source:i,...n}=t,o=h(r,p.sessionEvent,{apiKey:e,source:i}),a={distinctId:s.mixpanelDistinctId,events:n.events,janeDeviceId:s.jdid};return await l.post(o,a)};function S(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...i){return await this.init(),s.apply(this,i)},r}function R(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...i){if(!this.rateLimiter)throw new Error("throttle decorator can only be used on JaneDM class methods");return this.rateLimiter.schedule(async()=>s.apply(this,i))},r}var z=class{burst;intervalMs;rate;tat=0;toleranceMs;constructor(e,r=1){if(e<=0)throw new I("rate must be > 0");if(r<1)throw new I("burst must be >= 1");this.rate=e,this.burst=Math.floor(r),this.intervalMs=1e3/this.rate,this.toleranceMs=(this.burst-1)*this.intervalMs}async schedule(e){let r=Date.now(),s=Math.max(0,this.tat-this.toleranceMs-r);this.tat=Math.max(this.tat,r)+this.intervalMs;let i=async()=>e();return s>0?new Promise((n,o)=>setTimeout(()=>i().then(n).catch(o),s)):i()}};var lt=/^https?:\/\//,ht=/^(https?:\/\/)?(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}|localhost)(:\d+)?(\/.*)?$/,G=(t,e)=>{let s=lt.test(t??e)?t??e:`https://${t}`,i=new URL(s);return ht.test(i.toString())?i.protocol+"//"+i.host:e};var g=class{config;rateLimiter;initialized=!1;multiClient;productClient;smartSortClient;userProvidedJdid=!1;constructor(e,r){let{apiKey:s,endpoint:i,identifier:n}=e,{appMode:o="headless",eventsEndpoint:a,pageEndpoint:c,skipAutoSmartSortOnLoad:m=!1,source:P="sdk"}=r??{},u=G(i,"https://dmerch.iheartjane.com"),d=G(a,u),y=G(c,u);this.userProvidedJdid=!!n?.jdid,this.config={apiKey:s,appMode:o,endpoint:u,eventsEndpoint:d,identifier:n??{jdid:""},pageEndpoint:y,skipAutoSmartSortOnLoad:m,source:P},this.smartSortClient=new F,this.multiClient=new q,this.productClient=new N,this.rateLimiter=new z(10,20)}static generateJaneDeviceId(){return Pt()}async fetchCartTopperRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"cart_toppers"})}async fetchCustomImageRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"custom_image_row"})}async fetchCustomPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"custom",...e})}async fetchFacets(e){return Te({...e,...this.config})}async fetchFeaturedPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"featured",...e})}async fetchMenuRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline"})}async fetchMenuTopRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_top_row"})}async fetchProduct(e){return this.productClient.create({config:this.config,...e})}async fetchProductReviews(e){return Ae({config:this.config,...e})}async fetchRecommendedPDPRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"pdp_row"})}async fetchRecommendedRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_dynamic_row"})}async fetchRecommendedSort(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline_table"})}getJaneDeviceId(){return this.config.identifier.jdid}async init(){this.initialized||(b()&&!this.userProvidedJdid&&await this.initializeClientSideJdid(),this.initialized=!0)}iterateProductReviews(e){return Oe(r=>this.fetchProductReviews({...e,page:r}))}async sendPosCheckout(e){return Me({...e,...this.config})}async sendSessionEvent(e){return je({...e,...this.config})}async initializeClientSideJdid(){let e={apiKey:this.config.apiKey,source:this.config.source},r=await xe(this.config.eventsEndpoint,e);_.set("jdid",r),this.config.identifier.jdid=r}};f([S,R],g.prototype,"fetchCartTopperRow",1),f([S,R],g.prototype,"fetchCustomImageRow",1),f([S,R],g.prototype,"fetchCustomPlacements",1),f([S,R],g.prototype,"fetchFacets",1),f([S,R],g.prototype,"fetchFeaturedPlacements",1),f([S,R],g.prototype,"fetchMenuRow",1),f([S,R],g.prototype,"fetchMenuTopRow",1),f([S,R],g.prototype,"fetchProduct",1),f([S,R],g.prototype,"fetchProductReviews",1),f([S,R],g.prototype,"fetchRecommendedPDPRow",1),f([S,R],g.prototype,"fetchRecommendedRow",1),f([S,R],g.prototype,"fetchRecommendedSort",1);export{L as AdMode,Ie as AppMode,j as BrandSpecials,J as DEFAULT_PAGE_SIZE,ze as IntendedDisplay,g as JaneDM,we as JaneDeviceIdSentinel,Ge as PageContextEnum,A as Placement,Ke as ProductKindEnum,Le as ReviewSortEnum,be as SearchSortEnum,x as SmartSort,C as SmartSortProduct,U as Specials,B as bestSellerRank,H as categoryAndNameAsc,Q as defaultOrder,V as priceAsc,$ as priceDesc,Z as priceEighthOunceAsc,X as priceEighthOunceDesc,Y as priceGramAsc,W as priceGramDesc,ee as priceHalfGramAsc,te as priceHalfGramDesc,re as priceHalfOunceAsc,se as priceHalfOunceDesc,ie as priceOunceAsc,oe as priceOunceDesc,ne as priceQuarterOunceAsc,ae as priceQuarterOunceDesc,ce as priceTwoGramAsc,de as priceTwoGramDesc,ue as rating,pe as recommendation,Je as searchSorts,me as thcPotencyAsc,le as thcPotencyDesc};
|
|
1
|
+
import{A as ne,B as ae,C as ce,D as de,E as ue,F as pe,G as me,H as le,I as he,J as Je,a as f,b as p,c as L,d as we,e as ze,f as be,g as Ge,h as A,i as Ke,j as Le,k as J,l as B,m as H,n as Q,o as V,p as $,q as Z,r as X,s as Y,t as W,u as ee,v as te,w as re,x as se,y as ie,z as oe}from"./chunk-HXMWTQAO.js";var ve="2.26.0";var Pe=(t,e)=>{let{apiKey:r,source:s}=e,i=new URL(t);return i.searchParams.set("jdm_source",s),i.searchParams.set("jdm_version",ve),r&&i.searchParams.set("jdm_api_key",r),i.searchParams.sort(),i.toString()},h=(t,e,r)=>{let s=new URL(t+e);return Pe(s.toString(),r)},k=(t,e)=>{let r=new URL(t+p.click),s=new URL(t+p.impression);return{clickEndpoint:Pe(r.toString(),e),impressionEndpoint:Pe(s.toString(),e)}},ge=class extends Error{response;constructor(e,r){super(e),this.response=r}},_e=async t=>{if(t.ok){if(t.status===204)return null}else throw new ge("Api Request Failed",t);try{return await t.json()}catch{}},Be=async(t,e)=>{let r=await fetch(t,{body:JSON.stringify(e),headers:{Accept:"application/json","Content-Type":"text/plain"},method:"POST"});return _e(r)},He=async(t,e={})=>{let{headers:r,...s}=e,i=await fetch(t,{...s,headers:{Accept:"application/json",...r},method:"GET"});return _e(i)},l={get:He,post:Be};import{nanoid as ke}from"nanoid";var b=()=>typeof window<"u"&&typeof document<"u";var Qe=(...t)=>{console.error("[JaneDmSDK]",...t)},Ve=(...t)=>{console.info("[JaneDmSDK]",...t)},$e=(...t)=>{console.log("[JaneDmSDK]",...t)},v={error:Qe,info:Ve,log:$e};var Ze=t=>{let e=localStorage.getItem(t);return e!==null?We(e):e},Xe=(t,e)=>localStorage.setItem(t,et(e)),Ye=t=>localStorage.removeItem(t),_={get:Ze,remove:Ye,set:Xe},We=t=>Ce(t)?t.substring(1,t.length-1):t,et=t=>Ce(t)?t:`"${t}"`,Ce=t=>{let r=t.length-1;return t[0]==='"'&&t[r]==='"'};var Se="j_fp_last_run",tt=1440*60*1e3,rt=20,fe=new Set,st=(t,e)=>`${t}:${e.apiKey}:${e.source}`;var it=t=>typeof t=="object"&&t!==null&&typeof t.token=="string"&&typeof t.endpoint=="string"&&typeof t.scriptUrlPattern=="string",ot=async(t,e)=>{try{let r=h(t,p.fingerprint,e),s=await l.get(r);return it(s)?s:null}catch(r){return v.error("Failed to fetch fingerprint token:",r),null}},nt=async(t,e,r,s)=>{try{let i=await import("@fingerprintjs/fingerprintjs-pro"),o=await i.load({apiKey:t,endpoint:[e,i.defaultEndpoint],region:"us",scriptUrlPattern:[r,i.defaultScriptUrlPattern],storageKey:"eyeD"}),a={tag:{isDmSdk:!0}};s?.linkedId&&(a.linkedId=s.linkedId);let c=await o.get(a);return!c||!c.visitorId?(v.error("Fingerprint JS did not return a valid visitorId"),null):{visitorId:c.visitorId}}catch(i){return v.error("Failed to run Fingerprint JS:",i),null}},xe=async(t,e,r)=>{if(!b())return ke();let s=_.get("jdid");if(!s)return await Ee(t,e,r)??ke();if(s.length!==rt)return await Re(t,e,{linkedId:s}),s;let i=await De(t,e,r);if(i)return i;if(Fe()==="error")try{_.set(Se,Date.now().toString())}catch{}return s},Fe=()=>{try{let t=_.get(Se);if(!t)return"missing";let e=parseInt(t,10);return Number.isNaN(e)?"missing":Date.now()-e>=tt?"expired":"valid"}catch{return"error"}},De=async(t,e,r)=>{let s=Fe();return s==="valid"||s==="error"?null:Ee(t,e,r)},Ee=async(t,e,r)=>{let s=st(t,e);if(fe.has(s))return null;fe.add(s);try{let i=await ot(t,e);if(!i)return null;let n=await nt(i.token,i.endpoint,i.scriptUrlPattern,r);if(!n)return null;try{_.set(Se,Date.now().toString())}catch{}return n.visitorId}catch(i){return v.error("Failed to run fingerprint:",i),null}finally{fe.delete(s)}},Re=async(t,e,r)=>{if(b()&&r?.linkedId!=="user-opt-out")try{await De(t,e,r)}catch(s){v.error("Failed to run SSR fingerprint:",s)}};var I=class t extends Error{constructor(e){super(`[Jane DM SDK]: ${e}`),this.name="SdkError",Object.setPrototypeOf(this,t.prototype)}};var at=new Set(Object.values(J)),ye=t=>{switch(t){case H:return"best-seller-rank";case Q:return"category-and-name-asc";case V:return"default";case $:return"price-asc";case Z:return"price-desc";case X:return"price-eighth-ounce-asc";case Y:return"price-eighth-ounce-desc";case W:return"price-gram-asc";case ee:return"price-gram-desc";case te:return"price-half-gram-asc";case re:return"price-half-gram-desc";case se:return"price-half-ounce-asc";case ie:return"price-half-ounce-desc";case oe:return"price-ounce-asc";case ne:return"price-ounce-desc";case ae:return"price-quarter-ounce-asc";case ce:return"price-quarter-ounce-desc";case de:return"price-two-gram-asc";case ue:return"price-two-gram-desc";case pe:return"rating";case me:return"recommendation";case le:return"thc-potency-asc";case he:return"thc-potency-desc";default:return at.has(t)?t:"default"}};var O=t=>JSON.parse(t);var Ie=class t{isSponsored;objectId;clickPayload;clickUrl;impressPayload;impressUrl;constructor(e){this.objectId=e.objectId,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored}static fromJSON(e){return new t(O(e))}serialize(){return{clickPayload:this.clickPayload,clickUrl:this.clickUrl,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},C=class t{attributes;isSponsored;objectId;clickPayload;clickUrl;hasBeenImpressed;impressPayload;impressPromise;impressUrl;constructor(e){this.objectId=e.objectId,this.attributes=e.attributes,this.impressUrl=e.impressUrl,this.impressPayload=e.impressPayload,this.clickPayload=e.clickPayload,this.clickUrl=e.clickUrl,this.isSponsored=e.isSponsored,this.hasBeenImpressed=e.hasBeenImpressed??!1}static fromJSON(e){return new t(O(e))}click(e={isAddToCart:!1}){let{isAddToCart:r=!1}=e,s={...this.clickPayload,isAddToCart:r};return l.post(this.clickUrl,s)}impress(){return this.hasBeenImpressed?Promise.resolve():(this.impressPromise??=l.post(this.impressUrl,this.impressPayload).then(()=>{this.hasBeenImpressed=!0}).finally(()=>{this.impressPromise=void 0}),this.impressPromise)}serialize(){return{attributes:this.attributes,clickPayload:this.clickPayload,clickUrl:this.clickUrl,hasBeenImpressed:this.hasBeenImpressed,impressPayload:this.impressPayload,impressUrl:this.impressUrl,isSponsored:this.isSponsored,objectId:this.objectId}}toJSON(){return JSON.stringify(this.serialize())}},x=class t{customImages;placement;products;rowId;searchFacets;title;totalProducts;creativeIds;cachedProducts;config;loadPromise;nextPageProps;nextPageUrl;constructor(e){this.rowId=e.rowId,this.searchFacets=e.searchFacets,this.nextPageUrl=e.nextPageUrl,this.nextPageProps=e.nextPageProps,this.products=e.products.map(r=>new C(r)),this.cachedProducts=e.cachedProducts.map(r=>new Ie(r)),this.totalProducts=e.totalProducts,this.title=e.title,this.creativeIds=e.creativeIds,this.config=e.config,this.customImages=e.customImages??[],this.placement=e.placement,b()&&!this.config.skipAutoSmartSortOnLoad&&this.onLoad().catch(r=>v.error("Failed to run onLoad:",r))}static fromJSON(e){return new t(O(e))}hasNextPage(){return this.cachedProducts.length>0}async nextPage(){if(!this.hasNextPage())return;let e=this.cachedProducts.slice(0,this.nextPageProps.pageSize),r={app_mode:this.config.appMode,jane_device_id:this.config.identifier.jdid,object_ids:e.map(n=>n.objectId),search_attributes:this.nextPageProps.searchAttributes},s=await l.post(this.nextPageUrl,r),i=new Map(s.products?.map(n=>[n.object_id,n.search_attributes]));e.forEach(n=>{let o=i.get(n.objectId);o!==void 0&&this.products.push(new C({...n.serialize(),attributes:o}))}),this.cachedProducts=this.cachedProducts.slice(this.nextPageProps.pageSize)}async onLoad(){return this.loadPromise?this.loadPromise:(this.loadPromise=(async()=>{if(!b())return;let e={apiKey:this.config.apiKey,source:this.config.source};await Re(this.config.eventsEndpoint,e,{linkedId:this.config.identifier.jdid})})(),this.loadPromise)}serialize(){return{cachedProducts:this.cachedProducts.map(e=>e.serialize()),config:this.config,creativeIds:this.creativeIds,customImages:this.customImages,nextPageProps:this.nextPageProps,nextPageUrl:this.nextPageUrl,placement:this.placement,products:this.products.map(e=>e.serialize()),rowId:this.rowId,searchFacets:this.searchFacets,title:this.title,totalProducts:this.totalProducts}}toJSON(){return JSON.stringify(this.serialize())}},F=class{async createSmartSort(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=h(e.config.endpoint,p.smart,r),i=h(e.config.pageEndpoint,p.page,r),n=this.buildSmartRequest(e),o=await l.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=k(e.config.eventsEndpoint,r),{creative_ids:m,custom_images:P,products:u,row_id:d,search_facets:y,title:w}=o,{cachedProducts:D,products:E}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:u}),T=(P??[]).map(M=>this.massageCustomImageData(M)).filter(M=>M!==void 0);return new x({cachedProducts:D,config:e.config,creativeIds:m,customImages:T,nextPageProps:{pageSize:"page_size"in n?n.page_size??60:60,searchAttributes:n.search_attributes??e.searchAttributes},nextPageUrl:i,placement:e.placement,products:E,rowId:d,searchFacets:y,title:w,totalProducts:o.nb_hits??0})}generateProducts(e){let{clickUrl:r,identifier:s,impressUrl:i,products:n}=e,o={cachedProducts:[],products:[]};return n?.forEach(a=>{let c={clickPayload:{adToken:a.ad_token,distinctId:s.mixpanelDistinctId??s.jdid,isAddToCart:!1,janeDeviceId:s.jdid,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id,storeId:a.store_id},clickUrl:r,impressPayload:{distinctId:s.mixpanelDistinctId??s.jdid,engagements:[{adToken:a.ad_token,kevelToken:a.kevel_token,myHighD:a.my_high_d,productId:a.product_id}],janeDeviceId:s.jdid},impressUrl:i,isSponsored:!!a.flight_id,objectId:a.object_id};a.search_attributes!==void 0?o.products.push({...c,attributes:a.search_attributes}):o.cachedProducts.push(c)}),o}massageCustomImageData(e){if(e)return{headline:e.headline,imageUrl:e.image_url,intendedDisplay:e.intended_display,logoUrl:e.logo_url,overlayColor:e.overlay_color,positionX:e.position_x,positionY:e.position_y,scaleNumber:e.scale_number,textColor:e.text_color}}buildSmartRequest(e){let{config:r,searchAttributes:s,...i}=e,n={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,user_id:r.identifier.userId};switch(i.placement){case"cart_toppers":{let{cartProductIds:o,posCartProductIds:a,storeId:c}=i;return{...n,cart_pos_product_ids:a,cart_product_ids:o,placement:"cart_toppers",store_id:c}}case"custom_image_row":{let{searchFilter:o,storeId:a}=i;return{...n,placement:"custom_image_row",search_filter:o,store_id:a}}case"menu_dynamic_row":{let{adMode:o,filterContext:a,pageContext:c,storeId:m}=i;return{...n,ad_mode:o??"default",filter_context:a,page_context:c,placement:"menu_dynamic_row",store_id:m}}case"menu_inline":{let{adMode:o,distinctByProduct:a,metadata:c,numColumns:m,searchFilter:P,searchQuery:u,searchSort:d,storeId:y,storeIds:w}=i;return{...n,ad_mode:o??"default",distinct_by_product:a,metadata:c,num_columns:m,placement:"menu_inline",search_filter:P,search_query:u,search_sort:ye(d),store_ids:w||[y]}}case"menu_inline_table":{let{disableAds:o,distinctByProduct:a,maxProducts:c,metadata:m,numColumns:P,pageSize:u,searchFacets:d,searchFilter:y,searchQuery:w,searchSort:D,storeId:E,storeIds:T}=i;return{...n,disable_ads:o,distinct_by_product:a,max_products:c,metadata:m,num_columns:P,page_size:u,placement:"menu_inline_table",search_attributes:s,search_facets:d,search_filter:y,search_query:w,search_sort:ye(D),store_ids:T||[E]}}case"menu_top_row":{let{searchFilter:o,storeId:a}=i,c=this.extractValidCreativeIds(e);return{...n,exclude_creative_ids:c,placement:"menu_top_row",search_filter:o,store_id:a}}case"pdp_row":{let{posProductId:o,productId:a,storeId:c}=i;return{...n,placement:"pdp_row",pos_product_id:o,product_id:a,store_id:c}}default:throw new I(`Invalid Smart Sort Placement: ${i.placement}`)}}extractValidCreativeIds(e){if(e.placement==="menu_top_row"&&"excludeCreativeIds"in e&&Array.isArray(e.excludeCreativeIds))return e.excludeCreativeIds.filter(r=>typeof r=="number")}};var dt=t=>t.placement==="specials",ut=t=>t.placement==="brand_specials",j=class{placement;title;constructor(e){this.title=e,this.placement="brand_specials"}},U=class{placement;title;constructor(e){this.title=e,this.placement="specials"}},q=class extends F{async createMultiPlacement(e){let r={apiKey:e.config.apiKey,source:e.config.source},s=h(e.config.endpoint,p.multi,r),i=h(e.config.pageEndpoint,p.page,r),n=this.buildMultiRequest(e),o=await l.post(s,n),{clickEndpoint:a,impressionEndpoint:c}=k(e.config.eventsEndpoint,r),m=[];for(let[P,u]of(o.placements||[]).entries())if(dt(u))m.push(new U(u.title));else if(ut(u))m.push(new j(u.title));else{let{creative_ids:d,custom_images:y,placement:w,products:D,row_id:E,search_facets:T,title:M}=u,{cachedProducts:Ue,products:qe}=this.generateProducts({clickUrl:a,identifier:e.config.identifier,impressUrl:c,products:D}),Ne=(y??[]).map(K=>this.massageCustomImageData(K)).filter(K=>K!==void 0);m.push(new x({cachedProducts:Ue,config:{...e.config,skipAutoSmartSortOnLoad:P===0?e.config.skipAutoSmartSortOnLoad:!0},creativeIds:d,customImages:Ne,nextPageProps:{pageSize:60,searchAttributes:n.search_attributes||[]},nextPageUrl:i,placement:w,products:qe,rowId:E,searchFacets:T,title:M,totalProducts:u.nb_hits??0}))}return m}buildMultiRequest(e){let{config:r,numColumns:s,searchAttributes:i,storeId:n,...o}=e,a={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,num_columns:s,pos_user_id:r.identifier.posUserId,search_attributes:i,store_id:n,user_id:r.identifier.userId};switch(o.multiRequestType){case"custom":return{...a,placements:this.massageCustomPlacements(o.placements),type:"custom"};case"featured":return{...a,exclude_menu_top_row:o.excludeMenuTopRow??!1,type:"featured"};default:throw new I(`Invalid Multi Type: ${o.multiRequestType}`)}}massageCustomPlacements(e){let r=[];for(let s of e)switch(s.placement){case"best_selling":r.push({placement:"best_selling",title:s.title});break;case"brand_specials":r.push({placement:"brand_specials",title:s.title});break;case"buy_again_row":r.push({placement:"buy_again_row",title:s.title});break;case"custom_image_row":r.push({placement:"custom_image_row",search_filter:s.searchFilter});break;case"featured_row":r.push({placement:"featured_row",row_id:s.rowId});break;case"menu_dynamic_row":r.push({ad_mode:s.adMode??"default",filter_context:s.filterContext,page_context:s.pageContext,placement:"menu_dynamic_row"});break;case"menu_inline":r.push({ad_mode:s.adMode??"default",metadata:s.metadata,placement:"menu_inline",search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_inline_table":r.push({disable_ads:s.disableAds,max_products:s.maxProducts,metadata:s.metadata,page_size:s.pageSize,placement:"menu_inline_table",search_facets:s.searchFacets,search_filter:s.searchFilter,search_query:s.searchQuery,search_sort:s.searchSort,title:s.title});break;case"menu_top_row":r.push({placement:"menu_top_row",search_filter:s.searchFilter});break;case"sale":r.push({placement:"sale",title:s.title});break;case"specials":r.push({placement:"specials",title:s.title});break;default:throw new I(`Invalid Custom Placement: ${s.placement}`)}return r}};import{nanoid as gt}from"nanoid";var Te=async t=>{let{apiKey:e,appMode:r,endpoint:s,identifier:i,searchFacets:n,searchFilter:o,searchQuery:a,source:c,storeId:m}=t,{jdid:P}=i||{},u=h(s,p.facets,{apiKey:e,source:c}),d={appMode:r,janeDeviceId:P,searchFacets:n,searchFilter:o,searchQuery:a,storeId:m};return(await l.post(u,d)).searchFacets??{}};var Me=async t=>{let{apiKey:e,endpoint:r,identifier:s,source:i,storeId:n,...o}=t,a=h(r,p.externalCheckout,{apiKey:e,source:i}),c={janeDeviceId:s.jdid,posOrderId:o.posOrderId,posUserId:o.posUserId||s.posUserId,products:o.products,storeId:n};return await l.post(a,c)};var N=class{async create(e){let{config:r,searchAttributes:s,storeId:i,...n}=e,o={apiKey:r.apiKey,source:r.source},a=h(r.endpoint,p.product,o),{clickEndpoint:c,impressionEndpoint:m}=k(r.eventsEndpoint,o),P={app_mode:r.appMode,distinct_id:r.identifier.mixpanelDistinctId,jane_device_id:r.identifier.jdid,pos_user_id:r.identifier.posUserId,search_attributes:s,store_id:i,user_id:r.identifier.userId},u=n.productId!==void 0?{...P,product_id:n.productId}:{...P,pos_product_id:n.posProductId},d=await l.post(a,u);return new C({attributes:d.search_attributes,clickPayload:{adToken:d.ad_token,distinctId:r.identifier.mixpanelDistinctId,isAddToCart:!1,janeDeviceId:r.identifier.jdid,kevelToken:d.kevel_token,myHighD:d.my_high_d,productId:d.product_id,storeId:i},clickUrl:c,impressPayload:{distinctId:r.identifier.mixpanelDistinctId??r.identifier.jdid,engagements:[{adToken:d.ad_token,kevelToken:d.kevel_token,myHighD:d.my_high_d,productId:d.product_id}],janeDeviceId:r.identifier.jdid},impressUrl:m,isSponsored:!!d.flight_id,objectId:d.object_id})}};var pt=t=>({activities:t.activities,avatar:t.avatar,comment:t.comment,createdAt:t.created_at,feelings:t.feelings,hasComment:t.has_comment,id:t.id,nickname:t.nickname,productId:t.product_id,rating:t.rating,storeId:t.store_id,storeName:t.store_name,updatedAt:t.updated_at,upvoteCount:t.upvote_count}),mt=t=>({activitiesDistribution:t.activities_distribution,averageRating:t.average_rating,distribution:t.distribution,feelingsDistribution:t.feelings_distribution,reviewCount:t.review_count}),lt=(t,e,r)=>{let s=t.total_count,i=Math.max(1,Math.ceil(s/r));return{aggregate:mt(t.aggregate),aiSummary:t.ai_summary,items:t.reviews.map(pt),pagination:{currentPage:e,hasNextPage:e<i,hasPreviousPage:e>1,pageSize:r,totalCount:s,totalPages:i},productId:t.product_id}},Ae=async t=>{let{activities:e,config:r,feelings:s,hasComment:i,page:n,pageSize:o,productId:a,ratings:c,sort:m}=t,P=n??1,u=o??50,d=h(r.endpoint,p.productReviews,{apiKey:r.apiKey,source:r.source}),y={activities:e,feelings:s,has_comment:i||void 0,page:n,page_size:o,product_id:a,ratings:c,sort:m},w=await l.post(d,y);return lt(w,P,u)},Oe=t=>{let e={[Symbol.asyncIterator]:async function*(){let r=1;for(;;){let s=await t(r);if(yield s,!s.pagination.hasNextPage)return;r+=1}}};return{pages:e,[Symbol.asyncIterator]:async function*(){for await(let r of e)yield*r.items}}};var je=async t=>{let{apiKey:e,eventsEndpoint:r,identifier:s,source:i,...n}=t,o=h(r,p.sessionEvent,{apiKey:e,source:i}),a={distinctId:s.mixpanelDistinctId,events:n.events,janeDeviceId:s.jdid};return await l.post(o,a)};function S(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...i){return await this.init(),s.apply(this,i)},r}function R(t,e,r){let s=r.value;if(!s)throw new Error("Decorator applied to invalid method descriptor");return r.value=async function(...i){if(!this.rateLimiter)throw new Error("throttle decorator can only be used on JaneDM class methods");return this.rateLimiter.schedule(async()=>s.apply(this,i))},r}var z=class{burst;intervalMs;rate;tat=0;toleranceMs;constructor(e,r=1){if(e<=0)throw new I("rate must be > 0");if(r<1)throw new I("burst must be >= 1");this.rate=e,this.burst=Math.floor(r),this.intervalMs=1e3/this.rate,this.toleranceMs=(this.burst-1)*this.intervalMs}async schedule(e){let r=Date.now(),s=Math.max(0,this.tat-this.toleranceMs-r);this.tat=Math.max(this.tat,r)+this.intervalMs;let i=async()=>e();return s>0?new Promise((n,o)=>setTimeout(()=>i().then(n).catch(o),s)):i()}};var ht=/^https?:\/\//,Pt=/^(https?:\/\/)?(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}|localhost)(:\d+)?(\/.*)?$/,G=(t,e)=>{let s=ht.test(t??e)?t??e:`https://${t}`,i=new URL(s);return Pt.test(i.toString())?i.protocol+"//"+i.host:e};var g=class{config;rateLimiter;initialized=!1;multiClient;productClient;smartSortClient;userProvidedJdid=!1;constructor(e,r){let{apiKey:s,endpoint:i,identifier:n}=e,{appMode:o="headless",eventsEndpoint:a,pageEndpoint:c,skipAutoSmartSortOnLoad:m=!1,source:P="sdk"}=r??{},u=G(i,"https://dmerch.iheartjane.com"),d=G(a,u),y=G(c,u);this.userProvidedJdid=!!n?.jdid,this.config={apiKey:s,appMode:o,endpoint:u,eventsEndpoint:d,identifier:n??{jdid:""},pageEndpoint:y,skipAutoSmartSortOnLoad:m,source:P},this.smartSortClient=new F,this.multiClient=new q,this.productClient=new N,this.rateLimiter=new z(10,20)}static generateJaneDeviceId(){return gt()}async fetchCartTopperRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"cart_toppers"})}async fetchCustomImageRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"custom_image_row"})}async fetchCustomPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"custom",...e})}async fetchFacets(e){return Te({...e,...this.config})}async fetchFeaturedPlacements(e){return await this.multiClient.createMultiPlacement({config:this.config,multiRequestType:"featured",...e})}async fetchMenuRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline"})}async fetchMenuTopRow(e){return this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_top_row"})}async fetchProduct(e){return this.productClient.create({config:this.config,...e})}async fetchProductReviews(e){return Ae({config:this.config,...e})}async fetchRecommendedPDPRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"pdp_row"})}async fetchRecommendedRow(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_dynamic_row"})}async fetchRecommendedSort(e){return await this.smartSortClient.createSmartSort({...e,config:this.config,placement:"menu_inline_table"})}getJaneDeviceId(){return this.config.identifier.jdid}async init(){this.initialized||(b()&&!this.userProvidedJdid&&await this.initializeClientSideJdid(),this.initialized=!0)}iterateProductReviews(e){return Oe(r=>this.fetchProductReviews({...e,page:r}))}async sendPosCheckout(e){return Me({...e,...this.config})}async sendSessionEvent(e){return je({...e,...this.config})}async initializeClientSideJdid(){let e={apiKey:this.config.apiKey,source:this.config.source},r=await xe(this.config.eventsEndpoint,e);_.set("jdid",r),this.config.identifier.jdid=r}};f([S,R],g.prototype,"fetchCartTopperRow",1),f([S,R],g.prototype,"fetchCustomImageRow",1),f([S,R],g.prototype,"fetchCustomPlacements",1),f([S,R],g.prototype,"fetchFacets",1),f([S,R],g.prototype,"fetchFeaturedPlacements",1),f([S,R],g.prototype,"fetchMenuRow",1),f([S,R],g.prototype,"fetchMenuTopRow",1),f([S,R],g.prototype,"fetchProduct",1),f([S,R],g.prototype,"fetchProductReviews",1),f([S,R],g.prototype,"fetchRecommendedPDPRow",1),f([S,R],g.prototype,"fetchRecommendedRow",1),f([S,R],g.prototype,"fetchRecommendedSort",1);export{L as AdMode,we as AppMode,j as BrandSpecials,B as DEFAULT_PAGE_SIZE,ze as IntendedDisplay,g as JaneDM,be as JaneDeviceIdSentinel,Ge as PageContextEnum,A as Placement,Ke as ProductKindEnum,Le as ReviewSortEnum,J as SearchSortEnum,x as SmartSort,C as SmartSortProduct,U as Specials,H as bestSellerRank,Q as categoryAndNameAsc,V as defaultOrder,$ as priceAsc,Z as priceDesc,X as priceEighthOunceAsc,Y as priceEighthOunceDesc,W as priceGramAsc,ee as priceGramDesc,te as priceHalfGramAsc,re as priceHalfGramDesc,se as priceHalfOunceAsc,ie as priceHalfOunceDesc,oe as priceOunceAsc,ne as priceOunceDesc,ae as priceQuarterOunceAsc,ce as priceQuarterOunceDesc,de as priceTwoGramAsc,ue as priceTwoGramDesc,pe as rating,me as recommendation,Je as searchSorts,le as thcPotencyAsc,he as thcPotencyDesc};
|
|
@@ -60,6 +60,8 @@ declare enum ReviewSortEnum {
|
|
|
60
60
|
declare enum SearchSortEnum {
|
|
61
61
|
BestSellerRank = "best-seller-rank",
|
|
62
62
|
CategoryAndNameAsc = "category-and-name-asc",
|
|
63
|
+
CbdDosageAsc = "cbd-dosage-asc",
|
|
64
|
+
CbdDosageDesc = "cbd-dosage-desc",
|
|
63
65
|
Default = "default",
|
|
64
66
|
PriceAsc = "price-asc",
|
|
65
67
|
PriceDesc = "price-desc",
|
|
@@ -79,6 +81,8 @@ declare enum SearchSortEnum {
|
|
|
79
81
|
PriceTwoGramDesc = "price-two-gram-desc",
|
|
80
82
|
Rating = "rating",
|
|
81
83
|
Recommendation = "recommendation",
|
|
84
|
+
ThcDosageAsc = "thc-dosage-asc",
|
|
85
|
+
ThcDosageDesc = "thc-dosage-desc",
|
|
82
86
|
ThcPotencyAsc = "thc-potency-asc",
|
|
83
87
|
ThcPotencyDesc = "thc-potency-desc"
|
|
84
88
|
}
|
|
@@ -60,6 +60,8 @@ declare enum ReviewSortEnum {
|
|
|
60
60
|
declare enum SearchSortEnum {
|
|
61
61
|
BestSellerRank = "best-seller-rank",
|
|
62
62
|
CategoryAndNameAsc = "category-and-name-asc",
|
|
63
|
+
CbdDosageAsc = "cbd-dosage-asc",
|
|
64
|
+
CbdDosageDesc = "cbd-dosage-desc",
|
|
63
65
|
Default = "default",
|
|
64
66
|
PriceAsc = "price-asc",
|
|
65
67
|
PriceDesc = "price-desc",
|
|
@@ -79,6 +81,8 @@ declare enum SearchSortEnum {
|
|
|
79
81
|
PriceTwoGramDesc = "price-two-gram-desc",
|
|
80
82
|
Rating = "rating",
|
|
81
83
|
Recommendation = "recommendation",
|
|
84
|
+
ThcDosageAsc = "thc-dosage-asc",
|
|
85
|
+
ThcDosageDesc = "thc-dosage-desc",
|
|
82
86
|
ThcPotencyAsc = "thc-potency-asc",
|
|
83
87
|
ThcPotencyDesc = "thc-potency-desc"
|
|
84
88
|
}
|
package/dist/test-utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var O=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var ne=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of re(t))!oe.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(o=te(t,n))||o.enumerable});return e};var ce=e=>se(O({},"__esModule",{value:!0}),e);var me={};ne(me,{buildCustomImageData:()=>N,buildProduct:()=>k,buildProductReview:()=>J,buildProductReviewsAggregate:()=>V,buildProductsPlacementResponse:()=>p,buildSmartSortProductProps:()=>C,buildSmartSortProps:()=>H,mockClick:()=>T,mockFacets:()=>E,mockFetchProduct:()=>L,mockFetchProductReviews:()=>Q,mockFingerprint:()=>B,mockImpression:()=>F,mockMultiFeaturedPlacements:()=>U,mockSessionEvent:()=>z,mockSmartSortPage:()=>W,mockSmartSortPlacements:()=>Z});module.exports=ce(me);var c={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};var y=(o=>(o.Desktop="desktop",o.Kiosk="kiosk",o.Mobile="mobile",o))(y||{});var w=require("msw"),T=(e,t)=>w.http.post(`${e}${c.click}*`,async({request:r})=>{let o=new URL(r.url);if(t){let n=await r.json();t({reqBody:n,url:o})}return w.HttpResponse.json({},{status:200})}),F=(e,t)=>w.http.post(`${e}${c.impression}*`,async({request:r})=>{let o=new URL(r.url);if(t){let n=await r.json();t({reqBody:n,url:o})}return w.HttpResponse.json({},{status:200})});var q=require("@faker-js/faker");var j=(e={})=>{let{identifier:t,...r}=e;return{apiKey:q.faker.string.uuid(),appMode:"default",endpoint:"http://localhost:4200",eventsEndpoint:"http://localhost:4200",identifier:{jdid:q.faker.string.uuid(),...t},pageEndpoint:"http://localhost:4200",skipAutoSmartSortOnLoad:!1,source:"test",...r}};var
|
|
1
|
+
"use strict";var O=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var ne=(e,t)=>{for(var r in t)O(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of re(t))!oe.call(e,n)&&n!==r&&O(e,n,{get:()=>t[n],enumerable:!(o=te(t,n))||o.enumerable});return e};var ce=e=>se(O({},"__esModule",{value:!0}),e);var me={};ne(me,{buildCustomImageData:()=>N,buildProduct:()=>k,buildProductReview:()=>J,buildProductReviewsAggregate:()=>V,buildProductsPlacementResponse:()=>p,buildSmartSortProductProps:()=>C,buildSmartSortProps:()=>H,mockClick:()=>T,mockFacets:()=>E,mockFetchProduct:()=>L,mockFetchProductReviews:()=>Q,mockFingerprint:()=>B,mockImpression:()=>F,mockMultiFeaturedPlacements:()=>U,mockSessionEvent:()=>z,mockSmartSortPage:()=>W,mockSmartSortPlacements:()=>Z});module.exports=ce(me);var c={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};var y=(o=>(o.Desktop="desktop",o.Kiosk="kiosk",o.Mobile="mobile",o))(y||{});var w=require("msw"),T=(e,t)=>w.http.post(`${e}${c.click}*`,async({request:r})=>{let o=new URL(r.url);if(t){let n=await r.json();t({reqBody:n,url:o})}return w.HttpResponse.json({},{status:200})}),F=(e,t)=>w.http.post(`${e}${c.impression}*`,async({request:r})=>{let o=new URL(r.url);if(t){let n=await r.json();t({reqBody:n,url:o})}return w.HttpResponse.json({},{status:200})});var q=require("@faker-js/faker");var j=(e={})=>{let{identifier:t,...r}=e;return{apiKey:q.faker.string.uuid(),appMode:"default",endpoint:"http://localhost:4200",eventsEndpoint:"http://localhost:4200",identifier:{jdid:q.faker.string.uuid(),...t},pageEndpoint:"http://localhost:4200",skipAutoSmartSortOnLoad:!1,source:"test",...r}};var v=require("msw"),ae=(e={})=>({searchFacets:e}),E=({callback:e,endpoint:t,facets:r})=>v.http.post(`${t}${c.facets}`,async({request:o})=>{if(e){let n=new URL(o.url),i=await o.json();e({reqBody:i,url:n})}return v.HttpResponse.json(ae(r),{status:200})});var S=require("msw"),B=({callback:e,endpoint:t,response:r})=>S.http.get(`${t}${c.fingerprint}`,async({request:o})=>{if(e){let n=new URL(o.url);e({reqBody:{},url:n})}return S.HttpResponse.json(r??{},{status:200})});var pe=require("@faker-js/faker");var M=require("msw");var s=require("@faker-js/faker");var k=(e={})=>({ad_token:s.faker.string.uuid(),object_id:s.faker.string.uuid(),product_id:s.faker.number.int(),store_id:s.faker.number.int(),...e}),N=(e={})=>({headline:s.faker.company.catchPhrase(),image_url:s.faker.image.url(),intended_display:s.faker.helpers.arrayElement(Object.values(y)),logo_url:s.faker.internet.url(),overlay_color:s.faker.color.rgb(),position_x:s.faker.number.int({max:100,min:0}),position_y:s.faker.number.int({max:100,min:0}),scale_number:s.faker.number.float({max:2,min:.5}),text_color:s.faker.color.rgb(),...e}),p=(e={})=>{let{products:t=[k()],...r}=e;return{nb_hits:t.length,placement:"menu_dynamic_row",products:t,search_facets:{},...r}},C=(e={})=>({...$(e),attributes:e.attributes??{},hasBeenImpressed:e.hasBeenImpressed??!1}),$=(e={})=>{let{endpoint:t="http://localhost:4242",eventsEndpoint:r,...o}=e,n=r??t,i=s.faker.string.uuid(),P=s.faker.datatype.boolean(),m=s.faker.string.uuid(),g=s.faker.string.uuid(),b=s.faker.string.uuid(),f=s.faker.number.int(),_=s.faker.number.int(),l=`${n}${c.click}`,x=`${n}${c.impression}`;return{clickPayload:{adToken:i,distinctId:m,isAddToCart:P,janeDeviceId:m,kevelToken:g,myHighD:b,productId:f,storeId:_},clickUrl:l,impressPayload:{distinctId:m,engagements:[{adToken:i,kevelToken:g,myHighD:b,productId:f}],janeDeviceId:m},impressUrl:x,isSponsored:!1,objectId:s.faker.string.uuid(),...o}},K=(e={})=>({object_id:s.faker.string.uuid(),...e}),G=(e={})=>({products:[K()],...e}),H=(e={creativeIds:[],endpoint:"http://localhost:4242",searchFacets:{},title:s.faker.company.catchPhrase()})=>{let{cachedProducts:t=[$()],endpoint:r="http://localhost:4242",eventsEndpoint:o,config:n=j({endpoint:r,eventsEndpoint:o??r}),creativeIds:i=[],customImages:P=[],placement:m="menu_dynamic_row",products:g=[C()],searchFacets:b={},title:f=s.faker.company.catchPhrase(),..._}=e,{totalProducts:l=t.length+g.length}=_,x=`${r}${c.page}`;return{cachedProducts:t,config:n,creativeIds:i,customImages:P,nextPageProps:{pageSize:60,searchAttributes:["*"]},nextPageUrl:x,placement:m,products:g,searchFacets:b,title:f,totalProducts:l}};var U=e=>{let{callback:t,endpoint:r,placements:o=[p({placement:"menu_top_row"}),p({placement:"menu_dynamic_row"}),p({placement:"menu_inline"})]}=e;return M.http.post(`${r}${c.multi}`,async({request:n})=>{let i=await n.json();return t&&t({reqBody:i,url:new URL(n.url)}),M.HttpResponse.json({placements:o},{status:200})})};var X=require("msw");var I=require("msw");var L=e=>{let{callback:t,endpoint:r,product:o=k()}=e;return I.http.post(`${r}${c.product}`,async({request:n})=>{let i=await n.json();return t&&t({reqBody:i,url:new URL(n.url)}),I.HttpResponse.json(o,{status:200})})};var d=require("@faker-js/faker");var D=require("msw"),J=(e={})=>({activities:[],avatar:d.faker.number.int({max:11,min:0}),comment:d.faker.lorem.sentence(),createdAt:d.faker.date.anytime().toISOString(),feelings:[],hasComment:!0,id:d.faker.number.int(),nickname:"w******a",productId:d.faker.number.int(),rating:d.faker.number.float({fractionDigits:1,max:5,min:0}),updatedAt:d.faker.date.anytime().toISOString(),upvoteCount:d.faker.number.int(),...e}),V=(e={})=>({activitiesDistribution:{},averageRating:d.faker.number.float({fractionDigits:1,max:5,min:0}),distribution:{1:1,2:2,3:5,4:10,5:20},feelingsDistribution:{},reviewCount:d.faker.number.int({max:100,min:0}),...e}),Y=(e={})=>({created_at:"2026-01-15T12:00:00Z",has_comment:!0,id:1,product_id:123,rating:5,updated_at:"2026-01-15T12:00:00Z",upvote_count:0,...e}),ee=(e={})=>({average_rating:4.5,distribution:{1:1,2:2,3:5,4:10,5:20},review_count:38,...e}),ue=(e={})=>({aggregate:ee(),product_id:123,reviews:[Y()],total_count:1,...e}),Q=({callback:e,endpoint:t,response:r})=>D.http.post(`${t}${c.productReviews}`,async({request:o})=>{if(e){let n=new URL(o.url),i=await o.json();e({reqBody:i,url:n})}return D.HttpResponse.json(ue(r),{status:200})});var A=require("msw"),z=(e,t)=>A.http.post(`${e}${c.sessionEvent}`,async({request:r})=>{if(t){let o=new URL(r.url),n=await r.json();t({reqBody:n,url:o})}return A.HttpResponse.json({},{status:200})});var u=require("msw");var Z=e=>{let{callback:t,endpoint:r,...o}=e;if(!Object.values(o).some(l=>l!==void 0)){let l=Object.keys(o).join(", ");throw new Error(`At least one of [${l}] must be defined in props.`)}let{cartToppers:i,customImageRow:P,menuRow:m,menuTopRow:g,pdpRow:b,recommendedRow:f,recommendedSort:_}=o;return u.http.post(`${r}${c.smart}`,async({request:l})=>{let x=await l.json();if(t){let a=new URL(l.url);t({reqBody:x,url:a})}let{placement:R}=x;if(R==="cart_toppers"&&i){let a=p(i);return u.HttpResponse.json(a,{status:200})}if(R==="menu_inline"&&m){let a=p(m);return u.HttpResponse.json(a,{status:200})}if(R==="menu_inline_table"&&_){let a=p(_);return u.HttpResponse.json(a,{status:200})}if(R==="menu_dynamic_row"&&f){let a=p(f);return u.HttpResponse.json(a,{status:200})}if(R==="custom_image_row"&&P){let a=p(P);return u.HttpResponse.json(a,{status:200})}if(R==="menu_top_row"&&g){let a=p(g);return u.HttpResponse.json(a,{status:200})}if(R==="pdp_row"&&b){let a=p(b);return u.HttpResponse.json(a,{status:200})}return u.HttpResponse.text("Invalid placement",{status:400})})},W=(e={endpoint:"https://the.weed.shop",response:{}})=>{let{callback:t,endpoint:r,response:o}=e,n=G(o);return u.http.post(`${r}${c.page}`,async({request:i})=>{if(t){let P=new URL(i.url),m=await i.json();t({reqBody:m,url:P})}return u.HttpResponse.json(n,{status:200})})};0&&(module.exports={buildCustomImageData,buildProduct,buildProductReview,buildProductReviewsAggregate,buildProductsPlacementResponse,buildSmartSortProductProps,buildSmartSortProps,mockClick,mockFacets,mockFetchProduct,mockFetchProductReviews,mockFingerprint,mockImpression,mockMultiFeaturedPlacements,mockSessionEvent,mockSmartSortPage,mockSmartSortPlacements});
|
package/dist/test-utils.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as msw from 'msw';
|
|
2
2
|
import { DefaultBodyType } from 'msw';
|
|
3
|
-
import { ad as PlacementResponse, ae as Product, H as ProductReview, K as ProductReviewsAggregate, af as ProductReviewsResponse, P as Placement, ag as ProductsPlacementResponse, ah as PageResponse, j as Facets, ai as CustomImageData, b as SmartSortProductProps, d as SmartSortProps } from './smartSort-
|
|
3
|
+
import { ad as PlacementResponse, ae as Product, H as ProductReview, K as ProductReviewsAggregate, af as ProductReviewsResponse, P as Placement, ag as ProductsPlacementResponse, ah as PageResponse, j as Facets, ai as CustomImageData, b as SmartSortProductProps, d as SmartSortProps } from './smartSort-C7l2wPes.cjs';
|
|
4
4
|
|
|
5
5
|
interface FingerprintTokenResponse {
|
|
6
6
|
endpoint: string;
|
package/dist/test-utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as msw from 'msw';
|
|
2
2
|
import { DefaultBodyType } from 'msw';
|
|
3
|
-
import { ad as PlacementResponse, ae as Product, H as ProductReview, K as ProductReviewsAggregate, af as ProductReviewsResponse, P as Placement, ag as ProductsPlacementResponse, ah as PageResponse, j as Facets, ai as CustomImageData, b as SmartSortProductProps, d as SmartSortProps } from './smartSort-
|
|
3
|
+
import { ad as PlacementResponse, ae as Product, H as ProductReview, K as ProductReviewsAggregate, af as ProductReviewsResponse, P as Placement, ag as ProductsPlacementResponse, ah as PageResponse, j as Facets, ai as CustomImageData, b as SmartSortProductProps, d as SmartSortProps } from './smartSort-C7l2wPes.js';
|
|
4
4
|
|
|
5
5
|
interface FingerprintTokenResponse {
|
|
6
6
|
endpoint: string;
|
package/dist/test-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,e as C}from"./chunk-
|
|
1
|
+
import{b as a,e as C}from"./chunk-HXMWTQAO.js";import{http as j,HttpResponse as I}from"msw";var F=(e,t)=>j.post(`${e}${a.click}*`,async({request:o})=>{let r=new URL(o.url);if(t){let n=await o.json();t({reqBody:n,url:r})}return I.json({},{status:200})}),T=(e,t)=>j.post(`${e}${a.impression}*`,async({request:o})=>{let r=new URL(o.url);if(t){let n=await o.json();t({reqBody:n,url:r})}return I.json({},{status:200})});import{faker as D}from"@faker-js/faker";var h=(e={})=>{let{identifier:t,...o}=e;return{apiKey:D.string.uuid(),appMode:"default",endpoint:"http://localhost:4200",eventsEndpoint:"http://localhost:4200",identifier:{jdid:D.string.uuid(),...t},pageEndpoint:"http://localhost:4200",skipAutoSmartSortOnLoad:!1,source:"test",...o}};import{http as Q,HttpResponse as V}from"msw";var W=(e={})=>({searchFacets:e}),A=({callback:e,endpoint:t,facets:o})=>Q.post(`${t}${a.facets}`,async({request:r})=>{if(e){let n=new URL(r.url),c=await r.json();e({reqBody:c,url:n})}return V.json(W(o),{status:200})});import{http as X,HttpResponse as Y}from"msw";var O=({callback:e,endpoint:t,response:o})=>X.get(`${t}${a.fingerprint}`,async({request:r})=>{if(e){let n=new URL(r.url);e({reqBody:{},url:n})}return Y.json(o??{},{status:200})});import{faker as we}from"@faker-js/faker";import{http as ee,HttpResponse as te}from"msw";import{faker as s}from"@faker-js/faker";var y=(e={})=>({ad_token:s.string.uuid(),object_id:s.string.uuid(),product_id:s.number.int(),store_id:s.number.int(),...e}),E=(e={})=>({headline:s.company.catchPhrase(),image_url:s.image.url(),intended_display:s.helpers.arrayElement(Object.values(C)),logo_url:s.internet.url(),overlay_color:s.color.rgb(),position_x:s.number.int({max:100,min:0}),position_y:s.number.int({max:100,min:0}),scale_number:s.number.float({max:2,min:.5}),text_color:s.color.rgb(),...e}),p=(e={})=>{let{products:t=[y()],...o}=e;return{nb_hits:t.length,placement:"menu_dynamic_row",products:t,search_facets:{},...o}},M=(e={})=>({...x(e),attributes:e.attributes??{},hasBeenImpressed:e.hasBeenImpressed??!1}),x=(e={})=>{let{endpoint:t="http://localhost:4242",eventsEndpoint:o,...r}=e,n=o??t,c=s.string.uuid(),P=s.datatype.boolean(),m=s.string.uuid(),k=s.string.uuid(),R=s.string.uuid(),f=s.number.int(),b=s.number.int(),u=`${n}${a.click}`,S=`${n}${a.impression}`;return{clickPayload:{adToken:c,distinctId:m,isAddToCart:P,janeDeviceId:m,kevelToken:k,myHighD:R,productId:f,storeId:b},clickUrl:u,impressPayload:{distinctId:m,engagements:[{adToken:c,kevelToken:k,myHighD:R,productId:f}],janeDeviceId:m},impressUrl:S,isSponsored:!1,objectId:s.string.uuid(),...r}},$=(e={})=>({object_id:s.string.uuid(),...e}),v=(e={})=>({products:[$()],...e}),N=(e={creativeIds:[],endpoint:"http://localhost:4242",searchFacets:{},title:s.company.catchPhrase()})=>{let{cachedProducts:t=[x()],endpoint:o="http://localhost:4242",eventsEndpoint:r,config:n=h({endpoint:o,eventsEndpoint:r??o}),creativeIds:c=[],customImages:P=[],placement:m="menu_dynamic_row",products:k=[M()],searchFacets:R={},title:f=s.company.catchPhrase(),...b}=e,{totalProducts:u=t.length+k.length}=b,S=`${o}${a.page}`;return{cachedProducts:t,config:n,creativeIds:c,customImages:P,nextPageProps:{pageSize:60,searchAttributes:["*"]},nextPageUrl:S,placement:m,products:k,searchFacets:R,title:f,totalProducts:u}};var _=e=>{let{callback:t,endpoint:o,placements:r=[p({placement:"menu_top_row"}),p({placement:"menu_dynamic_row"}),p({placement:"menu_inline"})]}=e;return ee.post(`${o}${a.multi}`,async({request:n})=>{let c=await n.json();return t&&t({reqBody:c,url:new URL(n.url)}),te.json({placements:r},{status:200})})};import{http as $e,HttpResponse as Ne}from"msw";import{http as oe,HttpResponse as re}from"msw";var B=e=>{let{callback:t,endpoint:o,product:r=y()}=e;return oe.post(`${o}${a.product}`,async({request:n})=>{let c=await n.json();return t&&t({reqBody:c,url:new URL(n.url)}),re.json(r,{status:200})})};import{faker as l}from"@faker-js/faker";import{http as ne,HttpResponse as se}from"msw";var U=(e={})=>({activities:[],avatar:l.number.int({max:11,min:0}),comment:l.lorem.sentence(),createdAt:l.date.anytime().toISOString(),feelings:[],hasComment:!0,id:l.number.int(),nickname:"w******a",productId:l.number.int(),rating:l.number.float({fractionDigits:1,max:5,min:0}),updatedAt:l.date.anytime().toISOString(),upvoteCount:l.number.int(),...e}),L=(e={})=>({activitiesDistribution:{},averageRating:l.number.float({fractionDigits:1,max:5,min:0}),distribution:{1:1,2:2,3:5,4:10,5:20},feelingsDistribution:{},reviewCount:l.number.int({max:100,min:0}),...e}),q=(e={})=>({created_at:"2026-01-15T12:00:00Z",has_comment:!0,id:1,product_id:123,rating:5,updated_at:"2026-01-15T12:00:00Z",upvote_count:0,...e}),H=(e={})=>({average_rating:4.5,distribution:{1:1,2:2,3:5,4:10,5:20},review_count:38,...e}),ae=(e={})=>({aggregate:H(),product_id:123,reviews:[q()],total_count:1,...e}),J=({callback:e,endpoint:t,response:o})=>ne.post(`${t}${a.productReviews}`,async({request:r})=>{if(e){let n=new URL(r.url),c=await r.json();e({reqBody:c,url:n})}return se.json(ae(o),{status:200})});import{http as ce,HttpResponse as ie}from"msw";var K=(e,t)=>ce.post(`${e}${a.sessionEvent}`,async({request:o})=>{if(t){let r=new URL(o.url),n=await o.json();t({reqBody:n,url:r})}return ie.json({},{status:200})});import{http as Z,HttpResponse as d}from"msw";var z=e=>{let{callback:t,endpoint:o,...r}=e;if(!Object.values(r).some(u=>u!==void 0)){let u=Object.keys(r).join(", ");throw new Error(`At least one of [${u}] must be defined in props.`)}let{cartToppers:c,customImageRow:P,menuRow:m,menuTopRow:k,pdpRow:R,recommendedRow:f,recommendedSort:b}=r;return Z.post(`${o}${a.smart}`,async({request:u})=>{let S=await u.json();if(t){let i=new URL(u.url);t({reqBody:S,url:i})}let{placement:g}=S;if(g==="cart_toppers"&&c){let i=p(c);return d.json(i,{status:200})}if(g==="menu_inline"&&m){let i=p(m);return d.json(i,{status:200})}if(g==="menu_inline_table"&&b){let i=p(b);return d.json(i,{status:200})}if(g==="menu_dynamic_row"&&f){let i=p(f);return d.json(i,{status:200})}if(g==="custom_image_row"&&P){let i=p(P);return d.json(i,{status:200})}if(g==="menu_top_row"&&k){let i=p(k);return d.json(i,{status:200})}if(g==="pdp_row"&&R){let i=p(R);return d.json(i,{status:200})}return d.text("Invalid placement",{status:400})})},G=(e={endpoint:"https://the.weed.shop",response:{}})=>{let{callback:t,endpoint:o,response:r}=e,n=v(r);return Z.post(`${o}${a.page}`,async({request:c})=>{if(t){let P=new URL(c.url),m=await c.json();t({reqBody:m,url:P})}return d.json(n,{status:200})})};export{E as buildCustomImageData,y as buildProduct,U as buildProductReview,L as buildProductReviewsAggregate,p as buildProductsPlacementResponse,M as buildSmartSortProductProps,N as buildSmartSortProps,F as mockClick,A as mockFacets,B as mockFetchProduct,J as mockFetchProductReviews,O as mockFingerprint,T as mockImpression,_ as mockMultiFeaturedPlacements,K as mockSessionEvent,G as mockSmartSortPage,z as mockSmartSortPlacements};
|
package/package.json
CHANGED
package/dist/chunk-TGCEYA6I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Q=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var Z=(u,i,c,t)=>{for(var o=t>1?void 0:t?U(i,c):i,a=u.length-1,p;a>=0;a--)(p=u[a])&&(o=(t?p(i,c,o):p(o))||o);return t&&o&&Q(i,c,o),o};var m=(t=>(t.All="all",t.Default="default",t.Off="off",t))(m||{}),d=(s=>(s.Bloom="bloom",s.Default="default",s.Embedded="embedded",s.FramelessEmbed="framelessEmbed",s.Headless="headless",s.Kiosk="kiosk",s.OperatorEmbed="operatorEmbed",s.WhiteLabel="whiteLabel",s))(d||{}),l=(t=>(t.Desktop="desktop",t.Kiosk="kiosk",t.Mobile="mobile",t))(l||{}),g=(i=>(i.UserOptOut="user-opt-out",i))(g||{});var _=(c=>(c.Featured="featured",c.Midgrid="midgrid",c))(_||{}),P=(r=>(r.BestSelling="best_selling",r.BrandSpecials="brand_specials",r.BuyAgainRow="buy_again_row",r.CartToppers="cart_toppers",r.CustomImageRow="custom_image_row",r.FeaturedRow="featured_row",r.MenuDynamicRow="menu_dynamic_row",r.MenuInline="menu_inline",r.MenuInlineTable="menu_inline_table",r.MenuTopRow="menu_top_row",r.PdpRow="pdp_row",r.Sale="sale",r.Specials="specials",r))(P||{}),R=(n=>(n.Edible="edible",n.Extract="extract",n.Flower="flower",n.Gear="gear",n.Grow="grow",n.Merch="merch",n.PreRoll="pre-roll",n.Tincture="tincture",n.Topical="topical",n.Vape="vape",n))(R||{}),b=(t=>(t.Rating="rating",t.Recent="recent",t.Upvote="upvote",t))(b||{}),x=(e=>(e.BestSellerRank="best-seller-rank",e.CategoryAndNameAsc="category-and-name-asc",e.Default="default",e.PriceAsc="price-asc",e.PriceDesc="price-desc",e.PriceEighthOunceAsc="price-eighth-ounce-asc",e.PriceEighthOunceDesc="price-eighth-ounce-desc",e.PriceGramAsc="price-gram-asc",e.PriceGramDesc="price-gram-desc",e.PriceHalfGramAsc="price-half-gram-asc",e.PriceHalfGramDesc="price-half-gram-desc",e.PriceHalfOunceAsc="price-half-ounce-asc",e.PriceHalfOunceDesc="price-half-ounce-desc",e.PriceOunceAsc="price-ounce-asc",e.PriceOunceDesc="price-ounce-desc",e.PriceQuarterOunceAsc="price-quarter-ounce-asc",e.PriceQuarterOunceDesc="price-quarter-ounce-desc",e.PriceTwoGramAsc="price-two-gram-asc",e.PriceTwoGramDesc="price-two-gram-desc",e.Rating="rating",e.Recommendation="recommendation",e.ThcPotencyAsc="thc-potency-asc",e.ThcPotencyDesc="thc-potency-desc",e))(x||{});var z=50;var f="best-seller-rank",w="category-and-name-asc",v="default",y="price-asc",h="price-desc",C="price-eighth-ounce-asc",I="price-eighth-ounce-desc",q="price-gram-asc",D="price-gram-desc",S="price-half-gram-asc",A="price-half-gram-desc",O="price-half-ounce-asc",M="price-half-ounce-desc",T="price-ounce-asc",F="price-ounce-desc",k="price-quarter-ounce-asc",B="price-quarter-ounce-desc",G="price-two-gram-asc",E="price-two-gram-desc",j="rating",H="recommendation",N="thc-potency-asc",V="thc-potency-desc",J=[f,w,v,y,h,C,I,q,D,S,A,O,M,T,F,k,B,G,E,j,H,N,V];var L={click:"/v2/event/2",externalCheckout:"/v2/event/3e",facets:"/v2/facets",fingerprint:"/fp/token",impression:"/v2/event/1",multi:"/v2/multi",page:"/v2/smartpage",product:"/v2/product",productReviews:"/v2/product/reviews",sessionEvent:"/v2/event/session",smart:"/v2/smart"};export{Z as a,L as b,m as c,d,l as e,g as f,_ as g,P as h,R as i,b as j,x as k,z as l,f as m,w as n,v as o,y as p,h as q,C as r,I as s,q as t,D as u,S as v,A as w,O as x,M as y,T as z,F as A,k as B,B as C,G as D,E,j as F,H as G,N as H,V as I,J};
|