@uniformdev/canvas 19.36.1-alpha.0 → 19.36.1-alpha.61

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 CHANGED
@@ -181,19 +181,15 @@ interface components$4 {
181
181
  value: unknown;
182
182
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
183
183
  type: string;
184
+ /** @deprecated */
184
185
  connectedData?: components$4["schemas"]["DataElementConnectionDefinition"];
185
186
  };
186
- /**
187
- * @description Defines a connection to a data element on a data resource.
188
- *
189
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
190
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
191
- */
187
+ /** @description Defines a connection to a dynamic token on a data resource. */
192
188
  DataElementConnectionDefinition: {
193
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
189
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
194
190
  pointer: string;
195
191
  /**
196
- * @description The syntax used to select the data element to bind to
192
+ * @description The syntax used to select the dynamic token to bind to
197
193
  * @enum {string}
198
194
  */
199
195
  syntax: "jptr";
@@ -833,19 +829,15 @@ interface external$a {
833
829
  value: unknown;
834
830
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
835
831
  type: string;
832
+ /** @deprecated */
836
833
  connectedData?: external$a["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
837
834
  };
838
- /**
839
- * @description Defines a connection to a data element on a data resource.
840
- *
841
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
842
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
843
- */
835
+ /** @description Defines a connection to a dynamic token on a data resource. */
844
836
  DataElementConnectionDefinition: {
845
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
837
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
846
838
  pointer: string;
847
839
  /**
848
- * @description The syntax used to select the data element to bind to
840
+ * @description The syntax used to select the dynamic token to bind to
849
841
  * @enum {string}
850
842
  */
851
843
  syntax: "jptr";
@@ -1486,19 +1478,15 @@ interface external$9 {
1486
1478
  value: unknown;
1487
1479
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
1488
1480
  type: string;
1481
+ /** @deprecated */
1489
1482
  connectedData?: external$9["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
1490
1483
  };
1491
- /**
1492
- * @description Defines a connection to a data element on a data resource.
1493
- *
1494
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
1495
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
1496
- */
1484
+ /** @description Defines a connection to a dynamic token on a data resource. */
1497
1485
  DataElementConnectionDefinition: {
1498
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
1486
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
1499
1487
  pointer: string;
1500
1488
  /**
1501
- * @description The syntax used to select the data element to bind to
1489
+ * @description The syntax used to select the dynamic token to bind to
1502
1490
  * @enum {string}
1503
1491
  */
1504
1492
  syntax: "jptr";
@@ -2135,19 +2123,15 @@ interface external$8 {
2135
2123
  value: unknown;
2136
2124
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
2137
2125
  type: string;
2126
+ /** @deprecated */
2138
2127
  connectedData?: external$8["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
2139
2128
  };
2140
- /**
2141
- * @description Defines a connection to a data element on a data resource.
2142
- *
2143
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
2144
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
2145
- */
2129
+ /** @description Defines a connection to a dynamic token on a data resource. */
2146
2130
  DataElementConnectionDefinition: {
2147
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
2131
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
2148
2132
  pointer: string;
2149
2133
  /**
2150
- * @description The syntax used to select the data element to bind to
2134
+ * @description The syntax used to select the dynamic token to bind to
2151
2135
  * @enum {string}
2152
2136
  */
2153
2137
  syntax: "jptr";
@@ -2727,19 +2711,15 @@ interface external$7 {
2727
2711
  value: unknown;
2728
2712
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
2729
2713
  type: string;
2714
+ /** @deprecated */
2730
2715
  connectedData?: external$7["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
2731
2716
  };
2732
- /**
2733
- * @description Defines a connection to a data element on a data resource.
2734
- *
2735
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
2736
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
2737
- */
2717
+ /** @description Defines a connection to a dynamic token on a data resource. */
2738
2718
  DataElementConnectionDefinition: {
2739
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
2719
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
2740
2720
  pointer: string;
2741
2721
  /**
2742
- * @description The syntax used to select the data element to bind to
2722
+ * @description The syntax used to select the dynamic token to bind to
2743
2723
  * @enum {string}
2744
2724
  */
2745
2725
  syntax: "jptr";
@@ -3354,19 +3334,15 @@ interface external$6 {
3354
3334
  value: unknown;
3355
3335
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
3356
3336
  type: string;
3337
+ /** @deprecated */
3357
3338
  connectedData?: external$6["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
3358
3339
  };
3359
- /**
3360
- * @description Defines a connection to a data element on a data resource.
3361
- *
3362
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
3363
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
3364
- */
3340
+ /** @description Defines a connection to a dynamic token on a data resource. */
3365
3341
  DataElementConnectionDefinition: {
3366
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
3342
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
3367
3343
  pointer: string;
3368
3344
  /**
3369
- * @description The syntax used to select the data element to bind to
3345
+ * @description The syntax used to select the dynamic token to bind to
3370
3346
  * @enum {string}
3371
3347
  */
3372
3348
  syntax: "jptr";
@@ -3732,6 +3708,11 @@ interface paths$4 {
3732
3708
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
3733
3709
  */
3734
3710
  compositionId?: components$3["parameters"]["compositionId"];
3711
+ /**
3712
+ * Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
3713
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
3714
+ */
3715
+ componentId?: components$3["parameters"]["componentId"];
3735
3716
  /**
3736
3717
  * Specify a historical composition version ID to fetch (retrieved from the canvas-history API).
3737
3718
  * Must be used with the `compositionId` parameter.
@@ -4032,6 +4013,11 @@ interface components$3 {
4032
4013
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
4033
4014
  */
4034
4015
  compositionId: string;
4016
+ /**
4017
+ * @description Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
4018
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
4019
+ */
4020
+ componentId: string;
4035
4021
  /**
4036
4022
  * @description Specify multiple composition IDs to fetch. Response type will be a list.
4037
4023
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
@@ -4396,19 +4382,15 @@ interface external$5 {
4396
4382
  value: unknown;
4397
4383
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
4398
4384
  type: string;
4385
+ /** @deprecated */
4399
4386
  connectedData?: external$5["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
4400
4387
  };
4401
- /**
4402
- * @description Defines a connection to a data element on a data resource.
4403
- *
4404
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
4405
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
4406
- */
4388
+ /** @description Defines a connection to a dynamic token on a data resource. */
4407
4389
  DataElementConnectionDefinition: {
4408
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
4390
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
4409
4391
  pointer: string;
4410
4392
  /**
4411
- * @description The syntax used to select the data element to bind to
4393
+ * @description The syntax used to select the dynamic token to bind to
4412
4394
  * @enum {string}
4413
4395
  */
4414
4396
  syntax: "jptr";
@@ -5239,19 +5221,15 @@ interface external$3 {
5239
5221
  value: unknown;
5240
5222
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
5241
5223
  type: string;
5224
+ /** @deprecated */
5242
5225
  connectedData?: external$3["../../../lambda/functions/uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
5243
5226
  };
5244
- /**
5245
- * @description Defines a connection to a data element on a data resource.
5246
- *
5247
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
5248
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
5249
- */
5227
+ /** @description Defines a connection to a dynamic token on a data resource. */
5250
5228
  DataElementConnectionDefinition: {
5251
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
5229
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
5252
5230
  pointer: string;
5253
5231
  /**
5254
- * @description The syntax used to select the data element to bind to
5232
+ * @description The syntax used to select the dynamic token to bind to
5255
5233
  * @enum {string}
5256
5234
  */
5257
5235
  syntax: "jptr";
@@ -5585,6 +5563,11 @@ interface external$3 {
5585
5563
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
5586
5564
  */
5587
5565
  compositionId?: external$3["../../../lambda/functions/v1-canvas.swagger.yml"]["components"]["parameters"]["compositionId"];
5566
+ /**
5567
+ * Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
5568
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
5569
+ */
5570
+ componentId?: external$3["../../../lambda/functions/v1-canvas.swagger.yml"]["components"]["parameters"]["componentId"];
5588
5571
  /**
5589
5572
  * Specify a historical composition version ID to fetch (retrieved from the canvas-history API).
5590
5573
  * Must be used with the `compositionId` parameter.
@@ -5885,6 +5868,11 @@ interface external$3 {
5885
5868
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
5886
5869
  */
5887
5870
  compositionId: string;
5871
+ /**
5872
+ * @description Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
5873
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
5874
+ */
5875
+ componentId: string;
5888
5876
  /**
5889
5877
  * @description Specify multiple composition IDs to fetch. Response type will be a list.
5890
5878
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
@@ -6738,19 +6726,15 @@ interface external$2 {
6738
6726
  value: unknown;
6739
6727
  /** @description The type of the parameter. Determines how it is displayed when editing, and tells the consumer how to process it. */
6740
6728
  type: string;
6729
+ /** @deprecated */
6741
6730
  connectedData?: external$2["uniform-canvas-types.swagger.yml"]["components"]["schemas"]["DataElementConnectionDefinition"];
6742
6731
  };
6743
- /**
6744
- * @description Defines a connection to a data element on a data resource.
6745
- *
6746
- * NOTE: This is considered an internal data structure and is not guaranteed to be stable.
6747
- * Future updates that do not break the edgehanced/data-bound state of a composition may be made without notice.
6748
- */
6732
+ /** @description Defines a connection to a dynamic token on a data resource. */
6749
6733
  DataElementConnectionDefinition: {
6750
- /** @description A JSON Pointer expression that defines the data element to connect the parameter to. */
6734
+ /** @description A JSON Pointer expression that defines the data resource dynamic token value. */
6751
6735
  pointer: string;
6752
6736
  /**
6753
- * @description The syntax used to select the data element to bind to
6737
+ * @description The syntax used to select the dynamic token to bind to
6754
6738
  * @enum {string}
6755
6739
  */
6756
6740
  syntax: "jptr";
@@ -7084,6 +7068,11 @@ interface external$2 {
7084
7068
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
7085
7069
  */
7086
7070
  compositionId?: external$2["v1-canvas.swagger.yml"]["components"]["parameters"]["compositionId"];
7071
+ /**
7072
+ * Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
7073
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
7074
+ */
7075
+ componentId?: external$2["v1-canvas.swagger.yml"]["components"]["parameters"]["componentId"];
7087
7076
  /**
7088
7077
  * Specify a historical composition version ID to fetch (retrieved from the canvas-history API).
7089
7078
  * Must be used with the `compositionId` parameter.
@@ -7384,6 +7373,11 @@ interface external$2 {
7384
7373
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
7385
7374
  */
7386
7375
  compositionId: string;
7376
+ /**
7377
+ * @description Specify a single component ID to fetch the component's composition defaults. Response will be a single composition.
7378
+ * This is a primary query parameter, and cannot be used with any other primary query parameters.
7379
+ */
7380
+ componentId: string;
7387
7381
  /**
7388
7382
  * @description Specify multiple composition IDs to fetch. Response type will be a list.
7389
7383
  * This is a primary query parameter, and cannot be used with any other primary query parameters.
@@ -7768,7 +7762,7 @@ type ComponentParameterContextualEditing<TValue = unknown> = ComponentParameter<
7768
7762
  isEditable?: boolean;
7769
7763
  };
7770
7764
  };
7771
- /** Defines a connection to a data element on a data resource. */
7765
+ /** Defines a connection to a dynamic token on a data resource. */
7772
7766
  type DataElementConnectionDefinition = SharedComponents['DataElementConnectionDefinition'];
7773
7767
  /** Variable values for a data resource. */
7774
7768
  type DataResourceVariables = SharedComponents['DataResourceVariables'];
@@ -7820,6 +7814,7 @@ type CompositionGetByNodePathParameters = CompositionGetBy<'projectMapNodePath'>
7820
7814
  type CompositionGetByNodeIdParameters = CompositionGetBy<'projectMapNodeId'> & SpecificProjectMap;
7821
7815
  type CompositionGetBySlugParameters = CompositionGetBy<'slug'>;
7822
7816
  type CompositionGetByIdParameters = CompositionGetBy<'compositionId'>;
7817
+ type CompositionGetByComponentIdParameters = CompositionGetBy<'componentId'>;
7823
7818
  /** Switches for data resolution */
7824
7819
  type DataResolutionOption = {
7825
7820
  skipDataResolution?: boolean;
@@ -7845,7 +7840,7 @@ type CompositionPatternIssue = CompositionIssueCore & {
7845
7840
  type: 'pattern';
7846
7841
  code: NonNullable<ComponentInstance['_patternError']>;
7847
7842
  };
7848
- /** An error while binding a data element from a data resource to a component parameter (i.e. a missing property in the data resource) */
7843
+ /** An error while binding a dynamic token from a data resource to a component parameter (i.e. a missing property in the data resource) */
7849
7844
  type DataElementBindingIssue = CompositionIssueCore & {
7850
7845
  type: 'binding';
7851
7846
  parameterName: string;
@@ -7896,7 +7891,7 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
7896
7891
  private edgeApiHost;
7897
7892
  constructor(options: CanvasClientOptions);
7898
7893
  /** Fetches lists of Canvas compositions, optionally by type */
7899
- getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'compositionId' | 'slug'>): Promise<{
7894
+ getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'componentId' | 'compositionId' | 'slug'>): Promise<{
7900
7895
  compositions: {
7901
7896
  state: number;
7902
7897
  uiStatus?: "Draft" | "Modified" | "Published" | "Orphan" | "Previous" | undefined;
@@ -8042,6 +8037,10 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
8042
8037
  getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
8043
8038
  getCompositionById(options: CompositionGetByIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
8044
8039
  getCompositionById<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
8040
+ /** Fetches a component definition's composition defaults */
8041
+ getCompositionDefaults(options: CompositionGetByComponentIdParameters & DataResolutionOptionNegative): Promise<CompositionGetResponse>;
8042
+ getCompositionDefaults(options: CompositionGetByComponentIdParameters & DataResolutionOptionPositive & DataResolutionParameters): Promise<CompositionResolvedGetResponse>;
8043
+ getCompositionDefaults<T extends CompositionGetResponse = CompositionGetValidResponses>(options: CompositionGetByComponentIdParameters & DataResolutionOption & DataResolutionParameters): Promise<T>;
8045
8044
  /** Fetches historical versions of a composition or pattern */
8046
8045
  unstable_getCompositionHistory(options: ExceptProject<ComponentInstanceHistoryGetParameters>): Promise<{
8047
8046
  cursor?: string | undefined;
@@ -8575,7 +8574,7 @@ type ProjectMapLinkComponentParameterValue = ProjectMapLinkParamValue | undefine
8575
8574
  type LinkComponentParameterValue = LinkParamValue;
8576
8575
 
8577
8576
  type RichTextBuiltInFormat = 'code' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'superscript' | 'subscript';
8578
- type RichTextBuiltInElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'unorderedList' | 'orderedList' | 'link' | 'quote' | 'code';
8577
+ type RichTextBuiltInElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'unorderedList' | 'orderedList' | 'link' | 'quote' | 'code' | 'variable';
8579
8578
  type RichTextParamConfiguration = {
8580
8579
  required?: boolean;
8581
8580
  formatting?: {
@@ -9031,50 +9030,6 @@ declare class RouteClient extends ApiClient<RouteClientOptions> {
9031
9030
  getRoute(options?: Omit<RouteGetParameters, 'projectId'>): Promise<ResolvedRouteGetResponse>;
9032
9031
  }
9033
9032
 
9034
- type BindVariablesResult<TValue> = {
9035
- boundCount: number;
9036
- result: TValue;
9037
- errors?: string[];
9038
- };
9039
- type BindVariablesToObjectOptions<T> = {
9040
- /** The object to bind variables to. Only strings or objects are bound. */
9041
- value: T;
9042
- } & Omit<BindVariablesOptions, 'value'>;
9043
- /**
9044
- * Binds composition variables to an object whose string keys may have variable expressions in them.
9045
- * Binding is recursive.
9046
- */
9047
- declare function bindVariablesToObject<T>(options: BindVariablesToObjectOptions<T>): BindVariablesResult<T>;
9048
-
9049
- type BindVariablesOptions = {
9050
- /** Current variable values table */
9051
- variables: DataResourceVariables;
9052
- /** String value to bind variables to */
9053
- value: string;
9054
- /**
9055
- * Text prefix for any variable binding errors that might be returned
9056
- * @default "Variable"
9057
- */
9058
- errorPrefix?: string;
9059
- /**
9060
- * Optionally provide overridden binding behaviour with a function.
9061
- * Default behaviour:
9062
- * - If variable is not defined, its expression is replaced by empty string and an error is returned
9063
- * - If variable is defined, its expression is replaced by its value
9064
- * @param variableName The variable name referred to in the `value` string. This is the name inside the ${} expression.
9065
- * @param variables The current variables table.
9066
- * @param errors Errors array. Push to it to add errors to the result.
9067
- * @returns New value for the variable reference expression, will replace the whole ${} in the result.
9068
- */
9069
- handleBinding?: (variableName: string, variables: DataResourceVariables, errors: string[]) => string;
9070
- };
9071
- /**
9072
- * Binds variables to a string that could have variable values in it.
9073
- * Variables are referenced in the string as ${variableName}.
9074
- * Literal variable values are escaped with a backslash, e.g. \${literal}
9075
- */
9076
- declare function bindVariables({ variables, value, errorPrefix, handleBinding, }: BindVariablesOptions): BindVariablesResult<string>;
9077
-
9078
9033
  /** Public ID of Canvas personalization component type */
9079
9034
  declare const CANVAS_PERSONALIZE_TYPE = "$personalization";
9080
9035
  /** Public ID of Canvas A/B test component type */
@@ -9315,6 +9270,63 @@ declare function mapSlotToPersonalizedVariations(slot: ComponentInstance[] | und
9315
9270
  */
9316
9271
  declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined): Array<ComponentInstance & TestVariant>;
9317
9272
 
9273
+ type BindVariablesResult<TValue> = {
9274
+ /** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
9275
+ boundCount: number;
9276
+ /** Result object after the binding */
9277
+ result: TValue;
9278
+ /** Any errors that occurred resolving bound values */
9279
+ errors?: Array<string | Error>;
9280
+ };
9281
+ type BindVariablesToObjectOptions<T> = {
9282
+ /** The object to bind variables to. Only strings or objects are bound. */
9283
+ value: T;
9284
+ } & Omit<BindVariablesOptions, 'value'>;
9285
+ /**
9286
+ * Binds composition variables to an object whose string keys may have variable expressions in them.
9287
+ * Binding is recursive.
9288
+ */
9289
+ declare function bindVariablesToObject<T>(options: BindVariablesToObjectOptions<T>): BindVariablesResult<T>;
9290
+
9291
+ type BindVariablesOptions = {
9292
+ /** Current variable values table */
9293
+ variables: Record<string, unknown>;
9294
+ /** String value to bind variables to */
9295
+ value: string;
9296
+ /**
9297
+ * Text prefix for any variable binding errors that might be returned
9298
+ * @default "Variable"
9299
+ */
9300
+ errorPrefix?: string;
9301
+ /**
9302
+ * Optionally provide overridden binding behaviour with a function.
9303
+ * Default behaviour:
9304
+ * - If variable is not defined, its expression is replaced by empty string and an error is returned
9305
+ * - If variable is defined, its expression is replaced by its value
9306
+ * @param variableName The variable name referred to in the `value` string. This is the name inside the ${} expression.
9307
+ * @param variables The current variables table.
9308
+ * @param errors Errors array. Push to it to add errors to the result.
9309
+ * @returns New value for the variable reference expression, will replace the whole ${} in the result. If non-string value is returned, then:
9310
+ * - If the original string value contains ONLY the variable reference (i.e. "${foo}") then the value will be used literally, e.g. the property becomes an array, etc
9311
+ * - If the original value contains other text, then the value will be string-interpolated as a fallback (i.e. [object Object], 'array,elements', etc)
9312
+ */
9313
+ handleBinding?: (variableName: string, variables: Record<string, unknown>, errors: Array<string | Error>) => unknown;
9314
+ };
9315
+ /**
9316
+ * Binds variables to a string that could have variable values in it.
9317
+ * Variables are referenced in the string as ${variableName}.
9318
+ * Literal variable values are escaped with a backslash, e.g. \${literal}
9319
+ */
9320
+ declare function bindVariables({ variables, value, errorPrefix, handleBinding, }: BindVariablesOptions): BindVariablesResult<unknown>;
9321
+
9322
+ declare function createVariableReference(variableName: string): string;
9323
+
9324
+ /**
9325
+ * Parses an expression that may contain Uniform variables and invokes a callback for each text or variable token found
9326
+ * @returns the number of tokens found in the string (variable or text)
9327
+ */
9328
+ declare function parseVariableExpression(serialized: string, onToken?: (token: string, type: 'text' | 'variable') => void | false): number;
9329
+
9318
9330
  declare const CanvasClientError: typeof ApiClientError;
9319
9331
 
9320
- export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionUIStatus, ContextualEditingComponentReference, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS, EDGE_MAX_CACHE_TTL, EDGE_MAX_L2_CACHE_TTL_IN_HOURS, EDGE_MIN_CACHE_TTL, EDGE_MIN_L2_CACHE_TTL_IN_HOURS, EMPTY_COMPOSITION, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, InvalidationResult, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NonProjectMapLinkParamValue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, bindVariables, bindVariablesToObject, compose, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree };
9332
+ export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, CANVAS_DRAFT_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionUIStatus, ContextualEditingComponentReference, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_DEFAULT_L2_CACHE_TTL_IN_HOURS, EDGE_MAX_CACHE_TTL, EDGE_MAX_L2_CACHE_TTL_IN_HOURS, EDGE_MIN_CACHE_TTL, EDGE_MIN_L2_CACHE_TTL_IN_HOURS, EMPTY_COMPOSITION, EnhancerBuilder, EnhancerContext, EnhancerError, EventNames, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, InvalidationResult, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NonProjectMapLinkParamValue, OverrideOptions, PLACEHOLDER_ID, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, bindVariables, bindVariablesToObject, compose, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateHash, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, isAddComponentMessage, isDismissPlaceholderMessage, isMovingComponentMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree };