@coframe/sdk 1.1.46 → 1.1.47
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/pkg/cf.cjs.js +5 -2
- package/dist/pkg/cf.esm.mjs +5 -2
- package/package.json +1 -1
package/dist/pkg/cf.cjs.js
CHANGED
|
@@ -2069,6 +2069,7 @@ const applyVariantChanges = (variantElements, currentUrl, logger, nonce, lifecyc
|
|
|
2069
2069
|
? lifecycleContext.runtime.createVariantSession({
|
|
2070
2070
|
batchId: lifecycleContext.batchId,
|
|
2071
2071
|
variantId: variant.id,
|
|
2072
|
+
experimentId: variant.experiment_id,
|
|
2072
2073
|
})
|
|
2073
2074
|
: null;
|
|
2074
2075
|
if (!variant.modifications ||
|
|
@@ -2106,7 +2107,7 @@ const applyVariantChanges = (variantElements, currentUrl, logger, nonce, lifecyc
|
|
|
2106
2107
|
});
|
|
2107
2108
|
}
|
|
2108
2109
|
else if (selectedElement instanceof HTMLElement) {
|
|
2109
|
-
selectedElement.setAttribute('coframe-exp-id', variant.
|
|
2110
|
+
selectedElement.setAttribute('coframe-exp-id', variant.experiment_id);
|
|
2110
2111
|
}
|
|
2111
2112
|
}
|
|
2112
2113
|
return true;
|
|
@@ -4159,7 +4160,7 @@ function setupListeners(Coframe, executionStartTime) {
|
|
|
4159
4160
|
for (const variantElement of Coframe.variantsAndElements || []) {
|
|
4160
4161
|
const variant = variantElement.variant;
|
|
4161
4162
|
if (!experiencedCoframeIds.has(variant.id)) {
|
|
4162
|
-
const elements = document.querySelectorAll(`[coframe-exp-id="${variant.
|
|
4163
|
+
const elements = document.querySelectorAll(`[coframe-exp-id="${variant.experiment_id}"]`);
|
|
4163
4164
|
for (const el of Array.from(elements)) {
|
|
4164
4165
|
if (isElementVisible(el)) {
|
|
4165
4166
|
el.setAttribute('coframe-experienced', 'true');
|
|
@@ -5389,6 +5390,7 @@ function createVariantSession(options) {
|
|
|
5389
5390
|
getPageState: () => ({ ...options.getPageState() }),
|
|
5390
5391
|
getState: () => ({ ...state }),
|
|
5391
5392
|
getVariantId: () => state.variantId,
|
|
5393
|
+
getExperimentId: () => options.experimentId,
|
|
5392
5394
|
onPage: (event, handler) => subscribe(event, handler, false),
|
|
5393
5395
|
oncePage: (event, handler) => subscribe(event, handler, true),
|
|
5394
5396
|
ready() {
|
|
@@ -5748,6 +5750,7 @@ function createPageRuntime(options) {
|
|
|
5748
5750
|
const session = createVariantSession({
|
|
5749
5751
|
sessionId: createId(),
|
|
5750
5752
|
variantId: input.variantId,
|
|
5753
|
+
experimentId: input.experimentId,
|
|
5751
5754
|
batchId: batch.batchId,
|
|
5752
5755
|
routeVersion: batch.routeVersion,
|
|
5753
5756
|
getPageState: () => ({ ...state }),
|
package/dist/pkg/cf.esm.mjs
CHANGED
|
@@ -2067,6 +2067,7 @@ const applyVariantChanges = (variantElements, currentUrl, logger, nonce, lifecyc
|
|
|
2067
2067
|
? lifecycleContext.runtime.createVariantSession({
|
|
2068
2068
|
batchId: lifecycleContext.batchId,
|
|
2069
2069
|
variantId: variant.id,
|
|
2070
|
+
experimentId: variant.experiment_id,
|
|
2070
2071
|
})
|
|
2071
2072
|
: null;
|
|
2072
2073
|
if (!variant.modifications ||
|
|
@@ -2104,7 +2105,7 @@ const applyVariantChanges = (variantElements, currentUrl, logger, nonce, lifecyc
|
|
|
2104
2105
|
});
|
|
2105
2106
|
}
|
|
2106
2107
|
else if (selectedElement instanceof HTMLElement) {
|
|
2107
|
-
selectedElement.setAttribute('coframe-exp-id', variant.
|
|
2108
|
+
selectedElement.setAttribute('coframe-exp-id', variant.experiment_id);
|
|
2108
2109
|
}
|
|
2109
2110
|
}
|
|
2110
2111
|
return true;
|
|
@@ -4157,7 +4158,7 @@ function setupListeners(Coframe, executionStartTime) {
|
|
|
4157
4158
|
for (const variantElement of Coframe.variantsAndElements || []) {
|
|
4158
4159
|
const variant = variantElement.variant;
|
|
4159
4160
|
if (!experiencedCoframeIds.has(variant.id)) {
|
|
4160
|
-
const elements = document.querySelectorAll(`[coframe-exp-id="${variant.
|
|
4161
|
+
const elements = document.querySelectorAll(`[coframe-exp-id="${variant.experiment_id}"]`);
|
|
4161
4162
|
for (const el of Array.from(elements)) {
|
|
4162
4163
|
if (isElementVisible(el)) {
|
|
4163
4164
|
el.setAttribute('coframe-experienced', 'true');
|
|
@@ -5387,6 +5388,7 @@ function createVariantSession(options) {
|
|
|
5387
5388
|
getPageState: () => ({ ...options.getPageState() }),
|
|
5388
5389
|
getState: () => ({ ...state }),
|
|
5389
5390
|
getVariantId: () => state.variantId,
|
|
5391
|
+
getExperimentId: () => options.experimentId,
|
|
5390
5392
|
onPage: (event, handler) => subscribe(event, handler, false),
|
|
5391
5393
|
oncePage: (event, handler) => subscribe(event, handler, true),
|
|
5392
5394
|
ready() {
|
|
@@ -5746,6 +5748,7 @@ function createPageRuntime(options) {
|
|
|
5746
5748
|
const session = createVariantSession({
|
|
5747
5749
|
sessionId: createId(),
|
|
5748
5750
|
variantId: input.variantId,
|
|
5751
|
+
experimentId: input.experimentId,
|
|
5749
5752
|
batchId: batch.batchId,
|
|
5750
5753
|
routeVersion: batch.routeVersion,
|
|
5751
5754
|
getPageState: () => ({ ...state }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coframe/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"description": "Coframe optimizes your website using generative AI to deliver maximum impact to your audience and allow your site to improve itself as you sleep. Learn more at coframe.com.",
|
|
5
5
|
"main": "dist/pkg/cf.cjs.js",
|
|
6
6
|
"module": "dist/pkg/cf.esm.mjs",
|