@ninetailed/experience.js 7.5.3 → 7.6.0-beta.2

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 (35) hide show
  1. package/index.cjs.d.ts +1 -0
  2. package/{index.cjs → index.cjs.js} +697 -375
  3. package/index.esm.js +1203 -0
  4. package/package.json +6 -9
  5. package/src/index.d.ts +1 -1
  6. package/src/lib/ElementSeenObserver.d.ts +1 -1
  7. package/src/lib/Ninetailed.d.ts +19 -5
  8. package/src/lib/NinetailedCorePlugin/NinetailedCorePlugin.d.ts +69 -0
  9. package/src/lib/{ninetailedCorePlugin → NinetailedCorePlugin}/index.d.ts +1 -1
  10. package/src/lib/constants.d.ts +1 -2
  11. package/src/lib/experience/makeExperienceSelectMiddleware.d.ts +9 -9
  12. package/src/lib/guards/hasComponentViewTrackingThreshold.d.ts +3 -0
  13. package/src/lib/guards/hasExperienceSelectionMiddleware.d.ts +1 -1
  14. package/src/lib/plugins/selectPluginsHavingExperienceSelectionMiddleware.d.ts +2 -2
  15. package/src/lib/plugins/selectPluginsHavingOnChangeEmitter.d.ts +1 -1
  16. package/src/lib/types/OnSelectVariant.d.ts +51 -0
  17. package/src/lib/types/index.d.ts +9 -9
  18. package/src/lib/types/interfaces/HasComponentViewTrackingThreshold.d.ts +3 -0
  19. package/src/lib/types/interfaces/HasExperienceSelectionMiddleware.d.ts +10 -10
  20. package/src/lib/types/interfaces/InterestedInHiddenPage.d.ts +1 -1
  21. package/src/lib/types/interfaces/InterestedInProfileChange.d.ts +1 -1
  22. package/src/lib/types/interfaces/InterestedInSeenElements.d.ts +1 -3
  23. package/src/lib/utils/EventBuilder.d.ts +221 -0
  24. package/src/lib/utils/noop.d.ts +1 -0
  25. package/index.js +0 -886
  26. package/src/lib/ninetailedCorePlugin/ninetailedCorePlugin.d.ts +0 -17
  27. package/src/lib/test-helpers/intersection-observer-test-helper.d.ts +0 -2
  28. package/src/lib/types/ElementSeenPayload.d.ts +0 -82
  29. package/src/lib/types/EventHandler.d.ts +0 -6
  30. package/src/lib/types/NinetailedPlugin.d.ts +0 -11
  31. package/src/lib/types/TrackingProperties.d.ts +0 -35
  32. /package/src/lib/{ninetailedCorePlugin → NinetailedCorePlugin}/Events/build-context.d.ts +0 -0
  33. /package/src/lib/{ninetailedCorePlugin → NinetailedCorePlugin}/Events/build-locale.d.ts +0 -0
  34. /package/src/lib/{ninetailedCorePlugin → NinetailedCorePlugin}/Events/index.d.ts +0 -0
  35. /package/src/lib/{ninetailedCorePlugin → NinetailedCorePlugin}/constants.d.ts +0 -0
