@proveanything/smartlinks 1.7.9 → 1.8.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.
@@ -0,0 +1,307 @@
1
+ /**
2
+ * Collection analytics types.
3
+ *
4
+ * Separate from the `interactions` namespace. These types cover generic web
5
+ * analytics, click tracking, and tag scan analytics for collection dashboards.
6
+ */
7
+ export type AnalyticsSource = 'events' | 'tag';
8
+ export type AnalyticsEventType = string;
9
+ export type AnalyticsGranularity = 'hour' | 'day' | 'week' | 'month';
10
+ export type AnalyticsMetric = 'count' | 'uniqueSessions' | 'uniqueVisitors';
11
+ export type AnalyticsSortOrder = 'asc' | 'desc';
12
+ export type AnalyticsDeviceType = 'mobile' | 'tablet' | 'desktop' | 'unknown';
13
+ export type AnalyticsStorageMode = 'local' | 'session' | false;
14
+ export interface AnalyticsLocation {
15
+ country?: string;
16
+ latitude?: number;
17
+ longitude?: number;
18
+ area?: number;
19
+ [key: string]: any;
20
+ }
21
+ export interface AnalyticsStandardMetadataFields {
22
+ visitorId?: string;
23
+ referrer?: string;
24
+ referrerHost?: string;
25
+ utmSource?: string;
26
+ utmMedium?: string;
27
+ utmCampaign?: string;
28
+ utmContent?: string;
29
+ utmTerm?: string;
30
+ entryType?: string;
31
+ group?: string;
32
+ tag?: string;
33
+ campaign?: string;
34
+ placement?: string;
35
+ linkGroup?: string;
36
+ linkPlacement?: string;
37
+ linkPosition?: string | number;
38
+ linkTitle?: string;
39
+ destinationDomain?: string;
40
+ pagePath?: string;
41
+ pageId?: string;
42
+ qrCodeId?: string;
43
+ scanMethod?: string;
44
+ }
45
+ export interface CollectionAnalyticsEvent extends AnalyticsStandardMetadataFields {
46
+ sessionId?: string;
47
+ eventType: AnalyticsEventType;
48
+ collectionId: string;
49
+ productId?: string;
50
+ proofId?: string;
51
+ batchId?: string;
52
+ variantId?: string;
53
+ appId?: string;
54
+ destinationAppId?: string;
55
+ linkId?: string;
56
+ deviceType?: string;
57
+ href?: string;
58
+ path?: string;
59
+ isExternal?: boolean;
60
+ location?: AnalyticsLocation;
61
+ metadata?: Record<string, any>;
62
+ }
63
+ export interface TagAnalyticsEvent extends AnalyticsStandardMetadataFields {
64
+ sessionId?: string;
65
+ eventType: AnalyticsEventType;
66
+ collectionId: string;
67
+ productId?: string;
68
+ proofId?: string;
69
+ batchId?: string;
70
+ variantId?: string;
71
+ codeId?: string;
72
+ claimId?: string;
73
+ deviceType?: string;
74
+ path?: string;
75
+ location?: AnalyticsLocation;
76
+ isAdmin?: boolean;
77
+ metadata?: Record<string, any>;
78
+ }
79
+ export interface AnalyticsTrackOptions {
80
+ preferBeacon?: boolean;
81
+ }
82
+ export interface AnalyticsBrowserConfig {
83
+ sessionStorageKey?: string;
84
+ sessionIdFactory?: () => string;
85
+ visitorId?: string;
86
+ visitorStorage?: AnalyticsStorageMode;
87
+ visitorStorageKey?: string;
88
+ visitorIdFactory?: () => string;
89
+ autoCaptureCampaignParams?: boolean;
90
+ campaignParamMap?: Partial<Record<keyof AnalyticsStandardMetadataFields, string | string[]>>;
91
+ defaultCollectionEvent?: Partial<CollectionAnalyticsEvent>;
92
+ defaultTagEvent?: Partial<TagAnalyticsEvent>;
93
+ getCollectionDefaults?: () => Partial<CollectionAnalyticsEvent> | undefined;
94
+ getTagDefaults?: () => Partial<TagAnalyticsEvent> | undefined;
95
+ getLocation?: () => AnalyticsLocation | null | undefined;
96
+ }
97
+ export interface AnalyticsGeolocationCaptureOptions extends PositionOptions {
98
+ includeCoordinates?: boolean;
99
+ includeAccuracyArea?: boolean;
100
+ }
101
+ export interface AnalyticsLinkClickInput extends Partial<CollectionAnalyticsEvent> {
102
+ href: string;
103
+ linkId?: string;
104
+ destinationAppId?: string;
105
+ path?: string;
106
+ isExternal?: boolean;
107
+ linkTitle?: string;
108
+ }
109
+ export interface AnalyticsVisitorIdOptions {
110
+ persist?: boolean;
111
+ storage?: AnalyticsStorageMode;
112
+ storageKey?: string;
113
+ }
114
+ export interface AnalyticsPageViewBindingOptions {
115
+ trackInitialPageView?: boolean;
116
+ includeHashChanges?: boolean;
117
+ event?: Partial<CollectionAnalyticsEvent>;
118
+ trackOptions?: AnalyticsTrackOptions;
119
+ getEvent?: (path: string) => Partial<CollectionAnalyticsEvent> | null | undefined;
120
+ }
121
+ export interface AnalyticsLinkBindingOptions {
122
+ root?: Document | HTMLElement;
123
+ selector?: string;
124
+ trackInternal?: boolean;
125
+ event?: Partial<CollectionAnalyticsEvent>;
126
+ trackOptions?: AnalyticsTrackOptions;
127
+ getEvent?: (anchor: HTMLAnchorElement, event: MouseEvent) => Partial<CollectionAnalyticsEvent> | null | undefined;
128
+ }
129
+ export interface AnalyticsClassicReportRequest extends AnalyticsFilterRequest {
130
+ metric?: AnalyticsMetric;
131
+ limit?: number;
132
+ }
133
+ export interface AnalyticsTrackResult {
134
+ queued: boolean;
135
+ transport: 'beacon' | 'fetch' | 'unavailable';
136
+ }
137
+ export interface AnalyticsFilterRequest {
138
+ source?: AnalyticsSource;
139
+ from?: string;
140
+ to?: string;
141
+ eventType?: string;
142
+ eventTypes?: string[];
143
+ productId?: string;
144
+ productIds?: string[];
145
+ proofId?: string;
146
+ proofIds?: string[];
147
+ batchId?: string;
148
+ batchIds?: string[];
149
+ variantId?: string;
150
+ variantIds?: string[];
151
+ sessionId?: string;
152
+ sessionIds?: string[];
153
+ country?: string;
154
+ countries?: string[];
155
+ metadata?: Record<string, any>;
156
+ appId?: string;
157
+ appIds?: string[];
158
+ destinationAppId?: string;
159
+ destinationAppIds?: string[];
160
+ linkId?: string;
161
+ linkIds?: string[];
162
+ href?: string;
163
+ path?: string;
164
+ hrefContains?: string;
165
+ pathContains?: string;
166
+ isExternal?: boolean;
167
+ codeId?: string;
168
+ codeIds?: string[];
169
+ claimId?: string;
170
+ claimIds?: string[];
171
+ isAdmin?: boolean;
172
+ hasLocation?: boolean;
173
+ }
174
+ export interface AnalyticsSummaryRequest extends AnalyticsFilterRequest {
175
+ source: AnalyticsSource;
176
+ }
177
+ export interface AnalyticsSummaryData {
178
+ totalEvents?: number;
179
+ uniqueSessions?: number;
180
+ uniqueVisitors?: number;
181
+ uniqueCountries?: number;
182
+ uniqueLinks?: number;
183
+ externalEvents?: number;
184
+ internalEvents?: number;
185
+ firstEventAt?: string | null;
186
+ lastEventAt?: string | null;
187
+ uniqueCodes?: number;
188
+ uniqueClaims?: number;
189
+ adminEvents?: number;
190
+ customerEvents?: number;
191
+ locationEvents?: number;
192
+ [key: string]: any;
193
+ }
194
+ export interface AnalyticsSummaryResponse {
195
+ source: AnalyticsSource;
196
+ summary: AnalyticsSummaryData;
197
+ }
198
+ export interface AnalyticsTimeseriesRequest extends AnalyticsFilterRequest {
199
+ source: AnalyticsSource;
200
+ granularity: AnalyticsGranularity;
201
+ metric: AnalyticsMetric;
202
+ }
203
+ export interface AnalyticsTimeseriesRow {
204
+ period: string;
205
+ count: number;
206
+ uniqueSessions?: number;
207
+ uniqueVisitors?: number;
208
+ value: number;
209
+ [key: string]: any;
210
+ }
211
+ export interface AnalyticsTimeseriesResponse {
212
+ source: AnalyticsSource;
213
+ granularity: AnalyticsGranularity;
214
+ metric: AnalyticsMetric;
215
+ rows: AnalyticsTimeseriesRow[];
216
+ }
217
+ export type EventAnalyticsDimension = 'eventType' | 'country' | 'linkId' | 'href' | 'path' | 'appId' | 'destinationAppId' | 'deviceType' | 'isExternal' | 'productId' | 'proofId' | 'batchId' | 'variantId' | 'sessionId' | 'metadata';
218
+ export type TagAnalyticsDimension = 'eventType' | 'country' | 'codeId' | 'claimId' | 'proofId' | 'productId' | 'batchId' | 'variantId' | 'deviceType' | 'sessionId' | 'isAdmin' | 'location' | 'metadata';
219
+ export interface AnalyticsBreakdownRequest extends AnalyticsFilterRequest {
220
+ source: AnalyticsSource;
221
+ dimension: EventAnalyticsDimension | TagAnalyticsDimension;
222
+ metric?: AnalyticsMetric;
223
+ metadataKey?: string;
224
+ limit?: number;
225
+ }
226
+ export interface AnalyticsBreakdownRow {
227
+ dimensionValue: string | number | boolean | null;
228
+ count: number;
229
+ uniqueSessions?: number;
230
+ uniqueVisitors?: number;
231
+ value: number;
232
+ [key: string]: any;
233
+ }
234
+ export interface AnalyticsBreakdownResponse {
235
+ source: AnalyticsSource;
236
+ dimension: string;
237
+ metric: AnalyticsMetric;
238
+ rows: AnalyticsBreakdownRow[];
239
+ }
240
+ export interface AnalyticsEventsRequest extends AnalyticsFilterRequest {
241
+ source: AnalyticsSource;
242
+ limit?: number;
243
+ offset?: number;
244
+ sort?: AnalyticsSortOrder;
245
+ }
246
+ export interface AnalyticsEventsResponse {
247
+ source: AnalyticsSource;
248
+ limit: number;
249
+ offset: number;
250
+ sort: 'ASC' | 'DESC';
251
+ count: number;
252
+ rows: Array<Record<string, any>>;
253
+ }
254
+ export interface LegacyAnalyticsRequest {
255
+ collection?: string;
256
+ collectionId?: string;
257
+ productId?: string;
258
+ appId?: string;
259
+ startDate?: string;
260
+ endDate?: string;
261
+ location?: string;
262
+ tagId?: string;
263
+ qrCodeUrl?: string;
264
+ [key: string]: any;
265
+ }
266
+ export interface AnalyticsDashboardMetrics {
267
+ [key: string]: string | number | null;
268
+ }
269
+ export interface AnalyticsDashboardCharts {
270
+ [key: string]: any[];
271
+ }
272
+ export interface AnalyticsDashboardResponse {
273
+ metrics: AnalyticsDashboardMetrics;
274
+ charts: AnalyticsDashboardCharts;
275
+ locationData: any[];
276
+ }
277
+ export interface AnalyticsProductsRow {
278
+ productId: string;
279
+ totalEvents: number;
280
+ }
281
+ export interface AnalyticsProductsResponse {
282
+ products: string[];
283
+ rows: AnalyticsProductsRow[];
284
+ }
285
+ export interface AnalyticsQrCodeRow {
286
+ href: string;
287
+ visits: number;
288
+ displayName: string;
289
+ code: string;
290
+ }
291
+ export type AnalyticsQrCodesResponse = AnalyticsQrCodeRow[];
292
+ export interface AnalyticsTagRow {
293
+ tagId: string;
294
+ claimId: string;
295
+ codeId: string;
296
+ displayName: string;
297
+ scans: number;
298
+ activeDays: number;
299
+ }
300
+ export interface AnalyticsTagsResponse {
301
+ tags: AnalyticsTagRow[];
302
+ }
303
+ export interface AnalyticsWeeklyRequest extends LegacyAnalyticsRequest {
304
+ group?: 'count' | 'unique';
305
+ }
306
+ export interface AnalyticsCountryRequest extends LegacyAnalyticsRequest {
307
+ }
@@ -1,3 +1,9 @@
1
- "use strict";
2
1
  // Deprecated: types moved to ./actions.ts and ./broadcasts.ts
