@proveanything/smartlinks 1.7.10 → 1.8.1

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,308 @@
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 type AnalyticsSessionId = number;
15
+ export interface AnalyticsLocation {
16
+ country?: string;
17
+ latitude?: number;
18
+ longitude?: number;
19
+ area?: number;
20
+ [key: string]: any;
21
+ }
22
+ export interface AnalyticsStandardEventFields {
23
+ visitorId?: string;
24
+ referrer?: string;
25
+ referrerHost?: string;
26
+ utmSource?: string;
27
+ utmMedium?: string;
28
+ utmCampaign?: string;
29
+ utmContent?: string;
30
+ utmTerm?: string;
31
+ entryType?: string;
32
+ group?: string;
33
+ tag?: string;
34
+ campaign?: string;
35
+ placement?: string;
36
+ linkGroup?: string;
37
+ linkPlacement?: string;
38
+ linkPosition?: string | number;
39
+ linkTitle?: string;
40
+ destinationDomain?: string;
41
+ pagePath?: string;
42
+ pageId?: string;
43
+ qrCodeId?: string;
44
+ scanMethod?: string;
45
+ }
46
+ export interface CollectionAnalyticsEvent extends AnalyticsStandardEventFields {
47
+ sessionId?: AnalyticsSessionId;
48
+ eventType: AnalyticsEventType;
49
+ collectionId: string;
50
+ productId?: string;
51
+ proofId?: string;
52
+ batchId?: string;
53
+ variantId?: string;
54
+ appId?: string;
55
+ destinationAppId?: string;
56
+ linkId?: string;
57
+ deviceType?: string;
58
+ href?: string;
59
+ path?: string;
60
+ isExternal?: boolean;
61
+ location?: AnalyticsLocation;
62
+ metadata?: Record<string, any>;
63
+ }
64
+ export interface TagAnalyticsEvent extends AnalyticsStandardEventFields {
65
+ sessionId?: AnalyticsSessionId;
66
+ eventType: AnalyticsEventType;
67
+ collectionId: string;
68
+ productId?: string;
69
+ proofId?: string;
70
+ batchId?: string;
71
+ variantId?: string;
72
+ codeId?: string;
73
+ claimId?: string;
74
+ deviceType?: string;
75
+ path?: string;
76
+ location?: AnalyticsLocation;
77
+ isAdmin?: boolean;
78
+ metadata?: Record<string, any>;
79
+ }
80
+ export interface AnalyticsTrackOptions {
81
+ preferBeacon?: boolean;
82
+ }
83
+ export interface AnalyticsBrowserConfig {
84
+ sessionStorageKey?: string;
85
+ sessionIdFactory?: () => AnalyticsSessionId;
86
+ visitorId?: string;
87
+ visitorStorage?: AnalyticsStorageMode;
88
+ visitorStorageKey?: string;
89
+ visitorIdFactory?: () => string;
90
+ autoCaptureCampaignParams?: boolean;
91
+ campaignParamMap?: Partial<Record<keyof AnalyticsStandardEventFields, string | string[]>>;
92
+ defaultCollectionEvent?: Partial<CollectionAnalyticsEvent>;
93
+ defaultTagEvent?: Partial<TagAnalyticsEvent>;
94
+ getCollectionDefaults?: () => Partial<CollectionAnalyticsEvent> | undefined;
95
+ getTagDefaults?: () => Partial<TagAnalyticsEvent> | undefined;
96
+ getLocation?: () => AnalyticsLocation | null | undefined;
97
+ }
98
+ export interface AnalyticsGeolocationCaptureOptions extends PositionOptions {
99
+ includeCoordinates?: boolean;
100
+ includeAccuracyArea?: boolean;
101
+ }
102
+ export interface AnalyticsLinkClickInput extends Partial<CollectionAnalyticsEvent> {
103
+ href: string;
104
+ linkId?: string;
105
+ destinationAppId?: string;
106
+ path?: string;
107
+ isExternal?: boolean;
108
+ linkTitle?: string;
109
+ }
110
+ export interface AnalyticsVisitorIdOptions {
111
+ persist?: boolean;
112
+ storage?: AnalyticsStorageMode;
113
+ storageKey?: string;
114
+ }
115
+ export interface AnalyticsPageViewBindingOptions {
116
+ trackInitialPageView?: boolean;
117
+ includeHashChanges?: boolean;
118
+ event?: Partial<CollectionAnalyticsEvent>;
119
+ trackOptions?: AnalyticsTrackOptions;
120
+ getEvent?: (path: string) => Partial<CollectionAnalyticsEvent> | null | undefined;
121
+ }
122
+ export interface AnalyticsLinkBindingOptions {
123
+ root?: Document | HTMLElement;
124
+ selector?: string;
125
+ trackInternal?: boolean;
126
+ event?: Partial<CollectionAnalyticsEvent>;
127
+ trackOptions?: AnalyticsTrackOptions;
128
+ getEvent?: (anchor: HTMLAnchorElement, event: MouseEvent) => Partial<CollectionAnalyticsEvent> | null | undefined;
129
+ }
130
+ export interface AnalyticsClassicReportRequest extends AnalyticsFilterRequest {
131
+ metric?: AnalyticsMetric;
132
+ limit?: number;
133
+ }
134
+ export interface AnalyticsTrackResult {
135
+ queued: boolean;
136
+ transport: 'beacon' | 'fetch' | 'unavailable';
137
+ }
138
+ export interface AnalyticsFilterRequest {
139
+ source?: AnalyticsSource;
140
+ from?: string;
141
+ to?: string;
142
+ eventType?: string;
143
+ eventTypes?: string[];
144
+ productId?: string;
145
+ productIds?: string[];
146
+ proofId?: string;
147
+ proofIds?: string[];
148
+ batchId?: string;
149
+ batchIds?: string[];
150
+ variantId?: string;
151
+ variantIds?: string[];
152
+ sessionId?: AnalyticsSessionId;
153
+ sessionIds?: AnalyticsSessionId[];
154
+ country?: string;
155
+ countries?: string[];
156
+ metadata?: Record<string, any>;
157
+ appId?: string;
158
+ appIds?: string[];
159
+ destinationAppId?: string;
160
+ destinationAppIds?: string[];
161
+ linkId?: string;
162
+ linkIds?: string[];
163
+ href?: string;
164
+ path?: string;
165
+ hrefContains?: string;
166
+ pathContains?: string;
167
+ isExternal?: boolean;
168
+ codeId?: string;
169
+ codeIds?: string[];
170
+ claimId?: string;
171
+ claimIds?: string[];
172
+ isAdmin?: boolean;
173
+ hasLocation?: boolean;
174
+ }
175
+ export interface AnalyticsSummaryRequest extends AnalyticsFilterRequest {
176
+ source: AnalyticsSource;
177
+ }
178
+ export interface AnalyticsSummaryData {
179
+ totalEvents?: number;
180
+ uniqueSessions?: number;
181
+ uniqueVisitors?: number;
182
+ uniqueCountries?: number;
183
+ uniqueLinks?: number;
184
+ externalEvents?: number;
185
+ internalEvents?: number;
186
+ firstEventAt?: string | null;
187
+ lastEventAt?: string | null;
188
+ uniqueCodes?: number;
189
+ uniqueClaims?: number;
190
+ adminEvents?: number;
191
+ customerEvents?: number;
192
+ locationEvents?: number;
193
+ [key: string]: any;
194
+ }
195
+ export interface AnalyticsSummaryResponse {
196
+ source: AnalyticsSource;
197
+ summary: AnalyticsSummaryData;
198
+ }
199
+ export interface AnalyticsTimeseriesRequest extends AnalyticsFilterRequest {
200
+ source: AnalyticsSource;
201
+ granularity: AnalyticsGranularity;
202
+ metric: AnalyticsMetric;
203
+ }
204
+ export interface AnalyticsTimeseriesRow {
205
+ period: string;
206
+ count: number;
207
+ uniqueSessions?: number;
208
+ uniqueVisitors?: number;
209
+ value: number;
210
+ [key: string]: any;
211
+ }
212
+ export interface AnalyticsTimeseriesResponse {
213
+ source: AnalyticsSource;
214
+ granularity: AnalyticsGranularity;
215
+ metric: AnalyticsMetric;
216
+ rows: AnalyticsTimeseriesRow[];
217
+ }
218
+ export type EventAnalyticsDimension = 'eventType' | 'country' | 'linkId' | 'href' | 'path' | 'appId' | 'destinationAppId' | 'deviceType' | 'isExternal' | 'productId' | 'proofId' | 'batchId' | 'variantId' | 'sessionId' | 'metadata';
219
+ export type TagAnalyticsDimension = 'eventType' | 'country' | 'codeId' | 'claimId' | 'proofId' | 'productId' | 'batchId' | 'variantId' | 'deviceType' | 'sessionId' | 'isAdmin' | 'location' | 'metadata';
220
+ export interface AnalyticsBreakdownRequest extends AnalyticsFilterRequest {
221
+ source: AnalyticsSource;
222
+ dimension: EventAnalyticsDimension | TagAnalyticsDimension;
223
+ metric?: AnalyticsMetric;
224
+ metadataKey?: string;
225
+ limit?: number;
226
+ }
227
+ export interface AnalyticsBreakdownRow {
228
+ dimensionValue: string | number | boolean | null;
229
+ count: number;
230
+ uniqueSessions?: number;
231
+ uniqueVisitors?: number;
232
+ value: number;
233
+ [key: string]: any;
234
+ }
235
+ export interface AnalyticsBreakdownResponse {
236
+ source: AnalyticsSource;
237
+ dimension: string;
238
+ metric: AnalyticsMetric;
239
+ rows: AnalyticsBreakdownRow[];
240
+ }
241
+ export interface AnalyticsEventsRequest extends AnalyticsFilterRequest {
242
+ source: AnalyticsSource;
243
+ limit?: number;
244
+ offset?: number;
245
+ sort?: AnalyticsSortOrder;
246
+ }
247
+ export interface AnalyticsEventsResponse {
248
+ source: AnalyticsSource;
249
+ limit: number;
250
+ offset: number;
251
+ sort: 'ASC' | 'DESC';
252
+ count: number;
253
+ rows: Array<Record<string, any>>;
254
+ }
255
+ export interface LegacyAnalyticsRequest {
256
+ collection?: string;
257
+ collectionId?: string;
258
+ productId?: string;
259
+ appId?: string;
260
+ startDate?: string;
261
+ endDate?: string;
262
+ location?: string;
263
+ tagId?: string;
264
+ qrCodeUrl?: string;
265
+ [key: string]: any;
266
+ }
267
+ export interface AnalyticsDashboardMetrics {
268
+ [key: string]: string | number | null;
269
+ }
270
+ export interface AnalyticsDashboardCharts {
271
+ [key: string]: any[];
272
+ }
273
+ export interface AnalyticsDashboardResponse {
274
+ metrics: AnalyticsDashboardMetrics;
275
+ charts: AnalyticsDashboardCharts;
276
+ locationData: any[];
277
+ }
278
+ export interface AnalyticsProductsRow {
279
+ productId: string;
280
+ totalEvents: number;
281
+ }
282
+ export interface AnalyticsProductsResponse {
283
+ products: string[];
284
+ rows: AnalyticsProductsRow[];
285
+ }
286
+ export interface AnalyticsQrCodeRow {
287
+ href: string;
288
+ visits: number;
289
+ displayName: string;
290
+ code: string;
291
+ }
292
+ export type AnalyticsQrCodesResponse = AnalyticsQrCodeRow[];
293
+ export interface AnalyticsTagRow {
294
+ tagId: string;
295
+ claimId: string;
296
+ codeId: string;
297
+ displayName: string;
298
+ scans: number;
299
+ activeDays: number;
300
+ }
301
+ export interface AnalyticsTagsResponse {
302
+ tags: AnalyticsTagRow[];
303
+ }
304
+ export interface AnalyticsWeeklyRequest extends LegacyAnalyticsRequest {
305
+ group?: 'count' | 'unique';
306
+ }
307
+ export interface AnalyticsCountryRequest extends LegacyAnalyticsRequest {
308
+ }
@@ -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";