@heycatch/sdk 0.6.0 → 0.7.0-dev.41
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/README.md +2 -1
- package/THIRD-PARTY-LICENSES.md +360 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +26 -83
- package/dist/index.d.ts +26 -83
- package/dist/index.js +2 -2
- package/dist/react-native.cjs +2 -0
- package/dist/react-native.d.cts +98 -0
- package/dist/react-native.d.ts +98 -0
- package/dist/react-native.js +2 -0
- package/dist/server.cjs +3 -0
- package/dist/server.d.cts +78 -0
- package/dist/server.d.ts +78 -0
- package/dist/server.js +3 -0
- package/dist/shared-B8y8fJCD.d.cts +157 -0
- package/dist/shared-B8y8fJCD.d.ts +157 -0
- package/package.json +50 -10
- package/AGENTS.md +0 -132
- package/docs/short-links.md +0 -69
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var H=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},De=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ne(t))!je.call(e,i)&&i!==r&&H(e,i,{get:()=>t[i],enumerable:!(o=Oe(t,i))||o.enumerable});return e};var Le=e=>De(H({},"__esModule",{value:!0}),e);var ft={};Fe(ft,{HeyCatchProvider:()=>Me,SDK_VERSION:()=>P,STAGE:()=>k,analytics:()=>lt});module.exports=Le(ft);var te="project",Ue="[a-z0-9]",dt=new RegExp(`^${Ue}$`);var we=require("posthog-react-native");var re;function f(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:n,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=n.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function n(s){var u;let a=r?.Parent?new c:this;o(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(n,"init",{value:o}),Object.defineProperty(n,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(B,e),B}function ne(e,t){return typeof t=="bigint"?t.toString():t}function ie(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var oe=Symbol("evaluating");function z(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==oe)return o===void 0&&(o=oe,o=r()),o},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var V="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function se(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function W(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function G(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function v(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var _t={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function E(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ue(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function J(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let o=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:n,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=n),s}var ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ne,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=f("$ZodError",ae),A=f("$ZodError",ae,{Parent:Error});var Be=e=>(t,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise)throw new _;if(n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw V(s,i?.callee),s}return n.value},R=Be(A),Ke=e=>async(t,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise&&(n=await n),n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw V(s,i?.callee),s}return n.value},O=Ke(A),Ve=e=>(t,r,o)=>{let i=o?{...o,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??pe)(c.issues.map(n=>$(n,i,x())))}:{success:!0,data:c.value}},T=Ve(A),We=e=>async(t,r,o)=>{let i=o?{...o,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(n=>$(n,i,x())))}:{success:!0,data:c.value}},S=We(A);var Ge="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Je=new RegExp(`^${Ge}$`);var le=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Y=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ye=f("$ZodCheckStringFormat",(e,t)=>{var r,o;Y.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),me=f("$ZodCheckRegex",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var de={major:4,minor:4,patch:3};var y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=de;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(n,s,u)=>{let a=E(n),p;for(let m of s){if(m._zod.def.when){if(ue(n)||!m._zod.def.when(n))continue}else if(a)continue;let l=n.issues.length,d=m._zod.check(n);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,n.issues.length!==l&&(a||(a=E(n,l)))});else{if(n.issues.length===l)continue;a||(a=E(n,l))}}return p?p.then(()=>n):n},c=(n,s,u)=>{if(E(n))return n.aborted=!0,n;let a=i(s,o,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(n,s)=>{if(s.skipChecks)return e._zod.parse(n,s);if(s.direction==="backward"){let a=e._zod.parse({value:n.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,n,s)):c(a,n,s)}let u=e._zod.parse(n,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,o,s))}return i(u,o,s)}}z(e,"~standard",()=>({validate:i=>{try{let c=T(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return S(e,i).then(n=>n.success?{value:n.data}:{issues:n.error?.issues})}},vendor:"zod",version:1}))}),ge=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??le(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});function he(e,t,r){e.issues.length&&t.issues.push(...J(r,e.issues)),t.value[r]=e.value}var xe=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let n=0;n<i.length;n++){let s=i[n],u=t.element._zod.run({value:s,issues:[]},o);u instanceof Promise?c.push(u.then(a=>he(a,r,n))):he(u,r,n)}return c.length?Promise.all(c).then(()=>r):r}});function N(e,t,r,o,i,c){let n=r in o;if(e.issues.length){if(i&&c&&!n)return;t.issues.push(...J(r,e.issues))}if(!n&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?n&&(t.value[r]=void 0):t.value[r]=e.value}function Qe(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function et(e,t,r,o,i,c){let n=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){n.push(l);continue}let d=u.run({value:t[l],issues:[]},o);d instanceof Promise?e.push(d.then(g=>N(g,r,l,t,p,m))):N(d,r,l,t,p,m)}return n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ze=f("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=ie(()=>Qe(t));z(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,n;e._zod.parse=(s,u)=>{n??(n=o.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=n.shape;for(let l of n.keys){let d=m[l],g=d._zod.optin==="optional",ee=d._zod.optout==="optional",U=d._zod.run({value:a[l],issues:[]},u);U instanceof Promise?p.push(U.then(Re=>N(Re,s,l,a,g,ee))):N(U,s,l,a,g,ee)}return c?et(p,a,s,u,o.value,e):p.length?Promise.all(p).then(()=>s):s}});var ve=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,o);return i instanceof Promise?i.then(c=>_e(c,t)):_e(i,t)}});function _e(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function $e(e,t){return new e({type:"string",...v(t)})}function q(e,t){return new me({check:"string_format",format:"regex",...v(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");y.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>R(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>T(e,r,o),e.parseAsync=async(r,o)=>O(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>S(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>G(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),rt=f("ZodMiniString",(e,t)=>{ge.init(e,t),j.init(e,t)});function b(e){return $e(rt,e)}var ot=f("ZodMiniArray",(e,t)=>{xe.init(e,t),j.init(e,t)});function ye(e,t){return new ot({type:"array",element:e,...v(t)})}var nt=f("ZodMiniObject",(e,t)=>{ze.init(e,t),j.init(e,t),z(e,"shape",()=>t.shape)});function X(e,t){let r={type:"object",shape:e??{},...v(t)};return new nt(r)}var it=f("ZodMiniDefault",(e,t)=>{ve.init(e,t),j.init(e,t)});function Z(e,t){return new it({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():W(t)}})}var F="https://in.dev.heycatch.ai",k="dev",P="0.7.0-dev.41",be="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";var w="unknown",Ze=X({projectKey:b({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(q(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:Z(ye(b()),[]),install:Z(X({framework:Z(b(),w),frameworkVersion:Z(b(),w),agent:Z(b(),w)}),{framework:w,frameworkVersion:w,agent:w})});var Q=null;function h(){return Q}function ke(e){if(Q!==null)return;let t=Ze.safeParse(e);if(!t.success){let c=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${c}`);return}let r=new we.PostHog(be,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};r.register({heycatch_sdk_version:P,heycatch_sdk_stage:k,heycatch_project_key:t.data.projectKey,...i}),r.group(te,t.data.projectKey,{key:t.data.projectKey,sdk_version:P,sdk_stage:k,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:F}),Q=r,console.info(`[HeyCatch] SDK v${P} (${k}) initialized \u2192 ${F}`)}function Pe(e,t,r){let o=h();if(o!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}o.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function Ee(){let e=h();e!==null&&e.reset()}function D(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function Ce(e,t,r){let o=h();if(o!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}o.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function Ae(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Se=require("posthog-react-native"),Ie=require("react");var L=require("react/jsx-runtime");function ut(){try{return typeof require!="function"?null:require("expo-router")}catch{return null}}var Te=ut();function at(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[o]=i;continue}Array.isArray(i)&&(r[o]=i.filter(c=>typeof c=="string").join(","))}return r}function pt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),i=JSON.stringify(t());return(0,Ie.useEffect)(()=>{D(o,at(i))},[o,i]),null}function Me({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,L.jsxs)(Se.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Te===null?null:(0,L.jsx)(pt,{router:Te}),e]})}var lt={init:ke,resetIdentity:Ee,setIdentity:Pe,setPersonProperties:Ae,trackEvent:Ce,trackScreen:D};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
|
|
2
|
+
//# sourceMappingURL=react-native.cjs.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.cjs';
|
|
2
|
+
export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.cjs';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Link the device's anonymous visitor to the authenticated user. Same
|
|
7
|
+
* contract as the web entry: a stable internal user id - never an email or
|
|
8
|
+
* a session token - with email/name in the PROPERTIES. No-op before
|
|
9
|
+
* `init()`, mirroring the web entry.
|
|
10
|
+
*/
|
|
11
|
+
declare function setIdentity(userId: string, properties?: HeyCatchPersonProperties, propertiesOnce?: HeyCatchPersonProperties): void;
|
|
12
|
+
/**
|
|
13
|
+
* Clear the current identity. Call on sign-out so the next user on this
|
|
14
|
+
* device starts anonymous.
|
|
15
|
+
*/
|
|
16
|
+
declare function resetIdentity(): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the React Native entry. Call once at module scope of the root
|
|
20
|
+
* layout (`app/_layout.tsx`); idempotent. The client queues everything
|
|
21
|
+
* captured before its async storage finishes loading, so nothing is lost
|
|
22
|
+
* around startup.
|
|
23
|
+
*/
|
|
24
|
+
declare function init(config: HeyCatchConfig): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Record a screen view. `HeyCatchProvider` calls this automatically on
|
|
28
|
+
* Expo Router route changes; call it manually only on a non-Expo-Router
|
|
29
|
+
* navigator (pass the current route name from your navigation container).
|
|
30
|
+
*
|
|
31
|
+
* Manual by design: the transport's own screen autocapture is broken on
|
|
32
|
+
* React Navigation v7 (what current Expo Router runs on) - its hooks may
|
|
33
|
+
* not run above the navigator, which is exactly where a provider sits.
|
|
34
|
+
*/
|
|
35
|
+
declare function trackScreen(name: string, properties?: HeyCatchProperties): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Record a product event. Touch autocapture (via `HeyCatchProvider`) and
|
|
39
|
+
* lifecycle events cover behaviour - this is for the moments only the app
|
|
40
|
+
* knows about. Same validation contract as the web entry; `userId` in the
|
|
41
|
+
* options is ignored here, the device session already knows who.
|
|
42
|
+
*/
|
|
43
|
+
declare function trackEvent(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
|
|
44
|
+
/**
|
|
45
|
+
* Update the current person's properties without sending a product event -
|
|
46
|
+
* same surface as the web entry. The `$set` event is the transport's
|
|
47
|
+
* person-update carrier; it is a built-in, not a custom event, so no
|
|
48
|
+
* `heycatch_custom_user_event` stamp.
|
|
49
|
+
*/
|
|
50
|
+
declare function setPersonProperties(set?: HeyCatchPersonProperties, setOnce?: HeyCatchPersonProperties): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Mount once in the root layout (`app/_layout.tsx`), wrapping the layout's
|
|
54
|
+
* children. It adds the two things `init` alone cannot: touch autocapture
|
|
55
|
+
* (the transport hooks touches via a root View, so a component is
|
|
56
|
+
* structurally required) and automatic screen views on Expo Router.
|
|
57
|
+
* Everything else - lifecycle events, identity, business events - works
|
|
58
|
+
* from `init` alone.
|
|
59
|
+
*/
|
|
60
|
+
declare function HeyCatchProvider({ children, }: {
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}): ReactNode;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The React Native entry. The `react-native` export condition routes a
|
|
66
|
+
* bare `@heycatch/sdk` import here under Metro (newest Expo enables
|
|
67
|
+
* package exports with that condition), so the customer API stays ONE
|
|
68
|
+
* surface across web, server, and native.
|
|
69
|
+
*
|
|
70
|
+
* Wraps posthog-react-native - a regular dependency, deliberately NOT
|
|
71
|
+
* bundled: bundling breaks its optional-Expo-peer probing. Not a peer
|
|
72
|
+
* either: a peer would force the agent guide to name the vendor in its
|
|
73
|
+
* install line (the vendor-ban spec forbids exactly that); the dependency
|
|
74
|
+
* resolves silently instead. The Expo companions are app-level installs
|
|
75
|
+
* the guide's RN line carries (`expo-file-system` above all - without it
|
|
76
|
+
* persistence silently falls back to memory and every launch becomes a
|
|
77
|
+
* new anonymous person).
|
|
78
|
+
*
|
|
79
|
+
* Flags, surveys, replay, and error tracking are never fetched or enabled.
|
|
80
|
+
* Native-only additions to the namespace: `trackScreen`, plus the
|
|
81
|
+
* `HeyCatchProvider` component for touch autocapture + Expo Router screen
|
|
82
|
+
* views.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The same-shaped `analytics` namespace as the web and server entries,
|
|
87
|
+
* plus the native-only `trackScreen`.
|
|
88
|
+
*/
|
|
89
|
+
declare const analytics: {
|
|
90
|
+
readonly init: typeof init;
|
|
91
|
+
readonly resetIdentity: typeof resetIdentity;
|
|
92
|
+
readonly setIdentity: typeof setIdentity;
|
|
93
|
+
readonly setPersonProperties: typeof setPersonProperties;
|
|
94
|
+
readonly trackEvent: typeof trackEvent;
|
|
95
|
+
readonly trackScreen: typeof trackScreen;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { HeyCatchConfig, HeyCatchPersonProperties, HeyCatchProperties, HeyCatchProvider, TrackOptions, analytics };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.js';
|
|
2
|
+
export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.js';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Link the device's anonymous visitor to the authenticated user. Same
|
|
7
|
+
* contract as the web entry: a stable internal user id - never an email or
|
|
8
|
+
* a session token - with email/name in the PROPERTIES. No-op before
|
|
9
|
+
* `init()`, mirroring the web entry.
|
|
10
|
+
*/
|
|
11
|
+
declare function setIdentity(userId: string, properties?: HeyCatchPersonProperties, propertiesOnce?: HeyCatchPersonProperties): void;
|
|
12
|
+
/**
|
|
13
|
+
* Clear the current identity. Call on sign-out so the next user on this
|
|
14
|
+
* device starts anonymous.
|
|
15
|
+
*/
|
|
16
|
+
declare function resetIdentity(): void;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the React Native entry. Call once at module scope of the root
|
|
20
|
+
* layout (`app/_layout.tsx`); idempotent. The client queues everything
|
|
21
|
+
* captured before its async storage finishes loading, so nothing is lost
|
|
22
|
+
* around startup.
|
|
23
|
+
*/
|
|
24
|
+
declare function init(config: HeyCatchConfig): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Record a screen view. `HeyCatchProvider` calls this automatically on
|
|
28
|
+
* Expo Router route changes; call it manually only on a non-Expo-Router
|
|
29
|
+
* navigator (pass the current route name from your navigation container).
|
|
30
|
+
*
|
|
31
|
+
* Manual by design: the transport's own screen autocapture is broken on
|
|
32
|
+
* React Navigation v7 (what current Expo Router runs on) - its hooks may
|
|
33
|
+
* not run above the navigator, which is exactly where a provider sits.
|
|
34
|
+
*/
|
|
35
|
+
declare function trackScreen(name: string, properties?: HeyCatchProperties): void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Record a product event. Touch autocapture (via `HeyCatchProvider`) and
|
|
39
|
+
* lifecycle events cover behaviour - this is for the moments only the app
|
|
40
|
+
* knows about. Same validation contract as the web entry; `userId` in the
|
|
41
|
+
* options is ignored here, the device session already knows who.
|
|
42
|
+
*/
|
|
43
|
+
declare function trackEvent(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
|
|
44
|
+
/**
|
|
45
|
+
* Update the current person's properties without sending a product event -
|
|
46
|
+
* same surface as the web entry. The `$set` event is the transport's
|
|
47
|
+
* person-update carrier; it is a built-in, not a custom event, so no
|
|
48
|
+
* `heycatch_custom_user_event` stamp.
|
|
49
|
+
*/
|
|
50
|
+
declare function setPersonProperties(set?: HeyCatchPersonProperties, setOnce?: HeyCatchPersonProperties): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Mount once in the root layout (`app/_layout.tsx`), wrapping the layout's
|
|
54
|
+
* children. It adds the two things `init` alone cannot: touch autocapture
|
|
55
|
+
* (the transport hooks touches via a root View, so a component is
|
|
56
|
+
* structurally required) and automatic screen views on Expo Router.
|
|
57
|
+
* Everything else - lifecycle events, identity, business events - works
|
|
58
|
+
* from `init` alone.
|
|
59
|
+
*/
|
|
60
|
+
declare function HeyCatchProvider({ children, }: {
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}): ReactNode;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The React Native entry. The `react-native` export condition routes a
|
|
66
|
+
* bare `@heycatch/sdk` import here under Metro (newest Expo enables
|
|
67
|
+
* package exports with that condition), so the customer API stays ONE
|
|
68
|
+
* surface across web, server, and native.
|
|
69
|
+
*
|
|
70
|
+
* Wraps posthog-react-native - a regular dependency, deliberately NOT
|
|
71
|
+
* bundled: bundling breaks its optional-Expo-peer probing. Not a peer
|
|
72
|
+
* either: a peer would force the agent guide to name the vendor in its
|
|
73
|
+
* install line (the vendor-ban spec forbids exactly that); the dependency
|
|
74
|
+
* resolves silently instead. The Expo companions are app-level installs
|
|
75
|
+
* the guide's RN line carries (`expo-file-system` above all - without it
|
|
76
|
+
* persistence silently falls back to memory and every launch becomes a
|
|
77
|
+
* new anonymous person).
|
|
78
|
+
*
|
|
79
|
+
* Flags, surveys, replay, and error tracking are never fetched or enabled.
|
|
80
|
+
* Native-only additions to the namespace: `trackScreen`, plus the
|
|
81
|
+
* `HeyCatchProvider` component for touch autocapture + Expo Router screen
|
|
82
|
+
* views.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The same-shaped `analytics` namespace as the web and server entries,
|
|
87
|
+
* plus the native-only `trackScreen`.
|
|
88
|
+
*/
|
|
89
|
+
declare const analytics: {
|
|
90
|
+
readonly init: typeof init;
|
|
91
|
+
readonly resetIdentity: typeof resetIdentity;
|
|
92
|
+
readonly setIdentity: typeof setIdentity;
|
|
93
|
+
readonly setPersonProperties: typeof setPersonProperties;
|
|
94
|
+
readonly trackEvent: typeof trackEvent;
|
|
95
|
+
readonly trackScreen: typeof trackScreen;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { HeyCatchConfig, HeyCatchPersonProperties, HeyCatchProperties, HeyCatchProvider, TrackOptions, analytics };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var U=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ee="project",Te="[a-z0-9]",ct=new RegExp(`^${Te}$`);import{PostHog as qe}from"posthog-react-native";var te;function f(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:n,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=n.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function n(s){var u;let a=r?.Parent?new c:this;o(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(n,"init",{value:o}),Object.defineProperty(n,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(te=globalThis).__zod_globalConfig??(te.__zod_globalConfig={});var H=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(H,e),H}function oe(e,t){return typeof t=="bigint"?t.toString():t}function ne(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var re=Symbol("evaluating");function z(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==re)return o===void 0&&(o=re,o=r()),o},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var K="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ie(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function V(e){return ie(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function v(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function se(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var at={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function k(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ce(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function G(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let o=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:n,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=n),s}var ue=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ae=f("$ZodError",ue),E=f("$ZodError",ue,{Parent:Error});var Ie=e=>(t,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise)throw new _;if(n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw K(s,i?.callee),s}return n.value},R=Ie(E),Me=e=>async(t,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise&&(n=await n),n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw K(s,i?.callee),s}return n.value},O=Me(E),Re=e=>(t,r,o)=>{let i=o?{...o,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??ae)(c.issues.map(n=>$(n,i,x())))}:{success:!0,data:c.value}},C=Re(E),Oe=e=>async(t,r,o)=>{let i=o?{...o,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(n=>$(n,i,x())))}:{success:!0,data:c.value}},A=Oe(E);var Ne="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",je=new RegExp(`^${Ne}$`);var pe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var J=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Fe=f("$ZodCheckStringFormat",(e,t)=>{var r,o;J.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),fe=f("$ZodCheckRegex",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var me={major:4,minor:4,patch:3};var y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=me;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(n,s,u)=>{let a=k(n),p;for(let m of s){if(m._zod.def.when){if(ce(n)||!m._zod.def.when(n))continue}else if(a)continue;let l=n.issues.length,d=m._zod.check(n);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,n.issues.length!==l&&(a||(a=k(n,l)))});else{if(n.issues.length===l)continue;a||(a=k(n,l))}}return p?p.then(()=>n):n},c=(n,s,u)=>{if(k(n))return n.aborted=!0,n;let a=i(s,o,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(n,s)=>{if(s.skipChecks)return e._zod.parse(n,s);if(s.direction==="backward"){let a=e._zod.parse({value:n.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,n,s)):c(a,n,s)}let u=e._zod.parse(n,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,o,s))}return i(u,o,s)}}z(e,"~standard",()=>({validate:i=>{try{let c=C(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return A(e,i).then(n=>n.success?{value:n.data}:{issues:n.error?.issues})}},vendor:"zod",version:1}))}),_e=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??pe(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});function de(e,t,r){e.issues.length&&t.issues.push(...G(r,e.issues)),t.value[r]=e.value}var ge=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let n=0;n<i.length;n++){let s=i[n],u=t.element._zod.run({value:s,issues:[]},o);u instanceof Promise?c.push(u.then(a=>de(a,r,n))):de(u,r,n)}return c.length?Promise.all(c).then(()=>r):r}});function N(e,t,r,o,i,c){let n=r in o;if(e.issues.length){if(i&&c&&!n)return;t.issues.push(...G(r,e.issues))}if(!n&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?n&&(t.value[r]=void 0):t.value[r]=e.value}function Ue(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=se(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function He(e,t,r,o,i,c){let n=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){n.push(l);continue}let d=u.run({value:t[l],issues:[]},o);d instanceof Promise?e.push(d.then(g=>N(g,r,l,t,p,m))):N(d,r,l,t,p,m)}return n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var xe=f("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=ne(()=>Ue(t));z(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,n;e._zod.parse=(s,u)=>{n??(n=o.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=n.shape;for(let l of n.keys){let d=m[l],g=d._zod.optin==="optional",Q=d._zod.optout==="optional",L=d._zod.run({value:a[l],issues:[]},u);L instanceof Promise?p.push(L.then(Ae=>N(Ae,s,l,a,g,Q))):N(L,s,l,a,g,Q)}return c?He(p,a,s,u,o.value,e):p.length?Promise.all(p).then(()=>s):s}});var ze=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,o);return i instanceof Promise?i.then(c=>he(c,t)):he(i,t)}});function he(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ve(e,t){return new e({type:"string",...v(t)})}function Y(e,t){return new fe({check:"string_format",format:"regex",...v(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");y.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>R(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>C(e,r,o),e.parseAsync=async(r,o)=>O(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>A(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>W(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),Ke=f("ZodMiniString",(e,t)=>{_e.init(e,t),j.init(e,t)});function b(e){return ve(Ke,e)}var Ve=f("ZodMiniArray",(e,t)=>{ge.init(e,t),j.init(e,t)});function $e(e,t){return new Ve({type:"array",element:e,...v(t)})}var We=f("ZodMiniObject",(e,t)=>{xe.init(e,t),j.init(e,t),z(e,"shape",()=>t.shape)});function q(e,t){let r={type:"object",shape:e??{},...v(t)};return new We(r)}var Ge=f("ZodMiniDefault",(e,t)=>{ze.init(e,t),j.init(e,t)});function Z(e,t){return new Ge({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():V(t)}})}var F="https://in.dev.heycatch.ai",T="dev",S="0.7.0-dev.41",ye="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";var w="unknown",be=q({projectKey:b({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Y(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:Z($e(b()),[]),install:Z(q({framework:Z(b(),w),frameworkVersion:Z(b(),w),agent:Z(b(),w)}),{framework:w,frameworkVersion:w,agent:w})});var X=null;function h(){return X}function Ze(e){if(X!==null)return;let t=be.safeParse(e);if(!t.success){let c=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${c}`);return}let r=new qe(ye,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};r.register({heycatch_sdk_version:S,heycatch_sdk_stage:T,heycatch_project_key:t.data.projectKey,...i}),r.group(ee,t.data.projectKey,{key:t.data.projectKey,sdk_version:S,sdk_stage:T,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:F}),X=r,console.info(`[HeyCatch] SDK v${S} (${T}) initialized \u2192 ${F}`)}function we(e,t,r){let o=h();if(o!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}o.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function ke(){let e=h();e!==null&&e.reset()}function D(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function Pe(e,t,r){let o=h();if(o!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}o.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function Ee(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as Xe}from"posthog-react-native";import{useEffect as Qe}from"react";import{jsx as nt,jsxs as it}from"react/jsx-runtime";function et(){try{return typeof U!="function"?null:U("expo-router")}catch{return null}}var Ce=et();function tt(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[o]=i;continue}Array.isArray(i)&&(r[o]=i.filter(c=>typeof c=="string").join(","))}return r}function rt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),i=JSON.stringify(t());return Qe(()=>{D(o,tt(i))},[o,i]),null}function ot({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):it(Xe,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Ce===null?null:nt(rt,{router:Ce}),e]})}var Ni={init:Ze,resetIdentity:ke,setIdentity:we,setPersonProperties:Ee,trackEvent:Pe,trackScreen:D};export{ot as HeyCatchProvider,S as SDK_VERSION,T as STAGE,Ni as analytics};
|
|
2
|
+
//# sourceMappingURL=react-native.js.map
|