@haus-storefront-react/shared-types 0.0.6-0 → 0.0.7-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.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/index.d.ts +176 -129
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.0.6 (2025-07-01)
2
+
3
+ This was a version bump only for shared/types to align it with other projects, there were no code changes.
4
+
5
+ ## 0.0.6-0 (2025-07-01)
6
+
7
+ This was a version bump only for shared/types to align it with other projects, there were no code changes.
8
+
1
9
  ## 0.0.5 (2025-07-01)
2
10
 
3
11
  This was a version bump only for shared/types to align it with other projects, there were no code changes.
package/index.d.ts CHANGED
@@ -3,8 +3,11 @@ import { default as React, HTMLAttributes, ReactNode, JSX, CSSProperties } from
3
3
  export type ErrorResult = {
4
4
  errorCode: ErrorCode;
5
5
  message: string;
6
+ code?: string;
6
7
  };
7
- export type GenericEcomError = Maybe<AxiosError | ErrorResult | Error | undefined>;
8
+ export type GenericEcomError = Maybe<AxiosError | ErrorResult | Error | (Error & {
9
+ code: string;
10
+ }) | undefined>;
8
11
  export type Maybe<T> = T | null;
9
12
  export type Exact<T extends {
10
13
  [key: string]: unknown;
@@ -30,6 +33,46 @@ export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<
30
33
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
31
34
  }[Keys];
32
35
  export type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
