@simpleapps-com/augur-web 2.2.29 → 2.3.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/EXPORTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @simpleapps-com/augur-web exports
2
2
 
3
- Version: 2.2.10
3
+ Version: 2.2.29
4
4
 
5
5
  > Auto-generated from built type declarations. Do not edit manually.
6
6
  > Regenerate with: `pnpm run generate-exports`
@@ -223,6 +223,22 @@ import { createFormatPrice } from "@simpleapps-com/augur-web/price-format";
223
223
  import { RadioGroup, RadioGroupItem } from "@simpleapps-com/augur-web/radio-group";
224
224
  ```
225
225
 
226
+ ## `@simpleapps-com/augur-web/resource-tabs`
227
+
228
+ ### Values
229
+
230
+ | Export | Kind | Description |
231
+ |--------|------|-------------|
232
+ | `ResourceTabs` | function | Standardized sub-resource tab layout for detail pages. |
233
+
234
+ ### Types
235
+
236
+ `ResourceTabsProps`, `TabDef`
237
+
238
+ ```ts
239
+ import { ResourceTabs } from "@simpleapps-com/augur-web/resource-tabs";
240
+ ```
241
+
226
242
  ## `@simpleapps-com/augur-web/select`
227
243
 
228
244
  ### Values
@@ -326,6 +342,57 @@ import { Textarea } from "@simpleapps-com/augur-web/textarea";
326
342
  import { Command, CommandDialog, CommandEmpty } from "@simpleapps-com/augur-web/command";
327
343
  ```
328
344
 
345
+ ## `@simpleapps-com/augur-web/confirm-dialog`
346
+
347
+ ### Values
348
+
349
+ | Export | Kind | Description |
350
+ |--------|------|-------------|
351
+ | `ConfirmDialog` | function | Pre-composed confirmation dialog for delete/action confirmations. |
352
+
353
+ ### Types
354
+
355
+ `ConfirmDialogProps`
356
+
357
+ ```ts
358
+ import { ConfirmDialog } from "@simpleapps-com/augur-web/confirm-dialog";
359
+ ```
360
+
361
+ ## `@simpleapps-com/augur-web/data-table`
362
+
363
+ ### Values
364
+
365
+ | Export | Kind | Description |
366
+ |--------|------|-------------|
367
+ | `DataTable` | function | |
368
+ | `RowSelectionState` | value | |
369
+ | `SortingState` | value | |
370
+ | `VisibilityState` | value | |
371
+
372
+ ### Types
373
+
374
+ `ColumnDef`, `DataTablePagination`, `DataTableProps`
375
+
376
+ ```ts
377
+ import { DataTable, RowSelectionState, SortingState } from "@simpleapps-com/augur-web/data-table";
378
+ ```
379
+
380
+ ## `@simpleapps-com/augur-web/detail-panel`
381
+
382
+ ### Values
383
+
384
+ | Export | Kind | Description |
385
+ |--------|------|-------------|
386
+ | `DetailPanel` | function | Read/edit toggle panel for a single record. Renders field values in read |
387
+
388
+ ### Types
389
+
390
+ `DetailPanelProps`, `FieldDef`
391
+
392
+ ```ts
393
+ import { DetailPanel } from "@simpleapps-com/augur-web/detail-panel";
394
+ ```
395
+
329
396
  ## `@simpleapps-com/augur-web/dialog`
330
397
 
331
398
  ### Values
@@ -520,17 +587,14 @@ import { FinancingWidget } from "@simpleapps-com/augur-web/financing-widget";
520
587
  |--------|------|-------------|
521
588
  | `AnalyticsNoscript` | function | |
522
589
  | `AnalyticsProvider` | function | |
523
- | `GtmNoscript` | const | |
524
- | `GtmProvider` | const | |
525
590
  | `useAnalytics` | function | |
526
- | `useGtm` | const | |
527
591
 
528
592
  ### Types
529
593
 
530
- `AnalyticsContextValue`, `AnalyticsNoscriptProps`, `AnalyticsProviderProps`, `AnalyticsStrategy`, `EcommerceEvent`, `EcommerceItem`, `EcommerceParams`, `GtmContextValue`, `GtmEcommerceEvent`, `GtmEcommerceParams`, `GtmItem`, `GtmNoscriptProps`, `GtmProviderProps`, `GtmStrategy`
594
+ `AnalyticsContextValue`, `AnalyticsNoscriptProps`, `AnalyticsProviderProps`, `AnalyticsStrategy`, `EcommerceEvent`, `EcommerceItem`, `EcommerceParams`
531
595
 
532
596
  ```ts
533
- import { AnalyticsNoscript, AnalyticsProvider, GtmNoscript } from "@simpleapps-com/augur-web/gtm";
597
+ import { AnalyticsNoscript, AnalyticsProvider, useAnalytics } from "@simpleapps-com/augur-web/gtm";
534
598
  ```
535
599
 
536
600
  ## `@simpleapps-com/augur-web/mdx-components`
package/README.md CHANGED
@@ -14,7 +14,7 @@ pnpm add @simpleapps-com/augur-web
14
14
 
15
15
  ### Peer Dependencies
16
16
 
17
- `@radix-ui/react-accordion`, `@radix-ui/react-checkbox`, `@radix-ui/react-dialog`, `@radix-ui/react-dropdown-menu`, `@radix-ui/react-label`, `@radix-ui/react-navigation-menu`, `@radix-ui/react-popover`, `@radix-ui/react-radio-group`, `@radix-ui/react-select`, `@radix-ui/react-separator`, `@radix-ui/react-slot`, `@radix-ui/react-tabs`, `class-variance-authority`, `cmdk`, `react`, `react-dom`, `react-icons`, `tailwindcss`
17
+ `@radix-ui/react-accordion`, `@radix-ui/react-checkbox`, `@radix-ui/react-dialog`, `@radix-ui/react-dropdown-menu`, `@radix-ui/react-label`, `@radix-ui/react-navigation-menu`, `@radix-ui/react-popover`, `@radix-ui/react-radio-group`, `@radix-ui/react-select`, `@radix-ui/react-separator`, `@radix-ui/react-slot`, `@radix-ui/react-tabs`, `@tanstack/react-table`, `class-variance-authority`, `cmdk`, `react`, `react-dom`, `react-icons`, `tailwindcss`
18
18
 
19
19
  ## Entry Points
20
20
 
@@ -34,12 +34,16 @@ pnpm add @simpleapps-com/augur-web
34
34
  | `@simpleapps-com/augur-web/price` | 3 exports, 4 types |
35
35
  | `@simpleapps-com/augur-web/price-format` | 1 exports, 2 types |
36
36
  | `@simpleapps-com/augur-web/radio-group` | 2 exports, 0 types |
37
+ | `@simpleapps-com/augur-web/resource-tabs` | 1 exports, 2 types |
37
38
  | `@simpleapps-com/augur-web/select` | 10 exports, 0 types |
38
39
  | `@simpleapps-com/augur-web/spinner` | 1 exports, 0 types |
