@hanzo/commerce 7.7.1 → 7.7.3

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 (91) hide show
  1. package/dist/components/cart/cart-panel/promo-code.d.ts +2 -2
  2. package/dist/service/impls/standalone/index.js +4 -4
  3. package/dist/service/impls/standalone/index.js.map +1 -1
  4. package/package.json +46 -17
  5. package/billing.ts +0 -2
  6. package/client.ts +0 -783
  7. package/components/Icons.tsx +0 -35
  8. package/components/add-to-cart-widget.tsx +0 -195
  9. package/components/buy/buy-card.tsx +0 -269
  10. package/components/buy/carousel-buy-card.tsx +0 -243
  11. package/components/buy/multi-family/all-variants-carousel.tsx +0 -259
  12. package/components/buy/multi-family/family-carousel/index.tsx +0 -75
  13. package/components/buy/multi-family/family-carousel/slide.tsx +0 -82
  14. package/components/buy/multi-family/family-carousel/state.ts +0 -87
  15. package/components/buy/multi-family/index.ts +0 -2
  16. package/components/buy/single-family-selector.tsx +0 -91
  17. package/components/buy/title-and-byline.tsx +0 -26
  18. package/components/cart/cart-panel/cart-line-item.tsx +0 -77
  19. package/components/cart/cart-panel/index.tsx +0 -157
  20. package/components/cart/cart-panel/promo-code.tsx +0 -105
  21. package/components/cart/cart-panel/total-area.tsx +0 -61
  22. package/components/checkout/payment-step-form/card-icon-row.tsx +0 -26
  23. package/components/checkout/payment-step-form/card-icons/amex.tsx +0 -32
  24. package/components/checkout/payment-step-form/card-icons/diners-club.tsx +0 -13
  25. package/components/checkout/payment-step-form/card-icons/discover.tsx +0 -25
  26. package/components/checkout/payment-step-form/card-icons/jcb.tsx +0 -26
  27. package/components/checkout/payment-step-form/card-icons/mastercard.tsx +0 -27
  28. package/components/checkout/payment-step-form/card-icons/visa.tsx +0 -25
  29. package/components/checkout/payment-step-form/cc-button.tsx +0 -18
  30. package/components/checkout/payment-step-form/contact-form.tsx +0 -48
  31. package/components/checkout/payment-step-form/crypto-icons/btc.tsx +0 -11
  32. package/components/checkout/payment-step-form/crypto-icons/eth.tsx +0 -20
  33. package/components/checkout/payment-step-form/crypto-icons/usdt.tsx +0 -13
  34. package/components/checkout/payment-step-form/index.tsx +0 -113
  35. package/components/checkout/payment-step-form/methods/bank-transfer.tsx +0 -81
  36. package/components/checkout/payment-step-form/methods/card.tsx +0 -253
  37. package/components/checkout/payment-step-form/methods/crypto.tsx +0 -226
  38. package/components/checkout/payment-step-form/methods/index.ts +0 -23
  39. package/components/checkout/shipping-step-form.tsx +0 -171
  40. package/components/index.ts +0 -11
  41. package/components/item/product-card.tsx +0 -66
  42. package/components/item-selector/button.tsx +0 -213
  43. package/components/item-selector/carousel/index.tsx +0 -196
  44. package/components/item-selector/carousel/slider.tsx +0 -37
  45. package/components/item-selector/index.ts +0 -5
  46. package/components/item-selector/quantity-indicator.tsx +0 -50
  47. package/components/node-tabs/index.tsx +0 -90
  48. package/components/node-tabs/node-image.tsx +0 -31
  49. package/index.ts +0 -55
  50. package/metering.test.ts +0 -199
  51. package/metering.ts +0 -289
  52. package/product-card.test.tsx +0 -104
  53. package/service/context.tsx +0 -45
  54. package/service/debug.ts +0 -41
  55. package/service/impls/standalone/actual-line-item.ts +0 -136
  56. package/service/impls/standalone/get-instance.ts +0 -64
  57. package/service/impls/standalone/index.ts +0 -579
  58. package/service/impls/standalone/order/firebase.ts +0 -5
  59. package/service/impls/standalone/order/index.ts +0 -58
  60. package/service/impls/standalone/persistence.ts +0 -33
  61. package/service/path-utils.ts +0 -26
  62. package/service/sep.ts +0 -7
  63. package/tsconfig.json +0 -17
  64. package/types/README.md +0 -2
  65. package/types/category-node.ts +0 -50
  66. package/types/checkout.ts +0 -47
  67. package/types/commerce-config.ts +0 -13
  68. package/types/commerce-service.ts +0 -128
  69. package/types/family.ts +0 -26
  70. package/types/index.ts +0 -15
  71. package/types/item-selector.ts +0 -97
  72. package/types/line-item.ts +0 -29
  73. package/types/multi-family-selector-props.ts +0 -20
  74. package/types/product.ts +0 -21
  75. package/types/promo.ts +0 -10
  76. package/types/selection-ui-specifier.ts +0 -52
  77. package/types/string-mutator.ts +0 -14
  78. package/types/token-separators.ts +0 -7
  79. package/util/analytics.ts +0 -21
  80. package/util/countries.ts +0 -196
  81. package/util/error.ts +0 -34
  82. package/util/index.ts +0 -71
  83. package/util/item-selector-options-accessor.ts +0 -35
  84. package/util/line-item-ref.ts +0 -23
  85. package/util/multi-family-selector-options-accessor.ts +0 -15
  86. package/util/obs-string-mutator.ts +0 -22
  87. package/util/product-media-accessor.ts +0 -58
  88. package/util/promo-codes.ts +0 -106
  89. package/util/selection-ui-specifiers.ts +0 -30
  90. package/util/square-payment.ts +0 -50
  91. package/util/use-sync-sku-param-w-current-item.ts +0 -88
