@plasmicpkgs/commerce 0.0.1 → 0.0.2

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 (116) hide show
  1. package/README.md +1 -0
  2. package/dist/api/endpoints/cart.d.ts +4 -0
  3. package/dist/api/endpoints/catalog/products.d.ts +4 -0
  4. package/dist/api/index.d.ts +75 -0
  5. package/dist/api/operations.d.ts +130 -0
  6. package/dist/api/utils/errors.d.ts +10 -0
  7. package/dist/api/utils/is-allowed-method.d.ts +3 -0
  8. package/dist/api/utils/is-allowed-operation.d.ts +6 -0
  9. package/dist/api/utils/types.d.ts +34 -0
  10. package/dist/cart/use-add-item.d.ts +5 -6
  11. package/dist/cart/use-cart.d.ts +5 -6
  12. package/dist/cart/use-remove-item.d.ts +5 -6
  13. package/dist/cart/use-update-item.d.ts +5 -6
  14. package/dist/commerce.cjs.development.js +1851 -0
  15. package/dist/commerce.cjs.development.js.map +1 -0
  16. package/dist/commerce.cjs.production.min.js +2 -0
  17. package/dist/commerce.cjs.production.min.js.map +1 -0
  18. package/dist/commerce.d.ts +37 -0
  19. package/dist/commerce.esm.js +1828 -0
  20. package/dist/commerce.esm.js.map +1 -0
  21. package/dist/contexts.d.ts +10 -7
  22. package/dist/index.d.ts +21 -71
  23. package/dist/index.js +7 -28
  24. package/dist/product/use-price.d.ts +26 -26
  25. package/dist/product/use-search.d.ts +6 -6
  26. package/dist/registerAddToCartButton.d.ts +10 -0
  27. package/dist/registerProductCollection.d.ts +13 -11
  28. package/dist/registerProductMedia.d.ts +12 -0
  29. package/dist/registerProductPrice.d.ts +9 -0
  30. package/dist/registerProductQuantity.d.ts +11 -0
  31. package/dist/registerProductTextField.d.ts +10 -0
  32. package/dist/registerProductVariantPicker.d.ts +9 -0
  33. package/dist/registerUseCart.d.ts +9 -0
  34. package/dist/registerable.d.ts +4 -4
  35. package/dist/types/cart.d.ts +157 -157
  36. package/dist/types/checkout.d.ts +57 -57
  37. package/dist/types/common.d.ts +13 -13
  38. package/dist/types/customer/address.d.ts +110 -110
  39. package/dist/types/customer/card.d.ts +113 -113
  40. package/dist/types/customer/index.d.ts +24 -24
  41. package/dist/types/index.d.ts +12 -12
  42. package/dist/types/login.d.ts +27 -27
  43. package/dist/types/logout.d.ts +17 -17
  44. package/dist/types/page.d.ts +24 -24
  45. package/dist/types/product.d.ts +102 -99
  46. package/dist/types/signup.d.ts +23 -23
  47. package/dist/types/site.d.ts +17 -17
  48. package/dist/types/wishlist.d.ts +83 -83
  49. package/dist/utils/default-fetcher.d.ts +4 -4
  50. package/dist/utils/define-property.d.ts +21 -21
  51. package/dist/utils/errors.d.ts +27 -27
  52. package/dist/utils/get-product-price.d.ts +2 -0
  53. package/dist/utils/types.d.ts +95 -94
  54. package/dist/utils/use-data.d.ts +12 -12
  55. package/dist/utils/use-hook.d.ts +6 -6
  56. package/package.json +13 -13
  57. package/dist/auth/use-login.d.ts +0 -6
  58. package/dist/auth/use-login.js +0 -9
  59. package/dist/auth/use-logout.d.ts +0 -6
  60. package/dist/auth/use-logout.js +0 -9
  61. package/dist/auth/use-signup.d.ts +0 -6
  62. package/dist/auth/use-signup.js +0 -9
  63. package/dist/cart/use-add-item.js +0 -9
  64. package/dist/cart/use-cart.js +0 -18
  65. package/dist/cart/use-remove-item.js +0 -9
  66. package/dist/cart/use-update-item.js +0 -9
  67. package/dist/checkout/use-checkout.d.ts +0 -6
  68. package/dist/checkout/use-checkout.js +0 -18
  69. package/dist/checkout/use-submit-checkout.d.ts +0 -6
  70. package/dist/checkout/use-submit-checkout.js +0 -9
  71. package/dist/contexts.js +0 -46
  72. package/dist/customer/address/use-add-item.d.ts +0 -6
  73. package/dist/customer/address/use-add-item.js +0 -9
  74. package/dist/customer/address/use-addresses.d.ts +0 -6
  75. package/dist/customer/address/use-addresses.js +0 -18
  76. package/dist/customer/address/use-remove-item.d.ts +0 -6
  77. package/dist/customer/address/use-remove-item.js +0 -9
  78. package/dist/customer/address/use-update-item.d.ts +0 -6
  79. package/dist/customer/address/use-update-item.js +0 -9
  80. package/dist/customer/card/use-add-item.d.ts +0 -6
  81. package/dist/customer/card/use-add-item.js +0 -9
  82. package/dist/customer/card/use-cards.d.ts +0 -6
  83. package/dist/customer/card/use-cards.js +0 -18
  84. package/dist/customer/card/use-remove-item.d.ts +0 -6
  85. package/dist/customer/card/use-remove-item.js +0 -9
  86. package/dist/customer/card/use-update-item.d.ts +0 -6
  87. package/dist/customer/card/use-update-item.js +0 -9
  88. package/dist/customer/use-customer.d.ts +0 -6
  89. package/dist/customer/use-customer.js +0 -9
  90. package/dist/product/use-price.js +0 -33
  91. package/dist/product/use-search.js +0 -9
  92. package/dist/registerProductCollection.js +0 -42
  93. package/dist/registerProductImage.d.ts +0 -13
  94. package/dist/registerProductImage.js +0 -37
  95. package/dist/registerable.js +0 -0
  96. package/dist/tsconfig.tsbuildinfo +0 -2970
  97. package/dist/types/cart.js +0 -0
  98. package/dist/types/checkout.js +0 -0
  99. package/dist/types/common.js +0 -0
  100. package/dist/types/customer/address.js +0 -0
  101. package/dist/types/customer/card.js +0 -0
  102. package/dist/types/customer/index.js +0 -2
  103. package/dist/types/index.js +0 -11
  104. package/dist/types/login.js +0 -0
  105. package/dist/types/logout.js +0 -0
  106. package/dist/types/page.js +0 -0
  107. package/dist/types/product.js +0 -0
  108. package/dist/types/signup.js +0 -0
  109. package/dist/types/site.js +0 -0
  110. package/dist/types/wishlist.js +0 -0
  111. package/dist/utils/default-fetcher.js +0 -3
  112. package/dist/utils/define-property.js +0 -4
  113. package/dist/utils/errors.js +0 -24
  114. package/dist/utils/types.js +0 -0
  115. package/dist/utils/use-data.js +0 -43
  116. package/dist/utils/use-hook.js +0 -37
@@ -1,157 +1,157 @@
1
- import type { Discount, Measurement, Image } from './common';
2
- export declare type SelectedOption = {
3
- id?: string;
4
- name: string;
5
- value: string;
6
- };
7
- export declare type LineItem = {
8
- id: string;
9
- variantId: string;
10
- productId: string;
11
- name: string;
12
- quantity: number;
13
- discounts: Discount[];
14
- path: string;
15
- variant: ProductVariant;
16
- options?: SelectedOption[];
17
- };
18
- export declare type ProductVariant = {
19
- id: string;
20
- sku: string;
21
- name: string;
22
- requiresShipping: boolean;
23
- price: number;
24
- listPrice: number;
25
- image?: Image;
26
- isInStock?: boolean;
27
- availableForSale?: boolean;
28
- weight?: Measurement;
29
- height?: Measurement;
30
- width?: Measurement;
31
- depth?: Measurement;
32
- };
33
- export declare type Cart = {
34
- id: string;
35
- customerId?: string;
36
- email?: string;
37
- createdAt: string;
38
- currency: {
39
- code: string;
40
- };
41
- taxesIncluded: boolean;
42
- lineItems: LineItem[];
43
- lineItemsSubtotalPrice: number;
44
- subtotalPrice: number;
45
- totalPrice: number;
46
- discounts?: Discount[];
47
- };
48
- /**
49
- * Base cart item body used for cart mutations
50
- */
51
- export declare type CartItemBody = {
52
- variantId: string;
53
- productId?: string;
54
- quantity?: number;
55
- };
56
- /**
57
- * Hooks schema
58
- */
59
- export declare type CartTypes = {
60
- cart?: Cart;
61
- item: LineItem;
62
- itemBody: CartItemBody;
63
- };
64
- export declare type CartHooks<T extends CartTypes = CartTypes> = {
65
- getCart: GetCartHook<T>;
66
- addItem: AddItemHook<T>;
67
- updateItem: UpdateItemHook<T>;
68
- removeItem: RemoveItemHook<T>;
69
- };
70
- export declare type GetCartHook<T extends CartTypes = CartTypes> = {
71
- data: T['cart'] | null;
72
- input: {};
73
- fetcherInput: {
74
- cartId?: string;
75
- };
76
- swrState: {
77
- isEmpty: boolean;
78
- };
79
- };
80
- export declare type AddItemHook<T extends CartTypes = CartTypes> = {
81
- data: T['cart'];
82
- input?: T['itemBody'];
83
- fetcherInput: T['itemBody'];
84
- body: {
85
- item: T['itemBody'];
86
- };
87
- actionInput: T['itemBody'];
88
- };
89
- export declare type UpdateItemHook<T extends CartTypes = CartTypes> = {
90
- data: T['cart'] | null;
91
- input: {
92
- item?: T['item'];
93
- wait?: number;
94
- };
95
- fetcherInput: {
96
- itemId: string;
97
- item: T['itemBody'];
98
- };
99
- body: {
100
- itemId: string;
101
- item: T['itemBody'];
102
- };
103
- actionInput: T['itemBody'] & {
104
- id: string;
105
- };
106
- };
107
- export declare type RemoveItemHook<T extends CartTypes = CartTypes> = {
108
- data: T['cart'] | null;
109
- input: {
110
- item?: T['item'];
111
- };
112
- fetcherInput: {
113
- itemId: string;
114
- };
115
- body: {
116
- itemId: string;
117
- };
118
- actionInput: {
119
- id: string;
120
- };
121
- };
122
- /**
123
- * API Schema
124
- */
125
- export declare type CartSchema<T extends CartTypes = CartTypes> = {
126
- endpoint: {
127
- options: {};
128
- handlers: CartHandlers<T>;
129
- };
130
- };
131
- export declare type CartHandlers<T extends CartTypes = CartTypes> = {
132
- getCart: GetCartHandler<T>;
133
- addItem: AddItemHandler<T>;
134
- updateItem: UpdateItemHandler<T>;
135
- removeItem: RemoveItemHandler<T>;
136
- };
137
- export declare type GetCartHandler<T extends CartTypes = CartTypes> = GetCartHook<T> & {
138
- body: {
139
- cartId?: string;
140
- };
141
- };
142
- export declare type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHook<T> & {
143
- body: {
144
- cartId: string;
145
- };
146
- };
147
- export declare type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
148
- data: T['cart'];
149
- body: {
150
- cartId: string;
151
- };
152
- };
153
- export declare type RemoveItemHandler<T extends CartTypes = CartTypes> = RemoveItemHook<T> & {
154
- body: {
155
- cartId: string;
156
- };
157
- };
1
+ import type { Discount, Measurement, Image } from './common';
2
+ export declare type SelectedOption = {
3
+ id?: string;
4
+ name: string;
5
+ value: string;
6
+ };
7
+ export declare type LineItem = {
8
+ id: string;
9
+ variantId: string;
10
+ productId: string;
11
+ name: string;
12
+ quantity: number;
13
+ discounts: Discount[];
14
+ path: string;
15
+ variant: ProductVariant;
16
+ options?: SelectedOption[];
17
+ };
18
+ export declare type ProductVariant = {
19
+ id: string;
20
+ sku: string;
21
+ name: string;
22
+ requiresShipping: boolean;
23
+ price: number;
24
+ listPrice: number;
25
+ image?: Image;
26
+ isInStock?: boolean;
27
+ availableForSale?: boolean;
28
+ weight?: Measurement;
29
+ height?: Measurement;
30
+ width?: Measurement;
31
+ depth?: Measurement;
32
+ };
33
+ export declare type Cart = {
34
+ id: string;
35
+ customerId?: string;
36
+ email?: string;
37
+ createdAt: string;
38
+ currency: {
39
+ code: string;
40
+ };
41
+ taxesIncluded: boolean;
42
+ lineItems: LineItem[];
43
+ lineItemsSubtotalPrice: number;
44
+ subtotalPrice: number;
45
+ totalPrice: number;
46
+ discounts?: Discount[];
47
+ };
48
+ /**
49
+ * Base cart item body used for cart mutations
50
+ */
51
+ export declare type CartItemBody = {
52
+ variantId: string;
53
+ productId?: string;
54
+ quantity?: number;
55
+ };
56
+ /**
57
+ * Hooks schema
58
+ */
59
+ export declare type CartTypes = {
60
+ cart?: Cart;
61
+ item: LineItem;
62
+ itemBody: CartItemBody;
63
+ };
64
+ export declare type CartHooks<T extends CartTypes = CartTypes> = {
65
+ getCart: GetCartHook<T>;
66
+ addItem: AddItemHook<T>;
67
+ updateItem: UpdateItemHook<T>;
68
+ removeItem: RemoveItemHook<T>;
69
+ };
70
+ export declare type GetCartHook<T extends CartTypes = CartTypes> = {
71
+ data: T['cart'] | null;
72
+ input: {};
73
+ fetcherInput: {
74
+ cartId?: string;
75
+ };
76
+ swrState: {
77
+ isEmpty: boolean;
78
+ };
79
+ };
80
+ export declare type AddItemHook<T extends CartTypes = CartTypes> = {
81
+ data: T['cart'];
82
+ input?: T['itemBody'];
83
+ fetcherInput: T['itemBody'];
84
+ body: {
85
+ item: T['itemBody'];
86
+ };
87
+ actionInput: T['itemBody'];
88
+ };
89
+ export declare type UpdateItemHook<T extends CartTypes = CartTypes> = {
90
+ data: T['cart'] | null;
91
+ input: {
92
+ item?: T['item'];
93
+ wait?: number;
94
+ };
95
+ fetcherInput: {
96
+ itemId: string;
97
+ item: T['itemBody'];
98
+ };
99
+ body: {
100
+ itemId: string;
101
+ item: T['itemBody'];
102
+ };
103
+ actionInput: T['itemBody'] & {
104
+ id: string;
105
+ };
106
+ };
107
+ export declare type RemoveItemHook<T extends CartTypes = CartTypes> = {
108
+ data: T['cart'] | null;
109
+ input: {
110
+ item?: T['item'];
111
+ };
112
+ fetcherInput: {
113
+ itemId: string;
114
+ };
115
+ body: {
116
+ itemId: string;
117
+ };
118
+ actionInput: {
119
+ id: string;
120
+ };
121
+ };
122
+ /**
123
+ * API Schema
124
+ */
125
+ export declare type CartSchema<T extends CartTypes = CartTypes> = {
126
+ endpoint: {
127
+ options: {};
128
+ handlers: CartHandlers<T>;
129
+ };
130
+ };
131
+ export declare type CartHandlers<T extends CartTypes = CartTypes> = {
132
+ getCart: GetCartHandler<T>;
133
+ addItem: AddItemHandler<T>;
134
+ updateItem: UpdateItemHandler<T>;
135
+ removeItem: RemoveItemHandler<T>;
136
+ };
137
+ export declare type GetCartHandler<T extends CartTypes = CartTypes> = GetCartHook<T> & {
138
+ body: {
139
+ cartId?: string;
140
+ };
141
+ };
142
+ export declare type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHook<T> & {
143
+ body: {
144
+ cartId: string;
145
+ };
146
+ };
147
+ export declare type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
148
+ data: T['cart'];
149
+ body: {
150
+ cartId: string;
151
+ };
152
+ };
153
+ export declare type RemoveItemHandler<T extends CartTypes = CartTypes> = RemoveItemHook<T> & {
154
+ body: {
155
+ cartId: string;
156
+ };
157
+ };
@@ -1,57 +1,57 @@
1
- import type { UseSubmitCheckout } from '../checkout/use-submit-checkout';
2
- import type { Address, AddressFields } from './customer/address';
3
- import type { Card, CardFields } from './customer/card';
4
- export declare type Checkout = any;
5
- export declare type CheckoutTypes = {
6
- card?: Card | CardFields;
7
- address?: Address | AddressFields;
8
- checkout?: Checkout;
9
- hasPayment?: boolean;
10
- hasShipping?: boolean;
11
- };
12
- export declare type SubmitCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
13
- data: T;
14
- input?: T;
15
- fetcherInput: T;
16
- body: {
17
- item: T;
18
- };
19
- actionInput: T;
20
- };
21
- export declare type GetCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
22
- data: T['checkout'] | null;
23
- input: {};
24
- fetcherInput: {
25
- cartId?: string;
26
- };
27
- swrState: {
28
- isEmpty: boolean;
29
- };
30
- mutations: {
31
- submit: UseSubmitCheckout;
32
- };
33
- };
34
- export declare type CheckoutHooks<T extends CheckoutTypes = CheckoutTypes> = {
35
- submitCheckout?: SubmitCheckoutHook<T>;
36
- getCheckout: GetCheckoutHook<T>;
37
- };
38
- export declare type GetCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = GetCheckoutHook<T> & {
39
- body: {
40
- cartId: string;
41
- };
42
- };
43
- export declare type SubmitCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = SubmitCheckoutHook<T> & {
44
- body: {
45
- cartId: string;
46
- };
47
- };
48
- export declare type CheckoutHandlers<T extends CheckoutTypes = CheckoutTypes> = {
49
- getCheckout: GetCheckoutHandler<T>;
50
- submitCheckout?: SubmitCheckoutHandler<T>;
51
- };
52
- export declare type CheckoutSchema<T extends CheckoutTypes = CheckoutTypes> = {
53
- endpoint: {
54
- options: {};
55
- handlers: CheckoutHandlers<T>;
56
- };
57
- };
1
+ import type { UseSubmitCheckout } from '../checkout/use-submit-checkout';
2
+ import type { Address, AddressFields } from './customer/address';
3
+ import type { Card, CardFields } from './customer/card';
4
+ export declare type Checkout = any;
5
+ export declare type CheckoutTypes = {
6
+ card?: Card | CardFields;
7
+ address?: Address | AddressFields;
8
+ checkout?: Checkout;
9
+ hasPayment?: boolean;
10
+ hasShipping?: boolean;
11
+ };
12
+ export declare type SubmitCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
13
+ data: T;
14
+ input?: T;
15
+ fetcherInput: T;
16
+ body: {
17
+ item: T;
18
+ };
19
+ actionInput: T;
20
+ };
21
+ export declare type GetCheckoutHook<T extends CheckoutTypes = CheckoutTypes> = {
22
+ data: T['checkout'] | null;
23
+ input: {};
24
+ fetcherInput: {
25
+ cartId?: string;
26
+ };
27
+ swrState: {
28
+ isEmpty: boolean;
29
+ };
30
+ mutations: {
31
+ submit: UseSubmitCheckout;
32
+ };
33
+ };
34
+ export declare type CheckoutHooks<T extends CheckoutTypes = CheckoutTypes> = {
35
+ submitCheckout?: SubmitCheckoutHook<T>;
36
+ getCheckout: GetCheckoutHook<T>;
37
+ };
38
+ export declare type GetCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = GetCheckoutHook<T> & {
39
+ body: {
40
+ cartId: string;
41
+ };
42
+ };
43
+ export declare type SubmitCheckoutHandler<T extends CheckoutTypes = CheckoutTypes> = SubmitCheckoutHook<T> & {
44
+ body: {
45
+ cartId: string;
46
+ };
47
+ };
48
+ export declare type CheckoutHandlers<T extends CheckoutTypes = CheckoutTypes> = {
49
+ getCheckout: GetCheckoutHandler<T>;
50
+ submitCheckout?: SubmitCheckoutHandler<T>;
51
+ };
52
+ export declare type CheckoutSchema<T extends CheckoutTypes = CheckoutTypes> = {
53
+ endpoint: {
54
+ options: {};
55
+ handlers: CheckoutHandlers<T>;
56
+ };
57
+ };
@@ -1,13 +1,13 @@
1
- export declare type Discount = {
2
- value: number;
3
- };
4
- export declare type Measurement = {
5
- value: number;
6
- unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
7
- };
8
- export declare type Image = {
9
- url: string;
10
- altText?: string;
11
- width?: number;
12
- height?: number;
13
- };
1
+ export declare type Discount = {
2
+ value: number;
3
+ };
4
+ export declare type Measurement = {
5
+ value: number;
6
+ unit: 'KILOGRAMS' | 'GRAMS' | 'POUNDS' | 'OUNCES';
7
+ };
8
+ export declare type Image = {
9
+ url: string;
10
+ altText?: string;
11
+ width?: number;
12
+ height?: number;
13
+ };
@@ -1,110 +1,110 @@
1
- export interface Address {
2
- id: string;
3
- mask: string;
4
- }
5
- export interface AddressFields {
6
- type: string;
7
- firstName: string;
8
- lastName: string;
9
- company: string;
10
- streetNumber: string;
11
- apartments: string;
12
- zipCode: string;
13
- city: string;
14
- country: string;
15
- }
16
- export declare type CustomerAddressTypes = {
17
- address?: Address;
18
- fields: AddressFields;
19
- };
20
- export declare type GetAddressesHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
21
- data: T['address'][] | null;
22
- input: {};
23
- fetcherInput: {
24
- cartId?: string;
25
- };
26
- swrState: {
27
- isEmpty: boolean;
28
- };
29
- };
30
- export declare type AddItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
31
- data: T['address'];
32
- input?: T['fields'];
33
- fetcherInput: T['fields'];
34
- body: {
35
- item: T['fields'];
36
- };
37
- actionInput: T['fields'];
38
- };
39
- export declare type UpdateItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
40
- data: T['address'] | null;
41
- input: {
42
- item?: T['fields'];
43
- wait?: number;
44
- };
45
- fetcherInput: {
46
- itemId: string;
47
- item: T['fields'];
48
- };
49
- body: {
50
- itemId: string;
51
- item: T['fields'];
52
- };
53
- actionInput: T['fields'] & {
54
- id: string;
55
- };
56
- };
57
- export declare type RemoveItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
58
- data: T['address'] | null;
59
- input: {
60
- item?: T['address'];
61
- };
62
- fetcherInput: {
63
- itemId: string;
64
- };
65
- body: {
66
- itemId: string;
67
- };
68
- actionInput: {
69
- id: string;
70
- };
71
- };
72
- export declare type CustomerAddressHooks<T extends CustomerAddressTypes = CustomerAddressTypes> = {
73
- getAddresses: GetAddressesHook<T>;
74
- addItem: AddItemHook<T>;
75
- updateItem: UpdateItemHook<T>;
76
- removeItem: RemoveItemHook<T>;
77
- };
78
- export declare type AddressHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = GetAddressesHook<T> & {
79
- body: {
80
- cartId?: string;
81
- };
82
- };
83
- export declare type AddItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = AddItemHook<T> & {
84
- body: {
85
- cartId: string;
86
- };
87
- };
88
- export declare type UpdateItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = UpdateItemHook<T> & {
89
- data: T['address'];
90
- body: {
91
- cartId: string;
92
- };
93
- };
94
- export declare type RemoveItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = RemoveItemHook<T> & {
95
- body: {
96
- cartId: string;
97
- };
98
- };
99
- export declare type CustomerAddressHandlers<T extends CustomerAddressTypes = CustomerAddressTypes> = {
100
- getAddresses: GetAddressesHook<T>;
101
- addItem: AddItemHandler<T>;
102
- updateItem: UpdateItemHandler<T>;
103
- removeItem: RemoveItemHandler<T>;
104
- };
105
- export declare type CustomerAddressSchema<T extends CustomerAddressTypes = CustomerAddressTypes> = {
106
- endpoint: {
107
- options: {};
108
- handlers: CustomerAddressHandlers<T>;
109
- };
110
- };
1
+ export interface Address {
2
+ id: string;
3
+ mask: string;
4
+ }
5
+ export interface AddressFields {
6
+ type: string;
7
+ firstName: string;
8
+ lastName: string;
9
+ company: string;
10
+ streetNumber: string;
11
+ apartments: string;
12
+ zipCode: string;
13
+ city: string;
14
+ country: string;
15
+ }
16
+ export declare type CustomerAddressTypes = {
17
+ address?: Address;
18
+ fields: AddressFields;
19
+ };
20
+ export declare type GetAddressesHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
21
+ data: T['address'][] | null;
22
+ input: {};
23
+ fetcherInput: {
24
+ cartId?: string;
25
+ };
26
+ swrState: {
27
+ isEmpty: boolean;
28
+ };
29
+ };
30
+ export declare type AddItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
31
+ data: T['address'];
32
+ input?: T['fields'];
33
+ fetcherInput: T['fields'];
34
+ body: {
35
+ item: T['fields'];
36
+ };
37
+ actionInput: T['fields'];
38
+ };
39
+ export declare type UpdateItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
40
+ data: T['address'] | null;
41
+ input: {
42
+ item?: T['fields'];
43
+ wait?: number;
44
+ };
45
+ fetcherInput: {
46
+ itemId: string;
47
+ item: T['fields'];
48
+ };
49
+ body: {
50
+ itemId: string;
51
+ item: T['fields'];
52
+ };
53
+ actionInput: T['fields'] & {
54
+ id: string;
55
+ };
56
+ };
57
+ export declare type RemoveItemHook<T extends CustomerAddressTypes = CustomerAddressTypes> = {
58
+ data: T['address'] | null;
59
+ input: {
60
+ item?: T['address'];
61
+ };
62
+ fetcherInput: {
63
+ itemId: string;
64
+ };
65
+ body: {
66
+ itemId: string;
67
+ };
68
+ actionInput: {
69
+ id: string;
70
+ };
71
+ };
72
+ export declare type CustomerAddressHooks<T extends CustomerAddressTypes = CustomerAddressTypes> = {
73
+ getAddresses: GetAddressesHook<T>;
74
+ addItem: AddItemHook<T>;
75
+ updateItem: UpdateItemHook<T>;
76
+ removeItem: RemoveItemHook<T>;
77
+ };
78
+ export declare type AddressHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = GetAddressesHook<T> & {
79
+ body: {
80
+ cartId?: string;
81
+ };
82
+ };
83
+ export declare type AddItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = AddItemHook<T> & {
84
+ body: {
85
+ cartId: string;
86
+ };
87
+ };
88
+ export declare type UpdateItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = UpdateItemHook<T> & {
89
+ data: T['address'];
90
+ body: {
91
+ cartId: string;
92
+ };
93
+ };
94
+ export declare type RemoveItemHandler<T extends CustomerAddressTypes = CustomerAddressTypes> = RemoveItemHook<T> & {
95
+ body: {
96
+ cartId: string;
97
+ };
98
+ };
99
+ export declare type CustomerAddressHandlers<T extends CustomerAddressTypes = CustomerAddressTypes> = {
100
+ getAddresses: GetAddressesHook<T>;
101
+ addItem: AddItemHandler<T>;
102
+ updateItem: UpdateItemHandler<T>;
103
+ removeItem: RemoveItemHandler<T>;
104
+ };
105
+ export declare type CustomerAddressSchema<T extends CustomerAddressTypes = CustomerAddressTypes> = {
106
+ endpoint: {
107
+ options: {};
108
+ handlers: CustomerAddressHandlers<T>;
109
+ };
110
+ };