vwo-fme-node-sdk 1.5.2 → 1.7.0

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 (43) hide show
  1. package/CHANGELOG.md +67 -9
  2. package/dist/client/vwo-fme-javascript-sdk.js +350 -164
  3. package/dist/client/vwo-fme-javascript-sdk.js.map +1 -1
  4. package/dist/client/vwo-fme-javascript-sdk.min.js +2 -2
  5. package/dist/client/vwo-fme-javascript-sdk.min.js.map +1 -1
  6. package/dist/package.json +1 -1
  7. package/dist/server/vwo-fme-node-sdk.js +513 -162
  8. package/dist/server/vwo-fme-node-sdk.js.map +1 -1
  9. package/dist/server/vwo-fme-node-sdk.min.js +2 -2
  10. package/dist/server/vwo-fme-node-sdk.min.js.map +1 -1
  11. package/dist/server-unpacked/VWOClient.js +95 -42
  12. package/dist/server-unpacked/VWOClient.js.map +1 -1
  13. package/dist/server-unpacked/api/GetFlag.js +73 -56
  14. package/dist/server-unpacked/api/GetFlag.js.map +1 -1
  15. package/dist/server-unpacked/api/SetAttribute.js +27 -6
  16. package/dist/server-unpacked/api/SetAttribute.js.map +1 -1
  17. package/dist/server-unpacked/api/TrackEvent.js +33 -17
  18. package/dist/server-unpacked/api/TrackEvent.js.map +1 -1
  19. package/dist/server-unpacked/decorators/StorageDecorator.js +1 -1
  20. package/dist/server-unpacked/decorators/StorageDecorator.js.map +1 -1
  21. package/dist/server-unpacked/models/VWOOptionsModel.js +3 -0
  22. package/dist/server-unpacked/models/VWOOptionsModel.js.map +1 -1
  23. package/dist/server-unpacked/utils/ImpressionUtil.js +53 -9
  24. package/dist/server-unpacked/utils/ImpressionUtil.js.map +1 -1
  25. package/dist/server-unpacked/utils/NetworkUtil.js +45 -16
  26. package/dist/server-unpacked/utils/NetworkUtil.js.map +1 -1
  27. package/dist/server-unpacked/utils/RuleEvaluationUtil.js +19 -13
  28. package/dist/server-unpacked/utils/RuleEvaluationUtil.js.map +1 -1
  29. package/dist/types/VWOClient.d.ts +10 -2
  30. package/dist/types/api/SetAttribute.d.ts +12 -2
  31. package/dist/types/models/VWOOptionsModel.d.ts +2 -0
  32. package/dist/types/utils/ImpressionUtil.d.ts +1 -1
  33. package/dist/types/utils/NetworkUtil.d.ts +11 -1
  34. package/lib/VWOClient.ts +14 -3
  35. package/lib/api/GetFlag.ts +36 -10
  36. package/lib/api/SetAttribute.ts +24 -5
  37. package/lib/api/TrackEvent.ts +12 -3
  38. package/lib/decorators/StorageDecorator.ts +1 -1
  39. package/lib/models/VWOOptionsModel.ts +6 -0
  40. package/lib/utils/ImpressionUtil.ts +2 -2
  41. package/lib/utils/NetworkUtil.ts +21 -2
  42. package/lib/utils/RuleEvaluationUtil.ts +11 -1
  43. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,17 +5,66 @@ 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.6.1] - 2024-09-03
9
+
10
+ ### Added
11
+
12
+ - feat: added support to wait for network response incase of edge like environment.
13
+
14
+ ```javascript
15
+ const { init } = require('vwo-fme-node-sdk');
16
+
17
+ const vwoClient = await init({
18
+ accountId: '123456', // VWO Account ID
19
+ sdkKey: '32-alpha-numeric-sdk-key', // SDK Key
20
+ shouldWaitForTrackingCalls: true, // if running on edge env
21
+ });
22
+ ```
23
+
24
+ ## [1.6.0] - 2024-08-27
25
+
26
+ ### Fixed
27
+
28
+ - Update key name from `user` to `userId` for storing User ID in storage connector.
29
+
30
+ ```javascript
31
+ class StorageConnector extends StorageConnector {
32
+ constructor() {
33
+ super();
34
+ }
35
+
36
+ /**
37
+ * Get data from storage
38
+ * @param {string} featureKey
39
+ * @param {string} userId
40
+ * @returns {Promise<any>}
41
+ */
42
+ async get(featureKey, userId) {
43
+ // return await data (based on featureKey and userId)
44
+ }
45
+
46
+ /**
47
+ * Set data in storage
48
+ * @param {object} data
49
+ */
50
+ async set(data) {
51
+ // Set data corresponding to a featureKey and user ID
52
+ // Use data.featureKey and data.userId to store the above data for a specific feature and a user
53
+ }
54
+ }
55
+ ```
56
+
8
57
  ## [1.5.2] - 2024-08-20
9
58
 
10
59
  ### Fixed
11
60
 
12
- - fix: Updated regular expressions for `GREATER_THAN_MATCH`, `GREATER_THAN_EQUAL_TO_MATCH`, `LESS_THAN_MATCH`, and `LESS_THAN_EQUAL_TO_MATCH` segmentation operators
61
+ - Updated regular expressions for `GREATER_THAN_MATCH`, `GREATER_THAN_EQUAL_TO_MATCH`, `LESS_THAN_MATCH`, and `LESS_THAN_EQUAL_TO_MATCH` segmentation operators
13
62
 
14
63
  ## [1.5.1] - 2024-08-13
15
64
 
16
65
  ### Fixed
17
66
 
18
- - fix: Encode user-agent in `setAttribute` and `trackEvent` APIs before making a call to VWO server`
67
+ - Encode user-agent in `setAttribute` and `trackEvent` APIs before making a call to VWO server`
19
68
 
20
69
  ## [1.5.0] - 2024-08-01
21
70
 
@@ -115,14 +164,23 @@ Client-side Javascript SDK
115
164
  super();
116
165
  }
117
166
 
118
- async get(key) {
119
- // return promise based data for feature-key
120
- // return await this.map[key];
167
+ /**
168
+ * Get data from storage
169
+ * @param {string} featureKey
170
+ * @param {string} userId
171
+ * @returns {Promise<any>}
172
+ */
173
+ async get(featureKey, userId) {
174
+ // return await data (based on featureKey and userId)
121
175
  }
122
176
 
123
- async set(key, data) {
124
- // Set data for feature-key
125
- // this.map[key] = data;
177
+ /**
178
+ * Set data in storage
179
+ * @param {object} data
180
+ */
181
+ async set(data) {
182
+ // Set data corresponding to a featureKey and user ID
183
+ // Use data.featureKey and data.userId to store the above data for a specific feature and a user
126
184
  }
127
185
  }
128
186
 
@@ -237,4 +295,4 @@ Client-side Javascript SDK
237
295
 
238
296
  // track event
239
297
  vwoClient.trackEvent('addToCart', eventProperties, userContext);
240
- ```
298
+ ```