@uniformdev/context 20.32.2-alpha.2 → 20.33.1-alpha.53

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.
@@ -1,4 +1,4 @@
1
- import { aI as paths$7, $ as ManifestV2 } from '../types-CzIkFCDD.mjs';
1
+ import { aJ as paths$7, $ as ManifestV2 } from '../types-BxuNEj-w.mjs';
2
2
  import 'mitt';
3
3
 
4
4
  type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
package/dist/api/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aI as paths$7, $ as ManifestV2 } from '../types-CzIkFCDD.js';
1
+ import { aJ as paths$7, $ as ManifestV2 } from '../types-BxuNEj-w.js';
2
2
  import 'mitt';
3
3
 
4
4
  type LimitPolicy = <ReturnValue>(func: () => Promise<ReturnValue>) => Promise<ReturnValue>;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, P as PersonalizedVariant, g as PersonalizeOptions, h as Context, i as PersonalizedResult, j as VariationMatchDimensionCriteria, k as PersonalizationSelectionAlgorithmOptions, l as DevToolsEvents } from './types-CzIkFCDD.mjs';
2
- export { a7 as AggregateDimensionInput, ad as BehaviorTag, m as CONTEXTUAL_EDITING_TEST_NAME, n as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, u as ContextEvents, v as ContextInstance, q as ContextOptions, aF as ContextState, aG as ContextStateUpdate, Z as CriteriaEvaluatorParameters, Y as CriteriaEvaluatorResult, au as DecayOptions, y as DevToolsActions, E as DevToolsDataEvent, z as DevToolsEvent, I as DevToolsForgetEvent, F as DevToolsHelloEvent, B as DevToolsLogEvent, H as DevToolsRawCommandsEvent, x as DevToolsState, w as DevToolsUiVersion, G as DevToolsUpdateEvent, ab as DimensionMatch, a4 as EnrichmentCategory, aA as EnrichmentData, aD as EventData, aH as GoalStateUpdate, az as Goals, X as GroupCriteriaEvaluator, an as IdentifyCommand, U as LogMessageGroup, R as LogMessageSingle, J as LogMessages, W as ManifestInstance, $ as ManifestV2, M as MessageCategory, N as MessageFunc, ai as ModifyScoreCommand, aj as ModifySessionScoreCommand, a5 as NumberMatch, s as PersonalizationEvent, r as PersonalizationEventVariantId, a0 as PersonalizationManifest, o as PersonalizationSelectionAlgorithm, p as PersonalizationSelectionAlgorithms, aB as PersonalizeControlVariant, aC as PersonalizeVariants, ac as QuirkMatch, as as SERVER_STATE_ID, ar as ServerToClientTransitionState, ak as SetConsentCommand, ao as SetControlGroupCommand, ah as SetGoalCommand, ap as SetPersonalizeVariantControlCommand, al as SetQuirkCommand, am as SetTestCommand, K as Severity, a1 as Signal, a3 as SignalCriteria, a2 as SignalCriteriaGroup, _ as SignalData, ag as StorageCommand, a6 as TestDefinition, t as TestEvent, a8 as TestOptions, af as TestResult, ae as TestVariant, ay as Tests, at as TransitionDataStoreEvents, aa as VariationMatchMetadata, ax as VisitorDataStore, aw as VisitorDataStoreEvents, av as VisitorDataStoreOptions, aq as areCommandsEqual, aE as emptyVisitorData, a9 as testVariations } from './types-CzIkFCDD.mjs';
1
+ import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, P as PersonalizedVariant, g as PersonalizeOptions, h as Context, i as PersonalizedResult, j as VariationMatchDimensionCriteria, k as PersonalizationSelectionAlgorithmOptions, l as DevToolsEvents } from './types-BxuNEj-w.mjs';
2
+ export { a7 as AggregateDimensionInput, ad as BehaviorTag, m as CONTEXTUAL_EDITING_TEST_NAME, n as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, aF as CompositionMetadata, u as ContextEvents, v as ContextInstance, q as ContextOptions, aG as ContextState, aH as ContextStateUpdate, Z as CriteriaEvaluatorParameters, Y as CriteriaEvaluatorResult, au as DecayOptions, y as DevToolsActions, E as DevToolsDataEvent, z as DevToolsEvent, I as DevToolsForgetEvent, F as DevToolsHelloEvent, B as DevToolsLogEvent, H as DevToolsRawCommandsEvent, x as DevToolsState, w as DevToolsUiVersion, G as DevToolsUpdateEvent, ab as DimensionMatch, a4 as EnrichmentCategory, aA as EnrichmentData, aD as EventData, aI as GoalStateUpdate, az as Goals, X as GroupCriteriaEvaluator, an as IdentifyCommand, U as LogMessageGroup, R as LogMessageSingle, J as LogMessages, W as ManifestInstance, $ as ManifestV2, M as MessageCategory, N as MessageFunc, ai as ModifyScoreCommand, aj as ModifySessionScoreCommand, a5 as NumberMatch, s as PersonalizationEvent, r as PersonalizationEventVariantId, a0 as PersonalizationManifest, o as PersonalizationSelectionAlgorithm, p as PersonalizationSelectionAlgorithms, aB as PersonalizeControlVariant, aC as PersonalizeVariants, ac as QuirkMatch, as as SERVER_STATE_ID, ar as ServerToClientTransitionState, ak as SetConsentCommand, ao as SetControlGroupCommand, ah as SetGoalCommand, ap as SetPersonalizeVariantControlCommand, al as SetQuirkCommand, am as SetTestCommand, K as Severity, a1 as Signal, a3 as SignalCriteria, a2 as SignalCriteriaGroup, _ as SignalData, ag as StorageCommand, a6 as TestDefinition, t as TestEvent, a8 as TestOptions, af as TestResult, ae as TestVariant, ay as Tests, at as TransitionDataStoreEvents, aa as VariationMatchMetadata, ax as VisitorDataStore, aw as VisitorDataStoreEvents, av as VisitorDataStoreOptions, aq as areCommandsEqual, aE as emptyVisitorData, a9 as testVariations } from './types-BxuNEj-w.mjs';
3
3
  import Cookies from 'js-cookie';
4
4
  import 'mitt';
5
5
 
@@ -229,9 +229,13 @@ type InsightsEndpoint = {
229
229
  apiKey?: string;
230
230
  projectId?: string;
231
231
  };
232
+
232
233
  type EnableUniformInsightsOptions = {
233
234
  endpoint: InsightsEndpoint;
234
235
  };
236
+ /**
237
+ * @deprecated Use `import { enableUniformInsights } from '@uniformdev/context-insights'` instead
238
+ */
235
239
  declare const enableUniformInsights: (options: EnableUniformInsightsOptions) => ContextPlugin;
236
240
 
237
241
  type QuickConnectConfig = {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, P as PersonalizedVariant, g as PersonalizeOptions, h as Context, i as PersonalizedResult, j as VariationMatchDimensionCriteria, k as PersonalizationSelectionAlgorithmOptions, l as DevToolsEvents } from './types-CzIkFCDD.js';
