@analyticscli/sdk 0.1.0-preview.5 → 0.1.0-preview.6
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/README.md +75 -80
- package/dist/browser.cjs +70 -102
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +5 -15
- package/dist/{chunk-HL2VOD3Z.js → chunk-RGEYDN6A.js} +68 -95
- package/dist/index.cjs +70 -102
- package/dist/index.d.cts +57 -53
- package/dist/index.d.ts +57 -53
- package/dist/index.js +5 -15
- package/dist/react-native.cjs +70 -102
- package/dist/react-native.d.cts +1 -1
- package/dist/react-native.d.ts +1 -1
- package/dist/react-native.js +5 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -236,36 +236,6 @@ type AnalyticsClientOptions = {
|
|
|
236
236
|
useCookieStorage?: boolean | null;
|
|
237
237
|
};
|
|
238
238
|
type InitOptions = AnalyticsClientOptions;
|
|
239
|
-
type InitFromEnvMissingConfigMode = 'noop' | 'throw';
|
|
240
|
-
type InitFromEnvMissingConfig = {
|
|
241
|
-
missingApiKey: boolean;
|
|
242
|
-
searchedApiKeyEnvKeys: string[];
|
|
243
|
-
};
|
|
244
|
-
type InitFromEnvOptions = Omit<AnalyticsClientOptions, 'apiKey'> & {
|
|
245
|
-
/**
|
|
246
|
-
* Optional environment-like object.
|
|
247
|
-
* Defaults to `globalThis.process?.env` when available.
|
|
248
|
-
*/
|
|
249
|
-
env?: Record<string, unknown> | null;
|
|
250
|
-
/**
|
|
251
|
-
* Explicit api key override.
|
|
252
|
-
*/
|
|
253
|
-
apiKey?: string | null;
|
|
254
|
-
/**
|
|
255
|
-
* Candidate env keys resolved in order.
|
|
256
|
-
*/
|
|
257
|
-
apiKeyEnvKeys?: string[] | null;
|
|
258
|
-
/**
|
|
259
|
-
* How missing config is handled.
|
|
260
|
-
* - `noop` (default): returns a safe no-op client
|
|
261
|
-
* - `throw`: throws when required config is missing
|
|
262
|
-
*/
|
|
263
|
-
missingConfigMode?: InitFromEnvMissingConfigMode | null;
|
|
264
|
-
/**
|
|
265
|
-
* Optional callback for custom logging when config is missing.
|
|
266
|
-
*/
|
|
267
|
-
onMissingConfig?: ((details: InitFromEnvMissingConfig) => void) | null;
|
|
268
|
-
};
|
|
269
239
|
type InitInput = InitOptions | string | null | undefined;
|
|
270
240
|
|
|
271
241
|
declare class AnalyticsClient {
|
|
@@ -445,12 +415,64 @@ declare class AnalyticsClient {
|
|
|
445
415
|
private reportMissingApiKey;
|
|
446
416
|
}
|
|
447
417
|
|
|
448
|
-
|
|
418
|
+
type ContextClientInput = InitInput | AnalyticsClient | null | undefined;
|
|
419
|
+
type AnalyticsContextConsentControls = {
|
|
420
|
+
get: () => boolean;
|
|
421
|
+
getState: () => AnalyticsConsentState;
|
|
422
|
+
set: (granted: boolean, options?: SetConsentOptions) => void;
|
|
423
|
+
optIn: (options?: SetConsentOptions) => void;
|
|
424
|
+
optOut: (options?: SetConsentOptions) => void;
|
|
425
|
+
setFullTracking: (granted: boolean, options?: SetConsentOptions) => void;
|
|
426
|
+
optInFullTracking: (options?: SetConsentOptions) => void;
|
|
427
|
+
optOutFullTracking: (options?: SetConsentOptions) => void;
|
|
428
|
+
isFullTrackingEnabled: () => boolean;
|
|
429
|
+
};
|
|
430
|
+
type AnalyticsContextUserControls = {
|
|
431
|
+
identify: (userId: string, traits?: EventProperties) => void;
|
|
432
|
+
set: (userId: string | null | undefined, traits?: EventProperties) => void;
|
|
433
|
+
clear: () => void;
|
|
434
|
+
};
|
|
435
|
+
type AnalyticsContext = {
|
|
436
|
+
client: AnalyticsClient;
|
|
437
|
+
onboarding: OnboardingTracker;
|
|
438
|
+
paywall: PaywallTracker | null;
|
|
439
|
+
consent: AnalyticsContextConsentControls;
|
|
440
|
+
user: AnalyticsContextUserControls;
|
|
441
|
+
track: (eventName: string, properties?: EventProperties) => void;
|
|
442
|
+
trackOnboardingEvent: (eventName: OnboardingEventName, properties?: OnboardingEventProperties) => void;
|
|
443
|
+
trackOnboardingSurveyResponse: (input: OnboardingSurveyResponseInput, eventName?: OnboardingSurveyEventName) => void;
|
|
444
|
+
trackPaywallEvent: (eventName: PaywallJourneyEventName, properties: PaywallEventProperties) => void;
|
|
445
|
+
screen: (name: string, properties?: EventProperties) => void;
|
|
446
|
+
page: (name: string, properties?: EventProperties) => void;
|
|
447
|
+
feedback: (message: string, rating?: number, properties?: EventProperties) => void;
|
|
448
|
+
setContext: (context: EventContext) => void;
|
|
449
|
+
createOnboarding: (defaults: OnboardingTrackerDefaults) => OnboardingTracker;
|
|
450
|
+
createPaywall: (defaults: PaywallTrackerDefaults) => PaywallTracker;
|
|
451
|
+
configureOnboarding: (defaults: OnboardingTrackerDefaults) => OnboardingTracker;
|
|
452
|
+
configurePaywall: (defaults: PaywallTrackerDefaults) => PaywallTracker;
|
|
453
|
+
ready: () => Promise<void>;
|
|
454
|
+
flush: () => Promise<void>;
|
|
455
|
+
shutdown: () => void;
|
|
456
|
+
};
|
|
457
|
+
type CreateAnalyticsContextOptions = {
|
|
458
|
+
/**
|
|
459
|
+
* Either an existing client instance or standard `init(...)` input.
|
|
460
|
+
*/
|
|
461
|
+
client?: ContextClientInput;
|
|
462
|
+
/**
|
|
463
|
+
* Defaults used for the exported `context.onboarding` tracker instance.
|
|
464
|
+
*/
|
|
465
|
+
onboarding?: OnboardingTrackerDefaults | null;
|
|
466
|
+
/**
|
|
467
|
+
* Optional defaults used for the exported `context.paywall` tracker instance.
|
|
468
|
+
*/
|
|
469
|
+
paywall?: PaywallTrackerDefaults | null;
|
|
470
|
+
};
|
|
449
471
|
/**
|
|
450
|
-
*
|
|
451
|
-
*
|
|
472
|
+
* Host-app friendly SDK context with low boilerplate and rich defaults.
|
|
473
|
+
* Provides pre-wired onboarding + consent/user controls and optional paywall tracker binding.
|
|
452
474
|
*/
|
|
453
|
-
declare const
|
|
475
|
+
declare const createAnalyticsContext: (options?: CreateAnalyticsContextOptions) => AnalyticsContext;
|
|
454
476
|
|
|
455
477
|
/**
|
|
456
478
|
* Creates a browser analytics client instance.
|
|
@@ -466,23 +488,5 @@ declare const initConsentFirst: (input?: InitInput) => AnalyticsClient;
|
|
|
466
488
|
*/
|
|
467
489
|
declare const initAsync: (input?: InitInput) => Promise<AnalyticsClient>;
|
|
468
490
|
declare const initConsentFirstAsync: (input?: InitInput) => Promise<AnalyticsClient>;
|
|
469
|
-
declare const BROWSER_API_KEY_ENV_KEYS: readonly ["ANALYTICSCLI_PUBLISHABLE_API_KEY", "NEXT_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY", "PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY", "VITE_ANALYTICSCLI_PUBLISHABLE_API_KEY", "EXPO_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY"];
|
|
470
|
-
declare const REACT_NATIVE_API_KEY_ENV_KEYS: readonly ["ANALYTICSCLI_PUBLISHABLE_API_KEY", "EXPO_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY"];
|
|
471
|
-
type BrowserInitFromEnvOptions = Omit<InitFromEnvOptions, 'apiKeyEnvKeys'> & {
|
|
472
|
-
apiKeyEnvKeys?: readonly string[];
|
|
473
|
-
};
|
|
474
|
-
type ReactNativeInitFromEnvOptions = Omit<InitFromEnvOptions, 'apiKeyEnvKeys'> & {
|
|
475
|
-
apiKeyEnvKeys?: readonly string[];
|
|
476
|
-
};
|
|
477
|
-
/**
|
|
478
|
-
* Browser-focused env bootstrap.
|
|
479
|
-
* Supports common env prefixes across Next.js, Astro/Vite and Expo web.
|
|
480
|
-
*/
|
|
481
|
-
declare const initBrowserFromEnv: (options?: BrowserInitFromEnvOptions) => AnalyticsClient;
|
|
482
|
-
/**
|
|
483
|
-
* React Native-focused env bootstrap.
|
|
484
|
-
* Defaults to native-friendly env keys while still allowing explicit overrides.
|
|
485
|
-
*/
|
|
486
|
-
declare const initReactNativeFromEnv: (options?: ReactNativeInitFromEnvOptions) => AnalyticsClient;
|
|
487
491
|
|
|
488
|
-
export { AnalyticsClient, type AnalyticsClientOptions, type AnalyticsConsentState, type
|
|
492
|
+
export { AnalyticsClient, type AnalyticsClientOptions, type AnalyticsConsentState, type AnalyticsContext, type AnalyticsContextConsentControls, type AnalyticsContextUserControls, type AnalyticsStorageAdapter, type CreateAnalyticsContextOptions, type EventContext, type EventProperties, type IdentityTrackingMode, 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, type SetConsentOptions, createAnalyticsContext, init, initAsync, initConsentFirst, initConsentFirstAsync };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnalyticsClient,
|
|
3
|
-
BROWSER_API_KEY_ENV_KEYS,
|
|
4
|
-
DEFAULT_API_KEY_ENV_KEYS,
|
|
5
3
|
ONBOARDING_EVENTS,
|
|
6
4
|
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
7
5
|
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -12,19 +10,14 @@ import {
|
|
|
12
10
|
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
13
11
|
PURCHASE_EVENTS,
|
|
14
12
|
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
15
|
-
|
|
13
|
+
createAnalyticsContext,
|
|
16
14
|
init,
|
|
17
15
|
initAsync,
|
|
18
|
-
initBrowserFromEnv,
|
|
19
16
|
initConsentFirst,
|
|
20
|
-
initConsentFirstAsync
|
|
21
|
-
|
|
22
|
-
initReactNativeFromEnv
|
|
23
|
-
} from "./chunk-HL2VOD3Z.js";
|
|
17
|
+
initConsentFirstAsync
|
|
18
|
+
} from "./chunk-RGEYDN6A.js";
|
|
24
19
|
export {
|
|
25
20
|
AnalyticsClient,
|
|
26
|
-
BROWSER_API_KEY_ENV_KEYS,
|
|
27
|
-
DEFAULT_API_KEY_ENV_KEYS,
|
|
28
21
|
ONBOARDING_EVENTS,
|
|
29
22
|
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
30
23
|
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -35,12 +28,9 @@ export {
|
|
|
35
28
|
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
36
29
|
PURCHASE_EVENTS,
|
|
37
30
|
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
38
|
-
|
|
31
|
+
createAnalyticsContext,
|
|
39
32
|
init,
|
|
40
33
|
initAsync,
|
|
41
|
-
initBrowserFromEnv,
|
|
42
34
|
initConsentFirst,
|
|
43
|
-
initConsentFirstAsync
|
|
44
|
-
initFromEnv,
|
|
45
|
-
initReactNativeFromEnv
|
|
35
|
+
initConsentFirstAsync
|
|
46
36
|
};
|
package/dist/react-native.cjs
CHANGED
|
@@ -21,8 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var react_native_exports = {};
|
|
22
22
|
__export(react_native_exports, {
|
|
23
23
|
AnalyticsClient: () => AnalyticsClient,
|
|
24
|
-
BROWSER_API_KEY_ENV_KEYS: () => BROWSER_API_KEY_ENV_KEYS,
|
|
25
|
-
DEFAULT_API_KEY_ENV_KEYS: () => DEFAULT_API_KEY_ENV_KEYS,
|
|
26
24
|
ONBOARDING_EVENTS: () => ONBOARDING_EVENTS,
|
|
27
25
|
ONBOARDING_PROGRESS_EVENT_ORDER: () => ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
28
26
|
ONBOARDING_SCREEN_EVENT_PREFIXES: () => ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -33,14 +31,11 @@ __export(react_native_exports, {
|
|
|
33
31
|
PAYWALL_SKIP_EVENT_CANDIDATES: () => PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
34
32
|
PURCHASE_EVENTS: () => PURCHASE_EVENTS,
|
|
35
33
|
PURCHASE_SUCCESS_EVENT_CANDIDATES: () => PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
36
|
-
|
|
34
|
+
createAnalyticsContext: () => createAnalyticsContext,
|
|
37
35
|
init: () => init,
|
|
38
36
|
initAsync: () => initAsync,
|
|
39
|
-
initBrowserFromEnv: () => initBrowserFromEnv,
|
|
40
37
|
initConsentFirst: () => initConsentFirst,
|
|
41
|
-
initConsentFirstAsync: () => initConsentFirstAsync
|
|
42
|
-
initFromEnv: () => initFromEnv,
|
|
43
|
-
initReactNativeFromEnv: () => initReactNativeFromEnv
|
|
38
|
+
initConsentFirstAsync: () => initConsentFirstAsync
|
|
44
39
|
});
|
|
45
40
|
module.exports = __toCommonJS(react_native_exports);
|
|
46
41
|
|
|
@@ -1603,75 +1598,78 @@ var AnalyticsClient = class {
|
|
|
1603
1598
|
}
|
|
1604
1599
|
};
|
|
1605
1600
|
|
|
1606
|
-
// src/
|
|
1607
|
-
var
|
|
1608
|
-
"
|
|
1609
|
-
|
|
1610
|
-
"EXPO_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1611
|
-
"VITE_ANALYTICSCLI_PUBLISHABLE_API_KEY"
|
|
1612
|
-
];
|
|
1613
|
-
var readTrimmedString2 = (value) => {
|
|
1614
|
-
if (typeof value === "string") {
|
|
1615
|
-
return value.trim();
|
|
1616
|
-
}
|
|
1617
|
-
if (typeof value === "number" || typeof value === "boolean") {
|
|
1618
|
-
return String(value).trim();
|
|
1619
|
-
}
|
|
1620
|
-
return "";
|
|
1621
|
-
};
|
|
1622
|
-
var resolveDefaultEnv = () => {
|
|
1623
|
-
const withProcess = globalThis;
|
|
1624
|
-
if (typeof withProcess.process?.env === "object" && withProcess.process.env !== null) {
|
|
1625
|
-
return withProcess.process.env;
|
|
1601
|
+
// src/context.ts
|
|
1602
|
+
var normalizeInitInput = (input) => {
|
|
1603
|
+
if (typeof input === "string") {
|
|
1604
|
+
return { apiKey: input };
|
|
1626
1605
|
}
|
|
1627
|
-
|
|
1628
|
-
};
|
|
1629
|
-
var resolveValueFromEnv = (env, keys) => {
|
|
1630
|
-
for (const key of keys) {
|
|
1631
|
-
const value = readTrimmedString2(env[key]);
|
|
1632
|
-
if (value.length > 0) {
|
|
1633
|
-
return value;
|
|
1634
|
-
}
|
|
1606
|
+
if (input === null || input === void 0) {
|
|
1607
|
+
return {};
|
|
1635
1608
|
}
|
|
1636
|
-
return
|
|
1609
|
+
return input;
|
|
1637
1610
|
};
|
|
1638
|
-
var
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
parts.push(`apiKey (searched: ${details.searchedApiKeyEnvKeys.join(", ") || "none"})`);
|
|
1611
|
+
var resolveClient = (input) => {
|
|
1612
|
+
if (input instanceof AnalyticsClient) {
|
|
1613
|
+
return input;
|
|
1642
1614
|
}
|
|
1643
|
-
return
|
|
1615
|
+
return new AnalyticsClient(normalizeInitInput(input ?? {}));
|
|
1644
1616
|
};
|
|
1645
|
-
var
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1617
|
+
var createAnalyticsContext = (options = {}) => {
|
|
1618
|
+
const client = resolveClient(options.client);
|
|
1619
|
+
let onboardingTracker = client.createOnboardingTracker(options.onboarding ?? {});
|
|
1620
|
+
let paywallTracker = options.paywall ? client.createPaywallTracker(options.paywall) : null;
|
|
1621
|
+
const consent = {
|
|
1622
|
+
get: () => client.getConsent(),
|
|
1623
|
+
getState: () => client.getConsentState(),
|
|
1624
|
+
set: (granted, setOptions) => client.setConsent(granted, setOptions),
|
|
1625
|
+
optIn: (setOptions) => client.optIn(setOptions),
|
|
1626
|
+
optOut: (setOptions) => client.optOut(setOptions),
|
|
1627
|
+
setFullTracking: (granted, setOptions) => client.setFullTrackingConsent(granted, setOptions),
|
|
1628
|
+
optInFullTracking: (setOptions) => client.optInFullTracking(setOptions),
|
|
1629
|
+
optOutFullTracking: (setOptions) => client.optOutFullTracking(setOptions),
|
|
1630
|
+
isFullTrackingEnabled: () => client.isFullTrackingEnabled()
|
|
1631
|
+
};
|
|
1632
|
+
const user = {
|
|
1633
|
+
identify: (userId, traits) => client.identify(userId, traits),
|
|
1634
|
+
set: (userId, traits) => client.setUser(userId, traits),
|
|
1635
|
+
clear: () => client.clearUser()
|
|
1636
|
+
};
|
|
1637
|
+
return {
|
|
1638
|
+
client,
|
|
1639
|
+
get onboarding() {
|
|
1640
|
+
return onboardingTracker;
|
|
1641
|
+
},
|
|
1642
|
+
get paywall() {
|
|
1643
|
+
return paywallTracker;
|
|
1644
|
+
},
|
|
1645
|
+
consent,
|
|
1646
|
+
user,
|
|
1647
|
+
track: (eventName, properties) => client.track(eventName, properties),
|
|
1648
|
+
trackOnboardingEvent: (eventName, properties) => client.trackOnboardingEvent(eventName, properties),
|
|
1649
|
+
trackOnboardingSurveyResponse: (input, eventName) => client.trackOnboardingSurveyResponse(input, eventName),
|
|
1650
|
+
trackPaywallEvent: (eventName, properties) => client.trackPaywallEvent(eventName, properties),
|
|
1651
|
+
screen: (name, properties) => client.screen(name, properties),
|
|
1652
|
+
page: (name, properties) => client.page(name, properties),
|
|
1653
|
+
feedback: (message, rating, properties) => client.feedback(message, rating, properties),
|
|
1654
|
+
setContext: (context) => client.setContext(context),
|
|
1655
|
+
createOnboarding: (defaults) => client.createOnboardingTracker(defaults),
|
|
1656
|
+
createPaywall: (defaults) => client.createPaywallTracker(defaults),
|
|
1657
|
+
configureOnboarding: (defaults) => {
|
|
1658
|
+
onboardingTracker = client.createOnboardingTracker(defaults);
|
|
1659
|
+
return onboardingTracker;
|
|
1660
|
+
},
|
|
1661
|
+
configurePaywall: (defaults) => {
|
|
1662
|
+
paywallTracker = client.createPaywallTracker(defaults);
|
|
1663
|
+
return paywallTracker;
|
|
1664
|
+
},
|
|
1665
|
+
ready: () => client.ready(),
|
|
1666
|
+
flush: () => client.flush(),
|
|
1667
|
+
shutdown: () => client.shutdown()
|
|
1660
1668
|
};
|
|
1661
|
-
if (missingConfig.missingApiKey) {
|
|
1662
|
-
onMissingConfig?.(missingConfig);
|
|
1663
|
-
if (missingConfigMode === "throw") {
|
|
1664
|
-
throw new Error(toMissingMessage(missingConfig));
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
return new AnalyticsClient({
|
|
1668
|
-
...clientOptions,
|
|
1669
|
-
apiKey: resolvedApiKey
|
|
1670
|
-
});
|
|
1671
1669
|
};
|
|
1672
1670
|
|
|
1673
1671
|
// src/index.ts
|
|
1674
|
-
var
|
|
1672
|
+
var normalizeInitInput2 = (input) => {
|
|
1675
1673
|
if (typeof input === "string") {
|
|
1676
1674
|
return { apiKey: input };
|
|
1677
1675
|
}
|
|
@@ -1681,17 +1679,17 @@ var normalizeInitInput = (input) => {
|
|
|
1681
1679
|
return input;
|
|
1682
1680
|
};
|
|
1683
1681
|
var init = (input = {}) => {
|
|
1684
|
-
return new AnalyticsClient(
|
|
1682
|
+
return new AnalyticsClient(normalizeInitInput2(input));
|
|
1685
1683
|
};
|
|
1686
1684
|
var initConsentFirst = (input = {}) => {
|
|
1687
|
-
const normalized =
|
|
1685
|
+
const normalized = normalizeInitInput2(input);
|
|
1688
1686
|
return new AnalyticsClient({
|
|
1689
1687
|
...normalized,
|
|
1690
1688
|
initialConsentGranted: false
|
|
1691
1689
|
});
|
|
1692
1690
|
};
|
|
1693
1691
|
var initAsync = async (input = {}) => {
|
|
1694
|
-
const client = new AnalyticsClient(
|
|
1692
|
+
const client = new AnalyticsClient(normalizeInitInput2(input));
|
|
1695
1693
|
await client.ready();
|
|
1696
1694
|
return client;
|
|
1697
1695
|
};
|
|
@@ -1700,36 +1698,9 @@ var initConsentFirstAsync = async (input = {}) => {
|
|
|
1700
1698
|
await client.ready();
|
|
1701
1699
|
return client;
|
|
1702
1700
|
};
|
|
1703
|
-
var BROWSER_API_KEY_ENV_KEYS = [
|
|
1704
|
-
"ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1705
|
-
"NEXT_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1706
|
-
"PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1707
|
-
"VITE_ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1708
|
-
"EXPO_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY"
|
|
1709
|
-
];
|
|
1710
|
-
var REACT_NATIVE_API_KEY_ENV_KEYS = [
|
|
1711
|
-
"ANALYTICSCLI_PUBLISHABLE_API_KEY",
|
|
1712
|
-
"EXPO_PUBLIC_ANALYTICSCLI_PUBLISHABLE_API_KEY"
|
|
1713
|
-
];
|
|
1714
|
-
var initBrowserFromEnv = (options = {}) => {
|
|
1715
|
-
const { apiKeyEnvKeys, ...rest } = options;
|
|
1716
|
-
return initFromEnv({
|
|
1717
|
-
...rest,
|
|
1718
|
-
apiKeyEnvKeys: [...apiKeyEnvKeys ?? BROWSER_API_KEY_ENV_KEYS]
|
|
1719
|
-
});
|
|
1720
|
-
};
|
|
1721
|
-
var initReactNativeFromEnv = (options = {}) => {
|
|
1722
|
-
const { apiKeyEnvKeys, ...rest } = options;
|
|
1723
|
-
return initFromEnv({
|
|
1724
|
-
...rest,
|
|
1725
|
-
apiKeyEnvKeys: [...apiKeyEnvKeys ?? REACT_NATIVE_API_KEY_ENV_KEYS]
|
|
1726
|
-
});
|
|
1727
|
-
};
|
|
1728
1701
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1729
1702
|
0 && (module.exports = {
|
|
1730
1703
|
AnalyticsClient,
|
|
1731
|
-
BROWSER_API_KEY_ENV_KEYS,
|
|
1732
|
-
DEFAULT_API_KEY_ENV_KEYS,
|
|
1733
1704
|
ONBOARDING_EVENTS,
|
|
1734
1705
|
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
1735
1706
|
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -1740,12 +1711,9 @@ var initReactNativeFromEnv = (options = {}) => {
|
|
|
1740
1711
|
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
1741
1712
|
PURCHASE_EVENTS,
|
|
1742
1713
|
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
1743
|
-
|
|
1714
|
+
createAnalyticsContext,
|
|
1744
1715
|
init,
|
|
1745
1716
|
initAsync,
|
|
1746
|
-
initBrowserFromEnv,
|
|
1747
1717
|
initConsentFirst,
|
|
1748
|
-
initConsentFirstAsync
|
|
1749
|
-
initFromEnv,
|
|
1750
|
-
initReactNativeFromEnv
|
|
1718
|
+
initConsentFirstAsync
|
|
1751
1719
|
});
|
package/dist/react-native.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AnalyticsClient, AnalyticsClientOptions, AnalyticsConsentState,
|
|
1
|
+
export { AnalyticsClient, AnalyticsClientOptions, AnalyticsConsentState, AnalyticsContext, AnalyticsContextConsentControls, AnalyticsContextUserControls, AnalyticsStorageAdapter, CreateAnalyticsContextOptions, EventContext, EventProperties, IdentityTrackingMode, InitInput, InitOptions, ONBOARDING_EVENTS, ONBOARDING_PROGRESS_EVENT_ORDER, ONBOARDING_SCREEN_EVENT_PREFIXES, ONBOARDING_SURVEY_EVENTS, OnboardingEventName, OnboardingEventProperties, OnboardingStepTracker, OnboardingSurveyAnswerType, OnboardingSurveyEventName, OnboardingSurveyResponseInput, OnboardingTracker, OnboardingTrackerDefaults, OnboardingTrackerSurveyInput, PAYWALL_ANCHOR_EVENT_CANDIDATES, PAYWALL_EVENTS, PAYWALL_JOURNEY_EVENT_ORDER, PAYWALL_SKIP_EVENT_CANDIDATES, PURCHASE_EVENTS, PURCHASE_SUCCESS_EVENT_CANDIDATES, PaywallEventName, PaywallEventProperties, PaywallJourneyEventName, PaywallTracker, PaywallTrackerDefaults, PaywallTrackerProperties, PurchaseEventName, SetConsentOptions, createAnalyticsContext, init, initAsync, initConsentFirst, initConsentFirstAsync } from './index.cjs';
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AnalyticsClient, AnalyticsClientOptions, AnalyticsConsentState,
|
|
1
|
+
export { AnalyticsClient, AnalyticsClientOptions, AnalyticsConsentState, AnalyticsContext, AnalyticsContextConsentControls, AnalyticsContextUserControls, AnalyticsStorageAdapter, CreateAnalyticsContextOptions, EventContext, EventProperties, IdentityTrackingMode, InitInput, InitOptions, ONBOARDING_EVENTS, ONBOARDING_PROGRESS_EVENT_ORDER, ONBOARDING_SCREEN_EVENT_PREFIXES, ONBOARDING_SURVEY_EVENTS, OnboardingEventName, OnboardingEventProperties, OnboardingStepTracker, OnboardingSurveyAnswerType, OnboardingSurveyEventName, OnboardingSurveyResponseInput, OnboardingTracker, OnboardingTrackerDefaults, OnboardingTrackerSurveyInput, PAYWALL_ANCHOR_EVENT_CANDIDATES, PAYWALL_EVENTS, PAYWALL_JOURNEY_EVENT_ORDER, PAYWALL_SKIP_EVENT_CANDIDATES, PURCHASE_EVENTS, PURCHASE_SUCCESS_EVENT_CANDIDATES, PaywallEventName, PaywallEventProperties, PaywallJourneyEventName, PaywallTracker, PaywallTrackerDefaults, PaywallTrackerProperties, PurchaseEventName, SetConsentOptions, createAnalyticsContext, init, initAsync, initConsentFirst, initConsentFirstAsync } from './index.js';
|
package/dist/react-native.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AnalyticsClient,
|
|
3
|
-
BROWSER_API_KEY_ENV_KEYS,
|
|
4
|
-
DEFAULT_API_KEY_ENV_KEYS,
|
|
5
3
|
ONBOARDING_EVENTS,
|
|
6
4
|
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
7
5
|
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -12,19 +10,14 @@ import {
|
|
|
12
10
|
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
13
11
|
PURCHASE_EVENTS,
|
|
14
12
|
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
15
|
-
|
|
13
|
+
createAnalyticsContext,
|
|
16
14
|
init,
|
|
17
15
|
initAsync,
|
|
18
|
-
initBrowserFromEnv,
|
|
19
16
|
initConsentFirst,
|
|
20
|
-
initConsentFirstAsync
|
|
21
|
-
|
|
22
|
-
initReactNativeFromEnv
|
|
23
|
-
} from "./chunk-HL2VOD3Z.js";
|
|
17
|
+
initConsentFirstAsync
|
|
18
|
+
} from "./chunk-RGEYDN6A.js";
|
|
24
19
|
export {
|
|
25
20
|
AnalyticsClient,
|
|
26
|
-
BROWSER_API_KEY_ENV_KEYS,
|
|
27
|
-
DEFAULT_API_KEY_ENV_KEYS,
|
|
28
21
|
ONBOARDING_EVENTS,
|
|
29
22
|
ONBOARDING_PROGRESS_EVENT_ORDER,
|
|
30
23
|
ONBOARDING_SCREEN_EVENT_PREFIXES,
|
|
@@ -35,12 +28,9 @@ export {
|
|
|
35
28
|
PAYWALL_SKIP_EVENT_CANDIDATES,
|
|
36
29
|
PURCHASE_EVENTS,
|
|
37
30
|
PURCHASE_SUCCESS_EVENT_CANDIDATES,
|
|
38
|
-
|
|
31
|
+
createAnalyticsContext,
|
|
39
32
|
init,
|
|
40
33
|
initAsync,
|
|
41
|
-
initBrowserFromEnv,
|
|
42
34
|
initConsentFirst,
|
|
43
|
-
initConsentFirstAsync
|
|
44
|
-
initFromEnv,
|
|
45
|
-
initReactNativeFromEnv
|
|
35
|
+
initConsentFirstAsync
|
|
46
36
|
};
|
package/package.json
CHANGED