@ninetailed/experience.js 3.1.0 → 3.1.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/index.cjs +5 -4
- package/index.js +5 -5
- package/lib/analytics/constants.d.ts +1 -0
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -2590,6 +2590,7 @@ const PROFILE_FALLBACK_CACHE = '__nt_profile__';
|
|
|
2590
2590
|
const PROFILE_CHANGE = 'profile-change';
|
|
2591
2591
|
const PROFILE_RESET = 'profile-reset';
|
|
2592
2592
|
const CONSENT = '__nt-consent__';
|
|
2593
|
+
const EMPTY_MERGE_ID = 'nt:empty-merge-id';
|
|
2593
2594
|
|
|
2594
2595
|
const PLUGIN_NAME = 'ninetailed';
|
|
2595
2596
|
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -2730,16 +2731,15 @@ const ninetailedPlugin = ({
|
|
|
2730
2731
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2731
2732
|
experience_jsShared.logger.info('Sending Identify event.');
|
|
2732
2733
|
const ctx = buildClientNinetailedRequestContext();
|
|
2733
|
-
if (payload.userId ===
|
|
2734
|
+
if (payload.userId === EMPTY_MERGE_ID && (!payload.traits || typeof payload.traits === 'object' && Object.keys(payload.traits).length === 0)) {
|
|
2734
2735
|
experience_jsShared.logger.info('Skipping Identify event as no userId and no traits are set.');
|
|
2735
2736
|
return;
|
|
2736
2737
|
}
|
|
2737
2738
|
return enqueueEvent(experience_jsShared.buildIdentifyEvent({
|
|
2738
|
-
// doing this here as the anonymous id is set to late from init
|
|
2739
2739
|
messageId: payload.meta.rid,
|
|
2740
2740
|
timestamp: payload.meta.ts,
|
|
2741
2741
|
traits: payload.traits,
|
|
2742
|
-
userId: payload.userId,
|
|
2742
|
+
userId: payload.userId === EMPTY_MERGE_ID ? '' : payload.userId,
|
|
2743
2743
|
ctx
|
|
2744
2744
|
}));
|
|
2745
2745
|
}),
|
|
@@ -3244,7 +3244,7 @@ class Ninetailed {
|
|
|
3244
3244
|
throw new Error(`[Validation Error] "identify" was called with invalid params. Traits are no valid json: ${result.error.format()}`);
|
|
3245
3245
|
}
|
|
3246
3246
|
yield this.waitUntilInitialized();
|
|
3247
|
-
yield this.instance.identify(uid.toString(), result.data, this.buildOptions(options));
|
|
3247
|
+
yield this.instance.identify(uid && uid.toString() !== '' ? uid.toString() : EMPTY_MERGE_ID, result.data, this.buildOptions(options));
|
|
3248
3248
|
return this.eventQueue.flush();
|
|
3249
3249
|
} catch (error) {
|
|
3250
3250
|
experience_jsShared.logger.error(error);
|
|
@@ -4324,6 +4324,7 @@ const decodeExperienceVariantsMap = encodedExperienceVariantsMap => {
|
|
|
4324
4324
|
exports.ANONYMOUS_ID = ANONYMOUS_ID;
|
|
4325
4325
|
exports.CONSENT = CONSENT;
|
|
4326
4326
|
exports.DEBUG_FLAG = DEBUG_FLAG;
|
|
4327
|
+
exports.EMPTY_MERGE_ID = EMPTY_MERGE_ID;
|
|
4327
4328
|
exports.EXPERIENCE_TRAIT_PREFIX = EXPERIENCE_TRAIT_PREFIX;
|
|
4328
4329
|
exports.LEGACY_ANONYMOUS_ID = LEGACY_ANONYMOUS_ID;
|
|
4329
4330
|
exports.Ninetailed = Ninetailed;
|
package/index.js
CHANGED
|
@@ -2577,6 +2577,7 @@ const PROFILE_FALLBACK_CACHE = '__nt_profile__';
|
|
|
2577
2577
|
const PROFILE_CHANGE = 'profile-change';
|
|
2578
2578
|
const PROFILE_RESET = 'profile-reset';
|
|
2579
2579
|
const CONSENT = '__nt-consent__';
|
|
2580
|
+
const EMPTY_MERGE_ID = 'nt:empty-merge-id';
|
|
2580
2581
|
|
|
2581
2582
|
const PLUGIN_NAME = 'ninetailed';
|
|
2582
2583
|
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -2717,16 +2718,15 @@ const ninetailedPlugin = ({
|
|
|
2717
2718
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2718
2719
|
logger.info('Sending Identify event.');
|
|
2719
2720
|
const ctx = buildClientNinetailedRequestContext();
|
|
2720
|
-
if (payload.userId ===
|
|
2721
|
+
if (payload.userId === EMPTY_MERGE_ID && (!payload.traits || typeof payload.traits === 'object' && Object.keys(payload.traits).length === 0)) {
|
|
2721
2722
|
logger.info('Skipping Identify event as no userId and no traits are set.');
|
|
2722
2723
|
return;
|
|
2723
2724
|
}
|
|
2724
2725
|
return enqueueEvent(buildIdentifyEvent({
|
|
2725
|
-
// doing this here as the anonymous id is set to late from init
|
|
2726
2726
|
messageId: payload.meta.rid,
|
|
2727
2727
|
timestamp: payload.meta.ts,
|
|
2728
2728
|
traits: payload.traits,
|
|
2729
|
-
userId: payload.userId,
|
|
2729
|
+
userId: payload.userId === EMPTY_MERGE_ID ? '' : payload.userId,
|
|
2730
2730
|
ctx
|
|
2731
2731
|
}));
|
|
2732
2732
|
}),
|
|
@@ -3231,7 +3231,7 @@ class Ninetailed {
|
|
|
3231
3231
|
throw new Error(`[Validation Error] "identify" was called with invalid params. Traits are no valid json: ${result.error.format()}`);
|
|
3232
3232
|
}
|
|
3233
3233
|
yield this.waitUntilInitialized();
|
|
3234
|
-
yield this.instance.identify(uid.toString(), result.data, this.buildOptions(options));
|
|
3234
|
+
yield this.instance.identify(uid && uid.toString() !== '' ? uid.toString() : EMPTY_MERGE_ID, result.data, this.buildOptions(options));
|
|
3235
3235
|
return this.eventQueue.flush();
|
|
3236
3236
|
} catch (error) {
|
|
3237
3237
|
logger.error(error);
|
|
@@ -4308,4 +4308,4 @@ const decodeExperienceVariantsMap = encodedExperienceVariantsMap => {
|
|
|
4308
4308
|
}), {});
|
|
4309
4309
|
};
|
|
4310
4310
|
|
|
4311
|
-
export { ANONYMOUS_ID, CONSENT, DEBUG_FLAG, EXPERIENCE_TRAIT_PREFIX, LEGACY_ANONYMOUS_ID, Ninetailed, PLUGIN_NAME, PROFILE_CHANGE, PROFILE_FALLBACK_CACHE, PROFILE_RESET, decodeExperienceVariantsMap, isExperienceMatch, ninetailedPlugin, selectActiveExperiments, selectDistribution, selectEligibleExperiences, selectExperience, selectBaselineWithVariants as selectExperienceBaselineWithVariants, selectVariant as selectExperienceVariant, selectVariants as selectExperienceVariants, selectHasVariants as selectHasExperienceVariants, selectVariant$1 as selectVariant };
|
|
4311
|
+
export { ANONYMOUS_ID, CONSENT, DEBUG_FLAG, EMPTY_MERGE_ID, EXPERIENCE_TRAIT_PREFIX, LEGACY_ANONYMOUS_ID, Ninetailed, PLUGIN_NAME, PROFILE_CHANGE, PROFILE_FALLBACK_CACHE, PROFILE_RESET, decodeExperienceVariantsMap, isExperienceMatch, ninetailedPlugin, selectActiveExperiments, selectDistribution, selectEligibleExperiences, selectExperience, selectBaselineWithVariants as selectExperienceBaselineWithVariants, selectVariant as selectExperienceVariant, selectVariants as selectExperienceVariants, selectHasVariants as selectHasExperienceVariants, selectVariant$1 as selectVariant };
|
|
@@ -5,3 +5,4 @@ export declare const PROFILE_FALLBACK_CACHE = "__nt_profile__";
|
|
|
5
5
|
export declare const PROFILE_CHANGE = "profile-change";
|
|
6
6
|
export declare const PROFILE_RESET = "profile-reset";
|
|
7
7
|
export declare const CONSENT = "__nt-consent__";
|
|
8
|
+
export declare const EMPTY_MERGE_ID = "nt:empty-merge-id";
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"module": "./index.js",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@ninetailed/experience.js-shared": "3.1.
|
|
9
|
+
"@ninetailed/experience.js-shared": "3.1.1",
|
|
10
10
|
"analytics": "0.8.1",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
12
|
"murmurhash-js": "1.0.0",
|
|
13
|
-
"@ninetailed/experience.js-plugin-analytics": "3.1.
|
|
13
|
+
"@ninetailed/experience.js-plugin-analytics": "3.1.1"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {}
|
|
16
16
|
}
|