36
+ export type ObtainKeys<Obj, Type> = {
37
+ [Prop in keyof Obj]: Obj[Prop] extends Type ? Prop : never;
38
+ }[keyof Obj];
39
+ export interface PluginFeatureMappings {
40
+ }
41
+ type PluginFeatureNames = ObtainKeys<PluginFeatureMappings, unknown>;
42
+ export type PluginFeatures = Partial<{
43
+ [K in PluginFeatureNames]: PluginFeatureMappings[K];
44
+ }>;
45
+ type PluginName = 'packageSize' | 'productPopularity' | 'badges' | 'campaign' | string;
46
+ type ProviderData = {
47
+ wraps?: string;
48
+ provider: React.ComponentType<{
49
+ children: ReactNode;
50
+ }>;
51
+ };
52
+ export type ProviderDataMap = Array<ProviderData>;
53
+ export interface IVendurePluginConfig<Features extends PluginFeatures, R, S, T> {
54
+ readonly name: PluginName;
55
+ enabled?: boolean;
56
+ enableFeatures?: Partial<Record<keyof Features, boolean>> | Partial<Features>;
57
+ queryUpdates: BuilderQueryUpdates;
58
+ requests?: R;
59
+ providers?: ProviderDataMap;
60
+ settings?: S;
61
+ setSdk: (sdk: T) => void;
62
+ setProviders: (providers: ProviderDataMap) => void;
63
+ setEnabled: (enabled: boolean) => void;
64
+ setEnableFeatures: (enableFeatures: Partial<Record<keyof Features, boolean>> | Partial<Features>) => void;
65
+ setQueryUpdates: (queryUpdates: BuilderQueryUpdates) => void;
66
+ setRequests: (requests: R) => void;
67
+ setSettings: (settings: S) => void;
68
+ getSdk: () => T;
69
+ getProviders: () => ProviderDataMap;
70
+ getEnabled: () => boolean;
71
+ getEnabledFeatures: () => Partial<Record<keyof Features, boolean>> | Partial<Features>;
72
+ getQueryUpdates: () => BuilderQueryUpdates;
73
+ getRequests: () => R;
74
+ getSettings: () => S;
75
+ }
33
76
  export type FacetValueFilterType = {
34
77
  type?: 'facet';
35
78
  facetCode: string;
@@ -182,16 +225,16 @@ export type SinglePrice = {
182
225
  value: number;
183
226
  };
184
227
  export type Price = PriceRange | SinglePrice | number;
185
- export type SearchResultAsset = {
228
+ export interface SearchResultAsset {
186
229
  id: string;
187
230
  preview: string;
188
- };
231
+ }
189
232
  export type FilterInputs = {
190
233
  filters: FacetValueFilterInput[];
191
234
  priceRange?: PriceRangeInput;
192
235
  priceRangeWithTax?: PriceRangeInput;
193
236
  };
194
- export type SearchResult = Node & {
237
+ export interface SearchResult {
195
238
  collectionIds: Array<string>;
196
239
  currencyCode: CurrencyCode;
197
240
  description: string;
@@ -209,47 +252,45 @@ export type SearchResult = Node & {
209
252
  score: number;
210
253
  sku: string;
211
254
  slug: string;
212
- badges?: Maybe<Array<Badge>>;
213
- ordinaryPrice?: Price;
214
- };
255
+ }
215
256
  type ResponseResult = {
216
257
  count: number;
217
258
  };
218
- export type CollectionList = {
259
+ export interface CollectionList {
219
260
  items: Array<Collection>;
220
261
  totalItems: number;
221
- };
222
- export type CollectionResult = ResponseResult & {
262
+ }
263
+ export interface CollectionResult extends ResponseResult {
223
264
  collection: Collection;
224
- };
225
- export type FacetValueResult = ResponseResult & {
265
+ }
266
+ export interface FacetValueResult extends ResponseResult {
226
267
  facetValue: FacetValue;
227
- };
228
- export type SearchResponsePriceData = {
268
+ }
269
+ export interface SearchResponsePriceData {
229
270
  range: PriceRange;
230
271
  rangeWithTax: PriceRange;
231
- };
232
- export type SearchResponse = {
272
+ }
273
+ export interface SearchResponse {
233
274
  collections: Array<CollectionResult>;
234
275
  facetValues: Array<FacetValueResult>;
235
276
  items: Array<SearchResult>;
236
277
  prices: SearchResponsePriceData;
237
278
  totalItems: number;
238
- };
239
- export type ProductResponse = {
279
+ }
280
+ export interface ProductResponse {
240
281
  items: Array<Product>;
241
- };
282
+ }
242
283
  export interface GroupedFacetValues {
243
284
  [key: string]: FacetValue[];
244
285
  }
245
286
  export type SearchInputProps = Pick<SearchInput, 'term' | 'collectionId' | 'facetValueIds' | 'facetValueOperator' | 'facetValueFilters' | 'groupByProduct' | 'sort' | 'take' | 'skip' | 'priceRange' | 'priceRangeWithTax'>;
246
- export type Node = {
287
+ export interface Node {
247
288
  id: string;
248
289
  createdAt: string;
249
290
  updatedAt: string;
250
291
  customFields?: Record<string, unknown>;
251
- };
252
- export type Channel = Node & {
292
+ }
293
+ export interface Channel extends Node {
253
294
  availableCurrencyCodes: Array<CurrencyCode>;
254
295
  availableLanguageCodes?: Maybe<Array<LanguageCode>>;
255
296
  code: string;
@@ -262,8 +303,8 @@ export type Channel = Node & {
262
303
  /** Not yet used - will be implemented in a future release. */
263
304
  trackInventory?: string;
264
305
  updatedAt: string;
265
- };
266
- export type Asset = Node & {
306
+ }
307
+ export interface Asset extends Node {
267
308
  name: string;
268
309
  type: AssetType;
269
310
  fileSize: number;
@@ -272,29 +313,22 @@ export type Asset = Node & {
272
313
  height: number;
273
314
  source: string;
274
315
  preview: string;
275
- };
276
- export type CollectionBreadcrumb = {
277
- id: string;
278
- name: string;
279
- slug: string;
280
- breadcrumbs: Array<CollectionBreadcrumb>;
281
- };
282
- export type PaginatedList<T = Node> = {
316
+ }
317
+ export interface PaginatedList<T = Node> {
283
318
  items: Array<T>;
284
319
  totalItems: number;
285
- };
286
- export type ProductVariantList = PaginatedList & {
320
+ }
321
+ export interface ProductVariantList extends PaginatedList {
287
322
  items: Array<ProductVariant>;
288
- };
289
- export type FacetList = PaginatedList & {
323
+ }
324
+ export interface FacetList extends PaginatedList {
290
325
  items: Array<Facet>;
291
- };
292
- export type FacetValueList = PaginatedList & {
326
+ }
327
+ export interface FacetValueList extends PaginatedList {
293
328
  items: Array<FacetValue>;
294
- };
295
- export type Collection = Node & {
329
+ }
330
+ export interface Collection extends Node {
296
331
  assets: Array<Asset>;
297
- breadcrumbs: Array<CollectionBreadcrumb>;
298
332
  children?: Maybe<Array<Collection>>;
299
333
  description: string;
300
334
  featuredAsset?: Maybe<Asset>;
@@ -304,40 +338,40 @@ export type Collection = Node & {
304
338
  parentId: string;
305
339
  productVariants: ProductVariantList;
306
340
  slug: string;
307
- };
308
- export type Facet = Node & {
341
+ }
342
+ export interface Facet extends Node {
309
343
  code: string;
310
344
  languageCode: LanguageCode;
311
345
  name: string;
312
346
  valueList: FacetValueList;
313
347
  values: Array<FacetValue>;
314
- };
315
- export type FacetValue = Node & {
348
+ }
349
+ export interface FacetValue extends Node {
316
350
  code: string;
317
351
  facet: Facet;
318
352
  facetId: string;
319
353
  languageCode: LanguageCode;
320
354
  name: string;
321
- };
322
- export type ProductOption = Node & {
355
+ }
356
+ export interface ProductOption extends Node {
323
357
  code: string;
324
358
  group: ProductOptionGroup;
325
359
  groupId: string;
326
360
  languageCode: LanguageCode;
327
361
  name: string;
328
- };
329
- export type ProductOptionGroup = Node & {
362
+ }
363
+ export interface ProductOptionGroup extends Node {
330
364
  code: string;
331
365
  languageCode: LanguageCode;
332
366
  name: string;
333
367
  options: Array<ProductOption>;
334
- };
335
- export type BriefProduct = Node & {
368
+ }
369
+ export interface BriefProduct extends Node {
336
370
  name: string;
337
371
  slug: string;
338
372
  variants: Array<ProductVariant>;
339
- };
340
- export type Product = BriefProduct & {
373
+ }
374
+ export interface Product extends BriefProduct {
341
375
  assets: Array<Asset>;
342
376
  collections: Array<Collection>;
343
377
  description: string;
@@ -346,24 +380,17 @@ export type Product = BriefProduct & {
346
380
  languageCode: LanguageCode;
347
381
  optionGroups: Array<ProductOptionGroup>;
348
382
  variantList: ProductVariantList;
349
- badges?: Maybe<Array<Badge>>;
350
- price: Price;
351
- priceWithTax: Price;
352
383
  currencyCode: CurrencyCode;
353
- breadCrumbs: string;
354
- ordinaryPrice?: PriceRange;
355
- };
356
- export type BriefProductVariant = Node & {
384
+ }
385
+ export interface BriefProductVariant extends Node {
357
386
  name: string;
358
387
  sku: string;
359
388
  price: Price;
360
389
  priceWithTax: Price;
361
390
  currencyCode: CurrencyCode;
362
391
  stockLevel: string;
363
- packageSize?: number;
364
- ordinaryPrice?: Price;
365
- };
366
- export type ProductVariant = BriefProductVariant & {
392
+ }
393
+ export interface ProductVariant extends BriefProductVariant {
367
394
  product: Product;
368
395
  productId: string;
369
396
  languageCode: LanguageCode;
@@ -375,15 +402,14 @@ export type ProductVariant = BriefProductVariant & {
375
402
  options: Array<ProductOption>;
376
403
  facetValues: Array<FacetValue>;
377
404
  customFields: Record<string, unknown>;
378
- badges?: Maybe<Array<Badge>>;
379
- };
380
- export type Country = Node & {
405
+ }
406
+ export interface Country extends Node {
381
407
  code: LanguageCode;
382
408
  name: string;
383
409
  type: string;
384
410
  enabled: boolean;
385
- };
386
- export type Address = Node & {
411
+ }
412
+ export interface Address extends Node {
387
413
  fullName?: Maybe<string>;
388
414
  company?: Maybe<string>;
389
415
  streetLine1?: Maybe<string>;
@@ -395,24 +421,24 @@ export type Address = Node & {
395
421
  defaultShippingAddress?: Maybe<boolean>;
396
422
  defaultBillingAddress?: Maybe<boolean>;
397
423
  country?: Maybe<Country>;
398
- };
399
- export type CreateAddressInput = Omit<Address, 'id' | 'createdAt' | 'updatedAt' | 'country'> & {
424
+ }
425
+ export interface CreateAddressInput extends Omit<Address, 'id' | 'createdAt' | 'updatedAt' | 'country'> {
400
426
  streetLine1: string;
401
427
  countryCode: string;
402
- };
403
- export type OrderAddress = Omit<Address, 'id' | 'createdAt' | 'updatedAt'> & {
428
+ }
429
+ export interface OrderAddress extends Omit<Address, 'id' | 'createdAt' | 'updatedAt'> {
404
430
  countryCode?: Maybe<string>;
405
- };
406
- export type Customer = Node & {
431
+ }
432
+ export interface Customer extends Node {
407
433
  title?: Maybe<string>;
408
434
  firstName: string;
409
435
  lastName: string;
410
436
  phoneNumber?: Maybe<string>;
411
437
  emailAddress: string;
412
438
  addresses?: Maybe<Array<Address>>;
413
- };
439
+ }
414
440
  export type CreateCustomerInput = Omit<Customer, 'id' | 'createdAt' | 'updatedAt' | 'addresses'>;
415
- export type OrderLine = Node & {
441
+ export interface OrderLine extends Node {
416
442
  unitPrice: Price;
417
443
  unitPriceWithTax: Price;
418
444
  linePrice: Price;
@@ -428,37 +454,36 @@ export type OrderLine = Node & {
428
454
  quantity: number;
429
455
  featuredAsset?: Maybe<Asset>;
430
456
  productVariant: ProductVariant;
431
- ordinaryPrice?: Price;
432
- };
433
- export type Payment = Node & {
457
+ }
458
+ export interface Payment extends Node {
434
459
  method: string;
435
460
  state: string;
436
461
  transactionId?: Maybe<string>;
437
462
  amount: Price;
438
463
  metadata?: Maybe<JSON>;
439
- };
440
- export type PaymentMethodQuote = Omit<Node, 'createdAt' | 'updatedAt'> & {
464
+ }
465
+ export interface PaymentMethodQuote extends Omit<Node, 'createdAt' | 'updatedAt'> {
441
466
  code: string;
442
467
  name: string;
443
468
  description: string;
444
469
  isEligible: boolean;
445
470
  eligibilityMessage: string;
446
- };
447
- export type ShippingMethodQuote = Omit<Node, 'createdAt' | 'updatedAt'> & {
471
+ }
472
+ export interface ShippingMethodQuote extends Omit<Node, 'createdAt' | 'updatedAt'> {
448
473
  price: Price;
449
474
  priceWithTax: Price;
450
475
  code: string;
451
476
  name: string;
452
477
  description: string;
453
478
  metadata: JSON;
454
- };
455
- export type OrderTaxSummary = {
479
+ }
480
+ export interface OrderTaxSummary {
456
481
  description: string;
457
482
  taxBase: number;
458
483
  taxRate: number;
459
484
  taxTotal: number;
460
- };
461
- export type OrderPriceData = {
485
+ }
486
+ export interface OrderPriceData {
462
487
  subTotal: number;
463
488
  subTotalWithTax: number;
464
489
  total: number;
@@ -467,8 +492,8 @@ export type OrderPriceData = {
467
492
  shippingWithTax: number;
468
493
  currencyCode: CurrencyCode;
469
494
  taxSummary: Array<OrderTaxSummary>;
470
- };
471
- export type Order = Node & OrderPriceData & {
495
+ }
496
+ export interface Order extends Node, OrderPriceData {
472
497
  code: string;
473
498
  active: boolean;
474
499
  state: string;
@@ -482,35 +507,35 @@ export type Order = Node & OrderPriceData & {
482
507
  discounts: Discount[];
483
508
  shippingLines: ShippingLine[];
484
509
  orderPlacedAt: string;
485
- };
486
- export type UpdateOrderInput = {
510
+ }
511
+ export interface UpdateOrderInput {
487
512
  billingAddress?: Maybe<CreateAddressInput>;
488
513
  shippingAddress?: Maybe<CreateAddressInput>;
489
514
  shippingMethodId?: Maybe<string>;
490
515
  paymentMethodCode?: Maybe<string>;
491
516
  customer?: Maybe<CreateCustomerInput>;
492
517
  customFields?: Record<string, unknown>;
493
- };
494
- export type ShippingMethod = {
518
+ }
519
+ export interface ShippingMethod {
495
520
  id: string;
496
521
  name: string;
497
- };
498
- export type ShippingLine = {
522
+ }
523
+ export interface ShippingLine {
499
524
  priceWithTax: Price;
500
525
  price: Price;
501
526
  shippingMethod: ShippingMethod;
502
- };
503
- export type HistoryEntryList = {
527
+ }
528
+ export interface HistoryEntryList {
504
529
  items: Array<HistoryEntry>;
505
530
  totalItems: number;
506
- };
507
- export type Discount = {
531
+ }
532
+ export interface Discount {
508
533
  type: string;
509
534
  description: string;
510
535
  amount: Price;
511
536
  amountWithTax: Price;
512
- };
513
- export type HistoryEntry = Node & {
537
+ }
538
+ export interface HistoryEntry extends Node {
514
539
  id: string;
515
540
  type: string;
516
541
  data: {
@@ -518,8 +543,8 @@ export type HistoryEntry = Node & {
518
543
  to: string;
519
544
  [key: string]: string;
520
545
  };
521
- };
522
- export type OrderFilterParameter = {
546
+ }
547
+ export interface OrderFilterParameter {
523
548
  CustomerMessage?: Maybe<StringOperators>;
524
549
  active?: Maybe<BooleanOperators>;
525
550
  code?: Maybe<StringOperators>;
@@ -538,8 +563,8 @@ export type OrderFilterParameter = {
538
563
  totalWithTax?: Maybe<NumberOperators>;
539
564
  type?: Maybe<StringOperators>;
540
565
  updatedAt?: Maybe<DateOperators>;
541
- };
542
- export type OrderSortParameter = {
566
+ }
567
+ export interface OrderSortParameter {
543
568
  CustomerMessage?: Maybe<SortOrder>;
544
569
  code?: Maybe<SortOrder>;
545
570
  createdAt?: Maybe<SortOrder>;
@@ -555,41 +580,41 @@ export type OrderSortParameter = {
555
580
  totalQuantity?: Maybe<SortOrder>;
556
581
  totalWithTax?: Maybe<SortOrder>;
557
582
  updatedAt?: Maybe<SortOrder>;
558
- };
559
- export type FacetFilterParameter = {
583
+ }
584
+ export interface FacetFilterParameter {
560
585
  code?: Maybe<StringOperators>;
561
586
  createdAt?: Maybe<DateOperators>;
562
587
  id?: Maybe<IdOperators>;
563
588
  languageCode?: Maybe<StringOperators>;
564
589
  name?: Maybe<StringOperators>;
565
590
  updatedAt?: Maybe<DateOperators>;
566
- };
567
- export type FacetSortParameter = {
591
+ }
592
+ export interface FacetSortParameter {
568
593
  code?: Maybe<SortOrder>;
569
594
  createdAt?: Maybe<SortOrder>;
570
595
  id?: Maybe<SortOrder>;
571
596
  name?: Maybe<SortOrder>;
572
597
  updatedAt?: Maybe<SortOrder>;
573
- };
574
- export type FacetListOptions = {
598
+ }
599
+ export interface FacetListOptions {
575
600
  filter?: Maybe<FacetFilterParameter>;
576
601
  filterOperator?: Maybe<LogicalOperator>;
577
602
  skip?: Maybe<number>;
578
603
  sort?: Maybe<FacetSortParameter>;
579
604
  take?: Maybe<number>;
580
- };
581
- export type OrderListOptions = {
605
+ }
606
+ export interface OrderListOptions {
582
607
  filter?: Maybe<OrderFilterParameter>;
583
608
  filterOperator?: Maybe<LogicalOperator>;
584
609
  skip?: Maybe<number>;
585
610
  sort?: Maybe<OrderSortParameter>;
586
611
  take?: Maybe<number>;
587
- };
588
- export type OrderList = PaginatedList & {
612
+ }
613
+ export interface OrderList extends PaginatedList {
589
614
  items: Array<Order>;
590
615
  totalItems: number;
591
- };
592
- export type Badge = {
616
+ }
617
+ export interface Badge {
593
618
  id: string;
594
619
  createdAt: string;
595
620
  updatedAt: string;
@@ -598,7 +623,7 @@ export type Badge = {
598
623
  position: string;
599
624
  asset: Asset;
600
625
  assetId: string;
601
- };
626
+ }
602
627
  export interface CollectionSearchResponse extends Collection {
603
628
  hierarchySlug: string;
604
629
  }
@@ -608,26 +633,26 @@ export interface UseSearchFieldResponse {
608
633
  totalItems: number;
609
634
  facets: GroupedFacetValues;
610
635
  }
611
- export type AddItemToOrderInput = {
636
+ export interface AddItemToOrderInput {
612
637
  productVariantId: string;
613
638
  quantity: number;
614
- };
615
- export type AdjustOrderLineInput = {
639
+ }
640
+ export interface AdjustOrderLineInput {
616
641
  orderLineId: string;
617
642
  quantity: number;
618
- };
619
- export type LoginInput = {
643
+ }
644
+ export interface LoginInput {
620
645
  username: string;
621
646
  password: string;
622
647
  rememberMe?: boolean;
623
- };
624
- export type RequestPasswordResetInput = {
648
+ }
649
+ export interface RequestPasswordResetInput {
625
650
  email: string;
626
- };
627
- export type ResetPasswordInput = {
651
+ }
652
+ export interface ResetPasswordInput {
628
653
  token: string;
629
654
  password: string;
630
- };
655
+ }
631
656
  export declare enum QueryKeys {
632
657
  ACTIVE_ORDER = "activeOrder",
633
658
  ACTIVE_CHANNEL = "activeChannel",
@@ -1322,4 +1347,26 @@ export interface AsChildProps {
1322
1347
  style?: CSSProperties;
1323
1348
  children?: ReactNode;
1324
1349
  }
1350
+ export interface PersistOptions {
1351
+ enabled: boolean;
1352
+ storage?: Storage;
1353
+ maxAge?: number;
1354
+ }
1355
+ export interface IGraphQLSDK {
1356
+ setUpdates(updates: BuilderQueryUpdates): void;
1357
+ getQueries(): BuilderQueries;
1358
+ createRequest<T = unknown, Vars extends Record<string, unknown> = Record<string, unknown>>(json: BuilderQuery<Vars>, variables: ExpectedVariables<Vars>, mutation?: boolean): Promise<AxiosResponse<T>>;
1359
+ createGraphQLQuery(json: BuilderQuery, variables?: Record<string, unknown>): {
1360
+ query: string;
1361
+ variables: unknown;
1362
+ operationName: string;
1363
+ };
1364
+ createGraphQLMutation(json: BuilderQuery, variables?: Record<string, unknown>): {
1365
+ query: string;
1366
+ variables: unknown;
1367
+ operationName: string;
1368
+ };
1369
+ updateFields(source: BuilderQueries, updates: BuilderQueryUpdates): BuilderQueries;
1370
+ replaceChildObjectVariables(json: unknown, variables?: Record<string, unknown>): void;
1371
+ }
1325
1372
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-storefront-react/shared-types",
3
- "version": "0.0.6-0",
3
+ "version": "0.0.7-0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {