@voyantjs/pricing-react 0.2.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.
Files changed (126) hide show
  1. package/LICENSE +109 -0
  2. package/dist/hooks/index.d.ts +33 -0
  3. package/dist/hooks/index.d.ts.map +1 -1
  4. package/dist/hooks/index.js +33 -0
  5. package/dist/hooks/use-cancellation-policies.d.ts +20 -0
  6. package/dist/hooks/use-cancellation-policies.d.ts.map +1 -0
  7. package/dist/hooks/use-cancellation-policies.js +12 -0
  8. package/dist/hooks/use-cancellation-policy-mutation.d.ts +57 -0
  9. package/dist/hooks/use-cancellation-policy-mutation.d.ts.map +1 -0
  10. package/dist/hooks/use-cancellation-policy-mutation.js +49 -0
  11. package/dist/hooks/use-cancellation-policy-rule-mutation.d.ts +58 -0
  12. package/dist/hooks/use-cancellation-policy-rule-mutation.d.ts.map +1 -0
  13. package/dist/hooks/use-cancellation-policy-rule-mutation.js +49 -0
  14. package/dist/hooks/use-cancellation-policy-rule.d.ts +15 -0
  15. package/dist/hooks/use-cancellation-policy-rule.d.ts.map +1 -0
  16. package/dist/hooks/use-cancellation-policy-rule.js +12 -0
  17. package/dist/hooks/use-cancellation-policy-rules.d.ts +21 -0
  18. package/dist/hooks/use-cancellation-policy-rules.d.ts.map +1 -0
  19. package/dist/hooks/use-cancellation-policy-rules.js +12 -0
  20. package/dist/hooks/use-cancellation-policy.d.ts +14 -0
  21. package/dist/hooks/use-cancellation-policy.d.ts.map +1 -0
  22. package/dist/hooks/use-cancellation-policy.js +12 -0
  23. package/dist/hooks/use-dropoff-price-rule-mutation.d.ts +72 -0
  24. package/dist/hooks/use-dropoff-price-rule-mutation.d.ts.map +1 -0
  25. package/dist/hooks/use-dropoff-price-rule-mutation.js +52 -0
  26. package/dist/hooks/use-dropoff-price-rule.d.ts +18 -0
  27. package/dist/hooks/use-dropoff-price-rule.d.ts.map +1 -0
  28. package/dist/hooks/use-dropoff-price-rule.js +12 -0
  29. package/dist/hooks/use-dropoff-price-rules.d.ts +24 -0
  30. package/dist/hooks/use-dropoff-price-rules.d.ts.map +1 -0
  31. package/dist/hooks/use-dropoff-price-rules.js +12 -0
  32. package/dist/hooks/use-extra-price-rule-mutation.d.ts +72 -0
  33. package/dist/hooks/use-extra-price-rule-mutation.d.ts.map +1 -0
  34. package/dist/hooks/use-extra-price-rule-mutation.js +52 -0
  35. package/dist/hooks/use-extra-price-rule.d.ts +18 -0
  36. package/dist/hooks/use-extra-price-rule.d.ts.map +1 -0
  37. package/dist/hooks/use-extra-price-rule.js +12 -0
  38. package/dist/hooks/use-extra-price-rules.d.ts +24 -0
  39. package/dist/hooks/use-extra-price-rules.d.ts.map +1 -0
  40. package/dist/hooks/use-extra-price-rules.js +12 -0
  41. package/dist/hooks/use-option-price-rule-mutation.d.ts +98 -0
  42. package/dist/hooks/use-option-price-rule-mutation.d.ts.map +1 -0
  43. package/dist/hooks/use-option-price-rule-mutation.js +66 -0
  44. package/dist/hooks/use-option-price-rule.d.ts +24 -0
  45. package/dist/hooks/use-option-price-rule.d.ts.map +1 -0
  46. package/dist/hooks/use-option-price-rule.js +12 -0
  47. package/dist/hooks/use-option-price-rules.d.ts +30 -0
  48. package/dist/hooks/use-option-price-rules.d.ts.map +1 -0
  49. package/dist/hooks/use-option-price-rules.js +12 -0
  50. package/dist/hooks/use-option-start-time-rule-mutation.d.ts +70 -0
  51. package/dist/hooks/use-option-start-time-rule-mutation.d.ts.map +1 -0
  52. package/dist/hooks/use-option-start-time-rule-mutation.js +51 -0
  53. package/dist/hooks/use-option-start-time-rule.d.ts +17 -0
  54. package/dist/hooks/use-option-start-time-rule.d.ts.map +1 -0
  55. package/dist/hooks/use-option-start-time-rule.js +12 -0
  56. package/dist/hooks/use-option-start-time-rules.d.ts +23 -0
  57. package/dist/hooks/use-option-start-time-rules.d.ts.map +1 -0
  58. package/dist/hooks/use-option-start-time-rules.js +12 -0
  59. package/dist/hooks/use-option-unit-price-rule-mutation.d.ts +79 -0
  60. package/dist/hooks/use-option-unit-price-rule-mutation.d.ts.map +1 -0
  61. package/dist/hooks/use-option-unit-price-rule-mutation.js +54 -0
  62. package/dist/hooks/use-option-unit-price-rule.d.ts +19 -0
  63. package/dist/hooks/use-option-unit-price-rule.d.ts.map +1 -0
  64. package/dist/hooks/use-option-unit-price-rule.js +12 -0
  65. package/dist/hooks/use-option-unit-price-rules.d.ts +25 -0
  66. package/dist/hooks/use-option-unit-price-rules.d.ts.map +1 -0
  67. package/dist/hooks/use-option-unit-price-rules.js +12 -0
  68. package/dist/hooks/use-option-unit-tier-mutation.d.ts +50 -0
  69. package/dist/hooks/use-option-unit-tier-mutation.d.ts.map +1 -0
  70. package/dist/hooks/use-option-unit-tier-mutation.js +48 -0
  71. package/dist/hooks/use-option-unit-tier.d.ts +14 -0
  72. package/dist/hooks/use-option-unit-tier.d.ts.map +1 -0
  73. package/dist/hooks/use-option-unit-tier.js +12 -0
  74. package/dist/hooks/use-option-unit-tiers.d.ts +20 -0
  75. package/dist/hooks/use-option-unit-tiers.d.ts.map +1 -0
  76. package/dist/hooks/use-option-unit-tiers.js +12 -0
  77. package/dist/hooks/use-pickup-price-rule-mutation.d.ts +64 -0
  78. package/dist/hooks/use-pickup-price-rule-mutation.d.ts.map +1 -0
  79. package/dist/hooks/use-pickup-price-rule-mutation.js +50 -0
  80. package/dist/hooks/use-pickup-price-rule.d.ts +16 -0
  81. package/dist/hooks/use-pickup-price-rule.d.ts.map +1 -0
  82. package/dist/hooks/use-pickup-price-rule.js +12 -0
  83. package/dist/hooks/use-pickup-price-rules.d.ts +22 -0
  84. package/dist/hooks/use-pickup-price-rules.d.ts.map +1 -0
  85. package/dist/hooks/use-pickup-price-rules.js +12 -0
  86. package/dist/hooks/use-price-catalog-mutation.d.ts +60 -0
  87. package/dist/hooks/use-price-catalog-mutation.d.ts.map +1 -0
  88. package/dist/hooks/use-price-catalog-mutation.js +51 -0
  89. package/dist/hooks/use-price-catalog.d.ts +14 -0
  90. package/dist/hooks/use-price-catalog.d.ts.map +1 -0
  91. package/dist/hooks/use-price-catalog.js +12 -0
  92. package/dist/hooks/use-price-catalogs.d.ts +20 -0
  93. package/dist/hooks/use-price-catalogs.d.ts.map +1 -0
  94. package/dist/hooks/use-price-catalogs.js +12 -0
  95. package/dist/hooks/use-price-schedule-mutation.d.ts +76 -0
  96. package/dist/hooks/use-price-schedule-mutation.d.ts.map +1 -0
  97. package/dist/hooks/use-price-schedule-mutation.js +64 -0
  98. package/dist/hooks/use-price-schedule.d.ts +18 -0
  99. package/dist/hooks/use-price-schedule.d.ts.map +1 -0
  100. package/dist/hooks/use-price-schedule.js +12 -0
  101. package/dist/hooks/use-price-schedules.d.ts +28 -0
  102. package/dist/hooks/use-price-schedules.d.ts.map +1 -0
  103. package/dist/hooks/use-price-schedules.js +11 -0
  104. package/dist/hooks/use-pricing-categories.d.ts +1 -1
  105. package/dist/hooks/use-pricing-categories.d.ts.map +1 -1
  106. package/dist/hooks/use-pricing-categories.js +2 -0
  107. package/dist/hooks/use-pricing-category-mutation.d.ts +2 -2
  108. package/dist/hooks/use-pricing-category.d.ts +1 -1
  109. package/dist/hooks/use-pricing-category.d.ts.map +1 -1
  110. package/dist/hooks/use-pricing-category.js +2 -8
  111. package/dist/index.d.ts +1 -0
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +1 -0
  114. package/dist/provider.d.ts +1 -13
  115. package/dist/provider.d.ts.map +1 -1
  116. package/dist/provider.js +1 -16
  117. package/dist/query-keys.d.ts +116 -0
  118. package/dist/query-keys.d.ts.map +1 -1
  119. package/dist/query-keys.js +33 -0
  120. package/dist/query-options.d.ts +1727 -0
  121. package/dist/query-options.d.ts.map +1 -0
  122. package/dist/query-options.js +409 -0
  123. package/dist/schemas.d.ts +688 -3
  124. package/dist/schemas.d.ts.map +1 -1
  125. package/dist/schemas.js +165 -0
  126. package/package.json +42 -46
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-options.d.ts","sourceRoot":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
1
+ "use client";
2
+ import { queryOptions } from "@tanstack/react-query";
3
+ import { fetchWithValidation } from "./client.js";
4
+ import { pricingQueryKeys } from "./query-keys.js";
5
+ import { cancellationPolicyListResponse, cancellationPolicyRuleListResponse, cancellationPolicyRuleSingleResponse, cancellationPolicySingleResponse, dropoffPriceRuleListResponse, dropoffPriceRuleSingleResponse, extraPriceRuleListResponse, extraPriceRuleSingleResponse, optionPriceRuleListResponse, optionPriceRuleSingleResponse, optionStartTimeRuleListResponse, optionStartTimeRuleSingleResponse, optionUnitPriceRuleListResponse, optionUnitPriceRuleSingleResponse, optionUnitTierListResponse, optionUnitTierSingleResponse, pickupPriceRuleListResponse, pickupPriceRuleSingleResponse, priceCatalogListResponse, priceCatalogSingleResponse, priceScheduleListResponse, priceScheduleSingleResponse, pricingCategoryDependencyListResponse, pricingCategoryListResponse, pricingCategorySingleResponse, } from "./schemas.js";
6
+ export function getPricingCategoryQueryOptions(client, id) {
7
+ return queryOptions({
8
+ queryKey: pricingQueryKeys.pricingCategory(id),
9
+ queryFn: async () => {
10
+ const { data } = await fetchWithValidation(`/v1/pricing/pricing-categories/${id}`, pricingCategorySingleResponse, client);
11
+ return data;
12
+ },
13
+ });
14
+ }
15
+ export function getPricingCategoriesQueryOptions(client, options = {}) {
16
+ const { enabled: _enabled = true, ...filters } = options;
17
+ return queryOptions({
18
+ queryKey: pricingQueryKeys.pricingCategoriesList(filters),
19
+ queryFn: () => {
20
+ const params = new URLSearchParams();
21
+ if (filters.productId)
22
+ params.set("productId", filters.productId);
23
+ if (filters.optionId)
24
+ params.set("optionId", filters.optionId);
25
+ if (filters.unitId)
26
+ params.set("unitId", filters.unitId);
27
+ if (filters.categoryType)
28
+ params.set("categoryType", filters.categoryType);
29
+ if (filters.active !== undefined)
30
+ params.set("active", String(filters.active));
31
+ if (filters.search)
32
+ params.set("search", filters.search);
33
+ if (filters.limit !== undefined)
34
+ params.set("limit", String(filters.limit));
35
+ if (filters.offset !== undefined)
36
+ params.set("offset", String(filters.offset));
37
+ const qs = params.toString();
38
+ return fetchWithValidation(`/v1/pricing/pricing-categories${qs ? `?${qs}` : ""}`, pricingCategoryListResponse, client);
39
+ },
40
+ });
41
+ }
42
+ export function getPricingCategoryDependenciesQueryOptions(client, options = {}) {
43
+ const { enabled: _enabled = true, ...filters } = options;
44
+ return queryOptions({
45
+ queryKey: pricingQueryKeys.pricingCategoryDependenciesList(filters),
46
+ queryFn: () => {
47
+ const params = new URLSearchParams();
48
+ if (filters.pricingCategoryId)
49
+ params.set("pricingCategoryId", filters.pricingCategoryId);
50
+ if (filters.masterPricingCategoryId) {
51
+ params.set("masterPricingCategoryId", filters.masterPricingCategoryId);
52
+ }
53
+ if (filters.dependencyType)
54
+ params.set("dependencyType", filters.dependencyType);
55
+ if (filters.active !== undefined)
56
+ params.set("active", String(filters.active));
57
+ if (filters.limit !== undefined)
58
+ params.set("limit", String(filters.limit));
59
+ if (filters.offset !== undefined)
60
+ params.set("offset", String(filters.offset));
61
+ const qs = params.toString();
62
+ return fetchWithValidation(`/v1/pricing/pricing-category-dependencies${qs ? `?${qs}` : ""}`, pricingCategoryDependencyListResponse, client);
63
+ },
64
+ });
65
+ }
66
+ export function getPriceCatalogsQueryOptions(client, options = {}) {
67
+ const { enabled: _enabled = true, ...filters } = options;
68
+ return queryOptions({
69
+ queryKey: pricingQueryKeys.priceCatalogsList(filters),
70
+ queryFn: () => {
71
+ const params = new URLSearchParams();
72
+ if (filters.search)
73
+ params.set("search", filters.search);
74
+ if (filters.limit !== undefined)
75
+ params.set("limit", String(filters.limit));
76
+ if (filters.offset !== undefined)
77
+ params.set("offset", String(filters.offset));
78
+ const qs = params.toString();
79
+ return fetchWithValidation(`/v1/pricing/price-catalogs${qs ? `?${qs}` : ""}`, priceCatalogListResponse, client);
80
+ },
81
+ });
82
+ }
83
+ export function getPriceCatalogQueryOptions(client, id) {
84
+ return queryOptions({
85
+ queryKey: [...pricingQueryKeys.priceCatalogs(), "detail", id],
86
+ queryFn: async () => {
87
+ const { data } = await fetchWithValidation(`/v1/pricing/price-catalogs/${id}`, priceCatalogSingleResponse, client);
88
+ return data;
89
+ },
90
+ });
91
+ }
92
+ export function getCancellationPoliciesQueryOptions(client, options = {}) {
93
+ const { enabled: _enabled = true, ...filters } = options;
94
+ return queryOptions({
95
+ queryKey: pricingQueryKeys.cancellationPoliciesList(filters),
96
+ queryFn: () => {
97
+ const params = new URLSearchParams();
98
+ if (filters.search)
99
+ params.set("search", filters.search);
100
+ if (filters.limit !== undefined)
101
+ params.set("limit", String(filters.limit));
102
+ if (filters.offset !== undefined)
103
+ params.set("offset", String(filters.offset));
104
+ const qs = params.toString();
105
+ return fetchWithValidation(`/v1/pricing/cancellation-policies${qs ? `?${qs}` : ""}`, cancellationPolicyListResponse, client);
106
+ },
107
+ });
108
+ }
109
+ export function getCancellationPolicyQueryOptions(client, id) {
110
+ return queryOptions({
111
+ queryKey: [...pricingQueryKeys.cancellationPolicies(), "detail", id],
112
+ queryFn: async () => {
113
+ const { data } = await fetchWithValidation(`/v1/pricing/cancellation-policies/${id}`, cancellationPolicySingleResponse, client);
114
+ return data;
115
+ },
116
+ });
117
+ }
118
+ export function getCancellationPolicyRulesQueryOptions(client, options = {}) {
119
+ const { enabled: _enabled = true, ...filters } = options;
120
+ return queryOptions({
121
+ queryKey: pricingQueryKeys.cancellationPolicyRulesList(filters),
122
+ queryFn: () => {
123
+ const params = new URLSearchParams();
124
+ if (filters.cancellationPolicyId) {
125
+ params.set("cancellationPolicyId", filters.cancellationPolicyId);
126
+ }
127
+ if (filters.active !== undefined)
128
+ params.set("active", String(filters.active));
129
+ if (filters.limit !== undefined)
130
+ params.set("limit", String(filters.limit));
131
+ if (filters.offset !== undefined)
132
+ params.set("offset", String(filters.offset));
133
+ const qs = params.toString();
134
+ return fetchWithValidation(`/v1/pricing/cancellation-policy-rules${qs ? `?${qs}` : ""}`, cancellationPolicyRuleListResponse, client);
135
+ },
136
+ });
137
+ }
138
+ export function getCancellationPolicyRuleQueryOptions(client, id) {
139
+ return queryOptions({
140
+ queryKey: pricingQueryKeys.cancellationPolicyRule(id),
141
+ queryFn: async () => {
142
+ const { data } = await fetchWithValidation(`/v1/pricing/cancellation-policy-rules/${id}`, cancellationPolicyRuleSingleResponse, client);
143
+ return data;
144
+ },
145
+ });
146
+ }
147
+ export function getPriceSchedulesQueryOptions(client, options = {}) {
148
+ const { enabled: _enabled = true, ...filters } = options;
149
+ return queryOptions({
150
+ queryKey: pricingQueryKeys.priceSchedulesList(filters),
151
+ queryFn: () => {
152
+ const params = new URLSearchParams();
153
+ if (filters.priceCatalogId)
154
+ params.set("priceCatalogId", filters.priceCatalogId);
155
+ if (filters.active !== undefined)
156
+ params.set("active", String(filters.active));
157
+ if (filters.search)
158
+ params.set("search", filters.search);
159
+ if (filters.limit !== undefined)
160
+ params.set("limit", String(filters.limit));
161
+ if (filters.offset !== undefined)
162
+ params.set("offset", String(filters.offset));
163
+ const qs = params.toString();
164
+ return fetchWithValidation(`/v1/pricing/price-schedules${qs ? `?${qs}` : ""}`, priceScheduleListResponse, client);
165
+ },
166
+ });
167
+ }
168
+ export function getPriceScheduleQueryOptions(client, id) {
169
+ return queryOptions({
170
+ queryKey: [...pricingQueryKeys.priceSchedules(), "detail", id],
171
+ queryFn: async () => {
172
+ const { data } = await fetchWithValidation(`/v1/pricing/price-schedules/${id}`, priceScheduleSingleResponse, client);
173
+ return data;
174
+ },
175
+ });
176
+ }
177
+ export function getOptionPriceRulesQueryOptions(client, options = {}) {
178
+ const { enabled: _enabled = true, ...filters } = options;
179
+ return queryOptions({
180
+ queryKey: pricingQueryKeys.optionPriceRulesList(filters),
181
+ queryFn: () => {
182
+ const params = new URLSearchParams();
183
+ if (filters.productId)
184
+ params.set("productId", filters.productId);
185
+ if (filters.optionId)
186
+ params.set("optionId", filters.optionId);
187
+ if (filters.priceCatalogId)
188
+ params.set("priceCatalogId", filters.priceCatalogId);
189
+ if (filters.priceScheduleId)
190
+ params.set("priceScheduleId", filters.priceScheduleId);
191
+ if (filters.cancellationPolicyId) {
192
+ params.set("cancellationPolicyId", filters.cancellationPolicyId);
193
+ }
194
+ if (filters.pricingMode)
195
+ params.set("pricingMode", filters.pricingMode);
196
+ if (filters.active !== undefined)
197
+ params.set("active", String(filters.active));
198
+ if (filters.limit !== undefined)
199
+ params.set("limit", String(filters.limit));
200
+ if (filters.offset !== undefined)
201
+ params.set("offset", String(filters.offset));
202
+ const qs = params.toString();
203
+ return fetchWithValidation(`/v1/pricing/option-price-rules${qs ? `?${qs}` : ""}`, optionPriceRuleListResponse, client);
204
+ },
205
+ });
206
+ }
207
+ export function getOptionPriceRuleQueryOptions(client, id) {
208
+ return queryOptions({
209
+ queryKey: pricingQueryKeys.optionPriceRule(id),
210
+ queryFn: async () => {
211
+ const { data } = await fetchWithValidation(`/v1/pricing/option-price-rules/${id}`, optionPriceRuleSingleResponse, client);
212
+ return data;
213
+ },
214
+ });
215
+ }
216
+ export function getOptionUnitPriceRulesQueryOptions(client, options = {}) {
217
+ const { enabled: _enabled = true, ...filters } = options;
218
+ return queryOptions({
219
+ queryKey: pricingQueryKeys.optionUnitPriceRulesList(filters),
220
+ queryFn: () => {
221
+ const params = new URLSearchParams();
222
+ if (filters.optionPriceRuleId)
223
+ params.set("optionPriceRuleId", filters.optionPriceRuleId);
224
+ if (filters.optionId)
225
+ params.set("optionId", filters.optionId);
226
+ if (filters.unitId)
227
+ params.set("unitId", filters.unitId);
228
+ if (filters.pricingCategoryId)
229
+ params.set("pricingCategoryId", filters.pricingCategoryId);
230
+ if (filters.active !== undefined)
231
+ params.set("active", String(filters.active));
232
+ if (filters.limit !== undefined)
233
+ params.set("limit", String(filters.limit));
234
+ if (filters.offset !== undefined)
235
+ params.set("offset", String(filters.offset));
236
+ const qs = params.toString();
237
+ return fetchWithValidation(`/v1/pricing/option-unit-price-rules${qs ? `?${qs}` : ""}`, optionUnitPriceRuleListResponse, client);
238
+ },
239
+ });
240
+ }
241
+ export function getOptionUnitPriceRuleQueryOptions(client, id) {
242
+ return queryOptions({
243
+ queryKey: pricingQueryKeys.optionUnitPriceRule(id),
244
+ queryFn: async () => {
245
+ const { data } = await fetchWithValidation(`/v1/pricing/option-unit-price-rules/${id}`, optionUnitPriceRuleSingleResponse, client);
246
+ return data;
247
+ },
248
+ });
249
+ }
250
+ export function getOptionUnitTiersQueryOptions(client, options = {}) {
251
+ const { enabled: _enabled = true, ...filters } = options;
252
+ return queryOptions({
253
+ queryKey: pricingQueryKeys.optionUnitTiersList(filters),
254
+ queryFn: () => {
255
+ const params = new URLSearchParams();
256
+ if (filters.optionUnitPriceRuleId) {
257
+ params.set("optionUnitPriceRuleId", filters.optionUnitPriceRuleId);
258
+ }
259
+ if (filters.active !== undefined)
260
+ params.set("active", String(filters.active));
261
+ if (filters.limit !== undefined)
262
+ params.set("limit", String(filters.limit));
263
+ if (filters.offset !== undefined)
264
+ params.set("offset", String(filters.offset));
265
+ const qs = params.toString();
266
+ return fetchWithValidation(`/v1/pricing/option-unit-tiers${qs ? `?${qs}` : ""}`, optionUnitTierListResponse, client);
267
+ },
268
+ });
269
+ }
270
+ export function getOptionUnitTierQueryOptions(client, id) {
271
+ return queryOptions({
272
+ queryKey: pricingQueryKeys.optionUnitTier(id),
273
+ queryFn: async () => {
274
+ const { data } = await fetchWithValidation(`/v1/pricing/option-unit-tiers/${id}`, optionUnitTierSingleResponse, client);
275
+ return data;
276
+ },
277
+ });
278
+ }
279
+ export function getPickupPriceRulesQueryOptions(client, options = {}) {
280
+ const { enabled: _enabled = true, ...filters } = options;
281
+ return queryOptions({
282
+ queryKey: pricingQueryKeys.pickupPriceRulesList(filters),
283
+ queryFn: () => {
284
+ const params = new URLSearchParams();
285
+ if (filters.optionPriceRuleId)
286
+ params.set("optionPriceRuleId", filters.optionPriceRuleId);
287
+ if (filters.optionId)
288
+ params.set("optionId", filters.optionId);
289
+ if (filters.pickupPointId)
290
+ params.set("pickupPointId", filters.pickupPointId);
291
+ if (filters.active !== undefined)
292
+ params.set("active", String(filters.active));
293
+ if (filters.limit !== undefined)
294
+ params.set("limit", String(filters.limit));
295
+ if (filters.offset !== undefined)
296
+ params.set("offset", String(filters.offset));
297
+ const qs = params.toString();
298
+ return fetchWithValidation(`/v1/pricing/pickup-price-rules${qs ? `?${qs}` : ""}`, pickupPriceRuleListResponse, client);
299
+ },
300
+ });
301
+ }
302
+ export function getPickupPriceRuleQueryOptions(client, id) {
303
+ return queryOptions({
304
+ queryKey: pricingQueryKeys.pickupPriceRule(id),
305
+ queryFn: async () => {
306
+ const { data } = await fetchWithValidation(`/v1/pricing/pickup-price-rules/${id}`, pickupPriceRuleSingleResponse, client);
307
+ return data;
308
+ },
309
+ });
310
+ }
311
+ export function getDropoffPriceRulesQueryOptions(client, options = {}) {
312
+ const { enabled: _enabled = true, ...filters } = options;
313
+ return queryOptions({
314
+ queryKey: pricingQueryKeys.dropoffPriceRulesList(filters),
315
+ queryFn: () => {
316
+ const params = new URLSearchParams();
317
+ if (filters.optionPriceRuleId)
318
+ params.set("optionPriceRuleId", filters.optionPriceRuleId);
319
+ if (filters.optionId)
320
+ params.set("optionId", filters.optionId);
321
+ if (filters.facilityId)
322
+ params.set("facilityId", filters.facilityId);
323
+ if (filters.active !== undefined)
324
+ params.set("active", String(filters.active));
325
+ if (filters.limit !== undefined)
326
+ params.set("limit", String(filters.limit));
327
+ if (filters.offset !== undefined)
328
+ params.set("offset", String(filters.offset));
329
+ const qs = params.toString();
330
+ return fetchWithValidation(`/v1/pricing/dropoff-price-rules${qs ? `?${qs}` : ""}`, dropoffPriceRuleListResponse, client);
331
+ },
332
+ });
333
+ }
334
+ export function getDropoffPriceRuleQueryOptions(client, id) {
335
+ return queryOptions({
336
+ queryKey: pricingQueryKeys.dropoffPriceRule(id),
337
+ queryFn: async () => {
338
+ const { data } = await fetchWithValidation(`/v1/pricing/dropoff-price-rules/${id}`, dropoffPriceRuleSingleResponse, client);
339
+ return data;
340
+ },
341
+ });
342
+ }
343
+ export function getExtraPriceRulesQueryOptions(client, options = {}) {
344
+ const { enabled: _enabled = true, ...filters } = options;
345
+ return queryOptions({
346
+ queryKey: pricingQueryKeys.extraPriceRulesList(filters),
347
+ queryFn: () => {
348
+ const params = new URLSearchParams();
349
+ if (filters.optionPriceRuleId)
350
+ params.set("optionPriceRuleId", filters.optionPriceRuleId);
351
+ if (filters.optionId)
352
+ params.set("optionId", filters.optionId);
353
+ if (filters.productExtraId)
354
+ params.set("productExtraId", filters.productExtraId);
355
+ if (filters.optionExtraConfigId) {
356
+ params.set("optionExtraConfigId", filters.optionExtraConfigId);
357
+ }
358
+ if (filters.active !== undefined)
359
+ params.set("active", String(filters.active));
360
+ if (filters.limit !== undefined)
361
+ params.set("limit", String(filters.limit));
362
+ if (filters.offset !== undefined)
363
+ params.set("offset", String(filters.offset));
364
+ const qs = params.toString();
365
+ return fetchWithValidation(`/v1/pricing/extra-price-rules${qs ? `?${qs}` : ""}`, extraPriceRuleListResponse, client);
366
+ },
367
+ });
368
+ }
369
+ export function getExtraPriceRuleQueryOptions(client, id) {
370
+ return queryOptions({
371
+ queryKey: pricingQueryKeys.extraPriceRule(id),
372
+ queryFn: async () => {
373
+ const { data } = await fetchWithValidation(`/v1/pricing/extra-price-rules/${id}`, extraPriceRuleSingleResponse, client);
374
+ return data;
375
+ },
376
+ });
377
+ }
378
+ export function getOptionStartTimeRulesQueryOptions(client, options = {}) {
379
+ const { enabled: _enabled = true, ...filters } = options;
380
+ return queryOptions({
381
+ queryKey: pricingQueryKeys.optionStartTimeRulesList(filters),
382
+ queryFn: () => {
383
+ const params = new URLSearchParams();
384
+ if (filters.optionPriceRuleId)
385
+ params.set("optionPriceRuleId", filters.optionPriceRuleId);
386
+ if (filters.optionId)
387
+ params.set("optionId", filters.optionId);
388
+ if (filters.startTimeId)
389
+ params.set("startTimeId", filters.startTimeId);
390
+ if (filters.active !== undefined)
391
+ params.set("active", String(filters.active));
392
+ if (filters.limit !== undefined)
393
+ params.set("limit", String(filters.limit));
394
+ if (filters.offset !== undefined)
395
+ params.set("offset", String(filters.offset));
396
+ const qs = params.toString();
397
+ return fetchWithValidation(`/v1/pricing/option-start-time-rules${qs ? `?${qs}` : ""}`, optionStartTimeRuleListResponse, client);
398
+ },
399
+ });
400
+ }
401
+ export function getOptionStartTimeRuleQueryOptions(client, id) {
402
+ return queryOptions({
403
+ queryKey: pricingQueryKeys.optionStartTimeRule(id),
404
+ queryFn: async () => {
405
+ const { data } = await fetchWithValidation(`/v1/pricing/option-start-time-rules/${id}`, optionStartTimeRuleSingleResponse, client);
406
+ return data;
407
+ },
408
+ });
409
+ }