@hanzo/commerce 7.3.7 → 7.3.9
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.
- package/components/cart/cart-panel/promo-code.tsx +7 -4
- package/components/checkout/payment-step-form/contact-form.tsx +3 -2
- package/components/checkout/payment-step-form/index.tsx +1 -1
- package/components/checkout/shipping-step-form.tsx +12 -9
- package/hanzo-ui.d.ts +108 -0
- package/package.json +3 -3
- package/tsconfig.json +3 -1
- package/util/promo-codes.ts +0 -2
- package/util/square-payment.ts +34 -27
- package/dist/components/Icons.d.ts +0 -18
- package/dist/components/Icons.jsx +0 -19
- package/dist/components/Icons.jsx.map +0 -1
- package/dist/components/add-to-cart-widget.d.ts +0 -11
- package/dist/components/add-to-cart-widget.jsx +0 -99
- package/dist/components/add-to-cart-widget.jsx.map +0 -1
- package/dist/components/buy/buy-card.d.ts +0 -30
- package/dist/components/buy/buy-card.jsx +0 -123
- package/dist/components/buy/buy-card.jsx.map +0 -1
- package/dist/components/buy/carousel-buy-card.d.ts +0 -12
- package/dist/components/buy/carousel-buy-card.jsx +0 -99
- package/dist/components/buy/carousel-buy-card.jsx.map +0 -1
- package/dist/components/buy/multi-family/all-variants-carousel.d.ts +0 -4
- package/dist/components/buy/multi-family/all-variants-carousel.jsx +0 -147
- package/dist/components/buy/multi-family/all-variants-carousel.jsx.map +0 -1
- package/dist/components/buy/multi-family/family-carousel/index.d.ts +0 -4
- package/dist/components/buy/multi-family/family-carousel/index.jsx +0 -34
- package/dist/components/buy/multi-family/family-carousel/index.jsx.map +0 -1
- package/dist/components/buy/multi-family/family-carousel/slide.d.ts +0 -11
- package/dist/components/buy/multi-family/family-carousel/slide.jsx +0 -41
- package/dist/components/buy/multi-family/family-carousel/slide.jsx.map +0 -1
- package/dist/components/buy/multi-family/family-carousel/state.d.ts +0 -20
- package/dist/components/buy/multi-family/family-carousel/state.js +0 -59
- package/dist/components/buy/multi-family/family-carousel/state.js.map +0 -1
- package/dist/components/buy/multi-family/index.d.ts +0 -2
- package/dist/components/buy/multi-family/index.js +0 -3
- package/dist/components/buy/multi-family/index.js.map +0 -1
- package/dist/components/buy/single-family-selector.d.ts +0 -15
- package/dist/components/buy/single-family-selector.jsx +0 -31
- package/dist/components/buy/single-family-selector.jsx.map +0 -1
- package/dist/components/buy/title-and-byline.d.ts +0 -8
- package/dist/components/buy/title-and-byline.jsx +0 -9
- package/dist/components/buy/title-and-byline.jsx.map +0 -1
- package/dist/components/cart/cart-panel/cart-line-item.d.ts +0 -11
- package/dist/components/cart/cart-panel/cart-line-item.jsx +0 -39
- package/dist/components/cart/cart-panel/cart-line-item.jsx.map +0 -1
- package/dist/components/cart/cart-panel/index.d.ts +0 -19
- package/dist/components/cart/cart-panel/index.jsx +0 -79
- package/dist/components/cart/cart-panel/index.jsx.map +0 -1
- package/dist/components/cart/cart-panel/promo-code.d.ts +0 -4
- package/dist/components/cart/cart-panel/promo-code.jsx +0 -73
- package/dist/components/cart/cart-panel/promo-code.jsx.map +0 -1
- package/dist/components/cart/cart-panel/total-area.d.ts +0 -7
- package/dist/components/cart/cart-panel/total-area.jsx +0 -37
- package/dist/components/cart/cart-panel/total-area.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icon-row.d.ts +0 -2
- package/dist/components/checkout/payment-step-form/card-icon-row.jsx +0 -22
- package/dist/components/checkout/payment-step-form/card-icon-row.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/amex.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/amex.jsx +0 -12
- package/dist/components/checkout/payment-step-form/card-icons/amex.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.jsx +0 -10
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/discover.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/discover.jsx +0 -12
- package/dist/components/checkout/payment-step-form/card-icons/discover.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/jcb.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/jcb.jsx +0 -23
- package/dist/components/checkout/payment-step-form/card-icons/jcb.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.jsx +0 -12
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/card-icons/visa.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/card-icons/visa.jsx +0 -10
- package/dist/components/checkout/payment-step-form/card-icons/visa.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/cc-button.d.ts +0 -3
- package/dist/components/checkout/payment-step-form/cc-button.jsx +0 -9
- package/dist/components/checkout/payment-step-form/cc-button.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/contact-form.d.ts +0 -5
- package/dist/components/checkout/payment-step-form/contact-form.jsx +0 -21
- package/dist/components/checkout/payment-step-form/contact-form.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.jsx +0 -8
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.jsx +0 -17
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.jsx +0 -10
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/index.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/index.jsx +0 -85
- package/dist/components/checkout/payment-step-form/index.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.jsx +0 -44
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/methods/card.d.ts +0 -4
- package/dist/components/checkout/payment-step-form/methods/card.jsx +0 -182
- package/dist/components/checkout/payment-step-form/methods/card.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/methods/crypto.d.ts +0 -9
- package/dist/components/checkout/payment-step-form/methods/crypto.jsx +0 -167
- package/dist/components/checkout/payment-step-form/methods/crypto.jsx.map +0 -1
- package/dist/components/checkout/payment-step-form/methods/index.d.ts +0 -6
- package/dist/components/checkout/payment-step-form/methods/index.js +0 -21
- package/dist/components/checkout/payment-step-form/methods/index.js.map +0 -1
- package/dist/components/checkout/shipping-step-form.d.ts +0 -3
- package/dist/components/checkout/shipping-step-form.jsx +0 -105
- package/dist/components/checkout/shipping-step-form.jsx.map +0 -1
- package/dist/components/index.d.ts +0 -8
- package/dist/components/index.js +0 -9
- package/dist/components/index.js.map +0 -1
- package/dist/components/item/product-card.d.ts +0 -7
- package/dist/components/item/product-card.jsx +0 -21
- package/dist/components/item/product-card.jsx.map +0 -1
- package/dist/components/item-selector/button.d.ts +0 -4
- package/dist/components/item-selector/button.jsx +0 -65
- package/dist/components/item-selector/button.jsx.map +0 -1
- package/dist/components/item-selector/carousel/index.d.ts +0 -12
- package/dist/components/item-selector/carousel/index.jsx +0 -101
- package/dist/components/item-selector/carousel/index.jsx.map +0 -1
- package/dist/components/item-selector/carousel/slider.d.ts +0 -8
- package/dist/components/item-selector/carousel/slider.jsx +0 -11
- package/dist/components/item-selector/carousel/slider.jsx.map +0 -1
- package/dist/components/item-selector/index.d.ts +0 -2
- package/dist/components/item-selector/index.js +0 -3
- package/dist/components/item-selector/index.js.map +0 -1
- package/dist/components/item-selector/quantity-indicator.d.ts +0 -9
- package/dist/components/item-selector/quantity-indicator.jsx +0 -23
- package/dist/components/item-selector/quantity-indicator.jsx.map +0 -1
- package/dist/components/node-tabs/index.d.ts +0 -14
- package/dist/components/node-tabs/index.jsx +0 -48
- package/dist/components/node-tabs/index.jsx.map +0 -1
- package/dist/components/node-tabs/node-image.d.ts +0 -6
- package/dist/components/node-tabs/node-image.jsx +0 -12
- package/dist/components/node-tabs/node-image.jsx.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/dist/service/context.d.ts +0 -8
- package/dist/service/context.jsx +0 -20
- package/dist/service/context.jsx.map +0 -1
- package/dist/service/debug.d.ts +0 -10
- package/dist/service/debug.js +0 -30
- package/dist/service/debug.js.map +0 -1
- package/dist/service/impls/standalone/actual-line-item.d.ts +0 -40
- package/dist/service/impls/standalone/actual-line-item.js +0 -84
- package/dist/service/impls/standalone/actual-line-item.js.map +0 -1
- package/dist/service/impls/standalone/get-instance.d.ts +0 -2
- package/dist/service/impls/standalone/get-instance.js +0 -39
- package/dist/service/impls/standalone/get-instance.js.map +0 -1
- package/dist/service/impls/standalone/index.d.ts +0 -67
- package/dist/service/impls/standalone/index.js +0 -416
- package/dist/service/impls/standalone/index.js.map +0 -1
- package/dist/service/impls/standalone/order/firebase.d.ts +0 -2
- package/dist/service/impls/standalone/order/firebase.js +0 -13
- package/dist/service/impls/standalone/order/firebase.js.map +0 -1
- package/dist/service/impls/standalone/order/index.d.ts +0 -24
- package/dist/service/impls/standalone/order/index.js +0 -61
- package/dist/service/impls/standalone/order/index.js.map +0 -1
- package/dist/service/impls/standalone/persistence.d.ts +0 -4
- package/dist/service/impls/standalone/persistence.js +0 -22
- package/dist/service/impls/standalone/persistence.js.map +0 -1
- package/dist/service/path-utils.d.ts +0 -7
- package/dist/service/path-utils.js +0 -16
- package/dist/service/path-utils.js.map +0 -1
- package/dist/service/sep.d.ts +0 -6
- package/dist/service/sep.js +0 -6
- package/dist/service/sep.js.map +0 -1
- package/dist/types/category-node.d.ts +0 -36
- package/dist/types/category-node.js +0 -2
- package/dist/types/category-node.js.map +0 -1
- package/dist/types/checkout.d.ts +0 -33
- package/dist/types/checkout.js +0 -2
- package/dist/types/checkout.js.map +0 -1
- package/dist/types/commerce-config.d.ts +0 -11
- package/dist/types/commerce-config.js +0 -2
- package/dist/types/commerce-config.js.map +0 -1
- package/dist/types/commerce-service.d.ts +0 -109
- package/dist/types/commerce-service.js +0 -2
- package/dist/types/commerce-service.js.map +0 -1
- package/dist/types/components/Icons.d.ts +0 -18
- package/dist/types/components/add-to-cart-widget.d.ts +0 -11
- package/dist/types/components/buy/buy-card.d.ts +0 -30
- package/dist/types/components/buy/carousel-buy-card.d.ts +0 -12
- package/dist/types/components/buy/multi-family/all-variants-carousel.d.ts +0 -4
- package/dist/types/components/buy/multi-family/family-carousel/index.d.ts +0 -4
- package/dist/types/components/buy/multi-family/family-carousel/slide.d.ts +0 -11
- package/dist/types/components/buy/multi-family/family-carousel/state.d.ts +0 -20
- package/dist/types/components/buy/multi-family/index.d.ts +0 -2
- package/dist/types/components/buy/single-family-selector.d.ts +0 -15
- package/dist/types/components/buy/title-and-byline.d.ts +0 -8
- package/dist/types/components/cart/cart-panel/cart-line-item.d.ts +0 -11
- package/dist/types/components/cart/cart-panel/index.d.ts +0 -19
- package/dist/types/components/cart/cart-panel/promo-code.d.ts +0 -4
- package/dist/types/components/cart/cart-panel/total-area.d.ts +0 -7
- package/dist/types/components/checkout/payment-step-form/card-icon-row.d.ts +0 -2
- package/dist/types/components/checkout/payment-step-form/card-icons/amex.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/card-icons/diners-club.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/card-icons/discover.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/card-icons/jcb.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/card-icons/mastercard.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/card-icons/visa.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/cc-button.d.ts +0 -3
- package/dist/types/components/checkout/payment-step-form/contact-form.d.ts +0 -5
- package/dist/types/components/checkout/payment-step-form/crypto-icons/btc.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/crypto-icons/eth.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/crypto-icons/usdt.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/index.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/methods/bank-transfer.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/methods/card.d.ts +0 -4
- package/dist/types/components/checkout/payment-step-form/methods/crypto.d.ts +0 -9
- package/dist/types/components/checkout/payment-step-form/methods/index.d.ts +0 -6
- package/dist/types/components/checkout/shipping-step-form.d.ts +0 -3
- package/dist/types/components/index.d.ts +0 -8
- package/dist/types/components/item/product-card.d.ts +0 -7
- package/dist/types/components/item-selector/button.d.ts +0 -4
- package/dist/types/components/item-selector/carousel/index.d.ts +0 -12
- package/dist/types/components/item-selector/carousel/slider.d.ts +0 -8
- package/dist/types/components/item-selector/index.d.ts +0 -2
- package/dist/types/components/item-selector/quantity-indicator.d.ts +0 -9
- package/dist/types/components/node-tabs/index.d.ts +0 -14
- package/dist/types/components/node-tabs/node-image.d.ts +0 -6
- package/dist/types/family.d.ts +0 -16
- package/dist/types/family.js +0 -2
- package/dist/types/family.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.js +0 -8
- package/dist/types/index.js.map +0 -1
- package/dist/types/item-selector.d.ts +0 -72
- package/dist/types/item-selector.js +0 -2
- package/dist/types/item-selector.js.map +0 -1
- package/dist/types/line-item.d.ts +0 -14
- package/dist/types/line-item.js +0 -2
- package/dist/types/line-item.js.map +0 -1
- package/dist/types/multi-family-selector-props.d.ts +0 -16
- package/dist/types/multi-family-selector-props.js +0 -2
- package/dist/types/multi-family-selector-props.js.map +0 -1
- package/dist/types/product.d.ts +0 -15
- package/dist/types/product.js +0 -2
- package/dist/types/product.js.map +0 -1
- package/dist/types/promo.d.ts +0 -7
- package/dist/types/promo.js +0 -2
- package/dist/types/promo.js.map +0 -1
- package/dist/types/selection-ui-specifier.d.ts +0 -40
- package/dist/types/selection-ui-specifier.js +0 -2
- package/dist/types/selection-ui-specifier.js.map +0 -1
- package/dist/types/service/context.d.ts +0 -8
- package/dist/types/service/debug.d.ts +0 -10
- package/dist/types/service/impls/standalone/actual-line-item.d.ts +0 -40
- package/dist/types/service/impls/standalone/get-instance.d.ts +0 -2
- package/dist/types/service/impls/standalone/index.d.ts +0 -67
- package/dist/types/service/impls/standalone/order/firebase.d.ts +0 -2
- package/dist/types/service/impls/standalone/order/index.d.ts +0 -24
- package/dist/types/service/impls/standalone/persistence.d.ts +0 -4
- package/dist/types/service/path-utils.d.ts +0 -7
- package/dist/types/service/sep.d.ts +0 -6
- package/dist/types/string-mutator.d.ts +0 -9
- package/dist/types/string-mutator.js +0 -2
- package/dist/types/string-mutator.js.map +0 -1
- package/dist/types/token-separators.d.ts +0 -6
- package/dist/types/token-separators.js +0 -2
- package/dist/types/token-separators.js.map +0 -1
- package/dist/types/types/category-node.d.ts +0 -36
- package/dist/types/types/checkout.d.ts +0 -33
- package/dist/types/types/commerce-config.d.ts +0 -11
- package/dist/types/types/commerce-service.d.ts +0 -109
- package/dist/types/types/family.d.ts +0 -16
- package/dist/types/types/index.d.ts +0 -13
- package/dist/types/types/item-selector.d.ts +0 -72
- package/dist/types/types/line-item.d.ts +0 -14
- package/dist/types/types/multi-family-selector-props.d.ts +0 -16
- package/dist/types/types/product.d.ts +0 -15
- package/dist/types/types/promo.d.ts +0 -7
- package/dist/types/types/selection-ui-specifier.d.ts +0 -40
- package/dist/types/types/string-mutator.d.ts +0 -9
- package/dist/types/types/token-separators.d.ts +0 -6
- package/dist/types/util/analytics.d.ts +0 -9
- package/dist/types/util/countries.d.ts +0 -7
- package/dist/types/util/error.d.ts +0 -1
- package/dist/types/util/index.d.ts +0 -15
- package/dist/types/util/item-selector-options-accessor.d.ts +0 -3
- package/dist/types/util/line-item-ref.d.ts +0 -8
- package/dist/types/util/multi-family-selector-options-accessor.d.ts +0 -3
- package/dist/types/util/obs-string-mutator.d.ts +0 -8
- package/dist/types/util/product-media-accessor.d.ts +0 -29
- package/dist/types/util/promo-codes.d.ts +0 -3
- package/dist/types/util/selection-ui-specifiers.d.ts +0 -3
- package/dist/types/util/square-payment.d.ts +0 -7
- package/dist/types/util/use-sync-sku-param-w-current-item.d.ts +0 -2
- package/dist/util/analytics.d.ts +0 -9
- package/dist/util/analytics.js +0 -10
- package/dist/util/analytics.js.map +0 -1
- package/dist/util/countries.d.ts +0 -7
- package/dist/util/countries.js +0 -197
- package/dist/util/countries.js.map +0 -1
- package/dist/util/error.d.ts +0 -1
- package/dist/util/error.js +0 -22
- package/dist/util/error.js.map +0 -1
- package/dist/util/index.d.ts +0 -15
- package/dist/util/index.js +0 -54
- package/dist/util/index.js.map +0 -1
- package/dist/util/item-selector-options-accessor.d.ts +0 -3
- package/dist/util/item-selector-options-accessor.js +0 -27
- package/dist/util/item-selector-options-accessor.js.map +0 -1
- package/dist/util/line-item-ref.d.ts +0 -8
- package/dist/util/line-item-ref.js +0 -15
- package/dist/util/line-item-ref.js.map +0 -1
- package/dist/util/multi-family-selector-options-accessor.d.ts +0 -3
- package/dist/util/multi-family-selector-options-accessor.js +0 -11
- package/dist/util/multi-family-selector-options-accessor.js.map +0 -1
- package/dist/util/obs-string-mutator.d.ts +0 -8
- package/dist/util/obs-string-mutator.js +0 -15
- package/dist/util/obs-string-mutator.js.map +0 -1
- package/dist/util/product-media-accessor.d.ts +0 -29
- package/dist/util/product-media-accessor.js +0 -22
- package/dist/util/product-media-accessor.js.map +0 -1
- package/dist/util/promo-codes.d.ts +0 -3
- package/dist/util/promo-codes.js +0 -101
- package/dist/util/promo-codes.js.map +0 -1
- package/dist/util/selection-ui-specifiers.d.ts +0 -3
- package/dist/util/selection-ui-specifiers.js +0 -24
- package/dist/util/selection-ui-specifiers.js.map +0 -1
- package/dist/util/square-payment.d.ts +0 -7
- package/dist/util/square-payment.js +0 -30
- package/dist/util/square-payment.js.map +0 -1
- package/dist/util/use-sync-sku-param-w-current-item.d.ts +0 -2
- package/dist/util/use-sync-sku-param-w-current-item.js +0 -61
- package/dist/util/use-sync-sku-param-w-current-item.js.map +0 -1
|
@@ -11,13 +11,16 @@ import { Check } from 'lucide-react'
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
Button,
|
|
14
|
-
Form,
|
|
15
|
-
FormControl,
|
|
16
|
-
FormField,
|
|
17
|
-
FormItem,
|
|
18
14
|
Input
|
|
19
15
|
} from '@hanzo/ui/primitives'
|
|
20
16
|
|
|
17
|
+
import {
|
|
18
|
+
Form,
|
|
19
|
+
FormControl,
|
|
20
|
+
FormField,
|
|
21
|
+
FormItem,
|
|
22
|
+
} from '@hanzo/ui/form'
|
|
23
|
+
|
|
21
24
|
import { useCommerce } from '../../../service/context'
|
|
22
25
|
import type { Promo } from '../../../types'
|
|
23
26
|
import getPromoFromApi from '../../../util/promo-codes'
|
|
@@ -35,7 +35,7 @@ const PaymentStepForm: React.FC<CheckoutStepComponentProps> = observer(({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const contactForm = useForm<z.infer<typeof contactFormSchema>>({
|
|
38
|
-
resolver: zodResolver(contactFormSchema),
|
|
38
|
+
resolver: zodResolver(contactFormSchema),
|
|
39
39
|
defaultValues: {
|
|
40
40
|
name: auth?.user?.displayName ?? '',
|
|
41
41
|
email: auth?.user?.email ?? '',
|
|
@@ -4,20 +4,23 @@ import * as z from 'zod'
|
|
|
4
4
|
import { useForm } from 'react-hook-form'
|
|
5
5
|
import { zodResolver } from '@hookform/resolvers/zod'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
Input,
|
|
9
|
-
Button,
|
|
7
|
+
import {
|
|
8
|
+
Input,
|
|
9
|
+
Button,
|
|
10
|
+
Select,
|
|
11
|
+
SelectContent,
|
|
12
|
+
SelectItem,
|
|
13
|
+
SelectTrigger,
|
|
14
|
+
SelectValue
|
|
15
|
+
} from '@hanzo/ui/primitives'
|
|
16
|
+
|
|
17
|
+
import {
|
|
10
18
|
Form,
|
|
11
19
|
FormControl,
|
|
12
20
|
FormField,
|
|
13
21
|
FormItem,
|
|
14
22
|
FormMessage,
|
|
15
|
-
|
|
16
|
-
SelectContent,
|
|
17
|
-
SelectItem,
|
|
18
|
-
SelectTrigger,
|
|
19
|
-
SelectValue
|
|
20
|
-
} from '@hanzo/ui/primitives'
|
|
23
|
+
} from '@hanzo/ui/form'
|
|
21
24
|
|
|
22
25
|
import { useCommerce } from '../../service/context'
|
|
23
26
|
|
package/hanzo-ui.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Temporary type declarations for @hanzo/ui imports
|
|
2
|
+
// Until proper .d.ts files are generated
|
|
3
|
+
|
|
4
|
+
declare module '@hanzo/ui/types' {
|
|
5
|
+
export type Dimensions = any
|
|
6
|
+
export type MediaStackDef = any
|
|
7
|
+
export type ImageDef = any
|
|
8
|
+
export type VideoDef = any
|
|
9
|
+
export type AnimationDef = any
|
|
10
|
+
export type MediaTransform = any
|
|
11
|
+
export type LinkDef = any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '@hanzo/ui/primitives' {
|
|
15
|
+
export type CarouselApi = any
|
|
16
|
+
export type CarouselOptions = any
|
|
17
|
+
export const Carousel: any
|
|
18
|
+
export const CarouselContent: any
|
|
19
|
+
export const CarouselItem: any
|
|
20
|
+
export const CarouselNext: any
|
|
21
|
+
export const CarouselPrevious: any
|
|
22
|
+
export const Button: any
|
|
23
|
+
export const buttonVariants: any
|
|
24
|
+
export const Input: any
|
|
25
|
+
export const Label: any
|
|
26
|
+
export const Separator: any
|
|
27
|
+
export const toast: any
|
|
28
|
+
export const Toaster: any
|
|
29
|
+
export const Image: any
|
|
30
|
+
export const Select: any
|
|
31
|
+
export const SelectContent: any
|
|
32
|
+
export const SelectGroup: any
|
|
33
|
+
export const SelectItem: any
|
|
34
|
+
export const SelectTrigger: any
|
|
35
|
+
export const SelectValue: any
|
|
36
|
+
export const RadioGroup: any
|
|
37
|
+
export const ScrollArea: any
|
|
38
|
+
export const ApplyTypography: any
|
|
39
|
+
export const MediaStack: any
|
|
40
|
+
export const Slider: any
|
|
41
|
+
export const Skeleton: any
|
|
42
|
+
export const Card: any
|
|
43
|
+
export const CardContent: any
|
|
44
|
+
export const CardFooter: any
|
|
45
|
+
export const CardHeader: any
|
|
46
|
+
export const CardTitle: any
|
|
47
|
+
export const ToggleGroup: any
|
|
48
|
+
export const ToggleGroupItem: any
|
|
49
|
+
export const Tabs: any
|
|
50
|
+
export const TabsContent: any
|
|
51
|
+
export const TabsList: any
|
|
52
|
+
export const TabsTrigger: any
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare module '@hanzo/ui/form' {
|
|
56
|
+
export const Form: any
|
|
57
|
+
export const FormControl: any
|
|
58
|
+
export const FormField: any
|
|
59
|
+
export const FormItem: any
|
|
60
|
+
export const FormLabel: any
|
|
61
|
+
export const FormMessage: any
|
|
62
|
+
export const FormDescription: any
|
|
63
|
+
export const useFormField: any
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare module '@hanzo/ui/util' {
|
|
67
|
+
export function cn(...inputs: any[]): string
|
|
68
|
+
export type VariantProps<T> = any
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Workaround for lucide-react with React 19 type mismatches
|
|
72
|
+
declare module 'lucide-react' {
|
|
73
|
+
import type { SVGProps } from 'react'
|
|
74
|
+
export type LucideProps = SVGProps<SVGSVGElement>
|
|
75
|
+
export const ChevronLeft: any
|
|
76
|
+
export const ChevronRight: any
|
|
77
|
+
export const Minus: any
|
|
78
|
+
export const Plus: any
|
|
79
|
+
export const X: any
|
|
80
|
+
export const Check: any
|
|
81
|
+
export const CreditCard: any
|
|
82
|
+
export const ShoppingCart: any
|
|
83
|
+
export const Menu: any
|
|
84
|
+
export const Loader2: any
|
|
85
|
+
export const ChevronDown: any
|
|
86
|
+
export const ChevronsLeft: any
|
|
87
|
+
export const ChevronsRight: any
|
|
88
|
+
export const Image: any
|
|
89
|
+
export const Trash2: any
|
|
90
|
+
export const Search: any
|
|
91
|
+
export const Barcode: any
|
|
92
|
+
export const LockKeyhole: any
|
|
93
|
+
export const Copy: any
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Workaround for react-square-web-payments-sdk with React 19
|
|
97
|
+
declare module 'react-square-web-payments-sdk' {
|
|
98
|
+
export const ApplePay: any
|
|
99
|
+
export const GooglePay: any
|
|
100
|
+
export const CreditCard: any
|
|
101
|
+
export const PaymentForm: any
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Workaround for next/image with React 19
|
|
105
|
+
declare module 'next/image' {
|
|
106
|
+
const Image: any
|
|
107
|
+
export default Image
|
|
108
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/commerce",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.9",
|
|
4
4
|
"description": "e-commerce framework.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@hanzo/auth": "2.5.4",
|
|
41
|
-
"@hanzo/ui": "
|
|
41
|
+
"@hanzo/ui": "workspace:*",
|
|
42
42
|
"@hookform/resolvers": "^3.3.4",
|
|
43
43
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
44
44
|
"firebase": "^10.8.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"mobx-react-lite": "^4.0.7",
|
|
48
48
|
"mobx-utils": "^6.0.8",
|
|
49
49
|
"next": "14.2.16",
|
|
50
|
-
"react": "
|
|
50
|
+
"react": "^19.0.0",
|
|
51
51
|
"react-dom": "18.3.1",
|
|
52
52
|
"react-hook-form": "7.51.4",
|
|
53
53
|
"zod": "3.23.8"
|
package/tsconfig.json
CHANGED
package/util/promo-codes.ts
CHANGED
package/util/square-payment.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Client, Environment } from 'square'
|
|
4
|
-
import { randomUUID } from 'crypto'
|
|
1
|
+
// Payment processing - requires API endpoint
|
|
2
|
+
// For static builds, this will call an external payment API
|
|
5
3
|
|
|
6
4
|
// https://developer.squareup.com/blog/online-payments-with-square-and-react/
|
|
7
5
|
declare global {
|
|
@@ -12,32 +10,41 @@ declare global {
|
|
|
12
10
|
|
|
13
11
|
BigInt.prototype.toJSON = function() { return this.toString(); }
|
|
14
12
|
|
|
15
|
-
const { paymentsApi } = new Client({
|
|
16
|
-
accessToken: process.env.SQUARE_ACCESS_TOKEN,
|
|
17
|
-
environment: process.env.SQUARE_ENVIRONMENT as Environment
|
|
18
|
-
})
|
|
19
|
-
|
|
20
13
|
const processPayment = async (sourceId: string, amount: number, verificationToken: string) => {
|
|
21
|
-
//
|
|
22
|
-
|
|
14
|
+
// For static builds, payments should be processed via an API endpoint
|
|
15
|
+
// Check if we're in a browser environment
|
|
16
|
+
if (typeof window !== 'undefined') {
|
|
17
|
+
// Client-side: call the payment API
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch('/api/payment', {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
},
|
|
24
|
+
body: JSON.stringify({
|
|
25
|
+
sourceId,
|
|
26
|
+
amount,
|
|
27
|
+
verificationToken
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
console.error('Payment API error:', response.statusText)
|
|
33
|
+
return null
|
|
34
|
+
}
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
currency: 'USD',
|
|
30
|
-
amount: BigInt(amountInCents)
|
|
31
|
-
},
|
|
32
|
-
verificationToken
|
|
33
|
-
})
|
|
34
|
-
return result
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('Error processing payment:', error)
|
|
37
|
-
return null
|
|
36
|
+
return await response.json()
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Error processing payment:', error)
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
38
41
|
}
|
|
42
|
+
|
|
43
|
+
// Server-side (for SSR builds only, not static export)
|
|
44
|
+
console.warn('Server-side payment processing not available in static export')
|
|
45
|
+
return null
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
export {
|
|
42
|
-
processPayment as default
|
|
43
|
-
}
|
|
49
|
+
processPayment as default
|
|
50
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
shoppingCart: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
3
|
-
menu: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
4
|
-
chevronLeft: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
5
|
-
chevronRight: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
6
|
-
spinner: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
7
|
-
check: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
8
|
-
plus: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
9
|
-
minus: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
10
|
-
chevronDown: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
11
|
-
chevronsLeft: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
12
|
-
chevronsRight: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
13
|
-
placeholder: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
14
|
-
trash: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
15
|
-
search: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
16
|
-
barcode: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
|
|
17
|
-
};
|
|
18
|
-
export default _default;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ShoppingCart, Menu, ChevronLeft, ChevronRight, Loader2, Check, Plus, Minus, ChevronDown, ChevronsLeft, ChevronsRight, Image, Trash2, Search, Barcode } from "lucide-react";
|
|
2
|
-
export default {
|
|
3
|
-
shoppingCart: ShoppingCart,
|
|
4
|
-
menu: Menu,
|
|
5
|
-
chevronLeft: ChevronLeft,
|
|
6
|
-
chevronRight: ChevronRight,
|
|
7
|
-
spinner: Loader2,
|
|
8
|
-
check: Check,
|
|
9
|
-
plus: Plus,
|
|
10
|
-
minus: Minus,
|
|
11
|
-
chevronDown: ChevronDown,
|
|
12
|
-
chevronsLeft: ChevronsLeft,
|
|
13
|
-
chevronsRight: ChevronsRight,
|
|
14
|
-
placeholder: Image,
|
|
15
|
-
trash: Trash2,
|
|
16
|
-
search: Search,
|
|
17
|
-
barcode: Barcode
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=Icons.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icons.jsx","sourceRoot":"","sources":["../../components/Icons.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACR,MAAM,cAAc,CAAA;AAErB,eAAe;IACb,YAAY,EAAE,YAAY;IAC1B,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,WAAW;IACxB,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,KAAK;IAClB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;CACjB,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LineItem } from '../types';
|
|
3
|
-
declare const AddToCartWidget: React.FC<{
|
|
4
|
-
item: LineItem;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
buttonClx?: string;
|
|
8
|
-
variant?: 'minimal' | 'primary' | 'primary-smaller' | 'outline';
|
|
9
|
-
onQuantityChanged?: (sku: string, oldV: number, newV: number) => void;
|
|
10
|
-
}>;
|
|
11
|
-
export default AddToCartWidget;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useEffect, useRef } from 'react';
|
|
3
|
-
import { reaction } from 'mobx';
|
|
4
|
-
import { observer } from 'mobx-react-lite';
|
|
5
|
-
import { Button, buttonVariants } from '@hanzo/ui/primitives';
|
|
6
|
-
import { cn } from '@hanzo/ui/util';
|
|
7
|
-
import Icons from './Icons';
|
|
8
|
-
import { sendFBEvent, sendGAEvent } from '../util/analytics';
|
|
9
|
-
const AddToCartWidget = observer(({ item, variant = 'primary', disabled = false, className = '', buttonClx = '', onQuantityChanged }) => {
|
|
10
|
-
const reactionDisposer = useRef(undefined);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (onQuantityChanged) {
|
|
13
|
-
reactionDisposer.current = reaction(() => (item.quantity), (quantity, previous) => {
|
|
14
|
-
onQuantityChanged(item.sku, quantity, previous);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return () => {
|
|
18
|
-
if (reactionDisposer.current) {
|
|
19
|
-
reactionDisposer.current();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
const ROUNDED_VAL = 'lg';
|
|
24
|
-
// no need to safelist, since its used widely
|
|
25
|
-
const ROUNDED_CLX = ` rounded-${ROUNDED_VAL} `;
|
|
26
|
-
const ghost = variant === 'minimal';
|
|
27
|
-
const outline = variant === 'outline';
|
|
28
|
-
const primary = variant === 'primary';
|
|
29
|
-
const priSmaller = variant === 'primary-smaller';
|
|
30
|
-
let iconClx = ghost ? 'h-4 w-4 md:h-3 md:w-3 text-muted-3 ' : (priSmaller ? 'h-4 w-6 px-0.5 opacity-70' : 'h-5 w-7 px-1 opacity-70 ');
|
|
31
|
-
iconClx += ghost ? 'group-hover:text-foreground' : 'group-hover:opacity-100';
|
|
32
|
-
let digitClx = ghost ? 'px-2 md:px-0.5 ' : 'sm:px-2 font-semibold ';
|
|
33
|
-
digitClx += (ghost || outline) ? 'text-foreground ' : 'text-primary-fg ';
|
|
34
|
-
if (disabled) {
|
|
35
|
-
return (<div className={cn('flex flex-row items-stretch' + ROUNDED_CLX + (!(primary || priSmaller) ? 'bg-transparent' : 'bg-primary'), className)}>
|
|
36
|
-
<div className={'text-sm flex items-center cursor-default ' + digitClx}>{item.quantity}</div>
|
|
37
|
-
</div>);
|
|
38
|
-
}
|
|
39
|
-
const inc = (event) => {
|
|
40
|
-
item.increment();
|
|
41
|
-
event.stopPropagation(); // in case we're part of a larger selection UI
|
|
42
|
-
sendGAEvent('add_to_cart', {
|
|
43
|
-
items: [{
|
|
44
|
-
item_id: item.sku,
|
|
45
|
-
item_name: item.title,
|
|
46
|
-
item_category: item.familyId,
|
|
47
|
-
price: item.price,
|
|
48
|
-
quantity: item.quantity
|
|
49
|
-
}],
|
|
50
|
-
value: item.price,
|
|
51
|
-
currency: 'USD',
|
|
52
|
-
});
|
|
53
|
-
sendFBEvent('AddToCart', {
|
|
54
|
-
content_ids: [item.sku],
|
|
55
|
-
contents: [{
|
|
56
|
-
id: item.sku,
|
|
57
|
-
quantity: item.quantity
|
|
58
|
-
}],
|
|
59
|
-
content_name: item.title,
|
|
60
|
-
value: item.price,
|
|
61
|
-
currency: 'USD',
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const dec = (event) => {
|
|
65
|
-
item.decrement();
|
|
66
|
-
event.stopPropagation(); // in case we're part of a larger selection UI
|
|
67
|
-
sendGAEvent('remove_from_cart', {
|
|
68
|
-
items: [{
|
|
69
|
-
item_id: item.sku,
|
|
70
|
-
item_name: item.title,
|
|
71
|
-
item_category: item.familyId,
|
|
72
|
-
price: item.price,
|
|
73
|
-
quantity: item.quantity
|
|
74
|
-
}],
|
|
75
|
-
value: item.price,
|
|
76
|
-
currency: 'USD',
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
return (item.isInCart ? (<div className={cn('flex flex-row items-stretch justify-between ',
|
|
80
|
-
// should match 'xs' and 'default' button heights
|
|
81
|
-
(ghost || priSmaller ? 'h-8' : 'h-9'), ROUNDED_CLX, (primary || priSmaller ? 'bg-primary' : 'bg-transparent'), (outline ? 'border border-muted' : ''), className)}>
|
|
82
|
-
<Button aria-label={'Remove a ' + item.title + ' from the cart'} size={ghost || priSmaller ? 'xs' : 'default'} variant={primary || priSmaller ? 'primary' : 'ghost'} rounded={ghost ? 'full' : ROUNDED_VAL} className={cn('lg:min-w-0 lg:px-2 grow justify-start group', (ghost || priSmaller ? 'px-1' : 'px-2'), (outline ? 'hover:bg-transparent' : ''), buttonClx, 'h-auto self-stretch' // must be smaller than normal
|
|
83
|
-
)} key='left' onClick={dec}>
|
|
84
|
-
{(item.quantity > 1) ? (<Icons.minus className={iconClx} aria-hidden='true'/>) : (<Icons.trash className={iconClx} aria-hidden='true'/>)}
|
|
85
|
-
</Button>
|
|
86
|
-
<div className={cn('grow-0 shrink-0 flex items-center cursor-default xs:px-2', priSmaller || ghost ? 'text-xs' : 'text-sm', digitClx)}>
|
|
87
|
-
{item.quantity}{ghost ? '' : ' in Bag'}
|
|
88
|
-
</div>
|
|
89
|
-
<Button aria-label={'Add another ' + item.title + ' to the cart'} size={ghost || priSmaller ? 'xs' : 'default'} variant={primary || priSmaller ? 'primary' : 'ghost'} rounded={ghost ? 'full' : ROUNDED_VAL} className={cn('lg:min-w-0 lg:px-2 grow justify-end group', (ghost || priSmaller ? 'px-1' : 'px-2'), (outline ? 'hover:bg-transparent' : ''), buttonClx, 'h-auto self-stretch' // must be smaller than normal
|
|
90
|
-
)} onClick={inc} key='right'>
|
|
91
|
-
<Icons.plus className={iconClx} aria-hidden='true'/>
|
|
92
|
-
</Button>
|
|
93
|
-
</div>) : (<Button aria-label={'Add a ' + item.title + ' to cart'} size={ghost || priSmaller ? 'xs' : 'default'} variant={ghost ? 'ghost' : (primary || priSmaller ? 'primary' : 'outline')} rounded={ROUNDED_VAL} className={cn(buttonClx, className)} onClick={inc}>
|
|
94
|
-
<span className='m1-1'>Add</span>
|
|
95
|
-
<Icons.plus className='h-5 w-5 ml-1' aria-hidden='true'/>
|
|
96
|
-
</Button>));
|
|
97
|
-
});
|
|
98
|
-
export default AddToCartWidget;
|
|
99
|
-
//# sourceMappingURL=add-to-cart-widget.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-to-cart-widget.jsx","sourceRoot":"","sources":["../../components/add-to-cart-widget.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,QAAQ,EAA0B,MAAM,MAAM,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,EAAE,EAAqB,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE5D,MAAM,eAAe,GAOhB,QAAQ,CAAC,CAAC,EACb,IAAI,EACJ,OAAO,GAAC,SAAS,EACjB,QAAQ,GAAC,KAAK,EACd,SAAS,GAAC,EAAE,EACZ,SAAS,GAAC,EAAE,EACZ,iBAAiB,EAClB,EAAE,EAAE;IAEH,MAAM,gBAAgB,GAAG,MAAM,CAAgC,SAAS,CAAC,CAAA;IACzE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,iBAAiB,EAAE,CAAC;YACtB,gBAAgB,CAAC,OAAO,GAAG,QAAQ,CACjC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EACrB,CAAC,QAAgB,EAAE,QAAgB,EAAE,EAAE;gBACrC,iBAAiB,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;YACjD,CAAC,CACF,CAAA;QACH,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;gBAC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CAAC,OAAO,CAEX;QAAA,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,EACpD;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,CACF,CAAC,MAAM,CACL,UAAU,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,CAC/C,IAAI,CAAC,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAC7C,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAC3E,OAAO,CAAC,CAAC,WAAW,CAAC,CACrB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CACpC,OAAO,CAAC,CAAC,GAAG,CAAC,CAEb;MAAA,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAChC;MAAA,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,EACzD;IAAA,EAAE,MAAM,CAAC,CACV,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,eAAe,eAAe,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { type ComponentType } from 'react';
|
|
2
|
-
import type { ItemSelectorProps, ItemSelectorCompProps } from '../../types';
|
|
3
|
-
declare const BuyCard: React.FC<{
|
|
4
|
-
skuPath: string;
|
|
5
|
-
/** For any selectors that show a list of choices,
|
|
6
|
-
* starting with 'scrollAfter' elements,
|
|
7
|
-
* the list will scroll, and the card will
|
|
8
|
-
* have 'scrollHeightClx' applied to it to define and fix the height.
|
|
9
|
-
* This is most like something like '80vh'
|
|
10
|
-
* defaults are '5' and 'h-[70vh]'
|
|
11
|
-
* */
|
|
12
|
-
scrollAfter?: number;
|
|
13
|
-
scrollHeightClx?: string;
|
|
14
|
-
clx?: string;
|
|
15
|
-
famWidgetClx?: string;
|
|
16
|
-
addWidgetClx?: string;
|
|
17
|
-
selector: ComponentType<ItemSelectorProps>;
|
|
18
|
-
selectorProps?: ItemSelectorCompProps;
|
|
19
|
-
/** Show all items from all sibling families
|
|
20
|
-
* If skuPath defines a Family, the first of it's items will
|
|
21
|
-
* be selected. The facet widget will just select a the first
|
|
22
|
-
* item in the chosen Family without changings the overall set
|
|
23
|
-
* of choices. */
|
|
24
|
-
allVariants?: boolean;
|
|
25
|
-
familyTabAs?: 'image' | 'label' | 'image-and-label';
|
|
26
|
-
showItemMedia?: boolean;
|
|
27
|
-
onQuantityChanged?: (sku: string, oldV: number, newV: number) => void;
|
|
28
|
-
mobile?: boolean;
|
|
29
|
-
}>;
|
|
30
|
-
export default BuyCard;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useRef, useEffect } from 'react';
|
|
3
|
-
import { reaction } from 'mobx';
|
|
4
|
-
import { observer } from 'mobx-react-lite';
|
|
5
|
-
import { cn } from '@hanzo/ui/util';
|
|
6
|
-
import { ApplyTypography, MediaStack } from '@hanzo/ui/primitives';
|
|
7
|
-
import { useCommerce } from '../../service/context';
|
|
8
|
-
import * as pathUtils from '../../service/path-utils';
|
|
9
|
-
import { getFacetValuesMutator, ObsStringMutator } from '../../util';
|
|
10
|
-
import NodeTabs from '../node-tabs';
|
|
11
|
-
import AddToCartWidget from '../add-to-cart-widget';
|
|
12
|
-
const BuyCard = observer(({ skuPath, scrollAfter = 5, scrollHeightClx = 'h-[80vh]', clx = '', famWidgetClx = '', addWidgetClx = '', selector: Selector, selectorProps = {
|
|
13
|
-
clx: '',
|
|
14
|
-
soleItemClx: '',
|
|
15
|
-
itemClx: '',
|
|
16
|
-
ext: {}
|
|
17
|
-
}, familyTabAs = 'image-and-label', showItemMedia = true, allVariants = false, mobile = false, onQuantityChanged, }) => {
|
|
18
|
-
const cmmc = useCommerce();
|
|
19
|
-
const inst = useRef(undefined);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
let requestedFamily = cmmc.getFamilyById(skuPath);
|
|
22
|
-
let requestedNode = requestedFamily ? undefined : cmmc.getNodeAtPath(skuPath);
|
|
23
|
-
let initialFamily = undefined;
|
|
24
|
-
const { paths, level } = pathUtils.getSelectedPaths(skuPath);
|
|
25
|
-
if (level === 0) {
|
|
26
|
-
throw new Error('BuyCard.useEffect(): must specify at least at least one Level in skuPath!');
|
|
27
|
-
}
|
|
28
|
-
if (requestedFamily) {
|
|
29
|
-
if (allVariants && level >= 2) {
|
|
30
|
-
// select all siblings of requestedFamily.
|
|
31
|
-
// ie, go one level back
|
|
32
|
-
delete paths[level];
|
|
33
|
-
initialFamily = requestedFamily;
|
|
34
|
-
requestedFamily = undefined;
|
|
35
|
-
requestedNode = cmmc.getNodeAtPath(pathUtils.getParentPath(skuPath));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// select siblings paths
|
|
40
|
-
if (allVariants) {
|
|
41
|
-
paths[level + 1] = [...requestedNode.subNodes.map((node) => (node.skuToken))];
|
|
42
|
-
}
|
|
43
|
-
// Actually select the the first fam at the fam level,
|
|
44
|
-
else {
|
|
45
|
-
paths[level + 1] = [requestedNode.subNodes[0].skuToken];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const selectedFams = cmmc.selectPaths(paths);
|
|
49
|
-
initialFamily = initialFamily ? initialFamily : (requestedFamily ? requestedFamily : selectedFams[0]);
|
|
50
|
-
cmmc.setCurrentItem(initialFamily.products[0].sku);
|
|
51
|
-
const currentFamTokenMutator = new ObsStringMutator(pathUtils.lastToken(initialFamily.id));
|
|
52
|
-
inst.current = {
|
|
53
|
-
level,
|
|
54
|
-
requestedFamily,
|
|
55
|
-
requestedNode,
|
|
56
|
-
currentFamTokenMutator,
|
|
57
|
-
disposers: []
|
|
58
|
-
};
|
|
59
|
-
if (!allVariants) {
|
|
60
|
-
inst.current?.disposers.push(reaction(() => {
|
|
61
|
-
const fams = cmmc.selectedFamilies;
|
|
62
|
-
return (fams.length > 0) ? fams[0].id : undefined;
|
|
63
|
-
}, (famId) => {
|
|
64
|
-
if (famId && famId !== cmmc.currentItem?.familyId) {
|
|
65
|
-
const fam = cmmc.getFamilyById(famId);
|
|
66
|
-
if (fam) {
|
|
67
|
-
cmmc.setCurrentItem(fam.products[0].sku);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
return () => {
|
|
73
|
-
inst.current?.disposers.forEach((d) => { d(); });
|
|
74
|
-
};
|
|
75
|
-
}, []);
|
|
76
|
-
const setFamilyPath = (pathValue) => {
|
|
77
|
-
if (inst.current?.currentFamTokenMutator.get() !== pathValue) {
|
|
78
|
-
inst.current?.currentFamTokenMutator.set(pathValue);
|
|
79
|
-
}
|
|
80
|
-
const found = cmmc.selectedItems.find((item) => (item.familyId.endsWith(pathValue)));
|
|
81
|
-
if (found) {
|
|
82
|
-
cmmc.setCurrentItem(found.sku);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const selectSku = (sku) => {
|
|
86
|
-
cmmc.setCurrentItem(sku);
|
|
87
|
-
const pathValue = pathUtils.lastToken(cmmc.currentItem.familyId);
|
|
88
|
-
if (pathValue !== inst.current?.currentFamTokenMutator.get()) {
|
|
89
|
-
inst.current?.currentFamTokenMutator.set(pathValue);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const famTitle = inst.current?.requestedFamily ? inst.current.requestedFamily.title : cmmc.selectedFamilies[0].title;
|
|
93
|
-
const itemsToShow = (!cmmc.hasSelection) ? undefined :
|
|
94
|
-
allVariants ? cmmc.selectedItems : cmmc.selectedFamilies[0].products;
|
|
95
|
-
const TitleArea = ({ title, byline, clx = '' }) => (<ApplyTypography className={clx}>
|
|
96
|
-
<h3>{title}</h3>
|
|
97
|
-
{byline && (<h6>{byline}</h6>)}
|
|
98
|
-
</ApplyTypography>);
|
|
99
|
-
const scroll = !!(itemsToShow && itemsToShow.length > scrollAfter);
|
|
100
|
-
return (<div className={cn('px-4 md:px-6 pt-3 pb-4 flex flex-col items-center min-h-[60vh]', clx, scroll ? scrollHeightClx : 'h-auto')}>
|
|
101
|
-
{inst.current?.requestedNode && (<>
|
|
102
|
-
<ApplyTypography className={'mb-2 ' + (scroll ? 'shrink-0' : '')}>
|
|
103
|
-
<h3>{inst.current.requestedNode.label}</h3>
|
|
104
|
-
{inst.current.requestedNode.subNodesLabel && (<h6 className='!text-center font-bold text-muted mt-3'>{inst.current.requestedNode.subNodesLabel}</h6>)}
|
|
105
|
-
</ApplyTypography>
|
|
106
|
-
<NodeTabs className={cn('grid gap-0 align-stretch justify-normal ' + `grid-cols-${inst.current.requestedNode.subNodes.length}`, 'border-b-2 rounded-lg border-level-3 mb-4 -mr-2 -ml-2 max-w-[460px] h-10', // height is needed for iPhone bug
|
|
107
|
-
(scroll ? 'shrink-0' : ''), famWidgetClx)} mobile={mobile} mutator={allVariants ?
|
|
108
|
-
{
|
|
109
|
-
get: () => (inst.current.currentFamTokenMutator.get()),
|
|
110
|
-
set: setFamilyPath
|
|
111
|
-
}
|
|
112
|
-
:
|
|
113
|
-
getFacetValuesMutator(inst.current.level + 1, cmmc)} itemClx='flex-col h-auto gap-0 py-1 px-3' buttonClx={'h-full ' +
|
|
114
|
-
'!border-level-3'} levelNodes={inst.current.requestedNode.subNodes} show={familyTabAs}/>
|
|
115
|
-
</>)}
|
|
116
|
-
{!inst.current?.requestedNode && famTitle && (<TitleArea title={famTitle} clx=''/>)}
|
|
117
|
-
{(cmmc.currentItem && showItemMedia) && (<MediaStack media={cmmc.currentItem} constrainTo={{ w: 200, h: 200 }} clx={(scroll ? 'shrink-0' : '')}/>)}
|
|
118
|
-
{itemsToShow && (<Selector items={itemsToShow} selectedItemRef={cmmc} selectSku={selectSku} {...selectorProps} scrollable={scroll}/>)}
|
|
119
|
-
{(cmmc.currentItem) && (<AddToCartWidget item={cmmc.currentItem} onQuantityChanged={onQuantityChanged} className={cn('min-w-[160px] mx-auto mt-4', (scroll ? 'shrink-0' : ''), addWidgetClx)}/>)}
|
|
120
|
-
</div>);
|
|
121
|
-
});
|
|
122
|
-
export default BuyCard;
|
|
123
|
-
//# sourceMappingURL=buy-card.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buy-card.jsx","sourceRoot":"","sources":["../../../components/buy/buy-card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,QAAQ,EAA0B,MAAM,MAAM,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAUlE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEpE,OAAO,QAAQ,MAAM,cAAc,CAAA;AACnC,OAAO,eAAe,MAAM,uBAAuB,CAAA;AAEnD,MAAM,OAAO,GAgCR,QAAQ,CAAC,CAAC,EACb,OAAO,EACP,WAAW,GAAC,CAAC,EACb,eAAe,GAAC,UAAU,EAC1B,GAAG,GAAC,EAAE,EACN,YAAY,GAAC,EAAE,EACf,YAAY,GAAC,EAAE,EACf,QAAQ,EAAE,QAAQ,EAClB,aAAa,GAAC;IACZ,GAAG,EAAE,EAAE;IACP,WAAW,EAAE,EAAE;I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