@shware/analytics 3.5.1 → 3.6.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.
Files changed (49) hide show
  1. package/dist/server/index.cjs +3 -0
  2. package/dist/server/index.cjs.map +1 -1
  3. package/dist/server/index.d.cts +2 -0
  4. package/dist/server/index.d.ts +2 -0
  5. package/dist/server/index.mjs +2 -0
  6. package/dist/server/index.mjs.map +1 -1
  7. package/dist/server/openai-conversions-api.cjs +107 -0
  8. package/dist/server/openai-conversions-api.cjs.map +1 -0
  9. package/dist/server/openai-conversions-api.d.cts +47 -0
  10. package/dist/server/openai-conversions-api.d.ts +47 -0
  11. package/dist/server/openai-conversions-api.mjs +81 -0
  12. package/dist/server/openai-conversions-api.mjs.map +1 -0
  13. package/dist/tanstack/index.cjs +28 -0
  14. package/dist/tanstack/index.cjs.map +1 -1
  15. package/dist/tanstack/index.d.cts +2 -1
  16. package/dist/tanstack/index.d.ts +2 -1
  17. package/dist/tanstack/index.mjs +28 -0
  18. package/dist/tanstack/index.mjs.map +1 -1
  19. package/dist/third-parties/google-analytics.cjs.map +1 -1
  20. package/dist/third-parties/google-analytics.mjs.map +1 -1
  21. package/dist/third-parties/index.cjs +5 -0
  22. package/dist/third-parties/index.cjs.map +1 -1
  23. package/dist/third-parties/index.d.cts +2 -0
  24. package/dist/third-parties/index.d.ts +2 -0
  25. package/dist/third-parties/index.mjs +3 -0
  26. package/dist/third-parties/index.mjs.map +1 -1
  27. package/dist/third-parties/linkedin-insight-tag.cjs.map +1 -1
  28. package/dist/third-parties/linkedin-insight-tag.mjs.map +1 -1
  29. package/dist/third-parties/meta-pixel.cjs.map +1 -1
  30. package/dist/third-parties/meta-pixel.mjs.map +1 -1
  31. package/dist/third-parties/openai-pixel.cjs +78 -0
  32. package/dist/third-parties/openai-pixel.cjs.map +1 -0
  33. package/dist/third-parties/openai-pixel.d.cts +23 -0
  34. package/dist/third-parties/openai-pixel.d.ts +23 -0
  35. package/dist/third-parties/openai-pixel.mjs +52 -0
  36. package/dist/third-parties/openai-pixel.mjs.map +1 -0
  37. package/dist/third-parties/reddit-pixel.cjs.map +1 -1
  38. package/dist/third-parties/reddit-pixel.mjs.map +1 -1
  39. package/dist/track/gtag.cjs.map +1 -1
  40. package/dist/track/gtag.d.cts +45 -12
  41. package/dist/track/gtag.d.ts +45 -12
  42. package/dist/track/gtag.mjs.map +1 -1
  43. package/dist/track/oaiq.cjs +155 -0
  44. package/dist/track/oaiq.cjs.map +1 -0
  45. package/dist/track/oaiq.d.cts +110 -0
  46. package/dist/track/oaiq.d.ts +110 -0
  47. package/dist/track/oaiq.mjs +128 -0
  48. package/dist/track/oaiq.mjs.map +1 -0
  49. package/package.json +14 -14
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/track/oaiq.ts
21
+ var oaiq_exports = {};
22
+ __export(oaiq_exports, {
23
+ mapContents: () => mapContents,
24
+ mapOAIEvent: () => mapOAIEvent,
25
+ toMinorUnits: () => toMinorUnits
26
+ });
27
+ module.exports = __toCommonJS(oaiq_exports);
28
+ var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
29
+ "BIF",
30
+ "CLP",
31
+ "DJF",
32
+ "GNF",
33
+ "ISK",
34
+ "JPY",
35
+ "KMF",
36
+ "KRW",
37
+ "MGA",
38
+ "PYG",
39
+ "RWF",
40
+ "UGX",
41
+ "VND",
42
+ "VUV",
43
+ "XAF",
44
+ "XOF",
45
+ "XPF"
46
+ ]);
47
+ var THREE_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set(["BHD", "IQD", "JOD", "KWD", "LYD", "OMR", "TND"]);
48
+ function toMinorUnits(value, currency) {
49
+ if (value === void 0 || value === null || Number.isNaN(value)) return void 0;
50
+ const code = currency == null ? void 0 : currency.toUpperCase();
51
+ const exponent = code && ZERO_DECIMAL_CURRENCIES.has(code) ? 0 : code && THREE_DECIMAL_CURRENCIES.has(code) ? 3 : 2;
52
+ return Math.round(value * 10 ** exponent);
53
+ }
54
+ function mapContents(items, currency) {
55
+ if (!items || items.length === 0) return void 0;
56
+ const code = currency == null ? void 0 : currency.toUpperCase();
57
+ return items.map((item) => ({
58
+ id: item.item_id,
59
+ name: item.item_name,
60
+ content_type: item.item_category,
61
+ quantity: item.quantity,
62
+ amount: toMinorUnits(item.price, currency),
63
+ currency: item.price !== void 0 ? code : void 0
64
+ }));
65
+ }
66
+ function prop(properties, key) {
67
+ return typeof properties === "object" && properties !== null ? properties[key] : void 0;
68
+ }
69
+ function readValue(properties) {
70
+ const value = prop(properties, "value");
71
+ return typeof value === "number" ? value : void 0;
72
+ }
73
+ function readCurrency(properties) {
74
+ const currency = prop(properties, "currency");
75
+ return typeof currency === "string" ? currency : void 0;
76
+ }
77
+ function readItems(properties) {
78
+ const items = prop(properties, "items");
79
+ return Array.isArray(items) ? items : void 0;
80
+ }
81
+ function contentsData(properties) {
82
+ const currency = readCurrency(properties);
83
+ return {
84
+ type: "contents",
85
+ amount: toMinorUnits(readValue(properties), currency),
86
+ currency: currency == null ? void 0 : currency.toUpperCase(),
87
+ contents: mapContents(readItems(properties), currency)
88
+ };
89
+ }
90
+ function customerActionData(properties) {
91
+ const currency = readCurrency(properties);
92
+ return {
93
+ type: "customer_action",
94
+ amount: toMinorUnits(readValue(properties), currency),
95
+ currency: currency == null ? void 0 : currency.toUpperCase()
96
+ };
97
+ }
98
+ function planEnrollmentData(properties) {
99
+ var _a;
100
+ const currency = readCurrency(properties);
101
+ const items = readItems(properties);
102
+ return {
103
+ type: "plan_enrollment",
104
+ plan_id: (_a = items == null ? void 0 : items[0]) == null ? void 0 : _a.item_id,
105
+ amount: toMinorUnits(readValue(properties), currency),
106
+ currency: currency == null ? void 0 : currency.toUpperCase(),
107
+ contents: mapContents(items, currency)
108
+ };
109
+ }
110
+ function mapOAIEvent(name, properties) {
111
+ switch (name) {
112
+ case "page_view":
113
+ return { type: "page_viewed", data: contentsData(properties) };
114
+ case "view_item":
115
+ case "view_item_list":
116
+ return { type: "contents_viewed", data: contentsData(properties) };
117
+ case "begin_checkout":
118
+ return { type: "checkout_started", data: contentsData(properties) };
119
+ case "add_to_cart":
120
+ return { type: "items_added", data: contentsData(properties) };
121
+ case "purchase":
122
+ return { type: "order_created", data: contentsData(properties) };
123
+ case "generate_lead":
124
+ case "qualify_lead":
125
+ return { type: "lead_created", data: customerActionData(properties) };
126
+ case "sign_up":
127
+ case "login":
128
+ return { type: "registration_completed", data: customerActionData(properties) };
129
+ case "schedule":
130
+ return { type: "appointment_scheduled", data: customerActionData(properties) };
131
+ case "subscribe":
132
+ return { type: "subscription_created", data: planEnrollmentData(properties) };
133
+ case "trial_begin":
134
+ return { type: "trial_started", data: planEnrollmentData(properties) };
135
+ default: {
136
+ const currency = readCurrency(properties);
137
+ return {
138
+ type: "custom",
139
+ data: {
140
+ type: "custom",
141
+ amount: toMinorUnits(readValue(properties), currency),
142
+ currency: currency == null ? void 0 : currency.toUpperCase(),
143
+ contents: mapContents(readItems(properties), currency)
144
+ }
145
+ };
146
+ }
147
+ }
148
+ }
149
+ // Annotate the CommonJS export names for ESM import in node:
150
+ 0 && (module.exports = {
151
+ mapContents,
152
+ mapOAIEvent,
153
+ toMinorUnits
154
+ });
155
+ //# sourceMappingURL=oaiq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/track/oaiq.ts"],"sourcesContent":["import type { Item } from './gtag';\nimport type { EventName, TrackName, TrackProperties } from './types';\n\n/**\n * Content item shared by `contents` and `plan_enrollment` events.\n * https://developers.openai.com/ads/supported-events\n */\nexport type ContentItem = {\n id?: string;\n name?: string;\n content_type?: string;\n quantity?: number;\n /** Per-item monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */\n amount?: number;\n currency?: string;\n};\n\nexport type ContentsData = {\n type: 'contents';\n /** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type CustomerActionData = {\n type: 'customer_action';\n amount?: number;\n currency?: string;\n};\n\nexport type PlanEnrollmentData = {\n type: 'plan_enrollment';\n plan_id?: string;\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type CustomEventData = {\n type: 'custom';\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;\n\n/**\n * Standard event names and the `data` shape each one expects.\n * https://developers.openai.com/ads/supported-events\n */\nexport type StandardEvents = {\n appointment_scheduled: CustomerActionData;\n checkout_started: ContentsData;\n contents_viewed: ContentsData;\n items_added: ContentsData;\n lead_created: CustomerActionData;\n order_created: ContentsData;\n page_viewed: ContentsData;\n registration_completed: CustomerActionData;\n subscription_created: PlanEnrollmentData;\n trial_started: PlanEnrollmentData;\n};\n\nexport type StandardEvent = keyof StandardEvents;\n\n/**\n * Identity fields passed to `oaiq(\"init\", ...)` for conversion matching. Email and external id\n * must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.\n * https://developers.openai.com/ads/measurement-pixel\n */\nexport type OAIQUser = {\n email_sha256?: string;\n external_id_sha256?: string;\n /** Two-letter ISO 3166-1 country code (e.g. \"US\"). */\n country?: string;\n /** Lowercased, max 128 characters. */\n city?: string;\n /** Max 32 characters. */\n zip_code?: string;\n};\n\nexport type InitConfig = {\n pixelId: string;\n /** Log SDK activity to the browser console. */\n debug?: boolean;\n user?: OAIQUser;\n};\n\n/**\n * Fourth argument of `oaiq(\"measure\", ...)`. Required for custom events (carries\n * `custom_event_name`); optional for standard events.\n */\nexport type MeasureOptions = {\n /** Shared with the Conversions API to deduplicate the same conversion across browser and server. */\n event_id?: string;\n /** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */\n custom_event_name?: string;\n /** When true, opts the event out of user-level personalization. */\n opt_out?: boolean;\n};\n\nexport interface OAIQ {\n oaiq(command: 'init', config: InitConfig): void;\n oaiq<T extends StandardEvent>(\n command: 'measure',\n event: T,\n data: StandardEvents[T],\n options?: MeasureOptions\n ): void;\n oaiq(\n command: 'measure',\n event: 'custom',\n data: CustomEventData,\n options: MeasureOptions & { custom_event_name: string }\n ): void;\n}\n\n/**\n * Currencies whose minor unit has 0 or 3 decimal places; everything else uses 2.\n * Follows Stripe's zero-decimal convention (e.g., MGA is treated as 0, ISK is included),\n * which can differ from strict ISO 4217 exponents.\n * https://docs.stripe.com/currencies#zero-decimal\n */\nconst ZERO_DECIMAL_CURRENCIES = new Set([\n 'BIF',\n 'CLP',\n 'DJF',\n 'GNF',\n 'ISK',\n 'JPY',\n 'KMF',\n 'KRW',\n 'MGA',\n 'PYG',\n 'RWF',\n 'UGX',\n 'VND',\n 'VUV',\n 'XAF',\n 'XOF',\n 'XPF',\n]);\nconst THREE_DECIMAL_CURRENCIES = new Set(['BHD', 'IQD', 'JOD', 'KWD', 'LYD', 'OMR', 'TND']);\n\n/** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */\nexport function toMinorUnits(value?: number, currency?: string): number | undefined {\n if (value === undefined || value === null || Number.isNaN(value)) return undefined;\n const code = currency?.toUpperCase();\n const exponent =\n code && ZERO_DECIMAL_CURRENCIES.has(code)\n ? 0\n : code && THREE_DECIMAL_CURRENCIES.has(code)\n ? 3\n : 2;\n return Math.round(value * 10 ** exponent);\n}\n\nexport function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined {\n if (!items || items.length === 0) return undefined;\n const code = currency?.toUpperCase();\n return items.map((item) => ({\n id: item.item_id,\n name: item.item_name,\n content_type: item.item_category,\n quantity: item.quantity,\n amount: toMinorUnits(item.price, currency),\n currency: item.price !== undefined ? code : undefined,\n }));\n}\n\n/** Safely read a property off loosely typed track properties without widening to `any`. */\nfunction prop(properties: unknown, key: string): unknown {\n return typeof properties === 'object' && properties !== null\n ? (properties as Record<string, unknown>)[key]\n : undefined;\n}\n\nfunction readValue(properties: unknown): number | undefined {\n const value = prop(properties, 'value');\n return typeof value === 'number' ? value : undefined;\n}\n\nfunction readCurrency(properties: unknown): string | undefined {\n const currency = prop(properties, 'currency');\n return typeof currency === 'string' ? currency : undefined;\n}\n\nfunction readItems(properties: unknown): Item[] | undefined {\n const items = prop(properties, 'items');\n return Array.isArray(items) ? (items as Item[]) : undefined;\n}\n\nfunction contentsData(properties: unknown): ContentsData {\n const currency = readCurrency(properties);\n return {\n type: 'contents',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(readItems(properties), currency),\n };\n}\n\nfunction customerActionData(properties: unknown): CustomerActionData {\n const currency = readCurrency(properties);\n return {\n type: 'customer_action',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n };\n}\n\nfunction planEnrollmentData(properties: unknown): PlanEnrollmentData {\n const currency = readCurrency(properties);\n const items = readItems(properties);\n return {\n type: 'plan_enrollment',\n plan_id: items?.[0]?.item_id,\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(items, currency),\n };\n}\n\nexport type MappedOAIEvent = {\n type: StandardEvent | 'custom';\n data: EventData;\n};\n\n/** Map an internal track event onto an OpenAI standard (or custom) conversion event. */\nexport function mapOAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n): MappedOAIEvent {\n switch (name) {\n case 'page_view':\n return { type: 'page_viewed', data: contentsData(properties) };\n case 'view_item':\n case 'view_item_list':\n return { type: 'contents_viewed', data: contentsData(properties) };\n case 'begin_checkout':\n return { type: 'checkout_started', data: contentsData(properties) };\n case 'add_to_cart':\n return { type: 'items_added', data: contentsData(properties) };\n case 'purchase':\n return { type: 'order_created', data: contentsData(properties) };\n case 'generate_lead':\n case 'qualify_lead':\n return { type: 'lead_created', data: customerActionData(properties) };\n case 'sign_up':\n case 'login':\n return { type: 'registration_completed', data: customerActionData(properties) };\n case 'schedule':\n return { type: 'appointment_scheduled', data: customerActionData(properties) };\n case 'subscribe':\n return { type: 'subscription_created', data: planEnrollmentData(properties) };\n case 'trial_begin':\n return { type: 'trial_started', data: planEnrollmentData(properties) };\n default: {\n const currency = readCurrency(properties);\n return {\n type: 'custom',\n data: {\n type: 'custom',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(readItems(properties), currency),\n },\n };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6HA,IAAM,0BAA0B,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AACD,IAAM,2BAA2B,oBAAI,IAAI,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,CAAC;AAGnF,SAAS,aAAa,OAAgB,UAAuC;AAClF,MAAI,UAAU,UAAa,UAAU,QAAQ,OAAO,MAAM,KAAK,EAAG,QAAO;AACzE,QAAM,OAAO,qCAAU;AACvB,QAAM,WACJ,QAAQ,wBAAw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W,aAAa,UAAU;AACxC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,QAAQ,aAAa,UAAU,UAAU,GAAG,QAAQ;AAAA,UACpD,UAAU,qCAAU;AAAA,UACpB,UAAU,YAAY,UAAU,UAAU,GAAG,QAAQ;AAAA,QACvD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,110 @@
1
+ import { Item } from './gtag.cjs';
2
+ import { EventName, TrackName, TrackProperties } from './types.cjs';
3
+
4
+ /**
5
+ * Content item shared by `contents` and `plan_enrollment` events.
6
+ * https://developers.openai.com/ads/supported-events
7
+ */
8
+ type ContentItem = {
9
+ id?: string;
10
+ name?: string;
11
+ content_type?: string;
12
+ quantity?: number;
13
+ /** Per-item monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
14
+ amount?: number;
15
+ currency?: string;
16
+ };
17
+ type ContentsData = {
18
+ type: 'contents';
19
+ /** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
20
+ amount?: number;
21
+ currency?: string;
22
+ contents?: ContentItem[];
23
+ };
24
+ type CustomerActionData = {
25
+ type: 'customer_action';
26
+ amount?: number;
27
+ currency?: string;
28
+ };
29
+ type PlanEnrollmentData = {
30
+ type: 'plan_enrollment';
31
+ plan_id?: string;
32
+ amount?: number;
33
+ currency?: string;
34
+ contents?: ContentItem[];
35
+ };
36
+ type CustomEventData = {
37
+ type: 'custom';
38
+ amount?: number;
39
+ currency?: string;
40
+ contents?: ContentItem[];
41
+ };
42
+ type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
43
+ /**
44
+ * Standard event names and the `data` shape each one expects.
45
+ * https://developers.openai.com/ads/supported-events
46
+ */
47
+ type StandardEvents = {
48
+ appointment_scheduled: CustomerActionData;
49
+ checkout_started: ContentsData;
50
+ contents_viewed: ContentsData;
51
+ items_added: ContentsData;
52
+ lead_created: CustomerActionData;
53
+ order_created: ContentsData;
54
+ page_viewed: ContentsData;
55
+ registration_completed: CustomerActionData;
56
+ subscription_created: PlanEnrollmentData;
57
+ trial_started: PlanEnrollmentData;
58
+ };
59
+ type StandardEvent = keyof StandardEvents;
60
+ /**
61
+ * Identity fields passed to `oaiq("init", ...)` for conversion matching. Email and external id
62
+ * must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.
63
+ * https://developers.openai.com/ads/measurement-pixel
64
+ */
65
+ type OAIQUser = {
66
+ email_sha256?: string;
67
+ external_id_sha256?: string;
68
+ /** Two-letter ISO 3166-1 country code (e.g. "US"). */
69
+ country?: string;
70
+ /** Lowercased, max 128 characters. */
71
+ city?: string;
72
+ /** Max 32 characters. */
73
+ zip_code?: string;
74
+ };
75
+ type InitConfig = {
76
+ pixelId: string;
77
+ /** Log SDK activity to the browser console. */
78
+ debug?: boolean;
79
+ user?: OAIQUser;
80
+ };
81
+ /**
82
+ * Fourth argument of `oaiq("measure", ...)`. Required for custom events (carries
83
+ * `custom_event_name`); optional for standard events.
84
+ */
85
+ type MeasureOptions = {
86
+ /** Shared with the Conversions API to deduplicate the same conversion across browser and server. */
87
+ event_id?: string;
88
+ /** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */
89
+ custom_event_name?: string;
90
+ /** When true, opts the event out of user-level personalization. */
91
+ opt_out?: boolean;
92
+ };
93
+ interface OAIQ {
94
+ oaiq(command: 'init', config: InitConfig): void;
95
+ oaiq<T extends StandardEvent>(command: 'measure', event: T, data: StandardEvents[T], options?: MeasureOptions): void;
96
+ oaiq(command: 'measure', event: 'custom', data: CustomEventData, options: MeasureOptions & {
97
+ custom_event_name: string;
98
+ }): void;
99
+ }
100
+ /** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */
101
+ declare function toMinorUnits(value?: number, currency?: string): number | undefined;
102
+ declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
103
+ type MappedOAIEvent = {
104
+ type: StandardEvent | 'custom';
105
+ data: EventData;
106
+ };
107
+ /** Map an internal track event onto an OpenAI standard (or custom) conversion event. */
108
+ declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
109
+
110
+ export { type ContentItem, type ContentsData, type CustomEventData, type CustomerActionData, type EventData, type InitConfig, type MappedOAIEvent, type MeasureOptions, type OAIQ, type OAIQUser, type PlanEnrollmentData, type StandardEvent, type StandardEvents, mapContents, mapOAIEvent, toMinorUnits };
@@ -0,0 +1,110 @@
1
+ import { Item } from './gtag.js';
2
+ import { EventName, TrackName, TrackProperties } from './types.js';
3
+
4
+ /**
5
+ * Content item shared by `contents` and `plan_enrollment` events.
6
+ * https://developers.openai.com/ads/supported-events
7
+ */
8
+ type ContentItem = {
9
+ id?: string;
10
+ name?: string;
11
+ content_type?: string;
12
+ quantity?: number;
13
+ /** Per-item monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
14
+ amount?: number;
15
+ currency?: string;
16
+ };
17
+ type ContentsData = {
18
+ type: 'contents';
19
+ /** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
20
+ amount?: number;
21
+ currency?: string;
22
+ contents?: ContentItem[];
23
+ };
24
+ type CustomerActionData = {
25
+ type: 'customer_action';
26
+ amount?: number;
27
+ currency?: string;
28
+ };
29
+ type PlanEnrollmentData = {
30
+ type: 'plan_enrollment';
31
+ plan_id?: string;
32
+ amount?: number;
33
+ currency?: string;
34
+ contents?: ContentItem[];
35
+ };
36
+ type CustomEventData = {
37
+ type: 'custom';
38
+ amount?: number;
39
+ currency?: string;
40
+ contents?: ContentItem[];
41
+ };
42
+ type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
43
+ /**
44
+ * Standard event names and the `data` shape each one expects.
45
+ * https://developers.openai.com/ads/supported-events
46
+ */
47
+ type StandardEvents = {
48
+ appointment_scheduled: CustomerActionData;
49
+ checkout_started: ContentsData;
50
+ contents_viewed: ContentsData;
51
+ items_added: ContentsData;
52
+ lead_created: CustomerActionData;
53
+ order_created: ContentsData;
54
+ page_viewed: ContentsData;
55
+ registration_completed: CustomerActionData;
56
+ subscription_created: PlanEnrollmentData;
57
+ trial_started: PlanEnrollmentData;
58
+ };
59
+ type StandardEvent = keyof StandardEvents;
60
+ /**
61
+ * Identity fields passed to `oaiq("init", ...)` for conversion matching. Email and external id
62
+ * must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.
63
+ * https://developers.openai.com/ads/measurement-pixel
64
+ */
65
+ type OAIQUser = {
66
+ email_sha256?: string;
67
+ external_id_sha256?: string;
68
+ /** Two-letter ISO 3166-1 country code (e.g. "US"). */
69
+ country?: string;
70
+ /** Lowercased, max 128 characters. */
71
+ city?: string;
72
+ /** Max 32 characters. */
73
+ zip_code?: string;
74
+ };
75
+ type InitConfig = {
76
+ pixelId: string;
77
+ /** Log SDK activity to the browser console. */
78
+ debug?: boolean;
79
+ user?: OAIQUser;
80
+ };
81
+ /**
82
+ * Fourth argument of `oaiq("measure", ...)`. Required for custom events (carries
83
+ * `custom_event_name`); optional for standard events.
84
+ */
85
+ type MeasureOptions = {
86
+ /** Shared with the Conversions API to deduplicate the same conversion across browser and server. */
87
+ event_id?: string;
88
+ /** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */
89
+ custom_event_name?: string;
90
+ /** When true, opts the event out of user-level personalization. */
91
+ opt_out?: boolean;
92
+ };
93
+ interface OAIQ {
94
+ oaiq(command: 'init', config: InitConfig): void;
95
+ oaiq<T extends StandardEvent>(command: 'measure', event: T, data: StandardEvents[T], options?: MeasureOptions): void;
96
+ oaiq(command: 'measure', event: 'custom', data: CustomEventData, options: MeasureOptions & {
97
+ custom_event_name: string;
98
+ }): void;
99
+ }
100
+ /** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */
101
+ declare function toMinorUnits(value?: number, currency?: string): number | undefined;
102
+ declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
103
+ type MappedOAIEvent = {
104
+ type: StandardEvent | 'custom';
105
+ data: EventData;
106
+ };
107
+ /** Map an internal track event onto an OpenAI standard (or custom) conversion event. */
108
+ declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
109
+
110
+ export { type ContentItem, type ContentsData, type CustomEventData, type CustomerActionData, type EventData, type InitConfig, type MappedOAIEvent, type MeasureOptions, type OAIQ, type OAIQUser, type PlanEnrollmentData, type StandardEvent, type StandardEvents, mapContents, mapOAIEvent, toMinorUnits };
@@ -0,0 +1,128 @@
1
+ // src/track/oaiq.ts
2
+ var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
3
+ "BIF",
4
+ "CLP",
5
+ "DJF",
6
+ "GNF",
7
+ "ISK",
8
+ "JPY",
9
+ "KMF",
10
+ "KRW",
11
+ "MGA",
12
+ "PYG",
13
+ "RWF",
14
+ "UGX",
15
+ "VND",
16
+ "VUV",
17
+ "XAF",
18
+ "XOF",
19
+ "XPF"
20
+ ]);
21
+ var THREE_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set(["BHD", "IQD", "JOD", "KWD", "LYD", "OMR", "TND"]);
22
+ function toMinorUnits(value, currency) {
23
+ if (value === void 0 || value === null || Number.isNaN(value)) return void 0;
24
+ const code = currency == null ? void 0 : currency.toUpperCase();
25
+ const exponent = code && ZERO_DECIMAL_CURRENCIES.has(code) ? 0 : code && THREE_DECIMAL_CURRENCIES.has(code) ? 3 : 2;
26
+ return Math.round(value * 10 ** exponent);
27
+ }
28
+ function mapContents(items, currency) {
29
+ if (!items || items.length === 0) return void 0;
30
+ const code = currency == null ? void 0 : currency.toUpperCase();
31
+ return items.map((item) => ({
32
+ id: item.item_id,
33
+ name: item.item_name,
34
+ content_type: item.item_category,
35
+ quantity: item.quantity,
36
+ amount: toMinorUnits(item.price, currency),
37
+ currency: item.price !== void 0 ? code : void 0
38
+ }));
39
+ }
40
+ function prop(properties, key) {
41
+ return typeof properties === "object" && properties !== null ? properties[key] : void 0;
42
+ }
43
+ function readValue(properties) {
44
+ const value = prop(properties, "value");
45
+ return typeof value === "number" ? value : void 0;
46
+ }
47
+ function readCurrency(properties) {
48
+ const currency = prop(properties, "currency");
49
+ return typeof currency === "string" ? currency : void 0;
50
+ }
51
+ function readItems(properties) {
52
+ const items = prop(properties, "items");
53
+ return Array.isArray(items) ? items : void 0;
54
+ }
55
+ function contentsData(properties) {
56
+ const currency = readCurrency(properties);
57
+ return {
58
+ type: "contents",
59
+ amount: toMinorUnits(readValue(properties), currency),
60
+ currency: currency == null ? void 0 : currency.toUpperCase(),
61
+ contents: mapContents(readItems(properties), currency)
62
+ };
63
+ }
64
+ function customerActionData(properties) {
65
+ const currency = readCurrency(properties);
66
+ return {
67
+ type: "customer_action",
68
+ amount: toMinorUnits(readValue(properties), currency),
69
+ currency: currency == null ? void 0 : currency.toUpperCase()
70
+ };
71
+ }
72
+ function planEnrollmentData(properties) {
73
+ var _a;
74
+ const currency = readCurrency(properties);
75
+ const items = readItems(properties);
76
+ return {
77
+ type: "plan_enrollment",
78
+ plan_id: (_a = items == null ? void 0 : items[0]) == null ? void 0 : _a.item_id,
79
+ amount: toMinorUnits(readValue(properties), currency),
80
+ currency: currency == null ? void 0 : currency.toUpperCase(),
81
+ contents: mapContents(items, currency)
82
+ };
83
+ }
84
+ function mapOAIEvent(name, properties) {
85
+ switch (name) {
86
+ case "page_view":
87
+ return { type: "page_viewed", data: contentsData(properties) };
88
+ case "view_item":
89
+ case "view_item_list":
90
+ return { type: "contents_viewed", data: contentsData(properties) };
91
+ case "begin_checkout":
92
+ return { type: "checkout_started", data: contentsData(properties) };
93
+ case "add_to_cart":
94
+ return { type: "items_added", data: contentsData(properties) };
95
+ case "purchase":
96
+ return { type: "order_created", data: contentsData(properties) };
97
+ case "generate_lead":
98
+ case "qualify_lead":
99
+ return { type: "lead_created", data: customerActionData(properties) };
100
+ case "sign_up":
101
+ case "login":
102
+ return { type: "registration_completed", data: customerActionData(properties) };
103
+ case "schedule":
104
+ return { type: "appointment_scheduled", data: customerActionData(properties) };
105
+ case "subscribe":
106
+ return { type: "subscription_created", data: planEnrollmentData(properties) };
107
+ case "trial_begin":
108
+ return { type: "trial_started", data: planEnrollmentData(properties) };
109
+ default: {
110
+ const currency = readCurrency(properties);
111
+ return {
112
+ type: "custom",
113
+ data: {
114
+ type: "custom",
115
+ amount: toMinorUnits(readValue(properties), currency),
116
+ currency: currency == null ? void 0 : currency.toUpperCase(),
117
+ contents: mapContents(readItems(properties), currency)
118
+ }
119
+ };
120
+ }
121
+ }
122
+ }
123
+ export {
124
+ mapContents,
125
+ mapOAIEvent,
126
+ toMinorUnits
127
+ };
128
+ //# sourceMappingURL=oaiq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/track/oaiq.ts"],"sourcesContent":["import type { Item } from './gtag';\nimport type { EventName, TrackName, TrackProperties } from './types';\n\n/**\n * Content item shared by `contents` and `plan_enrollment` events.\n * https://developers.openai.com/ads/supported-events\n */\nexport type ContentItem = {\n id?: string;\n name?: string;\n content_type?: string;\n quantity?: number;\n /** Per-item monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */\n amount?: number;\n currency?: string;\n};\n\nexport type ContentsData = {\n type: 'contents';\n /** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type CustomerActionData = {\n type: 'customer_action';\n amount?: number;\n currency?: string;\n};\n\nexport type PlanEnrollmentData = {\n type: 'plan_enrollment';\n plan_id?: string;\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type CustomEventData = {\n type: 'custom';\n amount?: number;\n currency?: string;\n contents?: ContentItem[];\n};\n\nexport type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;\n\n/**\n * Standard event names and the `data` shape each one expects.\n * https://developers.openai.com/ads/supported-events\n */\nexport type StandardEvents = {\n appointment_scheduled: CustomerActionData;\n checkout_started: ContentsData;\n contents_viewed: ContentsData;\n items_added: ContentsData;\n lead_created: CustomerActionData;\n order_created: ContentsData;\n page_viewed: ContentsData;\n registration_completed: CustomerActionData;\n subscription_created: PlanEnrollmentData;\n trial_started: PlanEnrollmentData;\n};\n\nexport type StandardEvent = keyof StandardEvents;\n\n/**\n * Identity fields passed to `oaiq(\"init\", ...)` for conversion matching. Email and external id\n * must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.\n * https://developers.openai.com/ads/measurement-pixel\n */\nexport type OAIQUser = {\n email_sha256?: string;\n external_id_sha256?: string;\n /** Two-letter ISO 3166-1 country code (e.g. \"US\"). */\n country?: string;\n /** Lowercased, max 128 characters. */\n city?: string;\n /** Max 32 characters. */\n zip_code?: string;\n};\n\nexport type InitConfig = {\n pixelId: string;\n /** Log SDK activity to the browser console. */\n debug?: boolean;\n user?: OAIQUser;\n};\n\n/**\n * Fourth argument of `oaiq(\"measure\", ...)`. Required for custom events (carries\n * `custom_event_name`); optional for standard events.\n */\nexport type MeasureOptions = {\n /** Shared with the Conversions API to deduplicate the same conversion across browser and server. */\n event_id?: string;\n /** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */\n custom_event_name?: string;\n /** When true, opts the event out of user-level personalization. */\n opt_out?: boolean;\n};\n\nexport interface OAIQ {\n oaiq(command: 'init', config: InitConfig): void;\n oaiq<T extends StandardEvent>(\n command: 'measure',\n event: T,\n data: StandardEvents[T],\n options?: MeasureOptions\n ): void;\n oaiq(\n command: 'measure',\n event: 'custom',\n data: CustomEventData,\n options: MeasureOptions & { custom_event_name: string }\n ): void;\n}\n\n/**\n * Currencies whose minor unit has 0 or 3 decimal places; everything else uses 2.\n * Follows Stripe's zero-decimal convention (e.g., MGA is treated as 0, ISK is included),\n * which can differ from strict ISO 4217 exponents.\n * https://docs.stripe.com/currencies#zero-decimal\n */\nconst ZERO_DECIMAL_CURRENCIES = new Set([\n 'BIF',\n 'CLP',\n 'DJF',\n 'GNF',\n 'ISK',\n 'JPY',\n 'KMF',\n 'KRW',\n 'MGA',\n 'PYG',\n 'RWF',\n 'UGX',\n 'VND',\n 'VUV',\n 'XAF',\n 'XOF',\n 'XPF',\n]);\nconst THREE_DECIMAL_CURRENCIES = new Set(['BHD', 'IQD', 'JOD', 'KWD', 'LYD', 'OMR', 'TND']);\n\n/** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */\nexport function toMinorUnits(value?: number, currency?: string): number | undefined {\n if (value === undefined || value === null || Number.isNaN(value)) return undefined;\n const code = currency?.toUpperCase();\n const exponent =\n code && ZERO_DECIMAL_CURRENCIES.has(code)\n ? 0\n : code && THREE_DECIMAL_CURRENCIES.has(code)\n ? 3\n : 2;\n return Math.round(value * 10 ** exponent);\n}\n\nexport function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined {\n if (!items || items.length === 0) return undefined;\n const code = currency?.toUpperCase();\n return items.map((item) => ({\n id: item.item_id,\n name: item.item_name,\n content_type: item.item_category,\n quantity: item.quantity,\n amount: toMinorUnits(item.price, currency),\n currency: item.price !== undefined ? code : undefined,\n }));\n}\n\n/** Safely read a property off loosely typed track properties without widening to `any`. */\nfunction prop(properties: unknown, key: string): unknown {\n return typeof properties === 'object' && properties !== null\n ? (properties as Record<string, unknown>)[key]\n : undefined;\n}\n\nfunction readValue(properties: unknown): number | undefined {\n const value = prop(properties, 'value');\n return typeof value === 'number' ? value : undefined;\n}\n\nfunction readCurrency(properties: unknown): string | undefined {\n const currency = prop(properties, 'currency');\n return typeof currency === 'string' ? currency : undefined;\n}\n\nfunction readItems(properties: unknown): Item[] | undefined {\n const items = prop(properties, 'items');\n return Array.isArray(items) ? (items as Item[]) : undefined;\n}\n\nfunction contentsData(properties: unknown): ContentsData {\n const currency = readCurrency(properties);\n return {\n type: 'contents',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(readItems(properties), currency),\n };\n}\n\nfunction customerActionData(properties: unknown): CustomerActionData {\n const currency = readCurrency(properties);\n return {\n type: 'customer_action',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n };\n}\n\nfunction planEnrollmentData(properties: unknown): PlanEnrollmentData {\n const currency = readCurrency(properties);\n const items = readItems(properties);\n return {\n type: 'plan_enrollment',\n plan_id: items?.[0]?.item_id,\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(items, currency),\n };\n}\n\nexport type MappedOAIEvent = {\n type: StandardEvent | 'custom';\n data: EventData;\n};\n\n/** Map an internal track event onto an OpenAI standard (or custom) conversion event. */\nexport function mapOAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n): MappedOAIEvent {\n switch (name) {\n case 'page_view':\n return { type: 'page_viewed', data: contentsData(properties) };\n case 'view_item':\n case 'view_item_list':\n return { type: 'contents_viewed', data: contentsData(properties) };\n case 'begin_checkout':\n return { type: 'checkout_started', data: contentsData(properties) };\n case 'add_to_cart':\n return { type: 'items_added', data: contentsData(properties) };\n case 'purchase':\n return { type: 'order_created', data: contentsData(properties) };\n case 'generate_lead':\n case 'qualify_lead':\n return { type: 'lead_created', data: customerActionData(properties) };\n case 'sign_up':\n case 'login':\n return { type: 'registration_completed', data: customerActionData(properties) };\n case 'schedule':\n return { type: 'appointment_scheduled', data: customerActionData(properties) };\n case 'subscribe':\n return { type: 'subscription_created', data: planEnrollmentData(properties) };\n case 'trial_begin':\n return { type: 'trial_started', data: planEnrollmentData(properties) };\n default: {\n const currency = readCurrency(properties);\n return {\n type: 'custom',\n data: {\n type: 'custom',\n amount: toMinorUnits(readValue(properties), currency),\n currency: currency?.toUpperCase(),\n contents: mapContents(readItems(properties), currency),\n },\n };\n }\n }\n}\n"],"mappings":";AA6HA,IAAM,0BAA0B,oBAAI,IAAI;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AAA,IACtE,KAAK;AAAA,IACL,KAAK;AACH,aAAO,EAAE,MAAM,0BAA0B,MAAM,mBAAmB,UAAU,EAAE;AAAA,IAChF,KAAK;AACH,aAAO,EAAE,MAAM,yBAAyB,MAAM,mBAAmB,UAAU,EAAE;AAAA,IAC/E,KAAK;AACH,aAAO,EAAE,MAAM,wBAAwB,MAAM,mBAAmB,UAAU,EAAE;AAAA,IAC9E,KAAK;AACH,aAAO,EAAE,MAAM,iBAAiB,MAAM,mBAAmB,UAAU,EAAE;AAAA,IACvE,SAAS;AACP,YAAM,WAAW,aAAa,UAAU;AACxC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,QAAQ,aAAa,UAAU,UAAU,GAAG,QAAQ;AAAA,UACpD,UAAU,qCAAU;AAAA,UACpB,UAAU,YAAY,UAAU,UAAU,GAAG,QAAQ;AAAA,QACvD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shware/analytics",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -73,31 +73,31 @@
73
73
  "uuid": "^14.0.0",
