@atomic-solutions/woocommerce-react 0.1.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.
@@ -0,0 +1,1159 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var reactQuery = require('@tanstack/react-query');
5
+ var woocommerceUtils = require('@atomic-solutions/woocommerce-utils');
6
+
7
+ // src/hooks/useWooCommerceClient.ts
8
+ var WooCommerceContext = react.createContext(null);
9
+
10
+ // src/hooks/useWooCommerceClient.ts
11
+ var useWooCommerceClient = () => {
12
+ const context = react.useContext(WooCommerceContext);
13
+ if (!context) {
14
+ throw new Error(
15
+ "useWooCommerceClient must be used within WooCommerceProvider. Wrap your app with <WooCommerceProvider client={client} queryKeys={queryKeys}>."
16
+ );
17
+ }
18
+ return context.client;
19
+ };
20
+ var useWooCommerceQueryKeys = () => {
21
+ const context = react.useContext(WooCommerceContext);
22
+ if (!context) {
23
+ throw new Error(
24
+ "useWooCommerceQueryKeys must be used within WooCommerceProvider. Wrap your app with <WooCommerceProvider client={client} queryKeys={queryKeys}>."
25
+ );
26
+ }
27
+ return context.queryKeys;
28
+ };
29
+
30
+ // src/constants/stale-times.ts
31
+ var STALE_TIME_SHORT = 60 * 1e3;
32
+ var STALE_TIME_LONG = 60 * 60 * 1e3;
33
+ var STALE_TIME_NONE = 0;
34
+ var StaleTimes = {
35
+ /** Cart data - always fresh */
36
+ cart: STALE_TIME_NONE,
37
+ /** Checkout data - always fresh */
38
+ checkout: STALE_TIME_NONE,
39
+ /** Product list - 1 minute */
40
+ products: STALE_TIME_SHORT,
41
+ /** Product detail - 1 minute */
42
+ product: STALE_TIME_SHORT,
43
+ /** Product categories - always fresh */
44
+ categories: STALE_TIME_NONE,
45
+ /** Orders - always fresh */
46
+ orders: STALE_TIME_NONE,
47
+ /** Default for infinite queries - 1 hour */
48
+ infinite: STALE_TIME_LONG
49
+ };
50
+ var useInfiniteWooQuery = ({
51
+ queryKey,
52
+ queryFn,
53
+ params,
54
+ perPage = 10,
55
+ staleTime = StaleTimes.infinite,
56
+ enabled
57
+ }) => {
58
+ const query = reactQuery.useInfiniteQuery({
59
+ queryKey,
60
+ queryFn: ({ pageParam }) => queryFn({
61
+ per_page: perPage,
62
+ ...params,
63
+ page: pageParam
64
+ }),
65
+ initialPageParam: 1,
66
+ getNextPageParam: (lastPage) => lastPage.pagination.nextPage,
67
+ getPreviousPageParam: (firstPage) => firstPage.pagination.prevPage,
68
+ staleTime,
69
+ enabled
70
+ });
71
+ const flatData = query.data?.pages.flatMap((page) => page.data) ?? [];
72
+ return {
73
+ ...query,
74
+ data: flatData
75
+ // Override data with flattened array
76
+ };
77
+ };
78
+
79
+ // src/hooks/products.ts
80
+ var useProducts = (params) => {
81
+ const client = useWooCommerceClient();
82
+ const queryKeys = useWooCommerceQueryKeys();
83
+ return reactQuery.useQuery({
84
+ queryKey: queryKeys.products.list(params),
85
+ queryFn: () => client.products.list(params),
86
+ staleTime: StaleTimes.products
87
+ });
88
+ };
89
+ var useInfiniteProducts = (params) => {
90
+ const client = useWooCommerceClient();
91
+ const queryKeys = useWooCommerceQueryKeys();
92
+ return useInfiniteWooQuery({
93
+ queryKey: queryKeys.products.list(params),
94
+ queryFn: (p) => client.products.list({ ...p, page: p.page ?? 1 }),
95
+ params,
96
+ perPage: params?.per_page ?? 10
97
+ });
98
+ };
99
+ var useProduct = (id) => {
100
+ const client = useWooCommerceClient();
101
+ const queryKeys = useWooCommerceQueryKeys();
102
+ return reactQuery.useQuery({
103
+ queryKey: queryKeys.products.detail(id),
104
+ queryFn: () => client.products.get(id),
105
+ staleTime: StaleTimes.product
106
+ });
107
+ };
108
+ var useProductCategories = () => {
109
+ const client = useWooCommerceClient();
110
+ const queryKeys = useWooCommerceQueryKeys();
111
+ return reactQuery.useQuery({
112
+ queryKey: queryKeys.products.categories(),
113
+ queryFn: () => client.products.categories(),
114
+ staleTime: StaleTimes.categories
115
+ });
116
+ };
117
+ var groupBy = (fn, list) => {
118
+ return list.reduce(
119
+ (acc, item) => {
120
+ const key = fn(item);
121
+ if (!acc[key]) {
122
+ acc[key] = [];
123
+ }
124
+ acc[key].push(item);
125
+ return acc;
126
+ },
127
+ {}
128
+ );
129
+ };
130
+ var processCategoriesToTree = (data) => {
131
+ const rootCategories = data?.filter((item) => item.parent === 0);
132
+ const indexedData = groupBy((item) => String(item.parent), data ?? []);
133
+ const processCategory = (item) => ({
134
+ ...item,
135
+ subCategories: indexedData[item.id]?.map(processCategory)
136
+ });
137
+ return rootCategories?.map(processCategory) ?? [];
138
+ };
139
+ var useProductCategoryTree = () => {
140
+ const query = useProductCategories();
141
+ const flatData = query.data ?? [];
142
+ const treeData = processCategoriesToTree(flatData);
143
+ const findById = (id) => {
144
+ if (!id) return;
145
+ const numId = typeof id === "string" ? parseInt(id, 10) : id;
146
+ return flatData.find((item) => item.id === numId);
147
+ };
148
+ return {
149
+ ...query,
150
+ data: flatData,
151
+ treeData,
152
+ findById
153
+ };
154
+ };
155
+ var EventContext = react.createContext(null);
156
+ var useEventEmitter = () => {
157
+ return react.useContext(EventContext);
158
+ };
159
+
160
+ // src/events/types.ts
161
+ function createSuccessEvent(type, data) {
162
+ return { type, status: "success", data };
163
+ }
164
+ function createErrorEvent(type, error) {
165
+ return { type, status: "error", error };
166
+ }
167
+
168
+ // src/hooks/cart.ts
169
+ var useCart = () => {
170
+ const client = useWooCommerceClient();
171
+ const queryKeys = useWooCommerceQueryKeys();
172
+ const query = reactQuery.useQuery({
173
+ queryKey: queryKeys.cart.details(),
174
+ queryFn: () => client.cart.get(),
175
+ staleTime: StaleTimes.cart
176
+ });
177
+ const cart = query.data;
178
+ const isInCart = (productId) => {
179
+ return cart?.items.some((item) => item.id === productId) ?? false;
180
+ };
181
+ const getCartItem = (productId) => {
182
+ return cart?.items.find((item) => item.id === productId);
183
+ };
184
+ const getQuantity = (productId) => {
185
+ return getCartItem(productId)?.quantity ?? 0;
186
+ };
187
+ return {
188
+ ...query,
189
+ isInCart,
190
+ getCartItem,
191
+ getQuantity
192
+ };
193
+ };
194
+ var useAddToCart = () => {
195
+ const client = useWooCommerceClient();
196
+ const queryKeys = useWooCommerceQueryKeys();
197
+ const queryClient = reactQuery.useQueryClient();
198
+ const emitEvent = useEventEmitter();
199
+ return reactQuery.useMutation({
200
+ mutationKey: queryKeys.cart.mutations.addItem(),
201
+ mutationFn: (input) => client.cart.addItem(input),
202
+ onSuccess: (cart, input) => {
203
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
204
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
205
+ const addedItem = cart.items.find((item) => item.id === input.id);
206
+ if (emitEvent && addedItem) {
207
+ emitEvent(createSuccessEvent("cart:item_added", { item: addedItem, cart }));
208
+ }
209
+ },
210
+ onError: (error) => {
211
+ if (emitEvent) {
212
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
213
+ code: "unknown_error",
214
+ message: error instanceof Error ? error.message : "Unknown error",
215
+ statusCode: 500,
216
+ url: "",
217
+ method: "POST",
218
+ originalCode: "unknown_error"
219
+ });
220
+ emitEvent(createErrorEvent("cart:item_added", wooError));
221
+ }
222
+ }
223
+ });
224
+ };
225
+ var useUpdateCartItem = () => {
226
+ const client = useWooCommerceClient();
227
+ const queryKeys = useWooCommerceQueryKeys();
228
+ const queryClient = reactQuery.useQueryClient();
229
+ const emitEvent = useEventEmitter();
230
+ return reactQuery.useMutation({
231
+ mutationKey: queryKeys.cart.mutations.updateItem(),
232
+ mutationFn: (input) => client.cart.updateItem(input),
233
+ onSuccess: (cart, input) => {
234
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
235
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
236
+ const updatedItem = cart.items.find((item) => item.key === input.key);
237
+ if (emitEvent && updatedItem) {
238
+ emitEvent(createSuccessEvent("cart:item_updated", { item: updatedItem, cart }));
239
+ }
240
+ },
241
+ onError: (error) => {
242
+ if (emitEvent) {
243
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
244
+ code: "unknown_error",
245
+ message: error instanceof Error ? error.message : "Unknown error",
246
+ statusCode: 500,
247
+ url: "",
248
+ method: "POST",
249
+ originalCode: "unknown_error"
250
+ });
251
+ emitEvent(createErrorEvent("cart:item_updated", wooError));
252
+ }
253
+ }
254
+ });
255
+ };
256
+ var useRemoveFromCart = () => {
257
+ const client = useWooCommerceClient();
258
+ const queryKeys = useWooCommerceQueryKeys();
259
+ const queryClient = reactQuery.useQueryClient();
260
+ const emitEvent = useEventEmitter();
261
+ return reactQuery.useMutation({
262
+ mutationKey: queryKeys.cart.mutations.removeItem(),
263
+ mutationFn: (input) => client.cart.removeItem(input),
264
+ onSuccess: (cart, input) => {
265
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
266
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
267
+ if (emitEvent) {
268
+ emitEvent(createSuccessEvent("cart:item_removed", { itemKey: input.key, cart }));
269
+ }
270
+ },
271
+ onError: (error) => {
272
+ if (emitEvent) {
273
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
274
+ code: "unknown_error",
275
+ message: error instanceof Error ? error.message : "Unknown error",
276
+ statusCode: 500,
277
+ url: "",
278
+ method: "POST",
279
+ originalCode: "unknown_error"
280
+ });
281
+ emitEvent(createErrorEvent("cart:item_removed", wooError));
282
+ }
283
+ }
284
+ });
285
+ };
286
+ var useApplyCoupon = () => {
287
+ const client = useWooCommerceClient();
288
+ const queryKeys = useWooCommerceQueryKeys();
289
+ const queryClient = reactQuery.useQueryClient();
290
+ const emitEvent = useEventEmitter();
291
+ return reactQuery.useMutation({
292
+ mutationKey: queryKeys.cart.mutations.applyCoupon(),
293
+ mutationFn: (input) => client.cart.applyCoupon(input),
294
+ onSuccess: (cart, input) => {
295
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
296
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
297
+ if (emitEvent) {
298
+ emitEvent(createSuccessEvent("cart:coupon_applied", { code: input.code, cart }));
299
+ }
300
+ },
301
+ onError: (error) => {
302
+ if (emitEvent) {
303
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
304
+ code: "unknown_error",
305
+ message: error instanceof Error ? error.message : "Unknown error",
306
+ statusCode: 500,
307
+ url: "",
308
+ method: "POST",
309
+ originalCode: "unknown_error"
310
+ });
311
+ emitEvent(createErrorEvent("cart:coupon_applied", wooError));
312
+ }
313
+ }
314
+ });
315
+ };
316
+ var useRemoveCoupon = () => {
317
+ const client = useWooCommerceClient();
318
+ const queryKeys = useWooCommerceQueryKeys();
319
+ const queryClient = reactQuery.useQueryClient();
320
+ const emitEvent = useEventEmitter();
321
+ return reactQuery.useMutation({
322
+ mutationKey: queryKeys.cart.mutations.removeCoupon(),
323
+ mutationFn: (input) => client.cart.removeCoupon(input),
324
+ onSuccess: (cart, input) => {
325
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
326
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
327
+ if (emitEvent) {
328
+ emitEvent(createSuccessEvent("cart:coupon_removed", { code: input.code, cart }));
329
+ }
330
+ },
331
+ onError: (error) => {
332
+ if (emitEvent) {
333
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
334
+ code: "unknown_error",
335
+ message: error instanceof Error ? error.message : "Unknown error",
336
+ statusCode: 500,
337
+ url: "",
338
+ method: "POST",
339
+ originalCode: "unknown_error"
340
+ });
341
+ emitEvent(createErrorEvent("cart:coupon_removed", wooError));
342
+ }
343
+ }
344
+ });
345
+ };
346
+ var useUpdateCustomer = () => {
347
+ const client = useWooCommerceClient();
348
+ const queryKeys = useWooCommerceQueryKeys();
349
+ const queryClient = reactQuery.useQueryClient();
350
+ const emitEvent = useEventEmitter();
351
+ return reactQuery.useMutation({
352
+ mutationKey: queryKeys.cart.mutations.updateCustomer(),
353
+ mutationFn: (input) => client.cart.updateCustomer(input),
354
+ onSuccess: (cart) => {
355
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
356
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
357
+ if (emitEvent) {
358
+ emitEvent(createSuccessEvent("cart:customer_updated", { cart }));
359
+ }
360
+ },
361
+ onError: (error) => {
362
+ if (emitEvent) {
363
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
364
+ code: "unknown_error",
365
+ message: error instanceof Error ? error.message : "Unknown error",
366
+ statusCode: 500,
367
+ url: "",
368
+ method: "POST",
369
+ originalCode: "unknown_error"
370
+ });
371
+ emitEvent(createErrorEvent("cart:customer_updated", wooError));
372
+ }
373
+ }
374
+ });
375
+ };
376
+ var useSelectShippingRate = () => {
377
+ const client = useWooCommerceClient();
378
+ const queryKeys = useWooCommerceQueryKeys();
379
+ const queryClient = reactQuery.useQueryClient();
380
+ const emitEvent = useEventEmitter();
381
+ return reactQuery.useMutation({
382
+ mutationKey: queryKeys.cart.mutations.selectShippingRate(),
383
+ mutationFn: (input) => client.cart.selectShippingRate(input),
384
+ onSuccess: (cart) => {
385
+ queryClient.setQueryData(queryKeys.cart.details(), cart);
386
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
387
+ if (emitEvent) {
388
+ emitEvent(createSuccessEvent("cart:shipping_selected", { cart }));
389
+ }
390
+ },
391
+ onError: (error) => {
392
+ if (emitEvent) {
393
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
394
+ code: "unknown_error",
395
+ message: error instanceof Error ? error.message : "Unknown error",
396
+ statusCode: 500,
397
+ url: "",
398
+ method: "POST",
399
+ originalCode: "unknown_error"
400
+ });
401
+ emitEvent(createErrorEvent("cart:shipping_selected", wooError));
402
+ }
403
+ }
404
+ });
405
+ };
406
+ var useCheckout = () => {
407
+ const client = useWooCommerceClient();
408
+ const queryKeys = useWooCommerceQueryKeys();
409
+ return reactQuery.useQuery({
410
+ queryKey: queryKeys.checkout.details(),
411
+ queryFn: () => client.checkout.get(),
412
+ staleTime: StaleTimes.checkout
413
+ });
414
+ };
415
+ var useProcessCheckout = () => {
416
+ const client = useWooCommerceClient();
417
+ const queryKeys = useWooCommerceQueryKeys();
418
+ const queryClient = reactQuery.useQueryClient();
419
+ const emitEvent = useEventEmitter();
420
+ return reactQuery.useMutation({
421
+ mutationKey: queryKeys.checkout.mutations.process(),
422
+ mutationFn: (input) => client.checkout.process(input),
423
+ onSuccess: (checkout) => {
424
+ queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
425
+ queryClient.invalidateQueries({ queryKey: queryKeys.checkout.all });
426
+ if (emitEvent) {
427
+ emitEvent(createSuccessEvent("checkout:processed", { checkout }));
428
+ }
429
+ },
430
+ onError: (error) => {
431
+ if (emitEvent) {
432
+ const wooError = error instanceof woocommerceUtils.WooCommerceApiError ? error : new woocommerceUtils.WooCommerceApiError({
433
+ code: "unknown_error",
434
+ message: error instanceof Error ? error.message : "Unknown error",
435
+ statusCode: 500,
436
+ url: "",
437
+ method: "POST",
438
+ originalCode: "unknown_error"
439
+ });
440
+ emitEvent(createErrorEvent("checkout:processed", wooError));
441
+ }
442
+ }
443
+ });
444
+ };
445
+ var useOrder = (input) => {
446
+ const client = useWooCommerceClient();
447
+ const queryKeys = useWooCommerceQueryKeys();
448
+ return reactQuery.useQuery({
449
+ queryKey: queryKeys.orders.detail(input.id, input.billing_email, input.key),
450
+ queryFn: () => client.orders.get(input),
451
+ staleTime: StaleTimes.orders
452
+ });
453
+ };
454
+
455
+ // src/hooks/queryKeys.ts
456
+ var createQueryKeys = (prefix = ["woocommerce"]) => ({
457
+ // All keys start with prefix
458
+ all: prefix,
459
+ // Products
460
+ products: {
461
+ all: [...prefix, "products"],
462
+ lists: () => [...prefix, "products", "list"],
463
+ list: (params) => [...prefix, "products", "list", params],
464
+ details: () => [...prefix, "products", "detail"],
465
+ detail: (id) => [...prefix, "products", "detail", id],
466
+ categories: () => [...prefix, "products", "categories"]
467
+ },
468
+ // Cart
469
+ cart: {
470
+ all: [...prefix, "cart"],
471
+ details: () => [...prefix, "cart", "details"],
472
+ // Mutation keys
473
+ mutations: {
474
+ addItem: () => [...prefix, "cart", "mutation", "addItem"],
475
+ updateItem: () => [...prefix, "cart", "mutation", "updateItem"],
476
+ removeItem: () => [...prefix, "cart", "mutation", "removeItem"],
477
+ applyCoupon: () => [...prefix, "cart", "mutation", "applyCoupon"],
478
+ removeCoupon: () => [...prefix, "cart", "mutation", "removeCoupon"],
479
+ updateCustomer: () => [...prefix, "cart", "mutation", "updateCustomer"],
480
+ selectShippingRate: () => [...prefix, "cart", "mutation", "selectShippingRate"]
481
+ }
482
+ },
483
+ // Checkout
484
+ checkout: {
485
+ all: [...prefix, "checkout"],
486
+ details: () => [...prefix, "checkout", "details"],
487
+ // Mutation keys
488
+ mutations: {
489
+ process: () => [...prefix, "checkout", "mutation", "process"]
490
+ }
491
+ },
492
+ // Orders
493
+ orders: {
494
+ all: [...prefix, "orders"],
495
+ lists: () => [...prefix, "orders", "list"],
496
+ list: (params) => [...prefix, "orders", "list", params],
497
+ details: () => [...prefix, "orders", "detail"],
498
+ detail: (id, billing_email, key) => [...prefix, "orders", "detail", id, billing_email, key].filter(Boolean)
499
+ }
500
+ });
501
+ var WooCommerceStoreContext = react.createContext(null);
502
+ WooCommerceStoreContext.displayName = "WooCommerceStoreContext";
503
+
504
+ // src/hooks/useStore.ts
505
+ function useStore() {
506
+ const context = react.useContext(WooCommerceStoreContext);
507
+ if (!context) {
508
+ throw new Error("useStore must be used within a WooCommerceStoreProvider");
509
+ }
510
+ return context;
511
+ }
512
+ function useStoreFeatures() {
513
+ const { config } = useStore();
514
+ return config.features;
515
+ }
516
+ function useStoreLocale() {
517
+ const { config } = useStore();
518
+ return config.locale;
519
+ }
520
+ var DEFAULT_THEME = {
521
+ primary: "#007AFF",
522
+ // iOS blue
523
+ secondary: "#5856D6",
524
+ // iOS purple
525
+ mode: "auto",
526
+ fonts: {
527
+ heading: void 0,
528
+ body: void 0
529
+ }
530
+ };
531
+ function useStoreTheme(options = {}) {
532
+ const { externalTheme } = options;
533
+ const storeContext = react.useContext(WooCommerceStoreContext);
534
+ const storeTheme = storeContext?.config?.theme;
535
+ const theme = react.useMemo(() => {
536
+ return {
537
+ primary: externalTheme?.primary ?? storeTheme?.primary ?? DEFAULT_THEME.primary,
538
+ secondary: externalTheme?.secondary ?? storeTheme?.secondary ?? DEFAULT_THEME.secondary,
539
+ mode: externalTheme?.mode ?? storeTheme?.mode ?? DEFAULT_THEME.mode,
540
+ fonts: {
541
+ heading: externalTheme?.fonts?.heading ?? storeTheme?.fonts?.heading ?? DEFAULT_THEME.fonts.heading,
542
+ body: externalTheme?.fonts?.body ?? storeTheme?.fonts?.body ?? DEFAULT_THEME.fonts.body
543
+ }
544
+ };
545
+ }, [externalTheme, storeTheme]);
546
+ return {
547
+ theme,
548
+ storeTheme,
549
+ hasExternalTheme: !!externalTheme
550
+ };
551
+ }
552
+
553
+ // src/provider/types.ts
554
+ var DEFAULT_STORE_CONFIG = {
555
+ locale: {
556
+ localeTag: "en-US"},
557
+ debug: process.env.NODE_ENV !== "production"
558
+ };
559
+
560
+ // src/utils/price.ts
561
+ var DEFAULT_LOCALE = {
562
+ localeTag: "en-US",
563
+ currency: "USD",
564
+ currencyPosition: "before",
565
+ thousandsSeparator: ",",
566
+ decimalSeparator: ".",
567
+ decimals: 2
568
+ };
569
+ var CURRENCY_SYMBOLS = {
570
+ USD: "$",
571
+ EUR: "\u20AC",
572
+ GBP: "\xA3",
573
+ CAD: "CA$",
574
+ AUD: "A$",
575
+ JPY: "\xA5",
576
+ CNY: "\xA5",
577
+ INR: "\u20B9",
578
+ BRL: "R$",
579
+ MXN: "MX$",
580
+ RUB: "\u20BD",
581
+ KRW: "\u20A9",
582
+ CHF: "CHF",
583
+ SEK: "kr",
584
+ NOK: "kr",
585
+ DKK: "kr",
586
+ PLN: "z\u0142",
587
+ TRY: "\u20BA",
588
+ ZAR: "R",
589
+ NZD: "NZ$",
590
+ SGD: "S$",
591
+ HKD: "HK$",
592
+ THB: "\u0E3F",
593
+ PHP: "\u20B1",
594
+ // Balkans
595
+ BAM: "KM",
596
+ RSD: "din",
597
+ HRK: "kn",
598
+ MKD: "\u0434\u0435\u043D",
599
+ BGN: "\u043B\u0432",
600
+ RON: "lei"
601
+ };
602
+ function getCurrencySymbol(currencyCode) {
603
+ return CURRENCY_SYMBOLS[currencyCode.toUpperCase()] ?? currencyCode;
604
+ }
605
+ function formatNumber(value, locale) {
606
+ const fixed = value.toFixed(locale.decimals);
607
+ const [integerPart, decimalPart] = fixed.split(".");
608
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, locale.thousandsSeparator);
609
+ if (locale.decimals > 0 && decimalPart) {
610
+ return `${formattedInteger}${locale.decimalSeparator}${decimalPart}`;
611
+ }
612
+ return formattedInteger;
613
+ }
614
+ function formatPrice(price, locale = {}) {
615
+ const mergedLocale = { ...DEFAULT_LOCALE, ...locale };
616
+ const numericPrice = typeof price === "string" ? parseFloat(price) : price;
617
+ if (isNaN(numericPrice)) {
618
+ return "";
619
+ }
620
+ const symbol = getCurrencySymbol(mergedLocale.currency);
621
+ const formattedNumber = formatNumber(numericPrice, mergedLocale);
622
+ if (mergedLocale.currencyPosition === "after") {
623
+ return `${formattedNumber}${symbol}`;
624
+ }
625
+ return `${symbol}${formattedNumber}`;
626
+ }
627
+ function calculateDiscount(regularPrice, salePrice) {
628
+ const regular = typeof regularPrice === "string" ? parseFloat(regularPrice) : regularPrice;
629
+ const sale = typeof salePrice === "string" ? parseFloat(salePrice) : salePrice;
630
+ if (isNaN(regular) || isNaN(sale) || regular <= 0 || sale >= regular) {
631
+ return null;
632
+ }
633
+ return Math.round((regular - sale) / regular * 100);
634
+ }
635
+ function formatStoreApiPriceIntl(priceInMinorUnits, currencyCode, localeTag = "en-US") {
636
+ if (!priceInMinorUnits || !currencyCode) {
637
+ return "-";
638
+ }
639
+ const cents = parseInt(priceInMinorUnits, 10);
640
+ if (isNaN(cents)) {
641
+ return "-";
642
+ }
643
+ const decimalPrice = cents / 100;
644
+ try {
645
+ const formatter = new Intl.NumberFormat(localeTag, {
646
+ style: "currency",
647
+ currency: currencyCode
648
+ });
649
+ return formatter.format(decimalPrice);
650
+ } catch {
651
+ return formatPrice(decimalPrice, { currency: currencyCode });
652
+ }
653
+ }
654
+
655
+ // src/utils/stock.ts
656
+ var DEFAULT_CONFIG = {
657
+ inStockText: "In Stock",
658
+ outOfStockText: "Out of Stock",
659
+ backorderText: "Available on Backorder",
660
+ showQuantity: false,
661
+ lowStockThreshold: 5,
662
+ lowStockText: "Only {quantity} left"
663
+ };
664
+ function getStockStatusText(status, quantity, config = {}) {
665
+ const mergedConfig = { ...DEFAULT_CONFIG, ...config };
666
+ switch (status) {
667
+ case "instock":
668
+ if (quantity !== null && quantity !== void 0 && quantity <= mergedConfig.lowStockThreshold && quantity > 0) {
669
+ return mergedConfig.lowStockText.replace("{quantity}", quantity.toString());
670
+ }
671
+ if (mergedConfig.showQuantity && quantity !== null && quantity !== void 0) {
672
+ return `${mergedConfig.inStockText} (${quantity})`;
673
+ }
674
+ return mergedConfig.inStockText;
675
+ case "outofstock":
676
+ return mergedConfig.outOfStockText;
677
+ case "onbackorder":
678
+ return mergedConfig.backorderText;
679
+ default:
680
+ return mergedConfig.inStockText;
681
+ }
682
+ }
683
+ function isPurchasable(status, quantity, manageStock = true) {
684
+ if (status === "outofstock") {
685
+ return false;
686
+ }
687
+ if (status === "onbackorder") {
688
+ return true;
689
+ }
690
+ if (manageStock && quantity !== null && quantity !== void 0) {
691
+ return quantity > 0;
692
+ }
693
+ return true;
694
+ }
695
+ function isLowStock(status, quantity, threshold = 5) {
696
+ return status === "instock" && quantity !== null && quantity !== void 0 && quantity <= threshold && quantity > 0;
697
+ }
698
+
699
+ // src/utils/image.ts
700
+ var SIZE_SUFFIXES = {
701
+ thumbnail: "-150x150",
702
+ medium: "-300x300",
703
+ large: "-1024x1024",
704
+ full: ""
705
+ };
706
+ function getPrimaryImage(images) {
707
+ if (!images || images.length === 0) {
708
+ return void 0;
709
+ }
710
+ return images[0];
711
+ }
712
+ function getImageUrl(images, size = "full", fallback) {
713
+ const primary = getPrimaryImage(images);
714
+ if (!primary) {
715
+ return fallback;
716
+ }
717
+ return getSizedImageUrl(primary.src, size);
718
+ }
719
+ function getSizedImageUrl(url, size = "full") {
720
+ if (!url || size === "full") {
721
+ return url;
722
+ }
723
+ const hasSize = Object.values(SIZE_SUFFIXES).some((suffix2) => suffix2 && url.includes(suffix2));
724
+ if (hasSize) {
725
+ let result = url;
726
+ Object.values(SIZE_SUFFIXES).forEach((suffix2) => {
727
+ if (suffix2) {
728
+ result = result.replace(suffix2, SIZE_SUFFIXES[size]);
729
+ }
730
+ });
731
+ return result;
732
+ }
733
+ const suffix = SIZE_SUFFIXES[size];
734
+ const lastDot = url.lastIndexOf(".");
735
+ if (lastDot === -1) {
736
+ return url;
737
+ }
738
+ return `${url.slice(0, lastDot)}${suffix}${url.slice(lastDot)}`;
739
+ }
740
+ function getAllImageUrls(images, size = "full") {
741
+ if (!images || images.length === 0) {
742
+ return [];
743
+ }
744
+ return images.map((img) => getSizedImageUrl(img.src, size));
745
+ }
746
+
747
+ // src/hooks/useProductsFeed.ts
748
+ function useProductsFeed(options = {}) {
749
+ const { params, imageSize = "medium" } = options;
750
+ const storeContext = react.useContext(WooCommerceStoreContext);
751
+ const storeConfig = storeContext?.config;
752
+ const localeTag = options.localeTag ?? storeConfig?.locale?.localeTag ?? DEFAULT_STORE_CONFIG.locale.localeTag;
753
+ const fallbackImageUrl = options.fallbackImageUrl ?? storeConfig?.fallbackImageUrl;
754
+ const imageUrlTransformer = storeConfig?.imageUrlTransformer;
755
+ const {
756
+ data: productsData,
757
+ isLoading,
758
+ isFetchingNextPage,
759
+ error,
760
+ hasNextPage = false,
761
+ fetchNextPage,
762
+ refetch,
763
+ isRefetching
764
+ } = useInfiniteProducts(params);
765
+ const { treeData: categoryTree = [], findById } = useProductCategoryTree();
766
+ const getProcessedImageUrl = react.useCallback(
767
+ (images) => {
768
+ const baseUrl = getImageUrl(images, imageSize, fallbackImageUrl);
769
+ if (baseUrl && imageUrlTransformer) {
770
+ return imageUrlTransformer(baseUrl, imageSize);
771
+ }
772
+ return baseUrl;
773
+ },
774
+ [imageSize, fallbackImageUrl, imageUrlTransformer]
775
+ );
776
+ const products = react.useMemo(() => {
777
+ if (!productsData) return [];
778
+ const productList = Array.isArray(productsData) ? productsData : [];
779
+ return productList.map((product) => {
780
+ const currencyCode = product.prices?.currency_code;
781
+ return {
782
+ id: product.id,
783
+ name: product.name,
784
+ slug: product.slug,
785
+ permalink: product.permalink,
786
+ imageUrl: getProcessedImageUrl(product.images),
787
+ price: formatStoreApiPriceIntl(product.prices?.price, currencyCode, localeTag),
788
+ regularPrice: formatStoreApiPriceIntl(
789
+ product.prices?.regular_price,
790
+ currencyCode,
791
+ localeTag
792
+ ),
793
+ isOnSale: product.on_sale,
794
+ canAddToCart: product.is_purchasable && product.is_in_stock,
795
+ raw: product
796
+ };
797
+ });
798
+ }, [productsData, localeTag, getProcessedImageUrl]);
799
+ const activeCategory = react.useMemo(() => {
800
+ if (!params?.category) return void 0;
801
+ return findById(params.category);
802
+ }, [params, findById]);
803
+ const refresh = react.useCallback(async () => {
804
+ await refetch();
805
+ }, [refetch]);
806
+ const totalCount = products.length;
807
+ return {
808
+ products,
809
+ isLoading,
810
+ isFetchingNextPage,
811
+ error,
812
+ hasNextPage,
813
+ fetchNextPage,
814
+ refresh,
815
+ isRefreshing: isRefetching,
816
+ activeCategory,
817
+ categoryTree,
818
+ findCategoryById: findById,
819
+ totalCount
820
+ };
821
+ }
822
+ function useProductView(options) {
823
+ const { productId, imageSize = "large", lowStockThreshold = 5 } = options;
824
+ const storeContext = react.useContext(WooCommerceStoreContext);
825
+ const storeConfig = storeContext?.config;
826
+ const localeTag = options.localeTag ?? storeConfig?.locale?.localeTag ?? DEFAULT_STORE_CONFIG.locale.localeTag;
827
+ const fallbackImageUrl = options.fallbackImageUrl ?? storeConfig?.fallbackImageUrl;
828
+ const imageUrlTransformer = storeConfig?.imageUrlTransformer;
829
+ const [draftQuantity, setDraftQuantity] = react.useState(1);
830
+ const { data: productData, isLoading, error, refetch } = useProduct(productId);
831
+ const { data: cartData } = useCart();
832
+ const addToCartMutation = useAddToCart();
833
+ const removeFromCartMutation = useRemoveFromCart();
834
+ const updateCartMutation = useUpdateCartItem();
835
+ const processImageUrl = react.useCallback(
836
+ (url) => {
837
+ if (!url) return url;
838
+ if (imageUrlTransformer) {
839
+ return imageUrlTransformer(url, imageSize);
840
+ }
841
+ return url;
842
+ },
843
+ [imageUrlTransformer, imageSize]
844
+ );
845
+ const product = react.useMemo(() => {
846
+ if (!productData) return null;
847
+ const currencyCode = productData.prices?.currency_code;
848
+ const stockStatus = productData.is_on_backorder ? "onbackorder" : productData.is_in_stock ? "instock" : "outofstock";
849
+ const lowStockRemaining = productData.low_stock_remaining;
850
+ const baseImageUrl = getImageUrl(productData.images, imageSize, fallbackImageUrl);
851
+ const baseImageUrls = getAllImageUrls(productData.images, imageSize);
852
+ return {
853
+ id: productData.id,
854
+ name: productData.name,
855
+ slug: productData.slug,
856
+ permalink: productData.permalink,
857
+ description: productData.description,
858
+ shortDescription: productData.short_description,
859
+ sku: productData.sku,
860
+ imageUrl: processImageUrl(baseImageUrl),
861
+ imageUrls: baseImageUrls.map((url) => processImageUrl(url) ?? url),
862
+ price: formatStoreApiPriceIntl(productData.prices?.price, currencyCode, localeTag),
863
+ regularPrice: formatStoreApiPriceIntl(
864
+ productData.prices?.regular_price,
865
+ currencyCode,
866
+ localeTag
867
+ ),
868
+ isOnSale: productData.on_sale,
869
+ discountPercent: calculateDiscount(
870
+ productData.prices?.regular_price ?? "0",
871
+ productData.prices?.price ?? "0"
872
+ ),
873
+ discountBadge: productData.on_sale ? `-${calculateDiscount(
874
+ productData.prices?.regular_price ?? "0",
875
+ productData.prices?.price ?? "0"
876
+ )}%` : null,
877
+ stockStatusText: getStockStatusText(stockStatus, lowStockRemaining ?? void 0, {
878
+ lowStockThreshold
879
+ }),
880
+ isPurchasable: isPurchasable(
881
+ stockStatus,
882
+ lowStockRemaining ?? void 0,
883
+ productData.sold_individually
884
+ ),
885
+ isLowStock: isLowStock(stockStatus, lowStockRemaining ?? void 0, lowStockThreshold),
886
+ maxQuantity: productData.add_to_cart?.maximum ?? 999,
887
+ minQuantity: productData.add_to_cart?.minimum ?? 1,
888
+ raw: productData
889
+ };
890
+ }, [productData, localeTag, fallbackImageUrl, imageSize, lowStockThreshold, processImageUrl]);
891
+ const cartItem = react.useMemo(() => {
892
+ return cartData?.items.find((item) => item.id === productId);
893
+ }, [cartData?.items, productId]);
894
+ const cartState = react.useMemo(
895
+ () => ({
896
+ isInCart: !!cartItem,
897
+ quantityInCart: cartItem?.quantity ?? 0,
898
+ cartItemKey: cartItem?.key ?? null,
899
+ cartQuantityLimits: cartItem ? {
900
+ minimum: cartItem.quantity_limits.minimum,
901
+ maximum: cartItem.quantity_limits.maximum
902
+ } : null
903
+ }),
904
+ [cartItem]
905
+ );
906
+ const addToCart = react.useCallback(async () => {
907
+ await addToCartMutation.mutateAsync({
908
+ id: productId,
909
+ quantity: draftQuantity
910
+ });
911
+ setDraftQuantity(1);
912
+ }, [addToCartMutation, productId, draftQuantity]);
913
+ const removeFromCart = react.useCallback(async () => {
914
+ if (!cartState.cartItemKey) return;
915
+ await removeFromCartMutation.mutateAsync({
916
+ key: cartState.cartItemKey
917
+ });
918
+ }, [removeFromCartMutation, cartState.cartItemKey]);
919
+ const updateCartQuantity = react.useCallback(
920
+ async (quantity) => {
921
+ if (!cartState.cartItemKey) return;
922
+ await updateCartMutation.mutateAsync({
923
+ key: cartState.cartItemKey,
924
+ quantity
925
+ });
926
+ },
927
+ [updateCartMutation, cartState.cartItemKey]
928
+ );
929
+ const refresh = react.useCallback(async () => {
930
+ await refetch();
931
+ }, [refetch]);
932
+ const isAddingToCart = addToCartMutation.isPending;
933
+ const isRemovingFromCart = removeFromCartMutation.isPending;
934
+ const isUpdatingCart = updateCartMutation.isPending;
935
+ const isCartBusy = isAddingToCart || isRemovingFromCart || isUpdatingCart;
936
+ return {
937
+ product,
938
+ isLoading,
939
+ error,
940
+ refresh,
941
+ cartState,
942
+ draftQuantity,
943
+ setDraftQuantity,
944
+ addToCart,
945
+ removeFromCart,
946
+ updateCartQuantity,
947
+ isAddingToCart,
948
+ isRemovingFromCart,
949
+ isUpdatingCart,
950
+ isCartBusy
951
+ };
952
+ }
953
+ var PAYMENT_METHOD_TITLES = {
954
+ cod: "Cash on Delivery",
955
+ monri: "Monri",
956
+ bacs: "Bank Transfer",
957
+ cheque: "Check Payment",
958
+ paypal: "PayPal",
959
+ stripe: "Credit Card"
960
+ };
961
+ function formatPaymentMethodTitle(methodId) {
962
+ const knownTitle = PAYMENT_METHOD_TITLES[methodId];
963
+ if (knownTitle) {
964
+ return knownTitle;
965
+ }
966
+ return methodId.replace(/[_-]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
967
+ }
968
+ function useCartView(options = {}) {
969
+ const { imageSize = "thumbnail" } = options;
970
+ const storeContext = react.useContext(WooCommerceStoreContext);
971
+ const storeConfig = storeContext?.config;
972
+ const localeTag = options.localeTag ?? storeConfig?.locale?.localeTag ?? DEFAULT_STORE_CONFIG.locale.localeTag;
973
+ const fallbackImageUrl = options.fallbackImageUrl ?? storeConfig?.fallbackImageUrl;
974
+ const imageUrlTransformer = storeConfig?.imageUrlTransformer;
975
+ const { data: cartData, isLoading, error, refetch } = useCart();
976
+ const updateItemMutation = useUpdateCartItem();
977
+ const removeItemMutation = useRemoveFromCart();
978
+ const applyCouponMutation = useApplyCoupon();
979
+ const removeCouponMutation = useRemoveCoupon();
980
+ const selectShippingMutation = useSelectShippingRate();
981
+ const getProcessedImageUrl = react.useCallback(
982
+ (images) => {
983
+ const baseUrl = getImageUrl(images, imageSize, fallbackImageUrl);
984
+ if (baseUrl && imageUrlTransformer) {
985
+ return imageUrlTransformer(baseUrl, imageSize);
986
+ }
987
+ return baseUrl;
988
+ },
989
+ [imageSize, fallbackImageUrl, imageUrlTransformer]
990
+ );
991
+ const items = react.useMemo(() => {
992
+ if (!cartData?.items) return [];
993
+ const currencyCode = cartData.totals.currency_code;
994
+ return cartData.items.map(
995
+ (item) => ({
996
+ key: item.key,
997
+ id: item.id,
998
+ name: item.name,
999
+ imageUrl: getProcessedImageUrl(item.images),
1000
+ quantity: item.quantity,
1001
+ minQuantity: item.quantity_limits.minimum,
1002
+ maxQuantity: item.quantity_limits.maximum,
1003
+ lineTotal: formatStoreApiPriceIntl(item.totals.line_total, currencyCode, localeTag),
1004
+ unitPrice: formatStoreApiPriceIntl(item.prices.price, currencyCode, localeTag),
1005
+ raw: item
1006
+ })
1007
+ );
1008
+ }, [cartData?.items, cartData?.totals.currency_code, localeTag, getProcessedImageUrl]);
1009
+ const totals = react.useMemo(() => {
1010
+ if (!cartData?.totals) {
1011
+ return {
1012
+ subtotal: "-",
1013
+ shipping: "-",
1014
+ tax: "-",
1015
+ discount: "-",
1016
+ total: "-",
1017
+ itemCount: 0,
1018
+ currencyCode: "USD"
1019
+ };
1020
+ }
1021
+ const { totals: t } = cartData;
1022
+ const currencyCode = t.currency_code;
1023
+ return {
1024
+ subtotal: formatStoreApiPriceIntl(t.total_items, currencyCode, localeTag),
1025
+ shipping: formatStoreApiPriceIntl(t.total_shipping, currencyCode, localeTag),
1026
+ tax: formatStoreApiPriceIntl(t.total_tax, currencyCode, localeTag),
1027
+ discount: formatStoreApiPriceIntl(t.total_discount, currencyCode, localeTag),
1028
+ total: formatStoreApiPriceIntl(t.total_price, currencyCode, localeTag),
1029
+ itemCount: cartData.items_count,
1030
+ currencyCode
1031
+ };
1032
+ }, [localeTag, cartData]);
1033
+ const coupons = react.useMemo(() => {
1034
+ if (!cartData?.coupons) return [];
1035
+ return cartData.coupons.map((coupon) => ({
1036
+ code: coupon.code,
1037
+ discount: formatStoreApiPriceIntl(
1038
+ coupon.totals.total_discount,
1039
+ coupon.totals.currency_code,
1040
+ localeTag
1041
+ )
1042
+ }));
1043
+ }, [cartData?.coupons, localeTag]);
1044
+ const shippingRates = react.useMemo(() => {
1045
+ if (!cartData?.shipping_rates?.[0]?.shipping_rates) return [];
1046
+ const currencyCode = cartData.totals.currency_code;
1047
+ return cartData.shipping_rates[0].shipping_rates.map((rate) => ({
1048
+ rateId: rate.rate_id,
1049
+ name: rate.name,
1050
+ price: formatStoreApiPriceIntl(rate.price, currencyCode, localeTag),
1051
+ isSelected: rate.selected
1052
+ }));
1053
+ }, [cartData?.shipping_rates, cartData?.totals.currency_code, localeTag]);
1054
+ const paymentMethods = react.useMemo(() => {
1055
+ if (!cartData?.payment_methods) return [];
1056
+ return cartData.payment_methods.map((methodId) => {
1057
+ const title = formatPaymentMethodTitle(methodId);
1058
+ return {
1059
+ id: methodId,
1060
+ title
1061
+ };
1062
+ });
1063
+ }, [cartData?.payment_methods]);
1064
+ const updateItemQuantity = react.useCallback(
1065
+ async (key, quantity) => {
1066
+ await updateItemMutation.mutateAsync({ key, quantity });
1067
+ },
1068
+ [updateItemMutation]
1069
+ );
1070
+ const removeItem = react.useCallback(
1071
+ async (key) => {
1072
+ await removeItemMutation.mutateAsync({ key });
1073
+ },
1074
+ [removeItemMutation]
1075
+ );
1076
+ const applyCoupon = react.useCallback(
1077
+ async (code) => {
1078
+ await applyCouponMutation.mutateAsync({ code });
1079
+ },
1080
+ [applyCouponMutation]
1081
+ );
1082
+ const removeCoupon = react.useCallback(
1083
+ async (code) => {
1084
+ await removeCouponMutation.mutateAsync({ code });
1085
+ },
1086
+ [removeCouponMutation]
1087
+ );
1088
+ const selectShippingRate = react.useCallback(
1089
+ async (rateId, packageId = 0) => {
1090
+ await selectShippingMutation.mutateAsync({
1091
+ rate_id: rateId,
1092
+ package_id: packageId
1093
+ });
1094
+ },
1095
+ [selectShippingMutation]
1096
+ );
1097
+ const refresh = react.useCallback(async () => {
1098
+ await refetch();
1099
+ }, [refetch]);
1100
+ const isUpdatingItem = updateItemMutation.isPending;
1101
+ const isRemovingItem = removeItemMutation.isPending;
1102
+ const isApplyingCoupon = applyCouponMutation.isPending;
1103
+ const isRemovingCoupon = removeCouponMutation.isPending;
1104
+ const isUpdatingShipping = selectShippingMutation.isPending;
1105
+ const isBusy = isUpdatingItem || isRemovingItem || isApplyingCoupon || isRemovingCoupon || isUpdatingShipping;
1106
+ return {
1107
+ items,
1108
+ totals,
1109
+ coupons,
1110
+ shippingRates,
1111
+ paymentMethods,
1112
+ isEmpty: items.length === 0,
1113
+ needsShipping: cartData?.needs_shipping ?? false,
1114
+ raw: cartData,
1115
+ isLoading,
1116
+ error,
1117
+ updateItemQuantity,
1118
+ removeItem,
1119
+ isUpdatingItem,
1120
+ isRemovingItem,
1121
+ applyCoupon,
1122
+ removeCoupon,
1123
+ isApplyingCoupon,
1124
+ isRemovingCoupon,
1125
+ selectShippingRate,
1126
+ isUpdatingShipping,
1127
+ refresh,
1128
+ isBusy
1129
+ };
1130
+ }
1131
+
1132
+ exports.createQueryKeys = createQueryKeys;
1133
+ exports.useAddToCart = useAddToCart;
1134
+ exports.useApplyCoupon = useApplyCoupon;
1135
+ exports.useCart = useCart;
1136
+ exports.useCartView = useCartView;
1137
+ exports.useCheckout = useCheckout;
1138
+ exports.useInfiniteProducts = useInfiniteProducts;
1139
+ exports.useOrder = useOrder;
1140
+ exports.useProcessCheckout = useProcessCheckout;
1141
+ exports.useProduct = useProduct;
1142
+ exports.useProductCategories = useProductCategories;
1143
+ exports.useProductCategoryTree = useProductCategoryTree;
1144
+ exports.useProductView = useProductView;
1145
+ exports.useProducts = useProducts;
1146
+ exports.useProductsFeed = useProductsFeed;
1147
+ exports.useRemoveCoupon = useRemoveCoupon;
1148
+ exports.useRemoveFromCart = useRemoveFromCart;
1149
+ exports.useSelectShippingRate = useSelectShippingRate;
1150
+ exports.useStore = useStore;
1151
+ exports.useStoreFeatures = useStoreFeatures;
1152
+ exports.useStoreLocale = useStoreLocale;
1153
+ exports.useStoreTheme = useStoreTheme;
1154
+ exports.useUpdateCartItem = useUpdateCartItem;
1155
+ exports.useUpdateCustomer = useUpdateCustomer;
1156
+ exports.useWooCommerceClient = useWooCommerceClient;
1157
+ exports.useWooCommerceQueryKeys = useWooCommerceQueryKeys;
1158
+ //# sourceMappingURL=index.cjs.map
1159
+ //# sourceMappingURL=index.cjs.map