@analyticscli/sdk 0.1.0-preview.4
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/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/browser.cjs +1531 -0
- package/dist/browser.d.cts +1 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +42 -0
- package/dist/chunk-CY4KHPLT.js +1455 -0
- package/dist/chunk-NC6ANZ4H.js +1455 -0
- package/dist/chunk-UILQQPVJ.js +1487 -0
- package/dist/chunk-W4RJPJLF.js +1426 -0
- package/dist/chunk-ZIOGPQNP.js +1478 -0
- package/dist/index.cjs +1531 -0
- package/dist/index.d.cts +402 -0
- package/dist/index.d.ts +402 -0
- package/dist/index.js +42 -0
- package/dist/react-native.cjs +1531 -0
- package/dist/react-native.d.cts +1 -0
- package/dist/react-native.d.ts +1 -0
- package/dist/react-native.js +42 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
declare const ONBOARDING_EVENTS: {
|
|
2
|
+
readonly START: "onboarding:start";
|
|
3
|
+
readonly STEP_VIEW: "onboarding:step_view";
|
|
4
|
+
readonly STEP_COMPLETE: "onboarding:step_complete";
|
|
5
|
+
readonly COMPLETE: "onboarding:complete";
|
|
6
|
+
readonly SKIP: "onboarding:skip";
|
|
7
|
+
};
|
|
8
|
+
type OnboardingEventName = (typeof ONBOARDING_EVENTS)[keyof typeof ONBOARDING_EVENTS];
|
|
9
|
+
declare const PAYWALL_EVENTS: {
|
|
10
|
+
readonly SHOWN: "paywall:shown";
|
|
11
|
+
readonly SKIP: "paywall:skip";
|
|
12
|
+
};
|
|
13
|
+
type PaywallEventName = (typeof PAYWALL_EVENTS)[keyof typeof PAYWALL_EVENTS];
|
|
14
|
+
declare const PURCHASE_EVENTS: {
|
|
15
|
+
readonly STARTED: "purchase:started";
|
|
16
|
+
readonly SUCCESS: "purchase:success";
|
|
17
|
+
readonly FAILED: "purchase:failed";
|
|
18
|
+
readonly CANCEL: "purchase:cancel";
|
|
19
|
+
};
|
|
20
|
+
type PurchaseEventName = (typeof PURCHASE_EVENTS)[keyof typeof PURCHASE_EVENTS];
|
|
21
|
+
type PaywallJourneyEventName = PaywallEventName | PurchaseEventName;
|
|
22
|
+
declare const ONBOARDING_SURVEY_EVENTS: {
|
|
23
|
+
readonly RESPONSE: "onboarding:survey_response";
|
|
24
|
+
};
|
|
25
|
+
type OnboardingSurveyEventName = (typeof ONBOARDING_SURVEY_EVENTS)[keyof typeof ONBOARDING_SURVEY_EVENTS];
|
|
26
|
+
declare const ONBOARDING_PROGRESS_EVENT_ORDER: readonly ["onboarding:complete", "onboarding:skip"];
|
|
27
|
+
declare const PAYWALL_JOURNEY_EVENT_ORDER: readonly ["paywall:shown", "paywall:skip", "purchase:success", "purchase:failed"];
|
|
28
|
+
declare const ONBOARDING_SCREEN_EVENT_PREFIXES: readonly ["screen:onboarding", "screen:onboarding_"];
|
|
29
|
+
declare const PAYWALL_ANCHOR_EVENT_CANDIDATES: readonly ["paywall:shown"];
|
|
30
|
+
declare const PAYWALL_SKIP_EVENT_CANDIDATES: readonly ["paywall:skip"];
|
|
31
|
+
declare const PURCHASE_SUCCESS_EVENT_CANDIDATES: readonly ["purchase:success"];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Arbitrary key/value payload sent with an event.
|
|
35
|
+
*/
|
|
36
|
+
type EventProperties = Record<string, unknown>;
|
|
37
|
+
type AnalyticsStorageAdapter = {
|
|
38
|
+
/**
|
|
39
|
+
* Storage APIs can be sync or async.
|
|
40
|
+
* This allows plugging in AsyncStorage (React Native), MMKV wrappers, or custom secure stores.
|
|
41
|
+
*/
|
|
42
|
+
getItem: (key: string) => string | null | Promise<string | null>;
|
|
43
|
+
setItem: (key: string, value: string) => void | Promise<void>;
|
|
44
|
+
removeItem?: (key: string) => void | Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
type EventContext = {
|
|
47
|
+
appBuild?: string;
|
|
48
|
+
osName?: string;
|
|
49
|
+
osVersion?: string;
|
|
50
|
+
deviceModel?: string;
|
|
51
|
+
deviceManufacturer?: string;
|
|
52
|
+
deviceType?: string;
|
|
53
|
+
locale?: string;
|
|
54
|
+
country?: string;
|
|
55
|
+
region?: string;
|
|
56
|
+
city?: string;
|
|
57
|
+
timezone?: string;
|
|
58
|
+
networkType?: string;
|
|
59
|
+
carrier?: string;
|
|
60
|
+
installSource?: string;
|
|
61
|
+
};
|
|
62
|
+
type OnboardingEventProperties = EventProperties & {
|
|
63
|
+
isNewUser?: boolean;
|
|
64
|
+
onboardingFlowId?: string;
|
|
65
|
+
onboardingFlowVersion?: string | number;
|
|
66
|
+
onboardingExperimentId?: string;
|
|
67
|
+
stepKey?: string;
|
|
68
|
+
stepIndex?: number;
|
|
69
|
+
stepCount?: number;
|
|
70
|
+
};
|
|
71
|
+
type PaywallEventProperties = EventProperties & {
|
|
72
|
+
source: string;
|
|
73
|
+
fromScreen?: string;
|
|
74
|
+
paywallId?: string;
|
|
75
|
+
offering?: string;
|
|
76
|
+
paywallEntryId?: string;
|
|
77
|
+
packageId?: string;
|
|
78
|
+
price?: number;
|
|
79
|
+
currency?: string;
|
|
80
|
+
experimentVariant?: string;
|
|
81
|
+
entitlementKey?: string;
|
|
82
|
+
};
|
|
83
|
+
type OnboardingSurveyAnswerType = 'single_choice' | 'multiple_choice' | 'boolean' | 'numeric' | 'text' | 'unknown';
|
|
84
|
+
type OnboardingSurveyResponseInput = {
|
|
85
|
+
surveyKey: string;
|
|
86
|
+
questionKey: string;
|
|
87
|
+
answerType: OnboardingSurveyAnswerType;
|
|
88
|
+
responseKey?: string;
|
|
89
|
+
responseKeys?: string[];
|
|
90
|
+
responseBoolean?: boolean;
|
|
91
|
+
responseNumber?: number;
|
|
92
|
+
responseText?: string;
|
|
93
|
+
appVersion?: string;
|
|
94
|
+
isNewUser?: boolean;
|
|
95
|
+
onboardingFlowId?: string;
|
|
96
|
+
onboardingFlowVersion?: string | number;
|
|
97
|
+
onboardingExperimentId?: string;
|
|
98
|
+
stepKey?: string;
|
|
99
|
+
stepIndex?: number;
|
|
100
|
+
stepCount?: number;
|
|
101
|
+
experimentVariant?: string;
|
|
102
|
+
paywallId?: string;
|
|
103
|
+
properties?: EventProperties;
|
|
104
|
+
};
|
|
105
|
+
type OnboardingTrackerDefaults = OnboardingEventProperties & {
|
|
106
|
+
surveyKey?: string;
|
|
107
|
+
};
|
|
108
|
+
type OnboardingTrackerSurveyInput = Omit<OnboardingSurveyResponseInput, 'surveyKey'> & {
|
|
109
|
+
surveyKey?: string;
|
|
110
|
+
};
|
|
111
|
+
type OnboardingStepTracker = {
|
|
112
|
+
view: (properties?: Omit<OnboardingEventProperties, 'stepKey' | 'stepIndex'>) => void;
|
|
113
|
+
complete: (properties?: Omit<OnboardingEventProperties, 'stepKey' | 'stepIndex'>) => void;
|
|
114
|
+
surveyResponse: (input: Omit<OnboardingTrackerSurveyInput, 'stepKey' | 'stepIndex'>) => void;
|
|
115
|
+
};
|
|
116
|
+
type OnboardingTracker = {
|
|
117
|
+
track: (eventName: OnboardingEventName, properties?: OnboardingEventProperties) => void;
|
|
118
|
+
start: (properties?: OnboardingEventProperties) => void;
|
|
119
|
+
stepView: (properties: OnboardingEventProperties) => void;
|
|
120
|
+
stepComplete: (properties: OnboardingEventProperties) => void;
|
|
121
|
+
complete: (properties?: OnboardingEventProperties) => void;
|
|
122
|
+
skip: (properties?: OnboardingEventProperties) => void;
|
|
123
|
+
surveyResponse: (input: OnboardingTrackerSurveyInput) => void;
|
|
124
|
+
step: (stepKey: string, stepIndex: number, properties?: Omit<OnboardingEventProperties, 'stepKey' | 'stepIndex'>) => OnboardingStepTracker;
|
|
125
|
+
};
|
|
126
|
+
type PaywallTrackerDefaults = PaywallEventProperties;
|
|
127
|
+
type PaywallTrackerProperties = Partial<PaywallEventProperties>;
|
|
128
|
+
type PaywallTracker = {
|
|
129
|
+
track: (eventName: PaywallJourneyEventName, properties?: PaywallTrackerProperties) => void;
|
|
130
|
+
shown: (properties?: PaywallTrackerProperties) => void;
|
|
131
|
+
skip: (properties?: PaywallTrackerProperties) => void;
|
|
132
|
+
purchaseStarted: (properties?: PaywallTrackerProperties) => void;
|
|
133
|
+
purchaseSuccess: (properties?: PaywallTrackerProperties) => void;
|
|
134
|
+
purchaseFailed: (properties?: PaywallTrackerProperties) => void;
|
|
135
|
+
purchaseCancel: (properties?: PaywallTrackerProperties) => void;
|
|
136
|
+
};
|
|
137
|
+
type AnalyticsClientOptions = {
|
|
138
|
+
/**
|
|
139
|
+
* Write key (long API key).
|
|
140
|
+
* If omitted, the client becomes a safe no-op until a valid key is provided.
|
|
141
|
+
*/
|
|
142
|
+
apiKey?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Optional collector override reserved for SDK/internal testing.
|
|
145
|
+
* Host app integrations should not set this option.
|
|
146
|
+
*/
|
|
147
|
+
endpoint?: string;
|
|
148
|
+
batchSize?: number;
|
|
149
|
+
flushIntervalMs?: number;
|
|
150
|
+
maxRetries?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Enables SDK debug logs (`console.debug`).
|
|
153
|
+
* Defaults to `false`.
|
|
154
|
+
*
|
|
155
|
+
* React Native/Expo recommendation:
|
|
156
|
+
* `debug: typeof __DEV__ === 'boolean' ? __DEV__ : false`
|
|
157
|
+
*/
|
|
158
|
+
debug?: boolean;
|
|
159
|
+
platform?: string;
|
|
160
|
+
appVersion?: string;
|
|
161
|
+
context?: EventContext;
|
|
162
|
+
/**
|
|
163
|
+
* Optional custom persistence adapter.
|
|
164
|
+
* If omitted, browser storage/cookies are used when available; otherwise in-memory IDs are used.
|
|
165
|
+
*/
|
|
166
|
+
storage?: AnalyticsStorageAdapter;
|
|
167
|
+
anonId?: string;
|
|
168
|
+
sessionId?: string;
|
|
169
|
+
sessionTimeoutMs?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Drops duplicate `onboarding:step_view` events for the same step within one session.
|
|
172
|
+
* This only affects the dedicated onboarding step-view event, not `screen(...)` or paywall events.
|
|
173
|
+
*/
|
|
174
|
+
dedupeOnboardingStepViewsPerSession?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Optional cookie domain to persist device/session ids across subdomains.
|
|
177
|
+
* Example: `.analyticscli.com`
|
|
178
|
+
*/
|
|
179
|
+
cookieDomain?: string;
|
|
180
|
+
cookieMaxAgeSeconds?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Enables cookie-backed id/session persistence.
|
|
183
|
+
* Defaults to true when `cookieDomain` is provided, otherwise false.
|
|
184
|
+
*/
|
|
185
|
+
useCookieStorage?: boolean;
|
|
186
|
+
};
|
|
187
|
+
type InitOptions = AnalyticsClientOptions;
|
|
188
|
+
type InitFromEnvMissingConfigMode = 'noop' | 'throw';
|
|
189
|
+
type InitFromEnvMissingConfig = {
|
|
190
|
+
missingApiKey: boolean;
|
|
191
|
+
searchedApiKeyEnvKeys: string[];
|
|
192
|
+
};
|
|
193
|
+
type InitFromEnvOptions = Omit<AnalyticsClientOptions, 'apiKey'> & {
|
|
194
|
+
/**
|
|
195
|
+
* Optional environment-like object.
|
|
196
|
+
* Defaults to `globalThis.process?.env` when available.
|
|
197
|
+
*/
|
|
198
|
+
env?: Record<string, unknown>;
|
|
199
|
+
/**
|
|
200
|
+
* Explicit api key override.
|
|
201
|
+
*/
|
|
202
|
+
apiKey?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Candidate env keys resolved in order.
|
|
205
|
+
*/
|
|
206
|
+
apiKeyEnvKeys?: string[];
|
|
207
|
+
/**
|
|
208
|
+
* How missing config is handled.
|
|
209
|
+
* - `noop` (default): returns a safe no-op client
|
|
210
|
+
* - `throw`: throws when required config is missing
|
|
211
|
+
*/
|
|
212
|
+
missingConfigMode?: InitFromEnvMissingConfigMode;
|
|
213
|
+
/**
|
|
214
|
+
* Optional callback for custom logging when config is missing.
|
|
215
|
+
*/
|
|
216
|
+
onMissingConfig?: (details: InitFromEnvMissingConfig) => void;
|
|
217
|
+
};
|
|
218
|
+
type InitInput = InitOptions | string;
|
|
219
|
+
|
|
220
|
+
declare class AnalyticsClient {
|
|
221
|
+
private readonly apiKey;
|
|
222
|
+
private readonly hasIngestConfig;
|
|
223
|
+
private readonly endpoint;
|
|
224
|
+
private readonly batchSize;
|
|
225
|
+
private readonly flushIntervalMs;
|
|
226
|
+
private readonly maxRetries;
|
|
227
|
+
private readonly debug;
|
|
228
|
+
private readonly platform;
|
|
229
|
+
private readonly appVersion;
|
|
230
|
+
private context;
|
|
231
|
+
private readonly storage;
|
|
232
|
+
private readonly storageReadsAreAsync;
|
|
233
|
+
private readonly sessionTimeoutMs;
|
|
234
|
+
private readonly dedupeOnboardingStepViewsPerSession;
|
|
235
|
+
private readonly runtimeEnv;
|
|
236
|
+
private readonly hasExplicitAnonId;
|
|
237
|
+
private readonly hasExplicitSessionId;
|
|
238
|
+
private readonly hydrationPromise;
|
|
239
|
+
private queue;
|
|
240
|
+
private flushTimer;
|
|
241
|
+
private isFlushing;
|
|
242
|
+
private consentGranted;
|
|
243
|
+
private userId;
|
|
244
|
+
private anonId;
|
|
245
|
+
private sessionId;
|
|
246
|
+
private sessionEventSeq;
|
|
247
|
+
private inMemoryLastSeenMs;
|
|
248
|
+
private hydrationCompleted;
|
|
249
|
+
private deferredEventsBeforeHydration;
|
|
250
|
+
private onboardingStepViewStateSessionId;
|
|
251
|
+
private onboardingStepViewsSeen;
|
|
252
|
+
constructor(options: AnalyticsClientOptions);
|
|
253
|
+
/**
|
|
254
|
+
* Resolves once any async storage adapter hydration completes.
|
|
255
|
+
* Useful in React Native when using async persistence (for example AsyncStorage).
|
|
256
|
+
*/
|
|
257
|
+
ready(): Promise<void>;
|
|
258
|
+
/**
|
|
259
|
+
* Enables or disables event collection.
|
|
260
|
+
* When disabled, queued events are dropped immediately.
|
|
261
|
+
*/
|
|
262
|
+
setConsent(granted: boolean): void;
|
|
263
|
+
optIn(): void;
|
|
264
|
+
optOut(): void;
|
|
265
|
+
/**
|
|
266
|
+
* Sets or updates shared event context fields (useful for mobile device/app metadata).
|
|
267
|
+
*/
|
|
268
|
+
setContext(context: EventContext): void;
|
|
269
|
+
/**
|
|
270
|
+
* Associates following events with a known user id.
|
|
271
|
+
* Anonymous history remains linked by anonId/sessionId.
|
|
272
|
+
*/
|
|
273
|
+
identify(userId: string, traits?: EventProperties): void;
|
|
274
|
+
/**
|
|
275
|
+
* Convenience helper for login/logout boundaries.
|
|
276
|
+
* - pass a non-empty user id to emit an identify event
|
|
277
|
+
* - pass null/undefined/empty string to clear user linkage
|
|
278
|
+
*/
|
|
279
|
+
setUser(userId: string | null | undefined, traits?: EventProperties): void;
|
|
280
|
+
/**
|
|
281
|
+
* Clears the current identified user from in-memory SDK state.
|
|
282
|
+
*/
|
|
283
|
+
clearUser(): void;
|
|
284
|
+
/**
|
|
285
|
+
* Sends a generic product event.
|
|
286
|
+
*/
|
|
287
|
+
track(eventName: string, properties?: EventProperties): void;
|
|
288
|
+
/**
|
|
289
|
+
* Sends a typed onboarding event with conventional onboarding metadata.
|
|
290
|
+
*/
|
|
291
|
+
trackOnboardingEvent(eventName: OnboardingEventName, properties?: OnboardingEventProperties): void;
|
|
292
|
+
/**
|
|
293
|
+
* Creates a scoped onboarding tracker that applies shared flow properties to every onboarding event.
|
|
294
|
+
* This reduces app-side boilerplate while keeping each emitted event fully self-describing.
|
|
295
|
+
*/
|
|
296
|
+
createOnboardingTracker(defaults: OnboardingTrackerDefaults): OnboardingTracker;
|
|
297
|
+
/**
|
|
298
|
+
* Creates a scoped paywall tracker that applies shared paywall defaults to every journey event.
|
|
299
|
+
* Useful when a flow has a stable `source`, `paywallId`, `offering`, or experiment metadata.
|
|
300
|
+
*/
|
|
301
|
+
createPaywallTracker(defaults: PaywallTrackerDefaults): PaywallTracker;
|
|
302
|
+
/**
|
|
303
|
+
* Sends a typed paywall/purchase journey event.
|
|
304
|
+
* Direct calls ignore `paywallEntryId`; use `createPaywallTracker(...)` for entry correlation.
|
|
305
|
+
*/
|
|
306
|
+
trackPaywallEvent(eventName: PaywallJourneyEventName, properties: PaywallEventProperties): void;
|
|
307
|
+
private sendPaywallEvent;
|
|
308
|
+
/**
|
|
309
|
+
* Sends anonymized onboarding survey responses using canonical event naming.
|
|
310
|
+
* Free text and raw numeric values are reduced to coarse buckets.
|
|
311
|
+
*/
|
|
312
|
+
trackOnboardingSurveyResponse(input: OnboardingSurveyResponseInput, eventName?: OnboardingSurveyEventName): void;
|
|
313
|
+
/**
|
|
314
|
+
* Sends a screen-view style event using the `screen:<name>` convention.
|
|
315
|
+
*/
|
|
316
|
+
screen(name: string, properties?: EventProperties): void;
|
|
317
|
+
/**
|
|
318
|
+
* Alias of `screen(...)` for web-style naming.
|
|
319
|
+
*/
|
|
320
|
+
page(name: string, properties?: EventProperties): void;
|
|
321
|
+
/**
|
|
322
|
+
* Sends a feedback event.
|
|
323
|
+
*/
|
|
324
|
+
feedback(message: string, rating?: number, properties?: EventProperties): void;
|
|
325
|
+
/**
|
|
326
|
+
* Flushes current event queue to the ingest endpoint.
|
|
327
|
+
*/
|
|
328
|
+
flush(): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* Stops internal timers and unload handlers.
|
|
331
|
+
*/
|
|
332
|
+
shutdown(): void;
|
|
333
|
+
private enqueue;
|
|
334
|
+
private scheduleFlush;
|
|
335
|
+
private sendWithRetry;
|
|
336
|
+
private startAutoFlush;
|
|
337
|
+
private ensureDeviceId;
|
|
338
|
+
private ensureSessionId;
|
|
339
|
+
private getSessionId;
|
|
340
|
+
private readSessionEventSeq;
|
|
341
|
+
private readSessionEventSeqAsync;
|
|
342
|
+
private parseSessionEventSeq;
|
|
343
|
+
private writeSessionEventSeq;
|
|
344
|
+
private hydrateIdentityFromStorage;
|
|
345
|
+
private shouldDeferEventsUntilHydrated;
|
|
346
|
+
private deferEventUntilHydrated;
|
|
347
|
+
private drainDeferredEventsAfterHydration;
|
|
348
|
+
private cloneProperties;
|
|
349
|
+
private detectAsyncStorageReads;
|
|
350
|
+
private withRuntimeMetadata;
|
|
351
|
+
private shouldDropOnboardingStepView;
|
|
352
|
+
private getOnboardingStepViewDedupeKey;
|
|
353
|
+
private readPropertyAsString;
|
|
354
|
+
private readPropertyAsStepIndex;
|
|
355
|
+
private syncOnboardingStepViewState;
|
|
356
|
+
private hydrateOnboardingStepViewState;
|
|
357
|
+
private persistOnboardingStepViewState;
|
|
358
|
+
private parseOnboardingStepViewState;
|
|
359
|
+
private withEventContext;
|
|
360
|
+
private normalizeOptions;
|
|
361
|
+
private readRequiredStringOption;
|
|
362
|
+
private normalizePlatformOption;
|
|
363
|
+
private log;
|
|
364
|
+
private reportMissingApiKey;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
declare const DEFAULT_API_KEY_ENV_KEYS: readonly ["ANALYTICSCLI_WRITE_KEY", "NEXT_PUBLIC_ANALYTICSCLI_WRITE_KEY", "EXPO_PUBLIC_ANALYTICSCLI_WRITE_KEY", "VITE_ANALYTICSCLI_WRITE_KEY"];
|
|
368
|
+
/**
|
|
369
|
+
* Minimal host-app bootstrap helper.
|
|
370
|
+
* Resolves `apiKey` (required) from explicit options or env-like objects.
|
|
371
|
+
*/
|
|
372
|
+
declare const initFromEnv: (options?: InitFromEnvOptions) => AnalyticsClient;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Creates a browser analytics client instance.
|
|
376
|
+
*/
|
|
377
|
+
declare const init: (input?: InitInput) => AnalyticsClient;
|
|
378
|
+
/**
|
|
379
|
+
* Creates an analytics client and waits for async storage hydration.
|
|
380
|
+
* Prefer this in React Native when using async persistence (for example AsyncStorage).
|
|
381
|
+
*/
|
|
382
|
+
declare const initAsync: (input?: InitInput) => Promise<AnalyticsClient>;
|
|
383
|
+
declare const BROWSER_API_KEY_ENV_KEYS: readonly ["ANALYTICSCLI_WRITE_KEY", "NEXT_PUBLIC_ANALYTICSCLI_WRITE_KEY", "PUBLIC_ANALYTICSCLI_WRITE_KEY", "VITE_ANALYTICSCLI_WRITE_KEY", "EXPO_PUBLIC_ANALYTICSCLI_WRITE_KEY"];
|
|
384
|
+
declare const REACT_NATIVE_API_KEY_ENV_KEYS: readonly ["ANALYTICSCLI_WRITE_KEY", "EXPO_PUBLIC_ANALYTICSCLI_WRITE_KEY"];
|
|
385
|
+
type BrowserInitFromEnvOptions = Omit<InitFromEnvOptions, 'apiKeyEnvKeys'> & {
|
|
386
|
+
apiKeyEnvKeys?: readonly string[];
|
|
387
|
+
};
|
|
388
|
+
type ReactNativeInitFromEnvOptions = Omit<InitFromEnvOptions, 'apiKeyEnvKeys'> & {
|
|
389
|
+
apiKeyEnvKeys?: readonly string[];
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Browser-focused env bootstrap.
|
|
393
|
+
* Supports common env prefixes across Next.js, Astro/Vite and Expo web.
|
|
394
|
+
*/
|
|
395
|
+
declare const initBrowserFromEnv: (options?: BrowserInitFromEnvOptions) => AnalyticsClient;
|
|
396
|
+
/**
|
|
397
|
+
* React Native-focused env bootstrap.
|
|
398
|
+
* Defaults to native-friendly env keys while still allowing explicit overrides.
|
|
399
|
+
*/
|
|
400
|
+
declare const initReactNativeFromEnv: (options?: ReactNativeInitFromEnvOptions) => AnalyticsClient;
|
|
401
|
+
|
|
402
|
+
export { AnalyticsClient, type AnalyticsClientOptions, type AnalyticsStorageAdapter, BROWSER_API_KEY_ENV_KEYS, type BrowserInitFromEnvOptions, DEFAULT_API_KEY_ENV_KEYS, type EventContext, type EventProperties, type InitFromEnvMissingConfig, type InitFromEnvMissingConfigMode, type InitFromEnvOptions, type InitInput, type InitOptions, ONBOARDING_EVENTS, ONBOARDING_PROGRESS_EVENT_ORDER, ONBOARDING_SCREEN_EVENT_PREFIXES, ONBOARDING_SURVEY_EVENTS, type OnboardingEventName, type OnboardingEventProperties, type OnboardingStepTracker, type OnboardingSurveyAnswerType, type OnboardingSurveyEventName, type OnboardingSurveyResponseInput, type OnboardingTracker, type OnboardingTrackerDefaults, type OnboardingTrackerSurveyInput, PAYWALL_ANCHOR_EVENT_CANDIDATES, PAYWALL_EVENTS, PAYWALL_JOURNEY_EVENT_ORDER, PAYWALL_SKIP_EVENT_CANDIDATES, PURCHASE_EVENTS, PURCHASE_SUCCESS_EVENT_CANDIDATES, type PaywallEventName, type PaywallEventProperties, type PaywallJourneyEventName, type PaywallTracker, type PaywallTrackerDefaults, type PaywallTrackerProperties, type PurchaseEventName, REACT_NATIVE_API_KEY_ENV_KEYS, type ReactNativeInitFromEnvOptions, init, initAsync, initBrowserFromEnv, initFromEnv, initReactNativeFromEnv };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnalyticsClient,
|
|
3
|
+
BROWSER_API_KEY_ENV_KEYS,
|
|
4
|
+
DEFAULT_API_KEY_ENV_KEYS,
|
|
5
|
+
ONBOARDING_EVENTS,
|
|
6
|
+
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
7
|
+
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
8
|
+
ONBOARDING_SURVEY_EVENTS,
|
|
9
|
+
PAYWALL_ANCHOR_EVENT_CANDIDATES,
|
|
10
|
+
PAYWALL_EVENTS,
|
|
11
|
+
PAYWALL_JOURNEY_EVENT_ORDER,
|
|
12
|
+
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
13
|
+
PURCHASE_EVENTS,
|
|
14
|
+
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
15
|
+
REACT_NATIVE_API_KEY_ENV_KEYS,
|
|
16
|
+
init,
|
|
17
|
+
initAsync,
|
|
18
|
+
initBrowserFromEnv,
|
|
19
|
+
initFromEnv,
|
|
20
|
+
initReactNativeFromEnv
|
|
21
|
+
} from "./chunk-UILQQPVJ.js";
|
|
22
|
+
export {
|
|
23
|
+
AnalyticsClient,
|
|
24
|
+
BROWSER_API_KEY_ENV_KEYS,
|
|
25
|
+
DEFAULT_API_KEY_ENV_KEYS,
|
|
26
|
+
ONBOARDING_EVENTS,
|
|
27
|
+
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
28
|
+
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
29
|
+
ONBOARDING_SURVEY_EVENTS,
|
|
30
|
+
PAYWALL_ANCHOR_EVENT_CANDIDATES,
|
|
31
|
+
PAYWALL_EVENTS,
|
|
32
|
+
PAYWALL_JOURNEY_EVENT_ORDER,
|
|
33
|
+
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
34
|
+
PURCHASE_EVENTS,
|
|
35
|
+
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
36
|
+
REACT_NATIVE_API_KEY_ENV_KEYS,
|
|
37
|
+
init,
|
|
38
|
+
initAsync,
|
|
39
|
+
initBrowserFromEnv,
|
|
40
|
+
initFromEnv,
|
|
41
|
+
initReactNativeFromEnv
|
|
42
|
+
};
|