@convertcom/js-sdk-rules 1.0.0 → 1.0.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 (156) hide show
  1. package/README.md +11 -0
  2. package/lib/{legacy/rules/src/rule-manager.d.ts → index.d.ts} +27 -4
  3. package/lib/index.js +59 -32
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.min.js +1 -1
  6. package/lib/index.min.mjs +1 -1
  7. package/lib/index.mjs +60 -33
  8. package/lib/index.mjs.map +1 -1
  9. package/lib/legacy/index.js +73 -46
  10. package/lib/legacy/index.js.map +1 -1
  11. package/lib/legacy/index.min.js +1 -1
  12. package/lib/package.json +7 -1
  13. package/package.json +2 -7
  14. package/lib/enums/index.d.ts +0 -29
  15. package/lib/enums/src/audience-type.d.ts +0 -11
  16. package/lib/enums/src/data-enitites.d.ts +0 -7
  17. package/lib/enums/src/dictionary.d.ts +0 -60
  18. package/lib/enums/src/do-not-track.d.ts +0 -12
  19. package/lib/enums/src/event-type.d.ts +0 -10
  20. package/lib/enums/src/experience-type.d.ts +0 -16
  21. package/lib/enums/src/feature-status.d.ts +0 -10
  22. package/lib/enums/src/ga-type.d.ts +0 -10
  23. package/lib/enums/src/goal-data-key.d.ts +0 -11
  24. package/lib/enums/src/goal-type.d.ts +0 -22
  25. package/lib/enums/src/integration-provider.d.ts +0 -27
  26. package/lib/enums/src/log-level.d.ts +0 -14
  27. package/lib/enums/src/log-method.d.ts +0 -14
  28. package/lib/enums/src/project-type.d.ts +0 -10
  29. package/lib/enums/src/rule-error.d.ts +0 -10
  30. package/lib/enums/src/segments/browser-type.d.ts +0 -17
  31. package/lib/enums/src/segments/device-type.d.ts +0 -16
  32. package/lib/enums/src/segments/segments-keys.d.ts +0 -15
  33. package/lib/enums/src/segments/source-type.d.ts +0 -12
  34. package/lib/enums/src/segments/visitor-type.d.ts +0 -10
  35. package/lib/enums/src/system-events.d.ts +0 -22
  36. package/lib/enums/src/variable-types.d.ts +0 -7
  37. package/lib/enums/src/variation-change-type.d.ts +0 -14
  38. package/lib/legacy/enums/index.d.ts +0 -29
  39. package/lib/legacy/enums/src/audience-type.d.ts +0 -11
  40. package/lib/legacy/enums/src/data-enitites.d.ts +0 -7
  41. package/lib/legacy/enums/src/dictionary.d.ts +0 -60
  42. package/lib/legacy/enums/src/do-not-track.d.ts +0 -12
  43. package/lib/legacy/enums/src/event-type.d.ts +0 -10
  44. package/lib/legacy/enums/src/experience-type.d.ts +0 -16
  45. package/lib/legacy/enums/src/feature-status.d.ts +0 -10
  46. package/lib/legacy/enums/src/ga-type.d.ts +0 -10
  47. package/lib/legacy/enums/src/goal-data-key.d.ts +0 -11
  48. package/lib/legacy/enums/src/goal-type.d.ts +0 -22
  49. package/lib/legacy/enums/src/integration-provider.d.ts +0 -27
  50. package/lib/legacy/enums/src/log-level.d.ts +0 -14
  51. package/lib/legacy/enums/src/log-method.d.ts +0 -14
  52. package/lib/legacy/enums/src/project-type.d.ts +0 -10
  53. package/lib/legacy/enums/src/rule-error.d.ts +0 -10
  54. package/lib/legacy/enums/src/segments/browser-type.d.ts +0 -17
  55. package/lib/legacy/enums/src/segments/device-type.d.ts +0 -16
  56. package/lib/legacy/enums/src/segments/segments-keys.d.ts +0 -15
  57. package/lib/legacy/enums/src/segments/source-type.d.ts +0 -12
  58. package/lib/legacy/enums/src/segments/visitor-type.d.ts +0 -10
  59. package/lib/legacy/enums/src/system-events.d.ts +0 -22
  60. package/lib/legacy/enums/src/variable-types.d.ts +0 -7
  61. package/lib/legacy/enums/src/variation-change-type.d.ts +0 -14
  62. package/lib/legacy/logger/index.d.ts +0 -8
  63. package/lib/legacy/logger/src/interfaces/log-client.d.ts +0 -13
  64. package/lib/legacy/logger/src/interfaces/log-manager.d.ts +0 -18
  65. package/lib/legacy/logger/src/interfaces/log-method-map.d.ts +0 -15
  66. package/lib/legacy/logger/src/log-manager.d.ts +0 -64
  67. package/lib/legacy/rules/index.d.ts +0 -8
  68. package/lib/legacy/rules/src/interfaces/rule-manager.d.ts +0 -14
  69. package/lib/legacy/types/index.d.ts +0 -36
  70. package/lib/legacy/types/src/Audience.d.ts +0 -16
  71. package/lib/legacy/types/src/BucketedFeature.d.ts +0 -30
  72. package/lib/legacy/types/src/BucketedVariation.d.ts +0 -13
  73. package/lib/legacy/types/src/BucketingAttributes.d.ts +0 -13
  74. package/lib/legacy/types/src/Config.d.ts +0 -62
  75. package/lib/legacy/types/src/ConversionAttributes.d.ts +0 -11
  76. package/lib/legacy/types/src/Entity.d.ts +0 -13
  77. package/lib/legacy/types/src/Experience.d.ts +0 -37
  78. package/lib/legacy/types/src/Feature.d.ts +0 -18
  79. package/lib/legacy/types/src/Goal.d.ts +0 -30
  80. package/lib/legacy/types/src/Id.d.ts +0 -10
  81. package/lib/legacy/types/src/IndentityField.d.ts +0 -7
  82. package/lib/legacy/types/src/Integration.d.ts +0 -16
  83. package/lib/legacy/types/src/Location.d.ts +0 -14
  84. package/lib/legacy/types/src/Path.d.ts +0 -10
  85. package/lib/legacy/types/src/Project.d.ts +0 -37
  86. package/lib/legacy/types/src/RequireAtLeastOne.d.ts +0 -3
  87. package/lib/legacy/types/src/Rule.d.ts +0 -24
  88. package/lib/legacy/types/src/Segments.d.ts +0 -14
  89. package/lib/legacy/types/src/SegmentsAttributes.d.ts +0 -9
  90. package/lib/legacy/types/src/SegmentsData.d.ts +0 -16
  91. package/lib/legacy/types/src/StoreData.d.ts +0 -14
  92. package/lib/legacy/types/src/TrackingEvent.d.ts +0 -14
  93. package/lib/legacy/types/src/VariableType.d.ts +0 -8
  94. package/lib/legacy/types/src/Variation.d.ts +0 -49
  95. package/lib/legacy/types/src/VisitorsQueue.d.ts +0 -16
  96. package/lib/legacy/types/src/tracking/BucketingEvent.d.ts +0 -11
  97. package/lib/legacy/types/src/tracking/ConversionEvent.d.ts +0 -16
  98. package/lib/legacy/types/src/tracking/Visitor.d.ts +0 -14
  99. package/lib/legacy/types/src/tracking/VisitorEvent.d.ts +0 -13
  100. package/lib/legacy/utils/index.d.ts +0 -14
  101. package/lib/legacy/utils/src/array-utils.d.ts +0 -11
  102. package/lib/legacy/utils/src/comparisons.d.ts +0 -22
  103. package/lib/legacy/utils/src/data-store.d.ts +0 -39
  104. package/lib/legacy/utils/src/file-logger.d.ts +0 -40
  105. package/lib/legacy/utils/src/http-client.d.ts +0 -102
  106. package/lib/legacy/utils/src/object-utils.d.ts +0 -28
  107. package/lib/legacy/utils/src/string-utils.d.ts +0 -20
  108. package/lib/legacy/utils/src/types-utils.d.ts +0 -12
  109. package/lib/logger/index.d.ts +0 -8
  110. package/lib/logger/src/interfaces/log-client.d.ts +0 -13
  111. package/lib/logger/src/interfaces/log-manager.d.ts +0 -18
  112. package/lib/logger/src/interfaces/log-method-map.d.ts +0 -15
  113. package/lib/logger/src/log-manager.d.ts +0 -64
  114. package/lib/rules/index.d.ts +0 -8
  115. package/lib/rules/src/interfaces/rule-manager.d.ts +0 -14
  116. package/lib/rules/src/rule-manager.d.ts +0 -75
  117. package/lib/types/index.d.ts +0 -36
  118. package/lib/types/src/Audience.d.ts +0 -16
  119. package/lib/types/src/BucketedFeature.d.ts +0 -30
  120. package/lib/types/src/BucketedVariation.d.ts +0 -13
  121. package/lib/types/src/BucketingAttributes.d.ts +0 -13
  122. package/lib/types/src/Config.d.ts +0 -62
  123. package/lib/types/src/ConversionAttributes.d.ts +0 -11
  124. package/lib/types/src/Entity.d.ts +0 -13
  125. package/lib/types/src/Experience.d.ts +0 -37
  126. package/lib/types/src/Feature.d.ts +0 -18
  127. package/lib/types/src/Goal.d.ts +0 -30
  128. package/lib/types/src/Id.d.ts +0 -10
  129. package/lib/types/src/IndentityField.d.ts +0 -7
  130. package/lib/types/src/Integration.d.ts +0 -16
  131. package/lib/types/src/Location.d.ts +0 -14
  132. package/lib/types/src/Path.d.ts +0 -10
  133. package/lib/types/src/Project.d.ts +0 -37
  134. package/lib/types/src/RequireAtLeastOne.d.ts +0 -3
  135. package/lib/types/src/Rule.d.ts +0 -24
  136. package/lib/types/src/Segments.d.ts +0 -14
  137. package/lib/types/src/SegmentsAttributes.d.ts +0 -9
  138. package/lib/types/src/SegmentsData.d.ts +0 -16
  139. package/lib/types/src/StoreData.d.ts +0 -14
  140. package/lib/types/src/TrackingEvent.d.ts +0 -14
  141. package/lib/types/src/VariableType.d.ts +0 -8
  142. package/lib/types/src/Variation.d.ts +0 -49
  143. package/lib/types/src/VisitorsQueue.d.ts +0 -16
  144. package/lib/types/src/tracking/BucketingEvent.d.ts +0 -11
  145. package/lib/types/src/tracking/ConversionEvent.d.ts +0 -16
  146. package/lib/types/src/tracking/Visitor.d.ts +0 -14
  147. package/lib/types/src/tracking/VisitorEvent.d.ts +0 -13
  148. package/lib/utils/index.d.ts +0 -14
  149. package/lib/utils/src/array-utils.d.ts +0 -11
  150. package/lib/utils/src/comparisons.d.ts +0 -22
  151. package/lib/utils/src/data-store.d.ts +0 -39
  152. package/lib/utils/src/file-logger.d.ts +0 -40
  153. package/lib/utils/src/http-client.d.ts +0 -102
  154. package/lib/utils/src/object-utils.d.ts +0 -28
  155. package/lib/utils/src/string-utils.d.ts +0 -20
  156. package/lib/utils/src/types-utils.d.ts +0 -12
