@uniformdev/canvas 20.7.1-alpha.4 → 20.7.1-alpha.45

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/index.js CHANGED
@@ -409,7 +409,10 @@ __export(src_exports, {
409
409
  CANVAS_LOCALE_TAG_PARAM: () => CANVAS_LOCALE_TAG_PARAM,
410
410
  CANVAS_LOCALIZATION_SLOT: () => CANVAS_LOCALIZATION_SLOT,
411
411
  CANVAS_LOCALIZATION_TYPE: () => CANVAS_LOCALIZATION_TYPE,
412
+ CANVAS_PERSONALIZATION_ALGORITHM_PARAM: () => CANVAS_PERSONALIZATION_ALGORITHM_PARAM,
413
+ CANVAS_PERSONALIZATION_EVENT_NAME_PARAM: () => CANVAS_PERSONALIZATION_EVENT_NAME_PARAM,
412
414
  CANVAS_PERSONALIZATION_PARAM: () => CANVAS_PERSONALIZATION_PARAM,
415
+ CANVAS_PERSONALIZATION_TAKE_PARAM: () => CANVAS_PERSONALIZATION_TAKE_PARAM,
413
416
  CANVAS_PERSONALIZE_SLOT: () => CANVAS_PERSONALIZE_SLOT,
414
417
  CANVAS_PERSONALIZE_TYPE: () => CANVAS_PERSONALIZE_TYPE,
415
418
  CANVAS_PUBLISHED_STATE: () => CANVAS_PUBLISHED_STATE,
@@ -534,6 +537,7 @@ __export(src_exports, {
534
537
  nullLimitPolicy: () => nullLimitPolicy,
535
538
  parseComponentPlaceholderId: () => parseComponentPlaceholderId,
536
539
  parseVariableExpression: () => parseVariableExpression,
540
+ version: () => version,
537
541
  walkNodeTree: () => walkNodeTree,
538
542
  walkPropertyValues: () => walkPropertyValues
539
543
  });
@@ -784,7 +788,7 @@ var CanvasClient = class extends import_api2.ApiClient {
784
788
  const edgeParams = {
785
789
  ...originParams,
786
790
  projectId,
787
- ...params.diagnostics ? { diagnostics: "true" } : {},
791
+ diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
788
792
  ...rewrittenFilters
789
793
  };
790
794
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
@@ -825,7 +829,7 @@ var CanvasClient = class extends import_api2.ApiClient {
825
829
  const edgeParams = {
826
830
  ...params,
827
831
  projectId,
828
- ...diagnostics ? { diagnostics: "true" } : {}
832
+ diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
829
833
  };
830
834
  const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
831
835
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1007,7 +1011,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
1007
1011
  return {
1008
1012
  projectId,
1009
1013
  ...params,
1010
- diagnostics: (options == null ? void 0 : options.diagnostics) ? "true" : void 0
1014
+ diagnostics: typeof options.diagnostics === "boolean" ? options.diagnostics : options.diagnostics === "no-data" ? "no-data" : void 0
1011
1015
  };
1012
1016
  }
1013
1017
  };
@@ -1235,6 +1239,9 @@ var CANVAS_DRAFT_STATE = 0;
1235
1239
  var CANVAS_PUBLISHED_STATE = 64;
1236
1240
  var CANVAS_EDITOR_STATE = 63;
1237
1241
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1242
+ var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
1243
+ var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
1244
+ var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
1238
1245
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1239
1246
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1240
1247
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
@@ -2249,15 +2256,19 @@ function evaluateNodeVisibility({
2249
2256
  function evaluateWalkTreeNodeVisibility({
2250
2257
  rules,
2251
2258
  showIndeterminate,
2259
+ rootNodeInvisibleHandling = "throw",
2252
2260
  context
2253
2261
  }) {
2254
- const { type, node, actions } = context;
2262
+ const { type, node, actions, ancestorsAndSelf } = context;
2255
2263
  if (type !== "component") {
2256
2264
  return;
2257
2265
  }
2258
2266
  const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
2259
2267
  if (result === null && !showIndeterminate || result === false) {
2260
- actions.remove();
2268
+ if (ancestorsAndSelf.length === 1 && rootNodeInvisibleHandling === "ignore") {
2269
+ } else {
2270
+ actions.remove();
2271
+ }
2261
2272
  return false;
2262
2273
  }
2263
2274
  return true;
@@ -2493,25 +2504,24 @@ function extractLocales({ component }) {
2493
2504
  function localize(options) {
2494
2505
  const nodes = options.nodes;
2495
2506
  const locale = options.locale;
2496
- const isUsingModernOptions = typeof locale === "string";
2497
- const vizControlLocaleRule = isUsingModernOptions ? createLocaleVisibilityRule(locale) : {};
2507
+ if (!locale) {
2508
+ return;
2509
+ }
2510
+ const vizControlLocaleRule = createLocaleVisibilityRule(locale);
2498
2511
  walkNodeTree(nodes, (context) => {
2499
2512
  const { type, node, actions } = context;
2500
2513
  if (type !== "component") {
2501
- if (isUsingModernOptions) {
2502
- localizeProperties(node, locale, vizControlLocaleRule);
2503
- }
2514
+ localizeProperties(node, locale, vizControlLocaleRule);
2504
2515
  return;
2505
2516
  }
2506
- if (isUsingModernOptions) {
2507
- const result = evaluateWalkTreeNodeVisibility({
2508
- context,
2509
- rules: vizControlLocaleRule,
2510
- showIndeterminate: true
2511
- });
2512
- if (!result) {
2513
- return;
2514
- }
2517
+ const result = evaluateWalkTreeNodeVisibility({
2518
+ context,
2519
+ rules: vizControlLocaleRule,
2520
+ showIndeterminate: true,
2521
+ rootNodeInvisibleHandling: "ignore"
2522
+ });
2523
+ if (!result) {
2524
+ return;
2515
2525
  }
2516
2526
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
2517
2527
  const locales = extractLocales({ component: node });
@@ -2522,9 +2532,7 @@ function localize(options) {
2522
2532
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
2523
2533
  replaceComponent.forEach((component) => {
2524
2534
  removeLocaleProperty(component);
2525
- if (isUsingModernOptions) {
2526
- localizeProperties(component, locale, vizControlLocaleRule);
2527
- }
2535
+ localizeProperties(component, locale, vizControlLocaleRule);
2528
2536
  });
2529
2537
  const [first, ...rest] = replaceComponent;
2530
2538
  actions.replace(first);
@@ -2534,7 +2542,7 @@ function localize(options) {
2534
2542
  } else {
2535
2543
  actions.remove();
2536
2544
  }
2537
- } else if (isUsingModernOptions) {
2545
+ } else {
2538
2546
  localizeProperties(node, locale, vizControlLocaleRule);
2539
2547
  }
2540
2548
  });
@@ -2794,17 +2802,19 @@ var createCanvasChannel = ({
2794
2802
  postMessage(message);
2795
2803
  };
2796
2804
  const ready = (options) => {
2797
- var _a, _b;
2805
+ var _a, _b, _c;
2798
2806
  if (typeof window === "undefined") {
2799
2807
  return;
2800
2808
  }
2801
2809
  const framework = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.framework;
2802
- const version = (_b = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _b.version;
2810
+ const version2 = (_b = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _b.version;
2811
+ const canvasPackageVersion = (_c = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _c.canvasPackageVersion;
2803
2812
  const message = {
2804
2813
  type: "ready",
2805
2814
  framework,
2806
- version,
2807
- rsc: options == null ? void 0 : options.rsc
2815
+ version: version2,
2816
+ rsc: options == null ? void 0 : options.rsc,
2817
+ canvasPackageVersion
2808
2818
  };
2809
2819
  postMessage(message);
2810
2820
  };
@@ -3525,6 +3535,9 @@ function handleRichTextNodeBinding(object, options) {
3525
3535
  // src/index.ts
3526
3536
  var import_api16 = require("@uniformdev/context/api");
3527
3537
 
3538
+ // src/.version.ts
3539
+ var version = "20.18.0";
3540
+
3528
3541
  // src/WorkflowClient.ts
3529
3542
  var import_api15 = require("@uniformdev/context/api");
3530
3543
  var workflowsUrl = "/api/v1/workflows";
@@ -3583,7 +3596,10 @@ var CanvasClientError = import_api16.ApiClientError;
3583
3596
  CANVAS_LOCALE_TAG_PARAM,
3584
3597
  CANVAS_LOCALIZATION_SLOT,
3585
3598
  CANVAS_LOCALIZATION_TYPE,
3599
+ CANVAS_PERSONALIZATION_ALGORITHM_PARAM,
3600
+ CANVAS_PERSONALIZATION_EVENT_NAME_PARAM,
3586
3601
  CANVAS_PERSONALIZATION_PARAM,
3602
+ CANVAS_PERSONALIZATION_TAKE_PARAM,
3587
3603
  CANVAS_PERSONALIZE_SLOT,
3588
3604
  CANVAS_PERSONALIZE_TYPE,
3589
3605
  CANVAS_PUBLISHED_STATE,
@@ -3708,6 +3724,7 @@ var CanvasClientError = import_api16.ApiClientError;
3708
3724
  nullLimitPolicy,
3709
3725
  parseComponentPlaceholderId,
3710
3726
  parseVariableExpression,
3727
+ version,
3711
3728
  walkNodeTree,
3712
3729
  walkPropertyValues
3713
3730
  });
package/dist/index.mjs CHANGED
@@ -624,7 +624,7 @@ var CanvasClient = class extends ApiClient {
624
624
  const edgeParams = {
625
625
  ...originParams,
626
626
  projectId,
627
- ...params.diagnostics ? { diagnostics: "true" } : {},
627
+ diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
628
628
  ...rewrittenFilters
629
629
  };
630
630
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
@@ -665,7 +665,7 @@ var CanvasClient = class extends ApiClient {
665
665
  const edgeParams = {
666
666
  ...params,
667
667
  projectId,
668
- ...diagnostics ? { diagnostics: "true" } : {}
668
+ diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
669
669
  };
670
670
  const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
671
671
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -847,7 +847,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
847
847
  return {
848
848
  projectId,
849
849
  ...params,
850
- diagnostics: (options == null ? void 0 : options.diagnostics) ? "true" : void 0
850
+ diagnostics: typeof options.diagnostics === "boolean" ? options.diagnostics : options.diagnostics === "no-data" ? "no-data" : void 0
851
851
  };
852
852
  }
853
853
  };
@@ -1075,6 +1075,9 @@ var CANVAS_DRAFT_STATE = 0;
1075
1075
  var CANVAS_PUBLISHED_STATE = 64;
1076
1076
  var CANVAS_EDITOR_STATE = 63;
1077
1077
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1078
+ var CANVAS_PERSONALIZATION_EVENT_NAME_PARAM = "trackingEventName";
1079
+ var CANVAS_PERSONALIZATION_ALGORITHM_PARAM = "algorithm";
1080
+ var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
1078
1081
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1079
1082
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1080
1083
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
@@ -2089,15 +2092,19 @@ function evaluateNodeVisibility({
2089
2092
  function evaluateWalkTreeNodeVisibility({
2090
2093
  rules,
2091
2094
  showIndeterminate,
2095
+ rootNodeInvisibleHandling = "throw",
2092
2096
  context
2093
2097
  }) {
2094
- const { type, node, actions } = context;
2098
+ const { type, node, actions, ancestorsAndSelf } = context;
2095
2099
  if (type !== "component") {
2096
2100
  return;
2097
2101
  }
2098
2102
  const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
2099
2103
  if (result === null && !showIndeterminate || result === false) {
2100
- actions.remove();
2104
+ if (ancestorsAndSelf.length === 1 && rootNodeInvisibleHandling === "ignore") {
2105
+ } else {
2106
+ actions.remove();
2107
+ }
2101
2108
  return false;
2102
2109
  }
2103
2110
  return true;
@@ -2333,25 +2340,24 @@ function extractLocales({ component }) {
2333
2340
  function localize(options) {
2334
2341
  const nodes = options.nodes;
2335
2342
  const locale = options.locale;
2336
- const isUsingModernOptions = typeof locale === "string";
2337
- const vizControlLocaleRule = isUsingModernOptions ? createLocaleVisibilityRule(locale) : {};
2343
+ if (!locale) {
2344
+ return;
2345
+ }
2346
+ const vizControlLocaleRule = createLocaleVisibilityRule(locale);
2338
2347
  walkNodeTree(nodes, (context) => {
2339
2348
  const { type, node, actions } = context;
2340
2349
  if (type !== "component") {
2341
- if (isUsingModernOptions) {
2342
- localizeProperties(node, locale, vizControlLocaleRule);
2343
- }
2350
+ localizeProperties(node, locale, vizControlLocaleRule);
2344
2351
  return;
2345
2352
  }
2346
- if (isUsingModernOptions) {
2347
- const result = evaluateWalkTreeNodeVisibility({
2348
- context,
2349
- rules: vizControlLocaleRule,
2350
- showIndeterminate: true
2351
- });
2352
- if (!result) {
2353
- return;
2354
- }
2353
+ const result = evaluateWalkTreeNodeVisibility({
2354
+ context,
2355
+ rules: vizControlLocaleRule,
2356
+ showIndeterminate: true,
2357
+ rootNodeInvisibleHandling: "ignore"
2358
+ });
2359
+ if (!result) {
2360
+ return;
2355
2361
  }
2356
2362
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
2357
2363
  const locales = extractLocales({ component: node });
@@ -2362,9 +2368,7 @@ function localize(options) {
2362
2368
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
2363
2369
  replaceComponent.forEach((component) => {
2364
2370
  removeLocaleProperty(component);
2365
- if (isUsingModernOptions) {
2366
- localizeProperties(component, locale, vizControlLocaleRule);
2367
- }
2371
+ localizeProperties(component, locale, vizControlLocaleRule);
2368
2372
  });
2369
2373
  const [first, ...rest] = replaceComponent;
2370
2374
  actions.replace(first);
@@ -2374,7 +2378,7 @@ function localize(options) {
2374
2378
  } else {
2375
2379
  actions.remove();
2376
2380
  }
2377
- } else if (isUsingModernOptions) {
2381
+ } else {
2378
2382
  localizeProperties(node, locale, vizControlLocaleRule);
2379
2383
  }
2380
2384
  });
@@ -2634,17 +2638,19 @@ var createCanvasChannel = ({
2634
2638
  postMessage(message);
2635
2639
  };
2636
2640
  const ready = (options) => {
2637
- var _a, _b;
2641
+ var _a, _b, _c;
2638
2642
  if (typeof window === "undefined") {
2639
2643
  return;
2640
2644
  }
2641
2645
  const framework = (_a = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _a.framework;
2642
- const version = (_b = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _b.version;
2646
+ const version2 = (_b = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _b.version;
2647
+ const canvasPackageVersion = (_c = window.__UNIFORM_CONTEXTUAL_EDITING__) == null ? void 0 : _c.canvasPackageVersion;
2643
2648
  const message = {
2644
2649
  type: "ready",
2645
2650
  framework,
2646
- version,
2647
- rsc: options == null ? void 0 : options.rsc
2651
+ version: version2,
2652
+ rsc: options == null ? void 0 : options.rsc,
2653
+ canvasPackageVersion
2648
2654
  };
2649
2655
  postMessage(message);
2650
2656
  };
@@ -3365,6 +3371,9 @@ function handleRichTextNodeBinding(object, options) {
3365
3371
  // src/index.ts
3366
3372
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3367
3373
 
3374
+ // src/.version.ts
3375
+ var version = "20.18.0";
3376
+
3368
3377
  // src/WorkflowClient.ts
3369
3378
  import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3370
3379
  var workflowsUrl = "/api/v1/workflows";
@@ -3422,7 +3431,10 @@ export {
3422
3431
  CANVAS_LOCALE_TAG_PARAM,
3423
3432
  CANVAS_LOCALIZATION_SLOT,
3424
3433
  CANVAS_LOCALIZATION_TYPE,
3434
+ CANVAS_PERSONALIZATION_ALGORITHM_PARAM,
3435
+ CANVAS_PERSONALIZATION_EVENT_NAME_PARAM,
3425
3436
  CANVAS_PERSONALIZATION_PARAM,
3437
+ CANVAS_PERSONALIZATION_TAKE_PARAM,
3426
3438
  CANVAS_PERSONALIZE_SLOT,
3427
3439
  CANVAS_PERSONALIZE_TYPE,
3428
3440
  CANVAS_PUBLISHED_STATE,
@@ -3547,6 +3559,7 @@ export {
3547
3559
  nullLimitPolicy,
3548
3560
  parseComponentPlaceholderId,
3549
3561
  parseVariableExpression,
3562
+ version,
3550
3563
  walkNodeTree,
3551
3564
  walkPropertyValues
3552
3565
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "20.7.1-alpha.4+20185a97ff",
3
+ "version": "20.7.1-alpha.45+082e9e310e",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -19,16 +19,18 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
- "build": "run-s update-openapi build:ts",
22
+ "build": "run-s update-openapi create-version build:ts",
23
23
  "build:ts": "tsup",
24
- "dev": "run-s update-openapi dev:ts",
24
+ "dev": "run-s update-openapi create-version dev:ts",
25
25
  "dev:ts": "tsup --watch",
26
26
  "clean": "rimraf dist",
27
- "test": "jest --maxWorkers=1",
27
+ "test": "run-s create-version test:run",
28
+ "test:run": "jest --maxWorkers=1",
28
29
  "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
29
30
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
30
31
  "update-openapi": "tsx ./scripts/update-openapi.cts",
31
- "document": "api-extractor run --local"
32
+ "create-version": "tsx ./scripts/create-version-export.cts",
33
+ "document:prebuild": "api-extractor run --local"
32
34
  },
33
35
  "devDependencies": {
34
36
  "@types/retry": "0.12.5",
@@ -38,9 +40,9 @@
38
40
  "p-throttle": "5.0.0"
39
41
  },
40
42
  "dependencies": {
41
- "@uniformdev/assets": "20.7.1-alpha.4+20185a97ff",
42
- "@uniformdev/context": "20.7.1-alpha.4+20185a97ff",
43
- "@uniformdev/richtext": "20.7.1-alpha.4+20185a97ff",
43
+ "@uniformdev/assets": "20.7.1-alpha.45+082e9e310e",
44
+ "@uniformdev/context": "20.7.1-alpha.45+082e9e310e",
45
+ "@uniformdev/richtext": "20.7.1-alpha.45+082e9e310e",
44
46
  "immer": "10.1.1"
45
47
  },
46
48
  "files": [
@@ -49,5 +51,5 @@
49
51
  "publishConfig": {
50
52
  "access": "public"
51
53
  },
52
- "gitHead": "20185a97ff6c2de2f871223af12d73583fe300af"
54
+ "gitHead": "082e9e310e3f0a32074da8bc21a928e665041246"
53
55
  }