2
- export { a7 as AggregateDimensionInput, ad as BehaviorTag, m as CONTEXTUAL_EDITING_TEST_NAME, n as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, u as ContextEvents, v as ContextInstance, q as ContextOptions, aF as ContextState, aG as ContextStateUpdate, Z as CriteriaEvaluatorParameters, Y as CriteriaEvaluatorResult, au as DecayOptions, y as DevToolsActions, E as DevToolsDataEvent, z as DevToolsEvent, I as DevToolsForgetEvent, F as DevToolsHelloEvent, B as DevToolsLogEvent, H as DevToolsRawCommandsEvent, x as DevToolsState, w as DevToolsUiVersion, G as DevToolsUpdateEvent, ab as DimensionMatch, a4 as EnrichmentCategory, aA as EnrichmentData, aD as EventData, aH as GoalStateUpdate, az as Goals, X as GroupCriteriaEvaluator, an as IdentifyCommand, U as LogMessageGroup, R as LogMessageSingle, J as LogMessages, W as ManifestInstance, $ as ManifestV2, M as MessageCategory, N as MessageFunc, ai as ModifyScoreCommand, aj as ModifySessionScoreCommand, a5 as NumberMatch, s as PersonalizationEvent, r as PersonalizationEventVariantId, a0 as PersonalizationManifest, o as PersonalizationSelectionAlgorithm, p as PersonalizationSelectionAlgorithms, aB as PersonalizeControlVariant, aC as PersonalizeVariants, ac as QuirkMatch, as as SERVER_STATE_ID, ar as ServerToClientTransitionState, ak as SetConsentCommand, ao as SetControlGroupCommand, ah as SetGoalCommand, ap as SetPersonalizeVariantControlCommand, al as SetQuirkCommand, am as SetTestCommand, K as Severity, a1 as Signal, a3 as SignalCriteria, a2 as SignalCriteriaGroup, _ as SignalData, ag as StorageCommand, a6 as TestDefinition, t as TestEvent, a8 as TestOptions, af as TestResult, ae as TestVariant, ay as Tests, at as TransitionDataStoreEvents, aa as VariationMatchMetadata, ax as VisitorDataStore, aw as VisitorDataStoreEvents, av as VisitorDataStoreOptions, aq as areCommandsEqual, aE as emptyVisitorData, a9 as testVariations } from './types-CzIkFCDD.js';
1
+ import { O as OutputSeverity, L as LogDrain, C as ContextPlugin, S as ScoreVector, A as AggregateDimension, T as TransitionDataStore, a as StorageCommands, V as VisitorData, Q as Quirks, b as TransitionDataStoreOptions, D as DecayFunction, c as CriteriaEvaluator, d as StringMatch, e as VariantMatchCriteria, f as LogMessage, P as PersonalizedVariant, g as PersonalizeOptions, h as Context, i as PersonalizedResult, j as VariationMatchDimensionCriteria, k as PersonalizationSelectionAlgorithmOptions, l as DevToolsEvents } from './types-BxuNEj-w.js';
2
+ export { a7 as AggregateDimensionInput, ad as BehaviorTag, m as CONTEXTUAL_EDITING_TEST_NAME, n as CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID, aF as CompositionMetadata, u as ContextEvents, v as ContextInstance, q as ContextOptions, aG as ContextState, aH as ContextStateUpdate, Z as CriteriaEvaluatorParameters, Y as CriteriaEvaluatorResult, au as DecayOptions, y as DevToolsActions, E as DevToolsDataEvent, z as DevToolsEvent, I as DevToolsForgetEvent, F as DevToolsHelloEvent, B as DevToolsLogEvent, H as DevToolsRawCommandsEvent, x as DevToolsState, w as DevToolsUiVersion, G as DevToolsUpdateEvent, ab as DimensionMatch, a4 as EnrichmentCategory, aA as EnrichmentData, aD as EventData, aI as GoalStateUpdate, az as Goals, X as GroupCriteriaEvaluator, an as IdentifyCommand, U as LogMessageGroup, R as LogMessageSingle, J as LogMessages, W as ManifestInstance, $ as ManifestV2, M as MessageCategory, N as MessageFunc, ai as ModifyScoreCommand, aj as ModifySessionScoreCommand, a5 as NumberMatch, s as PersonalizationEvent, r as PersonalizationEventVariantId, a0 as PersonalizationManifest, o as PersonalizationSelectionAlgorithm, p as PersonalizationSelectionAlgorithms, aB as PersonalizeControlVariant, aC as PersonalizeVariants, ac as QuirkMatch, as as SERVER_STATE_ID, ar as ServerToClientTransitionState, ak as SetConsentCommand, ao as SetControlGroupCommand, ah as SetGoalCommand, ap as SetPersonalizeVariantControlCommand, al as SetQuirkCommand, am as SetTestCommand, K as Severity, a1 as Signal, a3 as SignalCriteria, a2 as SignalCriteriaGroup, _ as SignalData, ag as StorageCommand, a6 as TestDefinition, t as TestEvent, a8 as TestOptions, af as TestResult, ae as TestVariant, ay as Tests, at as TransitionDataStoreEvents, aa as VariationMatchMetadata, ax as VisitorDataStore, aw as VisitorDataStoreEvents, av as VisitorDataStoreOptions, aq as areCommandsEqual, aE as emptyVisitorData, a9 as testVariations } from './types-BxuNEj-w.js';
3
3
  import Cookies from 'js-cookie';
4
4
  import 'mitt';
5
5
 
@@ -229,9 +229,13 @@ type InsightsEndpoint = {
229
229
  apiKey?: string;
230
230
  projectId?: string;
231
231
  };
232
+
232
233
  type EnableUniformInsightsOptions = {
233
234
  endpoint: InsightsEndpoint;
234
235
  };
236
+ /**
237
+ * @deprecated Use `import { enableUniformInsights } from '@uniformdev/context-insights'` instead
238
+ */
235
239
  declare const enableUniformInsights: (options: EnableUniformInsightsOptions) => ContextPlugin;
236
240
 
237
241
  type QuickConnectConfig = {
package/dist/index.esm.js CHANGED
@@ -941,6 +941,9 @@ var testVariations = ({
941
941
  }
942
942
  if (selectedVariant) {
943
943
  onLogMessage == null ? void 0 : onLogMessage(["info", 404, selectedVariant.id]);
944
+ if (selectedVariant.control === void 0) {
945
+ selectedVariant.control = variations.findIndex((variation) => variation.id === selectedVariantId) === 0;
946
+ }
944
947
  }
945
948
  return {
946
949
  result: selectedVariant,
@@ -1795,7 +1798,7 @@ var Context = class {
1795
1798
  * i.e. pushing the same URL or cookies as before,
1796
1799
  * will NOT result in a recomputation of signal state.
1797
1800
  */
1798
- async update(newData) {
1801
+ async update({ compositionMetadata, ...newData }) {
1799
1802
  var _a, _b, _c, _d, _e;
1800
1803
  const commands = [];
1801
1804
  const newServerSideTests = {};
@@ -1904,7 +1907,10 @@ var Context = class {
1904
1907
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
1905
1908
  name: testName,
1906
1909
  variantId: testVariantId,
1907
- variantAssigned: true
1910
+ variantAssigned: true,
1911
+ // @todo this needs to be fixed, we should provide correct is control as well as canvas data
1912
+ control: false,
1913
+ compositionMetadata: void 0
1908
1914
  });
1909
1915
  });
1910
1916
  const haveQuirksChanged = __privateGet(this, _serverTransitionState) && !dequal5(__privateGet(this, _serverTransitionState).quirks, this.storage.data.quirks);
@@ -1986,7 +1992,7 @@ var Context = class {
1986
1992
  }
1987
1993
  /** Executes an A/B test with a given set of variants, showing the visitor's assigned variant (or selecting one to assign, if none is set yet) */
1988
1994
  test(options) {
1989
- var _a, _b, _c;
1995
+ var _a, _b, _c, _d, _e;
1990
1996
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
1991
1997
  const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
1992
1998
  const value2 = {
@@ -2003,7 +2009,9 @@ var Context = class {
2003
2009
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
2004
2010
  name: options.name,
2005
2011
  variantId: (_c = (_b = value.result) == null ? void 0 : _b.id) != null ? _c : void 0,
2006
- variantAssigned: value.variantAssigned
2012
+ variantAssigned: value.variantAssigned,
2013
+ control: (_e = (_d = value.result) == null ? void 0 : _d.control) != null ? _e : false,
2014
+ compositionMetadata: options.compositionMetadata
2007
2015
  });
2008
2016
  return value;
2009
2017
  }
@@ -2032,7 +2040,8 @@ var Context = class {
2032
2040
  control: variation.control
2033
2041
  })),
2034
2042
  control: this.storage.data.controlGroup,
2035
- changed: true
2043
+ changed: true,
2044
+ compositionMetadata: options.compositionMetadata
2036
2045
  };
2037
2046
  if (previousPlacement && dequal5(eventData.variantIds, previousPlacement)) {
2038
2047
  eventData.changed = false;
@@ -2092,6 +2101,27 @@ var Context = class {
2092
2101
  __privateGet(this, _pzCache)[event.name] = event.variantIds;
2093
2102
  __privateGet(this, _mitt3).emit("personalizationResult", event);
2094
2103
  }
2104
+ /**
2105
+ * Gets the current canvas data
2106
+ */
2107
+ getCompositionMetadata() {
2108
+ return __privateGet(this, _state).compositionMetadata;
2109
+ }
2110
+ /**
2111
+ * Updates the canvas data and emits a canvasDataUpdated event
2112
+ */
2113
+ async updateCompositionMetadata(newData) {
2114
+ const currentCanvas = __privateGet(this, _state).compositionMetadata || {};
2115
+ const updatedCanvas = { ...currentCanvas, ...newData };
2116
+ if (!dequal5(currentCanvas, updatedCanvas)) {
2117
+ __privateSet(this, _state, {
2118
+ ...__privateGet(this, _state),
2119
+ compositionMetadata: updatedCanvas
2120
+ });
2121
+ __privateGet(this, _mitt3).emit("canvasDataUpdated", updatedCanvas);
2122
+ __privateGet(this, _mitt3).emit("log", ["info", 4, "Canvas data updated"]);
2123
+ }
2124
+ }
2095
2125
  };
2096
2126
  _personalizationSelectionAlgorithms = new WeakMap();
2097
2127
  _serverTransitionState = new WeakMap();
@@ -2256,7 +2286,31 @@ var ScriptType = /* @__PURE__ */ ((ScriptType2) => {
2256
2286
  })(ScriptType || {});
