@simpleapps-com/augur-web 0.2.13 → 0.2.15

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
+ {"version":3,"sources":["../src/session-replay.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Supported session replay providers. */\nexport type SessionReplayProvider = \"mouseflow\" | \"hotjar\";\n\nexport interface SessionReplayScriptProps {\n /** Session replay provider. */\n provider: SessionReplayProvider;\n /** Project/site ID from the provider. */\n siteId: string;\n /** Sampling rate (0-1). 1 = all sessions, 0.5 = 50%. Default: 1. */\n sampleRate?: number;\n /** Disable in development. Default: false. */\n disabled?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Globals\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n _mfq?: unknown[];\n hj?: (...args: unknown[]) => void;\n _hjSettings?: { hjid: string; hjsv: number };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Script injectors\n// ---------------------------------------------------------------------------\n\nfunction injectMouseflow(siteId: string): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(\"mouseflow-script\")) return;\n\n window._mfq = window._mfq || [];\n\n const script = document.createElement(\"script\");\n script.id = \"mouseflow-script\";\n script.src = `https://cdn.mouseflow.com/projects/${encodeURIComponent(siteId)}.js`;\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n}\n\nfunction injectHotjar(siteId: string): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(\"hotjar-script\")) return;\n\n window._hjSettings = { hjid: siteId, hjsv: 6 };\n window.hj =\n window.hj ||\n function hjQueue(...args: unknown[]) {\n (window.hj as unknown as { q: unknown[] }).q =\n (window.hj as unknown as { q: unknown[] }).q || [];\n (window.hj as unknown as { q: unknown[] }).q.push(args);\n };\n\n const script = document.createElement(\"script\");\n script.id = \"hotjar-script\";\n script.src = `https://static.hotjar.com/c/hotjar-${encodeURIComponent(siteId)}.js?sv=6`;\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n}\n\nconst injectors: Record<SessionReplayProvider, (siteId: string) => void> = {\n mouseflow: injectMouseflow,\n hotjar: injectHotjar,\n};\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\n/**\n * Loads a session replay script with `lazyOnload` behavior.\n * Renders nothing — this is a side-effect-only leaf component.\n *\n * Session replay tools require main thread DOM access (MutationObserver)\n * and cannot run in web workers.\n *\n * @example\n * ```tsx\n * // In layout.tsx\n * <SessionReplayScript provider=\"mouseflow\" siteId=\"88d79cd5-...\" />\n *\n * // With 50% sampling\n * <SessionReplayScript provider=\"mouseflow\" siteId=\"...\" sampleRate={0.5} />\n *\n * // Disabled in dev\n * <SessionReplayScript provider=\"hotjar\" siteId=\"...\" disabled={isDev} />\n * ```\n */\nexport function SessionReplayScript({\n provider,\n siteId,\n sampleRate = 1,\n disabled = false,\n}: SessionReplayScriptProps) {\n const injectedRef = useRef(false);\n\n useEffect(() => {\n if (disabled || injectedRef.current) return;\n if (sampleRate < 1 && Math.random() > sampleRate) return;\n\n injectedRef.current = true;\n\n const inject = injectors[provider];\n\n // Load during idle time (lazyOnload behavior)\n if (typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => inject(siteId));\n } else {\n setTimeout(() => inject(siteId), 0);\n }\n }, [provider, siteId, sampleRate, disabled]);\n\n return null;\n}\n"],"mappings":";;;;AAEA,SAAS,WAAW,cAAc;AAoClC,SAAS,gBAAgB,QAAsB;AAC7C,MAAI,OAAO,aAAa,YAAa;AACrC,MAAI,SAAS,eAAe,kBAAkB,EAAG;AAEjD,SAAO,OAAO,OAAO,QAAQ,CAAC;AAE9B,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,KAAK;AACZ,SAAO,MAAM,sCAAsC,mBAAmB,MAAM,CAAC;AAC7E,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAEA,SAAS,aAAa,QAAsB;AAC1C,MAAI,OAAO,aAAa,YAAa;AACrC,MAAI,SAAS,eAAe,eAAe,EAAG;AAE9C,SAAO,cAAc,EAAE,MAAM,QAAQ,MAAM,EAAE;AAC7C,SAAO,KACL,OAAO,MACP,SAAS,WAAW,MAAiB;AACnC,IAAC,OAAO,GAAmC,IACxC,OAAO,GAAmC,KAAK,CAAC;AACnD,IAAC,OAAO,GAAmC,EAAE,KAAK,IAAI;AAAA,EACxD;AAEF,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,KAAK;AACZ,SAAO,MAAM,sCAAsC,mBAAmB,MAAM,CAAC;AAC7E,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,WAAS,KAAK,YAAY,MAAM;AAClC;AAEA,IAAM,YAAqE;AAAA,EACzE,WAAW;AAAA,EACX,QAAQ;AACV;AAyBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,WAAW;AACb,GAA6B;AAC3B,QAAM,cAAc,OAAO,KAAK;AAEhC,YAAU,MAAM;AACd,QAAI,YAAY,YAAY,QAAS;AACrC,QAAI,aAAa,KAAK,KAAK,OAAO,IAAI,WAAY;AAElD,gBAAY,UAAU;AAEtB,UAAM,SAAS,UAAU,QAAQ;AAGjC,QAAI,OAAO,wBAAwB,YAAY;AAC7C,0BAAoB,MAAM,OAAO,MAAM,CAAC;AAAA,IAC1C,OAAO;AACL,iBAAW,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,YAAY,QAAQ,CAAC;AAE3C,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-web",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Shared React UI components for Augur ecommerce sites (Radix + Tailwind)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -60,6 +60,11 @@
60
60
  "import": "./dist/pagination.js",
61
61
  "require": "./dist/pagination.cjs"
62
62
  },
63
+ "./price": {
64
+ "types": "./dist/price.d.ts",
65
+ "import": "./dist/price.js",
66
+ "require": "./dist/price.cjs"
67
+ },
63
68
  "./radio-group": {
64
69
  "types": "./dist/radio-group.d.ts",
65
70
  "import": "./dist/radio-group.js",
@@ -145,10 +150,25 @@
145
150
  "import": "./dist/form-textarea.js",
146
151
  "require": "./dist/form-textarea.cjs"
147
152
  },
153
+ "./financing-widget": {
154
+ "types": "./dist/financing-widget.d.ts",
155
+ "import": "./dist/financing-widget.js",
156
+ "require": "./dist/financing-widget.cjs"
157
+ },
158
+ "./gtm": {
159
+ "types": "./dist/gtm.d.ts",
160
+ "import": "./dist/gtm.js",
161
+ "require": "./dist/gtm.cjs"
162
+ },
148
163
  "./mdx-components": {
149
164
  "types": "./dist/mdx-components.d.ts",
150
165
  "import": "./dist/mdx-components.js",
151
166
  "require": "./dist/mdx-components.cjs"
167
+ },
168
+ "./session-replay": {
169
+ "types": "./dist/session-replay.d.ts",
170
+ "import": "./dist/session-replay.js",
171
+ "require": "./dist/session-replay.cjs"
152
172
  }
153
173
  },
154
174
  "sideEffects": false,
@@ -156,7 +176,7 @@
156
176
  "dist"
157
177
  ],
158
178
  "dependencies": {
159
- "@simpleapps-com/augur-utils": "0.2.13"
179
+ "@simpleapps-com/augur-utils": "0.2.14"
160
180
  },
161
181
  "peerDependencies": {
162
182
  "@radix-ui/react-accordion": "^1.2.0",