@uniformdev/canvas 20.34.3-alpha.70 → 20.35.1-alpha.188

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
@@ -1081,6 +1081,11 @@ var CANVAS_PERSONALIZE_SLOT = "pz";
1081
1081
  var CANVAS_TEST_SLOT = "test";
1082
1082
  var CANVAS_LOCALIZATION_SLOT = "localized";
1083
1083
  var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
1084
+ var CANVAS_SLOT_SECTION_NAME_PARAM = "name";
1085
+ var CANVAS_SLOT_SECTION_MIN_PARAM = "min";
1086
+ var CANVAS_SLOT_SECTION_MAX_PARAM = "max";
1087
+ var CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM = "groupType";
1088
+ var CANVAS_SLOT_SECTION_SPECIFIC_PARAM = "specific";
1084
1089
  var CANVAS_DRAFT_STATE = 0;
1085
1090
  var CANVAS_PUBLISHED_STATE = 64;
1086
1091
  var CANVAS_EDITOR_STATE = 63;
@@ -1091,6 +1096,9 @@ var CANVAS_PERSONALIZATION_ALGORITHM_TYPE = "pzAlgorithm";
1091
1096
  var CANVAS_PERSONALIZATION_TAKE_PARAM = "count";
1092
1097
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1093
1098
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1099
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1100
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1101
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1094
1102
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1095
1103
  var SECRET_QUERY_STRING_PARAM = "secret";
1096
1104
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
@@ -2513,10 +2521,55 @@ var EntityReleasesClient = class extends ApiClient6 {
2513
2521
  }
2514
2522
  };
2515
2523
 
2516
- // src/LocaleClient.ts
2524
+ // src/IntegrationPropertyEditorsClient.ts
2517
2525
  import { ApiClient as ApiClient7 } from "@uniformdev/context/api";
