@aifeatures/backend 0.3.0 → 0.3.1

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.cts CHANGED
@@ -462,6 +462,10 @@ type Option = {
462
462
  * Images shown when this value is selected; empty = fall back to the product gallery.
463
463
  */
464
464
  images: Array<string>;
465
+ /**
466
+ * Colour chip for this value — a hex colour or an image URL — shown instead of the text label on the storefront. null when unset; set it with setProductVariants.
467
+ */
468
+ swatch: string | null;
465
469
  }>;
466
470
  };
467
471
  type VariantOptionValue = {
@@ -538,6 +542,9 @@ type InventoryInput = {
538
542
  };
539
543
  type NestedVariantInput = {
540
544
  title?: string | null;
545
+ /**
546
+ * Merchant SKU for this variant. Omitted or null = the server generates a stable opaque one (every variant always carries a SKU — it is the identifier fulfillment systems key on).
547
+ */
541
548
  sku?: string | null;
542
549
  unit_amount?: number;
543
550
  compare_at_amount?: number | null;
@@ -679,6 +686,9 @@ type CreateMultiItemTestOrder = {
679
686
  };
680
687
  type CreateVariant = {
681
688
  title?: string | null;
689
+ /**
690
+ * Merchant SKU for this variant. Omitted or null = the server generates a stable opaque one (every variant always carries a SKU — it is the identifier fulfillment systems key on).
691
+ */
682
692
  sku?: string | null;
683
693
  unit_amount?: number;
684
694
  compare_at_amount?: number | null;
@@ -721,6 +731,10 @@ type ReconcileOptionValueInput = {
721
731
  * Images shown when this value is selected (e.g. model shots of the Black colorway), in display order. REPLACES the value's whole gallery when present — to add an image, resend the existing URLs plus the new one. Omitted = keep the value's current images unchanged; [] = remove them all. Values without images fall back to the product-level gallery.
722
732
  */
723
733
  images?: Array<string>;
734
+ /**
735
+ * The colour chip shown for this value instead of its text label: a hex colour ("#6B7A4F") or an image URL for a pattern/finish. NOTE the clear token differs from `images` above because this is a single value, not a list: omitted = keep the current swatch unchanged; null = remove it. Values without a swatch keep rendering as their text label, which is how a merchant sees which colours still need one. Never send product photography here — that is what `images` is for.
736
+ */
737
+ swatch?: string | null;
724
738
  };
725
739
  type ReconcileOptionInput = {
726
740
  /**
@@ -771,7 +785,10 @@ type SetProductVariants = {
771
785
  };
772
786
  type UpdateVariant = {
773
787
  title?: string | null;
774
- sku?: string | null;
788
+ /**
789
+ * New SKU for this variant. Cannot be cleared to null — every variant carries one. Omit the field to keep the current value.
790
+ */
791
+ sku?: string;
775
792
  unit_amount?: number | null;
776
793
  compare_at_amount?: number | null;
777
794
  allow_custom_amount?: boolean;
@@ -1512,6 +1529,10 @@ type PublicOption = {
1512
1529
  * Images to show when this value is selected; empty = fall back to product.images.
1513
1530
  */
1514
1531
  images: Array<string>;
1532
+ /**
1533
+ * Colour chip for this value — a hex colour or an image URL — rendered instead of the text label. null when the merchant hasn't set one, in which case the value renders as its text.
1534
+ */
1535
+ swatch: string | null;
1515
1536
  }>;
1516
1537
  };
1517
1538
  type PublicVariant = {
@@ -3148,6 +3169,10 @@ type CreateFormWithSiteTokenData = {
3148
3169
  url: "/api/v1/forms";
3149
3170
  };
3150
3171
  type CreateFormWithSiteTokenErrors = {
3172
+ /**
3173
+ * Form name indicates credential/payment collection, which is not supported
3174
+ */
3175
+ 400: Error;
3151
3176
  /**
3152
3177
  * Unauthorized - requires site token
3153
3178
  */
@@ -3441,6 +3466,10 @@ type CreateFormData = {
3441
3466
  url: "/api/v1/sites/{siteId}/forms";
3442
3467
  };
3443
3468
  type CreateFormErrors = {
3469
+ /**
3470
+ * Form name indicates credential/payment collection, which is not supported
3471
+ */
3472
+ 400: Error;
3444
3473
  /**
3445
3474
  * Unauthorized
3446
3475
  */
@@ -3519,6 +3548,10 @@ type UpdateFormData = {
3519
3548
  url: "/api/v1/forms/{formId}";
3520
3549
  };
3521
3550
  type UpdateFormErrors = {
3551
+ /**
3552
+ * Form name indicates credential/payment collection, which is not supported
3553
+ */
3554
+ 400: Error;
3522
3555
  /**
3523
3556
  * Unauthorized
3524
3557
  */
@@ -3961,7 +3994,7 @@ declare const createVariant: <ThrowOnError extends boolean = false>(options: Opt
3961
3994
  /**
3962
3995
  * Reconcile the product's option/variant matrix
3963
3996
  *
3964
- * Declarative full-desired-state reconcile of a product's options and variants in ONE atomic operation — the only supported way to grow or drop an option axis on a product that already has variants. `options` and `variants` are the complete post-state: variants with an id survive (coordinates, price, title may change; inventory, order references, and open checkout sessions stay attached), entries without an id are created, and every currently-active variant must appear (kept, changed, or active: false) or the request is rejected naming the missing ids. An existing option omitted from `options` is REMOVED, taking its values and every variant's coordinate on that axis with it; the removal is refused only when it would collapse two ACTIVE variants onto the same combination (deactivate one first). Variants are never hard-deleted — active: false is the removal. Requires `matrix_version` from getProduct; a stale version is a 409 carrying the current matrix. Coordinate changes on surviving axes additionally require `allow_coordinate_changes: true`. Option values carry per-value `images` (the gallery shown when that value is selected, e.g. the Black colorway's model shots): omitted = keep current, [] = clear — storefronts fall back to product.images for values without any.
3997
+ * Declarative full-desired-state reconcile of a product's options and variants in ONE atomic operation — the only supported way to grow or drop an option axis on a product that already has variants. `options` and `variants` are the complete post-state: variants with an id survive (coordinates, price, title may change; inventory, order references, and open checkout sessions stay attached), entries without an id are created, and every currently-active variant must appear (kept, changed, or active: false) or the request is rejected naming the missing ids. An existing option omitted from `options` is REMOVED, taking its values and every variant's coordinate on that axis with it; the removal is refused only when it would collapse two ACTIVE variants onto the same combination (deactivate one first). Variants are never hard-deleted — active: false is the removal. Requires `matrix_version` from getProduct; a stale version is a 409 carrying the current matrix. Coordinate changes on surviving axes additionally require `allow_coordinate_changes: true`. Option values carry per-value `images` (the gallery shown when that value is selected, e.g. the Black colorway's model shots): omitted = keep current, [] = clear — storefronts fall back to product.images for values without any. Values also carry an optional `swatch` (a hex colour like `#4A5D23`, or an image URL for a pattern/texture) which renders the value as a colour chip instead of its text: omitted = keep current, null = clear. Note the divergence from `images` — swatch is a single nullable value, so `null` is its clear token, not `[]`.
3965
3998
  */
3966
3999
  declare const setProductVariants: <ThrowOnError extends boolean = false>(options: Options<SetProductVariantsData, ThrowOnError>) => RequestResult<SetProductVariantsResponses, SetProductVariantsErrors, ThrowOnError, "fields">;
3967
4000
  /**
package/dist/index.d.ts CHANGED
@@ -462,6 +462,10 @@ type Option = {
462
462
  * Images shown when this value is selected; empty = fall back to the product gallery.
463
463
  */
464
464
  images: Array<string>;
465
+ /**
466
+ * Colour chip for this value — a hex colour or an image URL — shown instead of the text label on the storefront. null when unset; set it with setProductVariants.
467
+ */
468
+ swatch: string | null;
465
469
  }>;
466
470
  };
467
471
  type VariantOptionValue = {
@@ -538,6 +542,9 @@ type InventoryInput = {
538
542
  };
539
543
  type NestedVariantInput = {
540
544
  title?: string | null;
545
+ /**
546
+ * Merchant SKU for this variant. Omitted or null = the server generates a stable opaque one (every variant always carries a SKU — it is the identifier fulfillment systems key on).
547
+ */
541
548
  sku?: string | null;
542
549
  unit_amount?: number;
543
550
  compare_at_amount?: number | null;
@@ -679,6 +686,9 @@ type CreateMultiItemTestOrder = {
679
686
  };
680
687
  type CreateVariant = {
681
688
  title?: string | null;
689
+ /**
690
+ * Merchant SKU for this variant. Omitted or null = the server generates a stable opaque one (every variant always carries a SKU — it is the identifier fulfillment systems key on).
691
+ */
682
692
  sku?: string | null;
683
693
  unit_amount?: number;
684
694
  compare_at_amount?: number | null;
@@ -721,6 +731,10 @@ type ReconcileOptionValueInput = {
721
731
  * Images shown when this value is selected (e.g. model shots of the Black colorway), in display order. REPLACES the value's whole gallery when present — to add an image, resend the existing URLs plus the new one. Omitted = keep the value's current images unchanged; [] = remove them all. Values without images fall back to the product-level gallery.
722
732
  */
723
733
  images?: Array<string>;
734
+ /**
735
+ * The colour chip shown for this value instead of its text label: a hex colour ("#6B7A4F") or an image URL for a pattern/finish. NOTE the clear token differs from `images` above because this is a single value, not a list: omitted = keep the current swatch unchanged; null = remove it. Values without a swatch keep rendering as their text label, which is how a merchant sees which colours still need one. Never send product photography here — that is what `images` is for.
736
+ */
737
+ swatch?: string | null;
724
738
  };
725
739
  type ReconcileOptionInput = {
726
740
  /**
@@ -771,7 +785,10 @@ type SetProductVariants = {
771
785
  };
772
786
  type UpdateVariant = {
773
787
  title?: string | null;
774
- sku?: string | null;
788
+ /**
789
+ * New SKU for this variant. Cannot be cleared to null — every variant carries one. Omit the field to keep the current value.
790
+ */
791
+ sku?: string;
775
792
  unit_amount?: number | null;
776
793
  compare_at_amount?: number | null;
777
794
  allow_custom_amount?: boolean;
@@ -1512,6 +1529,10 @@ type PublicOption = {
1512
1529
  * Images to show when this value is selected; empty = fall back to product.images.
1513
1530
  */
1514
1531
  images: Array<string>;
1532
+ /**
1533
+ * Colour chip for this value — a hex colour or an image URL — rendered instead of the text label. null when the merchant hasn't set one, in which case the value renders as its text.
1534
+ */
1535
+ swatch: string | null;
1515
1536
  }>;
1516
1537
  };
1517
1538
  type PublicVariant = {
@@ -3148,6 +3169,10 @@ type CreateFormWithSiteTokenData = {
3148
3169
  url: "/api/v1/forms";
3149
3170
  };
3150
3171
  type CreateFormWithSiteTokenErrors = {
3172
+ /**
3173
+ * Form name indicates credential/payment collection, which is not supported
3174
+ */
3175
+ 400: Error;
3151
3176
  /**
3152
3177
  * Unauthorized - requires site token
3153
3178
  */
@@ -3441,6 +3466,10 @@ type CreateFormData = {
3441
3466
  url: "/api/v1/sites/{siteId}/forms";
3442
3467
  };
3443
3468
  type CreateFormErrors = {
3469
+ /**
3470
+ * Form name indicates credential/payment collection, which is not supported
3471
+ */
3472
+ 400: Error;
3444
3473
  /**
3445
3474
  * Unauthorized
3446
3475
  */
@@ -3519,6 +3548,10 @@ type UpdateFormData = {
3519
3548
  url: "/api/v1/forms/{formId}";
3520
3549
  };
3521
3550
  type UpdateFormErrors = {
3551
+ /**
3552
+ * Form name indicates credential/payment collection, which is not supported
3553
+ */
3554
+ 400: Error;
3522
3555
  /**
3523
3556
  * Unauthorized
3524
3557
  */
@@ -3961,7 +3994,7 @@ declare const createVariant: <ThrowOnError extends boolean = false>(options: Opt
3961
3994
  /**
3962
3995
  * Reconcile the product's option/variant matrix
3963
3996
  *
3964
- * Declarative full-desired-state reconcile of a product's options and variants in ONE atomic operation — the only supported way to grow or drop an option axis on a product that already has variants. `options` and `variants` are the complete post-state: variants with an id survive (coordinates, price, title may change; inventory, order references, and open checkout sessions stay attached), entries without an id are created, and every currently-active variant must appear (kept, changed, or active: false) or the request is rejected naming the missing ids. An existing option omitted from `options` is REMOVED, taking its values and every variant's coordinate on that axis with it; the removal is refused only when it would collapse two ACTIVE variants onto the same combination (deactivate one first). Variants are never hard-deleted — active: false is the removal. Requires `matrix_version` from getProduct; a stale version is a 409 carrying the current matrix. Coordinate changes on surviving axes additionally require `allow_coordinate_changes: true`. Option values carry per-value `images` (the gallery shown when that value is selected, e.g. the Black colorway's model shots): omitted = keep current, [] = clear — storefronts fall back to product.images for values without any.
3997
+ * Declarative full-desired-state reconcile of a product's options and variants in ONE atomic operation — the only supported way to grow or drop an option axis on a product that already has variants. `options` and `variants` are the complete post-state: variants with an id survive (coordinates, price, title may change; inventory, order references, and open checkout sessions stay attached), entries without an id are created, and every currently-active variant must appear (kept, changed, or active: false) or the request is rejected naming the missing ids. An existing option omitted from `options` is REMOVED, taking its values and every variant's coordinate on that axis with it; the removal is refused only when it would collapse two ACTIVE variants onto the same combination (deactivate one first). Variants are never hard-deleted — active: false is the removal. Requires `matrix_version` from getProduct; a stale version is a 409 carrying the current matrix. Coordinate changes on surviving axes additionally require `allow_coordinate_changes: true`. Option values carry per-value `images` (the gallery shown when that value is selected, e.g. the Black colorway's model shots): omitted = keep current, [] = clear — storefronts fall back to product.images for values without any. Values also carry an optional `swatch` (a hex colour like `#4A5D23`, or an image URL for a pattern/texture) which renders the value as a colour chip instead of its text: omitted = keep current, null = clear. Note the divergence from `images` — swatch is a single nullable value, so `null` is its clear token, not `[]`.
3965
3998
  */
3966
3999
  declare const setProductVariants: <ThrowOnError extends boolean = false>(options: Options<SetProductVariantsData, ThrowOnError>) => RequestResult<SetProductVariantsResponses, SetProductVariantsErrors, ThrowOnError, "fields">;
3967
4000
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifeatures/backend",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript API client for aifeatures backend",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",