3
2
  // This file is intentionally left empty to avoid duplicate exports.
3
+ /**
4
+ * Collection analytics types.
5
+ *
6
+ * Separate from the `interactions` namespace. These types cover generic web
7
+ * analytics, click tracking, and tag scan analytics for collection dashboards.
8
+ */
9
+ export {};
@@ -14,3 +14,70 @@ export interface UserAccountRegistrationRequest {
14
14
  /** Desired token type returned */
15
15
  tokenType?: 'bearer' | 'firebase';
16
16
  }
17
+ export interface AuthLocation {
18
+ latitude?: number;
19
+ longitude?: number;
20
+ area?: number;
21
+ country?: string;
22
+ [key: string]: any;
23
+ }
24
+ export interface AuthLocationCacheOptions {
25
+ cache?: 'session' | false;
26
+ ttlMs?: number;
27
+ storageKey?: string;
28
+ forceRefresh?: boolean;
29
+ }
30
+ export interface AccountFirebaseInfo {
31
+ identities?: Record<string, string[]>;
32
+ sign_in_provider?: string;
33
+ [key: string]: any;
34
+ }
35
+ export interface AccountClientInfo {
36
+ createdAt?: string;
37
+ createdVia?: string;
38
+ [key: string]: any;
39
+ }
40
+ export interface AccountFeatureFlags {
41
+ actionLogger?: boolean;
42
+ apiKeys?: boolean;
43
+ analytics?: boolean;
44
+ webhooks?: boolean;
45
+ creating?: boolean;
46
+ helpDocs?: boolean;
47
+ certificateTemplates?: boolean;
48
+ contentLibrary?: boolean;
49
+ devScanner?: boolean;
50
+ appScanner?: boolean;
51
+ [key: string]: boolean | undefined;
52
+ }
53
+ export interface AccountInfoResponse {
54
+ id: string;
55
+ uid: string;
56
+ userId: string;
57
+ user_id?: string;
58
+ sub: string;
59
+ name: string;
60
+ email: string;
61
+ email_verified: boolean;
62
+ picture?: string | null;
63
+ iss: string;
64
+ aud?: string;
65
+ auth_time: number;
66
+ iat: number;
67
+ exp?: number;
68
+ firebase?: AccountFirebaseInfo;
69
+ accessType?: string;
70
+ clientType?: string;
71
+ analyticsCode?: string;
72
+ analyticsId?: string;
73
+ baseCollectionId?: string;
74
+ collectionGroup?: string;
75
+ contactId?: string;
76
+ features: AccountFeatureFlags;
77
+ adminCollections?: string[];
78
+ clients?: Record<string, AccountClientInfo>;
79
+ sites?: Record<string, boolean>;
80
+ whitelabel?: Record<string, any>;
81
+ location?: AuthLocation | null;
82
+ [key: string]: any;
83
+ }
@@ -19,6 +19,7 @@ export * from "./journeysAnalytics";
19
19
  export * from "./qr";