74
74
  "web-vitals": "^5.2.0",
75
75
  "zod": "^4.4.3",
76
- "@shware/utils": "^1.4.1"
76
+ "@shware/utils": "^1.4.3"
77
77
  },
78
78
  "devDependencies": {
79
- "@types/facebook-nodejs-business-sdk": "^23",
79
+ "@types/facebook-nodejs-business-sdk": "^24",
80
80
  "@types/node": "^25",
81
81
  "@types/react": "^19",
82
82
  "typescript": "^6.0.3",
83
- "vitest": "^4.1.5",
83
+ "vitest": "^4.1.7",
84
84
  "@repo/typescript-config": "0.0.0"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@react-native-firebase/analytics": "^24.0.0",
88
- "@tanstack/react-router": "^1.169.1",
89
- "expo-application": "^55.0.14",
90
- "expo-clipboard": "^55.0.13",
91
- "expo-crypto": "^55.0.14",
92
- "expo-device": "^55.0.15",
93
- "expo-localization": "^55.0.13",
94
- "expo-sqlite": "^55.0.15",
95
- "expo-tracking-transparency": "^55.0.13",
88
+ "@tanstack/react-router": "^1.170.8",
89
+ "expo-application": "^56.0.3",
90
+ "expo-clipboard": "^56.0.3",
91
+ "expo-crypto": "^56.0.4",
92
+ "expo-device": "^56.0.4",
93
+ "expo-localization": "^56.0.6",
94
+ "expo-sqlite": "^56.0.4",
95
+ "expo-tracking-transparency": "^56.0.5",
96
96
  "facebook-nodejs-business-sdk": "^24",
97
97
  "next": "^16",
98
- "posthog-js": "^1.372.6",
98
+ "posthog-js": "^1.376.2",
99
99
  "react": "^19",
100
- "react-native": "^0.83.0",
100
+ "react-native": "^0.85.3",
101
101
  "react-native-fbsdk-next": "^13.4.3",
102
102
  "react-native-url-polyfill": "^3",
103
103
  "react-router": "^7"