39
40
  | `@simpleapps-com/augur-web/table` | 8 exports, 0 types |
40
41
  | `@simpleapps-com/augur-web/tabs` | 4 exports, 0 types |
41
42
  | `@simpleapps-com/augur-web/textarea` | 1 exports, 1 types |
42
43
  | `@simpleapps-com/augur-web/command` | 9 exports, 0 types |
44
+ | `@simpleapps-com/augur-web/confirm-dialog` | 1 exports, 1 types |
45
+ | `@simpleapps-com/augur-web/data-table` | 4 exports, 3 types |
46
+ | `@simpleapps-com/augur-web/detail-panel` | 1 exports, 2 types |
43
47
  | `@simpleapps-com/augur-web/dialog` | 10 exports, 0 types |
44
48
  | `@simpleapps-com/augur-web/dropdown-menu` | 15 exports, 0 types |
45
49
  | `@simpleapps-com/augur-web/navigation-menu` | 9 exports, 0 types |
@@ -51,7 +55,7 @@ pnpm add @simpleapps-com/augur-web
51
55
  | `@simpleapps-com/augur-web/form-select` | 1 exports, 1 types |
52
56
  | `@simpleapps-com/augur-web/form-textarea` | 1 exports, 1 types |
53
57
  | `@simpleapps-com/augur-web/financing-widget` | 1 exports, 3 types |
54
- | `@simpleapps-com/augur-web/gtm` | 6 exports, 14 types |
58
+ | `@simpleapps-com/augur-web/gtm` | 3 exports, 7 types |
55
59
  | `@simpleapps-com/augur-web/mdx-components` | 1 exports, 0 types |
56
60
  | `@simpleapps-com/augur-web/payment-modal` | 2 exports, 1 types |
57
61
  | `@simpleapps-com/augur-web/quantity-input` | 1 exports, 1 types |
@@ -66,16 +70,13 @@ pnpm add @simpleapps-com/augur-web
66
70
  | Export | Kind | Description |
67
71
  |--------|------|-------------|
68
72
  | `AnalyticsNoscript` | function | |
69
- | `GtmNoscript` | const | |
70
73
  | `useAnalytics` | function | |
71
- | `useGtm` | const | |
72
74
 
73
75
  ### Auth & Context
74
76
 
75
77
  | Export | Kind | Description |
76
78
  |--------|------|-------------|
77
79
  | `AnalyticsProvider` | function | |
78
- | `GtmProvider` | const | |
79
80
  | `SessionReplayScript` | function | Loads a session replay script with `lazyOnload` behavior. |
80
81
  | `AugurSiteProvider` | function | Unified site provider that composes AugurHooksProvider with analytics |
81
82
 
@@ -230,9 +231,16 @@ pnpm add @simpleapps-com/augur-web
230
231
  | `PaginationNext` | const | |
231
232
  | `PaginationPrevious` | const | |
232
233
  | `getPageNumbers` | function | Build an array of page numbers and ellipsis markers for pagination UI. |
234
+ | `ResourceTabs` | function | Standardized sub-resource tab layout for detail pages. |
233
235
  | `Spinner` | const | Animated SVG loading spinner. Sizes: `sm` (12px), `md` (16px), `lg` (24px). |
234
236
  | `CommandDialog` | const | |
235
237
  | `CommandShortcut` | const | |
238
+ | `ConfirmDialog` | function | Pre-composed confirmation dialog for delete/action confirmations. |
239
+ | `DataTable` | function | |
240
+ | `RowSelectionState` | value | |
241
+ | `SortingState` | value | |
242
+ | `VisibilityState` | value | |
243
+ | `DetailPanel` | function | Read/edit toggle panel for a single record. Renders field values in read |
236
244
  | `DialogFooter` | const | |
237
245
  | `DialogHeader` | const | |
238
246
  | `DropdownMenuShortcut` | const | |