20
20
  export * from "./template";
21
21
  export * from "./interaction";
22
+ export * from "./analytics";
22
23
  export * from "./location";
23
24
  export * from "./jobs";
24
25
  export * from "./realtime";
@@ -21,6 +21,7 @@ export * from "./journeysAnalytics";
21
21
  export * from "./qr";
22
22
  export * from "./template";
23
23
  export * from "./interaction";
24
+ export * from "./analytics";
24
25
  export * from "./location";
25
26
  export * from "./jobs";
26
27
  export * from "./realtime";
@@ -175,38 +175,35 @@ export interface GetOrderItemsResponse {
175
175
  limit: number;
176
176
  offset: number;
177
177
  }
178
- /**
179
- * Item-level filters for advanced order querying.
180
- * Batch and variant identifiers are only meaningful within a product.
181
- */
182
- export interface QueryOrderItemFilter {
183
- productId: string;
184
- batchId?: string;
185
- variantId?: string;
186
- }
187
- /**
188
- * Order-level and item-level filters for advanced order querying.
189
- */
190
- export interface QueryOrdersFilter {
191
- status?: string;
192
- orderRef?: string;
193
- customerId?: string;
194
- createdAfter?: string;
195
- createdBefore?: string;
196
- updatedAfter?: string;
197
- updatedBefore?: string;
198
- minItemCount?: number;
199
- maxItemCount?: number;
200
- metadata?: Record<string, any>;
201
- item?: QueryOrderItemFilter;
202
- sortBy?: string;
203
- sortOrder?: 'asc' | 'desc';
204
- }
205
178
  /**
206
179
  * Request for advanced order querying.
207
180
  */
208
181
  export interface QueryOrdersRequest {
209
- query?: QueryOrdersFilter;
182
+ query?: {
183
+ status?: string;
184
+ orderRef?: string;
185
+ customerId?: string;
186
+ createdAfter?: string;
187
+ createdBefore?: string;
188
+ updatedAfter?: string;
189
+ updatedBefore?: string;
190
+ minItemCount?: number;
191
+ maxItemCount?: number;
192
+ productId?: string;
193
+ batchId?: string;
194
+ variantId?: string;
195
+ itemType?: 'tag' | 'proof' | 'serial';
196
+ itemId?: string;
197
+ itemCollectionId?: string;
198
+ itemMetadata?: Record<string, any>;
199
+ items?: Array<{
200
+ itemType: 'tag' | 'proof' | 'serial';
201
+ itemId: string;
202
+ }>;
203
+ metadata?: Record<string, any>;
204
+ sortBy?: string;
205
+ sortOrder?: 'asc' | 'desc';
206
+ };
210
207
  limit?: number;
211
208
  offset?: number;
212
209
  includeItems?: boolean;