react-shopwave-connect 0.4.6 → 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
@@ -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
@@ -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