@@ -277,6 +285,43 @@ export const { Price, formatPrice } = createPrice({
277
285
  <Price value={item.price1} uom={item.default_selling_unit} />
278
286
  ```
279
287
 
288
+ ### ResourceTabs
289
+
290
+ ```tsx
291
+ <ResourceTabs
292
+ tabs={[
293
+ { value: "attributes", label: "Attributes", content: <AttributesList /> },
294
+ { value: "items", label: "Items", content: <ItemsList /> },
295
+ ]}
296
+ />
297
+ ```
298
+
299
+ ### ConfirmDialog
300
+
301
+ ```tsx
302
+ <ConfirmDialog
303
+ open={showDelete}
304
+ onOpenChange={setShowDelete}
305
+ title="Delete brand?"
306
+ description="This action cannot be undone."
307
+ variant="destructive"
308
+ onConfirm={() => deleteBrand.mutate(uid)}
309
+ loading={deleteBrand.isPending}
310
+ />
311
+ ```
312
+
313
+ ### DetailPanel
314
+
315
+ ```tsx
316
+ const fields: FieldDef<Brand>[] = [
317
+ { key: "brandsName", label: "Name", type: "text", required: true },
318
+ { key: "brandsDesc", label: "Description", type: "textarea" },
319
+ { key: "brandsUid", label: "UID", type: "readonly" },
320
+ ];
321
+
322
+ <DetailPanel fields={fields} data={brand} onSave={handleSave} />
323
+ ```
324
+
280
325
  ### FormInput
281
326
 
282
327
  ```tsx
@@ -315,22 +360,9 @@ export const { Price, formatPrice } = createPrice({
315
360
  <QuantityInput value={qty} onChange={setQty} min={1} step={1} />
316
361
  ```
317
362
 
318
- ### SessionReplayScript
319
-
320
- ```tsx
321
- // In layout.tsx
322
- <SessionReplayScript provider="mouseflow" siteId="88d79cd5-..." />
323
-
324
- // With 50% sampling
325
- <SessionReplayScript provider="mouseflow" siteId="..." sampleRate={0.5} />
326
-
327
- // Disabled in dev
328
- <SessionReplayScript provider="hotjar" siteId="..." disabled={isDev} />
329
- ```
330
-
331
363
  ## Types
332
364
 
333
- `AddToCartButtonProps`, `BreadCrumbsProps`, `ButtonProps`, `InputProps`, `CreatePriceResult`, `PriceClassNames`, `PriceConfig`, `PriceProps`, `FormatPriceOptions`, `PriceFormatConfig`, `TextareaProps`, `FormFieldProps`, `FormInputProps`, `FormSelectProps`, `FormTextareaProps`, `FinancingProvider`, `FinancingWidgetProps`, `UseFinancingResult`, `AnalyticsContextValue`, `AnalyticsNoscriptProps`, `AnalyticsProviderProps`, `AnalyticsStrategy`, `EcommerceEvent`, `EcommerceItem`, `EcommerceParams`, `GtmContextValue`, `GtmEcommerceEvent`, `GtmEcommerceParams`, `GtmItem`, `GtmNoscriptProps`, `GtmProviderProps`, `GtmStrategy`, `PaymentModalProps`, `QuantityInputProps`, `SessionReplayProvider`, `SessionReplayScriptProps`, `CreateStockLabelResult`, `StockLabelClassNames`, `StockLabelConfig`, `StockLabelProps`, `AugurSiteProviderProps`
365
+ `AddToCartButtonProps`, `BreadCrumbsProps`, `ButtonProps`, `InputProps`, `CreatePriceResult`, `PriceClassNames`, `PriceConfig`, `PriceProps`, `FormatPriceOptions`, `PriceFormatConfig`, `ResourceTabsProps`, `TabDef`, `TextareaProps`, `ConfirmDialogProps`, `ColumnDef`, `DataTablePagination`, `DataTableProps`, `DetailPanelProps`, `FieldDef`, `FormFieldProps`, `FormInputProps`, `FormSelectProps`, `FormTextareaProps`, `FinancingProvider`, `FinancingWidgetProps`, `UseFinancingResult`, `AnalyticsContextValue`, `AnalyticsNoscriptProps`, `AnalyticsProviderProps`, `AnalyticsStrategy`, `EcommerceEvent`, `EcommerceItem`, `EcommerceParams`, `PaymentModalProps`, `QuantityInputProps`, `SessionReplayProvider`, `SessionReplayScriptProps`, `CreateStockLabelResult`, `StockLabelClassNames`, `StockLabelConfig`, `StockLabelProps`, `AugurSiteProviderProps`
334
366
 
335
367
 
336
368
  ## Related Packages
package/dist/button.d.cts CHANGED
@@ -7,7 +7,7 @@ import { VariantProps } from 'class-variance-authority';
7
7
  * secondary, ghost, link. Sizes: default, sm, lg, icon.
8
8
  */
9
9
  declare const buttonVariants: (props?: ({
10
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
11
11
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
12
12
  } & class_variance_authority_types.ClassProp) | undefined) => string;
13
13
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
package/dist/button.d.ts CHANGED
@@ -7,7 +7,7 @@ import { VariantProps } from 'class-variance-authority';
7
7
  * secondary, ghost, link. Sizes: default, sm, lg, icon.
8
8
  */
9
9
  declare const buttonVariants: (props?: ({
10
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
11
11
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
12
12
  } & class_variance_authority_types.ClassProp) | undefined) => string;
13
13
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -116,16 +116,10 @@ function AnalyticsNoscript({ gtmId }) {
116
116
  }
117
117
  ) });
118
118
  }
119
- var GtmProvider = AnalyticsProvider;
120
- var useGtm = useAnalytics;
121
- var GtmNoscript = AnalyticsNoscript;
122
119
 
123
120
 
124
121
 
125
122
 
126
123
 
127
-
128
-
129
-
130
- exports.AnalyticsProvider = AnalyticsProvider; exports.useAnalytics = useAnalytics; exports.AnalyticsNoscript = AnalyticsNoscript; exports.GtmProvider = GtmProvider; exports.useGtm = useGtm; exports.GtmNoscript = GtmNoscript;
131
- //# sourceMappingURL=chunk-CTYDRQML.cjs.map
124
+ exports.AnalyticsProvider = AnalyticsProvider; exports.useAnalytics = useAnalytics; exports.AnalyticsNoscript = AnalyticsNoscript;
125
+ //# sourceMappingURL=chunk-AE4GLYJE.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/chunk-AE4GLYJE.cjs","../src/gtm.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACAA,8BAAkF;AAmNzE,+CAAA;AAnIT,IAAM,iBAAA,EAAmB,kCAAA,IAAgD,CAAA;AAYzE,SAAS,YAAA,CAAA,EAA0C;AAEjD,EAAA,GAAA,CAAI,OAAO,OAAA,IAAW,WAAA,EAAa,OAAO,CAAC,CAAA;AAC3C,EAAA,GAAA,CAAI,CAAC,MAAA,CAAO,SAAA,EAAW,MAAA,CAAO,UAAA,EAAY,CAAC,CAAA;AAC3C,EAAA,OAAO,MAAA,CAAO,SAAA;AAChB;AAEA,SAAS,eAAA,CAAgB,KAAA,EAAe,QAAA,EAAmC;AAEzE,EAAA,GAAA,CAAI,OAAO,SAAA,IAAa,WAAA,EAAa,MAAA;AAGrC,EAAA,GAAA,CAAI,QAAA,CAAS,cAAA,CAAe,YAAY,CAAA,EAAG,MAAA;AAE3C,EAAA,MAAM,UAAA,EAAY,YAAA,CAAa,CAAA;AAC/B,EAAA,SAAA,CAAU,IAAA,CAAK,EAAE,WAAA,EAAA,iBAAa,IAAI,IAAA,CAAK,CAAA,CAAA,CAAE,OAAA,CAAQ,CAAA,EAAG,KAAA,EAAO,SAAS,CAAC,CAAA;AAErE,EAAA,MAAM,OAAA,EAAS,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AAC9C,EAAA,MAAA,CAAO,GAAA,EAAK,YAAA;AACZ,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ACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/chunk-AE4GLYJE.cjs","sourcesContent":[null,"\"use client\";\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Script loading strategy. */\nexport type AnalyticsStrategy = \"default\" | \"afterInteractive\" | \"lazyOnload\";\n\n/** GA4 standard e-commerce event names. */\nexport type EcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface EcommerceItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface EcommerceParams {\n currency?: string;\n value?: number;\n items?: EcommerceItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface AnalyticsProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: AnalyticsStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface AnalyticsContextValue {\n /** Push a custom event to the dataLayer. */\n trackEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n trackEcommerceEvent: (event: EcommerceEvent, params: EcommerceParams) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AnalyticsContext = createContext<AnalyticsContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n /* v8 ignore next */\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: AnalyticsStrategy): void {\n /* v8 ignore next */\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function AnalyticsProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: AnalyticsProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n /* v8 ignore next */\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const trackEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[Analytics]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const trackEcommerceEvent = useCallback(\n (event: EcommerceEvent, params: EcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[Analytics ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<AnalyticsContextValue>(\n () => ({\n trackEvent,\n trackEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [trackEvent, trackEcommerceEvent, grantConsent, revokeConsent, hasConsent, isLoaded],\n );\n\n return <AnalyticsContext.Provider value={value}>{children}</AnalyticsContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAnalytics(): AnalyticsContextValue {\n const context = useContext(AnalyticsContext);\n if (!context) {\n throw new Error(\"useAnalytics must be used within an <AnalyticsProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface AnalyticsNoscriptProps {\n /** GTM container ID (must match AnalyticsProvider). */\n gtmId: string;\n}\n\nexport function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n"]}
@@ -116,16 +116,10 @@ function AnalyticsNoscript({ gtmId }) {
116
116
  }
117
117
  ) });
118
118
  }
119
- var GtmProvider = AnalyticsProvider;
120
- var useGtm = useAnalytics;
121
- var GtmNoscript = AnalyticsNoscript;
122
119
 
123
120
  export {
124
121
  AnalyticsProvider,
125
122
  useAnalytics,
126
- AnalyticsNoscript,
127
- GtmProvider,
128
- useGtm,
129
- GtmNoscript
123
+ AnalyticsNoscript
130
124
  };
131
- //# sourceMappingURL=chunk-U35D7OOZ.js.map
125
+ //# sourceMappingURL=chunk-DCXYO3RB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/gtm.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Script loading strategy. */\nexport type AnalyticsStrategy = \"default\" | \"afterInteractive\" | \"lazyOnload\";\n\n/** GA4 standard e-commerce event names. */\nexport type EcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface EcommerceItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface EcommerceParams {\n currency?: string;\n value?: number;\n items?: EcommerceItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface AnalyticsProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: AnalyticsStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface AnalyticsContextValue {\n /** Push a custom event to the dataLayer. */\n trackEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n trackEcommerceEvent: (event: EcommerceEvent, params: EcommerceParams) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AnalyticsContext = createContext<AnalyticsContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n /* v8 ignore next */\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: AnalyticsStrategy): void {\n /* v8 ignore next */\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function AnalyticsProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: AnalyticsProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n /* v8 ignore next */\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const trackEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[Analytics]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const trackEcommerceEvent = useCallback(\n (event: EcommerceEvent, params: EcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[Analytics ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<AnalyticsContextValue>(\n () => ({\n trackEvent,\n trackEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [trackEvent, trackEcommerceEvent, grantConsent, revokeConsent, hasConsent, isLoaded],\n );\n\n return <AnalyticsContext.Provider value={value}>{children}</AnalyticsContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAnalytics(): AnalyticsContextValue {\n const context = useContext(AnalyticsContext);\n if (!context) {\n throw new Error(\"useAnalytics must be used within an <AnalyticsProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface AnalyticsNoscriptProps {\n /** GTM container ID (must match AnalyticsProvider). */\n gtmId: string;\n}\n\nexport function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Backward-compatible aliases (from #59 GtmProvider)\n// ---------------------------------------------------------------------------\n\n/** @deprecated Use `AnalyticsStrategy` instead. */\nexport type GtmStrategy = AnalyticsStrategy;\n/** @deprecated Use `EcommerceEvent` instead. */\nexport type GtmEcommerceEvent = EcommerceEvent;\n/** @deprecated Use `EcommerceItem` instead. */\nexport type GtmItem = EcommerceItem;\n/** @deprecated Use `EcommerceParams` instead. */\nexport type GtmEcommerceParams = EcommerceParams;\n/** @deprecated Use `AnalyticsProviderProps` instead. */\nexport type GtmProviderProps = AnalyticsProviderProps;\n/** @deprecated Use `AnalyticsContextValue` instead. */\nexport type GtmContextValue = AnalyticsContextValue;\n/** @deprecated Use `AnalyticsNoscriptProps` instead. */\nexport type GtmNoscriptProps = AnalyticsNoscriptProps;\n\n/** @deprecated Use `AnalyticsProvider` instead. */\nexport const GtmProvider = AnalyticsProvider;\n/** @deprecated Use `useAnalytics` instead. */\nexport const useGtm = useAnalytics;\n/** @deprecated Use `AnalyticsNoscript` instead. */\nexport const GtmNoscript =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pD,QAAM,UAAU,WAAW,gBAAgB;AAC3C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAWO,SAAS,kBAAkB,EAAE,MAAM,GAA2B;AACnE,SACE,oBAAC,cACC;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,+CAA+C,mBAAmB,KAAK,CAAC;AAAA,MAC7E,QAAO;AAAA,MACP,OAAM;AAAA,MACN,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS;AAAA,MAC/C,OAAM;AAAA;AAAA,EACR,GACF;AAEJ;AAsBO,IAAM,cAAc;AAEpB,IAAM,SAAS;AAEf,IAAM,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/gtm.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Script loading strategy. */\nexport type AnalyticsStrategy = \"default\" | \"afterInteractive\" | \"lazyOnload\";\n\n/** GA4 standard e-commerce event names. */\nexport type EcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface EcommerceItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface EcommerceParams {\n currency?: string;\n value?: number;\n items?: EcommerceItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface AnalyticsProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: AnalyticsStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface AnalyticsContextValue {\n /** Push a custom event to the dataLayer. */\n trackEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n trackEcommerceEvent: (event: EcommerceEvent, params: EcommerceParams) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AnalyticsContext = createContext<AnalyticsContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n /* v8 ignore next */\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: AnalyticsStrategy): void {\n /* v8 ignore next */\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function AnalyticsProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: AnalyticsProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n /* v8 ignore next */\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const trackEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[Analytics]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const trackEcommerceEvent = useCallback(\n (event: EcommerceEvent, params: EcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[Analytics ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<AnalyticsContextValue>(\n () => ({\n trackEvent,\n trackEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [trackEvent, trackEcommerceEvent, grantConsent, revokeConsent, hasConsent, isLoaded],\n );\n\n return <AnalyticsContext.Provider value={value}>{children}</AnalyticsContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAnalytics(): AnalyticsContextValue {\n const context = useContext(AnalyticsContext);\n if (!context) {\n throw new Error(\"useAnalytics must be used within an <AnalyticsProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface AnalyticsNoscriptProps {\n /** GTM container ID (must match AnalyticsProvider). */\n gtmId: string;\n}\n\nexport function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n"],"mappings":";;;AAEA,SAAS,eAAe,aAAa,YAAY,SAAS,QAAQ,gBAAgB;AAmNzE;AAnIT,IAAM,mBAAmB,cAA4C,IAAI;AAYzE,SAAS,eAA0C;AAEjD,MAAI,OAAO,WAAW,YAAa,QAAO,CAAC;AAC3C,MAAI,CAAC,OAAO,UAAW,QAAO,YAAY,CAAC;AAC3C,SAAO,OAAO;AAChB;AAEA,SAAS,gBAAgB,OAAe,UAAmC;AAEzE,MAAI,OAAO,aAAa,YAAa;AAGrC,MAAI,SAAS,eAAe,YAAY,EAAG;AAE3C,QAAM,YAAY,aAAa;AAC/B,YAAU,KAAK,EAAE,cAAa,oBAAI,KAAK,GAAE,QAAQ,GAAG,OAAO,SAAS,CAAC;AAErE,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,KAAK;AACZ,SAAO,MAAM,8CAA8C,mBAAmB,KAAK,CAAC;AAEpF,MAAI,aAAa,cAAc;AAC7B,WAAO,QAAQ;AACf,WAAO,QAAQ;AAAA,EACjB,OAAO;AAEL,WAAO,QAAQ;AAAA,EACjB;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;AAMO,SAAS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KAAK;AAAA,IAC3B;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,eAAe,YAAY,MAAM;AACrC,kBAAc,IAAI;AAClB,YAAQ;AAAA,EACV,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,gBAAgB,YAAY,MAAM;AACtC,kBAAc,KAAK;AAAA,EACrB,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,YAAY,qBAAqB,cAAc,eAAe,YAAY,QAAQ;AAAA,EACrF;AAEA,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAe,UAAS;AAC5D;AAMO,SAAS,eAAsC;AACpD,QAAM,UAAU,WAAW,gBAAgB;AAC3C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAWO,SAAS,kBAAkB,EAAE,MAAM,GAA2B;AACnE,SACE,oBAAC,cACC;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,+CAA+C,mBAAmB,KAAK,CAAC;AAAA,MAC7E,QAAO;AAAA,MACP,OAAM;AAAA,MACN,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS;AAAA,MAC/C,OAAM;AAAA;AAAA,EACR,GACF;AAEJ;","names":[]}
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
8
8
  ref?: React.Ref<HTMLDivElement>;
9
9
  } & {
10
10
  asChild?: boolean;
11
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
11
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
12
12
  label?: string;
13
13
  shouldFilter?: boolean;
14
14
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -25,7 +25,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
25
25
  ref?: React.Ref<HTMLInputElement>;
26
26
  } & {
27
27
  asChild?: boolean;
28
- }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
28
+ }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
29
29
  value?: string;
30
30
  onValueChange?: (search: string) => void;
31
31
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -35,7 +35,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
35
35
  ref?: React.Ref<HTMLDivElement>;
36
36
  } & {
37
37
  asChild?: boolean;
38
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
38
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
39
39
  label?: string;
40
40
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
41
41
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -44,14 +44,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
44
44
  ref?: React.Ref<HTMLDivElement>;
45
45
  } & {
46
46
  asChild?: boolean;
47
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
47
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
48
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
49
49
  children?: React.ReactNode;
50
50
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
51
51
  ref?: React.Ref<HTMLDivElement>;
52
52
  } & {
53
53
  asChild?: boolean;
54
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
54
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
55
55
  heading?: React.ReactNode;
56
56
  value?: string;
57
57
  forceMount?: boolean;
@@ -60,7 +60,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
60
60
  ref?: React.Ref<HTMLDivElement>;
61
61
  } & {
62
62
  asChild?: boolean;
63
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
63
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
64
64
  alwaysRender?: boolean;
65
65
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
66
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -69,7 +69,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
69
69
  ref?: React.Ref<HTMLDivElement>;
70
70
  } & {
71
71
  asChild?: boolean;
72
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
72
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "value" | "disabled"> & {
73
73
  disabled?: boolean;
74
74
  onSelect?: (value: string) => void;
75
75
  value?: string;
package/dist/command.d.ts CHANGED
@@ -8,7 +8,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
8
8
  ref?: React.Ref<HTMLDivElement>;
9
9
  } & {
10
10
  asChild?: boolean;
11
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
11
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
12
12
  label?: string;
13
13
  shouldFilter?: boolean;
14
14
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -25,7 +25,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
25
25
  ref?: React.Ref<HTMLInputElement>;
26
26
  } & {
27
27
  asChild?: boolean;
28
- }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
28
+ }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
29
29
  value?: string;
30
30
  onValueChange?: (search: string) => void;
31
31
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -35,7 +35,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
35
35
  ref?: React.Ref<HTMLDivElement>;
36
36
  } & {
37
37
  asChild?: boolean;
38
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
38
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
39
39
  label?: string;
40
40
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
41
41
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -44,14 +44,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
44
44
  ref?: React.Ref<HTMLDivElement>;
45
45
  } & {
46
46
  asChild?: boolean;
47
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
47
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
48
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
49
49
  children?: React.ReactNode;
50
50
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
51
51
  ref?: React.Ref<HTMLDivElement>;
52
52
  } & {
53
53
  asChild?: boolean;
54
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
54
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
55
55
  heading?: React.ReactNode;
56
56
  value?: string;
57
57
  forceMount?: boolean;
@@ -60,7 +60,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
60
60
  ref?: React.Ref<HTMLDivElement>;
61
61
  } & {
62
62
  asChild?: boolean;
63
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
63
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
64
64
  alwaysRender?: boolean;
65
65
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
66
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -69,7 +69,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
69
69
  ref?: React.Ref<HTMLDivElement>;
70
70
  } & {
71
71
  asChild?: boolean;
72
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
72
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "value" | "disabled"> & {
73
73
  disabled?: boolean;
74
74
  onSelect?: (value: string) => void;
75
75
  value?: string;
package/dist/gtm.cjs CHANGED
@@ -4,16 +4,10 @@
4
4
 
5
5
 
6
6
 
7
+ var _chunkAE4GLYJEcjs = require('./chunk-AE4GLYJE.cjs');
7
8
 
8
9
 
9
10
 
10
- var _chunkCTYDRQMLcjs = require('./chunk-CTYDRQML.cjs');
11
11
 
12
-
13
-
14
-
15
-
16
-
17
-
18
- exports.AnalyticsNoscript = _chunkCTYDRQMLcjs.AnalyticsNoscript; exports.AnalyticsProvider = _chunkCTYDRQMLcjs.AnalyticsProvider; exports.GtmNoscript = _chunkCTYDRQMLcjs.GtmNoscript; exports.GtmProvider = _chunkCTYDRQMLcjs.GtmProvider; exports.useAnalytics = _chunkCTYDRQMLcjs.useAnalytics; exports.useGtm = _chunkCTYDRQMLcjs.useGtm;
12
+ exports.AnalyticsNoscript = _chunkAE4GLYJEcjs.AnalyticsNoscript; exports.AnalyticsProvider = _chunkAE4GLYJEcjs.AnalyticsProvider; exports.useAnalytics = _chunkAE4GLYJEcjs.useAnalytics;
19
13
  //# sourceMappingURL=gtm.cjs.map
package/dist/gtm.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ,YAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,6UAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs"}
1
+ {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ,YAAY;AACZ;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wLAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/gtm.cjs"}
package/dist/gtm.d.cts CHANGED
@@ -65,25 +65,5 @@ interface AnalyticsNoscriptProps {
65
65
  gtmId: string;
66
66
  }
67
67
  declare function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps): react_jsx_runtime.JSX.Element;
68
- /** @deprecated Use `AnalyticsStrategy` instead. */
69
- type GtmStrategy = AnalyticsStrategy;
70
- /** @deprecated Use `EcommerceEvent` instead. */
71
- type GtmEcommerceEvent = EcommerceEvent;
72
- /** @deprecated Use `EcommerceItem` instead. */
73
- type GtmItem = EcommerceItem;
74
- /** @deprecated Use `EcommerceParams` instead. */
75
- type GtmEcommerceParams = EcommerceParams;
76
- /** @deprecated Use `AnalyticsProviderProps` instead. */
77
- type GtmProviderProps = AnalyticsProviderProps;
78
- /** @deprecated Use `AnalyticsContextValue` instead. */
79
- type GtmContextValue = AnalyticsContextValue;
80
- /** @deprecated Use `AnalyticsNoscriptProps` instead. */
81
- type GtmNoscriptProps = AnalyticsNoscriptProps;
82
- /** @deprecated Use `AnalyticsProvider` instead. */
83
- declare const GtmProvider: typeof AnalyticsProvider;
84
- /** @deprecated Use `useAnalytics` instead. */
85
- declare const useGtm: typeof useAnalytics;
86
- /** @deprecated Use `AnalyticsNoscript` instead. */
87
- declare const GtmNoscript: typeof AnalyticsNoscript;
88
68
 
89
- export { type AnalyticsContextValue, AnalyticsNoscript, type AnalyticsNoscriptProps, AnalyticsProvider, type AnalyticsProviderProps, type AnalyticsStrategy, type EcommerceEvent, type EcommerceItem, type EcommerceParams, type GtmContextValue, type GtmEcommerceEvent, type GtmEcommerceParams, type GtmItem, GtmNoscript, type GtmNoscriptProps, GtmProvider, type GtmProviderProps, type GtmStrategy, useAnalytics, useGtm };
69
+ export { type AnalyticsContextValue, AnalyticsNoscript, type AnalyticsNoscriptProps, AnalyticsProvider, type AnalyticsProviderProps, type AnalyticsStrategy, type EcommerceEvent, type EcommerceItem, type EcommerceParams, useAnalytics };
package/dist/gtm.d.ts CHANGED
@@ -65,25 +65,5 @@ interface AnalyticsNoscriptProps {
65
65
  gtmId: string;
66
66
  }
67
67
  declare function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps): react_jsx_runtime.JSX.Element;
68
- /** @deprecated Use `AnalyticsStrategy` instead. */
69
- type GtmStrategy = AnalyticsStrategy;
70
- /** @deprecated Use `EcommerceEvent` instead. */
71
- type GtmEcommerceEvent = EcommerceEvent;
72
- /** @deprecated Use `EcommerceItem` instead. */
73
- type GtmItem = EcommerceItem;
74
- /** @deprecated Use `EcommerceParams` instead. */
75
- type GtmEcommerceParams = EcommerceParams;
76
- /** @deprecated Use `AnalyticsProviderProps` instead. */
77
- type GtmProviderProps = AnalyticsProviderProps;
78
- /** @deprecated Use `AnalyticsContextValue` instead. */
79
- type GtmContextValue = AnalyticsContextValue;
80
- /** @deprecated Use `AnalyticsNoscriptProps` instead. */
81
- type GtmNoscriptProps = AnalyticsNoscriptProps;
82
- /** @deprecated Use `AnalyticsProvider` instead. */
83
- declare const GtmProvider: typeof AnalyticsProvider;
84
- /** @deprecated Use `useAnalytics` instead. */
85
- declare const useGtm: typeof useAnalytics;
86
- /** @deprecated Use `AnalyticsNoscript` instead. */
87
- declare const GtmNoscript: typeof AnalyticsNoscript;
88
68
 
89
- export { type AnalyticsContextValue, AnalyticsNoscript, type AnalyticsNoscriptProps, AnalyticsProvider, type AnalyticsProviderProps, type AnalyticsStrategy, type EcommerceEvent, type EcommerceItem, type EcommerceParams, type GtmContextValue, type GtmEcommerceEvent, type GtmEcommerceParams, type GtmItem, GtmNoscript, type GtmNoscriptProps, GtmProvider, type GtmProviderProps, type GtmStrategy, useAnalytics, useGtm };
69
+ export { type AnalyticsContextValue, AnalyticsNoscript, type AnalyticsNoscriptProps, AnalyticsProvider, type AnalyticsProviderProps, type AnalyticsStrategy, type EcommerceEvent, type EcommerceItem, type EcommerceParams, useAnalytics };
package/dist/gtm.js CHANGED
@@ -3,17 +3,11 @@
3
3
  import {
4
4
  AnalyticsNoscript,
5
5
  AnalyticsProvider,
6
- GtmNoscript,
7
- GtmProvider,
8
- useAnalytics,
9
- useGtm
10
- } from "./chunk-U35D7OOZ.js";
6
+ useAnalytics
7
+ } from "./chunk-DCXYO3RB.js";
11
8
  export {
12
9
  AnalyticsNoscript,
13
10
  AnalyticsProvider,
14
- GtmNoscript,
15
- GtmProvider,
16
- useAnalytics,
17
- useGtm
11
+ useAnalytics
18
12
  };
19
13
  //# sourceMappingURL=gtm.js.map
package/dist/provider.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _chunkCTYDRQMLcjs = require('./chunk-CTYDRQML.cjs');
4
+ var _chunkAE4GLYJEcjs = require('./chunk-AE4GLYJE.cjs');
5
5
 
6
6
  // src/provider.tsx
7
7
  var _augurhooks = require('@simpleapps-com/augur-hooks');
8
8
  var _jsxruntime = require('react/jsx-runtime');
9
9
  function AugurSiteProvider({ config, api, auth, cache, children }) {
10
10
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _augurhooks.AugurHooksProvider, { api, auth, cache, site: config, children: config.analytics ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11
- _chunkCTYDRQMLcjs.AnalyticsProvider,
11
+ _chunkAE4GLYJEcjs.AnalyticsProvider,
12
12
  {
13
13
  gtmId: config.analytics.gtmId,
14
14
  consentRequired: config.analytics.consentRequired,
package/dist/provider.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  AnalyticsProvider
4
- } from "./chunk-U35D7OOZ.js";
4
+ } from "./chunk-DCXYO3RB.js";
5
5
 
6
6
  // src/provider.tsx
7
7
  import { AugurHooksProvider } from "@simpleapps-com/augur-hooks";
package/llms.txt CHANGED
@@ -24,7 +24,7 @@ Each package ships its own llms.txt with exports and usage patterns.
24
24
 
25
25
  > Shared React UI components for Augur ecommerce sites (Radix + Tailwind)
26
26
 
27
- Version: 2.2.10
27
+ Version: 2.2.29
28
28
 
29
29
  ## @simpleapps-com/augur-web/accordion
30
30
 
@@ -157,6 +157,25 @@ export const { Price, formatPrice } = createPrice({
157
157
  - component: RadioGroup
158
158
  - component: RadioGroupItem
159
159
 
160
+ ## @simpleapps-com/augur-web/resource-tabs
161
+
162
+ - function: ResourceTabs - Standardized sub-resource tab layout for detail pages.
163
+ - type: ResourceTabsProps
164
+ - type: TabDef
165
+
166
+ ### Examples
167
+
168
+ ResourceTabs:
169
+ ```tsx
170
+ <ResourceTabs
171
+ tabs={[
172
+ { value: "attributes", label: "Attributes", content: <AttributesList /> },
173
+ { value: "items", label: "Items", content: <ItemsList /> },
174
+ ]}
175
+ />
176
+ ```
177
+
178
+
160
179
  ## @simpleapps-com/augur-web/select
161
180
 
162
181
  - component: Select
@@ -209,6 +228,57 @@ export const { Price, formatPrice } = createPrice({
209
228
  - component: CommandSeparator
210
229
  - const: CommandShortcut
211
230
 
231
+ ## @simpleapps-com/augur-web/confirm-dialog
232
+
233
+ - function: ConfirmDialog - Pre-composed confirmation dialog for delete/action confirmations.
234
+ - type: ConfirmDialogProps
235
+
236
+ ### Examples
237
+
238
+ ConfirmDialog:
239
+ ```tsx
240
+ <ConfirmDialog
241
+ open={showDelete}
242
+ onOpenChange={setShowDelete}
243
+ title="Delete brand?"
244
+ description="This action cannot be undone."
245
+ variant="destructive"
246
+ onConfirm={() => deleteBrand.mutate(uid)}
247
+ loading={deleteBrand.isPending}
248
+ />
249
+ ```
250
+
251
+
252
+ ## @simpleapps-com/augur-web/data-table
253
+
254
+ - function: DataTable
255
+ - value: RowSelectionState
256
+ - value: SortingState
257
+ - value: VisibilityState
258
+ - type: ColumnDef
259
+ - type: DataTablePagination
260
+ - type: DataTableProps
261
+
262
+ ## @simpleapps-com/augur-web/detail-panel
263
+
264
+ - function: DetailPanel - Read/edit toggle panel for a single record. Renders field values in read
265
+ - type: DetailPanelProps
266
+ - type: FieldDef
267
+
268
+ ### Examples
269
+
270
+ DetailPanel:
271
+ ```tsx
272
+ const fields: FieldDef<Brand>[] = [
273
+ { key: "brandsName", label: "Name", type: "text", required: true },
274
+ { key: "brandsDesc", label: "Description", type: "textarea" },
275
+ { key: "brandsUid", label: "UID", type: "readonly" },
276
+ ];
277
+
278
+ <DetailPanel fields={fields} data={brand} onSave={handleSave} />
279
+ ```
280
+
281
+
212
282
  ## @simpleapps-com/augur-web/dialog
213
283
 
214
284
  - component: Dialog
@@ -336,10 +406,7 @@ FinancingWidget:
336
406
 
337
407
  - function: AnalyticsNoscript
338
408
  - function: AnalyticsProvider
339
- - const: GtmNoscript
340
- - const: GtmProvider
341
409
  - function: useAnalytics
342
- - const: useGtm
343
410
  - type: AnalyticsContextValue
344
411
  - type: AnalyticsNoscriptProps
345
412
  - type: AnalyticsProviderProps
@@ -347,13 +414,6 @@ FinancingWidget:
347
414
  - type: EcommerceEvent
348
415
  - type: EcommerceItem
349
416
  - type: EcommerceParams
350
- - type: GtmContextValue
351
- - type: GtmEcommerceEvent
352
- - type: GtmEcommerceParams
353
- - type: GtmItem
354
- - type: GtmNoscriptProps
355
- - type: GtmProviderProps
356
- - type: GtmStrategy
357
417
 
358
418
  ## @simpleapps-com/augur-web/mdx-components
359
419
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-web",
3
- "version": "2.2.29",
3
+ "version": "2.3.0",
4
4
  "description": "Shared React UI components for Augur ecommerce sites (Radix + Tailwind)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -228,9 +228,9 @@
228
228
  "llms.txt"
229
229
  ],
230
230
  "dependencies": {
231
- "@simpleapps-com/augur-core": "2.2.29",
232
- "@simpleapps-com/augur-hooks": "2.2.29",
233
- "@simpleapps-com/augur-utils": "2.2.29"
231
+ "@simpleapps-com/augur-core": "2.3.0",
232
+ "@simpleapps-com/augur-hooks": "2.3.0",
233
+ "@simpleapps-com/augur-utils": "2.3.0"
234
234
  },
235
235
  "peerDependencies": {
236
236
  "@radix-ui/react-accordion": "^1.2.0",
@@ -282,8 +282,8 @@
282
282
  "tsup": "^8.5.0",
283
283
  "vitest": "^3.2.0",
284
284
  "@augur-packages/tsconfig": "0.0.0",
285
- "@simpleapps-com/augur-core": "2.2.29",
286
- "@simpleapps-com/augur-hooks": "2.2.29"
285
+ "@simpleapps-com/augur-core": "2.3.0",
286
+ "@simpleapps-com/augur-hooks": "2.3.0"
287
287
  },
288
288
  "scripts": {
289
289
  "build": "tsup",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/chunk-CTYDRQML.cjs","../src/gtm.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACAA,8BAAkF;AAmNzE,+CAAA;AAnIT,IAAM,iBAAA,EAAmB,kCAAA,IAAgD,CAAA;A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A;AAIqD,EAAA;AAC/D,IAAA;AACV,EAAA;AAEmB,EAAA;AACoC,IAAA;AAClB,MAAA;AACtB,MAAA;AACuB,QAAA;AAClC,MAAA;AACyB,MAAA;AAC3B,IAAA;AACM,IAAA;AACR,EAAA;AAE4B,EAAA;AAC0B,IAAA;AAEX,MAAA;AACE,MAAA;AAC9B,MAAA;AACiC,QAAA;AAC5C,MAAA;AACyB,MAAA;AAC3B,IAAA;AACM,IAAA;AACR,EAAA;AAEuC,EAAA;AACnB,IAAA;AACV,IAAA;AACE,EAAA;AAE4B,EAAA;AACnB,IAAA;AAChB,EAAA;AAES,EAAA;AACL,IAAA;AACL,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACF,IAAA;AACmF,IAAA;AACrF,EAAA;AAE0D,EAAA;AAC5D;AAMsD;AACT,EAAA;AAC7B,EAAA;AAC6D,IAAA;AAC3E,EAAA;AACO,EAAA;AACT;AAWqE;AAG/D,EAAA;AAAC,IAAA;AAAA,IAAA;AAC8E,MAAA;AACtE,MAAA;AACD,MAAA;AACyC,MAAA;AACzC,MAAA;AAAA,IAAA;AAEV,EAAA;AAEJ;AAsB2B;AAEL;AAEK;AD1J4D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/chunk-CTYDRQML.cjs","sourcesContent":[null,"\"use client\";\n\nimport { createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Script loading strategy. */\nexport type AnalyticsStrategy = \"default\" | \"afterInteractive\" | \"lazyOnload\";\n\n/** GA4 standard e-commerce event names. */\nexport type EcommerceEvent =\n | \"view_item\"\n | \"view_item_list\"\n | \"select_item\"\n | \"add_to_cart\"\n | \"remove_from_cart\"\n | \"view_cart\"\n | \"begin_checkout\"\n | \"add_shipping_info\"\n | \"add_payment_info\"\n | \"purchase\"\n | \"refund\";\n\n/** GA4 e-commerce item shape. */\nexport interface EcommerceItem {\n item_id: string;\n item_name?: string;\n item_brand?: string;\n item_category?: string;\n item_variant?: string;\n price?: number;\n quantity?: number;\n index?: number;\n [key: string]: unknown;\n}\n\n/** Parameters for e-commerce events. */\nexport interface EcommerceParams {\n currency?: string;\n value?: number;\n items?: EcommerceItem[];\n transaction_id?: string;\n shipping?: number;\n tax?: number;\n coupon?: string;\n [key: string]: unknown;\n}\n\nexport interface AnalyticsProviderProps {\n /** GTM container ID (e.g. \"GTM-XXXXX\"). */\n gtmId: string;\n /** Script loading strategy. Default: \"afterInteractive\". */\n strategy?: AnalyticsStrategy;\n /** Delay GTM loading until consent is granted. Default: false. */\n consentRequired?: boolean;\n /** Log dataLayer pushes to console. Default: false. */\n debug?: boolean;\n children: ReactNode;\n}\n\nexport interface AnalyticsContextValue {\n /** Push a custom event to the dataLayer. */\n trackEvent: (event: string, params?: Record<string, unknown>) => void;\n /** Push a GA4 e-commerce event to the dataLayer. */\n trackEcommerceEvent: (event: EcommerceEvent, params: EcommerceParams) => void;\n /** Grant consent — loads GTM if consentRequired was true. */\n grantConsent: () => void;\n /** Revoke consent. Does not unload GTM (scripts can't be unloaded). */\n revokeConsent: () => void;\n /** Whether consent has been granted. */\n hasConsent: boolean;\n /** Whether the GTM script has been injected. */\n isLoaded: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AnalyticsContext = createContext<AnalyticsContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ndeclare global {\n interface Window {\n dataLayer?: Record<string, unknown>[];\n }\n}\n\nfunction getDataLayer(): Record<string, unknown>[] {\n /* v8 ignore next */\n if (typeof window === \"undefined\") return [];\n if (!window.dataLayer) window.dataLayer = [];\n return window.dataLayer;\n}\n\nfunction injectGtmScript(gtmId: string, strategy: AnalyticsStrategy): void {\n /* v8 ignore next */\n if (typeof document === \"undefined\") return;\n\n // Prevent double-injection\n if (document.getElementById(\"gtm-script\")) return;\n\n const dataLayer = getDataLayer();\n dataLayer.push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n\n const script = document.createElement(\"script\");\n script.id = \"gtm-script\";\n script.src = `https://www.googletagmanager.com/gtm.js?id=${encodeURIComponent(gtmId)}`;\n\n if (strategy === \"lazyOnload\") {\n script.async = true;\n script.defer = true;\n } else {\n // \"default\" and \"afterInteractive\"\n script.async = true;\n }\n\n document.head.appendChild(script);\n}\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport function AnalyticsProvider({\n gtmId,\n strategy = \"afterInteractive\",\n consentRequired = false,\n debug = false,\n children,\n}: AnalyticsProviderProps) {\n const [hasConsent, setHasConsent] = useState(!consentRequired);\n const [isLoaded, setIsLoaded] = useState(false);\n const injectedRef = useRef(false);\n\n const loadGtm = useCallback(() => {\n if (injectedRef.current) return;\n injectedRef.current = true;\n\n if (strategy === \"lazyOnload\" && typeof requestIdleCallback === \"function\") {\n requestIdleCallback(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n });\n } else if (strategy === \"afterInteractive\") {\n // Defer to after hydration\n setTimeout(() => {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }, 0);\n } else {\n injectGtmScript(gtmId, strategy);\n setIsLoaded(true);\n }\n }, [gtmId, strategy]);\n\n // Auto-load when consent is not required or already granted\n /* v8 ignore next */\n if (hasConsent && !injectedRef.current && typeof window !== \"undefined\") {\n loadGtm();\n }\n\n const trackEvent = useCallback(\n (event: string, params?: Record<string, unknown>) => {\n const entry = { event, ...params };\n if (debug) {\n console.log(\"[Analytics]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const trackEcommerceEvent = useCallback(\n (event: EcommerceEvent, params: EcommerceParams) => {\n // Clear previous ecommerce data per GA4 best practices\n getDataLayer().push({ ecommerce: null });\n const entry = { event, ecommerce: params };\n if (debug) {\n console.log(\"[Analytics ecommerce]\", entry);\n }\n getDataLayer().push(entry);\n },\n [debug],\n );\n\n const grantConsent = useCallback(() => {\n setHasConsent(true);\n loadGtm();\n }, [loadGtm]);\n\n const revokeConsent = useCallback(() => {\n setHasConsent(false);\n }, []);\n\n const value = useMemo<AnalyticsContextValue>(\n () => ({\n trackEvent,\n trackEcommerceEvent,\n grantConsent,\n revokeConsent,\n hasConsent,\n isLoaded,\n }),\n [trackEvent, trackEcommerceEvent, grantConsent, revokeConsent, hasConsent, isLoaded],\n );\n\n return <AnalyticsContext.Provider value={value}>{children}</AnalyticsContext.Provider>;\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\nexport function useAnalytics(): AnalyticsContextValue {\n const context = useContext(AnalyticsContext);\n if (!context) {\n throw new Error(\"useAnalytics must be used within an <AnalyticsProvider>\");\n }\n return context;\n}\n\n// ---------------------------------------------------------------------------\n// Noscript\n// ---------------------------------------------------------------------------\n\nexport interface AnalyticsNoscriptProps {\n /** GTM container ID (must match AnalyticsProvider). */\n gtmId: string;\n}\n\nexport function AnalyticsNoscript({ gtmId }: AnalyticsNoscriptProps) {\n return (\n <noscript>\n <iframe\n src={`https://www.googletagmanager.com/ns.html?id=${encodeURIComponent(gtmId)}`}\n height=\"0\"\n width=\"0\"\n style={{ display: \"none\", visibility: \"hidden\" }}\n title=\"Google Tag Manager\"\n />\n </noscript>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Backward-compatible aliases (from #59 GtmProvider)\n// ---------------------------------------------------------------------------\n\n/** @deprecated Use `AnalyticsStrategy` instead. */\nexport type GtmStrategy = AnalyticsStrategy;\n/** @deprecated Use `EcommerceEvent` instead. */\nexport type GtmEcommerceEvent = EcommerceEvent;\n/** @deprecated Use `EcommerceItem` instead. */\nexport type GtmItem = EcommerceItem;\n/** @deprecated Use `EcommerceParams` instead. */\nexport type GtmEcommerceParams = EcommerceParams;\n/** @deprecated Use `AnalyticsProviderProps` instead. */\nexport type GtmProviderProps = AnalyticsProviderProps;\n/** @deprecated Use `AnalyticsContextValue` instead. */\nexport type GtmContextValue = AnalyticsContextValue;\n/** @deprecated Use `AnalyticsNoscriptProps` instead. */\nexport type GtmNoscriptProps = AnalyticsNoscriptProps;\n\n/** @deprecated Use `AnalyticsProvider` instead. */\nexport const GtmProvider = AnalyticsProvider;\n/** @deprecated Use `useAnalytics` instead. */\nexport const useGtm = useAnalytics;\n/** @deprecated Use `AnalyticsNoscript` instead. */\nexport const GtmNoscript = AnalyticsNoscript;\n"]}