@uniformdev/canvas 19.79.1-alpha.18 → 19.79.1-alpha.26
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.d.mts +6131 -416
- package/dist/index.d.ts +6131 -416
- package/dist/index.esm.js +63 -6
- package/dist/index.js +68 -6
- package/dist/index.mjs +63 -6
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
@@ -481,15 +481,22 @@ var CanvasClient = class extends ApiClient {
|
|
481
481
|
/** Fetches lists of Canvas compositions, optionally by type */
|
482
482
|
async getCompositionList(params = {}) {
|
483
483
|
const { projectId } = this.options;
|
484
|
-
const { resolveData, ...originParams } = params;
|
484
|
+
const { resolveData, filters, ...originParams } = params;
|
485
|
+
const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
|
486
|
+
const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
|
487
|
+
let rhs = typeof value === "object" ? Object.values(value)[0] : value;
|
488
|
+
rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
|
489
|
+
return { ...acc, [lhs]: rhs };
|
490
|
+
}, {});
|
485
491
|
if (!resolveData) {
|
486
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
|
492
|
+
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
487
493
|
return this.apiClient(fetchUri);
|
488
494
|
}
|
489
495
|
const edgeParams = {
|
490
496
|
...originParams,
|
491
497
|
projectId,
|
492
|
-
...params.diagnostics ? { diagnostics: "true" } : {}
|
498
|
+
...params.diagnostics ? { diagnostics: "true" } : {},
|
499
|
+
...rewrittenFilters
|
493
500
|
};
|
494
501
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
495
502
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -925,12 +932,14 @@ function getComponentPath(ancestorsAndSelf) {
|
|
925
932
|
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
926
933
|
var CANVAS_TEST_TYPE = "$test";
|
927
934
|
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
935
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
928
936
|
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
929
937
|
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
930
938
|
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
931
939
|
var CANVAS_PERSONALIZE_SLOT = "pz";
|
932
940
|
var CANVAS_TEST_SLOT = "test";
|
933
941
|
var CANVAS_LOCALIZATION_SLOT = "localized";
|
942
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
934
943
|
var CANVAS_DRAFT_STATE = 0;
|
935
944
|
var CANVAS_PUBLISHED_STATE = 64;
|
936
945
|
var CANVAS_EDITOR_STATE = 63;
|
@@ -1915,6 +1924,12 @@ var isOpenParameterEditorMessage = (message) => {
|
|
1915
1924
|
var isUpdateComponentReferencesMessage = (message) => {
|
1916
1925
|
return message.type === "update-component-references";
|
1917
1926
|
};
|
1927
|
+
var isRequestComponentSuggestionMessage = (message) => {
|
1928
|
+
return message.type === "request-component-suggestion";
|
1929
|
+
};
|
1930
|
+
var isSuggestComponentMessage = (message) => {
|
1931
|
+
return message.type === "suggest-component";
|
1932
|
+
};
|
1918
1933
|
var createCanvasChannel = ({
|
1919
1934
|
listenTo,
|
1920
1935
|
broadcastTo
|
@@ -2066,6 +2081,20 @@ var createCanvasChannel = ({
|
|
2066
2081
|
};
|
2067
2082
|
postMessage(message);
|
2068
2083
|
};
|
2084
|
+
const requestComponentSuggestion = (options) => {
|
2085
|
+
const message = {
|
2086
|
+
...options,
|
2087
|
+
type: "request-component-suggestion"
|
2088
|
+
};
|
2089
|
+
postMessage(message);
|
2090
|
+
};
|
2091
|
+
const suggestComponent = (options) => {
|
2092
|
+
const message = {
|
2093
|
+
...options,
|
2094
|
+
type: "suggest-component"
|
2095
|
+
};
|
2096
|
+
postMessage(message);
|
2097
|
+
};
|
2069
2098
|
const updateFeatureFlags = (options) => {
|
2070
2099
|
const message = {
|
2071
2100
|
...options,
|
@@ -2119,7 +2148,9 @@ var createCanvasChannel = ({
|
|
2119
2148
|
openParameterEditor,
|
2120
2149
|
reportRenderedCompositions,
|
2121
2150
|
editorStateUpdated,
|
2122
|
-
updateComponentReferences
|
2151
|
+
updateComponentReferences,
|
2152
|
+
requestComponentSuggestion,
|
2153
|
+
suggestComponent
|
2123
2154
|
};
|
2124
2155
|
};
|
2125
2156
|
|
@@ -2500,6 +2531,7 @@ function mapSlotToTestVariations(slot) {
|
|
2500
2531
|
}
|
2501
2532
|
|
2502
2533
|
// src/utils/placeholder.ts
|
2534
|
+
var SEPARATOR = "_";
|
2503
2535
|
var isComponentPlaceholderId = (id) => {
|
2504
2536
|
if (id === PLACEHOLDER_ID) {
|
2505
2537
|
return true;
|
@@ -2509,11 +2541,31 @@ var isComponentPlaceholderId = (id) => {
|
|
2509
2541
|
}
|
2510
2542
|
return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
|
2511
2543
|
};
|
2512
|
-
var generateComponentPlaceholderId = (randomId, sdkVersion) => {
|
2544
|
+
var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
|
2513
2545
|
if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
|
2514
2546
|
return PLACEHOLDER_ID;
|
2515
2547
|
}
|
2516
|
-
|
2548
|
+
let idParts = [PLACEHOLDER_ID, randomId];
|
2549
|
+
if (parent) {
|
2550
|
+
idParts = [...idParts, parent.nodeId, parent.slotId];
|
2551
|
+
}
|
2552
|
+
return idParts.join(SEPARATOR);
|
2553
|
+
};
|
2554
|
+
var parseComponentPlaceholderId = (id) => {
|
2555
|
+
if (!isComponentPlaceholderId(id)) {
|
2556
|
+
return;
|
2557
|
+
}
|
2558
|
+
const idParts = id.split(SEPARATOR);
|
2559
|
+
const result = {
|
2560
|
+
id: idParts[1]
|
2561
|
+
};
|
2562
|
+
if (idParts[2]) {
|
2563
|
+
result.parent = {
|
2564
|
+
nodeId: idParts[2],
|
2565
|
+
slotId: idParts[3]
|
2566
|
+
};
|
2567
|
+
}
|
2568
|
+
return result;
|
2517
2569
|
};
|
2518
2570
|
|
2519
2571
|
// src/utils/variables/parseVariableExpression.ts
|
@@ -2730,6 +2782,8 @@ export {
|
|
2730
2782
|
CANVAS_PERSONALIZE_SLOT,
|
2731
2783
|
CANVAS_PERSONALIZE_TYPE,
|
2732
2784
|
CANVAS_PUBLISHED_STATE,
|
2785
|
+
CANVAS_SLOT_SECTION_SLOT,
|
2786
|
+
CANVAS_SLOT_SECTION_TYPE,
|
2733
2787
|
CANVAS_TEST_SLOT,
|
2734
2788
|
CANVAS_TEST_TYPE,
|
2735
2789
|
CANVAS_TEST_VARIANT_PARAM,
|
@@ -2805,9 +2859,11 @@ export {
|
|
2805
2859
|
isOpenParameterEditorMessage,
|
2806
2860
|
isReadyMessage,
|
2807
2861
|
isReportRenderedCompositionsMessage,
|
2862
|
+
isRequestComponentSuggestionMessage,
|
2808
2863
|
isRootEntryReference,
|
2809
2864
|
isSelectComponentMessage,
|
2810
2865
|
isSelectParameterMessage,
|
2866
|
+
isSuggestComponentMessage,
|
2811
2867
|
isSystemComponentDefinition,
|
2812
2868
|
isTriggerCompositionActionMessage,
|
2813
2869
|
isUpdateComponentParameterMessage,
|
@@ -2821,6 +2877,7 @@ export {
|
|
2821
2877
|
mapSlotToPersonalizedVariations,
|
2822
2878
|
mapSlotToTestVariations,
|
2823
2879
|
nullLimitPolicy,
|
2880
|
+
parseComponentPlaceholderId,
|
2824
2881
|
parseVariableExpression,
|
2825
2882
|
subscribeToComposition,
|
2826
2883
|
walkComponentTree,
|
package/dist/index.js
CHANGED
@@ -300,6 +300,8 @@ __export(src_exports, {
|
|
300
300
|
CANVAS_PERSONALIZE_SLOT: () => CANVAS_PERSONALIZE_SLOT,
|
301
301
|
CANVAS_PERSONALIZE_TYPE: () => CANVAS_PERSONALIZE_TYPE,
|
302
302
|
CANVAS_PUBLISHED_STATE: () => CANVAS_PUBLISHED_STATE,
|
303
|
+
CANVAS_SLOT_SECTION_SLOT: () => CANVAS_SLOT_SECTION_SLOT,
|
304
|
+
CANVAS_SLOT_SECTION_TYPE: () => CANVAS_SLOT_SECTION_TYPE,
|
303
305
|
CANVAS_TEST_SLOT: () => CANVAS_TEST_SLOT,
|
304
306
|
CANVAS_TEST_TYPE: () => CANVAS_TEST_TYPE,
|
305
307
|
CANVAS_TEST_VARIANT_PARAM: () => CANVAS_TEST_VARIANT_PARAM,
|
@@ -375,9 +377,11 @@ __export(src_exports, {
|
|
375
377
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
376
378
|
isReadyMessage: () => isReadyMessage,
|
377
379
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
380
|
+
isRequestComponentSuggestionMessage: () => isRequestComponentSuggestionMessage,
|
378
381
|
isRootEntryReference: () => isRootEntryReference,
|
379
382
|
isSelectComponentMessage: () => isSelectComponentMessage,
|
380
383
|
isSelectParameterMessage: () => isSelectParameterMessage,
|
384
|
+
isSuggestComponentMessage: () => isSuggestComponentMessage,
|
381
385
|
isSystemComponentDefinition: () => isSystemComponentDefinition,
|
382
386
|
isTriggerCompositionActionMessage: () => isTriggerCompositionActionMessage,
|
383
387
|
isUpdateComponentParameterMessage: () => isUpdateComponentParameterMessage,
|
@@ -391,6 +395,7 @@ __export(src_exports, {
|
|
391
395
|
mapSlotToPersonalizedVariations: () => mapSlotToPersonalizedVariations,
|
392
396
|
mapSlotToTestVariations: () => mapSlotToTestVariations,
|
393
397
|
nullLimitPolicy: () => nullLimitPolicy,
|
398
|
+
parseComponentPlaceholderId: () => parseComponentPlaceholderId,
|
394
399
|
parseVariableExpression: () => parseVariableExpression,
|
395
400
|
subscribeToComposition: () => subscribeToComposition,
|
396
401
|
walkComponentTree: () => walkComponentTree,
|
@@ -611,15 +616,22 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
611
616
|
/** Fetches lists of Canvas compositions, optionally by type */
|
612
617
|
async getCompositionList(params = {}) {
|
613
618
|
const { projectId } = this.options;
|
614
|
-
const { resolveData, ...originParams } = params;
|
619
|
+
const { resolveData, filters, ...originParams } = params;
|
620
|
+
const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
|
621
|
+
const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
|
622
|
+
let rhs = typeof value === "object" ? Object.values(value)[0] : value;
|
623
|
+
rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
|
624
|
+
return { ...acc, [lhs]: rhs };
|
625
|
+
}, {});
|
615
626
|
if (!resolveData) {
|
616
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
|
627
|
+
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
617
628
|
return this.apiClient(fetchUri);
|
618
629
|
}
|
619
630
|
const edgeParams = {
|
620
631
|
...originParams,
|
621
632
|
projectId,
|
622
|
-
...params.diagnostics ? { diagnostics: "true" } : {}
|
633
|
+
...params.diagnostics ? { diagnostics: "true" } : {},
|
634
|
+
...rewrittenFilters
|
623
635
|
};
|
624
636
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
625
637
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -1055,12 +1067,14 @@ function getComponentPath(ancestorsAndSelf) {
|
|
1055
1067
|
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
1056
1068
|
var CANVAS_TEST_TYPE = "$test";
|
1057
1069
|
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
1070
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
1058
1071
|
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
1059
1072
|
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
1060
1073
|
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
1061
1074
|
var CANVAS_PERSONALIZE_SLOT = "pz";
|
1062
1075
|
var CANVAS_TEST_SLOT = "test";
|
1063
1076
|
var CANVAS_LOCALIZATION_SLOT = "localized";
|
1077
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
1064
1078
|
var CANVAS_DRAFT_STATE = 0;
|
1065
1079
|
var CANVAS_PUBLISHED_STATE = 64;
|
1066
1080
|
var CANVAS_EDITOR_STATE = 63;
|
@@ -2045,6 +2059,12 @@ var isOpenParameterEditorMessage = (message) => {
|
|
2045
2059
|
var isUpdateComponentReferencesMessage = (message) => {
|
2046
2060
|
return message.type === "update-component-references";
|
2047
2061
|
};
|
2062
|
+
var isRequestComponentSuggestionMessage = (message) => {
|
2063
|
+
return message.type === "request-component-suggestion";
|
2064
|
+
};
|
2065
|
+
var isSuggestComponentMessage = (message) => {
|
2066
|
+
return message.type === "suggest-component";
|
2067
|
+
};
|
2048
2068
|
var createCanvasChannel = ({
|
2049
2069
|
listenTo,
|
2050
2070
|
broadcastTo
|
@@ -2196,6 +2216,20 @@ var createCanvasChannel = ({
|
|
2196
2216
|
};
|
2197
2217
|
postMessage(message);
|
2198
2218
|
};
|
2219
|
+
const requestComponentSuggestion = (options) => {
|
2220
|
+
const message = {
|
2221
|
+
...options,
|
2222
|
+
type: "request-component-suggestion"
|
2223
|
+
};
|
2224
|
+
postMessage(message);
|
2225
|
+
};
|
2226
|
+
const suggestComponent = (options) => {
|
2227
|
+
const message = {
|
2228
|
+
...options,
|
2229
|
+
type: "suggest-component"
|
2230
|
+
};
|
2231
|
+
postMessage(message);
|
2232
|
+
};
|
2199
2233
|
const updateFeatureFlags = (options) => {
|
2200
2234
|
const message = {
|
2201
2235
|
...options,
|
@@ -2249,7 +2283,9 @@ var createCanvasChannel = ({
|
|
2249
2283
|
openParameterEditor,
|
2250
2284
|
reportRenderedCompositions,
|
2251
2285
|
editorStateUpdated,
|
2252
|
-
updateComponentReferences
|
2286
|
+
updateComponentReferences,
|
2287
|
+
requestComponentSuggestion,
|
2288
|
+
suggestComponent
|
2253
2289
|
};
|
2254
2290
|
};
|
2255
2291
|
|
@@ -2630,6 +2666,7 @@ function mapSlotToTestVariations(slot) {
|
|
2630
2666
|
}
|
2631
2667
|
|
2632
2668
|
// src/utils/placeholder.ts
|
2669
|
+
var SEPARATOR = "_";
|
2633
2670
|
var isComponentPlaceholderId = (id) => {
|
2634
2671
|
if (id === PLACEHOLDER_ID) {
|
2635
2672
|
return true;
|
@@ -2639,11 +2676,31 @@ var isComponentPlaceholderId = (id) => {
|
|
2639
2676
|
}
|
2640
2677
|
return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
|
2641
2678
|
};
|
2642
|
-
var generateComponentPlaceholderId = (randomId, sdkVersion) => {
|
2679
|
+
var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
|
2643
2680
|
if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
|
2644
2681
|
return PLACEHOLDER_ID;
|
2645
2682
|
}
|
2646
|
-
|
2683
|
+
let idParts = [PLACEHOLDER_ID, randomId];
|
2684
|
+
if (parent) {
|
2685
|
+
idParts = [...idParts, parent.nodeId, parent.slotId];
|
2686
|
+
}
|
2687
|
+
return idParts.join(SEPARATOR);
|
2688
|
+
};
|
2689
|
+
var parseComponentPlaceholderId = (id) => {
|
2690
|
+
if (!isComponentPlaceholderId(id)) {
|
2691
|
+
return;
|
2692
|
+
}
|
2693
|
+
const idParts = id.split(SEPARATOR);
|
2694
|
+
const result = {
|
2695
|
+
id: idParts[1]
|
2696
|
+
};
|
2697
|
+
if (idParts[2]) {
|
2698
|
+
result.parent = {
|
2699
|
+
nodeId: idParts[2],
|
2700
|
+
slotId: idParts[3]
|
2701
|
+
};
|
2702
|
+
}
|
2703
|
+
return result;
|
2647
2704
|
};
|
2648
2705
|
|
2649
2706
|
// src/utils/variables/parseVariableExpression.ts
|
@@ -2861,6 +2918,8 @@ var CanvasClientError = import_api13.ApiClientError;
|
|
2861
2918
|
CANVAS_PERSONALIZE_SLOT,
|
2862
2919
|
CANVAS_PERSONALIZE_TYPE,
|
2863
2920
|
CANVAS_PUBLISHED_STATE,
|
2921
|
+
CANVAS_SLOT_SECTION_SLOT,
|
2922
|
+
CANVAS_SLOT_SECTION_TYPE,
|
2864
2923
|
CANVAS_TEST_SLOT,
|
2865
2924
|
CANVAS_TEST_TYPE,
|
2866
2925
|
CANVAS_TEST_VARIANT_PARAM,
|
@@ -2936,9 +2995,11 @@ var CanvasClientError = import_api13.ApiClientError;
|
|
2936
2995
|
isOpenParameterEditorMessage,
|
2937
2996
|
isReadyMessage,
|
2938
2997
|
isReportRenderedCompositionsMessage,
|
2998
|
+
isRequestComponentSuggestionMessage,
|
2939
2999
|
isRootEntryReference,
|
2940
3000
|
isSelectComponentMessage,
|
2941
3001
|
isSelectParameterMessage,
|
3002
|
+
isSuggestComponentMessage,
|
2942
3003
|
isSystemComponentDefinition,
|
2943
3004
|
isTriggerCompositionActionMessage,
|
2944
3005
|
isUpdateComponentParameterMessage,
|
@@ -2952,6 +3013,7 @@ var CanvasClientError = import_api13.ApiClientError;
|
|
2952
3013
|
mapSlotToPersonalizedVariations,
|
2953
3014
|
mapSlotToTestVariations,
|
2954
3015
|
nullLimitPolicy,
|
3016
|
+
parseComponentPlaceholderId,
|
2955
3017
|
parseVariableExpression,
|
2956
3018
|
subscribeToComposition,
|
2957
3019
|
walkComponentTree,
|
package/dist/index.mjs
CHANGED
@@ -481,15 +481,22 @@ var CanvasClient = class extends ApiClient {
|
|
481
481
|
/** Fetches lists of Canvas compositions, optionally by type */
|
482
482
|
async getCompositionList(params = {}) {
|
483
483
|
const { projectId } = this.options;
|
484
|
-
const { resolveData, ...originParams } = params;
|
484
|
+
const { resolveData, filters, ...originParams } = params;
|
485
|
+
const rewrittenFilters = Object.entries(filters != null ? filters : {}).reduce((acc, [key, value]) => {
|
486
|
+
const lhs = `filters.${key}` + (typeof value === "object" ? `[${Object.keys(value)[0]}]` : "");
|
487
|
+
let rhs = typeof value === "object" ? Object.values(value)[0] : value;
|
488
|
+
rhs = Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim();
|
489
|
+
return { ...acc, [lhs]: rhs };
|
490
|
+
}, {});
|
485
491
|
if (!resolveData) {
|
486
|
-
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId });
|
492
|
+
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
487
493
|
return this.apiClient(fetchUri);
|
488
494
|
}
|
489
495
|
const edgeParams = {
|
490
496
|
...originParams,
|
491
497
|
projectId,
|
492
|
-
...params.diagnostics ? { diagnostics: "true" } : {}
|
498
|
+
...params.diagnostics ? { diagnostics: "true" } : {},
|
499
|
+
...rewrittenFilters
|
493
500
|
};
|
494
501
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
495
502
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -925,12 +932,14 @@ function getComponentPath(ancestorsAndSelf) {
|
|
925
932
|
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
926
933
|
var CANVAS_TEST_TYPE = "$test";
|
927
934
|
var CANVAS_LOCALIZATION_TYPE = "$localization";
|
935
|
+
var CANVAS_SLOT_SECTION_TYPE = "$slotSection";
|
928
936
|
var CANVAS_INTENT_TAG_PARAM = "intentTag";
|
929
937
|
var CANVAS_LOCALE_TAG_PARAM = "locale";
|
930
938
|
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
931
939
|
var CANVAS_PERSONALIZE_SLOT = "pz";
|
932
940
|
var CANVAS_TEST_SLOT = "test";
|
933
941
|
var CANVAS_LOCALIZATION_SLOT = "localized";
|
942
|
+
var CANVAS_SLOT_SECTION_SLOT = "$slotSectionItems";
|
934
943
|
var CANVAS_DRAFT_STATE = 0;
|
935
944
|
var CANVAS_PUBLISHED_STATE = 64;
|
936
945
|
var CANVAS_EDITOR_STATE = 63;
|
@@ -1915,6 +1924,12 @@ var isOpenParameterEditorMessage = (message) => {
|
|
1915
1924
|
var isUpdateComponentReferencesMessage = (message) => {
|
1916
1925
|
return message.type === "update-component-references";
|
1917
1926
|
};
|
1927
|
+
var isRequestComponentSuggestionMessage = (message) => {
|
1928
|
+
return message.type === "request-component-suggestion";
|
1929
|
+
};
|
1930
|
+
var isSuggestComponentMessage = (message) => {
|
1931
|
+
return message.type === "suggest-component";
|
1932
|
+
};
|
1918
1933
|
var createCanvasChannel = ({
|
1919
1934
|
listenTo,
|
1920
1935
|
broadcastTo
|
@@ -2066,6 +2081,20 @@ var createCanvasChannel = ({
|
|
2066
2081
|
};
|
2067
2082
|
postMessage(message);
|
2068
2083
|
};
|
2084
|
+
const requestComponentSuggestion = (options) => {
|
2085
|
+
const message = {
|
2086
|
+
...options,
|
2087
|
+
type: "request-component-suggestion"
|
2088
|
+
};
|
2089
|
+
postMessage(message);
|
2090
|
+
};
|
2091
|
+
const suggestComponent = (options) => {
|
2092
|
+
const message = {
|
2093
|
+
...options,
|
2094
|
+
type: "suggest-component"
|
2095
|
+
};
|
2096
|
+
postMessage(message);
|
2097
|
+
};
|
2069
2098
|
const updateFeatureFlags = (options) => {
|
2070
2099
|
const message = {
|
2071
2100
|
...options,
|
@@ -2119,7 +2148,9 @@ var createCanvasChannel = ({
|
|
2119
2148
|
openParameterEditor,
|
2120
2149
|
reportRenderedCompositions,
|
2121
2150
|
editorStateUpdated,
|
2122
|
-
updateComponentReferences
|
2151
|
+
updateComponentReferences,
|
2152
|
+
requestComponentSuggestion,
|
2153
|
+
suggestComponent
|
2123
2154
|
};
|
2124
2155
|
};
|
2125
2156
|
|
@@ -2500,6 +2531,7 @@ function mapSlotToTestVariations(slot) {
|
|
2500
2531
|
}
|
2501
2532
|
|
2502
2533
|
// src/utils/placeholder.ts
|
2534
|
+
var SEPARATOR = "_";
|
2503
2535
|
var isComponentPlaceholderId = (id) => {
|
2504
2536
|
if (id === PLACEHOLDER_ID) {
|
2505
2537
|
return true;
|
@@ -2509,11 +2541,31 @@ var isComponentPlaceholderId = (id) => {
|
|
2509
2541
|
}
|
2510
2542
|
return id == null ? void 0 : id.startsWith(PLACEHOLDER_ID);
|
2511
2543
|
};
|
2512
|
-
var generateComponentPlaceholderId = (randomId, sdkVersion) => {
|
2544
|
+
var generateComponentPlaceholderId = (randomId, sdkVersion, parent) => {
|
2513
2545
|
if (typeof sdkVersion === "undefined" || sdkVersion === 1) {
|
2514
2546
|
return PLACEHOLDER_ID;
|
2515
2547
|
}
|
2516
|
-
|
2548
|
+
let idParts = [PLACEHOLDER_ID, randomId];
|
2549
|
+
if (parent) {
|
2550
|
+
idParts = [...idParts, parent.nodeId, parent.slotId];
|
2551
|
+
}
|
2552
|
+
return idParts.join(SEPARATOR);
|
2553
|
+
};
|
2554
|
+
var parseComponentPlaceholderId = (id) => {
|
2555
|
+
if (!isComponentPlaceholderId(id)) {
|
2556
|
+
return;
|
2557
|
+
}
|
2558
|
+
const idParts = id.split(SEPARATOR);
|
2559
|
+
const result = {
|
2560
|
+
id: idParts[1]
|
2561
|
+
};
|
2562
|
+
if (idParts[2]) {
|
2563
|
+
result.parent = {
|
2564
|
+
nodeId: idParts[2],
|
2565
|
+
slotId: idParts[3]
|
2566
|
+
};
|
2567
|
+
}
|
2568
|
+
return result;
|
2517
2569
|
};
|
2518
2570
|
|
2519
2571
|
// src/utils/variables/parseVariableExpression.ts
|
@@ -2730,6 +2782,8 @@ export {
|
|
2730
2782
|
CANVAS_PERSONALIZE_SLOT,
|
2731
2783
|
CANVAS_PERSONALIZE_TYPE,
|
2732
2784
|
CANVAS_PUBLISHED_STATE,
|
2785
|
+
CANVAS_SLOT_SECTION_SLOT,
|
2786
|
+
CANVAS_SLOT_SECTION_TYPE,
|
2733
2787
|
CANVAS_TEST_SLOT,
|
2734
2788
|
CANVAS_TEST_TYPE,
|
2735
2789
|
CANVAS_TEST_VARIANT_PARAM,
|
@@ -2805,9 +2859,11 @@ export {
|
|
2805
2859
|
isOpenParameterEditorMessage,
|
2806
2860
|
isReadyMessage,
|
2807
2861
|
isReportRenderedCompositionsMessage,
|
2862
|
+
isRequestComponentSuggestionMessage,
|
2808
2863
|
isRootEntryReference,
|
2809
2864
|
isSelectComponentMessage,
|
2810
2865
|
isSelectParameterMessage,
|
2866
|
+
isSuggestComponentMessage,
|
2811
2867
|
isSystemComponentDefinition,
|
2812
2868
|
isTriggerCompositionActionMessage,
|
2813
2869
|
isUpdateComponentParameterMessage,
|
@@ -2821,6 +2877,7 @@ export {
|
|
2821
2877
|
mapSlotToPersonalizedVariations,
|
2822
2878
|
mapSlotToTestVariations,
|
2823
2879
|
nullLimitPolicy,
|
2880
|
+
parseComponentPlaceholderId,
|
2824
2881
|
parseVariableExpression,
|
2825
2882
|
subscribeToComposition,
|
2826
2883
|
walkComponentTree,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.79.1-alpha.
|
3
|
+
"version": "19.79.1-alpha.26+090e487591",
|
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,9 +38,9 @@
|
|
38
38
|
"pusher-js": "8.2.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "19.79.1-alpha.
|
42
|
-
"@uniformdev/context": "19.79.1-alpha.
|
43
|
-
"immer": "10.0.
|
41
|
+
"@uniformdev/assets": "19.79.1-alpha.26+090e487591",
|
42
|
+
"@uniformdev/context": "19.79.1-alpha.26+090e487591",
|
43
|
+
"immer": "10.0.4"
|
44
44
|
},
|
45
45
|
"files": [
|
46
46
|
"/dist"
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "090e487591b6cae5af1629967351ebf08824c264"
|
52
52
|
}
|