@spiffcommerce/theme-bridge 1.25.4-alpha.3 → 1.27.0

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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConversionDataType, OptionResource, SpiffCommerceClient, DesignCreationMessage, BundleDesignCreationMessage } from '@repo/core';
1
+ import { ConversionDataType, OptionResource, ActivationData, CollectionProduct, SpiffCommerceClient, DesignCreationMessage, BundleDesignCreationMessage } from '@repo/core';
2
2
  export { ConversionDataType } from '@repo/core';
3
3
  import { ThemeInstallConfigurationGraphQl } from '@repo/types';
4
4
  export { ThemeInstallConfigurationGraphQl } from '@repo/types';
@@ -88,18 +88,24 @@ interface ConfigurableField extends FieldBase {
88
88
  * Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.
89
89
  */
90
90
  description?: string;
91
+ }
92
+ interface RequiredOption {
91
93
  /**
92
94
  * Optional: Set to `true` to require a value to be provided in the configuration form.
93
95
  */
94
96
  required?: boolean;
97
+ /** Cannot combine required and defaultValue options. */
98
+ readonly defaultValue?: undefined;
95
99
  }
96
- interface DefaultValueOption {
100
+ type RequiredOrDefault = RequiredOption | {
97
101
  /**
98
102
  * Optional: A default value to supply. Values are always supplied as strings.
99
103
  * When the `type` is `"Select"`, this should be one of the `key` fields in the `options` array.
100
104
  */
101
105
  defaultValue?: string;
102
- }
106
+ /** Cannot combine required and defaultValue options. */
107
+ readonly required?: undefined;
108
+ };
103
109
  interface LimitOption {
104
110
  /**
105
111
  * Optional: A limit to impose on the input.
@@ -112,9 +118,10 @@ interface LimitOption {
112
118
  /**
113
119
  * Generic fields which have no extra configuration and can accept default values from the Theme developer.
114
120
  */
115
- interface GenericField extends ConfigurableField, DefaultValueOption {
121
+ interface GenericFieldBase extends ConfigurableField {
116
122
  type: FieldType.Boolean | FieldType.Color | FieldType.Number | FieldType.DateRange;
117
123
  }
124
+ type GenericField = GenericFieldBase & RequiredOrDefault;
118
125
  declare enum AssetType {
119
126
  Color = "Color",
120
127
  ColorProfile = "ColorProfile",
@@ -128,7 +135,7 @@ declare enum AssetType {
128
135
  Model = "Model",
129
136
  Video = "Video"
130
137
  }
131
- interface AssetField extends ConfigurableField {
138
+ interface AssetField extends ConfigurableField, RequiredOption {
132
139
  /**
133
140
  * The type of asset, e.g. Image, Model, Font, etc.
134
141
  */
@@ -138,7 +145,7 @@ interface AssetField extends ConfigurableField {
138
145
  interface ConversionConfigurationField extends ConfigurableField {
139
146
  type: FieldType.ConversionConfiguration;
140
147
  }
141
- interface SelectField extends ConfigurableField, DefaultValueOption {
148
+ interface SelectFieldBase extends ConfigurableField {
142
149
  /**
143
150
  * The options available for the Partner to select in the configuration form.
144
151
  */
@@ -154,13 +161,15 @@ interface SelectField extends ConfigurableField, DefaultValueOption {
154
161
  }[];
155
162
  type: FieldType.Select;
156
163
  }
157
- interface TextField extends ConfigurableField, LimitOption, DefaultValueOption {
164
+ type SelectField = SelectFieldBase & RequiredOrDefault;
165
+ interface TextFieldBase extends ConfigurableField, LimitOption {
158
166
  /**
159
167
  * Allows the Partner to configure the field in a multi-line text editor.
160
168
  */
161
169
  multiLine?: boolean;
162
170
  type: FieldType.Text;
163
171
  }
172
+ type TextField = TextFieldBase & RequiredOrDefault;
164
173
  /**
165
174
  * Displays a heading in the Configuration Editor page in Hub.
166
175
  */
@@ -170,7 +179,7 @@ interface HeadingField extends FieldBase {
170
179
  /**
171
180
  * A list of one specific field type.
172
181
  */
173
- interface ListField extends ConfigurableField, LimitOption {
182
+ interface ListField extends ConfigurableField, RequiredOption, LimitOption {
174
183
  type: FieldType.List;
175
184
  /**
176
185
  * Defines the configuration schema for the entries in this list.
@@ -180,16 +189,16 @@ interface ListField extends ConfigurableField, LimitOption {
180
189
  /**
181
190
  * A collection of any number of different fields.
182
191
  */
183
- interface ObjectField extends ConfigurableField {
192
+ interface ObjectField extends ConfigurableField, RequiredOption {
184
193
  type: FieldType.Object;
185
194
  /**
186
195
  * Defines the configuration schema for the fields in this object.
187
196
  */
188
197
  fields: ThemeConfigurationSchemaField[];
189
198
  /**
190
- * The schema to use from the `customSchemas` field. Leave this null when not using a pre-defined schema.
199
+ * The schema to use from the `customSchemas` field. Leave this undefined when not using a pre-defined schema.
191
200
  */
192
- schema?: null;
201
+ schema?: undefined;
193
202
  }
194
203
  interface CustomObjectField extends Omit<ObjectField, "fields" | "schema"> {
195
204
  schema: string;
@@ -385,17 +394,18 @@ interface ConversionConfiguration {
385
394
  }
386
395
  interface ThemeInstallConfigurationFieldResource {
387
396
  key?: string;
397
+ /** @deprecated No longer supported. */
388
398
  fallbackToDefaultConfiguration?: boolean;
389
399
  value?: string | null;
390
400
  type: FieldType;
391
401
  /** When the type is `Asset`, this will be the configured Asset resource. */
392
402
  asset?: AssetResource | null;
393
403
  /** When the type is `ConversionConfiguration`, this will be the configured ConversionConfiguration resource. */
394
- conversionConfiguration?: ConversionConfiguration;
404
+ conversionConfiguration?: ConversionConfiguration | null;
395
405
  /** When the type is `MetafieldConfiguration`, this will be the configured MetafieldConfiguration resource. */
396
- metafieldConfiguration?: MetafieldConfigurationResource;
406
+ metafieldConfiguration?: MetafieldConfigurationResource | null;
397
407
  /** When the type is `ProductCollection`, this will be the configured ProductCollection resource. */
398
- productCollection?: ProductCollectionResource;
408
+ productCollection?: ProductCollectionResource | null;
399
409
  /** When the type is `List`, this will be the configured values */
400
410
  listValues?: ThemeInstallConfigurationFieldResource[];
401
411
  /** When the type is `Object`, this will be the configured field values */
@@ -466,10 +476,21 @@ interface ThemeContextBase {
466
476
  queryParams?: {
467
477
  [key: string]: string;
468
478
  };
479
+ /**
480
+ * The Activation that is currently active.
481
+ */
482
+ activation?: ActivationData;
469
483
  }
470
484
  interface ThemeContextBundleOptionsNew {
471
485
  integrationProductId?: string;
472
486
  productCollectionId?: string;
487
+ singleProductMode?: boolean;
488
+ /**
489
+ * The active CollectionProduct. Use this to determine Workflows instead of fetching them from the IntegrationProduct.
490
+ *
491
+ * Only present when `singleProductMode === true`.
492
+ */
493
+ collectionProduct?: CollectionProduct;
473
494
  type: "new";
474
495
  }
475
496
  interface ThemeContextBundleOptionsExisting {
@@ -499,6 +520,11 @@ interface ThemeContextWorkflowOptionsExternalProduct extends ThemeContextWorkflo
499
520
  type: "external";
500
521
  }
501
522
  type ThemeContextWorkflowOptions = ThemeContextWorkflowOptionsTransaction | ThemeContextWorkflowOptionsIntegrationProduct | ThemeContextWorkflowOptionsExternalProduct;
523
+ /**
524
+ * @deprecated Transaction contexts are to be replaced entirely by Bundle contexts.
525
+ * If you are creating a testing context, single product flows should be achieved by creating a Bundle context with an Activation, and providing:
526
+ * `singleProductMode = true` and the appropriate `collectionProduct`.
527
+ */
502
528
  interface ThemeContextTransaction extends ThemeContextBase {
503
529
  workflowOptions: ThemeContextWorkflowOptions;
504
530
  type: "transaction";
package/dist/index.js CHANGED
@@ -57,7 +57,6 @@ function dT(M) {
57
57
  case oi.Select:
58
58
  return M.value;
59
59
  case oi.Heading:
60
- default:
61
60
  return;
62
61
  }
63
62
  }