vwo-fme-node-sdk 1.3.0 → 1.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.
Files changed (259) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/README.md +1 -1
  3. package/lib/VWOClient.ts +5 -5
  4. package/lib/api/TrackEvent.ts +3 -3
  5. package/lib/packages/segmentation-evaluator/evaluators/SegmentEvaluator.ts +13 -5
  6. package/lib/packages/segmentation-evaluator/evaluators/SegmentOperandEvaluator.ts +2 -2
  7. package/package.json +1 -1
  8. package/dist/VWO.d.ts +0 -40
  9. package/dist/VWO.js +0 -215
  10. package/dist/VWO.js.map +0 -1
  11. package/dist/VWOBuilder.d.ts +0 -114
  12. package/dist/VWOBuilder.js +0 -275
  13. package/dist/VWOBuilder.js.map +0 -1
  14. package/dist/VWOClient.d.ts +0 -46
  15. package/dist/VWOClient.js +0 -230
  16. package/dist/VWOClient.js.map +0 -1
  17. package/dist/api/GetFlag.d.ts +0 -26
  18. package/dist/api/GetFlag.js +0 -316
  19. package/dist/api/GetFlag.js.map +0 -1
  20. package/dist/api/SetAttribute.d.ts +0 -38
  21. package/dist/api/SetAttribute.js +0 -75
  22. package/dist/api/SetAttribute.js.map +0 -1
  23. package/dist/api/TrackEvent.d.ts +0 -23
  24. package/dist/api/TrackEvent.js +0 -108
  25. package/dist/api/TrackEvent.js.map +0 -1
  26. package/dist/constants/Url.d.ts +0 -21
  27. package/dist/constants/Url.js +0 -25
  28. package/dist/constants/Url.js.map +0 -1
  29. package/dist/constants/index.d.ts +0 -24
  30. package/dist/constants/index.js +0 -45
  31. package/dist/constants/index.js.map +0 -1
  32. package/dist/decorators/StorageDecorator.d.ts +0 -39
  33. package/dist/decorators/StorageDecorator.js +0 -156
  34. package/dist/decorators/StorageDecorator.js.map +0 -1
  35. package/dist/enums/ApiEnum.d.ts +0 -19
  36. package/dist/enums/ApiEnum.js +0 -24
  37. package/dist/enums/ApiEnum.js.map +0 -1
  38. package/dist/enums/CampaignTypeEnum.d.ts +0 -20
  39. package/dist/enums/CampaignTypeEnum.js +0 -25
  40. package/dist/enums/CampaignTypeEnum.js.map +0 -1
  41. package/dist/enums/EventEnum.d.ts +0 -19
  42. package/dist/enums/EventEnum.js +0 -24
  43. package/dist/enums/EventEnum.js.map +0 -1
  44. package/dist/enums/HeadersEnum.d.ts +0 -19
  45. package/dist/enums/HeadersEnum.js +0 -24
  46. package/dist/enums/HeadersEnum.js.map +0 -1
  47. package/dist/enums/HooksEnum.d.ts +0 -22
  48. package/dist/enums/HooksEnum.js +0 -23
  49. package/dist/enums/HooksEnum.js.map +0 -1
  50. package/dist/enums/LogLevelEnum.d.ts +0 -22
  51. package/dist/enums/LogLevelEnum.js +0 -27
  52. package/dist/enums/LogLevelEnum.js.map +0 -1
  53. package/dist/enums/StatusEnum.d.ts +0 -19
  54. package/dist/enums/StatusEnum.js +0 -24
  55. package/dist/enums/StatusEnum.js.map +0 -1
  56. package/dist/enums/StorageEnum.d.ts +0 -23
  57. package/dist/enums/StorageEnum.js +0 -28
  58. package/dist/enums/StorageEnum.js.map +0 -1
  59. package/dist/enums/UrlEnum.d.ts +0 -22
  60. package/dist/enums/UrlEnum.js +0 -29
  61. package/dist/enums/UrlEnum.js.map +0 -1
  62. package/dist/enums/log-messages/index.d.ts +0 -4
  63. package/dist/enums/log-messages/index.js +0 -26
  64. package/dist/enums/log-messages/index.js.map +0 -1
  65. package/dist/index.d.ts +0 -16
  66. package/dist/index.js +0 -25
  67. package/dist/index.js.map +0 -1
  68. package/dist/models/GatewayServiceModel.d.ts +0 -29
  69. package/dist/models/GatewayServiceModel.js +0 -36
  70. package/dist/models/GatewayServiceModel.js.map +0 -1
  71. package/dist/models/VWOOptionsModel.d.ts +0 -65
  72. package/dist/models/VWOOptionsModel.js +0 -85
  73. package/dist/models/VWOOptionsModel.js.map +0 -1
  74. package/dist/models/campaign/CampaignModel.d.ts +0 -51
  75. package/dist/models/campaign/CampaignModel.js +0 -120
  76. package/dist/models/campaign/CampaignModel.js.map +0 -1
  77. package/dist/models/campaign/FeatureModel.d.ts +0 -43
  78. package/dist/models/campaign/FeatureModel.js +0 -89
  79. package/dist/models/campaign/FeatureModel.js.map +0 -1
  80. package/dist/models/campaign/ImpactCampaignModel.d.ts +0 -22
  81. package/dist/models/campaign/ImpactCampaignModel.js +0 -36
  82. package/dist/models/campaign/ImpactCampaignModel.js.map +0 -1
  83. package/dist/models/campaign/MetricModel.d.ts +0 -27
  84. package/dist/models/campaign/MetricModel.js +0 -40
  85. package/dist/models/campaign/MetricModel.js.map +0 -1
  86. package/dist/models/campaign/RuleModel.d.ts +0 -28
  87. package/dist/models/campaign/RuleModel.js +0 -48
  88. package/dist/models/campaign/RuleModel.js.map +0 -1
  89. package/dist/models/campaign/VariableModel.d.ts +0 -33
  90. package/dist/models/campaign/VariableModel.js +0 -38
  91. package/dist/models/campaign/VariableModel.js.map +0 -1
  92. package/dist/models/campaign/VariationModel.d.ts +0 -44
  93. package/dist/models/campaign/VariationModel.js +0 -80
  94. package/dist/models/campaign/VariationModel.js.map +0 -1
  95. package/dist/models/schemas/SettingsSchemaValidation.d.ts +0 -13
  96. package/dist/models/schemas/SettingsSchemaValidation.js +0 -97
  97. package/dist/models/schemas/SettingsSchemaValidation.js.map +0 -1
  98. package/dist/models/settings/SettingsModel.d.ts +0 -43
  99. package/dist/models/settings/SettingsModel.js +0 -85
  100. package/dist/models/settings/SettingsModel.js.map +0 -1
  101. package/dist/models/storage/StorageDataModel.d.ts +0 -43
  102. package/dist/models/storage/StorageDataModel.js +0 -69
  103. package/dist/models/storage/StorageDataModel.js.map +0 -1
  104. package/dist/models/user/ContextModel.d.ts +0 -35
  105. package/dist/models/user/ContextModel.js +0 -54
  106. package/dist/models/user/ContextModel.js.map +0 -1
  107. package/dist/models/user/ContextVWOModel.d.ts +0 -22
  108. package/dist/models/user/ContextVWOModel.js +0 -40
  109. package/dist/models/user/ContextVWOModel.js.map +0 -1
  110. package/dist/packages/decision-maker/index.d.ts +0 -50
  111. package/dist/packages/decision-maker/index.js +0 -81
  112. package/dist/packages/decision-maker/index.js.map +0 -1
  113. package/dist/packages/logger/LogMessageBuilder.d.ts +0 -63
  114. package/dist/packages/logger/LogMessageBuilder.js +0 -86
  115. package/dist/packages/logger/LogMessageBuilder.js.map +0 -1
  116. package/dist/packages/logger/Logger.d.ts +0 -46
  117. package/dist/packages/logger/Logger.js +0 -29
  118. package/dist/packages/logger/Logger.js.map +0 -1
  119. package/dist/packages/logger/core/LogManager.d.ts +0 -100
  120. package/dist/packages/logger/core/LogManager.js +0 -157
  121. package/dist/packages/logger/core/LogManager.js.map +0 -1
  122. package/dist/packages/logger/core/TransportManager.d.ts +0 -80
  123. package/dist/packages/logger/core/TransportManager.js +0 -122
  124. package/dist/packages/logger/core/TransportManager.js.map +0 -1
  125. package/dist/packages/logger/enums/LogLevelEnum.d.ts +0 -22
  126. package/dist/packages/logger/enums/LogLevelEnum.js +0 -27
  127. package/dist/packages/logger/enums/LogLevelEnum.js.map +0 -1
  128. package/dist/packages/logger/index.d.ts +0 -17
  129. package/dist/packages/logger/index.js +0 -23
  130. package/dist/packages/logger/index.js.map +0 -1
  131. package/dist/packages/logger/transports/ConsoleTransport.d.ts +0 -45
  132. package/dist/packages/logger/transports/ConsoleTransport.js +0 -80
  133. package/dist/packages/logger/transports/ConsoleTransport.js.map +0 -1
  134. package/dist/packages/network-layer/client/NetworkClient.d.ts +0 -20
  135. package/dist/packages/network-layer/client/NetworkClient.js +0 -160
  136. package/dist/packages/network-layer/client/NetworkClient.js.map +0 -1
  137. package/dist/packages/network-layer/client/NetworkClientInterface.d.ts +0 -31
  138. package/dist/packages/network-layer/client/NetworkClientInterface.js +0 -3
  139. package/dist/packages/network-layer/client/NetworkClientInterface.js.map +0 -1
  140. package/dist/packages/network-layer/handlers/RequestHandler.d.ts +0 -17
  141. package/dist/packages/network-layer/handlers/RequestHandler.js +0 -50
  142. package/dist/packages/network-layer/handlers/RequestHandler.js.map +0 -1
  143. package/dist/packages/network-layer/index.d.ts +0 -21
  144. package/dist/packages/network-layer/index.js +0 -29
  145. package/dist/packages/network-layer/index.js.map +0 -1
  146. package/dist/packages/network-layer/manager/NetworkManager.d.ts +0 -47
  147. package/dist/packages/network-layer/manager/NetworkManager.js +0 -118
  148. package/dist/packages/network-layer/manager/NetworkManager.js.map +0 -1
  149. package/dist/packages/network-layer/models/GlobalRequestModel.d.ts +0 -97
  150. package/dist/packages/network-layer/models/GlobalRequestModel.js +0 -111
  151. package/dist/packages/network-layer/models/GlobalRequestModel.js.map +0 -1
  152. package/dist/packages/network-layer/models/RequestModel.d.ts +0 -140
  153. package/dist/packages/network-layer/models/RequestModel.js +0 -219
  154. package/dist/packages/network-layer/models/RequestModel.js.map +0 -1
  155. package/dist/packages/network-layer/models/ResponseModel.d.ts +0 -66
  156. package/dist/packages/network-layer/models/ResponseModel.js +0 -70
  157. package/dist/packages/network-layer/models/ResponseModel.js.map +0 -1
  158. package/dist/packages/segmentation-evaluator/Segmentation.d.ts +0 -32
  159. package/dist/packages/segmentation-evaluator/Segmentation.js +0 -3
  160. package/dist/packages/segmentation-evaluator/Segmentation.js.map +0 -1
  161. package/dist/packages/segmentation-evaluator/core/SegmentationManger.d.ts +0 -50
  162. package/dist/packages/segmentation-evaluator/core/SegmentationManger.js +0 -153
  163. package/dist/packages/segmentation-evaluator/core/SegmentationManger.js.map +0 -1
  164. package/dist/packages/segmentation-evaluator/enums/SegmentOperandRegexEnum.d.ts +0 -29
  165. package/dist/packages/segmentation-evaluator/enums/SegmentOperandRegexEnum.js +0 -34
  166. package/dist/packages/segmentation-evaluator/enums/SegmentOperandRegexEnum.js.map +0 -1
  167. package/dist/packages/segmentation-evaluator/enums/SegmentOperandValueEnum.d.ts +0 -27
  168. package/dist/packages/segmentation-evaluator/enums/SegmentOperandValueEnum.js +0 -32
  169. package/dist/packages/segmentation-evaluator/enums/SegmentOperandValueEnum.js.map +0 -1
  170. package/dist/packages/segmentation-evaluator/enums/SegmentOperatorValueEnum.d.ts +0 -31
  171. package/dist/packages/segmentation-evaluator/enums/SegmentOperatorValueEnum.js +0 -36
  172. package/dist/packages/segmentation-evaluator/enums/SegmentOperatorValueEnum.js.map +0 -1
  173. package/dist/packages/segmentation-evaluator/evaluators/SegmentEvaluator.d.ts +0 -77
  174. package/dist/packages/segmentation-evaluator/evaluators/SegmentEvaluator.js +0 -434
  175. package/dist/packages/segmentation-evaluator/evaluators/SegmentEvaluator.js.map +0 -1
  176. package/dist/packages/segmentation-evaluator/evaluators/SegmentOperandEvaluator.d.ts +0 -64
  177. package/dist/packages/segmentation-evaluator/evaluators/SegmentOperandEvaluator.js +0 -378
  178. package/dist/packages/segmentation-evaluator/evaluators/SegmentOperandEvaluator.js.map +0 -1
  179. package/dist/packages/segmentation-evaluator/index.d.ts +0 -18
  180. package/dist/packages/segmentation-evaluator/index.js +0 -23
  181. package/dist/packages/segmentation-evaluator/index.js.map +0 -1
  182. package/dist/packages/segmentation-evaluator/utils/SegmentUtil.d.ts +0 -13
  183. package/dist/packages/segmentation-evaluator/utils/SegmentUtil.js +0 -58
  184. package/dist/packages/segmentation-evaluator/utils/SegmentUtil.js.map +0 -1
  185. package/dist/packages/storage/Connector.d.ts +0 -20
  186. package/dist/packages/storage/Connector.js +0 -10
  187. package/dist/packages/storage/Connector.js.map +0 -1
  188. package/dist/packages/storage/Storage.d.ts +0 -23
  189. package/dist/packages/storage/Storage.js +0 -37
  190. package/dist/packages/storage/Storage.js.map +0 -1
  191. package/dist/packages/storage/connectors/MemoryConnector.d.ts +0 -15
  192. package/dist/packages/storage/connectors/MemoryConnector.js +0 -35
  193. package/dist/packages/storage/connectors/MemoryConnector.js.map +0 -1
  194. package/dist/packages/storage/connectors/RedisConnector.d.ts +0 -15
  195. package/dist/packages/storage/connectors/RedisConnector.js +0 -196
  196. package/dist/packages/storage/connectors/RedisConnector.js.map +0 -1
  197. package/dist/packages/storage/connectors/index.d.ts +0 -15
  198. package/dist/packages/storage/connectors/index.js +0 -18
  199. package/dist/packages/storage/connectors/index.js.map +0 -1
  200. package/dist/packages/storage/index.d.ts +0 -16
  201. package/dist/packages/storage/index.js +0 -21
  202. package/dist/packages/storage/index.js.map +0 -1
  203. package/dist/services/CampaignDecisionService.d.ts +0 -44
  204. package/dist/services/CampaignDecisionService.js +0 -210
  205. package/dist/services/CampaignDecisionService.js.map +0 -1
  206. package/dist/services/HooksManager.d.ts +0 -38
  207. package/dist/services/HooksManager.js +0 -39
  208. package/dist/services/HooksManager.js.map +0 -1
  209. package/dist/services/SettingsManager.d.ts +0 -40
  210. package/dist/services/SettingsManager.js +0 -217
  211. package/dist/services/SettingsManager.js.map +0 -1
  212. package/dist/services/StorageService.d.ts +0 -17
  213. package/dist/services/StorageService.js +0 -131
  214. package/dist/services/StorageService.js.map +0 -1
  215. package/dist/services/UrlService.d.ts +0 -9
  216. package/dist/services/UrlService.js +0 -39
  217. package/dist/services/UrlService.js.map +0 -1
  218. package/dist/types/Common.d.ts +0 -26
  219. package/dist/types/Common.js +0 -18
  220. package/dist/types/Common.js.map +0 -1
  221. package/dist/utils/CampaignUtil.d.ts +0 -99
  222. package/dist/utils/CampaignUtil.js +0 -321
  223. package/dist/utils/CampaignUtil.js.map +0 -1
  224. package/dist/utils/DataTypeUtil.d.ts +0 -102
  225. package/dist/utils/DataTypeUtil.js +0 -170
  226. package/dist/utils/DataTypeUtil.js.map +0 -1
  227. package/dist/utils/DecisionUtil.d.ts +0 -8
  228. package/dist/utils/DecisionUtil.js +0 -233
  229. package/dist/utils/DecisionUtil.js.map +0 -1
  230. package/dist/utils/FunctionUtil.d.ts +0 -74
  231. package/dist/utils/FunctionUtil.js +0 -173
  232. package/dist/utils/FunctionUtil.js.map +0 -1
  233. package/dist/utils/GatewayServiceUtil.d.ts +0 -19
  234. package/dist/utils/GatewayServiceUtil.js +0 -156
  235. package/dist/utils/GatewayServiceUtil.js.map +0 -1
  236. package/dist/utils/ImpressionUtil.d.ts +0 -28
  237. package/dist/utils/ImpressionUtil.js +0 -41
  238. package/dist/utils/ImpressionUtil.js.map +0 -1
  239. package/dist/utils/LogMessageUtil.d.ts +0 -8
  240. package/dist/utils/LogMessageUtil.js +0 -51
  241. package/dist/utils/LogMessageUtil.js.map +0 -1
  242. package/dist/utils/MegUtil.d.ts +0 -27
  243. package/dist/utils/MegUtil.js +0 -461
  244. package/dist/utils/MegUtil.js.map +0 -1
  245. package/dist/utils/NetworkUtil.d.ts +0 -91
  246. package/dist/utils/NetworkUtil.js +0 -335
  247. package/dist/utils/NetworkUtil.js.map +0 -1
  248. package/dist/utils/PromiseUtil.d.ts +0 -6
  249. package/dist/utils/PromiseUtil.js +0 -19
  250. package/dist/utils/PromiseUtil.js.map +0 -1
  251. package/dist/utils/RuleEvaluationUtil.d.ts +0 -37
  252. package/dist/utils/RuleEvaluationUtil.js +0 -83
  253. package/dist/utils/RuleEvaluationUtil.js.map +0 -1
  254. package/dist/utils/SettingsUtil.d.ts +0 -1
  255. package/dist/utils/SettingsUtil.js +0 -36
  256. package/dist/utils/SettingsUtil.js.map +0 -1
  257. package/dist/utils/UuidUtil.d.ts +0 -20
  258. package/dist/utils/UuidUtil.js +0 -69
  259. package/dist/utils/UuidUtil.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.1] - 2024-07-225
9
+
10
+ ### Fixed
11
+
12
+ - fix: add support for DSL where featureIdValue could be `off`
13
+ - refactor: make eventProperties as third parameter
14
+
15
+ ## [1.3.0] - 2024-06-20
16
+
17
+ ### Fixed
18
+
19
+ - Update dist folder
20
+
8
21
  ## [1.2.4] - 2024-06-14
9
22
 
10
23
  ### Fixed
@@ -51,11 +64,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
51
64
  ```javascript
52
65
  {
53
66
  id: 'user-id', // MANDATORY
54
- ip: '1.2.3.4', // OPTIONAL - required for user targeting
55
- ua: '...', // OPTIONAL - required for user targeting
56
- other_attributes: '...', // OPTIONAL - required for user targeting
67
+ ipAddress: '1.2.3.4', // OPTIONAL - required for user targeting
68
+ userAgent: '...', // OPTIONAL - required for user targeting
57
69
  // For pre-segmentation in campaigns
58
70
  customVariables: {
71
+ price: 300
59
72
  // ...
60
73
  }
61
74
  }
package/README.md CHANGED
@@ -40,7 +40,7 @@ const isFlagEnabled = getFlag.isEnabled();
40
40
  const intVar = getFlag.getVariable('int_variable_key');
41
41
 
42
42
  // track event
43
- vwoClient.trackEvent('addToCart', userContext, eventProperties);
43
+ vwoClient.trackEvent('add_to_cart', userContext, eventProperties);
44
44
  ```
45
45
 
46
46
  ### Development Scripts
package/lib/VWOClient.ts CHANGED
@@ -46,8 +46,8 @@ export interface IVWOClient {
46
46
  getFlag(featureKey: string, context: Record<string, any>): Record<any, any>;
47
47
  trackEvent(
48
48
  eventName: string,
49
- eventProperties: Record<string, dynamic>,
50
49
  context: Record<string, any>,
50
+ eventProperties: Record<string, dynamic>,
51
51
  ): Promise<Record<string, boolean>>;
52
52
  setAttribute(attributeKey: string, attributeValue: string, context: Record<string, any>): void;
53
53
  }
@@ -151,14 +151,14 @@ export class VWOClient implements IVWOClient {
151
151
  * This method validates the types of the inputs and ensures the settings and user context are valid before proceeding.
152
152
  *
153
153
  * @param {string} eventName - The name of the event to track.
154
- * @param {Record<string, dynamic>} eventProperties - The properties associated with the event.
155
154
  * @param {ContextModel} context - The context in which the event is being tracked, must include a valid user ID.
155
+ * @param {Record<string, dynamic>} eventProperties - The properties associated with the event.
156
156
  * @returns {Promise<Record<string, boolean>>} - A promise that resolves to the result of the tracking operation.
157
157
  */
158
158
  trackEvent(
159
159
  eventName: string,
160
- eventProperties: Record<string, dynamic> = {},
161
160
  context: Record<string, any>,
161
+ eventProperties: Record<string, dynamic> = {},
162
162
  ): Promise<Record<string, boolean>> {
163
163
  const apiName = 'trackEvent';
164
164
  const deferredObject = new Deferred();
@@ -192,7 +192,7 @@ export class VWOClient implements IVWOClient {
192
192
  LogManager.Instance.error(
193
193
  buildMessage(ErrorLogMessagesEnum.API_INVALID_PARAM, {
194
194
  apiName,
195
- key: 'featureKey',
195
+ key: 'eventProperties',
196
196
  type: getType(eventProperties),
197
197
  correctType: 'object',
198
198
  }),
@@ -217,7 +217,7 @@ export class VWOClient implements IVWOClient {
217
217
 
218
218
  // Proceed with tracking the event
219
219
  new TrackApi()
220
- .track(this.settings, eventName, eventProperties, contextModel, hookManager)
220
+ .track(this.settings, eventName, contextModel, eventProperties, hookManager)
221
221
  .then((data) => {
222
222
  deferredObject.resolve(data);
223
223
  })
@@ -28,16 +28,16 @@ interface ITrack {
28
28
  * Tracks an event with given properties and context.
29
29
  * @param settings Configuration settings for the tracking.
30
30
  * @param eventName Name of the event to track.
31
- * @param eventProperties Properties associated with the event.
32
31
  * @param context Contextual information like user details.
32
+ * @param eventProperties Properties associated with the event.
33
33
  * @param hookManager Manager for handling hooks and callbacks.
34
34
  * @returns A promise that resolves to a record indicating the success or failure of the event tracking.
35
35
  */
36
36
  track(
37
37
  settings: SettingsModel,
38
38
  eventName: string,
39
- eventProperties: any,
40
39
  context: ContextModel,
40
+ eventProperties: any,
41
41
  hookManager: HooksManager,
42
42
  ): Promise<Record<string, boolean>>;
43
43
  }
@@ -50,8 +50,8 @@ export class TrackApi implements ITrack {
50
50
  async track(
51
51
  settings: SettingsModel,
52
52
  eventName: string,
53
- eventProperties: any,
54
53
  context: ContextModel,
54
+ eventProperties: any,
55
55
  hookManager: HooksManager,
56
56
  ): Promise<Record<string, boolean>> {
57
57
  if (doesEventBelongToAnyFeature(eventName, settings)) {
@@ -106,16 +106,20 @@ export class SegmentEvaluator implements Segmentation {
106
106
  const featureIdKey: string = Object.keys(featureIdObject)[0];
107
107
  const featureIdValue: string = featureIdObject[featureIdKey];
108
108
 
109
- if (featureIdValue === 'on') {
109
+ if (featureIdValue === 'on' || featureIdValue === 'off') {
110
110
  const features = this.settings.getFeatures();
111
111
  const feature = features.find((feature) => feature.getId() === parseInt(featureIdKey));
112
112
 
113
113
  if (feature) {
114
114
  const featureKey = feature.getKey();
115
115
  const result = await this.checkInUserStorage(this.settings, featureKey, this.context);
116
+ // if the result is false, then we need to return true as feature is not present in the user storage
117
+ if (featureIdValue === 'off') {
118
+ return !result;
119
+ }
116
120
  return result;
117
121
  } else {
118
- console.error('Feature not found with featureIdKey:', featureIdKey);
122
+ LogManager.Instance.error('Feature not found with featureIdKey: ' + featureIdKey);
119
123
  return null; // Handle the case when feature is not found
120
124
  }
121
125
  }
@@ -197,7 +201,7 @@ export class SegmentEvaluator implements Segmentation {
197
201
  async checkLocationPreSegmentation(locationMap: Record<string, dynamic>): Promise<boolean> {
198
202
  // Ensure user's IP address is available
199
203
  if (this.context?.getIpAddress() === undefined) {
200
- LogManager.Instance.info('To evaluate location pre Segment, please pass ipAddress in context object');
204
+ LogManager.Instance.error('To evaluate location pre Segment, please pass ipAddress in context object');
201
205
  return false;
202
206
  }
203
207
  // Check if location data is available and matches the expected values
@@ -219,7 +223,7 @@ export class SegmentEvaluator implements Segmentation {
219
223
  async checkUserAgentParser(uaParserMap: Record<string, string[]>): Promise<boolean> {
220
224
  // Ensure user's user agent is available
221
225
  if (!this.context?.getUserAgent() || this.context?.getUserAgent() === undefined) {
222
- LogManager.Instance.info('To evaluate user agent related segments, please pass userAgent in context object');
226
+ LogManager.Instance.error('To evaluate user agent related segments, please pass userAgent in context object');
223
227
  return false;
224
228
  }
225
229
  // Check if user agent data is available and matches the expected values
@@ -264,6 +268,10 @@ export class SegmentEvaluator implements Segmentation {
264
268
  for (const key in actualMap) {
265
269
  if (Object.prototype.hasOwnProperty.call(expectedMap, key)) {
266
270
  const expectedValues = expectedMap[key];
271
+ // convert expected values to lowercase
272
+ expectedValues.forEach((value, index) => {
273
+ expectedValues[index] = value.toLowerCase();
274
+ });
267
275
  const actualValue = actualMap[key];
268
276
 
269
277
  // Handle wildcard patterns for all keys
@@ -273,7 +281,7 @@ export class SegmentEvaluator implements Segmentation {
273
281
  // Extract pattern from wildcard string
274
282
  const wildcardPattern = val.slice(9, -1);
275
283
  // Convert wildcard pattern to regex and check if it matches the actual value
276
- const regex = new RegExp(wildcardPattern.replace(/\*/g, '.*')); // Convert wildcard pattern to regex
284
+ const regex = new RegExp(wildcardPattern.replace(/\*/g, '.*'), 'i'); // Convert wildcard pattern to regex, 'i' for case-insensitive
277
285
  // Check if the actual value matches the regex pattern for the key
278
286
  if (regex.test(actualValue)) {
279
287
  // match found, return true as we only need to check if any of the expected values match the actual value
@@ -53,7 +53,7 @@ export class SegmentOperandEvaluator {
53
53
  const listIdRegex = /inlist\((\w+:\d+)\)/;
54
54
  const match = operand.match(listIdRegex);
55
55
  if (!match || match.length < 2) {
56
- console.error("Invalid 'inList' operand format");
56
+ LogManager.Instance.error("Invalid 'inList' operand format");
57
57
  return false;
58
58
  }
59
59
 
@@ -74,7 +74,7 @@ export class SegmentOperandEvaluator {
74
74
  }
75
75
  return res;
76
76
  } catch (error) {
77
- console.error('Error while fetching data:', error);
77
+ LogManager.Instance.error('Error while fetching data: ' + error);
78
78
  return false;
79
79
  }
80
80
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vwo-fme-node-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "VWO Node SDK for Feature Management and Experimentation",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index.d.ts",
package/dist/VWO.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import { IVWOClient } from './VWOClient';
2
- import { IVWOOptions } from './models/VWOOptionsModel';
3
- import { dynamic } from './types/Common';
4
- import { LogLevelEnum } from './packages/logger/enums/LogLevelEnum';
5
- import { Connector } from './packages/storage/Connector';
6
- export { LogLevelEnum, Connector as StorageConnector };
7
- export declare class VWO {
8
- private static vwoBuilder;
9
- private static instance;
10
- /**
11
- * Constructor for the VWO class.
12
- * Initializes a new instance of VWO with the provided options.
13
- * @param {Record<string, dynamic>} options - Configuration options for the VWO instance.
14
- * @returns The instance of VWO.
15
- */
16
- constructor(options: IVWOOptions);
17
- /**
18
- * Sets the singleton instance of VWO.
19
- * Configures and builds the VWO instance using the provided options.
20
- * @param {Record<string, dynamic>} options - Configuration options for setting up VWO.
21
- * @returns A Promise resolving to the configured VWO instance.
22
- */
23
- private static setInstance;
24
- /**
25
- * Gets the singleton instance of VWO.
26
- * @returns The singleton instance of VWO.
27
- */
28
- static get Instance(): dynamic;
29
- }
30
- /**
31
- * Initializes a new instance of VWO with the provided options.
32
- * @param options Configuration options for the VWO instance.
33
- * @property {string} sdkKey - The SDK key for the VWO account.
34
- * @property {string} accountId - The account ID for the VWO account.
35
- * @property {GatewayServiceModel} gatewayService - The gateway service configuration.
36
- * @property {StorageService} storage - The storage configuration.
37
- * @returns
38
- */
39
- export declare function init(options: IVWOOptions): Promise<IVWOClient>;
40
- export declare function onInit(): Promise<any>;
package/dist/VWO.js DELETED
@@ -1,215 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.onInit = exports.init = exports.VWO = exports.StorageConnector = exports.LogLevelEnum = void 0;
40
- /**
41
- * Copyright 2024 Wingify Software Pvt. Ltd.
42
- *
43
- * Licensed under the Apache License, Version 2.0 (the "License");
44
- * you may not use this file except in compliance with the License.
45
- * You may obtain a copy of the License at
46
- *
47
- * http://www.apache.org/licenses/LICENSE-2.0
48
- *
49
- * Unless required by applicable law or agreed to in writing, software
50
- * distributed under the License is distributed on an "AS IS" BASIS,
51
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
- * See the License for the specific language governing permissions and
53
- * limitations under the License.
54
- */
55
- var VWOBuilder_1 = require("./VWOBuilder");
56
- var DataTypeUtil_1 = require("./utils/DataTypeUtil");
57
- var PromiseUtil_1 = require("./utils/PromiseUtil");
58
- var log_messages_1 = require("./enums/log-messages");
59
- var LogLevelEnum_1 = require("./packages/logger/enums/LogLevelEnum");
60
- Object.defineProperty(exports, "LogLevelEnum", { enumerable: true, get: function () { return LogLevelEnum_1.LogLevelEnum; } });
61
- var Connector_1 = require("./packages/storage/Connector");
62
- Object.defineProperty(exports, "StorageConnector", { enumerable: true, get: function () { return Connector_1.Connector; } });
63
- var LogMessageUtil_1 = require("./utils/LogMessageUtil");
64
- var VWO = /** @class */ (function () {
65
- /**
66
- * Constructor for the VWO class.
67
- * Initializes a new instance of VWO with the provided options.
68
- * @param {Record<string, dynamic>} options - Configuration options for the VWO instance.
69
- * @returns The instance of VWO.
70
- */
71
- function VWO(options) {
72
- return VWO.setInstance(options);
73
- }
74
- /**
75
- * Sets the singleton instance of VWO.
76
- * Configures and builds the VWO instance using the provided options.
77
- * @param {Record<string, dynamic>} options - Configuration options for setting up VWO.
78
- * @returns A Promise resolving to the configured VWO instance.
79
- */
80
- VWO.setInstance = function (options) {
81
- var _this = this;
82
- var optionsVWOBuilder = options === null || options === void 0 ? void 0 : options.vwoBuilder;
83
- this.vwoBuilder = optionsVWOBuilder || new VWOBuilder_1.VWOBuilder(options);
84
- this.instance = this.vwoBuilder
85
- .setLogger() // Sets up logging for debugging and monitoring.
86
- .setSettingsManager() // Sets the settings manager for configuration management.
87
- .setStorage() // Configures storage for data persistence.
88
- .setNetworkManager() // Configures network management for API communication.
89
- .setSegmentation() // Sets up segmentation for targeted functionality.
90
- // .initBatching() // Initializes batching for bulk data processing.
91
- .initPolling(); // Starts polling mechanism for regular updates.
92
- // .setAnalyticsCallback() // Sets up analytics callback for data analysis.
93
- return this.vwoBuilder.getSettings().then(function (settings) {
94
- return _this.vwoBuilder.build(settings); // Builds the VWO instance with the fetched settings.
95
- });
96
- };
97
- Object.defineProperty(VWO, "Instance", {
98
- /**
99
- * Gets the singleton instance of VWO.
100
- * @returns The singleton instance of VWO.
101
- */
102
- get: function () {
103
- return this.instance;
104
- },
105
- enumerable: false,
106
- configurable: true
107
- });
108
- return VWO;
109
- }());
110
- exports.VWO = VWO;
111
- var _global = {};
112
- /**
113
- * Initializes a new instance of VWO with the provided options.
114
- * @param options Configuration options for the VWO instance.
115
- * @property {string} sdkKey - The SDK key for the VWO account.
116
- * @property {string} accountId - The account ID for the VWO account.
117
- * @property {GatewayServiceModel} gatewayService - The gateway service configuration.
118
- * @property {StorageService} storage - The storage configuration.
119
- * @returns
120
- */
121
- function init(options) {
122
- return __awaiter(this, void 0, void 0, function () {
123
- var apiName, date, msg, msg, msg, instance, msg;
124
- return __generator(this, function (_a) {
125
- apiName = 'init';
126
- date = new Date().toISOString();
127
- try {
128
- if (!(0, DataTypeUtil_1.isObject)(options)) {
129
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.ErrorLogMessagesEnum.INIT_OPTIONS_ERROR, {
130
- date: date,
131
- });
132
- console.error(msg); // Ensures options is an object.
133
- }
134
- if (!(options === null || options === void 0 ? void 0 : options.sdkKey) || !(0, DataTypeUtil_1.isString)(options === null || options === void 0 ? void 0 : options.sdkKey)) {
135
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.ErrorLogMessagesEnum.INIT_OPTIONS_SDK_KEY_ERROR, {
136
- date: date,
137
- });
138
- console.error(msg); // Validates sdkKey presence and type.
139
- }
140
- if (!options.accountId) {
141
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.ErrorLogMessagesEnum.INIT_OPTIONS_ACCOUNT_ID_ERROR, {
142
- date: date,
143
- });
144
- console.error(msg); // Validates accountId presence and type.
145
- }
146
- instance = new VWO(options);
147
- _global = {
148
- vwoInitDeferred: new PromiseUtil_1.Deferred(),
149
- isSettingsFetched: false,
150
- instance: null,
151
- };
152
- return [2 /*return*/, instance.then(function (_vwoInstance) {
153
- _global.isSettingsFetched = true;
154
- _global.instance = _vwoInstance;
155
- _global.vwoInitDeferred.resolve(_vwoInstance);
156
- return _vwoInstance;
157
- })];
158
- }
159
- catch (err) {
160
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.ErrorLogMessagesEnum.API_THROW_ERROR, {
161
- apiName: apiName,
162
- err: err,
163
- });
164
- console.info("[INFO]: VWO-SDK ".concat(new Date().toISOString(), " ").concat(msg));
165
- }
166
- return [2 /*return*/];
167
- });
168
- });
169
- }
170
- exports.init = init;
171
- function onInit() {
172
- return __awaiter(this, void 0, void 0, function () {
173
- var apiName, date_1, msg, msg;
174
- return __generator(this, function (_a) {
175
- apiName = 'onInit';
176
- try {
177
- _global.vwoInitDeferred = new PromiseUtil_1.Deferred();
178
- date_1 = new Date().toISOString();
179
- // If settings are already fetched, resolve the promise
180
- if (_global.isSettingsFetched) {
181
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.InfoLogMessagesEnum.ON_INIT_ALREADY_RESOLVED, {
182
- date: date_1,
183
- apiName: apiName,
184
- });
185
- console.info(msg);
186
- _global.vwoInitDeferred.resolve(_global.instance);
187
- }
188
- else {
189
- // wait for five seconds, else reject the promise
190
- setTimeout(function () {
191
- if (_global.isSettingsFetched) {
192
- return;
193
- }
194
- var msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.InfoLogMessagesEnum.ON_INIT_SETTINGS_FAILED, {
195
- date: date_1,
196
- });
197
- console.error(msg);
198
- _global.vwoInitDeferred.reject(new Error('VWO settings could not be fetched'));
199
- }, 5000);
200
- }
201
- return [2 /*return*/, _global.vwoInitDeferred.promise];
202
- }
203
- catch (err) {
204
- msg = (0, LogMessageUtil_1.buildMessage)(log_messages_1.ErrorLogMessagesEnum.API_THROW_ERROR, {
205
- apiName: apiName,
206
- err: err,
207
- });
208
- console.info("[INFO]: VWO-SDK ".concat(new Date().toISOString(), " ").concat(msg));
209
- }
210
- return [2 /*return*/];
211
- });
212
- });
213
- }
214
- exports.onInit = onInit;
215
- //# sourceMappingURL=V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C9B,OAAO;wBACT,CAAC;wBAED,IAAM,GAAG,GAAG,IAAA,6BAAY,EAAC,kCAAmB,CAAC,uBAAuB,EAAE;4BACpE,IAAI,QAAA;yBACL,CAAC,CAAC;wBAEH,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;wBACnB,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;oBACjF,CAAC,EAAE,IAAI,CAAC,CAAC;gBACX,CAAC;gBAED,sBAAO,OAAO,CAAC,eAAe,CAAC,OAAO,EAAC;YACzC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACP,GAAG,GAAG,IAAA,6BAAY,EAAC,mCAAoB,CAAC,eAAe,EAAE;oBAC7D,OAAO,SAAA;oBACP,GAAG,KAAA;iBACJ,CAAC,CAAC;gBAEH,OAAO,CAAC,IAAI,CAAC,0BAAmB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,cAAI,GAAG,CAAE,CAAC,CAAC;YACrE,CAAC;;;;CACF;AAzCD,wBAyCC"}
@@ -1,114 +0,0 @@
1
- /**
2
- * Copyright 2024 Wingify Software Pvt. Ltd.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { dynamic } from './types/Common';
17
- import { ILogManager } from './packages/logger';
18
- import { Storage } from './packages/storage';
19
- import { IVWOClient } from './VWOClient';
20
- import { SettingsModel } from './models/settings/SettingsModel';
21
- import { IVWOOptions } from './models/VWOOptionsModel';
22
- export interface IVWOBuilder {
23
- settings: SettingsModel;
24
- storage: Storage;
25
- logManager: ILogManager;
26
- isSettingsFetchInProgress: boolean;
27
- vwoInstance: IVWOClient;
28
- build(settings: SettingsModel): IVWOClient;
29
- fetchSettings(): Promise<SettingsModel>;
30
- setSettingsManager(): this;
31
- getSettings(force: boolean): Promise<dynamic>;
32
- setStorage(): this;
33
- setNetworkManager(): this;
34
- initPolling(): this;
35
- setLogger(): this;
36
- setSegmentation(): this;
37
- }
38
- export declare class VWOBuilder implements IVWOBuilder {
39
- readonly sdkKey: string;
40
- readonly options: IVWOOptions;
41
- private settingFileManager;
42
- settings: SettingsModel;
43
- storage: Storage;
44
- logManager: ILogManager;
45
- originalSettings: dynamic;
46
- isSettingsFetchInProgress: boolean;
47
- vwoInstance: IVWOClient;
48
- constructor(options: IVWOOptions);
49
- /**
50
- * Sets the network manager with the provided client and development mode options.
51
- * @returns {this} The instance of this builder.
52
- */
53
- setNetworkManager(): this;
54
- /**
55
- * Sets the segmentation evaluator with the provided segmentation options.
56
- * @returns {this} The instance of this builder.
57
- */
58
- setSegmentation(): this;
59
- /**
60
- * Fetches settings asynchronously, ensuring no parallel fetches.
61
- * @param {boolean} [force=false] - Force fetch ignoring cache.
62
- * @returns {Promise<SettingsModel>} A promise that resolves to the fetched settings.
63
- */
64
- fetchSettings(force?: boolean): Promise<SettingsModel>;
65
- /**
66
- * Gets the settings, fetching them if not cached or if forced.
67
- * @param {boolean} [force=false] - Force fetch ignoring cache.
68
- * @returns {Promise<SettingsModel>} A promise that resolves to the settings.
69
- */
70
- getSettings(force?: boolean): Promise<SettingsModel>;
71
- /**
72
- * Sets the storage connector based on the provided storage options.
73
- * @returns {this} The instance of this builder.
74
- */
75
- setStorage(): this;
76
- /**
77
- * Sets the settings manager with the provided options.
78
- * @returns {this} The instance of this builder.
79
- */
80
- setSettingsManager(): this;
81
- /**
82
- * Sets the logger with the provided logger options.
83
- * @returns {this} The instance of this builder.
84
- */
85
- setLogger(): this;
86
- /**
87
- * Sets the analytics callback with the provided analytics options.
88
- * @returns {this} The instance of this builder.
89
- */
90
- /**
91
- * Generates a random user ID based on the provided API key.
92
- * @returns {string} The generated random user ID.
93
- */
94
- getRandomUserId(): string;
95
- /**
96
- * Initializes the batching with the provided batch events options.
97
- * @returns {this} The instance of this builder.
98
- */
99
- /**
100
- * Initializes the polling with the provided poll interval.
101
- * @returns {this} The instance of this builder.
102
- */
103
- initPolling(): this;
104
- /**
105
- * Builds a new VWOClient instance with the provided settings.
106
- * @param {SettingsModel} settings - The settings for the VWOClient.
107
- * @returns {VWOClient} The new VWOClient instance.
108
- */
109
- build(settings: SettingsModel): IVWOClient;
110
- /**
111
- * Checks and polls for settings updates at the provided interval.
112
- */
113
- checkAndPoll(): void;
114
- }