@walkeros/web-source-browser 0.2.1 → 0.3.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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,60 @@
1
1
  import * as _walkeros_core from '@walkeros/core';
2
- import { Elb, WalkerOS, Collector, Source } from '@walkeros/core';
2
+ import { z, Elb, WalkerOS, Collector, Source } from '@walkeros/core';
3
3
  import { DestinationWeb, SessionConfig, SessionCallback, Walker } from '@walkeros/web-core';
4
4
 
5
+ /**
6
+ * Data attribute prefix
7
+ * Used for DOM event tracking
8
+ */
9
+ declare const DataAttributePrefix: z.ZodString;
10
+ /**
11
+ * JavaScript variable name
12
+ * Used for global function names
13
+ */
14
+ declare const JavaScriptVarName: z.ZodString;
15
+ /**
16
+ * DOM scope selector
17
+ * Note: Runtime type is Element | Document (non-serializable)
18
+ */
19
+ declare const ScopeSelector: z.ZodOptional<z.ZodString>;
20
+
21
+ /**
22
+ * Browser source settings schema
23
+ */
24
+ declare const SettingsSchema: z.ZodObject<{
25
+ prefix: z.ZodDefault<z.ZodString>;
26
+ scope: z.ZodOptional<z.ZodString>;
27
+ pageview: z.ZodDefault<z.ZodBoolean>;
28
+ session: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodAny]>>;
29
+ elb: z.ZodDefault<z.ZodString>;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ elbLayer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodAny]>>;
32
+ }, z.core.$strip>;
33
+ type Settings$1 = z.infer<typeof SettingsSchema>;
34
+
35
+ /**
36
+ * Tagger configuration schema
37
+ * Used for automatic data attribute generation
38
+ */
39
+ declare const TaggerSchema: z.ZodObject<{
40
+ prefix: z.ZodDefault<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ type TaggerConfig$1 = z.infer<typeof TaggerSchema>;
43
+
44
+ declare const settings: _walkeros_core.JSONSchema;
45
+ declare const tagger: _walkeros_core.JSONSchema;
46
+
47
+ declare const index$2_DataAttributePrefix: typeof DataAttributePrefix;
48
+ declare const index$2_JavaScriptVarName: typeof JavaScriptVarName;
49
+ declare const index$2_ScopeSelector: typeof ScopeSelector;
50
+ declare const index$2_SettingsSchema: typeof SettingsSchema;
51
+ declare const index$2_TaggerSchema: typeof TaggerSchema;
52
+ declare const index$2_settings: typeof settings;
53
+ declare const index$2_tagger: typeof tagger;
54
+ declare namespace index$2 {
55
+ export { index$2_DataAttributePrefix as DataAttributePrefix, index$2_JavaScriptVarName as JavaScriptVarName, index$2_ScopeSelector as ScopeSelector, type Settings$1 as Settings, index$2_SettingsSchema as SettingsSchema, type TaggerConfig$1 as TaggerConfig, index$2_TaggerSchema as TaggerSchema, index$2_settings as settings, index$2_tagger as tagger };
56
+ }
57
+
5
58
  type Scope$1 = Element | Document;
6
59
  type Trigger = string;
7
60
  interface BrowserPush<R = Promise<Elb.PushResult>> {
@@ -26,20 +79,15 @@ type CommandRun<R = Promise<Elb.PushResult>> = (event: 'walker run', state?: Par
26
79
  type PushResult = Elb.PushResult;
27
80
  type Layer = Elb.Layer | IArguments;
28
81
 
29
- interface InitSettings extends Record<string, unknown> {
30
- prefix?: string;
82
+ type BaseSettings = z.infer<typeof SettingsSchema>;
83
+ interface InitSettings extends Partial<Omit<BaseSettings, 'scope' | 'session' | 'elbLayer'>> {
31
84
  scope?: Element | Document;
32
- pageview?: boolean;
33
85
  session?: boolean | SessionConfig;
34
- elb?: string;
35
86
  elbLayer?: boolean | string | Elb.Layer;
36
87
  }
37
- interface Settings extends Record<string, unknown> {
38
- prefix: string;
88
+ interface Settings extends Omit<BaseSettings, 'scope' | 'session' | 'elbLayer'> {
39
89
  scope?: Element | Document;
40
- pageview: boolean;
41
90
  session: boolean | SessionConfig;
42
- elb: string;
43
91
  elbLayer: boolean | string | Elb.Layer;
44
92
  }
45
93
  interface Mapping {
@@ -143,4 +191,4 @@ declare function createTagger(config?: TaggerConfig): (entity?: string) => Tagge
143
191
  */
144
192
  declare const sourceBrowser: Source.Init<Types>;
145
193
 
146
- export { index$1 as SourceBrowser, type TaggerConfig, type TaggerInstance, createTagger, sourceBrowser as default, index as examples, getAllEvents, getElbAttributeName, getElbValues, getEvents, getGlobals, sourceBrowser };
194
+ export { index$1 as SourceBrowser, type TaggerConfig, type TaggerInstance, createTagger, sourceBrowser as default, index as examples, getAllEvents, getElbAttributeName, getElbValues, getEvents, getGlobals, index$2 as schemas, sourceBrowser };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,60 @@
1
1
  import * as _walkeros_core from '@walkeros/core';
2
- import { Elb, WalkerOS, Collector, Source } from '@walkeros/core';
2
+ import { z, Elb, WalkerOS, Collector, Source } from '@walkeros/core';
3
3
  import { DestinationWeb, SessionConfig, SessionCallback, Walker } from '@walkeros/web-core';
4
4
 
5
+ /**
6
+ * Data attribute prefix
7
+ * Used for DOM event tracking
8
+ */
9
+ declare const DataAttributePrefix: z.ZodString;
10
+ /**
11
+ * JavaScript variable name
12
+ * Used for global function names
13
+ */
14
+ declare const JavaScriptVarName: z.ZodString;
15
+ /**
16
+ * DOM scope selector
17
+ * Note: Runtime type is Element | Document (non-serializable)
18
+ */
19
+ declare const ScopeSelector: z.ZodOptional<z.ZodString>;
20
+
21
+ /**
22
+ * Browser source settings schema
23
+ */
24
+ declare const SettingsSchema: z.ZodObject<{
25
+ prefix: z.ZodDefault<z.ZodString>;
26
+ scope: z.ZodOptional<z.ZodString>;
27
+ pageview: z.ZodDefault<z.ZodBoolean>;
28
+ session: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodAny]>>;
29
+ elb: z.ZodDefault<z.ZodString>;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ elbLayer: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodAny]>>;
32
+ }, z.core.$strip>;
33
+ type Settings$1 = z.infer<typeof SettingsSchema>;
34
+
35
+ /**
36
+ * Tagger configuration schema
37
+ * Used for automatic data attribute generation
38
+ */
39
+ declare const TaggerSchema: z.ZodObject<{
40
+ prefix: z.ZodDefault<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ type TaggerConfig$1 = z.infer<typeof TaggerSchema>;
43
+
44
+ declare const settings: _walkeros_core.JSONSchema;
45
+ declare const tagger: _walkeros_core.JSONSchema;
46
+
47
+ declare const index$2_DataAttributePrefix: typeof DataAttributePrefix;
48
+ declare const index$2_JavaScriptVarName: typeof JavaScriptVarName;
49
+ declare const index$2_ScopeSelector: typeof ScopeSelector;
50
+ declare const index$2_SettingsSchema: typeof SettingsSchema;
51
+ declare const index$2_TaggerSchema: typeof TaggerSchema;
52
+ declare const index$2_settings: typeof settings;
53
+ declare const index$2_tagger: typeof tagger;
54
+ declare namespace index$2 {
55
+ export { index$2_DataAttributePrefix as DataAttributePrefix, index$2_JavaScriptVarName as JavaScriptVarName, index$2_ScopeSelector as ScopeSelector, type Settings$1 as Settings, index$2_SettingsSchema as SettingsSchema, type TaggerConfig$1 as TaggerConfig, index$2_TaggerSchema as TaggerSchema, index$2_settings as settings, index$2_tagger as tagger };
56
+ }
57
+
5
58
  type Scope$1 = Element | Document;
6
59
  type Trigger = string;
7
60
  interface BrowserPush<R = Promise<Elb.PushResult>> {
@@ -26,20 +79,15 @@ type CommandRun<R = Promise<Elb.PushResult>> = (event: 'walker run', state?: Par
26
79
  type PushResult = Elb.PushResult;
27
80
  type Layer = Elb.Layer | IArguments;
28
81
 
29
- interface InitSettings extends Record<string, unknown> {
30
- prefix?: string;
82
+ type BaseSettings = z.infer<typeof SettingsSchema>;
83
+ interface InitSettings extends Partial<Omit<BaseSettings, 'scope' | 'session' | 'elbLayer'>> {
31
84
  scope?: Element | Document;
32
- pageview?: boolean;
33
85
  session?: boolean | SessionConfig;
34
- elb?: string;
35
86
  elbLayer?: boolean | string | Elb.Layer;
36
87
  }
37
- interface Settings extends Record<string, unknown> {
38
- prefix: string;
88
+ interface Settings extends Omit<BaseSettings, 'scope' | 'session' | 'elbLayer'> {
39
89
  scope?: Element | Document;
40
- pageview: boolean;
41
90
  session: boolean | SessionConfig;
42
- elb: string;
43
91
  elbLayer: boolean | string | Elb.Layer;
44
92
  }
45
93
  interface Mapping {
@@ -143,4 +191,4 @@ declare function createTagger(config?: TaggerConfig): (entity?: string) => Tagge
143
191
  */
144
192
  declare const sourceBrowser: Source.Init<Types>;
145
193
 
146
- export { index$1 as SourceBrowser, type TaggerConfig, type TaggerInstance, createTagger, sourceBrowser as default, index as examples, getAllEvents, getElbAttributeName, getElbValues, getEvents, getGlobals, sourceBrowser };
194
+ export { index$1 as SourceBrowser, type TaggerConfig, type TaggerInstance, createTagger, sourceBrowser as default, index as examples, getAllEvents, getElbAttributeName, getElbValues, getEvents, getGlobals, index$2 as schemas, sourceBrowser };