@coframe/sdk 1.1.6 → 1.1.7

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.
@@ -926,7 +926,7 @@ function warnEventsNotSent() {
926
926
  }
927
927
  }
928
928
 
929
- const SDK_VERSION = '2.4.0';
929
+ const SDK_VERSION = '2.5.0';
930
930
  const queuedEvents = [];
931
931
  const queuedMonitoringEvents = [];
932
932
  const queuedSessions = [];
@@ -1016,6 +1016,18 @@ function queueEvent(coframe, sessionInfo) {
1016
1016
  }
1017
1017
  queueEventForBatchedSending(coframe, data);
1018
1018
  }
1019
+ function queueVariantViewEvent(coframe, { projectId, sessionId, orgId, userToken, experimentId, variantId, }) {
1020
+ queueEventForBatchedSending(coframe, {
1021
+ type: 'view',
1022
+ project_id: projectId,
1023
+ session_id: sessionId,
1024
+ experiment_id: experimentId,
1025
+ variant_id: variantId,
1026
+ time: new Date(),
1027
+ org_id: orgId,
1028
+ user_token: userToken,
1029
+ });
1030
+ }
1019
1031
  function sendPageEngagementEvent(coframe, eventType, event, { isEngaged, projectId, sessionId, orgId, duration = 0, userToken, personalizationHeaders, }) {
1020
1032
  var _a;
1021
1033
  const startTime = performance.now();
@@ -3040,14 +3052,13 @@ function setupListeners(Coframe, executionStartTime) {
3040
3052
  if (isElementVisible(el)) {
3041
3053
  el.setAttribute('coframe-experienced', 'true');
3042
3054
  experiencedCoframeIds.add(variant.id);
3043
- queueEventForBatchedSending(Coframe, {
3044
- type: 'view',
3045
- project_id: Coframe.projectId,
3046
- session_id: Coframe.sessionId,
3047
- experiment_id: variant.experiment_id,
3048
- variant_id: variant.id,
3049
- time: new Date(),
3055
+ queueVariantViewEvent(Coframe, {
3056
+ projectId: Coframe.projectId,
3057
+ sessionId: Coframe.sessionId,
3050
3058
  orgId: Coframe.orgId,
3059
+ userToken: Coframe.userToken,
3060
+ experimentId: variant.experiment_id,
3061
+ variantId: variant.id,
3051
3062
  });
3052
3063
  }
3053
3064
  }
@@ -924,7 +924,7 @@ function warnEventsNotSent() {
924
924
  }
925
925
  }
926
926
 
927
- const SDK_VERSION = '2.4.0';
927
+ const SDK_VERSION = '2.5.0';
928
928
  const queuedEvents = [];
929
929
  const queuedMonitoringEvents = [];
930
930
  const queuedSessions = [];
@@ -1014,6 +1014,18 @@ function queueEvent(coframe, sessionInfo) {
1014
1014
  }
1015
1015
  queueEventForBatchedSending(coframe, data);
1016
1016
  }
1017
+ function queueVariantViewEvent(coframe, { projectId, sessionId, orgId, userToken, experimentId, variantId, }) {
1018
+ queueEventForBatchedSending(coframe, {
1019
+ type: 'view',
1020
+ project_id: projectId,
1021
+ session_id: sessionId,
1022
+ experiment_id: experimentId,
1023
+ variant_id: variantId,
1024
+ time: new Date(),
1025
+ org_id: orgId,
1026
+ user_token: userToken,
1027
+ });
1028
+ }
1017
1029
  function sendPageEngagementEvent(coframe, eventType, event, { isEngaged, projectId, sessionId, orgId, duration = 0, userToken, personalizationHeaders, }) {
1018
1030
  var _a;
1019
1031
  const startTime = performance.now();
@@ -3038,14 +3050,13 @@ function setupListeners(Coframe, executionStartTime) {
3038
3050
  if (isElementVisible(el)) {
3039
3051
  el.setAttribute('coframe-experienced', 'true');
3040
3052
  experiencedCoframeIds.add(variant.id);
3041
- queueEventForBatchedSending(Coframe, {
3042
- type: 'view',
3043
- project_id: Coframe.projectId,
3044
- session_id: Coframe.sessionId,
3045
- experiment_id: variant.experiment_id,
3046
- variant_id: variant.id,
3047
- time: new Date(),
3053
+ queueVariantViewEvent(Coframe, {
3054
+ projectId: Coframe.projectId,
3055
+ sessionId: Coframe.sessionId,
3048
3056
  orgId: Coframe.orgId,
3057
+ userToken: Coframe.userToken,
3058
+ experimentId: variant.experiment_id,
3059
+ variantId: variant.id,
3049
3060
  });
3050
3061
  }
3051
3062
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coframe/sdk",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
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",