@@ -1,37 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { ExperienceType } from '@convertcom/js-sdk-enums';
8
- import { Id } from './Id';
9
- import { RuleSet } from './Rule';
10
- import { Variation } from './Variation';
11
- import { Integration } from './Integration';
12
- export type MultipagePages = {
13
- id: Id;
14
- url: string;
15
- };
16
- export type Experience = {
17
- id: Id;
18
- name: string;
19
- key: string;
20
- site_area?: RuleSet;
21
- locations?: Array<Id>;
22
- audiences?: Array<Id>;
23
- goals?: Array<Id>;
24
- type: ExperienceType;
25
- version: number;
26
- url: string;
27
- global_js?: string;
28
- global_css?: string;
29
- multipage_pages?: Array<MultipagePages>;
30
- variations: Array<Variation>;
31
- environments: Array<string>;
32
- settings?: {
33
- min_order_value?: number;
34
- max_order_value?: number;
35
- };
36
- integrations?: Array<Integration>;
37
- };
@@ -1,18 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from './Id';
8
- import { VariableType } from './VariableType';
9
- export type FeatureVariableDefinition = {
10
- key: string;
11
- type?: VariableType;
12
- };
13
- export type Feature = {
14
- id: Id;
15
- name: string;
16
- key: string;
17
- variables: Array<FeatureVariableDefinition>;
18
- };
@@ -1,30 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { RuleSet } from './Rule';
8
- import { Id } from './Id';
9
- import { GoalType, GoalRevenueTriggeringType } from '@convertcom/js-sdk-enums';
10
- export type GoalTrackedItem = {
11
- event: string;
12
- selector: string;
13
- };
14
- export type GoalSettings = {
15
- percentage?: number;
16
- tracked_items?: Array<GoalTrackedItem>;
17
- triggering_type?: GoalRevenueTriggeringType;
18
- selector?: string;
19
- href?: string;
20
- action?: string;
21
- ga_event?: string;
22
- };
23
- export type Goal = {
24
- id: Id;
25
- rules?: RuleSet;
26
- type: GoalType;
27
- settings?: GoalSettings;
28
- name: string;
29
- key: string;
30
- };
@@ -1,10 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- /**
8
- * A type which describes identification. String or number
9
- */
10
- export type Id = string | number;
@@ -1,7 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export type IdentityField = 'id' | 'key';
@@ -1,16 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { GoogleAnalyticsType, IntegrationProvider } from '@convertcom/js-sdk-enums';
8
- export type Integration = {
9
- provider: IntegrationProvider;
10
- enabled?: boolean;
11
- custom_dimension?: string;
12
- type?: GoogleAnalyticsType;
13
- measurementId?: string;
14
- property_UA?: string;
15
- evar?: string;
16
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { RuleSet } from './Rule';
8
- import { Id } from './Id';
9
- export type Location = {
10
- id: Id;
11
- name: string;
12
- key: string;
13
- rules: RuleSet;
14
- };
@@ -1,10 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export type Path = {
8
- base: string;
9
- route: string;
10
- };
@@ -1,37 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from './Id';
8
- import { DoNotTrack, GoogleAnalyticsType, ProjectType } from '@convertcom/js-sdk-enums';
9
- export type Project = {
10
- id: Id;
11
- name: string;
12
- type: ProjectType;
13
- environments: Record<string, string>;
14
- utc_offset: number;
15
- domains: Array<Record<string, any>>;
16
- global_javascript?: string | ((...args: any) => any | undefined);
17
- settings: {
18
- auto_link: boolean;
19
- data_anonymization: boolean;
20
- do_not_track: DoNotTrack;
21
- include_jquery: boolean;
22
- min_order_value?: number;
23
- max_order_value?: number;
24
- integrations?: {
25
- google_analytics?: {
26
- enabled: boolean;
27
- type: GoogleAnalyticsType;
28
- measurementId?: string;
29
- property_UA?: string;
30
- auto_revenue_tracking: boolean;
31
- };
32
- kissmetrics?: {
33
- enabled: boolean;
34
- };
35
- };
36
- };
37
- };
@@ -1,3 +0,0 @@
1
- export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
2
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
3
- }[Keys];
@@ -1,24 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export type Rule = {
8
- rule_type?: string;
9
- key?: string;
10
- matching: {
11
- match_type: string;
12
- negated?: boolean;
13
- };
14
- value: string | number | boolean | ((...args: any) => any | undefined);
15
- };
16
- export type RuleOrWhen = {
17
- OR_WHEN: Array<Rule>;
18
- };
19
- export type RuleAnd = {
20
- AND: Array<RuleOrWhen>;
21
- };
22
- export type RuleSet = {
23
- OR: Array<RuleAnd>;
24
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { RuleSet } from './Rule';
8
- import { Id } from './Id';
9
- export type Segments = {
10
- id: Id;
11
- rules: RuleSet;
12
- name: string;
13
- key: string;
14
- };
@@ -1,9 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export type SegmentsAttributes = {
8
- ruleData?: Record<string, any>;
9
- };
@@ -1,16 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { BrowserType, DeviceType, SegmentsKeys, SourceType, VisitorType } from '@convertcom/js-sdk-enums';
8
- export type SegmentsData = {
9
- [SegmentsKeys.COUNTRY]?: string;
10
- [SegmentsKeys.BROWSER]?: BrowserType;
11
- [SegmentsKeys.DEVICES]?: Array<DeviceType>;
12
- [SegmentsKeys.SOURCE]?: SourceType;
13
- [SegmentsKeys.CAMPAIGN]?: string;
14
- [SegmentsKeys.VISITOR_TYPE]?: VisitorType;
15
- [SegmentsKeys.CUSTOM_SEGMENTS]?: Array<string>;
16
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from './Id';
8
- import { SegmentsData } from './SegmentsData';
9
- export type StoreData = {
10
- bucketing?: Record<string, Id>;
11
- locations?: Array<Id>;
12
- segments?: SegmentsData;
13
- goals?: Record<string, boolean>;
14
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from './Id';
8
- import { Visitor } from './tracking/Visitor';
9
- export type TrackingEvent = {
10
- accountId?: Id;
11
- projectId?: Id;
12
- enrichData?: boolean;
13
- visitors: Array<Visitor>;
14
- };
@@ -1,8 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { VARIABLE_TYPES } from '@convertcom/js-sdk-enums';
8
- export type VariableType = (typeof VARIABLE_TYPES)[number];
@@ -1,49 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { VariationChangeType } from '@convertcom/js-sdk-enums';
8
- import { Id } from './Id';
9
- export type RichStructureChange = {
10
- js?: string;
11
- selector: string;
12
- page_id: string;
13
- };
14
- export type CustomCodeChange = {
15
- css?: string;
16
- js?: string;
17
- page_id: string;
18
- };
19
- export type DefaultCodeChange = {
20
- css?: string;
21
- js?: string;
22
- custom_js?: string;
23
- };
24
- export type DefaultCodeMultipageChange = {
25
- css?: string;
26
- js?: string;
27
- custom_js?: string;
28
- page_id: string;
29
- };
30
- export type DefaultRedirectChange = {
31
- original_pattern: string;
32
- variation_pattern: string;
33
- };
34
- export type FullStackFeatureChange = {
35
- feature_id: Id;
36
- variables_data: Record<string, any>;
37
- };
38
- export type VariationChange = {
39
- id: Id;
40
- type: VariationChangeType;
41
- data: RichStructureChange | CustomCodeChange | DefaultCodeChange | DefaultCodeMultipageChange | DefaultRedirectChange | FullStackFeatureChange;
42
- };
43
- export type Variation = {
44
- id: Id;
45
- key: string;
46
- name: string;
47
- changes: Array<VariationChange>;
48
- traffic_allocation?: number;
49
- };
@@ -1,16 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from './Id';
8
- import { SegmentsData } from './SegmentsData';
9
- import { Visitor } from './tracking/Visitor';
10
- import { VisitorEvent } from './tracking/VisitorEvent';
11
- export type VisitorsQueue = {
12
- length: number;
13
- items: Array<Visitor>;
14
- push: (visitorId: Id, eventRequest: VisitorEvent, segments?: SegmentsData) => void;
15
- reset: () => void;
16
- };
@@ -1,11 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from '../Id';
8
- export type BucketingEvent = {
9
- experienceId: Id;
10
- variationId: Id;
11
- };
@@ -1,16 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { GoalDataKey } from '@convertcom/js-sdk-enums';
8
- import { Id } from '../Id';
9
- export type GoalData = {
10
- [key in GoalDataKey]?: Id;
11
- };
12
- export type ConversionEvent = {
13
- goalId: Id;
14
- goalData?: Array<GoalData>;
15
- bucketingData?: Record<string, Id>;
16
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { Id } from '../Id';
8
- import { SegmentsData } from '../SegmentsData';
9
- import { VisitorEvent } from './VisitorEvent';
10
- export type Visitor = {
11
- visitorId: Id;
12
- segments?: SegmentsData;
13
- events: Array<VisitorEvent>;
14
- };
@@ -1,13 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- import { EventType } from '@convertcom/js-sdk-enums';
8
- import { BucketingEvent } from './BucketingEvent';
9
- import { ConversionEvent } from './ConversionEvent';
10
- export type VisitorEvent = {
11
- eventType: EventType;
12
- data?: BucketingEvent | ConversionEvent;
13
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * Convert JS SDK test
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export * from './src/array-utils';
8
- export * from './src/comparisons';
9
- export * from './src/data-store';
10
- export * from './src/file-logger';
11
- export * from './src/http-client';
12
- export * from './src/object-utils';
13
- export * from './src/string-utils';
14
- export * from './src/types-utils';
@@ -1,11 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- /**
8
- * Validates variable is array and not empty
9
- * @param array
10
- */
11
- export declare function arrayNotEmpty(array: Array<unknown>): boolean;
@@ -1,22 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- /**
8
- * Comparison Processor. Provides comparison methods for rules validation
9
- */
10
- export declare class Comparisons {
11
- static equals(value: string | number | boolean | Array<string | number | boolean> | Record<string, string | number | boolean>, testAgainst: string | number | boolean, negation?: boolean): boolean;
12
- static equalsNumber: typeof Comparisons.equals;
13
- static matches: typeof Comparisons.equals;
14
- static less(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
15
- static lessEqual(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
16
- static contains(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
17
- static isIn(values: string | number, testAgainst: Array<string | number> | string, negation?: boolean, splitter?: string): boolean;
18
- static startsWith(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
19
- static endsWith(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
20
- static regexMatches(value: string | number, testAgainst: string | number, negation?: boolean): boolean;
21
- private static _returnNegationCheck;
22
- }
@@ -1,39 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- /**
8
- * Example of Data Store implementation with simple database Based JSON file.
9
- * It's not recommended to use it in production as it can be memory and CPU intensive.
10
- * @param {string} file
11
- * @param {module} fs
12
- */
13
- declare class DataStore {
14
- private _file;
15
- private _fs;
16
- /**
17
- * @param {string} file
18
- * @param {module} fs
19
- */
20
- constructor(file: string, fs: any);
21
- /**
22
- * Get value by key
23
- * @param {string} key
24
- * @return {any}
25
- */
26
- get(key: string): any;
27
- /**
28
- * Store value by key
29
- * @param {string} key
30
- * @param {any} value
31
- */
32
- set(key: string, value: any): void;
33
- /**
34
- * Delete value by key
35
- * @param {string} key
36
- */
37
- delete(key: string): void;
38
- }
39
- export { DataStore };
@@ -1,40 +0,0 @@
1
- /**
2
- * @param {string} file
3
- * @param {module} fs
4
- * @param {string=} appendMethod Defaults to 'appendFileSync'
5
- * @example new FileLogger('./convert.log', require('fs'), 'appendFileSync')
6
- * @constructor
7
- */
8
- declare class FileLogger {
9
- private _file;
10
- private _fs;
11
- private _appendMethod;
12
- /**
13
- * @param {string} file
14
- * @param {module} fs
15
- * @param {string=} appendMethod
16
- */
17
- constructor(file: string, fs: any, appendMethod?: string);
18
- private _write;
19
- /**
20
- * @param {Array<any>} args
21
- */
22
- log(...args: any): Promise<void>;
23
- /**
24
- * @param {Array<any>} args
25
- */
26
- info(...args: any): Promise<void>;
27
- /**
28
- * @param {Array<any>} args
29
- */
30
- debug(...args: any): Promise<void>;
31
- /**
32
- * @param {Array<any>} args
33
- */
34
- warn(...args: any): Promise<void>;
35
- /**
36
- * @param {Array<any>} args
37
- */
38
- error(...args: any): Promise<void>;
39
- }
40
- export { FileLogger };
@@ -1,102 +0,0 @@
1
- /*!
2
- * Convert JS SDK
3
- * Version 1.0.0
4
- * Copyright(c) 2020 Convert Insights, Inc
5
- * License Apache-2.0
6
- */
7
- export type HttpMethod = 'GET' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';
8
- export type HttpResponseType = 'json' | 'arraybuffer' | 'text';
9
- export type HttpRequest = {
10
- baseURL: string;
11
- path?: string;
12
- method?: HttpMethod;
13
- headers?: {
14
- [x: string]: any;
15
- };
16
- responseType?: HttpResponseType;
17
- data?: Record<string, any>;
18
- };
19
- declare enum HttpStatusCode {
20
- Continue = 100,
21
- SwitchingProtocols = 101,
22
- Processing = 102,
23
- EarlyHints = 103,
24
- Ok = 200,
25
- Created = 201,
26
- Accepted = 202,
27
- NonAuthoritativeInformation = 203,
28
- NoContent = 204,
29
- ResetContent = 205,
30
- PartialContent = 206,
31
- MultiStatus = 207,
32
- AlreadyReported = 208,
33
- ImUsed = 226,
34
- MultipleChoices = 300,
35
- MovedPermanently = 301,
36
- Found = 302,
37
- SeeOther = 303,
38
- NotModified = 304,
39
- UseProxy = 305,
40
- Unused = 306,
41
- TemporaryRedirect = 307,
42
- PermanentRedirect = 308,
43
- BadRequest = 400,
44
- Unauthorized = 401,
45
- PaymentRequired = 402,
46
- Forbidden = 403,
47
- NotFound = 404,
48
- MethodNotAllowed = 405,
49
- NotAcceptable = 406,
50
- ProxyAuthenticationRequired = 407,
51
- RequestTimeout = 408,
52
- Conflict = 409,
53
- Gone = 410,
54
- LengthRequired = 411,
55
- PreconditionFailed = 412,
56
- PayloadTooLarge = 413,
57
- UriTooLong = 414,
58
- UnsupportedMediaType = 415,
59
- RangeNotSatisfiable = 416,
60
- ExpectationFailed = 417,
61
- ImATeapot = 418,
62
- MisdirectedRequest = 421,
63
- UnprocessableEntity = 422,
64
- Locked = 423,
65
- FailedDependency = 424,
66
- TooEarly = 425,
67
- UpgradeRequired = 426,
68
- PreconditionRequired = 428,
69
- TooManyRequests = 429,
70
- RequestHeaderFieldsTooLarge = 431,
71
- UnavailableForLegalReasons = 451,
72
- InternalServerError = 500,
73
- NotImplemented = 501,
74
- BadGateway = 502,
75
- ServiceUnavailable = 503,
76
- GatewayTimeout = 504,
77
- HttpVersionNotSupported = 505,
78
- VariantAlsoNegotiates = 506,
79
- InsufficientStorage = 507,
80
- LoopDetected = 508,
81
- NotExtended = 510,
82
- NetworkAuthenticationRequired = 511
83
- }
84
- export type HttpResponse = {
85
- data: any;
86
- status: HttpStatusCode;
87
- statusText: string;
88
- headers?: {
89
- [x: string]: any;
90
- };
91
- };
92
- interface HttpClientInterface {
93
- request(config: HttpRequest): Promise<HttpResponse>;
94
- }
95
- export declare const serialize: (params: Record<string, any>, method: string) => string;
96
- /**
97
- * Provide http client for newtork requests
98
- * @param {HttpRequest}
99
- * @returns {HttpClient}
100
- */
101
- export declare const HttpClient: HttpClientInterface;
102
- export {};