2257
2287
  var EdgeNodeTagName = "nesitag";
2258
2288
 
2259
- // src/insights/index.ts
2289
+ // src/insights/storage.ts
2290
+ var createInsightsStorage = () => {
2291
+ const STORAGE_KEY2 = "ufin";
2292
+ return {
2293
+ get: () => {
2294
+ const data = localStorage.getItem(STORAGE_KEY2);
2295
+ if (!data) {
2296
+ return;
2297
+ }
2298
+ return JSON.parse(data);
2299
+ },
2300
+ set: (data) => {
2301
+ const toSet = {
2302
+ ...data,
2303
+ updated: Date.now()
2304
+ };
2305
+ localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2306
+ },
2307
+ clear: () => {
2308
+ localStorage.removeItem(STORAGE_KEY2);
2309
+ }
2310
+ };
2311
+ };
2312
+
2313
+ // src/insights/types.ts
2260
2314
  var getBasePayload = () => {
2261
2315
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
2262
2316
  const locale = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.userLanguage || navigator.language || navigator.browserLanguage || "en";
@@ -2269,13 +2323,34 @@ var getBasePayload = () => {
2269
2323
  href: window.location.href
2270
2324
  };
2271
2325
  };
2326
+ var generateVisitorId = async () => {
2327
+ return `visitor_${generalRandomId()}`;
2328
+ };
2329
+ var generateSessionId = async () => {
2330
+ return `session_${generalRandomId()}`;
2331
+ };
2332
+ var generatePageId = () => {
2333
+ return `page_${generalRandomId()}`;
2334
+ };
2335
+ var generalRandomId = () => {
2336
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2337
+ const id = crypto.randomUUID();
2338
+ return id.replaceAll("-", "").toLowerCase();
2339
+ }
2340
+ return Math.random().toString(32).substring(2);
2341
+ };
2342
+
2343
+ // src/insights/v1.ts
2272
2344
  var createInsightsClient = ({ endpoint }) => {
2273
2345
  let endpointUrl;
2274
2346
  const apiKey = endpoint.apiKey;
2275
2347
  const projectId = endpoint.projectId;
2276
2348
  if (endpoint.type === "api") {
2277
2349
  const url = new URL(endpoint.host);
2278
- url.pathname = "/v0/events";
2350
+ url.pathname = `/v0/events`;
2351
+ if (endpoint.host.includes("tinybird.co")) {
2352
+ url.pathname = "/v0/events";
2353
+ }
2279
2354
  url.searchParams.set("name", "analytics_events");
2280
2355
  endpointUrl = url.toString();
2281
2356
  } else {
@@ -2405,38 +2480,7 @@ var createInsightsClient = ({ endpoint }) => {
2405
2480
  }
2406
2481
  };
2407
2482
  };
2408
- var createInsightsStorage = () => {
2409
- const STORAGE_KEY2 = "ufin";
2410
- return {
2411
- get: () => {
2412
- const data = localStorage.getItem(STORAGE_KEY2);
2413
- if (!data) {
2414
- return;
2415
- }
2416
- return JSON.parse(data);
2417
- },
2418
- set: (data) => {
2419
- const toSet = {
2420
- ...data,
2421
- updated: Date.now()
2422
- };
2423
- localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2424
- },
2425
- clear: () => {
2426
- localStorage.removeItem(STORAGE_KEY2);
2427
- }
2428
- };
2429
- };
2430
- var generateVisitorId = () => {
2431
- return `visitor_${generalRandomId()}`;
2432
- };
2433
- var generateSessionId = () => {
2434
- return `session_${generalRandomId()}`;
2435
- };
2436
- var generatePageId = () => {
2437
- return `page_${generalRandomId()}`;
2438
- };
2439
- var createInsights = ({
2483
+ var createInsightsV1 = ({
2440
2484
  endpoint,
2441
2485
  sessionDurationSeconds = 30 * 60
2442
2486
  }) => {
@@ -2537,8 +2581,10 @@ var createInsights = ({
2537
2581
  }
2538
2582
  };
2539
2583
  };
2584
+
2585
+ // src/insights/index.ts
2540
2586
  var enableUniformInsights = (options) => {
2541
- const insights = createInsights({
2587
+ const insights = createInsightsV1({
2542
2588
  endpoint: options.endpoint
2543
2589
  });
2544
2590
  let previousUrl = void 0;
@@ -2584,8 +2630,8 @@ var enableUniformInsights = (options) => {
2584
2630
  };
2585
2631
  },
2586
2632
  update: (context) => {
2587
- if (context.url && context.url !== previousUrl) {
2588
- previousUrl = context.url;
2633
+ if (context.url && context.url.toString() !== previousUrl) {
2634
+ previousUrl = context.url.toString();
2589
2635
  insights.pageHit();
2590
2636
  }
2591
2637
  },
@@ -2594,13 +2640,6 @@ var enableUniformInsights = (options) => {
2594
2640
  }
2595
2641
  };
2596
2642
  };
2597
- var generalRandomId = () => {
2598
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2599
- const id = crypto.randomUUID();
2600
- return id.replaceAll("-", "").toLowerCase();
2601
- }
2602
- return Math.random().toString(32).substring(2);
2603
- };
2604
2643
 
2605
2644
  // src/logging/enableConsoleLogDrain.ts
2606
2645
  import rfdc2 from "rfdc";
package/dist/index.js CHANGED
@@ -1034,6 +1034,9 @@ var testVariations = ({
1034
1034
  }
1035
1035
  if (selectedVariant) {
1036
1036
  onLogMessage == null ? void 0 : onLogMessage(["info", 404, selectedVariant.id]);
1037
+ if (selectedVariant.control === void 0) {
1038
+ selectedVariant.control = variations.findIndex((variation) => variation.id === selectedVariantId) === 0;
1039
+ }
1037
1040
  }
1038
1041
  return {
1039
1042
  result: selectedVariant,
@@ -1888,7 +1891,7 @@ var Context = class {
1888
1891
  * i.e. pushing the same URL or cookies as before,
1889
1892
  * will NOT result in a recomputation of signal state.
1890
1893
  */
1891
- async update(newData) {
1894
+ async update({ compositionMetadata, ...newData }) {
1892
1895
  var _a, _b, _c, _d, _e;
1893
1896
  const commands = [];
1894
1897
  const newServerSideTests = {};
@@ -1997,7 +2000,10 @@ var Context = class {
1997
2000
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
1998
2001
  name: testName,
1999
2002
  variantId: testVariantId,
2000
- variantAssigned: true
2003
+ variantAssigned: true,
2004
+ // @todo this needs to be fixed, we should provide correct is control as well as canvas data
2005
+ control: false,
2006
+ compositionMetadata: void 0
2001
2007
  });
2002
2008
  });
2003
2009
  const haveQuirksChanged = __privateGet(this, _serverTransitionState) && !(0, import_lite5.dequal)(__privateGet(this, _serverTransitionState).quirks, this.storage.data.quirks);
@@ -2079,7 +2085,7 @@ var Context = class {
2079
2085
  }
2080
2086
  /** Executes an A/B test with a given set of variants, showing the visitor's assigned variant (or selecting one to assign, if none is set yet) */
2081
2087
  test(options) {
2082
- var _a, _b, _c;
2088
+ var _a, _b, _c, _d, _e;
2083
2089
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
2084
2090
  const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
2085
2091
  const value2 = {
@@ -2096,7 +2102,9 @@ var Context = class {
2096
2102
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
2097
2103
  name: options.name,
2098
2104
  variantId: (_c = (_b = value.result) == null ? void 0 : _b.id) != null ? _c : void 0,
2099
- variantAssigned: value.variantAssigned
2105
+ variantAssigned: value.variantAssigned,
2106
+ control: (_e = (_d = value.result) == null ? void 0 : _d.control) != null ? _e : false,
2107
+ compositionMetadata: options.compositionMetadata
2100
2108
  });
2101
2109
  return value;
2102
2110
  }
@@ -2125,7 +2133,8 @@ var Context = class {
2125
2133
  control: variation.control
2126
2134
  })),
2127
2135
  control: this.storage.data.controlGroup,
2128
- changed: true
2136
+ changed: true,
2137
+ compositionMetadata: options.compositionMetadata
2129
2138
  };
2130
2139
  if (previousPlacement && (0, import_lite5.dequal)(eventData.variantIds, previousPlacement)) {
2131
2140
  eventData.changed = false;
@@ -2185,6 +2194,27 @@ var Context = class {
2185
2194
  __privateGet(this, _pzCache)[event.name] = event.variantIds;
2186
2195
  __privateGet(this, _mitt3).emit("personalizationResult", event);
2187
2196
  }
2197
+ /**
2198
+ * Gets the current canvas data
2199
+ */
2200
+ getCompositionMetadata() {
2201
+ return __privateGet(this, _state).compositionMetadata;
2202
+ }
2203
+ /**
2204
+ * Updates the canvas data and emits a canvasDataUpdated event
2205
+ */
2206
+ async updateCompositionMetadata(newData) {
2207
+ const currentCanvas = __privateGet(this, _state).compositionMetadata || {};
2208
+ const updatedCanvas = { ...currentCanvas, ...newData };
2209
+ if (!(0, import_lite5.dequal)(currentCanvas, updatedCanvas)) {
2210
+ __privateSet(this, _state, {
2211
+ ...__privateGet(this, _state),
2212
+ compositionMetadata: updatedCanvas
2213
+ });
2214
+ __privateGet(this, _mitt3).emit("canvasDataUpdated", updatedCanvas);
2215
+ __privateGet(this, _mitt3).emit("log", ["info", 4, "Canvas data updated"]);
2216
+ }
2217
+ }
2188
2218
  };
2189
2219
  _personalizationSelectionAlgorithms = new WeakMap();
2190
2220
  _serverTransitionState = new WeakMap();
@@ -2349,7 +2379,31 @@ var ScriptType = /* @__PURE__ */ ((ScriptType2) => {
2349
2379
  })(ScriptType || {});
2350
2380
  var EdgeNodeTagName = "nesitag";
2351
2381
 
2352
- // src/insights/index.ts
2382
+ // src/insights/storage.ts
2383
+ var createInsightsStorage = () => {
2384
+ const STORAGE_KEY2 = "ufin";
2385
+ return {
2386
+ get: () => {
2387
+ const data = localStorage.getItem(STORAGE_KEY2);
2388
+ if (!data) {
2389
+ return;
2390
+ }
2391
+ return JSON.parse(data);
2392
+ },
2393
+ set: (data) => {
2394
+ const toSet = {
2395
+ ...data,
2396
+ updated: Date.now()
2397
+ };
2398
+ localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2399
+ },
2400
+ clear: () => {
2401
+ localStorage.removeItem(STORAGE_KEY2);
2402
+ }
2403
+ };
2404
+ };
2405
+
2406
+ // src/insights/types.ts
2353
2407
  var getBasePayload = () => {
2354
2408
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
2355
2409
  const locale = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.userLanguage || navigator.language || navigator.browserLanguage || "en";
@@ -2362,13 +2416,34 @@ var getBasePayload = () => {
2362
2416
  href: window.location.href
2363
2417
  };
2364
2418
  };
2419
+ var generateVisitorId = async () => {
2420
+ return `visitor_${generalRandomId()}`;
2421
+ };
2422
+ var generateSessionId = async () => {
2423
+ return `session_${generalRandomId()}`;
2424
+ };
2425
+ var generatePageId = () => {
2426
+ return `page_${generalRandomId()}`;
2427
+ };
2428
+ var generalRandomId = () => {
2429
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2430
+ const id = crypto.randomUUID();
2431
+ return id.replaceAll("-", "").toLowerCase();
2432
+ }
2433
+ return Math.random().toString(32).substring(2);
2434
+ };
2435
+
2436
+ // src/insights/v1.ts
2365
2437
  var createInsightsClient = ({ endpoint }) => {
2366
2438
  let endpointUrl;
2367
2439
  const apiKey = endpoint.apiKey;
2368
2440
  const projectId = endpoint.projectId;
2369
2441
  if (endpoint.type === "api") {
2370
2442
  const url = new URL(endpoint.host);
2371
- url.pathname = "/v0/events";
2443
+ url.pathname = `/v0/events`;
2444
+ if (endpoint.host.includes("tinybird.co")) {
2445
+ url.pathname = "/v0/events";
2446
+ }
2372
2447
  url.searchParams.set("name", "analytics_events");
2373
2448
  endpointUrl = url.toString();
2374
2449
  } else {
@@ -2498,38 +2573,7 @@ var createInsightsClient = ({ endpoint }) => {
2498
2573
  }
2499
2574
  };
2500
2575
  };
