@picked/analytics 0.0.12-next.9 → 0.0.12

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.
@@ -0,0 +1 @@
1
+ "use strict";const h=require("@snowplow/browser-tracker"),tt=require("@snowplow/browser-plugin-button-click-tracking"),Pt=require("@snowplow/browser-plugin-performance-navigation-timing"),et=require("@snowplow/browser-plugin-error-tracking"),St=require("@snowplow/browser-plugin-web-vitals"),P=require("@picked/client");function nt(t,e){return`iglu:dev.pckd/${t}/jsonschema/${e}`}function L(t,...e){}function $(t,...e){}function l(t,e,o={}){return{event:{schema:nt("event","1-0-0"),data:{type:t,meta:o}},context:e.filter(a=>a!==void 0)}}function n(t,e,o){return{schema:nt(t,e),data:o}}function u(t,e){return(o,a)=>{const s=e(o,a);h.trackSelfDescribingEvent(s)}}function _(t,e,o={passive:!0}){const a=new WeakMap;return(s,i)=>{let r=a.get(s);if(r||(r=new Set,a.set(s,r)),r.has(t))return;function c(E){const C=i();e({event:E,analyticsContext:C})}s.addEventListener(t,c,o),r.add(t)}}function Vt(t,e){const o=new Set;return a=>{if(o.has(t)||!P.supportsDocument())return;function s(i){const r=a();e({event:i,analyticsContext:r})}document.addEventListener(t,s,{passive:!0}),o.add(t)}}function y(t,e){const o=new Set;return a=>{if(o.has(t)||!P.supportsWindow())return;function s(i){const r=a();e({event:i,analyticsContext:r})}window.addEventListener(t,s,{passive:!0}),o.add(t)}}function f(t){var o;return{items:((o=t.features)==null?void 0:o.map(({feature:a,name:s,key:i,bucket:r})=>({ab_feature:a,ab_name:s,ab_key:i,ab_bucket:r})))||[]}}const D="unknown";function d(t){var a;const e=qt(),o={id:t.sessionId||null};return e&&(o.gaid=e),(a=t.shopifySession)!=null&&a.clientId&&(o.shopify_client_id=t.shopifySession.clientId),o}function S(t){if(t.fields)return{items:t.fields.map(({id:e,type:o,label:a,options:s})=>({id:e,type:o,label:a,options:s}))}}function G(t){if(t.responses)return{items:t.responses.map(({fieldId:e,value:o})=>({field_id:e,values:Array.isArray(o)?o.map(a=>({value:a})):[{value:o}]}))}}function x(t,e=!1){const{step:o}=t;if(o)return{id:o.id,title:o.label};if(e)return $('"step" is required for this event',t),{id:D,title:D}}function Yt(t,e=!1){const{productList:o}=t;if(o)return{items:o.map(a=>({item_id:a.itemId,item_name:a.itemName,affiliation:a.affiliation,coupon:a.coupon,currency:a.currency,creative_name:a.creativeName,creative_slot:a.creativeSlot,discount:w(a.discount),index:w(a.index),item_brand:a.itemBrand,item_category:a.itemCategory,item_category2:a.itemCategory2,item_category3:a.itemCategory3,item_category4:a.itemCategory4,item_category5:a.itemCategory5,item_list_id:a.itemListId,item_list_name:a.itemListName,item_variant:a.itemVariant,location_id:a.locationId,price:w(a.price),promotion_id:a.promotionId,promotion_name:a.promotionName,quantity:w(a.quantity)}))};if(e)return $('"productList" is required for this event',t),{}}function p(t,e=!1){const{experience:o}=t;if(o)return{id:o.id,type:o.type,title:o.title};if(e)return $('"experience" is required for this event',t),{id:D,type:D,title:D}}function U(t,e=!1){const{exception:o}=t;if(o)return typeof o=="string"?{reason:o}:{reason:o.systemMessage};if(e)return $('"exception" is required for this event',t),{reason:D}}function V(t){const{form:e}=t;return e?{id:e.id,title:e.title}:($('"form" is required for this event',t),{id:D,title:D})}function Bt(t){const{modal:e}=t;return e?{id:e.id,title:e.title}:($('"modal" is required for this event',t),{id:D,title:D})}function Y(t,e=300){let o;return function(...a){clearTimeout(o),o=setTimeout(()=>t.apply(this,a),e)}}function w(t){if(typeof t=="number")return t;if(typeof t!="string")return;const e=parseFloat(t);if(!isNaN(e))return e}function qt(){if(!P.supportsDocument()||!P.supportsCookies())return null;const t="_ga=",e=document.cookie?document.cookie.split(";"):[];for(const o of e){const a=o.trim();if(a.startsWith(t)){const i=a.substring(t.length).split(".");if(i.length>2)return i.slice(2).join(".")}}}function Ht(t){const e=[];return t.trackErrors&&(L(),e.push(et.ErrorTrackingPlugin())),t.trackVitals&&(L(),e.push(St.WebVitalsPlugin())),t.trackPerformance&&(L(),e.push(Pt.PerformanceNavigationTimingPlugin())),(t.trackButtonClickAllowList||t.trackButtonClickFilter)&&e.push(tt.ButtonClickTrackingPlugin()),e}function Ft(t){t.trackActivity&&!t.trackActivityCallback&&(L(),h.enableActivityTracking({minimumVisitLength:30,heartbeatDelay:10})),t.trackActivity&&t.trackActivityCallback&&(L(),h.enableActivityTrackingCallback({minimumVisitLength:30,heartbeatDelay:10,callback:t.trackActivityCallback})),(t.trackButtonClickAllowList||t.trackButtonClickFilter)&&(L(),tt.enableButtonClickTracking({filter:t.trackButtonClickAllowList?{allowlist:t.trackButtonClickAllowList}:t.trackButtonClickFilter})),t.trackErrors&&(L(),et.enableErrorTracking())}function At({organizationId:t,projectId:e,cvlyX:o,collectorUrl:a="evnts.pckd.dev",appId:s="picked-analytics",trackVitals:i=!0,trackPerformance:r=!0,trackWebPage:c=!0,trackSessions:E=!0,trackBrowser:C=!0,trackActivity:gt=!0,trackErrors:$t=!0,trackActivityCallback:yt,trackButtonClickAllowList:ht}){L();const I={trackVitals:i,trackErrors:$t,trackActivity:gt,trackPerformance:r,trackActivityCallback:yt,trackButtonClickAllowList:ht},wt={appId:s,platform:"web",contexts:{webPage:c,session:E,browser:C||!1},plugins:Ht(I)},Nt=h.newTracker(s,a,wt);return Rt({organizationId:t,projectId:e,cvlyX:o}),Ft(I),Nt}function Rt({organizationId:t,projectId:e,cvlyX:o}){if(!t||!e)throw new Error("bindGlobalContext: Both organizationId and projectId are required");const a=[];a.push(n("app","1-0-0",{organization_id:t,project_id:e})),o&&a.push(n("cvly_x","1-0-1",{vercel_deployment_id:o.vercelDeploymentId,vercel_env:o.vercelEnv,vercel_url:o.vercelUrl})),h.addGlobalContexts(a)}const ot="app_close";function Wt(t,e){const o=f(t),a=d(t),s=p(t),i=x(t);return l(ot,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Ot=u(ot,Wt),st="app_load";function Mt(t,e){const o=f(t),a=d(t),s=p(t),i=x(t);return l(st,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const jt=u(st,Mt),at="app_open";function Gt(t,e){const o=f(t),a=d(t),s=p(t),i=x(t);return l(at,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Ut=u(at,Gt),it="experience_load";function It(t,e){const o=f(t),a=d(t),s=p(t,!0),i=x(t);return l(it,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("experience","1-0-0",s),i?n("step","1-0-0",i):void 0],e)}const zt=u(it,It),rt="field_validation_error";function Kt(t,e){const o=f(t),a=d(t),s=V(t),i=U(t,!0),r=p(t),c=x(t);return l(rt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("exception","1-0-0",i),n("form","1-0-0",s),r&&n("experience","1-0-0",r),c&&n("step","1-0-0",c)],e)}const Xt=u(rt,Kt),ct="form_submit";function Jt(t,e){const o=f(t),a=d(t),s=V(t),i=p(t),r=x(t);return l(ct,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("form","1-0-0",s),i&&n("experience","1-0-0",i),r&&n("step","1-0-0",r)],e)}const Qt=u(ct,Jt),lt="form_submit_error";function Zt(t,e){const o=f(t),a=d(t),s=V(t),i=U(t,!0),r=p(t),c=x(t);return l(lt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("form","1-0-0",s),n("exception","1-0-0",i),r&&n("experience","1-0-0",r),c&&n("step","1-0-0",c)],e)}const te=u(lt,Zt),ut="form_submit_success";function ee(t,e){const o=f(t),a=d(t),s=V(t),i=p(t),r=x(t);return l(ut,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("form","1-0-0",s),i&&n("experience","1-0-0",i),r&&n("step","1-0-0",r)],e)}const ne=u(ut,ee),ft="step_enter";function oe(t,e){const o=f(t),a=d(t),s=p(t),i=x(t,!0),r=S(t);return l(ft,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("step","1-0-0",i),r&&n("field_list","1-0-0",r),s&&n("experience","1-0-0",s)],e)}const se=u(ft,oe),dt="step_submit";function ae(t,e){const o=f(t),a=d(t),s=p(t),i=x(t,!0),r=G(t),c=S(t);return l(dt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("step","1-0-0",i),c&&n("field_list","1-0-0",c),r&&n("response_list","1-0-0",r),s&&n("experience","1-0-0",s)],e)}const ie=u(dt,ae),xt="step_submit_success";function re(t,e){const o=f(t),a=d(t),s=p(t),i=x(t,!0),r=S(t),c=G(t);return l(xt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("step","1-0-0",i),r&&n("field_list","1-0-0",r),c&&n("response_list","1-0-0",c),s&&n("experience","1-0-0",s)],e)}const ce=u(xt,re);function b(t){return t instanceof Element}function k(t){const e=["a","button","input","select","textarea","details","summary","label","form","fieldset","legend","optgroup","option","output","datalist","dialog","menu","menuitem","iframe","audio","video","embed","object","canvas"].join(", ");return b(t)?t.matches(e)?t:t.closest(e):null}function v(t){if(t instanceof HTMLSelectElement){const e=t.selectedIndex||0,o=t.options[e];return(o==null?void 0:o.text)??""}return"innerText"in t&&typeof t.innerText=="string"?t.innerText:t.textContent}function T(t){const e=t.getAttribute("aria-label");if(e)return e;const o=t.getAttribute("aria-labelledby");if(o){const s=document.getElementById(o);if(s){const i=v(s);if(i)return i}}if("id"in t&&t.id){const s=document.querySelector(`label[for="${t.id}"]`);if(s){const i=v(s);if(i)return i}}let a=t.parentElement;for(;a;){if(a.tagName.toLowerCase()==="label"){const s=v(a);if(s)return s}a=a.parentElement}if(t instanceof HTMLInputElement&&"labels"in t&&t.labels){const s=Array.from(t.labels).map(i=>v(i)).filter(Boolean).join(" ");if(s)return s}return"placeholder"in t&&typeof t.placeholder=="string"?t.placeholder:null}const le=255;function m(t){return t?t.slice(0,le):null}const q="rapid_scroll";function ue(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r)){const C={node_type:"unknown"};return l(q,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",C)],e)}const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(q,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",E)],e)}const fe=u(q,ue),de=100,xe=100,pe=300;let z=0,K=0;const Ee=Y((t,e)=>{fe(t,e)},pe);function me(t,e){const o=t.event.target||document.documentElement;if(!(o instanceof HTMLElement))return;const a=o.scrollTop,s=Date.now()-K;Math.abs(a-z)>de&&s<xe&&Ee(t.event,e),z=a,K=Date.now()}const Ce=_("scroll",me,!0),H="rapid_click";function ve(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r)){const C={node_type:"unknown"};return l(H,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",C),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(H,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",E),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const De=u(H,ve);let N=0,X=0;const _e=3,be=500;function ke(t,e){const o=new Date().getTime();o-X<be?N++:N=1,X=o,N>=_e&&(De(t,e),N=0)}const Te=_("click",ke),F="right_click";function Le(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r)){const C={node_type:"unknown"};return l(F,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",C),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0])}const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(F,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",E),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const ge=u(F,Le);function $e(t,e){ge(t,e)}const ye=_("contextmenu",$e),pt="mouse_shake";function he(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(pt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const we=u(pt,he),Ne=5,Pe=500,Se=500;let J={x:0},g=[],Q=0;const Ve=Y((t,e)=>{we(t,e)},Pe);function Ye(t,e){const o=Date.now(),a=t.event.clientX-J.x,s=Math.sign(a);o-Q>Se&&(g=[]),s!==0&&(g.length===0||g[g.length-1]!==s)&&g.push(s),J={x:t.event.clientX,y:t.event.clientY},g.length>=Ne&&(Ve(t,e),g=[]),Q=o}const Be=_("mousemove",Ye),Et="page_visible";function qe(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(Et,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const He=u(Et,qe),mt="page_hidden";function Fe(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(mt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Ae=u(mt,Fe);function Re(t,e){if(document.visibilityState==="visible"){He(t,e);return}Ae(t,e)}const We=Vt("visibilitychange",Re),A="backspace";function Oe(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r)){const C={node_type:"unknown"};return l(A,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",C),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(A,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",E),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Me=u(A,Oe);function je(t,e){t.event.key==="Backspace"&&Me(t,e)}const Ge=_("keydown",je),Ct="page_hide";function Ue(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(Ct,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Ie=u(Ct,Ue);function ze(t,e){Ie(t,e)}const Ke=y("pagehide",ze),vt="page_show";function Xe(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(vt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Je=u(vt,Xe);function Qe(t,e){Je(t,e)}const Ze=y("pageshow",Qe),Dt="offline";function tn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(Dt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const en=u(Dt,tn);function nn(t,e){en(t,e)}const on=y("offline",nn),R="scroll";function sn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r))return l(R,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e);const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(R,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",E)],e)}const an=u(R,sn),rn=Y((t,e)=>{an(t,e)},500),cn=_("scroll",rn,!0),_t="online";function ln(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(_t,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const un=u(_t,ln);function fn(t,e){un(t,e)}const dn=y("online",fn),bt="resize";function xn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(bt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Z=u(bt,xn);let B=0;const pn=Y((t,e)=>{const o=window.innerWidth;o!==B?(Z(t,e),B=o):"ontouchstart"in window||Z(t,e),B=o},300),En=y("resize",pn),kt="unload";function mn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext);return l(kt,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const Cn=u(kt,mn);function vn(t,e){Cn(t,e)}const Dn=y("unload",vn),W="click";function _n(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r)){const C={node_type:"unknown"};return l(W,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",C),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(W,[n("feature_list","2-0-0",o),n("session","1-0-2",a),n("element","1-0-0",E),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e)}const bn=u(W,_n);function kn(t,e){bn(t,e)}const Tn=_("click",kn),O="paste";function Ln(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r))return l(O,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e);const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(O,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",E)],e)}const gn=u(O,Ln);function $n(t,e){gn(t,e)}const yn=_("paste",$n),M="copy";function hn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r))return l(M,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e);const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(M,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",E)],e)}const wn=u(M,hn);function Nn(t,e){wn(t,e)}const Pn=_("copy",Nn),j="drag";function Sn(t,e){const o=f(t.analyticsContext),a=d(t.analyticsContext),s=p(t.analyticsContext),i=x(t.analyticsContext),r=t.event.target||document.activeElement||t.event.currentTarget;if(!b(r))return l(j,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0],e);const c=k(r)||r,E={id:c.id||null,node_type:c.nodeName.toLowerCase(),label:m(T(c)),text:m(v(c))};return l(j,[n("feature_list","2-0-0",o),n("session","1-0-2",a),i?n("step","1-0-0",i):void 0,s?n("experience","1-0-0",s):void 0,n("element","1-0-0",E)],e)}const Vn=u(j,Sn);function Tt(t,e){const o=t.event.currentTarget;if(!o||!(o instanceof HTMLElement))return;function a(s){Tt({event:s,analyticsContext:t.analyticsContext})}o.removeEventListener("drag",a),o.addEventListener("dragend",()=>Lt(o,()=>t.analyticsContext)),Vn(t,e)}const Lt=_("drag",Tt);function Yn(t,e){e&&(Tn(e,t),Te(e,t),ye(e,t),Pn(e,t),yn(e,t),Lt(e,t),Ge(e,t),cn(e,t),Ce(e,t),Be(e,t))}function Bn(t){We(t),Ke(t),Ze(t),on(t),dn(t),En(t),Dn(t)}exports.bindGlobalEventListeners=Bn;exports.bindUserInteractionListeners=Yn;exports.createContext=n;exports.createEvent=l;exports.createTrackEvent=u;exports.createTracker=At;exports.formatExceptionContextData=U;exports.formatExperienceContextData=p;exports.formatFeatureListContextData=f;exports.formatFieldListContextData=S;exports.formatModalContextData=Bt;exports.formatProductListContextData=Yt;exports.formatResponseListContextData=G;exports.formatSessionContextData=d;exports.formatStepContextData=x;exports.trackAppCloseEvent=Ot;exports.trackAppLoadEvent=jt;exports.trackAppOpenEvent=Ut;exports.trackExperienceLoadEvent=zt;exports.trackFieldValidationErrorEvent=Xt;exports.trackFormSubmitErrorEvent=te;exports.trackFormSubmitEvent=Qt;exports.trackFormSubmitSuccessEvent=ne;exports.trackStepEnterEvent=se;exports.trackStepSubmitEvent=ie;exports.trackStepSubmitSuccessEvent=ce;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/analytics",
3
3
  "description": "Picked Analytics",
4
- "version": "0.0.12-next.9",
4
+ "version": "0.0.12",
5
5
  "dependencies": {
6
6
  "@snowplow/browser-plugin-button-click-tracking": "^4.6.5",
7
7
  "@snowplow/browser-plugin-error-tracking": "^4.6.5",
@@ -24,9 +24,9 @@
24
24
  "terser": "^5.41.0",
25
25
  "tsup": "^8.5.0",
26
26
  "tsx": "^4.20.3",
27
- "vite": "^6.4.1",
27
+ "vite": "^6.3.5",
28
28
  "vite-plugin-dts": "^4.5.4",
29
- "vitest": "^3.2.4"
29
+ "vitest": "^3.2.2"
30
30
  },
31
31
  "exports": {
32
32
  ".": {
@@ -48,7 +48,7 @@
48
48
  "main": "./dist/cjs/index.js",
49
49
  "module": "./dist/esm/index.js",
50
50
  "peerDependencies": {
51
- "@picked/client": "0.0.12-next.9",
51
+ "@picked/client": "0.0.12",
52
52
  "effector": "^23.3.0"
53
53
  },
54
54
  "private": false,
@@ -1,4 +0,0 @@
1
- import { AnalyticsContext } from '../types';
2
- import { EventSchema } from '../schemas';
3
- export declare const trackFeatureDecideEvent: (eventPayload: AnalyticsContext, eventMeta?: EventSchema["meta"]) => void;
4
- //# sourceMappingURL=feature_decide.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature_decide.d.ts","sourceRoot":"","sources":["../../../src/events/feature_decide.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,gBAAgB,EAMjB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AA8B7C,eAAO,MAAM,uBAAuB,2EAA4C,CAAA"}
@@ -1,40 +0,0 @@
1
- import { FromSchema } from 'json-schema-to-ts';
2
- export declare const schema: {
3
- readonly $schema: "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#";
4
- readonly additionalProperties: true;
5
- readonly description: "Schema for an experience";
6
- readonly minProperties: 1;
7
- readonly properties: {
8
- readonly id: {
9
- readonly description: "The experience ID";
10
- readonly type: "string";
11
- readonly maxLength: 255;
12
- };
13
- readonly type: {
14
- readonly description: "The experience type";
15
- readonly type: readonly ["string", "null"];
16
- readonly maxLength: 255;
17
- };
18
- readonly title: {
19
- readonly description: "The experience title";
20
- readonly type: "string";
21
- readonly maxLength: 255;
22
- };
23
- readonly meta: {
24
- readonly description: "Additional metadata";
25
- readonly additionalProperties: true;
26
- readonly type: readonly ["object", "null"];
27
- };
28
- };
29
- readonly required: readonly ["id", "title"];
30
- readonly self: {
31
- readonly vendor: "dev.pckd";
32
- readonly name: "experience";
33
- readonly format: "jsonschema";
34
- readonly version: "1-0-1";
35
- };
36
- readonly type: "object";
37
- };
38
- export type Schema = FromSchema<typeof schema>;
39
- export type Version = typeof schema.self.version;
40
- //# sourceMappingURL=1-0-1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"1-0-1.d.ts","sourceRoot":"","sources":["../../../../src/schemas/experience/1-0-1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCT,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAA;AAC9C,MAAM,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAA"}
@@ -1,168 +0,0 @@
1
- import { FromSchema } from 'json-schema-to-ts';
2
- export declare const schema: {
3
- readonly $schema: "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#";
4
- readonly additionalProperties: true;
5
- readonly description: "Schema for a product list";
6
- readonly minProperties: 1;
7
- readonly properties: {
8
- readonly title: {
9
- readonly description: "The title of the product list";
10
- readonly type: readonly ["string", "null"];
11
- readonly maxLength: 255;
12
- };
13
- readonly items: {
14
- readonly description: "A list of products";
15
- readonly type: "array";
16
- readonly items: {
17
- readonly type: "object";
18
- readonly description: "Products in the list";
19
- readonly properties: {
20
- readonly item_id: {
21
- readonly type: readonly ["string", "null"];
22
- readonly description: "The product ID";
23
- readonly maxLength: 255;
24
- };
25
- readonly item_name: {
26
- readonly type: readonly ["string", "null"];
27
- readonly description: "The product name";
28
- readonly maxLength: 255;
29
- };
30
- readonly affiliation: {
31
- readonly type: readonly ["string", "null"];
32
- readonly description: "The affiliation";
33
- readonly maxLength: 255;
34
- };
35
- readonly coupon: {
36
- readonly type: readonly ["string", "null"];
37
- readonly description: "The coupon code";
38
- readonly maxLength: 255;
39
- };
40
- readonly currency: {
41
- readonly type: readonly ["string", "null"];
42
- readonly description: "The currency";
43
- readonly maxLength: 255;
44
- };
45
- readonly creative_name: {
46
- readonly type: readonly ["string", "null"];
47
- readonly description: "The creative name";
48
- readonly maxLength: 255;
49
- };
50
- readonly creative_slot: {
51
- readonly type: readonly ["string", "null"];
52
- readonly description: "The creative slot";
53
- readonly maxLength: 255;
54
- };
55
- readonly discount: {
56
- readonly type: readonly ["number", "null"];
57
- readonly description: "The discount";
58
- readonly minimum: -9999999999;
59
- readonly maximum: 9999999999;
60
- };
61
- readonly index: {
62
- readonly type: readonly ["number", "null"];
63
- readonly description: "The index";
64
- readonly minimum: -9999999999;
65
- readonly maximum: 9999999999;
66
- };
67
- readonly item_brand: {
68
- readonly type: readonly ["string", "null"];
69
- readonly description: "The item brand";
70
- readonly maxLength: 255;
71
- };
72
- readonly item_category: {
73
- readonly type: readonly ["string", "null"];
74
- readonly description: "The item category";
75
- readonly maxLength: 255;
76
- };
77
- readonly item_category2: {
78
- readonly type: readonly ["string", "null"];
79
- readonly description: "The item category 2";
80
- readonly maxLength: 255;
81
- };
82
- readonly item_category3: {
83
- readonly type: readonly ["string", "null"];
84
- readonly description: "The item category 3";
85
- readonly maxLength: 255;
86
- };
87
- readonly item_category4: {
88
- readonly type: readonly ["string", "null"];
89
- readonly description: "The item category 4";
90
- readonly maxLength: 255;
91
- };
92
- readonly item_category5: {
93
- readonly type: readonly ["string", "null"];
94
- readonly description: "The item category 5";
95
- readonly maxLength: 255;
96
- };
97
- readonly item_list_id: {
98
- readonly type: readonly ["string", "null"];
99
- readonly description: "The item list ID";
100
- readonly maxLength: 255;
101
- };
102
- readonly item_list_name: {
103
- readonly type: readonly ["string", "null"];
104
- readonly description: "The item list";
105
- readonly maxLength: 255;
106
- };
107
- readonly item_variant: {
108
- readonly type: readonly ["string", "null"];
109
- readonly description: "The item variant";
110
- readonly maxLength: 255;
111
- };
112
- readonly location_id: {
113
- readonly type: readonly ["string", "null"];
114
- readonly description: "The location ID";
115
- readonly maxLength: 255;
116
- };
117
- readonly price: {
118
- readonly type: readonly ["number", "null"];
119
- readonly description: "The price";
120
- readonly minimum: -9999999999;
121
- readonly maximum: 9999999999;
122
- };
123
- readonly promotion_id: {
124
- readonly type: readonly ["string", "null"];
125
- readonly description: "The promotion ID";
126
- readonly maxLength: 255;
127
- };
128
- readonly promotion_name: {
129
- readonly type: readonly ["string", "null"];
130
- readonly description: "The promotion name";
131
- readonly maxLength: 255;
132
- };
133
- readonly quantity: {
134
- readonly type: readonly ["number", "null"];
135
- readonly description: "The quantity";
136
- readonly minimum: -9999999999;
137
- readonly maximum: 9999999999;
138
- };
139
- readonly meta: {
140
- readonly description: "Additional metadata";
141
- readonly additionalProperties: true;
142
- readonly type: readonly ["object", "null"];
143
- };
144
- readonly in_stock: {
145
- readonly description: "The stock availability of the product";
146
- readonly type: readonly ["boolean", "null"];
147
- };
148
- };
149
- };
150
- };
151
- readonly meta: {
152
- readonly description: "Additional metadata";
153
- readonly additionalProperties: true;
154
- readonly type: readonly ["object", "null"];
155
- };
156
- };
157
- readonly required: readonly ["items"];
158
- readonly self: {
159
- readonly vendor: "dev.pckd";
160
- readonly name: "product_list";
161
- readonly format: "jsonschema";
162
- readonly version: "2-0-1";
163
- };
164
- readonly type: "object";
165
- };
166
- export type Schema = FromSchema<typeof schema>;
167
- export type Version = typeof schema.self.version;
168
- //# sourceMappingURL=2-0-1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"2-0-1.d.ts","sourceRoot":"","sources":["../../../../src/schemas/product_list/2-0-1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKT,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAA;AAC9C,MAAM,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAA"}