2526
+ var _baseUrl;
2527
+ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient extends ApiClient7 {
2528
+ constructor(options) {
2529
+ super(options);
2530
+ this.teamId = options.teamId;
2531
+ }
2532
+ /**
2533
+ * Gets a list of property type and hook names for the current team, including public integrations' hooks.
2534
+ */
2535
+ get(options) {
2536
+ const fetchUri = this.createUrl(__privateGet(_IntegrationPropertyEditorsClient, _baseUrl), {
2537
+ ...options,
2538
+ teamId: this.teamId
2539
+ });
2540
+ return this.apiClient(fetchUri);
2541
+ }
2542
+ /**
2543
+ * Creates or updates a custom AI property editor on a Mesh app.
2544
+ */
2545
+ async deploy(body) {
2546
+ const fetchUri = this.createUrl(__privateGet(_IntegrationPropertyEditorsClient, _baseUrl));
2547
+ await this.apiClient(fetchUri, {
2548
+ method: "PUT",
2549
+ body: JSON.stringify({ ...body, teamId: this.teamId }),
2550
+ expectNoContent: true
2551
+ });
2552
+ }
2553
+ /**
2554
+ * Removes a custom AI property editor from a Mesh app.
2555
+ */
2556
+ async delete(body) {
2557
+ const fetchUri = this.createUrl(__privateGet(_IntegrationPropertyEditorsClient, _baseUrl));
2558
+ await this.apiClient(fetchUri, {
2559
+ method: "DELETE",
2560
+ body: JSON.stringify({ ...body, teamId: this.teamId }),
2561
+ expectNoContent: true
2562
+ });
2563
+ }
2564
+ };
2565
+ _baseUrl = new WeakMap();
2566
+ __privateAdd(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2567
+ var IntegrationPropertyEditorsClient = _IntegrationPropertyEditorsClient;
2568
+
2569
+ // src/LocaleClient.ts
2570
+ import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2518
2571
  var localesUrl = "/api/v1/locales";
2519
- var LocaleClient = class extends ApiClient7 {
2572
+ var LocaleClient = class extends ApiClient8 {
2520
2573
  constructor(options) {
2521
2574
  super(options);
2522
2575
  }
@@ -2601,6 +2654,9 @@ var isUpdatePreviewSettingsMessage = (message) => {
2601
2654
  var isUpdateFeatureFlagsMessage = (message) => {
2602
2655
  return message.type === "update-feature-flags";
2603
2656
  };
2657
+ var isUpdateAiActionsMessage = (message) => {
2658
+ return message.type === "update-ai-actions";
2659
+ };
2604
2660
  var isUpdateContextualEditingStateInternalMessage = (message) => {
2605
2661
  return message.type === "update-contextual-editing-state-internal";
2606
2662
  };
@@ -2632,6 +2688,11 @@ var createCanvasChannel = ({
2632
2688
  let handlerCounter = 0;
2633
2689
  const handlers = {};
2634
2690
  const broadcastToItems = [...broadcastTo];
2691
+ const addBroadcastTarget = (window2) => {
2692
+ if (!broadcastToItems.includes(window2)) {
2693
+ broadcastToItems.push(window2);
2694
+ }
2695
+ };
2635
2696
  const postMessage = (message) => {
2636
2697
  broadcastToItems.forEach((item) => item == null ? void 0 : item.postMessage(JSON.stringify(message), "*"));
2637
2698
  for (const handlerId in handlers) {
@@ -2821,6 +2882,13 @@ var createCanvasChannel = ({
2821
2882
  };
2822
2883
  postMessage(message);
2823
2884
  };
2885
+ const updateAiActions = (options) => {
2886
+ const message = {
2887
+ ...options,
2888
+ type: "update-ai-actions"
2889
+ };
2890
+ postMessage(message);
2891
+ };
2824
2892
  const contextStorageUpdated = (options) => {
2825
2893
  const message = {
2826
2894
  ...options,
@@ -2855,9 +2923,10 @@ var createCanvasChannel = ({
2855
2923
  listenTo.forEach((item) => item.removeEventListener("message", messageEventListener));
2856
2924
  };
2857
2925
  return {
2858
- broadcastTo,
2926
+ broadcastTo: broadcastToItems,
2859
2927
  ready,
2860
2928
  destroy,
2929
+ addBroadcastTarget,
2861
2930
  triggerComponentAction,
2862
2931
  selectComponent,
2863
2932
  updateComposition,
@@ -2870,6 +2939,7 @@ var createCanvasChannel = ({
2870
2939
  triggerCompositionAction,
2871
2940
  updatePreviewSettings,
2872
2941
  updateFeatureFlags,
2942
+ updateAiActions,
2873
2943
  updateContextualEditingStateInternal,
2874
2944
  selectParameter,
2875
2945
  openParameterEditor,
@@ -2885,10 +2955,10 @@ var createCanvasChannel = ({
2885
2955
  };
2886
2956
 
2887
2957
  // src/PreviewClient.ts
2888
- import { ApiClient as ApiClient8 } from "@uniformdev/context/api";
2958
+ import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
2889
2959
  var previewUrlsUrl = "/api/v1/preview-urls";
2890
2960
  var previewViewportsUrl = "/api/v1/preview-viewports";
2891
- var PreviewClient = class extends ApiClient8 {
2961
+ var PreviewClient = class extends ApiClient9 {
2892
2962
  constructor(options) {
2893
2963
  super(options);
2894
2964
  }
@@ -2951,9 +3021,9 @@ var PreviewClient = class extends ApiClient8 {
2951
3021
  };
2952
3022
 
2953
3023
  // src/ProjectClient.ts
2954
- import { ApiClient as ApiClient9 } from "@uniformdev/context/api";
3024
+ import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
2955
3025
  var _url2;
2956
- var _ProjectClient = class _ProjectClient extends ApiClient9 {
3026
+ var _ProjectClient = class _ProjectClient extends ApiClient10 {
2957
3027
  constructor(options) {
2958
3028
  super({ ...options, bypassCache: true });
2959
3029
  }
@@ -2985,9 +3055,9 @@ __privateAdd(_ProjectClient, _url2, "/api/v1/project");
2985
3055
  var ProjectClient = _ProjectClient;
2986
3056
 
2987
3057
  // src/PromptClient.ts
2988
- import { ApiClient as ApiClient10 } from "@uniformdev/context/api";
3058
+ import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
2989
3059
  var PromptsUrl = "/api/v1/prompts";
2990
- var PromptClient = class extends ApiClient10 {
3060
+ var PromptClient = class extends ApiClient11 {
2991
3061
  constructor(options) {
2992
3062
  super(options);
2993
3063
  }
@@ -3018,9 +3088,9 @@ var PromptClient = class extends ApiClient10 {
3018
3088
  };
3019
3089
 
3020
3090
  // src/RelationshipClient.ts
3021
- import { ApiClient as ApiClient11 } from "@uniformdev/context/api";
3091
+ import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3022
3092
  var RELATIONSHIPS_URL = "/api/v1/relationships";
3023
- var RelationshipClient = class extends ApiClient11 {
3093
+ var RelationshipClient = class extends ApiClient12 {
3024
3094
  constructor(options) {
3025
3095
  super(options);
3026
3096
  this.get = async (options) => {
@@ -3032,9 +3102,9 @@ var RelationshipClient = class extends ApiClient11 {
3032
3102
  };
3033
3103
 
3034
3104
  // src/ReleaseClient.ts
3035
- import { ApiClient as ApiClient12 } from "@uniformdev/context/api";
3105
+ import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3036
3106
  var releasesUrl = "/api/v1/releases";
3037
- var ReleaseClient = class extends ApiClient12 {
3107
+ var ReleaseClient = class extends ApiClient13 {
3038
3108
  constructor(options) {
3039
3109
  super(options);
3040
3110
  }
@@ -3074,9 +3144,9 @@ var ReleaseClient = class extends ApiClient12 {
3074
3144
  };
3075
3145
 
3076
3146
  // src/ReleaseContentsClient.ts
3077
- import { ApiClient as ApiClient13 } from "@uniformdev/context/api";
3147
+ import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3078
3148
  var releaseContentsUrl2 = "/api/v1/release-contents";
3079
- var ReleaseContentsClient = class extends ApiClient13 {
3149
+ var ReleaseContentsClient = class extends ApiClient14 {
3080
3150
  constructor(options) {
3081
3151
  super(options);
3082
3152
  }
@@ -3098,9 +3168,9 @@ var ReleaseContentsClient = class extends ApiClient13 {
3098
3168
  };
3099
3169
 
3100
3170
  // src/RouteClient.ts
3101
- import { ApiClient as ApiClient14 } from "@uniformdev/context/api";
3171
+ import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3102
3172
  var ROUTE_URL = "/api/v1/route";
3103
- var RouteClient = class extends ApiClient14 {
3173
+ var RouteClient = class extends ApiClient15 {
3104
3174
  constructor(options) {
3105
3175
  var _a;
3106
3176
  if (!options.limitPolicy) {
@@ -3123,6 +3193,63 @@ var RouteClient = class extends ApiClient14 {
3123
3193
  // src/types/locales.ts
3124
3194
  var LOCALE_DYNAMIC_INPUT_NAME = "locale";
3125
3195
 
3196
+ // src/utils/assetConfig.ts
3197
+ var mergeAssetConfigWithDefaults = (config) => {
3198
+ var _a;
3199
+ return {
3200
+ ...config,
3201
+ // For backwards compatibility reasons undefined represents restriction to
3202
+ // image types
3203
+ allowedTypes: (_a = config.allowedTypes) != null ? _a : ["image"]
3204
+ };
3205
+ };
3206
+
3207
+ // src/utils/autoFixParameterGroups.ts
3208
+ function autoFixParameterGroups(properties) {
3209
+ var _a;
3210
+ const remainingGroups = (_a = properties.filter((param) => param.type === "group")) != null ? _a : [];
3211
+ if (remainingGroups.length === 0) {
3212
+ return false;
3213
+ }
3214
+ let result = false;
3215
+ while (remainingGroups.length > 0) {
3216
+ const group = remainingGroups.shift();
3217
+ const groupParamsConfig = group.typeConfig && typeof group.typeConfig === "object" && "childrenParams" in group.typeConfig && Array.isArray(group.typeConfig.childrenParams) ? group.typeConfig.childrenParams : [];
3218
+ const expectedParamsToFindFollowingGroup = new Set(groupParamsConfig);
3219
+ const groupStartIndex = properties.findIndex((param) => param.id === group.id);
3220
+ const groupItemsCount = expectedParamsToFindFollowingGroup.size;
3221
+ for (let i = groupStartIndex + 1; i <= groupStartIndex + groupItemsCount; i++) {
3222
+ const param = properties[i];
3223
+ if (!param) {
3224
+ continue;
3225
+ }
3226
+ if (expectedParamsToFindFollowingGroup.has(param.id)) {
3227
+ expectedParamsToFindFollowingGroup.delete(param.id);
3228
+ } else {
3229
+ break;
3230
+ }
3231
+ }
3232
+ if (expectedParamsToFindFollowingGroup.size > 0) {
3233
+ const paramsToMove = Array.from(expectedParamsToFindFollowingGroup);
3234
+ let leadingGroupIndex = groupStartIndex + groupItemsCount - expectedParamsToFindFollowingGroup.size;
3235
+ for (const paramId of paramsToMove) {
3236
+ const paramIndex = properties.findIndex((param) => param.id === paramId);
3237
+ if (paramIndex !== -1) {
3238
+ const [param] = properties.splice(paramIndex, 1);
3239
+ if (paramIndex > leadingGroupIndex) {
3240
+ leadingGroupIndex++;
3241
+ }
3242
+ properties.splice(leadingGroupIndex, 0, param);
3243
+ } else {
3244
+ groupParamsConfig.splice(groupParamsConfig.indexOf(paramId), 1);
3245
+ }
3246
+ }
3247
+ result = true;
3248
+ }
3249
+ }
3250
+ return result;
3251
+ }
3252
+
3126
3253
  // src/utils/createApiEnhancer.ts
3127
3254
  var createUniformApiEnhancer = ({ apiUrl }) => {
3128
3255
  return async (message) => {
@@ -3252,7 +3379,8 @@ function mapSlotToTestVariations(slot) {
3252
3379
  return {
3253
3380
  ...v,
3254
3381
  id,
3255
- testDistribution: contextTag == null ? void 0 : contextTag.testDistribution
3382
+ testDistribution: contextTag == null ? void 0 : contextTag.testDistribution,
3383
+ control: contextTag == null ? void 0 : contextTag.control
3256
3384
  };
3257
3385
  });
3258
3386
  }
@@ -3417,12 +3545,12 @@ function handleRichTextNodeBinding(object, options) {
3417
3545
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3418
3546
 
3419
3547
  // src/.version.ts
3420
- var version = "20.34.2";
3548
+ var version = "20.43.1";
3421
3549
 
3422
3550
  // src/WorkflowClient.ts
3423
- import { ApiClient as ApiClient15 } from "@uniformdev/context/api";
3551
+ import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
3424
3552
  var workflowsUrl = "/api/v1/workflows";
3425
- var WorkflowClient = class extends ApiClient15 {
3553
+ var WorkflowClient = class extends ApiClient16 {
3426
3554
  constructor(options) {
3427
3555
  super(options);
3428
3556
  }
@@ -3468,11 +3596,14 @@ export {
3468
3596
  BatchEntry,
3469
3597
  BlockFormatError,
3470
3598
  CANVAS_BLOCK_PARAM_TYPE,
3599
+ CANVAS_COMPONENT_DISPLAY_NAME_PARAM,
3471
3600
  CANVAS_CONTEXTUAL_EDITING_PARAM,
3472
3601
  CANVAS_DRAFT_STATE,
3473
3602
  CANVAS_EDITOR_STATE,
3474
3603
  CANVAS_ENRICHMENT_TAG_PARAM,
3604
+ CANVAS_HYPOTHESIS_PARAM,
3475
3605
  CANVAS_INTENT_TAG_PARAM,
3606
+ CANVAS_INTERNAL_PARAM_PREFIX,
3476
3607
  CANVAS_LOCALE_TAG_PARAM,
3477
3608
  CANVAS_LOCALIZATION_SLOT,
3478
3609
  CANVAS_LOCALIZATION_TYPE,
@@ -3484,7 +3615,12 @@ export {
3484
3615
  CANVAS_PERSONALIZE_SLOT,
3485
3616
  CANVAS_PERSONALIZE_TYPE,
3486
3617
  CANVAS_PUBLISHED_STATE,
3618
+ CANVAS_SLOT_SECTION_GROUP_TYPE_PARAM,
3619
+ CANVAS_SLOT_SECTION_MAX_PARAM,
3620
+ CANVAS_SLOT_SECTION_MIN_PARAM,
3621
+ CANVAS_SLOT_SECTION_NAME_PARAM,
3487
3622
  CANVAS_SLOT_SECTION_SLOT,
3623
+ CANVAS_SLOT_SECTION_SPECIFIC_PARAM,
3488
3624
  CANVAS_SLOT_SECTION_TYPE,
3489
3625
  CANVAS_TEST_SLOT,
3490
3626
  CANVAS_TEST_TYPE,
@@ -3516,6 +3652,7 @@ export {
3516
3652
  IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM,
3517
3653
  IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
3518
3654
  IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
3655
+ IntegrationPropertyEditorsClient,
3519
3656
  LOCALE_DYNAMIC_INPUT_NAME,
3520
3657
  LocaleClient,
3521
3658
  PLACEHOLDER_ID,
@@ -3532,6 +3669,7 @@ export {
3532
3669
  UncachedContentClient,
3533
3670
  UniqueBatchEntries,
3534
3671
  WorkflowClient,
3672
+ autoFixParameterGroups,
3535
3673
  bindExpressionEscapeChars,
3536
3674
  bindExpressionPrefix,
3537
3675
  bindVariables,
@@ -3593,6 +3731,7 @@ export {
3593
3731
  isSuggestComponentMessage,
3594
3732
  isSystemComponentDefinition,
3595
3733
  isTriggerCompositionActionMessage,
3734
+ isUpdateAiActionsMessage,
3596
3735
  isUpdateComponentParameterMessage,
3597
3736
  isUpdateComponentReferencesMessage,
3598
3737
  isUpdateCompositionInternalMessage,
@@ -3603,6 +3742,7 @@ export {
3603
3742
  localize,
3604
3743
  mapSlotToPersonalizedVariations,
3605
3744
  mapSlotToTestVariations,
3745
+ mergeAssetConfigWithDefaults,
3606
3746
  nullLimitPolicy,
3607
3747
  parseComponentPlaceholderId,
3608
3748
  parseVariableExpression,