@@ -1,17 +0,0 @@
1
- import { Locale, NinetailedApiClient, NinetailedRequestContext } from '@ninetailed/experience.js-shared';
2
- import { NinetailedInstance, FlushResult, NinetailedPlugin } from '../types';
3
- export type OnInitProfileId = (profileId?: string) => Promise<string | undefined> | string | undefined;
4
- type AnalyticsPluginNinetailedConfig = {
5
- apiClient: NinetailedApiClient;
6
- locale?: Locale;
7
- requestTimeout?: number;
8
- onInitProfileId?: OnInitProfileId;
9
- buildClientContext?: () => NinetailedRequestContext;
10
- ninetailed: NinetailedInstance;
11
- };
12
- export declare const PLUGIN_NAME = "ninetailed";
13
- export interface NinetailedCorePlugin extends NinetailedPlugin {
14
- flush: () => Promise<FlushResult>;
15
- }
16
- export declare const ninetailedCorePlugin: ({ apiClient, locale, ninetailed, onInitProfileId, buildClientContext, }: AnalyticsPluginNinetailedConfig) => NinetailedCorePlugin;
17
- export {};
@@ -1,2 +0,0 @@
1
- export declare function intersect(element: Element, isIntersecting: boolean): void;
2
- export declare function getObserverOf(element: Element): IntersectionObserver;
@@ -1,82 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ElementSeenPayloadSchema: z.ZodObject<{
3
- element: z.ZodAny;
4
- experience: z.ZodNullable<z.ZodOptional<z.ZodObject<{
5
- id: z.ZodString;
6
- type: z.ZodUnion<[z.ZodLiteral<"nt_experiment">, z.ZodLiteral<"nt_personalization">]>;
7
- name: z.ZodOptional<z.ZodString>;
8
- description: z.ZodOptional<z.ZodString>;
9
- }, "strip", z.ZodTypeAny, {
10
- id: string;
11
- type: "nt_experiment" | "nt_personalization";
12
- name?: string | undefined;
13
- description?: string | undefined;
14
- }, {
15
- id: string;
16
- type: "nt_experiment" | "nt_personalization";
17
- name?: string | undefined;
18
- description?: string | undefined;
19
- }>>>;
20
- audience: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodObject<{
21
- id: z.ZodString;
22
- name: z.ZodOptional<z.ZodString>;
23
- description: z.ZodOptional<z.ZodString>;
24
- }, "strip", z.ZodTypeAny, {
25
- id: string;
26
- name?: string | undefined;
27
- description?: string | undefined;
28
- }, {
29
- id: string;
30
- name?: string | undefined;
31
- description?: string | undefined;
32
- }>>>>;
33
- variant: z.ZodObject<{
34
- id: z.ZodString;
35
- }, "strip", z.ZodUnknown, z.objectOutputType<{
36
- id: z.ZodString;
37
- }, z.ZodUnknown, "strip">, z.objectInputType<{
38
- id: z.ZodString;
39
- }, z.ZodUnknown, "strip">>;
40
- variantIndex: z.ZodNumber;
41
- }, "strip", z.ZodTypeAny, {
42
- audience: {
43
- id: string;
44
- name?: string | undefined;
45
- description?: string | undefined;
46
- } | null;
47
- variant: {
48
- id: string;
49
- } & {
50
- [k: string]: unknown;
51
- };
52
- variantIndex: number;
53
- element?: any;
54
- experience?: {
55
- id: string;
56
- type: "nt_experiment" | "nt_personalization";
57
- name?: string | undefined;
58
- description?: string | undefined;
59
- } | null | undefined;
60
- }, {
61
- variant: {
62
- id: string;
63
- } & {
64
- [k: string]: unknown;
65
- };
66
- variantIndex: number;
67
- element?: any;
68
- experience?: {
69
- id: string;
70
- type: "nt_experiment" | "nt_personalization";
71
- name?: string | undefined;
72
- description?: string | undefined;
73
- } | null | undefined;
74
- audience?: {
75
- id: string;
76
- name?: string | undefined;
77
- description?: string | undefined;
78
- } | null | undefined;
79
- }>;
80
- export type ElementSeenPayload = Omit<z.input<typeof ElementSeenPayloadSchema>, 'element'> & {
81
- element: Element;
82
- };
@@ -1,6 +0,0 @@
1
- import { AnalyticsInstance } from './AnalyticsInstance';
2
- export type EventHandlerParams<T = unknown> = {
3
- payload: T;
4
- instance: AnalyticsInstance;
5
- };
6
- export type EventHandler<T = unknown> = (params: EventHandlerParams<T>) => void;
@@ -1,11 +0,0 @@
1
- import { AnalyticsPlugin } from 'analytics';
2
- import { AnalyticsInstance } from './AnalyticsInstance';
3
- export type EventHandlerParams<T = unknown> = {
4
- payload: T;
5
- instance: AnalyticsInstance;
6
- };
7
- export type EventHandler<T = unknown> = (params: EventHandlerParams<T>) => void;
8
- export declare abstract class NinetailedPlugin implements AnalyticsPlugin {
9
- [x: string]: unknown;
10
- abstract readonly name: string;
11
- }
@@ -1,35 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const TrackComponentProperties: z.ZodObject<{
3
- variant: z.ZodObject<{
4
- id: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- id: string;
7
- }, {
8
- id: string;
9
- }>;
10
- audience: z.ZodObject<{
11
- id: z.ZodString;
12
- }, "strip", z.ZodTypeAny, {
13
- id: string;
14
- }, {
15
- id: string;
16
- }>;
17
- isPersonalized: z.ZodBoolean;
18
- }, "strip", z.ZodTypeAny, {
19
- variant: {
20
- id: string;
21
- };
22
- audience: {
23
- id: string;
24
- };
25
- isPersonalized: boolean;
26
- }, {
27
- variant: {
28
- id: string;
29
- };
30
- audience: {
31
- id: string;
32
- };
33
- isPersonalized: boolean;
34
- }>;
35
- export type TrackComponentProperties = z.infer<typeof TrackComponentProperties>;