@hanzo/commerce 7.3.10 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -0
- package/LICENSE.md +21 -0
- package/billing.ts +2 -0
- package/client.ts +325 -0
- package/components/cart/cart-panel/promo-code.tsx +1 -1
- package/components/checkout/payment-step-form/index.tsx +2 -2
- package/components/checkout/shipping-step-form.tsx +1 -1
- package/dist/billing.d.ts +2 -0
- package/dist/billing.js +3 -0
- package/dist/billing.js.map +1 -0
- package/dist/client.d.ts +151 -0
- package/dist/client.js +188 -0
- package/dist/client.js.map +1 -0
- package/dist/components/Icons.d.ts +18 -0
- package/dist/components/Icons.js +19 -0
- package/dist/components/Icons.js.map +1 -0
- package/dist/components/Icons.jsx +19 -0
- package/dist/components/Icons.jsx.map +1 -0
- package/dist/components/add-to-cart-widget.d.ts +11 -0
- package/dist/components/add-to-cart-widget.js +85 -0
- package/dist/components/add-to-cart-widget.js.map +1 -0
- package/dist/components/add-to-cart-widget.jsx +99 -0
- package/dist/components/add-to-cart-widget.jsx.map +1 -0
- package/dist/components/buy/buy-card.d.ts +30 -0
- package/dist/components/buy/buy-card.js +109 -0
- package/dist/components/buy/buy-card.js.map +1 -0
- package/dist/components/buy/buy-card.jsx +123 -0
- package/dist/components/buy/buy-card.jsx.map +1 -0
- package/dist/components/buy/carousel-buy-card.d.ts +12 -0
- package/dist/components/buy/carousel-buy-card.js +94 -0
- package/dist/components/buy/carousel-buy-card.js.map +1 -0
- package/dist/components/buy/carousel-buy-card.jsx +99 -0
- package/dist/components/buy/carousel-buy-card.jsx.map +1 -0
- package/dist/components/buy/multi-family/all-variants-carousel.d.ts +4 -0
- package/dist/components/buy/multi-family/all-variants-carousel.js +115 -0
- package/dist/components/buy/multi-family/all-variants-carousel.js.map +1 -0
- package/dist/components/buy/multi-family/all-variants-carousel.jsx +147 -0
- package/dist/components/buy/multi-family/all-variants-carousel.jsx.map +1 -0
- package/dist/components/buy/multi-family/family-carousel/index.d.ts +4 -0
- package/dist/components/buy/multi-family/family-carousel/index.js +27 -0
- package/dist/components/buy/multi-family/family-carousel/index.js.map +1 -0
- package/dist/components/buy/multi-family/family-carousel/index.jsx +34 -0
- package/dist/components/buy/multi-family/family-carousel/index.jsx.map +1 -0
- package/dist/components/buy/multi-family/family-carousel/slide.d.ts +11 -0
- package/dist/components/buy/multi-family/family-carousel/slide.js +35 -0
- package/dist/components/buy/multi-family/family-carousel/slide.js.map +1 -0
- package/dist/components/buy/multi-family/family-carousel/slide.jsx +41 -0
- package/dist/components/buy/multi-family/family-carousel/slide.jsx.map +1 -0
- package/dist/components/buy/multi-family/family-carousel/state.d.ts +20 -0
- package/dist/components/buy/multi-family/family-carousel/state.js +59 -0
- package/dist/components/buy/multi-family/family-carousel/state.js.map +1 -0
- package/dist/components/buy/multi-family/index.d.ts +2 -0
- package/dist/components/buy/multi-family/index.js +3 -0
- package/dist/components/buy/multi-family/index.js.map +1 -0
- package/dist/components/buy/single-family-selector.d.ts +15 -0
- package/dist/components/buy/single-family-selector.js +28 -0
- package/dist/components/buy/single-family-selector.js.map +1 -0
- package/dist/components/buy/single-family-selector.jsx +31 -0
- package/dist/components/buy/single-family-selector.jsx.map +1 -0
- package/dist/components/buy/title-and-byline.d.ts +8 -0
- package/dist/components/buy/title-and-byline.js +7 -0
- package/dist/components/buy/title-and-byline.js.map +1 -0
- package/dist/components/buy/title-and-byline.jsx +9 -0
- package/dist/components/buy/title-and-byline.jsx.map +1 -0
- package/dist/components/cart/cart-panel/cart-line-item.d.ts +11 -0
- package/dist/components/cart/cart-panel/cart-line-item.js +25 -0
- package/dist/components/cart/cart-panel/cart-line-item.js.map +1 -0
- package/dist/components/cart/cart-panel/cart-line-item.jsx +39 -0
- package/dist/components/cart/cart-panel/cart-line-item.jsx.map +1 -0
- package/dist/components/cart/cart-panel/index.d.ts +19 -0
- package/dist/components/cart/cart-panel/index.js +65 -0
- package/dist/components/cart/cart-panel/index.js.map +1 -0
- package/dist/components/cart/cart-panel/index.jsx +79 -0
- package/dist/components/cart/cart-panel/index.jsx.map +1 -0
- package/dist/components/cart/cart-panel/promo-code.d.ts +4 -0
- package/dist/components/cart/cart-panel/promo-code.js +62 -0
- package/dist/components/cart/cart-panel/promo-code.js.map +1 -0
- package/dist/components/cart/cart-panel/promo-code.jsx +74 -0
- package/dist/components/cart/cart-panel/promo-code.jsx.map +1 -0
- package/dist/components/cart/cart-panel/total-area.d.ts +7 -0
- package/dist/components/cart/cart-panel/total-area.js +14 -0
- package/dist/components/cart/cart-panel/total-area.js.map +1 -0
- package/dist/components/cart/cart-panel/total-area.jsx +37 -0
- package/dist/components/cart/cart-panel/total-area.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icon-row.d.ts +2 -0
- package/dist/components/checkout/payment-step-form/card-icon-row.js +14 -0
- package/dist/components/checkout/payment-step-form/card-icon-row.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icon-row.jsx +22 -0
- package/dist/components/checkout/payment-step-form/card-icon-row.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/amex.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/amex.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/amex.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/amex.jsx +12 -0
- package/dist/components/checkout/payment-step-form/card-icons/amex.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.jsx +10 -0
- package/dist/components/checkout/payment-step-form/card-icons/diners-club.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/discover.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/discover.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/discover.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/discover.jsx +12 -0
- package/dist/components/checkout/payment-step-form/card-icons/discover.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/jcb.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/jcb.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/jcb.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/jcb.jsx +23 -0
- package/dist/components/checkout/payment-step-form/card-icons/jcb.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.jsx +12 -0
- package/dist/components/checkout/payment-step-form/card-icons/mastercard.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/visa.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/card-icons/visa.js +6 -0
- package/dist/components/checkout/payment-step-form/card-icons/visa.js.map +1 -0
- package/dist/components/checkout/payment-step-form/card-icons/visa.jsx +10 -0
- package/dist/components/checkout/payment-step-form/card-icons/visa.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/cc-button.d.ts +3 -0
- package/dist/components/checkout/payment-step-form/cc-button.js +6 -0
- package/dist/components/checkout/payment-step-form/cc-button.js.map +1 -0
- package/dist/components/checkout/payment-step-form/cc-button.jsx +9 -0
- package/dist/components/checkout/payment-step-form/cc-button.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/contact-form.d.ts +5 -0
- package/dist/components/checkout/payment-step-form/contact-form.js +6 -0
- package/dist/components/checkout/payment-step-form/contact-form.js.map +1 -0
- package/dist/components/checkout/payment-step-form/contact-form.jsx +21 -0
- package/dist/components/checkout/payment-step-form/contact-form.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.js +6 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.js.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.jsx +8 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/btc.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.js +6 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.js.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.jsx +17 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/eth.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.js +6 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.js.map +1 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.jsx +10 -0
- package/dist/components/checkout/payment-step-form/crypto-icons/usdt.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/index.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/index.js +77 -0
- package/dist/components/checkout/payment-step-form/index.js.map +1 -0
- package/dist/components/checkout/payment-step-form/index.jsx +86 -0
- package/dist/components/checkout/payment-step-form/index.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.js +24 -0
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.js.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.jsx +44 -0
- package/dist/components/checkout/payment-step-form/methods/bank-transfer.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/card.d.ts +4 -0
- package/dist/components/checkout/payment-step-form/methods/card.js +160 -0
- package/dist/components/checkout/payment-step-form/methods/card.js.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/card.jsx +182 -0
- package/dist/components/checkout/payment-step-form/methods/card.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/crypto.d.ts +9 -0
- package/dist/components/checkout/payment-step-form/methods/crypto.js +137 -0
- package/dist/components/checkout/payment-step-form/methods/crypto.js.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/crypto.jsx +167 -0
- package/dist/components/checkout/payment-step-form/methods/crypto.jsx.map +1 -0
- package/dist/components/checkout/payment-step-form/methods/index.d.ts +6 -0
- package/dist/components/checkout/payment-step-form/methods/index.js +21 -0
- package/dist/components/checkout/payment-step-form/methods/index.js.map +1 -0
- package/dist/components/checkout/shipping-step-form.d.ts +3 -0
- package/dist/components/checkout/shipping-step-form.js +53 -0
- package/dist/components/checkout/shipping-step-form.js.map +1 -0
- package/dist/components/checkout/shipping-step-form.jsx +106 -0
- package/dist/components/checkout/shipping-step-form.jsx.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/item/product-card.d.ts +7 -0
- package/dist/components/item/product-card.js +9 -0
- package/dist/components/item/product-card.js.map +1 -0
- package/dist/components/item/product-card.jsx +21 -0
- package/dist/components/item/product-card.jsx.map +1 -0
- package/dist/components/item-selector/button.d.ts +4 -0
- package/dist/components/item-selector/button.js +47 -0
- package/dist/components/item-selector/button.js.map +1 -0
- package/dist/components/item-selector/button.jsx +65 -0
- package/dist/components/item-selector/button.jsx.map +1 -0
- package/dist/components/item-selector/carousel/index.d.ts +12 -0
- package/dist/components/item-selector/carousel/index.js +74 -0
- package/dist/components/item-selector/carousel/index.js.map +1 -0
- package/dist/components/item-selector/carousel/index.jsx +101 -0
- package/dist/components/item-selector/carousel/index.jsx.map +1 -0
- package/dist/components/item-selector/carousel/slider.d.ts +8 -0
- package/dist/components/item-selector/carousel/slider.js +12 -0
- package/dist/components/item-selector/carousel/slider.js.map +1 -0
- package/dist/components/item-selector/carousel/slider.jsx +11 -0
- package/dist/components/item-selector/carousel/slider.jsx.map +1 -0
- package/dist/components/item-selector/index.d.ts +2 -0
- package/dist/components/item-selector/index.js +3 -0
- package/dist/components/item-selector/index.js.map +1 -0
- package/dist/components/item-selector/quantity-indicator.d.ts +9 -0
- package/dist/components/item-selector/quantity-indicator.js +16 -0
- package/dist/components/item-selector/quantity-indicator.js.map +1 -0
- package/dist/components/item-selector/quantity-indicator.jsx +23 -0
- package/dist/components/item-selector/quantity-indicator.jsx.map +1 -0
- package/dist/components/node-tabs/index.d.ts +14 -0
- package/dist/components/node-tabs/index.js +42 -0
- package/dist/components/node-tabs/index.js.map +1 -0
- package/dist/components/node-tabs/index.jsx +48 -0
- package/dist/components/node-tabs/index.jsx.map +1 -0
- package/dist/components/node-tabs/node-image.d.ts +6 -0
- package/dist/components/node-tabs/node-image.js +13 -0
- package/dist/components/node-tabs/node-image.js.map +1 -0
- package/dist/components/node-tabs/node-image.jsx +12 -0
- package/dist/components/node-tabs/node-image.jsx.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/service/context.d.ts +8 -0
- package/dist/service/context.js +19 -0
- package/dist/service/context.js.map +1 -0
- package/dist/service/context.jsx +20 -0
- package/dist/service/context.jsx.map +1 -0
- package/dist/service/debug.d.ts +10 -0
- package/dist/service/debug.js +30 -0
- package/dist/service/debug.js.map +1 -0
- package/dist/service/impls/standalone/actual-line-item.d.ts +40 -0
- package/dist/service/impls/standalone/actual-line-item.js +84 -0
- package/dist/service/impls/standalone/actual-line-item.js.map +1 -0
- package/dist/service/impls/standalone/get-instance.d.ts +2 -0
- package/dist/service/impls/standalone/get-instance.js +39 -0
- package/dist/service/impls/standalone/get-instance.js.map +1 -0
- package/dist/service/impls/standalone/index.d.ts +67 -0
- package/dist/service/impls/standalone/index.js +416 -0
- package/dist/service/impls/standalone/index.js.map +1 -0
- package/dist/service/impls/standalone/order/firebase.d.ts +6 -0
- package/dist/service/impls/standalone/order/firebase.js +6 -0
- package/dist/service/impls/standalone/order/firebase.js.map +1 -0
- package/dist/service/impls/standalone/order/index.d.ts +30 -0
- package/dist/service/impls/standalone/order/index.js +21 -0
- package/dist/service/impls/standalone/order/index.js.map +1 -0
- package/dist/service/impls/standalone/persistence.d.ts +4 -0
- package/dist/service/impls/standalone/persistence.js +22 -0
- package/dist/service/impls/standalone/persistence.js.map +1 -0
- package/dist/service/path-utils.d.ts +7 -0
- package/dist/service/path-utils.js +16 -0
- package/dist/service/path-utils.js.map +1 -0
- package/dist/service/sep.d.ts +6 -0
- package/dist/service/sep.js +6 -0
- package/dist/service/sep.js.map +1 -0
- package/dist/types/category-node.d.ts +36 -0
- package/dist/types/category-node.js +2 -0
- package/dist/types/category-node.js.map +1 -0
- package/dist/types/checkout.d.ts +33 -0
- package/dist/types/checkout.js +2 -0
- package/dist/types/checkout.js.map +1 -0
- package/dist/types/commerce-config.d.ts +11 -0
- package/dist/types/commerce-config.js +2 -0
- package/dist/types/commerce-config.js.map +1 -0
- package/dist/types/commerce-service.d.ts +109 -0
- package/dist/types/commerce-service.js +2 -0
- package/dist/types/commerce-service.js.map +1 -0
- package/dist/types/family.d.ts +16 -0
- package/dist/types/family.js +2 -0
- package/dist/types/family.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/item-selector.d.ts +72 -0
- package/dist/types/item-selector.js +2 -0
- package/dist/types/item-selector.js.map +1 -0
- package/dist/types/line-item.d.ts +14 -0
- package/dist/types/line-item.js +2 -0
- package/dist/types/line-item.js.map +1 -0
- package/dist/types/multi-family-selector-props.d.ts +16 -0
- package/dist/types/multi-family-selector-props.js +2 -0
- package/dist/types/multi-family-selector-props.js.map +1 -0
- package/dist/types/product.d.ts +15 -0
- package/dist/types/product.js +2 -0
- package/dist/types/product.js.map +1 -0
- package/dist/types/promo.d.ts +7 -0
- package/dist/types/promo.js +2 -0
- package/dist/types/promo.js.map +1 -0
- package/dist/types/selection-ui-specifier.d.ts +40 -0
- package/dist/types/selection-ui-specifier.js +2 -0
- package/dist/types/selection-ui-specifier.js.map +1 -0
- package/dist/types/string-mutator.d.ts +9 -0
- package/dist/types/string-mutator.js +2 -0
- package/dist/types/string-mutator.js.map +1 -0
- package/dist/types/token-separators.d.ts +6 -0
- package/dist/types/token-separators.js +2 -0
- package/dist/types/token-separators.js.map +1 -0
- package/dist/util/analytics.d.ts +9 -0
- package/dist/util/analytics.js +10 -0
- package/dist/util/analytics.js.map +1 -0
- package/dist/util/countries.d.ts +7 -0
- package/dist/util/countries.js +197 -0
- package/dist/util/countries.js.map +1 -0
- package/dist/util/error.d.ts +1 -0
- package/dist/util/error.js +22 -0
- package/dist/util/error.js.map +1 -0
- package/dist/util/index.d.ts +15 -0
- package/dist/util/index.js +54 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/item-selector-options-accessor.d.ts +3 -0
- package/dist/util/item-selector-options-accessor.js +27 -0
- package/dist/util/item-selector-options-accessor.js.map +1 -0
- package/dist/util/line-item-ref.d.ts +8 -0
- package/dist/util/line-item-ref.js +15 -0
- package/dist/util/line-item-ref.js.map +1 -0
- package/dist/util/multi-family-selector-options-accessor.d.ts +3 -0
- package/dist/util/multi-family-selector-options-accessor.js +11 -0
- package/dist/util/multi-family-selector-options-accessor.js.map +1 -0
- package/dist/util/obs-string-mutator.d.ts +8 -0
- package/dist/util/obs-string-mutator.js +15 -0
- package/dist/util/obs-string-mutator.js.map +1 -0
- package/dist/util/product-media-accessor.d.ts +29 -0
- package/dist/util/product-media-accessor.js +22 -0
- package/dist/util/product-media-accessor.js.map +1 -0
- package/dist/util/promo-codes.d.ts +3 -0
- package/dist/util/promo-codes.js +100 -0
- package/dist/util/promo-codes.js.map +1 -0
- package/dist/util/selection-ui-specifiers.d.ts +3 -0
- package/dist/util/selection-ui-specifiers.js +24 -0
- package/dist/util/selection-ui-specifiers.js.map +1 -0
- package/dist/util/square-payment.d.ts +7 -0
- package/dist/util/square-payment.js +37 -0
- package/dist/util/square-payment.js.map +1 -0
- package/dist/util/use-sync-sku-param-w-current-item.d.ts +2 -0
- package/dist/util/use-sync-sku-param-w-current-item.js +61 -0
- package/dist/util/use-sync-sku-param-w-current-item.js.map +1 -0
- package/index.ts +9 -5
- package/package.json +13 -12
- package/service/impls/standalone/order/firebase.ts +5 -14
- package/service/impls/standalone/order/index.ts +16 -87
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
WARN Issue while reading "/Users/z/work/hanzo/ui/pkg/commerce/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
|
|
2
|
+
|
|
3
|
+
> @hanzo/commerce@7.5.0 build /Users/z/work/hanzo/ui/pkg/commerce
|
|
4
|
+
> tsc --outDir dist --declaration --emitDeclarationOnly false --module ESNext --esModuleInterop true --skipLibCheck true --sourceMap true
|
|
5
|
+
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 hanzo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/billing.ts
ADDED
package/client.ts
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hanzo/commerce/client
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the Hanzo Commerce API.
|
|
5
|
+
* Handles billing, subscriptions, payments, usage, plans — all commerce operations.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Commerce } from '@hanzo/commerce'
|
|
10
|
+
*
|
|
11
|
+
* const commerce = new Commerce({
|
|
12
|
+
* commerceUrl: 'https://commerce.hanzo.ai',
|
|
13
|
+
* token: iamAccessToken,
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* // Balance
|
|
17
|
+
* const balance = await commerce.getBalance('hanzo/alice')
|
|
18
|
+
*
|
|
19
|
+
* // Usage
|
|
20
|
+
* await commerce.addUsageRecord({ user: 'hanzo/alice', amount: 150, model: 'claude-opus-4-6' })
|
|
21
|
+
*
|
|
22
|
+
* // Subscribe
|
|
23
|
+
* await commerce.subscribe({ planId: 'growth', userId: 'hanzo/alice' })
|
|
24
|
+
*
|
|
25
|
+
* // Charge
|
|
26
|
+
* await commerce.charge(orderId)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Config
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
export type CommerceClientConfig = {
|
|
35
|
+
/** Commerce API base URL (e.g. "https://commerce.hanzo.ai"). */
|
|
36
|
+
commerceUrl: string
|
|
37
|
+
/** Optional IAM access token for authenticated requests. */
|
|
38
|
+
token?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Types
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
export type Balance = {
|
|
47
|
+
balance: number
|
|
48
|
+
holds: number
|
|
49
|
+
available: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type Transaction = {
|
|
53
|
+
id?: string
|
|
54
|
+
owner?: string
|
|
55
|
+
type: 'hold' | 'hold-removed' | 'transfer' | 'deposit' | 'withdraw'
|
|
56
|
+
destinationId?: string
|
|
57
|
+
destinationKind?: string
|
|
58
|
+
sourceId?: string
|
|
59
|
+
sourceKind?: string
|
|
60
|
+
currency: string
|
|
61
|
+
amount: number
|
|
62
|
+
tags?: string[]
|
|
63
|
+
expiresAt?: string
|
|
64
|
+
metadata?: Record<string, unknown>
|
|
65
|
+
createdAt?: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type Subscription = {
|
|
69
|
+
id?: string
|
|
70
|
+
planId?: string
|
|
71
|
+
userId?: string
|
|
72
|
+
status?: 'trialing' | 'active' | 'past_due' | 'canceled' | 'unpaid' | string
|
|
73
|
+
billingType?: 'charge_automatically' | 'send_invoice'
|
|
74
|
+
periodStart?: string
|
|
75
|
+
periodEnd?: string
|
|
76
|
+
trialStart?: string
|
|
77
|
+
trialEnd?: string
|
|
78
|
+
quantity?: number
|
|
79
|
+
createdAt?: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type Plan = {
|
|
83
|
+
slug?: string
|
|
84
|
+
name?: string
|
|
85
|
+
description?: string
|
|
86
|
+
price?: number
|
|
87
|
+
currency?: string
|
|
88
|
+
interval?: 'monthly' | 'yearly' | string
|
|
89
|
+
intervalCount?: number
|
|
90
|
+
trialPeriodDays?: number
|
|
91
|
+
metadata?: Record<string, unknown>
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type Payment = {
|
|
95
|
+
id?: string
|
|
96
|
+
orderId?: string
|
|
97
|
+
userId?: string
|
|
98
|
+
amount?: number
|
|
99
|
+
amountRefunded?: number
|
|
100
|
+
fee?: number
|
|
101
|
+
currency?: string
|
|
102
|
+
status?: 'cancelled' | 'credit' | 'disputed' | 'failed' | 'fraudulent' | 'paid' | 'refunded' | 'unpaid' | string
|
|
103
|
+
captured?: boolean
|
|
104
|
+
live?: boolean
|
|
105
|
+
createdAt?: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type UsageRecord = {
|
|
109
|
+
user: string
|
|
110
|
+
currency?: string
|
|
111
|
+
amount: number
|
|
112
|
+
model?: string
|
|
113
|
+
provider?: string
|
|
114
|
+
tokens?: number
|
|
115
|
+
promptTokens?: number
|
|
116
|
+
completionTokens?: number
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Client
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
const DEFAULT_TIMEOUT_MS = 10_000
|
|
124
|
+
|
|
125
|
+
export class Commerce {
|
|
126
|
+
private readonly baseUrl: string
|
|
127
|
+
private token: string | undefined
|
|
128
|
+
|
|
129
|
+
constructor(config: CommerceClientConfig) {
|
|
130
|
+
this.baseUrl = config.commerceUrl.replace(/\/+$/, '')
|
|
131
|
+
this.token = config.token
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Update the auth token (e.g. after IAM token refresh). */
|
|
135
|
+
setToken(token: string) {
|
|
136
|
+
this.token = token
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private async request<T>(
|
|
140
|
+
path: string,
|
|
141
|
+
opts?: {
|
|
142
|
+
method?: string
|
|
143
|
+
body?: unknown
|
|
144
|
+
token?: string
|
|
145
|
+
params?: Record<string, string>
|
|
146
|
+
},
|
|
147
|
+
): Promise<T> {
|
|
148
|
+
const url = new URL(path, this.baseUrl)
|
|
149
|
+
if (opts?.params) {
|
|
150
|
+
for (const [k, v] of Object.entries(opts.params)) {
|
|
151
|
+
url.searchParams.set(k, v)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const controller = new AbortController()
|
|
156
|
+
const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS)
|
|
157
|
+
|
|
158
|
+
const headers: Record<string, string> = { Accept: 'application/json' }
|
|
159
|
+
const authToken = opts?.token ?? this.token
|
|
160
|
+
if (authToken) headers.Authorization = `Bearer ${authToken}`
|
|
161
|
+
if (opts?.body) headers['Content-Type'] = 'application/json'
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
const res = await fetch(url.toString(), {
|
|
165
|
+
method: opts?.method ?? 'GET',
|
|
166
|
+
headers,
|
|
167
|
+
body: opts?.body ? JSON.stringify(opts.body) : undefined,
|
|
168
|
+
signal: controller.signal,
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
if (!res.ok) {
|
|
172
|
+
const text = await res.text().catch(() => '')
|
|
173
|
+
throw new CommerceApiError(res.status, `${res.statusText}: ${text}`.trim())
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return (await res.json()) as T
|
|
177
|
+
} finally {
|
|
178
|
+
clearTimeout(timer)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// -----------------------------------------------------------------------
|
|
183
|
+
// Balance
|
|
184
|
+
// -----------------------------------------------------------------------
|
|
185
|
+
|
|
186
|
+
async getBalance(user: string, currency = 'usd', token?: string): Promise<Balance> {
|
|
187
|
+
return this.request<Balance>('/api/v1/billing/balance', {
|
|
188
|
+
params: { user, currency }, token,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async getAllBalances(user: string, token?: string): Promise<Record<string, Balance>> {
|
|
193
|
+
return this.request<Record<string, Balance>>('/api/v1/billing/balance/all', {
|
|
194
|
+
params: { user }, token,
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// -----------------------------------------------------------------------
|
|
199
|
+
// Usage
|
|
200
|
+
// -----------------------------------------------------------------------
|
|
201
|
+
|
|
202
|
+
async addUsageRecord(record: UsageRecord, token?: string): Promise<Transaction> {
|
|
203
|
+
return this.request<Transaction>('/api/v1/billing/usage', {
|
|
204
|
+
method: 'POST', body: record, token,
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async getUsageRecords(user: string, currency = 'usd', token?: string): Promise<Transaction[]> {
|
|
209
|
+
return this.request<Transaction[]>('/api/v1/billing/usage', {
|
|
210
|
+
params: { user, currency }, token,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// -----------------------------------------------------------------------
|
|
215
|
+
// Deposits / Credits
|
|
216
|
+
// -----------------------------------------------------------------------
|
|
217
|
+
|
|
218
|
+
async addDeposit(
|
|
219
|
+
params: { user: string; currency?: string; amount: number; notes?: string; tags?: string[]; expiresIn?: string },
|
|
220
|
+
token?: string,
|
|
221
|
+
): Promise<Transaction> {
|
|
222
|
+
return this.request<Transaction>('/api/v1/billing/deposit', {
|
|
223
|
+
method: 'POST', body: params, token,
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
async grantStarterCredit(user: string, token?: string): Promise<Transaction> {
|
|
228
|
+
return this.request<Transaction>('/api/v1/billing/credit', {
|
|
229
|
+
method: 'POST', body: { user }, token,
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// -----------------------------------------------------------------------
|
|
234
|
+
// Subscriptions
|
|
235
|
+
// -----------------------------------------------------------------------
|
|
236
|
+
|
|
237
|
+
async subscribe(params: { planId: string; userId: string; paymentToken?: string }, token?: string): Promise<Subscription> {
|
|
238
|
+
return this.request<Subscription>('/api/v1/subscribe', {
|
|
239
|
+
method: 'POST', body: params, token,
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async getSubscription(subscriptionId: string, token?: string): Promise<Subscription | null> {
|
|
244
|
+
try {
|
|
245
|
+
return await this.request<Subscription>(`/api/v1/subscribe/${subscriptionId}`, { token })
|
|
246
|
+
} catch { return null }
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async updateSubscription(subscriptionId: string, update: Partial<Subscription>, token?: string): Promise<Subscription> {
|
|
250
|
+
return this.request<Subscription>(`/api/v1/subscribe/${subscriptionId}`, {
|
|
251
|
+
method: 'PATCH', body: update, token,
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async cancelSubscription(subscriptionId: string, token?: string): Promise<void> {
|
|
256
|
+
await this.request<void>(`/api/v1/subscribe/${subscriptionId}`, {
|
|
257
|
+
method: 'DELETE', token,
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// -----------------------------------------------------------------------
|
|
262
|
+
// Checkout / Payments
|
|
263
|
+
// -----------------------------------------------------------------------
|
|
264
|
+
|
|
265
|
+
async authorize(orderId: string, token?: string): Promise<Payment> {
|
|
266
|
+
return this.request<Payment>(`/api/v1/authorize/${orderId}`, { method: 'POST', token })
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
async capture(orderId: string, token?: string): Promise<Payment> {
|
|
270
|
+
return this.request<Payment>(`/api/v1/capture/${orderId}`, { method: 'POST', token })
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async charge(orderId: string, token?: string): Promise<Payment> {
|
|
274
|
+
return this.request<Payment>(`/api/v1/charge/${orderId}`, { method: 'POST', token })
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async refund(paymentId: string, token?: string): Promise<Payment> {
|
|
278
|
+
return this.request<Payment>(`/api/v1/refund/${paymentId}`, { method: 'POST', token })
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Issue a billing refund (correction deposit) for an overcharge.
|
|
283
|
+
* Creates a deposit tagged "refund" linked to the original transaction.
|
|
284
|
+
*/
|
|
285
|
+
async billingRefund(params: {
|
|
286
|
+
user: string
|
|
287
|
+
amount: number
|
|
288
|
+
originalTransactionId: string
|
|
289
|
+
currency?: string
|
|
290
|
+
notes?: string
|
|
291
|
+
}, token?: string): Promise<Transaction> {
|
|
292
|
+
return this.request<Transaction>('/api/v1/billing/refund', {
|
|
293
|
+
method: 'POST', body: params, token,
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// -----------------------------------------------------------------------
|
|
298
|
+
// Plans
|
|
299
|
+
// -----------------------------------------------------------------------
|
|
300
|
+
|
|
301
|
+
async getPlans(token?: string): Promise<Plan[]> {
|
|
302
|
+
return this.request<Plan[]>('/api/v1/plan', { token })
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
async getPlan(planId: string, token?: string): Promise<Plan | null> {
|
|
306
|
+
try {
|
|
307
|
+
return await this.request<Plan>(`/api/v1/plan/${planId}`, { token })
|
|
308
|
+
} catch { return null }
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Error
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
|
|
317
|
+
export class CommerceApiError extends Error {
|
|
318
|
+
readonly status: number
|
|
319
|
+
|
|
320
|
+
constructor(status: number, message: string) {
|
|
321
|
+
super(message)
|
|
322
|
+
this.name = 'CommerceApiError'
|
|
323
|
+
this.status = status
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -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 as any),
|
|
39
39
|
defaultValues: {
|
|
40
40
|
name: auth?.user?.displayName ?? '',
|
|
41
41
|
email: auth?.user?.email ?? '',
|
|
@@ -111,7 +111,7 @@ const PaymentStepForm: React.FC<CheckoutStepComponentProps> = observer(({
|
|
|
111
111
|
transactionStatus={transactionStatus}
|
|
112
112
|
setTransactionStatus={setTransactionStatus}
|
|
113
113
|
storePaymentInfo={storePaymentInfo}
|
|
114
|
-
contactForm={contactForm}
|
|
114
|
+
contactForm={contactForm as any}
|
|
115
115
|
/>
|
|
116
116
|
</TabsContent>
|
|
117
117
|
))}
|
|
@@ -45,7 +45,7 @@ const ShippingStepForm: React.FC<CheckoutStepComponentProps> = ({
|
|
|
45
45
|
const cmmc = useCommerce()
|
|
46
46
|
|
|
47
47
|
const shippingForm = useForm<z.infer<typeof shippingFormSchema>>({
|
|
48
|
-
resolver: zodResolver(shippingFormSchema),
|
|
48
|
+
resolver: zodResolver(shippingFormSchema as any),
|
|
49
49
|
defaultValues: {
|
|
50
50
|
addressLine1: '',
|
|
51
51
|
addressLine2: '',
|
package/dist/billing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../billing.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,cAAc,UAAU,CAAA"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hanzo/commerce/client
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the Hanzo Commerce API.
|
|
5
|
+
* Handles billing, subscriptions, payments, usage, plans — all commerce operations.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Commerce } from '@hanzo/commerce'
|
|
10
|
+
*
|
|
11
|
+
* const commerce = new Commerce({
|
|
12
|
+
* commerceUrl: 'https://commerce.hanzo.ai',
|
|
13
|
+
* token: iamAccessToken,
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* // Balance
|
|
17
|
+
* const balance = await commerce.getBalance('hanzo/alice')
|
|
18
|
+
*
|
|
19
|
+
* // Usage
|
|
20
|
+
* await commerce.addUsageRecord({ user: 'hanzo/alice', amount: 150, model: 'claude-opus-4-6' })
|
|
21
|
+
*
|
|
22
|
+
* // Subscribe
|
|
23
|
+
* await commerce.subscribe({ planId: 'growth', userId: 'hanzo/alice' })
|
|
24
|
+
*
|
|
25
|
+
* // Charge
|
|
26
|
+
* await commerce.charge(orderId)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type CommerceClientConfig = {
|
|
30
|
+
/** Commerce API base URL (e.g. "https://commerce.hanzo.ai"). */
|
|
31
|
+
commerceUrl: string;
|
|
32
|
+
/** Optional IAM access token for authenticated requests. */
|
|
33
|
+
token?: string;
|
|
34
|
+
};
|
|
35
|
+
export type Balance = {
|
|
36
|
+
balance: number;
|
|
37
|
+
holds: number;
|
|
38
|
+
available: number;
|
|
39
|
+
};
|
|
40
|
+
export type Transaction = {
|
|
41
|
+
id?: string;
|
|
42
|
+
owner?: string;
|
|
43
|
+
type: 'hold' | 'hold-removed' | 'transfer' | 'deposit' | 'withdraw';
|
|
44
|
+
destinationId?: string;
|
|
45
|
+
destinationKind?: string;
|
|
46
|
+
sourceId?: string;
|
|
47
|
+
sourceKind?: string;
|
|
48
|
+
currency: string;
|
|
49
|
+
amount: number;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
expiresAt?: string;
|
|
52
|
+
metadata?: Record<string, unknown>;
|
|
53
|
+
createdAt?: string;
|
|
54
|
+
};
|
|
55
|
+
export type Subscription = {
|
|
56
|
+
id?: string;
|
|
57
|
+
planId?: string;
|
|
58
|
+
userId?: string;
|
|
59
|
+
status?: 'trialing' | 'active' | 'past_due' | 'canceled' | 'unpaid' | string;
|
|
60
|
+
billingType?: 'charge_automatically' | 'send_invoice';
|
|
61
|
+
periodStart?: string;
|
|
62
|
+
periodEnd?: string;
|
|
63
|
+
trialStart?: string;
|
|
64
|
+
trialEnd?: string;
|
|
65
|
+
quantity?: number;
|
|
66
|
+
createdAt?: string;
|
|
67
|
+
};
|
|
68
|
+
export type Plan = {
|
|
69
|
+
slug?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
price?: number;
|
|
73
|
+
currency?: string;
|
|
74
|
+
interval?: 'monthly' | 'yearly' | string;
|
|
75
|
+
intervalCount?: number;
|
|
76
|
+
trialPeriodDays?: number;
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
};
|
|
79
|
+
export type Payment = {
|
|
80
|
+
id?: string;
|
|
81
|
+
orderId?: string;
|
|
82
|
+
userId?: string;
|
|
83
|
+
amount?: number;
|
|
84
|
+
amountRefunded?: number;
|
|
85
|
+
fee?: number;
|
|
86
|
+
currency?: string;
|
|
87
|
+
status?: 'cancelled' | 'credit' | 'disputed' | 'failed' | 'fraudulent' | 'paid' | 'refunded' | 'unpaid' | string;
|
|
88
|
+
captured?: boolean;
|
|
89
|
+
live?: boolean;
|
|
90
|
+
createdAt?: string;
|
|
91
|
+
};
|
|
92
|
+
export type UsageRecord = {
|
|
93
|
+
user: string;
|
|
94
|
+
currency?: string;
|
|
95
|
+
amount: number;
|
|
96
|
+
model?: string;
|
|
97
|
+
provider?: string;
|
|
98
|
+
tokens?: number;
|
|
99
|
+
promptTokens?: number;
|
|
100
|
+
completionTokens?: number;
|
|
101
|
+
};
|
|
102
|
+
export declare class Commerce {
|
|
103
|
+
private readonly baseUrl;
|
|
104
|
+
private token;
|
|
105
|
+
constructor(config: CommerceClientConfig);
|
|
106
|
+
/** Update the auth token (e.g. after IAM token refresh). */
|
|
107
|
+
setToken(token: string): void;
|
|
108
|
+
private request;
|
|
109
|
+
getBalance(user: string, currency?: string, token?: string): Promise<Balance>;
|
|
110
|
+
getAllBalances(user: string, token?: string): Promise<Record<string, Balance>>;
|
|
111
|
+
addUsageRecord(record: UsageRecord, token?: string): Promise<Transaction>;
|
|
112
|
+
getUsageRecords(user: string, currency?: string, token?: string): Promise<Transaction[]>;
|
|
113
|
+
addDeposit(params: {
|
|
114
|
+
user: string;
|
|
115
|
+
currency?: string;
|
|
116
|
+
amount: number;
|
|
117
|
+
notes?: string;
|
|
118
|
+
tags?: string[];
|
|
119
|
+
expiresIn?: string;
|
|
120
|
+
}, token?: string): Promise<Transaction>;
|
|
121
|
+
grantStarterCredit(user: string, token?: string): Promise<Transaction>;
|
|
122
|
+
subscribe(params: {
|
|
123
|
+
planId: string;
|
|
124
|
+
userId: string;
|
|
125
|
+
paymentToken?: string;
|
|
126
|
+
}, token?: string): Promise<Subscription>;
|
|
127
|
+
getSubscription(subscriptionId: string, token?: string): Promise<Subscription | null>;
|
|
128
|
+
updateSubscription(subscriptionId: string, update: Partial<Subscription>, token?: string): Promise<Subscription>;
|
|
129
|
+
cancelSubscription(subscriptionId: string, token?: string): Promise<void>;
|
|
130
|
+
authorize(orderId: string, token?: string): Promise<Payment>;
|
|
131
|
+
capture(orderId: string, token?: string): Promise<Payment>;
|
|
132
|
+
charge(orderId: string, token?: string): Promise<Payment>;
|
|
133
|
+
refund(paymentId: string, token?: string): Promise<Payment>;
|
|
134
|
+
/**
|
|
135
|
+
* Issue a billing refund (correction deposit) for an overcharge.
|
|
136
|
+
* Creates a deposit tagged "refund" linked to the original transaction.
|
|
137
|
+
*/
|
|
138
|
+
billingRefund(params: {
|
|
139
|
+
user: string;
|
|
140
|
+
amount: number;
|
|
141
|
+
originalTransactionId: string;
|
|
142
|
+
currency?: string;
|
|
143
|
+
notes?: string;
|
|
144
|
+
}, token?: string): Promise<Transaction>;
|
|
145
|
+
getPlans(token?: string): Promise<Plan[]>;
|
|
146
|
+
getPlan(planId: string, token?: string): Promise<Plan | null>;
|
|
147
|
+
}
|
|
148
|
+
export declare class CommerceApiError extends Error {
|
|
149
|
+
readonly status: number;
|
|
150
|
+
constructor(status: number, message: string);
|
|
151
|
+
}
|