@@ -1,88 +0,0 @@
1
- "use client"
2
- import { useEffect } from 'react'
3
- import { reaction } from 'mobx'
4
-
5
- import {
6
- useQueryState,
7
- parseAsString,
8
- parseAsBoolean,
9
- } from 'next-usequerystate'
10
-
11
- import { useCommerce } from '../service/context'
12
- import type { SelectedPaths } from '../types'
13
- import sep from '../service/sep'
14
-
15
- const PLEASE_SELECT_FACETS = 'Please select an option from each group.'
16
-
17
- const useSyncSkuParamWithCurrentItem = (
18
- familyLevel: number,
19
- setMessage: (m: string | undefined) => void,
20
- setLoading?: (l: boolean) => void
21
- ) => {
22
-
23
- const cmmc = useCommerce()
24
-
25
- const [skuParam, setSkuParam] = useQueryState('sku',
26
- parseAsString.withDefault('').withOptions({ clearOnDefault: true })
27
- )
28
-
29
- const [addParam, setAddParam] = useQueryState('add',
30
- parseAsBoolean.withDefault(false).withOptions({ clearOnDefault: true })
31
- )
32
-
33
- useEffect(() => {
34
-
35
- return reaction(() => ({
36
- specifiedCat: cmmc.selectedFamilies.length === 1 ? cmmc.selectedFamilies[0] : undefined,
37
- currentItem: cmmc.currentItem
38
- }),
39
- ({specifiedCat, currentItem}) => {
40
- //console.log("REACTION: " + `CAT ID: ${family?.id} SKU: ${item?.sku}`)
41
- if (currentItem) {
42
- // if we set the currentItem w sku, then user selects other facets
43
- if (specifiedCat && currentItem.familyId != specifiedCat.id ) {
44
- cmmc.setCurrentItem(specifiedCat.products[0].sku)
45
- }
46
- setSkuParam(cmmc.currentItem!.sku)
47
- }
48
- else if (specifiedCat) {
49
- cmmc.setCurrentItem(specifiedCat.products[0].sku)
50
- setSkuParam(cmmc.currentItem!.sku)
51
- }
52
- })
53
- }, [])
54
-
55
- useEffect(() => {
56
-
57
- const setCurrentFamilyFromSku = (sku: string) => {
58
- const toks: string[] = sku.split(sep.tok)
59
- const fv: SelectedPaths = {}
60
- // TODO: confirm that extra trailing nonsense tokens won't break selectPaths()
61
- for (let i = 1; i < familyLevel; i++) {
62
- if (i in toks) {
63
- fv[i] = [toks[i]]
64
- }
65
- }
66
- cmmc.selectPaths(fv)
67
- }
68
-
69
- // setCI returns true if it's a recognized sku
70
- if (skuParam && cmmc.setCurrentItem(skuParam)) {
71
- if (addParam) {
72
- if (cmmc.currentItem!.quantity === 0) {
73
- cmmc.currentItem!.increment()
74
- }
75
- setAddParam(false)
76
- }
77
- setCurrentFamilyFromSku(skuParam)
78
- setMessage(undefined)
79
- }
80
- else {
81
- setMessage(PLEASE_SELECT_FACETS)
82
- }
83
-
84
- setLoading && setLoading(false)
85
- }, [skuParam])
86
- }
87
-
88
- export default useSyncSkuParamWithCurrentItem