react-shopwave-connect 0.4.5 → 0.4.7

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.
@@ -183,6 +183,32 @@ interface FetchProductsParams {
183
183
  token?: string;
184
184
  }
185
185
  //#endregion
186
+ //#region src/core/store.d.ts
187
+ interface Store {
188
+ id: number;
189
+ lat: number;
190
+ lng: number;
191
+ addressLine1: string;
192
+ addressLine2: string | null;
193
+ addressLine3: string;
194
+ phoneNumber: string;
195
+ city: string;
196
+ postcode: string;
197
+ countryId: number | null;
198
+ timezoneId: number | null;
199
+ storeDeleteDate: string | null;
200
+ email: string | null;
201
+ sandbox: boolean | null;
202
+ }
203
+ interface FetchStoresParams {
204
+ /** Optional id filter. */
205
+ storeIds?: Array<number>;
206
+ /** Whether to include soft-deleted records. Defaults to `false`. */
207
+ deleted?: boolean;
208
+ /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
209
+ token?: string;
210
+ }
211
+ //#endregion
186
212
  //#region src/core/promotion.d.ts
187
213
  /** Promotion rule identifiers as stored by the Shopwave API. */
188
214
  declare enum PromotionRuleSet {
@@ -226,30 +252,62 @@ interface FetchPromotionsParams {
226
252
  token?: string;
227
253
  }
228
254
  //#endregion
229
- //#region src/core/store.d.ts
230
- interface Store {
255
+ //#region src/core/productComponent.d.ts
256
+ /**
257
+ * Product components are modifier groups: a group belongs to a parent product
258
+ * (`productId`) and offers other products as options. Each option product has
259
+ * one or more option rows (`productInstances`). See `SHOPWAVE_ENTITIES.productComponent`
260
+ * for what the live API does on reads, saves and deletes.
261
+ */
262
+ /** One option row of a product component. */
263
+ interface ProductComponentInstance {
231
264
  id: number;
232
- lat: number;
233
- lng: number;
234
- addressLine1: string;
235
- addressLine2: string | null;
236
- addressLine3: string;
237
- phoneNumber: string;
238
- city: string;
239
- postcode: string;
240
- countryId: number | null;
241
- timezoneId: number | null;
242
- storeDeleteDate: string | null;
243
- email: string | null;
244
- sandbox: boolean | null;
245
- }
246
- interface FetchStoresParams {
247
- /** Optional id filter. */
248
- storeIds?: Array<number>;
249
- /** Whether to include soft-deleted records. Defaults to `false`. */
265
+ /** Name override for the option; `null` or `""` means the product's own name. Stored as sent. */
266
+ name: string | null;
267
+ /** Price as a decimal string, pence excluding VAT (reads return `"100.0"` for `"100"`). */
268
+ price: string;
269
+ /** VAT as a fraction string (`"0.200"`). */
270
+ vatPercentage: string;
271
+ quantity: number;
272
+ /** Comma-separated price tags, or `null`. Stored as sent (not trimmed). */
273
+ tags: string | null;
274
+ size?: string | null;
275
+ activeDate?: string | null;
276
+ /** Set once the row has been deleted; deleted rows still appear in live reads. */
277
+ deleteDate?: string | null;
278
+ }
279
+ /** A product offered as an option in a product component, with its option rows. */
280
+ interface ProductComponentProduct {
281
+ id: number;
282
+ name: string;
283
+ barcode?: string | null;
284
+ details?: string | null;
285
+ unit?: number | null;
286
+ activeDate?: string | null;
287
+ /** Option rows, keyed by row id on reads. */
288
+ productInstances: Record<string, ProductComponentInstance>;
289
+ }
290
+ /** A product component (modifier group). */
291
+ interface ProductComponent {
292
+ id: number;
293
+ name: string;
294
+ /** The parent product the group belongs to. */
295
+ productId: number;
296
+ minQuantity: number;
297
+ maxQuantity: number;
298
+ productTimestamp?: string;
299
+ /** Set once the group has been deleted (only `deleted: true` reads return it then). */
300
+ deleteDate?: string | null;
301
+ /** Option products, keyed by product id. */
302
+ products: Record<string, ProductComponentProduct>;
303
+ }
304
+ interface FetchProductComponentsParams {
305
+ /** Parent products whose groups to read. */
306
+ productIds?: ReadonlyArray<number | string>;
307
+ /** Groups to read, by id. */
308
+ productComponentIds?: ReadonlyArray<number | string>;
309
+ /** `false` (default): live groups only. `true`: deleted groups only. */
250
310
  deleted?: boolean;
251
- /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
252
- token?: string;
253
311
  }
254
312
  //#endregion
255
313
  //#region src/core/report.d.ts
@@ -357,8 +415,8 @@ type UploadKind = "merchant" | "merchantFeature" | "product" | "user" | "applica
357
415
  /**
358
416
  * The role an image plays, sent to Shopwave as the uploader's `prefix` header.
359
417
  * The uploader names the file `<prefix>_<hash>.<ext>`, so the role travels with
360
- * the file wherever a record stores it (a product's `images`). Live, merchant
361
- * 5644, 4 Nov 2026: all four values answered 201.
418
+ * the file wherever a record stores it (a product's `images`). Live, test
419
+ * merchant, 4 Nov 2026: all four values answered 201.
362
420
  * - `product`: a product gallery image;
363
421
  * - `product_thumbnail`: the product's lead image, shown in lists;
364
422
  * - `variant` / `variant_thumbnail`: a variant's own image and its lead image
@@ -402,7 +460,7 @@ interface UploadedImage {
402
460
  //#endregion
403
461
  //#region src/core/merchantImages.d.ts
404
462
  /**
405
- * Merchant images, as adminV1 saves them and adminV2 reads them:
463
+ * Merchant images, as Shopwave's existing admin apps save and read them:
406
464
  *
407
465
  * ```
408
466
  * { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
@@ -419,7 +477,7 @@ interface UploadedImage {
419
477
  * So a featured image must be uploaded with kind `merchantFeature` (which
420
478
  * stores it under `feature/`); a `merchant` upload lands under `logo/`.
421
479
  *
422
- * Confirmed on the live API, merchant 5644, 30 Sep 2026.
480
+ * Confirmed on the live API, 30 Sep 2026.
423
481
  */
424
482
  interface MerchantImageIds {
425
483
  logo?: {
@@ -452,7 +510,7 @@ interface MerchantColourSet {
452
510
  [key: string]: string | null | undefined;
453
511
  }
454
512
  /**
455
- * Brand colours, as adminV1 saves them and adminV2 reads them
513
+ * Brand colours, as Shopwave's existing admin apps save and read them
456
514
  * (`colours.primary.main` is the logo background): `{ primary: { main,
457
515
  * highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
458
516
  */
@@ -461,7 +519,7 @@ interface MerchantColours {
461
519
  [key: string]: MerchantColourSet | null | undefined;
462
520
  }
463
521
  /**
464
- * Web and social links, as adminV1 saves them:
522
+ * Web and social links, as Shopwave's existing admin saves them:
465
523
  * `{ website: { home }, social: { twitter, facebook, instagram } }`.
466
524
  * `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
467
525
  * {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
@@ -585,6 +643,15 @@ declare function useProductTags(options?: LookupOptions): QueryState<string[]>;
585
643
  */
586
644
  declare function useProductInstanceTags(options?: LookupOptions): QueryState<string[]>;
587
645
  //#endregion
646
+ //#region src/hooks/useProductComponent.d.ts
647
+ /**
648
+ * Auto-fetches product components (modifier groups) on mount and whenever the params change:
649
+ * a product's groups with `{ productIds: [id] }`, one group with `{ productComponentIds: [id] }`,
650
+ * or every group with no filter. Option rows with a `deleteDate` are included; skip them when
651
+ * listing options.
652
+ */
653
+ declare function useProductComponent(params?: FetchProductComponentsParams, options?: RequestOptions): QueryState<ProductComponent[]>;
654
+ //#endregion
588
655
  //#region src/hooks/usePromotion.d.ts
589
656
  /**
590
657
  * Auto-fetches promotions on mount and whenever the params change.
@@ -738,5 +805,5 @@ interface UseBasketReportReturn {
738
805
  */
739
806
  declare function useBasketReport(options?: RequestOptions): UseBasketReportReturn;
740
807
  //#endregion
741
- export { type MutationState, type QueryState, type UseBasketReportReturn, useBasketReport, useCategory, useConsumer, useDelete, useEmployee, useLogout, useMerchant, useProduct, useProductInstanceTags, useProductTags, usePromotion, useReport, useSession, useStore, useSubmit, useUpdateMerchant, useUploadImage, useUploadMerchantImage, useUser };
808
+ export { type MutationState, type QueryState, type UseBasketReportReturn, useBasketReport, useCategory, useConsumer, useDelete, useEmployee, useLogout, useMerchant, useProduct, useProductComponent, useProductInstanceTags, useProductTags, usePromotion, useReport, useSession, useStore, useSubmit, useUpdateMerchant, useUploadImage, useUploadMerchantImage, useUser };
742
809
  //# sourceMappingURL=index.d.cts.map
@@ -183,6 +183,32 @@ interface FetchProductsParams {
183
183
  token?: string;
184
184
  }
185
185
  //#endregion
186
+ //#region src/core/store.d.ts
187
+ interface Store {
188
+ id: number;
189
+ lat: number;
190
+ lng: number;
191
+ addressLine1: string;
192
+ addressLine2: string | null;
193
+ addressLine3: string;
194
+ phoneNumber: string;
195
+ city: string;
196
+ postcode: string;
197
+ countryId: number | null;
198
+ timezoneId: number | null;
199
+ storeDeleteDate: string | null;
200
+ email: string | null;
201
+ sandbox: boolean | null;
202
+ }
203
+ interface FetchStoresParams {
204
+ /** Optional id filter. */
205
+ storeIds?: Array<number>;
206
+ /** Whether to include soft-deleted records. Defaults to `false`. */
207
+ deleted?: boolean;
208
+ /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
209
+ token?: string;
210
+ }
211
+ //#endregion
186
212
  //#region src/core/promotion.d.ts
187
213
  /** Promotion rule identifiers as stored by the Shopwave API. */
188
214
  declare enum PromotionRuleSet {
@@ -226,30 +252,62 @@ interface FetchPromotionsParams {
226
252
  token?: string;
227
253
  }
228
254
  //#endregion
229
- //#region src/core/store.d.ts
230
- interface Store {
255
+ //#region src/core/productComponent.d.ts
256
+ /**
257
+ * Product components are modifier groups: a group belongs to a parent product
258
+ * (`productId`) and offers other products as options. Each option product has
259
+ * one or more option rows (`productInstances`). See `SHOPWAVE_ENTITIES.productComponent`
260
+ * for what the live API does on reads, saves and deletes.
261
+ */
262
+ /** One option row of a product component. */
263
+ interface ProductComponentInstance {
231
264
  id: number;
232
- lat: number;
233
- lng: number;
234
- addressLine1: string;
235
- addressLine2: string | null;
236
- addressLine3: string;
237
- phoneNumber: string;
238
- city: string;
239
- postcode: string;
240
- countryId: number | null;
241
- timezoneId: number | null;
242
- storeDeleteDate: string | null;
243
- email: string | null;
244
- sandbox: boolean | null;
245
- }
246
- interface FetchStoresParams {
247
- /** Optional id filter. */
248
- storeIds?: Array<number>;
249
- /** Whether to include soft-deleted records. Defaults to `false`. */
265
+ /** Name override for the option; `null` or `""` means the product's own name. Stored as sent. */
266
+ name: string | null;
267
+ /** Price as a decimal string, pence excluding VAT (reads return `"100.0"` for `"100"`). */
268
+ price: string;
269
+ /** VAT as a fraction string (`"0.200"`). */
270
+ vatPercentage: string;
271
+ quantity: number;
272
+ /** Comma-separated price tags, or `null`. Stored as sent (not trimmed). */
273
+ tags: string | null;
274
+ size?: string | null;
275
+ activeDate?: string | null;
276
+ /** Set once the row has been deleted; deleted rows still appear in live reads. */
277
+ deleteDate?: string | null;
278
+ }
279
+ /** A product offered as an option in a product component, with its option rows. */
280
+ interface ProductComponentProduct {
281
+ id: number;
282
+ name: string;
283
+ barcode?: string | null;
284
+ details?: string | null;
285
+ unit?: number | null;
286
+ activeDate?: string | null;
287
+ /** Option rows, keyed by row id on reads. */
288
+ productInstances: Record<string, ProductComponentInstance>;
289
+ }
290
+ /** A product component (modifier group). */
291
+ interface ProductComponent {
292
+ id: number;
293
+ name: string;
294
+ /** The parent product the group belongs to. */
295
+ productId: number;
296
+ minQuantity: number;
297
+ maxQuantity: number;
298
+ productTimestamp?: string;
299
+ /** Set once the group has been deleted (only `deleted: true` reads return it then). */
300
+ deleteDate?: string | null;
301
+ /** Option products, keyed by product id. */
302
+ products: Record<string, ProductComponentProduct>;
303
+ }
304
+ interface FetchProductComponentsParams {
305
+ /** Parent products whose groups to read. */
306
+ productIds?: ReadonlyArray<number | string>;
307
+ /** Groups to read, by id. */
308
+ productComponentIds?: ReadonlyArray<number | string>;
309
+ /** `false` (default): live groups only. `true`: deleted groups only. */
250
310
  deleted?: boolean;
251
- /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
252
- token?: string;
253
311
  }
254
312
  //#endregion
255
313
  //#region src/core/report.d.ts
@@ -357,8 +415,8 @@ type UploadKind = "merchant" | "merchantFeature" | "product" | "user" | "applica
357
415
  /**
358
416
  * The role an image plays, sent to Shopwave as the uploader's `prefix` header.
359
417
  * The uploader names the file `<prefix>_<hash>.<ext>`, so the role travels with
360
- * the file wherever a record stores it (a product's `images`). Live, merchant
361
- * 5644, 4 Nov 2026: all four values answered 201.
418
+ * the file wherever a record stores it (a product's `images`). Live, test
419
+ * merchant, 4 Nov 2026: all four values answered 201.
362
420
  * - `product`: a product gallery image;
363
421
  * - `product_thumbnail`: the product's lead image, shown in lists;
364
422
  * - `variant` / `variant_thumbnail`: a variant's own image and its lead image
@@ -402,7 +460,7 @@ interface UploadedImage {
402
460
  //#endregion
403
461
  //#region src/core/merchantImages.d.ts
404
462
  /**
405
- * Merchant images, as adminV1 saves them and adminV2 reads them:
463
+ * Merchant images, as Shopwave's existing admin apps save and read them:
406
464
  *
407
465
  * ```
408
466
  * { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
@@ -419,7 +477,7 @@ interface UploadedImage {
419
477
  * So a featured image must be uploaded with kind `merchantFeature` (which
420
478
  * stores it under `feature/`); a `merchant` upload lands under `logo/`.
421
479
  *
422
- * Confirmed on the live API, merchant 5644, 30 Sep 2026.
480
+ * Confirmed on the live API, 30 Sep 2026.
423
481
  */
424
482
  interface MerchantImageIds {
425
483
  logo?: {
@@ -452,7 +510,7 @@ interface MerchantColourSet {
452
510
  [key: string]: string | null | undefined;
453
511
  }
454
512
  /**
455
- * Brand colours, as adminV1 saves them and adminV2 reads them
513
+ * Brand colours, as Shopwave's existing admin apps save and read them
456
514
  * (`colours.primary.main` is the logo background): `{ primary: { main,
457
515
  * highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
458
516
  */
@@ -461,7 +519,7 @@ interface MerchantColours {
461
519
  [key: string]: MerchantColourSet | null | undefined;
462
520
  }
463
521
  /**
464
- * Web and social links, as adminV1 saves them:
522
+ * Web and social links, as Shopwave's existing admin saves them:
465
523
  * `{ website: { home }, social: { twitter, facebook, instagram } }`.
466
524
  * `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
467
525
  * {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
@@ -585,6 +643,15 @@ declare function useProductTags(options?: LookupOptions): QueryState<string[]>;
585
643
  */
586
644
  declare function useProductInstanceTags(options?: LookupOptions): QueryState<string[]>;
587
645
  //#endregion
646
+ //#region src/hooks/useProductComponent.d.ts
647
+ /**
648
+ * Auto-fetches product components (modifier groups) on mount and whenever the params change:
649
+ * a product's groups with `{ productIds: [id] }`, one group with `{ productComponentIds: [id] }`,
650
+ * or every group with no filter. Option rows with a `deleteDate` are included; skip them when
651
+ * listing options.
652
+ */
653
+ declare function useProductComponent(params?: FetchProductComponentsParams, options?: RequestOptions): QueryState<ProductComponent[]>;
654
+ //#endregion
588
655
  //#region src/hooks/usePromotion.d.ts
589
656
  /**
590
657
  * Auto-fetches promotions on mount and whenever the params change.
@@ -738,5 +805,5 @@ interface UseBasketReportReturn {
738
805
  */
739
806
  declare function useBasketReport(options?: RequestOptions): UseBasketReportReturn;
740
807
  //#endregion
741
- export { type MutationState, type QueryState, type UseBasketReportReturn, useBasketReport, useCategory, useConsumer, useDelete, useEmployee, useLogout, useMerchant, useProduct, useProductInstanceTags, useProductTags, usePromotion, useReport, useSession, useStore, useSubmit, useUpdateMerchant, useUploadImage, useUploadMerchantImage, useUser };
808
+ export { type MutationState, type QueryState, type UseBasketReportReturn, useBasketReport, useCategory, useConsumer, useDelete, useEmployee, useLogout, useMerchant, useProduct, useProductComponent, useProductInstanceTags, useProductTags, usePromotion, useReport, useSession, useStore, useSubmit, useUpdateMerchant, useUploadImage, useUploadMerchantImage, useUser };
742
809
  //# sourceMappingURL=index.d.ts.map