@uniformdev/canvas 19.134.3-alpha.28 → 19.135.1-alpha.10

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.esm.js CHANGED
@@ -992,6 +992,21 @@ function getPropertiesValue(entity) {
992
992
  function getPropertyValue(parameter) {
993
993
  return parameter ? parameter.value : parameter;
994
994
  }
995
+ function getLocalizedPropertyValues(parameter) {
996
+ if (!parameter) {
997
+ return parameter;
998
+ }
999
+ const localizedValues = /* @__PURE__ */ new Map();
1000
+ if (typeof parameter.value !== "undefined") {
1001
+ localizedValues.set(void 0, parameter.value);
1002
+ }
1003
+ if (parameter.locales !== void 0) {
1004
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1005
+ localizedValues.set(locale, localeValue);
1006
+ }
1007
+ }
1008
+ return localizedValues;
1009
+ }
995
1010
  function flattenValues(data, options = {}) {
996
1011
  if (!data) {
997
1012
  return data;
@@ -1067,6 +1082,7 @@ function walkNodeTree(node, visitor, options) {
1067
1082
  } else {
1068
1083
  throw new Error("Unknown node type");
1069
1084
  }
1085
+ visitDescendants = false;
1070
1086
  },
1071
1087
  insertAfter: (nodes) => {
1072
1088
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1152,6 +1168,7 @@ function walkNodeTree(node, visitor, options) {
1152
1168
  } else {
1153
1169
  throw new Error("Unknown node type");
1154
1170
  }
1171
+ visitDescendants = false;
1155
1172
  },
1156
1173
  insertAfter: (nodes) => {
1157
1174
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -1939,6 +1956,12 @@ var createCanvasChannel = ({
1939
1956
  const broadcastToItems = [...broadcastTo];
1940
1957
  const postMessage = (message) => {
1941
1958
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
1959
+ for (const handlerId in handlers) {
1960
+ const handler = handlers[handlerId];
1961
+ if (handler.types.includes(message.type)) {
1962
+ handler.handler(message, new MessageEvent(message.type));
1963
+ }
1964
+ }
1942
1965
  };
1943
1966
  const selectComponent = (id) => {
1944
1967
  const message = {
@@ -1979,15 +2002,17 @@ var createCanvasChannel = ({
1979
2002
  hash: generateHash({
1980
2003
  composition,
1981
2004
  secret
1982
- })
2005
+ }),
2006
+ eventTimestamp: Date.now()
1983
2007
  };
1984
2008
  postMessage(message);
1985
2009
  };
1986
- const updateCompositionInternal = (composition, hash) => {
2010
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
1987
2011
  const message = {
1988
2012
  type: "update-composition-internal",
1989
2013
  composition,
1990
- hash
2014
+ hash,
2015
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
1991
2016
  };
1992
2017
  postMessage(message);
1993
2018
  };
@@ -2129,6 +2154,7 @@ var createCanvasChannel = ({
2129
2154
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2130
2155
  };
2131
2156
  return {
2157
+ broadcastTo,
2132
2158
  ready,
2133
2159
  destroy,
2134
2160
  triggerComponentAction,
@@ -2454,7 +2480,9 @@ function convertEntryToPutEntry(entry) {
2454
2480
  pattern: entry.pattern,
2455
2481
  state: entry.state,
2456
2482
  projectId: entry.projectId,
2457
- releaseId: entry.releaseId
2483
+ releaseId: entry.releaseId,
2484
+ workflowId: entry.workflowId,
2485
+ workflowStageId: entry.workflowStageId
2458
2486
  };
2459
2487
  }
2460
2488
 
@@ -2757,6 +2785,41 @@ function handleRichTextNodeBinding(object, options) {
2757
2785
 
2758
2786
  // src/index.ts
2759
2787
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2788
+
2789
+ // src/WorkflowClient.ts
2790
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2791
+ var workflowsUrl = "/api/v1/workflows";
2792
+ var WorkflowClient = class extends ApiClient12 {
2793
+ constructor(options) {
2794
+ super(options);
2795
+ }
2796
+ /** Fetches workflows for a project */
2797
+ async get(options) {
2798
+ const { projectId } = this.options;
2799
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2800
+ return await this.apiClient(fetchUri);
2801
+ }
2802
+ /** Updates or creates a workflow definition */
2803
+ async upsert(body) {
2804
+ const fetchUri = this.createUrl(workflowsUrl);
2805
+ await this.apiClient(fetchUri, {
2806
+ method: "PUT",
2807
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2808
+ expectNoContent: true
2809
+ });
2810
+ }
2811
+ /** Deletes a workflow definition */
2812
+ async remove(body) {
2813
+ const fetchUri = this.createUrl(workflowsUrl);
2814
+ await this.apiClient(fetchUri, {
2815
+ method: "DELETE",
2816
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2817
+ expectNoContent: true
2818
+ });
2819
+ }
2820
+ };
2821
+
2822
+ // src/index.ts
2760
2823
  var CanvasClientError = ApiClientError2;
2761
2824
  export {
2762
2825
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2821,6 +2884,7 @@ export {
2821
2884
  UncachedCategoryClient,
2822
2885
  UncachedContentClient,
2823
2886
  UniqueBatchEntries,
2887
+ WorkflowClient,
2824
2888
  bindVariables,
2825
2889
  bindVariablesToObject,
2826
2890
  compose,
@@ -2841,6 +2905,7 @@ export {
2841
2905
  getChannelName,
2842
2906
  getComponentJsonPointer,
2843
2907
  getComponentPath,
2908
+ getLocalizedPropertyValues,
2844
2909
  getNounForLocation,
2845
2910
  getNounForNode,
2846
2911
  getParameterAttributes,
package/dist/index.js CHANGED
@@ -286,7 +286,7 @@ __export(src_exports, {
286
286
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
287
287
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
288
288
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
289
- ApiClientError: () => import_api13.ApiClientError,
289
+ ApiClientError: () => import_api14.ApiClientError,
290
290
  BatchEntry: () => BatchEntry,
291
291
  CANVAS_BLOCK_PARAM_TYPE: () => CANVAS_BLOCK_PARAM_TYPE,
292
292
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
@@ -339,6 +339,7 @@ __export(src_exports, {
339
339
  UncachedCategoryClient: () => UncachedCategoryClient,
340
340
  UncachedContentClient: () => UncachedContentClient,
341
341
  UniqueBatchEntries: () => UniqueBatchEntries,
342
+ WorkflowClient: () => WorkflowClient,
342
343
  bindVariables: () => bindVariables,
343
344
  bindVariablesToObject: () => bindVariablesToObject,
344
345
  compose: () => compose,
@@ -359,6 +360,7 @@ __export(src_exports, {
359
360
  getChannelName: () => getChannelName,
360
361
  getComponentJsonPointer: () => getComponentJsonPointer,
361
362
  getComponentPath: () => getComponentPath,
363
+ getLocalizedPropertyValues: () => getLocalizedPropertyValues,
362
364
  getNounForLocation: () => getNounForLocation,
363
365
  getNounForNode: () => getNounForNode,
364
366
  getParameterAttributes: () => getParameterAttributes,
@@ -1127,6 +1129,21 @@ function getPropertiesValue(entity) {
1127
1129
  function getPropertyValue(parameter) {
1128
1130
  return parameter ? parameter.value : parameter;
1129
1131
  }
1132
+ function getLocalizedPropertyValues(parameter) {
1133
+ if (!parameter) {
1134
+ return parameter;
1135
+ }
1136
+ const localizedValues = /* @__PURE__ */ new Map();
1137
+ if (typeof parameter.value !== "undefined") {
1138
+ localizedValues.set(void 0, parameter.value);
1139
+ }
1140
+ if (parameter.locales !== void 0) {
1141
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1142
+ localizedValues.set(locale, localeValue);
1143
+ }
1144
+ }
1145
+ return localizedValues;
1146
+ }
1130
1147
  function flattenValues(data, options = {}) {
1131
1148
  if (!data) {
1132
1149
  return data;
@@ -1202,6 +1219,7 @@ function walkNodeTree(node, visitor, options) {
1202
1219
  } else {
1203
1220
  throw new Error("Unknown node type");
1204
1221
  }
1222
+ visitDescendants = false;
1205
1223
  },
1206
1224
  insertAfter: (nodes) => {
1207
1225
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1287,6 +1305,7 @@ function walkNodeTree(node, visitor, options) {
1287
1305
  } else {
1288
1306
  throw new Error("Unknown node type");
1289
1307
  }
1308
+ visitDescendants = false;
1290
1309
  },
1291
1310
  insertAfter: (nodes) => {
1292
1311
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -2074,6 +2093,12 @@ var createCanvasChannel = ({
2074
2093
  const broadcastToItems = [...broadcastTo];
2075
2094
  const postMessage = (message) => {
2076
2095
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
2096
+ for (const handlerId in handlers) {
2097
+ const handler = handlers[handlerId];
2098
+ if (handler.types.includes(message.type)) {
2099
+ handler.handler(message, new MessageEvent(message.type));
2100
+ }
2101
+ }
2077
2102
  };
2078
2103
  const selectComponent = (id) => {
2079
2104
  const message = {
@@ -2114,15 +2139,17 @@ var createCanvasChannel = ({
2114
2139
  hash: generateHash({
2115
2140
  composition,
2116
2141
  secret
2117
- })
2142
+ }),
2143
+ eventTimestamp: Date.now()
2118
2144
  };
2119
2145
  postMessage(message);
2120
2146
  };
2121
- const updateCompositionInternal = (composition, hash) => {
2147
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
2122
2148
  const message = {
2123
2149
  type: "update-composition-internal",
2124
2150
  composition,
2125
- hash
2151
+ hash,
2152
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
2126
2153
  };
2127
2154
  postMessage(message);
2128
2155
  };
@@ -2264,6 +2291,7 @@ var createCanvasChannel = ({
2264
2291
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2265
2292
  };
2266
2293
  return {
2294
+ broadcastTo,
2267
2295
  ready,
2268
2296
  destroy,
2269
2297
  triggerComponentAction,
@@ -2589,7 +2617,9 @@ function convertEntryToPutEntry(entry) {
2589
2617
  pattern: entry.pattern,
2590
2618
  state: entry.state,
2591
2619
  projectId: entry.projectId,
2592
- releaseId: entry.releaseId
2620
+ releaseId: entry.releaseId,
2621
+ workflowId: entry.workflowId,
2622
+ workflowStageId: entry.workflowStageId
2593
2623
  };
2594
2624
  }
2595
2625
 
@@ -2891,8 +2921,43 @@ function handleRichTextNodeBinding(object, options) {
2891
2921
  }
2892
2922
 
2893
2923
  // src/index.ts
2924
+ var import_api14 = require("@uniformdev/context/api");
2925
+
2926
+ // src/WorkflowClient.ts
2894
2927
  var import_api13 = require("@uniformdev/context/api");
2895
- var CanvasClientError = import_api13.ApiClientError;
2928
+ var workflowsUrl = "/api/v1/workflows";
2929
+ var WorkflowClient = class extends import_api13.ApiClient {
2930
+ constructor(options) {
2931
+ super(options);
2932
+ }
2933
+ /** Fetches workflows for a project */
2934
+ async get(options) {
2935
+ const { projectId } = this.options;
2936
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2937
+ return await this.apiClient(fetchUri);
2938
+ }
2939
+ /** Updates or creates a workflow definition */
2940
+ async upsert(body) {
2941
+ const fetchUri = this.createUrl(workflowsUrl);
2942
+ await this.apiClient(fetchUri, {
2943
+ method: "PUT",
2944
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2945
+ expectNoContent: true
2946
+ });
2947
+ }
2948
+ /** Deletes a workflow definition */
2949
+ async remove(body) {
2950
+ const fetchUri = this.createUrl(workflowsUrl);
2951
+ await this.apiClient(fetchUri, {
2952
+ method: "DELETE",
2953
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2954
+ expectNoContent: true
2955
+ });
2956
+ }
2957
+ };
2958
+
2959
+ // src/index.ts
2960
+ var CanvasClientError = import_api14.ApiClientError;
2896
2961
  // Annotate the CommonJS export names for ESM import in node:
2897
2962
  0 && (module.exports = {
2898
2963
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2957,6 +3022,7 @@ var CanvasClientError = import_api13.ApiClientError;
2957
3022
  UncachedCategoryClient,
2958
3023
  UncachedContentClient,
2959
3024
  UniqueBatchEntries,
3025
+ WorkflowClient,
2960
3026
  bindVariables,
2961
3027
  bindVariablesToObject,
2962
3028
  compose,
@@ -2977,6 +3043,7 @@ var CanvasClientError = import_api13.ApiClientError;
2977
3043
  getChannelName,
2978
3044
  getComponentJsonPointer,
2979
3045
  getComponentPath,
3046
+ getLocalizedPropertyValues,
2980
3047
  getNounForLocation,
2981
3048
  getNounForNode,
2982
3049
  getParameterAttributes,
package/dist/index.mjs CHANGED
@@ -992,6 +992,21 @@ function getPropertiesValue(entity) {
992
992
  function getPropertyValue(parameter) {
993
993
  return parameter ? parameter.value : parameter;
994
994
  }
995
+ function getLocalizedPropertyValues(parameter) {
996
+ if (!parameter) {
997
+ return parameter;
998
+ }
999
+ const localizedValues = /* @__PURE__ */ new Map();
1000
+ if (typeof parameter.value !== "undefined") {
1001
+ localizedValues.set(void 0, parameter.value);
1002
+ }
1003
+ if (parameter.locales !== void 0) {
1004
+ for (const [locale, localeValue] of Object.entries(parameter.locales)) {
1005
+ localizedValues.set(locale, localeValue);
1006
+ }
1007
+ }
1008
+ return localizedValues;
1009
+ }
995
1010
  function flattenValues(data, options = {}) {
996
1011
  if (!data) {
997
1012
  return data;
@@ -1067,6 +1082,7 @@ function walkNodeTree(node, visitor, options) {
1067
1082
  } else {
1068
1083
  throw new Error("Unknown node type");
1069
1084
  }
1085
+ visitDescendants = false;
1070
1086
  },
1071
1087
  insertAfter: (nodes) => {
1072
1088
  const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
@@ -1152,6 +1168,7 @@ function walkNodeTree(node, visitor, options) {
1152
1168
  } else {
1153
1169
  throw new Error("Unknown node type");
1154
1170
  }
1171
+ visitDescendants = false;
1155
1172
  },
1156
1173
  insertAfter: (nodes) => {
1157
1174
  const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
@@ -1939,6 +1956,12 @@ var createCanvasChannel = ({
1939
1956
  const broadcastToItems = [...broadcastTo];
1940
1957
  const postMessage = (message) => {
1941
1958
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
1959
+ for (const handlerId in handlers) {
1960
+ const handler = handlers[handlerId];
1961
+ if (handler.types.includes(message.type)) {
1962
+ handler.handler(message, new MessageEvent(message.type));
1963
+ }
1964
+ }
1942
1965
  };
1943
1966
  const selectComponent = (id) => {
1944
1967
  const message = {
@@ -1979,15 +2002,17 @@ var createCanvasChannel = ({
1979
2002
  hash: generateHash({
1980
2003
  composition,
1981
2004
  secret
1982
- })
2005
+ }),
2006
+ eventTimestamp: Date.now()
1983
2007
  };
1984
2008
  postMessage(message);
1985
2009
  };
1986
- const updateCompositionInternal = (composition, hash) => {
2010
+ const updateCompositionInternal = (composition, hash, eventTimestamp) => {
1987
2011
  const message = {
1988
2012
  type: "update-composition-internal",
1989
2013
  composition,
1990
- hash
2014
+ hash,
2015
+ eventTimestamp: eventTimestamp != null ? eventTimestamp : Date.now()
1991
2016
  };
1992
2017
  postMessage(message);
1993
2018
  };
@@ -2129,6 +2154,7 @@ var createCanvasChannel = ({
2129
2154
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2130
2155
  };
2131
2156
  return {
2157
+ broadcastTo,
2132
2158
  ready,
2133
2159
  destroy,
2134
2160
  triggerComponentAction,
@@ -2454,7 +2480,9 @@ function convertEntryToPutEntry(entry) {
2454
2480
  pattern: entry.pattern,
2455
2481
  state: entry.state,
2456
2482
  projectId: entry.projectId,
2457
- releaseId: entry.releaseId
2483
+ releaseId: entry.releaseId,
2484
+ workflowId: entry.workflowId,
2485
+ workflowStageId: entry.workflowStageId
2458
2486
  };
2459
2487
  }
2460
2488
 
@@ -2757,6 +2785,41 @@ function handleRichTextNodeBinding(object, options) {
2757
2785
 
2758
2786
  // src/index.ts
2759
2787
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
2788
+
2789
+ // src/WorkflowClient.ts
2790
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
2791
+ var workflowsUrl = "/api/v1/workflows";
2792
+ var WorkflowClient = class extends ApiClient12 {
2793
+ constructor(options) {
2794
+ super(options);
2795
+ }
2796
+ /** Fetches workflows for a project */
2797
+ async get(options) {
2798
+ const { projectId } = this.options;
2799
+ const fetchUri = this.createUrl(workflowsUrl, { ...options, projectId });
2800
+ return await this.apiClient(fetchUri);
2801
+ }
2802
+ /** Updates or creates a workflow definition */
2803
+ async upsert(body) {
2804
+ const fetchUri = this.createUrl(workflowsUrl);
2805
+ await this.apiClient(fetchUri, {
2806
+ method: "PUT",
2807
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2808
+ expectNoContent: true
2809
+ });
2810
+ }
2811
+ /** Deletes a workflow definition */
2812
+ async remove(body) {
2813
+ const fetchUri = this.createUrl(workflowsUrl);
2814
+ await this.apiClient(fetchUri, {
2815
+ method: "DELETE",
2816
+ body: JSON.stringify({ ...body, projectId: this.options.projectId }),
2817
+ expectNoContent: true
2818
+ });
2819
+ }
2820
+ };
2821
+
2822
+ // src/index.ts
2760
2823
  var CanvasClientError = ApiClientError2;
2761
2824
  export {
2762
2825
  ASSETS_SOURCE_CUSTOM_URL,
@@ -2821,6 +2884,7 @@ export {
2821
2884
  UncachedCategoryClient,
2822
2885
  UncachedContentClient,
2823
2886
  UniqueBatchEntries,
2887
+ WorkflowClient,
2824
2888
  bindVariables,
2825
2889
  bindVariablesToObject,
2826
2890
  compose,
@@ -2841,6 +2905,7 @@ export {
2841
2905
  getChannelName,
2842
2906
  getComponentJsonPointer,
2843
2907
  getComponentPath,
2908
+ getLocalizedPropertyValues,
2844
2909
  getNounForLocation,
2845
2910
  getNounForNode,
2846
2911
  getParameterAttributes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.134.3-alpha.28+506233b832",
3
+ "version": "19.135.1-alpha.10+261b728b6b",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,8 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/assets": "19.134.3-alpha.28+506233b832",
42
- "@uniformdev/context": "19.134.3-alpha.28+506233b832",
41
+ "@uniformdev/assets": "19.135.1-alpha.10+261b728b6b",
42
+ "@uniformdev/context": "19.135.1-alpha.10+261b728b6b",
43
43
  "immer": "10.0.4"
44
44
  },
45
45
  "files": [
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "506233b8324cbb3d7d6a0ef97b8d5e01b36bfb08"
51
+ "gitHead": "261b728b6bc036ca8260861715632078b3eb27ca"
52
52
  }