2501
- var createInsightsStorage = () => {
2502
- const STORAGE_KEY2 = "ufin";
2503
- return {
2504
- get: () => {
2505
- const data = localStorage.getItem(STORAGE_KEY2);
2506
- if (!data) {
2507
- return;
2508
- }
2509
- return JSON.parse(data);
2510
- },
2511
- set: (data) => {
2512
- const toSet = {
2513
- ...data,
2514
- updated: Date.now()
2515
- };
2516
- localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2517
- },
2518
- clear: () => {
2519
- localStorage.removeItem(STORAGE_KEY2);
2520
- }
2521
- };
2522
- };
2523
- var generateVisitorId = () => {
2524
- return `visitor_${generalRandomId()}`;
2525
- };
2526
- var generateSessionId = () => {
2527
- return `session_${generalRandomId()}`;
2528
- };
2529
- var generatePageId = () => {
2530
- return `page_${generalRandomId()}`;
2531
- };
2532
- var createInsights = ({
2576
+ var createInsightsV1 = ({
2533
2577
  endpoint,
2534
2578
  sessionDurationSeconds = 30 * 60
2535
2579
  }) => {
@@ -2630,8 +2674,10 @@ var createInsights = ({
2630
2674
  }
2631
2675
  };
2632
2676
  };
2677
+
2678
+ // src/insights/index.ts
2633
2679
  var enableUniformInsights = (options) => {
2634
- const insights = createInsights({
2680
+ const insights = createInsightsV1({
2635
2681
  endpoint: options.endpoint
2636
2682
  });
2637
2683
  let previousUrl = void 0;
@@ -2677,8 +2723,8 @@ var enableUniformInsights = (options) => {
2677
2723
  };
2678
2724
  },
2679
2725
  update: (context) => {
2680
- if (context.url && context.url !== previousUrl) {
2681
- previousUrl = context.url;
2726
+ if (context.url && context.url.toString() !== previousUrl) {
2727
+ previousUrl = context.url.toString();
2682
2728
  insights.pageHit();
2683
2729
  }
2684
2730
  },
@@ -2687,13 +2733,6 @@ var enableUniformInsights = (options) => {
2687
2733
  }
2688
2734
  };
2689
2735
  };
2690
- var generalRandomId = () => {
2691
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2692
- const id = crypto.randomUUID();
2693
- return id.replaceAll("-", "").toLowerCase();
2694
- }
2695
- return Math.random().toString(32).substring(2);
2696
- };
2697
2736
 
2698
2737
  // src/logging/enableConsoleLogDrain.ts
2699
2738
  var import_rfdc2 = __toESM(require("rfdc"));
package/dist/index.mjs CHANGED
@@ -941,6 +941,9 @@ var testVariations = ({
941
941
  }
942
942
  if (selectedVariant) {
943
943
  onLogMessage == null ? void 0 : onLogMessage(["info", 404, selectedVariant.id]);
944
+ if (selectedVariant.control === void 0) {
945
+ selectedVariant.control = variations.findIndex((variation) => variation.id === selectedVariantId) === 0;
946
+ }
944
947
  }
945
948
  return {
946
949
  result: selectedVariant,
@@ -1795,7 +1798,7 @@ var Context = class {
1795
1798
  * i.e. pushing the same URL or cookies as before,
1796
1799
  * will NOT result in a recomputation of signal state.
1797
1800
  */
1798
- async update(newData) {
1801
+ async update({ compositionMetadata, ...newData }) {
1799
1802
  var _a, _b, _c, _d, _e;
1800
1803
  const commands = [];
1801
1804
  const newServerSideTests = {};
@@ -1904,7 +1907,10 @@ var Context = class {
1904
1907
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
1905
1908
  name: testName,
1906
1909
  variantId: testVariantId,
1907
- variantAssigned: true
1910
+ variantAssigned: true,
1911
+ // @todo this needs to be fixed, we should provide correct is control as well as canvas data
1912
+ control: false,
1913
+ compositionMetadata: void 0
1908
1914
  });
1909
1915
  });
1910
1916
  const haveQuirksChanged = __privateGet(this, _serverTransitionState) && !dequal5(__privateGet(this, _serverTransitionState).quirks, this.storage.data.quirks);
@@ -1986,7 +1992,7 @@ var Context = class {
1986
1992
  }
1987
1993
  /** Executes an A/B test with a given set of variants, showing the visitor's assigned variant (or selecting one to assign, if none is set yet) */
1988
1994
  test(options) {
1989
- var _a, _b, _c;
1995
+ var _a, _b, _c, _d, _e;
1990
1996
  if (options.name === CONTEXTUAL_EDITING_TEST_NAME) {
1991
1997
  const selectedVariant = (_a = options.variations.find((variant) => variant.id === CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID)) != null ? _a : options.variations.at(-1);
1992
1998
  const value2 = {
@@ -2003,7 +2009,9 @@ var Context = class {
2003
2009
  __privateMethod(this, _Context_instances, emitTest_fn).call(this, {
2004
2010
  name: options.name,
2005
2011
  variantId: (_c = (_b = value.result) == null ? void 0 : _b.id) != null ? _c : void 0,
2006
- variantAssigned: value.variantAssigned
2012
+ variantAssigned: value.variantAssigned,
2013
+ control: (_e = (_d = value.result) == null ? void 0 : _d.control) != null ? _e : false,
2014
+ compositionMetadata: options.compositionMetadata
2007
2015
  });
2008
2016
  return value;
2009
2017
  }
@@ -2032,7 +2040,8 @@ var Context = class {
2032
2040
  control: variation.control
2033
2041
  })),
2034
2042
  control: this.storage.data.controlGroup,
2035
- changed: true
2043
+ changed: true,
2044
+ compositionMetadata: options.compositionMetadata
2036
2045
  };
2037
2046
  if (previousPlacement && dequal5(eventData.variantIds, previousPlacement)) {
2038
2047
  eventData.changed = false;
@@ -2092,6 +2101,27 @@ var Context = class {
2092
2101
  __privateGet(this, _pzCache)[event.name] = event.variantIds;
2093
2102
  __privateGet(this, _mitt3).emit("personalizationResult", event);
2094
2103
  }
2104
+ /**
2105
+ * Gets the current canvas data
2106
+ */
2107
+ getCompositionMetadata() {
2108
+ return __privateGet(this, _state).compositionMetadata;
2109
+ }
2110
+ /**
2111
+ * Updates the canvas data and emits a canvasDataUpdated event
2112
+ */
2113
+ async updateCompositionMetadata(newData) {
2114
+ const currentCanvas = __privateGet(this, _state).compositionMetadata || {};
2115
+ const updatedCanvas = { ...currentCanvas, ...newData };
2116
+ if (!dequal5(currentCanvas, updatedCanvas)) {
2117
+ __privateSet(this, _state, {
2118
+ ...__privateGet(this, _state),
2119
+ compositionMetadata: updatedCanvas
2120
+ });
2121
+ __privateGet(this, _mitt3).emit("canvasDataUpdated", updatedCanvas);
2122
+ __privateGet(this, _mitt3).emit("log", ["info", 4, "Canvas data updated"]);
2123
+ }
2124
+ }
2095
2125
  };
2096
2126
  _personalizationSelectionAlgorithms = new WeakMap();
2097
2127
  _serverTransitionState = new WeakMap();
@@ -2256,7 +2286,31 @@ var ScriptType = /* @__PURE__ */ ((ScriptType2) => {
2256
2286
  })(ScriptType || {});
2257
2287
  var EdgeNodeTagName = "nesitag";
2258
2288
 
2259
- // src/insights/index.ts
2289
+ // src/insights/storage.ts
2290
+ var createInsightsStorage = () => {
2291
+ const STORAGE_KEY2 = "ufin";
2292
+ return {
2293
+ get: () => {
2294
+ const data = localStorage.getItem(STORAGE_KEY2);
2295
+ if (!data) {
2296
+ return;
2297
+ }
2298
+ return JSON.parse(data);
2299
+ },
2300
+ set: (data) => {
2301
+ const toSet = {
2302
+ ...data,
2303
+ updated: Date.now()
2304
+ };
2305
+ localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2306
+ },
2307
+ clear: () => {
2308
+ localStorage.removeItem(STORAGE_KEY2);
2309
+ }
2310
+ };
2311
+ };
2312
+
2313
+ // src/insights/types.ts
2260
2314
  var getBasePayload = () => {
2261
2315
  const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
2262
2316
  const locale = navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.userLanguage || navigator.language || navigator.browserLanguage || "en";
@@ -2269,13 +2323,34 @@ var getBasePayload = () => {
2269
2323
  href: window.location.href
2270
2324
  };
2271
2325
  };
2326
+ var generateVisitorId = async () => {
2327
+ return `visitor_${generalRandomId()}`;
2328
+ };
2329
+ var generateSessionId = async () => {
2330
+ return `session_${generalRandomId()}`;
2331
+ };
2332
+ var generatePageId = () => {
2333
+ return `page_${generalRandomId()}`;
2334
+ };
2335
+ var generalRandomId = () => {
2336
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2337
+ const id = crypto.randomUUID();
2338
+ return id.replaceAll("-", "").toLowerCase();
2339
+ }
2340
+ return Math.random().toString(32).substring(2);
2341
+ };
2342
+
2343
+ // src/insights/v1.ts
2272
2344
  var createInsightsClient = ({ endpoint }) => {
2273
2345
  let endpointUrl;
2274
2346
  const apiKey = endpoint.apiKey;
2275
2347
  const projectId = endpoint.projectId;
2276
2348
  if (endpoint.type === "api") {
2277
2349
  const url = new URL(endpoint.host);
2278
- url.pathname = "/v0/events";
2350
+ url.pathname = `/v0/events`;
2351
+ if (endpoint.host.includes("tinybird.co")) {
2352
+ url.pathname = "/v0/events";
2353
+ }
2279
2354
  url.searchParams.set("name", "analytics_events");
2280
2355
  endpointUrl = url.toString();
2281
2356
  } else {
@@ -2405,38 +2480,7 @@ var createInsightsClient = ({ endpoint }) => {
2405
2480
  }
2406
2481
  };
2407
2482
  };
2408
- var createInsightsStorage = () => {
2409
- const STORAGE_KEY2 = "ufin";
2410
- return {
2411
- get: () => {
2412
- const data = localStorage.getItem(STORAGE_KEY2);
2413
- if (!data) {
2414
- return;
2415
- }
2416
- return JSON.parse(data);
2417
- },
2418
- set: (data) => {
2419
- const toSet = {
2420
- ...data,
2421
- updated: Date.now()
2422
- };
2423
- localStorage.setItem(STORAGE_KEY2, JSON.stringify(toSet));
2424
- },
2425
- clear: () => {
2426
- localStorage.removeItem(STORAGE_KEY2);
2427
- }
2428
- };
2429
- };
2430
- var generateVisitorId = () => {
2431
- return `visitor_${generalRandomId()}`;
2432
- };
2433
- var generateSessionId = () => {
2434
- return `session_${generalRandomId()}`;
2435
- };
2436
- var generatePageId = () => {
2437
- return `page_${generalRandomId()}`;
2438
- };
2439
- var createInsights = ({
2483
+ var createInsightsV1 = ({
2440
2484
  endpoint,
2441
2485
  sessionDurationSeconds = 30 * 60
2442
2486
  }) => {
@@ -2537,8 +2581,10 @@ var createInsights = ({
2537
2581
  }
2538
2582
  };
2539
2583
  };
2584
+
2585
+ // src/insights/index.ts
2540
2586
  var enableUniformInsights = (options) => {
2541
- const insights = createInsights({
2587
+ const insights = createInsightsV1({
2542
2588
  endpoint: options.endpoint
2543
2589
  });
2544
2590
  let previousUrl = void 0;
@@ -2584,8 +2630,8 @@ var enableUniformInsights = (options) => {
2584
2630
  };
2585
2631
  },
2586
2632
  update: (context) => {
2587
- if (context.url && context.url !== previousUrl) {
2588
- previousUrl = context.url;
2633
+ if (context.url && context.url.toString() !== previousUrl) {
2634
+ previousUrl = context.url.toString();
2589
2635
  insights.pageHit();
2590
2636
  }
2591
2637
  },
@@ -2594,13 +2640,6 @@ var enableUniformInsights = (options) => {
2594
2640
  }
2595
2641
  };
2596
2642
  };
2597
- var generalRandomId = () => {
2598
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2599
- const id = crypto.randomUUID();
2600
- return id.replaceAll("-", "").toLowerCase();
2601
- }
2602
- return Math.random().toString(32).substring(2);
2603
- };
2604
2643
 
2605
2644
  // src/logging/enableConsoleLogDrain.ts
2606
2645
  import rfdc2 from "rfdc";
@@ -76,6 +76,17 @@ type VisitorData = {
76
76
  personalizeVariants?: PersonalizeVariants;
77
77
  };
78
78
  declare const emptyVisitorData: () => VisitorData;
79
+ /**
80
+ * Canvas-specific data that should be managed separately from regular context updates
81
+ */
82
+ type CompositionMetadata = {
83
+ /** The composition ID always required, otherwise whole metadata should not be set */
84
+ compositionId: string;
85
+ /** The matched route from router endpoint. Same as matched project map node pathname */
86
+ matchedRoute?: string;
87
+ /** Dynamic inputs for the route */
88
+ dynamicInputs?: Record<string, string>;
89
+ };
79
90
  /**
80
91
  * Expresses a 'patch' to the Uniform Context state
81
92
  */
@@ -85,6 +96,11 @@ type ContextState = {
85
96
  quirks: Quirks;
86
97
  enrichments: EnrichmentData[];
87
98
  events: EventData[];
99
+ /**
100
+ * Metadata about the composition that is being rendered right now.
101
+ * if you have multiple compositions on the page, please set this one manually.
102
+ */
103
+ compositionMetadata?: CompositionMetadata;
88
104
  };
89
105
  type ContextStateUpdate = {
90
106
  /** The new effective state of the visitor after this state update is applied */
@@ -1030,6 +1046,10 @@ type TestVariant = {
1030
1046
  * If not provided, this variant will be selected in equal proportion to other variants without an explicit distribution.
1031
1047
  */
1032
1048
  testDistribution?: number;
1049
+ /** Whether this variant is a control variant.
1050
+ * Can be undefined for backward compatibility with older versions of the SDK which were not explicitly setting the control flag.
1051
+ */
1052
+ control?: boolean;
1033
1053
  };
1034
1054
  /** The result of computing an A/B test result */
1035
1055
  type TestResult<TVariant> = {
@@ -1051,6 +1071,8 @@ interface PersonalizeOptions<TVariant> {
1051
1071
  take?: number;
1052
1072
  /** Name of the personalization selection algorithm to use. Defaults to top-down criteria when not specified. */
1053
1073
  algorithm?: string;
1074
+ /** Composition metadata where the personalization is being rendered for analytics tracking */
1075
+ compositionMetadata?: CompositionMetadata;
1054
1076
  }
1055
1077
  interface PersonalizationSelectionAlgorithmOptions<TCriteria, TVariant extends PersonalizedVariant<TCriteria> = PersonalizedVariant<TCriteria>> {
1056
1078
  /** Name of placement (sent to analytics) */
@@ -1070,6 +1092,8 @@ type TestOptions<TVariant extends TestVariant> = {
1070
1092
  name: string;
1071
1093
  /** Variations that are being tested. */
1072
1094
  variations: TVariant[];
1095
+ /** Composition metadata where the personalization is being rendered for analytics tracking */
1096
+ compositionMetadata?: CompositionMetadata;
1073
1097
  };
1074
1098
  declare const testVariations: <TVariant extends TestVariant>({ name, context, variations, onLogMessage, }: TestOptions<TVariant> & {
1075
1099
  context: Context;
@@ -1140,6 +1164,12 @@ type PersonalizationEvent = {
1140
1164
  * False: the variant(s) selected were the same as a previous evaluation of this placement.
1141
1165
  */
1142
1166
  changed: boolean;
1167
+ /**
1168
+ * Contains information about the composition that contains personalization wrapper component,
1169
+ * which triggered the personalization event.
1170
+ * Only references top level root composition after pattern resolutions.
1171
+ */
1172
+ compositionMetadata?: CompositionMetadata;
1143
1173
  };
1144
1174
  /** Emitted event when an A/B test runs */
1145
1175
  type TestEvent = {
@@ -1147,12 +1177,22 @@ type TestEvent = {
1147
1177
  name: string;
1148
1178
  /** ID of the variant that was selected */
1149
1179
  variantId: string | undefined;
1180
+ /**
1181
+ * Whether the variant is part of the control group.
1182
+ */
1183
+ control: boolean;
1150
1184
  /**
1151
1185
  * Whether the test variant was newly assigned to the visitor.
1152
1186
  * True: variant was assigned to the visitor for the first time.
1153
1187
  * False: variant was already assigned to the visitor and is being reused.
1154
1188
  */
1155
1189
  variantAssigned: boolean;
1190
+ /**
1191
+ * Contains information about the composition that contains A/B test wrapper component,
1192
+ * which triggered the A/B test event.
1193
+ * Only references top level root composition after pattern resolutions.
1194
+ */
1195
+ compositionMetadata?: CompositionMetadata;
1156
1196
  };
1157
1197
  type ContextEvents = {
1158
1198
  /**
@@ -1176,6 +1216,8 @@ type ContextEvents = {
1176
1216
  testResult: TestEvent;
1177
1217
  /** Personalization variants have been selected */
1178
1218
  personalizationResult: PersonalizationEvent;
1219
+ /** Composition metadata has been set/updated, usually happens when new composition is being rendered during client-side navigation for example */
1220
+ canvasDataUpdated: CompositionMetadata;
1179
1221
  };
1180
1222
  interface ContextInstance {
1181
1223
  get scores(): Readonly<ScoreVector>;
@@ -1197,6 +1239,14 @@ interface ContextInstance {
1197
1239
  internal_processTestEvent(event: TestEvent): void;
1198
1240
  /** @deprecated */
1199
1241
  internal_processPersonalizationEvent(event: PersonalizationEvent): void;
1242
+ /**
1243
+ * Gets the current canvas data
1244
+ */
1245
+ getCompositionMetadata(): Readonly<CompositionMetadata | undefined>;
1246
+ /**
1247
+ * Updates the canvas data and emits a canvasDataUpdated event
1248
+ */
1249
+ updateCompositionMetadata(newData: Partial<CompositionMetadata>): Promise<void>;
1200
1250
  }
1201
1251
  declare class Context implements ContextInstance {
1202
1252
  #private;
@@ -1232,7 +1282,7 @@ declare class Context implements ContextInstance {
1232
1282
  * i.e. pushing the same URL or cookies as before,
1233
1283
  * will NOT result in a recomputation of signal state.
1234
1284
  */
1235
- update(newData: Partial<ContextState>): Promise<void>;
1285
+ update({ compositionMetadata, ...newData }: Partial<ContextState>): Promise<void>;
1236
1286
  processServerCommands({ serverCommands, commands, }: {
1237
1287
  serverCommands: StorageCommands[] | undefined;
1238
1288
  commands: StorageCommands[];
@@ -1266,6 +1316,14 @@ declare class Context implements ContextInstance {
1266
1316
  internal_processTestEvent(event: TestEvent): void;
1267
1317
  /** @deprecated */
1268
1318
  internal_processPersonalizationEvent(event: PersonalizationEvent): void;
1319
+ /**
1320
+ * Gets the current canvas data
1321
+ */
1322
+ getCompositionMetadata(): Readonly<CompositionMetadata | undefined>;
1323
+ /**
1324
+ * Updates the canvas data and emits a canvasDataUpdated event
1325
+ */
1326
+ updateCompositionMetadata(newData: CompositionMetadata): Promise<void>;
1269
1327
  }
1270
1328
 
1271
1329
  /**
@@ -1337,4 +1395,4 @@ declare global {
1337
1395
  }
1338
1396
  }
1339
1397
 
1340
- export { type ManifestV2 as $, type AggregateDimension as A, type DevToolsLogEvent as B, type ContextPlugin as C, type DecayFunction as D, type DevToolsDataEvent as E, type DevToolsHelloEvent as F, type DevToolsUpdateEvent as G, type DevToolsRawCommandsEvent as H, type DevToolsForgetEvent as I, type LogMessages as J, type Severity as K, type LogDrain as L, type MessageCategory as M, type MessageFunc as N, type OutputSeverity as O, type PersonalizedVariant as P, type Quirks as Q, type LogMessageSingle as R, type ScoreVector as S, TransitionDataStore as T, type LogMessageGroup as U, type VisitorData as V, ManifestInstance as W, GroupCriteriaEvaluator as X, type CriteriaEvaluatorResult as Y, type CriteriaEvaluatorParameters as Z, type SignalData as _, type StorageCommands as a, type PersonalizationManifest as a0, type Signal as a1, type SignalCriteriaGroup as a2, type SignalCriteria as a3, type EnrichmentCategory as a4, type NumberMatch as a5, type TestDefinition as a6, type AggregateDimensionInput as a7, type TestOptions as a8, testVariations as a9, type EnrichmentData as aA, type PersonalizeControlVariant as aB, type PersonalizeVariants as aC, type EventData as aD, emptyVisitorData as aE, type ContextState as aF, type ContextStateUpdate as aG, type GoalStateUpdate as aH, type paths as aI, type VariationMatchMetadata as aa, type DimensionMatch as ab, type QuirkMatch as ac, type BehaviorTag as ad, type TestVariant as ae, type TestResult as af, type StorageCommand as ag, type SetGoalCommand as ah, type ModifyScoreCommand as ai, type ModifySessionScoreCommand as aj, type SetConsentCommand as ak, type SetQuirkCommand as al, type SetTestCommand as am, type IdentifyCommand as an, type SetControlGroupCommand as ao, type SetPersonalizeVariantControlCommand as ap, areCommandsEqual as aq, type ServerToClientTransitionState as ar, SERVER_STATE_ID as as, type TransitionDataStoreEvents as at, type DecayOptions as au, type VisitorDataStoreOptions as av, type VisitorDataStoreEvents as aw, VisitorDataStore as ax, type Tests as ay, type Goals as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type PersonalizeOptions as g, Context as h, type PersonalizedResult as i, type VariationMatchDimensionCriteria as j, type PersonalizationSelectionAlgorithmOptions as k, type DevToolsEvents as l, CONTEXTUAL_EDITING_TEST_NAME as m, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as n, type PersonalizationSelectionAlgorithm as o, type PersonalizationSelectionAlgorithms as p, type ContextOptions as q, type PersonalizationEventVariantId as r, type PersonalizationEvent as s, type TestEvent as t, type ContextEvents as u, type ContextInstance as v, type DevToolsUiVersion as w, type DevToolsState as x, type DevToolsActions as y, type DevToolsEvent as z };
1398
+ export { type ManifestV2 as $, type AggregateDimension as A, type DevToolsLogEvent as B, type ContextPlugin as C, type DecayFunction as D, type DevToolsDataEvent as E, type DevToolsHelloEvent as F, type DevToolsUpdateEvent as G, type DevToolsRawCommandsEvent as H, type DevToolsForgetEvent as I, type LogMessages as J, type Severity as K, type LogDrain as L, type MessageCategory as M, type MessageFunc as N, type OutputSeverity as O, type PersonalizedVariant as P, type Quirks as Q, type LogMessageSingle as R, type ScoreVector as S, TransitionDataStore as T, type LogMessageGroup as U, type VisitorData as V, ManifestInstance as W, GroupCriteriaEvaluator as X, type CriteriaEvaluatorResult as Y, type CriteriaEvaluatorParameters as Z, type SignalData as _, type StorageCommands as a, type PersonalizationManifest as a0, type Signal as a1, type SignalCriteriaGroup as a2, type SignalCriteria as a3, type EnrichmentCategory as a4, type NumberMatch as a5, type TestDefinition as a6, type AggregateDimensionInput as a7, type TestOptions as a8, testVariations as a9, type EnrichmentData as aA, type PersonalizeControlVariant as aB, type PersonalizeVariants as aC, type EventData as aD, emptyVisitorData as aE, type CompositionMetadata as aF, type ContextState as aG, type ContextStateUpdate as aH, type GoalStateUpdate as aI, type paths as aJ, type VariationMatchMetadata as aa, type DimensionMatch as ab, type QuirkMatch as ac, type BehaviorTag as ad, type TestVariant as ae, type TestResult as af, type StorageCommand as ag, type SetGoalCommand as ah, type ModifyScoreCommand as ai, type ModifySessionScoreCommand as aj, type SetConsentCommand as ak, type SetQuirkCommand as al, type SetTestCommand as am, type IdentifyCommand as an, type SetControlGroupCommand as ao, type SetPersonalizeVariantControlCommand as ap, areCommandsEqual as aq, type ServerToClientTransitionState as ar, SERVER_STATE_ID as as, type TransitionDataStoreEvents as at, type DecayOptions as au, type VisitorDataStoreOptions as av, type VisitorDataStoreEvents as aw, VisitorDataStore as ax, type Tests as ay, type Goals as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type PersonalizeOptions as g, Context as h, type PersonalizedResult as i, type VariationMatchDimensionCriteria as j, type PersonalizationSelectionAlgorithmOptions as k, type DevToolsEvents as l, CONTEXTUAL_EDITING_TEST_NAME as m, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as n, type PersonalizationSelectionAlgorithm as o, type PersonalizationSelectionAlgorithms as p, type ContextOptions as q, type PersonalizationEventVariantId as r, type PersonalizationEvent as s, type TestEvent as t, type ContextEvents as u, type ContextInstance as v, type DevToolsUiVersion as w, type DevToolsState as x, type DevToolsActions as y, type DevToolsEvent as z };
@@ -76,6 +76,17 @@ type VisitorData = {
76
76
  personalizeVariants?: PersonalizeVariants;
77
77
  };
78
78
  declare const emptyVisitorData: () => VisitorData;
79
+ /**
80
+ * Canvas-specific data that should be managed separately from regular context updates
81
+ */
82
+ type CompositionMetadata = {
83
+ /** The composition ID always required, otherwise whole metadata should not be set */
84
+ compositionId: string;
85
+ /** The matched route from router endpoint. Same as matched project map node pathname */
86
+ matchedRoute?: string;
87
+ /** Dynamic inputs for the route */
88
+ dynamicInputs?: Record<string, string>;
89
+ };
79
90
  /**
80
91
  * Expresses a 'patch' to the Uniform Context state
81
92
  */
@@ -85,6 +96,11 @@ type ContextState = {
85
96
  quirks: Quirks;
86
97
  enrichments: EnrichmentData[];
87
98
  events: EventData[];
99
+ /**
100
+ * Metadata about the composition that is being rendered right now.
101
+ * if you have multiple compositions on the page, please set this one manually.
102
+ */
103
+ compositionMetadata?: CompositionMetadata;
88
104
  };
89
105
  type ContextStateUpdate = {
90
106
  /** The new effective state of the visitor after this state update is applied */
@@ -1030,6 +1046,10 @@ type TestVariant = {
1030
1046
  * If not provided, this variant will be selected in equal proportion to other variants without an explicit distribution.
1031
1047
  */
1032
1048
  testDistribution?: number;
1049
+ /** Whether this variant is a control variant.
1050
+ * Can be undefined for backward compatibility with older versions of the SDK which were not explicitly setting the control flag.
1051
+ */
1052
+ control?: boolean;
1033
1053
  };
1034
1054
  /** The result of computing an A/B test result */
1035
1055
  type TestResult<TVariant> = {
@@ -1051,6 +1071,8 @@ interface PersonalizeOptions<TVariant> {
1051
1071
  take?: number;
1052
1072
  /** Name of the personalization selection algorithm to use. Defaults to top-down criteria when not specified. */
1053
1073
  algorithm?: string;
1074
+ /** Composition metadata where the personalization is being rendered for analytics tracking */
1075
+ compositionMetadata?: CompositionMetadata;
1054
1076
  }
1055
1077
  interface PersonalizationSelectionAlgorithmOptions<TCriteria, TVariant extends PersonalizedVariant<TCriteria> = PersonalizedVariant<TCriteria>> {
1056
1078
  /** Name of placement (sent to analytics) */
@@ -1070,6 +1092,8 @@ type TestOptions<TVariant extends TestVariant> = {
1070
1092
  name: string;
1071
1093
  /** Variations that are being tested. */
1072
1094
  variations: TVariant[];
1095
+ /** Composition metadata where the personalization is being rendered for analytics tracking */
1096
+ compositionMetadata?: CompositionMetadata;
1073
1097
  };
1074
1098
  declare const testVariations: <TVariant extends TestVariant>({ name, context, variations, onLogMessage, }: TestOptions<TVariant> & {
1075
1099
  context: Context;
@@ -1140,6 +1164,12 @@ type PersonalizationEvent = {
1140
1164
  * False: the variant(s) selected were the same as a previous evaluation of this placement.
1141
1165
  */
1142
1166
  changed: boolean;
1167
+ /**
1168
+ * Contains information about the composition that contains personalization wrapper component,
1169
+ * which triggered the personalization event.
1170
+ * Only references top level root composition after pattern resolutions.
1171
+ */
1172
+ compositionMetadata?: CompositionMetadata;
1143
1173
  };
1144
1174
  /** Emitted event when an A/B test runs */
1145
1175
  type TestEvent = {
@@ -1147,12 +1177,22 @@ type TestEvent = {
1147
1177
  name: string;
1148
1178
  /** ID of the variant that was selected */
1149
1179
  variantId: string | undefined;
1180
+ /**
1181
+ * Whether the variant is part of the control group.
1182
+ */
1183
+ control: boolean;
1150
1184
  /**
1151
1185
  * Whether the test variant was newly assigned to the visitor.
1152
1186
  * True: variant was assigned to the visitor for the first time.
1153
1187
  * False: variant was already assigned to the visitor and is being reused.
1154
1188
  */
1155
1189
  variantAssigned: boolean;
1190
+ /**
1191
+ * Contains information about the composition that contains A/B test wrapper component,
1192
+ * which triggered the A/B test event.
1193
+ * Only references top level root composition after pattern resolutions.
1194
+ */
1195
+ compositionMetadata?: CompositionMetadata;
1156
1196
  };
1157
1197
  type ContextEvents = {
1158
1198
  /**
@@ -1176,6 +1216,8 @@ type ContextEvents = {
1176
1216
  testResult: TestEvent;
1177
1217
  /** Personalization variants have been selected */
1178
1218
  personalizationResult: PersonalizationEvent;
1219
+ /** Composition metadata has been set/updated, usually happens when new composition is being rendered during client-side navigation for example */
1220
+ canvasDataUpdated: CompositionMetadata;
1179
1221
  };
1180
1222
  interface ContextInstance {
1181
1223
  get scores(): Readonly<ScoreVector>;
@@ -1197,6 +1239,14 @@ interface ContextInstance {
1197
1239
  internal_processTestEvent(event: TestEvent): void;
1198
1240
  /** @deprecated */
1199
1241
  internal_processPersonalizationEvent(event: PersonalizationEvent): void;
1242
+ /**
1243
+ * Gets the current canvas data
1244
+ */
1245
+ getCompositionMetadata(): Readonly<CompositionMetadata | undefined>;
1246
+ /**
1247
+ * Updates the canvas data and emits a canvasDataUpdated event
1248
+ */
1249
+ updateCompositionMetadata(newData: Partial<CompositionMetadata>): Promise<void>;
1200
1250
  }
1201
1251
  declare class Context implements ContextInstance {
1202
1252
  #private;
@@ -1232,7 +1282,7 @@ declare class Context implements ContextInstance {
1232
1282
  * i.e. pushing the same URL or cookies as before,
1233
1283
  * will NOT result in a recomputation of signal state.
1234
1284
  */
1235
- update(newData: Partial<ContextState>): Promise<void>;
1285
+ update({ compositionMetadata, ...newData }: Partial<ContextState>): Promise<void>;
1236
1286
  processServerCommands({ serverCommands, commands, }: {
1237
1287
  serverCommands: StorageCommands[] | undefined;
1238
1288
  commands: StorageCommands[];
@@ -1266,6 +1316,14 @@ declare class Context implements ContextInstance {
1266
1316
  internal_processTestEvent(event: TestEvent): void;
1267
1317
  /** @deprecated */
1268
1318
  internal_processPersonalizationEvent(event: PersonalizationEvent): void;
1319
+ /**
1320
+ * Gets the current canvas data
1321
+ */
1322
+ getCompositionMetadata(): Readonly<CompositionMetadata | undefined>;
1323
+ /**
1324
+ * Updates the canvas data and emits a canvasDataUpdated event
1325
+ */
1326
+ updateCompositionMetadata(newData: CompositionMetadata): Promise<void>;
1269
1327
  }
1270
1328
 
1271
1329
  /**
@@ -1337,4 +1395,4 @@ declare global {
1337
1395
  }
1338
1396
  }
1339
1397
 
1340
- export { type ManifestV2 as $, type AggregateDimension as A, type DevToolsLogEvent as B, type ContextPlugin as C, type DecayFunction as D, type DevToolsDataEvent as E, type DevToolsHelloEvent as F, type DevToolsUpdateEvent as G, type DevToolsRawCommandsEvent as H, type DevToolsForgetEvent as I, type LogMessages as J, type Severity as K, type LogDrain as L, type MessageCategory as M, type MessageFunc as N, type OutputSeverity as O, type PersonalizedVariant as P, type Quirks as Q, type LogMessageSingle as R, type ScoreVector as S, TransitionDataStore as T, type LogMessageGroup as U, type VisitorData as V, ManifestInstance as W, GroupCriteriaEvaluator as X, type CriteriaEvaluatorResult as Y, type CriteriaEvaluatorParameters as Z, type SignalData as _, type StorageCommands as a, type PersonalizationManifest as a0, type Signal as a1, type SignalCriteriaGroup as a2, type SignalCriteria as a3, type EnrichmentCategory as a4, type NumberMatch as a5, type TestDefinition as a6, type AggregateDimensionInput as a7, type TestOptions as a8, testVariations as a9, type EnrichmentData as aA, type PersonalizeControlVariant as aB, type PersonalizeVariants as aC, type EventData as aD, emptyVisitorData as aE, type ContextState as aF, type ContextStateUpdate as aG, type GoalStateUpdate as aH, type paths as aI, type VariationMatchMetadata as aa, type DimensionMatch as ab, type QuirkMatch as ac, type BehaviorTag as ad, type TestVariant as ae, type TestResult as af, type StorageCommand as ag, type SetGoalCommand as ah, type ModifyScoreCommand as ai, type ModifySessionScoreCommand as aj, type SetConsentCommand as ak, type SetQuirkCommand as al, type SetTestCommand as am, type IdentifyCommand as an, type SetControlGroupCommand as ao, type SetPersonalizeVariantControlCommand as ap, areCommandsEqual as aq, type ServerToClientTransitionState as ar, SERVER_STATE_ID as as, type TransitionDataStoreEvents as at, type DecayOptions as au, type VisitorDataStoreOptions as av, type VisitorDataStoreEvents as aw, VisitorDataStore as ax, type Tests as ay, type Goals as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type PersonalizeOptions as g, Context as h, type PersonalizedResult as i, type VariationMatchDimensionCriteria as j, type PersonalizationSelectionAlgorithmOptions as k, type DevToolsEvents as l, CONTEXTUAL_EDITING_TEST_NAME as m, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as n, type PersonalizationSelectionAlgorithm as o, type PersonalizationSelectionAlgorithms as p, type ContextOptions as q, type PersonalizationEventVariantId as r, type PersonalizationEvent as s, type TestEvent as t, type ContextEvents as u, type ContextInstance as v, type DevToolsUiVersion as w, type DevToolsState as x, type DevToolsActions as y, type DevToolsEvent as z };
1398
+ export { type ManifestV2 as $, type AggregateDimension as A, type DevToolsLogEvent as B, type ContextPlugin as C, type DecayFunction as D, type DevToolsDataEvent as E, type DevToolsHelloEvent as F, type DevToolsUpdateEvent as G, type DevToolsRawCommandsEvent as H, type DevToolsForgetEvent as I, type LogMessages as J, type Severity as K, type LogDrain as L, type MessageCategory as M, type MessageFunc as N, type OutputSeverity as O, type PersonalizedVariant as P, type Quirks as Q, type LogMessageSingle as R, type ScoreVector as S, TransitionDataStore as T, type LogMessageGroup as U, type VisitorData as V, ManifestInstance as W, GroupCriteriaEvaluator as X, type CriteriaEvaluatorResult as Y, type CriteriaEvaluatorParameters as Z, type SignalData as _, type StorageCommands as a, type PersonalizationManifest as a0, type Signal as a1, type SignalCriteriaGroup as a2, type SignalCriteria as a3, type EnrichmentCategory as a4, type NumberMatch as a5, type TestDefinition as a6, type AggregateDimensionInput as a7, type TestOptions as a8, testVariations as a9, type EnrichmentData as aA, type PersonalizeControlVariant as aB, type PersonalizeVariants as aC, type EventData as aD, emptyVisitorData as aE, type CompositionMetadata as aF, type ContextState as aG, type ContextStateUpdate as aH, type GoalStateUpdate as aI, type paths as aJ, type VariationMatchMetadata as aa, type DimensionMatch as ab, type QuirkMatch as ac, type BehaviorTag as ad, type TestVariant as ae, type TestResult as af, type StorageCommand as ag, type SetGoalCommand as ah, type ModifyScoreCommand as ai, type ModifySessionScoreCommand as aj, type SetConsentCommand as ak, type SetQuirkCommand as al, type SetTestCommand as am, type IdentifyCommand as an, type SetControlGroupCommand as ao, type SetPersonalizeVariantControlCommand as ap, areCommandsEqual as aq, type ServerToClientTransitionState as ar, SERVER_STATE_ID as as, type TransitionDataStoreEvents as at, type DecayOptions as au, type VisitorDataStoreOptions as av, type VisitorDataStoreEvents as aw, VisitorDataStore as ax, type Tests as ay, type Goals as az, type TransitionDataStoreOptions as b, type CriteriaEvaluator as c, type StringMatch as d, type VariantMatchCriteria as e, type LogMessage as f, type PersonalizeOptions as g, Context as h, type PersonalizedResult as i, type VariationMatchDimensionCriteria as j, type PersonalizationSelectionAlgorithmOptions as k, type DevToolsEvents as l, CONTEXTUAL_EDITING_TEST_NAME as m, CONTEXTUAL_EDITING_TEST_SELECTED_VARIANT_ID as n, type PersonalizationSelectionAlgorithm as o, type PersonalizationSelectionAlgorithms as p, type ContextOptions as q, type PersonalizationEventVariantId as r, type PersonalizationEvent as s, type TestEvent as t, type ContextEvents as u, type ContextInstance as v, type DevToolsUiVersion as w, type DevToolsState as x, type DevToolsActions as y, type DevToolsEvent as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context",
3
- "version": "20.32.2-alpha.2+63682964b1",
3
+ "version": "20.33.1-alpha.53+0eb981d2f2",
4
4
  "description": "Uniform Context core package",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "dev": "run-s update-openapi dev:ts",
42
42
  "dev:ts": "tsup --watch",
43
43
  "clean": "rimraf dist",
44
- "test": "vitest",
44
+ "test": "vitest run",
45
45
  "test:coverage": "vitest run --coverage",
46
46
  "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
47
47
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "63682964b1d48a8e78403f5c67365bb0db875568"
75
+ "gitHead": "0eb981d2f2dc4ac76f097fa4a5cddc8f7988126e"
76
76
  }