@simpleapps-com/augur-hooks 2.2.21 → 2.2.23
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/dist/checkout/index.cjs +33 -24
- package/dist/checkout/index.cjs.map +1 -1
- package/dist/checkout/index.d.cts +3 -1
- package/dist/checkout/index.d.ts +3 -1
- package/dist/checkout/index.js +14 -5
- package/dist/checkout/index.js.map +1 -1
- package/dist/{chunk-ONB6O35U.js → chunk-5YN2RPZ4.js} +119 -13
- package/dist/chunk-5YN2RPZ4.js.map +1 -0
- package/dist/{chunk-EOHLFKJN.cjs → chunk-XLBU5PCT.cjs} +113 -7
- package/dist/chunk-XLBU5PCT.cjs.map +1 -0
- package/dist/index.cjs +18 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -72
- package/dist/index.js.map +1 -1
- package/dist/{use-payment-flow-DF8OEQiq.d.cts → use-payment-flow-u8RwBTbO.d.cts} +3 -1
- package/dist/{use-payment-flow-DF8OEQiq.d.ts → use-payment-flow-u8RwBTbO.d.ts} +3 -1
- package/package.json +3 -3
- package/dist/chunk-EOHLFKJN.cjs.map +0 -1
- package/dist/chunk-ONB6O35U.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stores/cart-store.ts","../src/hooks/use-payment-flow.ts","../src/hooks/use-order-readiness.ts"],"sourcesContent":["import { create } from \"zustand\";\nimport { devtools } from \"zustand/middleware\";\nimport type { TCartLine } from \"@simpleapps-com/augur-utils\";\n\n/** Internal state shape for the cart Zustand store. */\ninterface CartState {\n /** P21 cart header UID; `undefined` when no cart exists. */\n cartHdrUid: number | string | undefined;\n /** Current line items in the cart. */\n cartLines: TCartLine[];\n /** Sum of `quantity` across all cart lines (auto-computed by `setCartLines`). */\n cartQuantityTotal: number;\n /** Number of distinct line items (auto-computed by `setCartLines`). */\n cartLineCount: number;\n setCartHdrUid: (cartHdrUid: number | string | undefined) => void;\n /** Replace all cart lines. Auto-recomputes `cartQuantityTotal` and `cartLineCount`. */\n setCartLines: (cartLines: TCartLine[]) => void;\n /** Reset the cart to its empty initial state. */\n clearCart: () => void;\n}\n\n/** Zustand store for cart state. Prefer the individual selector hooks below for optimal re-renders. */\nexport const useCartStore = create<CartState>()(\n devtools(\n (set) => ({\n cartHdrUid: undefined,\n cartLines: [],\n cartQuantityTotal: 0,\n cartLineCount: 0,\n\n setCartHdrUid: (cartHdrUid) => set({ cartHdrUid }, false, \"setCartHdrUid\"),\n\n setCartLines: (cartLines) => {\n const cartQuantityTotal = cartLines.reduce((sum, line) => sum + (line.quantity || 0), 0);\n const cartLineCount = cartLines.length;\n set({ cartLines, cartQuantityTotal, cartLineCount }, false, \"setCartLines\");\n },\n\n clearCart: () =>\n set(\n { cartHdrUid: undefined, cartLines: [], cartQuantityTotal: 0, cartLineCount: 0 },\n false,\n \"clearCart\",\n ),\n }),\n { name: \"CartStore\", enabled: process.env[\"NODE_ENV\"] === \"development\" },\n ),\n);\n\n// Selector hooks -- only re-render when specific state changes\n\n/** Select the current cart header UID. */\nexport const useCartHdrUid = () => useCartStore((s) => s.cartHdrUid);\n/** Select the current cart line items array. */\nexport const useCartLines = () => useCartStore((s) => s.cartLines);\n/** Select the total quantity summed across all cart lines. */\nexport const useCartQuantityTotal = () => useCartStore((s) => s.cartQuantityTotal);\n/** Select the number of distinct line items in the cart. */\nexport const useCartLineCount = () => useCartStore((s) => s.cartLineCount);\n/** Get the `setCartHdrUid` action (stable reference). */\nexport const useSetCartHdrUid = () => useCartStore((s) => s.setCartHdrUid);\n/** Get the `setCartLines` action (stable reference). Also recomputes totals. */\nexport const useSetCartLines = () => useCartStore((s) => s.setCartLines);\n/** Get the `clearCart` action (stable reference). */\nexport const useClearCart = () => useCartStore((s) => s.clearCart);\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type {\n TTransactionSetup,\n TCardInfo,\n TPaymentValidation,\n TAccountQuery,\n TBillingUpdate,\n} from \"@simpleapps-com/augur-utils\";\n\n/** Site-specific payment action callbacks injected into usePaymentFlow. */\nexport interface PaymentFlowCallbacks {\n /** Initialize a payment session. Returns transaction setup or undefined on failure. */\n transactionSetup: (params: { customerId: string }) => Promise<TTransactionSetup | undefined>;\n /** Retrieve card details after iframe entry. */\n cardInfo: (params: { transactionSetupId: string }) => Promise<TCardInfo | undefined>;\n /** Verify card is valid. */\n validatePayment: (params: {\n transactionSetupId: string;\n customerId: string;\n }) => Promise<TPaymentValidation | undefined>;\n /** Get payment account ID. */\n accountQuery: (params: {\n transactionSetupId: string;\n customerId: string;\n }) => Promise<TAccountQuery | undefined>;\n /** Send billing address to payment processor. */\n billingUpdate: (params: {\n transactionSetupId: string;\n address1: string;\n address2?: string;\n city: string;\n state: string;\n zip: string;\n }) => Promise<TBillingUpdate | undefined>;\n /** Optional toast notification callback. */\n toast?: {\n error?: (message: string) => void;\n };\n}\n\n/** Billing address shape accepted by the payment flow. */\nexport interface PaymentBillingAddress {\n address1: string;\n address2?: string;\n city: string;\n state: string;\n postalCode: string;\n}\n\ninterface UsePaymentFlowParams {\n callbacks: PaymentFlowCallbacks;\n customerId: string | number | undefined;\n billingAddress: PaymentBillingAddress | undefined;\n paymentMethod: string;\n shippingAccepted: boolean;\n}\n\n/**\n * Manages the full Element/Unified payment lifecycle:\n * transactionSetup -> cardInfo -> validatePayment -> accountQuery -> billingUpdate\n *\n * Accepts site-specific server action callbacks so the hook has no dependency\n * on any particular server action implementation.\n *\n * @example\n * ```tsx\n * import { usePaymentFlow } from \"@simpleapps-com/augur-hooks\";\n * import { transactionSetup, cardInfo, validatePayment, accountQuery, billingUpdate } from \"@/lib/actions/payments\";\n *\n * const payment = usePaymentFlow({\n * callbacks: { transactionSetup, cardInfo, validatePayment, accountQuery, billingUpdate },\n * customerId,\n * billingAddress,\n * paymentMethod: \"credit-card\",\n * shippingAccepted: true,\n * });\n * ```\n */\nexport function usePaymentFlow({\n callbacks,\n customerId,\n billingAddress,\n paymentMethod,\n shippingAccepted,\n}: UsePaymentFlowParams) {\n const [isOpen, setIsOpen] = useState(false);\n const [unified, setUnified] = useState<TTransactionSetup | null>(null);\n const [unifiedCc, setUnifiedCc] = useState<TCardInfo | null>(null);\n const [unifiedResponse, setUnifiedResponse] = useState(false);\n const [unifiedBilling, setUnifiedBilling] = useState(false);\n const [unifiedPayment, setUnifiedPayment] = useState<TAccountQuery | null>(null);\n const [capturedBin, setCapturedBin] = useState<string | null>(null);\n const [editCc, setEditCc] = useState(false);\n\n const handleBinCapture = useCallback((bin: string) => {\n setCapturedBin(bin);\n }, []);\n\n // Ref ensures callbacks always read the latest customerId, avoiding stale\n // closures when React batches state updates (e.g., modal close + verify).\n const customerIdRef = useRef(customerId);\n customerIdRef.current = customerId;\n\n // Step 1: Initialize payment session\n const postUnified = useCallback(async () => {\n if (!customerIdRef.current) return;\n try {\n const result = await callbacks.transactionSetup({\n customerId: String(customerIdRef.current),\n });\n if (!result) {\n callbacks.toast?.error?.(\"Unable to initialize payment. Please try again.\");\n return;\n }\n setUnified(result);\n } catch (error) {\n console.error(\"transactionSetup failed:\", error);\n callbacks.toast?.error?.(\"Unable to initialize payment. Please try again.\");\n }\n }, [callbacks]);\n\n // Step 2: Get card info after iframe entry\n const getCardInfo = useCallback(async () => {\n /* v8 ignore next -- defensive: caller (verifyUnified) already guards */\n if (!unified?.transactionSetupId) return;\n try {\n const result = await callbacks.cardInfo({ transactionSetupId: unified.transactionSetupId });\n if (!result) {\n callbacks.toast?.error?.(\"Unable to verify card details. Please try again.\");\n return;\n }\n setUnifiedCc(result);\n } catch (error) {\n console.error(\"cardInfo failed:\", error);\n callbacks.toast?.error?.(\"Unable to verify card details. Please try again.\");\n }\n }, [unified, callbacks]);\n\n // Step 3: Validate payment\n const verifyUnified = useCallback(async () => {\n if (!unified?.transactionSetupId || !customerIdRef.current) return;\n try {\n const result = await callbacks.validatePayment({\n transactionSetupId: unified.transactionSetupId,\n customerId: String(customerIdRef.current),\n });\n if (!result) {\n callbacks.toast?.error?.(\"Payment verification failed. Please try again.\");\n return;\n }\n setUnifiedResponse(result.valid);\n if (result.valid) {\n await getCardInfo();\n }\n } catch (error) {\n console.error(\"validatePayment failed:\", error);\n callbacks.toast?.error?.(\"Payment verification failed. Please try again.\");\n }\n }, [unified, getCardInfo, callbacks]);\n\n // Step 4: Get payment account info\n const getUnifiedPayment = useCallback(async () => {\n if (!unified?.transactionSetupId || !customerIdRef.current) return;\n try {\n const result = await callbacks.accountQuery({\n transactionSetupId: unified.transactionSetupId,\n customerId: String(customerIdRef.current),\n });\n if (!result) {\n callbacks.toast?.error?.(\"Unable to retrieve payment account. Please try again.\");\n return;\n }\n const payment = capturedBin && !result.Bin ? { ...result, Bin: capturedBin } : result;\n setUnifiedPayment(payment);\n } catch (error) {\n console.error(\"accountQuery failed:\", error);\n callbacks.toast?.error?.(\"Unable to retrieve payment account. Please try again.\");\n }\n }, [unified, capturedBin, callbacks]);\n\n // Step 5: Update billing info\n const updateUnifiedBilling = useCallback(async () => {\n /* v8 ignore next -- defensive: effect already guards billingAddress/unified */\n if (!unified?.transactionSetupId || !billingAddress) return;\n try {\n const result = await callbacks.billingUpdate({\n transactionSetupId: unified.transactionSetupId,\n address1: billingAddress.address1,\n address2: billingAddress.address2,\n city: billingAddress.city,\n state: billingAddress.state,\n zip: billingAddress.postalCode,\n });\n if (!result) {\n callbacks.toast?.error?.(\"Billing update failed. Please try again.\");\n return;\n }\n setUnifiedBilling(true);\n void getUnifiedPayment();\n } catch (error) {\n console.error(\"billingUpdate failed:\", error);\n callbacks.toast?.error?.(\"Billing update failed. Please try again.\");\n }\n }, [unified, billingAddress, getUnifiedPayment, callbacks]);\n\n // Close payment modal if preconditions are lost\n useEffect(() => {\n if (isOpen && (!shippingAccepted || paymentMethod !== \"credit-card\")) {\n setIsOpen(false);\n }\n }, [isOpen, shippingAccepted, paymentMethod]);\n\n // Initialize payment setup when modal opens with no transaction\n useEffect(() => {\n if (isOpen && shippingAccepted && paymentMethod === \"credit-card\" && unified === null) {\n void postUnified();\n }\n }, [isOpen, shippingAccepted, paymentMethod, unified, postUnified]);\n\n // Verify payment after modal closes\n useEffect(() => {\n if (!isOpen && unified !== null && shippingAccepted && paymentMethod === \"credit-card\") {\n void verifyUnified();\n }\n }, [isOpen, unified, shippingAccepted, paymentMethod, verifyUnified]);\n\n // Trigger billing update when card verified + billing address ready\n useEffect(() => {\n if (\n unifiedResponse &&\n billingAddress !== undefined &&\n unifiedCc?.transactionSetupId &&\n paymentMethod === \"credit-card\"\n ) {\n void updateUnifiedBilling();\n }\n }, [\n unifiedResponse,\n billingAddress,\n unifiedCc?.transactionSetupId,\n updateUnifiedBilling,\n paymentMethod,\n ]);\n\n // Reset all payment state when editing CC\n useEffect(() => {\n if (editCc) {\n setIsOpen(true);\n setUnified(null);\n setUnifiedCc(null);\n setUnifiedPayment(null);\n setUnifiedBilling(false);\n setUnifiedResponse(false);\n setCapturedBin(null);\n }\n }, [editCc]);\n\n return {\n isOpen,\n setIsOpen,\n editCc,\n setEditCc,\n unified,\n unifiedCc,\n unifiedResponse,\n unifiedBilling,\n unifiedPayment,\n capturedBin,\n handleBinCapture,\n };\n}\n","\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/** Parameters for order readiness validation. */\nexport interface OrderReadinessParams {\n cartHdrUid: string | number | undefined;\n shippingAddress: unknown;\n billingAddress: unknown;\n shippingMethodSaved: boolean;\n showBillingInfoSummary: boolean;\n processingOrder: boolean;\n paymentMethod: string;\n unifiedPaymentAccountId: string | undefined;\n unifiedBilling: boolean;\n isFreeShipping: boolean;\n carrierId: string;\n shippingFee: number | undefined;\n isEditShippingInfo: boolean;\n isEditShippingMethods: boolean;\n isEditBillingInfo: boolean;\n editCc: boolean;\n /** Site-provided function to check if the order is ready. Overrides default logic when provided. */\n customReadinessCheck?: (params: OrderReadinessParams) => boolean;\n}\n\n/**\n * Pure function that determines if an order is ready to submit.\n *\n * Checks all gates: cart exists, addresses present, shipping method saved,\n * billing shown, payment complete (for credit card), shipping fee present\n * (for non-free, non-pickup orders), and no sections being edited.\n */\nexport function determineOrderReadiness(params: OrderReadinessParams): boolean {\n if (params.customReadinessCheck) {\n return params.customReadinessCheck(params);\n }\n\n if (!params.cartHdrUid) return false;\n\n // Block if any section is being edited or addresses are missing\n const blockers = [\n params.isEditShippingInfo,\n params.isEditShippingMethods,\n params.isEditBillingInfo,\n params.editCc,\n params.shippingAddress === undefined,\n params.billingAddress === undefined,\n !params.shippingMethodSaved,\n !params.showBillingInfoSummary,\n params.processingOrder,\n ];\n if (blockers.some(Boolean)) return false;\n\n // Credit card requires completed payment flow\n if (\n params.paymentMethod === \"credit-card\" &&\n (!params.unifiedPaymentAccountId || !params.unifiedBilling)\n ) {\n return false;\n }\n\n // Non-free shipping requires a fee (unless carrier is pickup/freight)\n if (!params.isFreeShipping && params.shippingFee === undefined) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Debounced order readiness hook.\n *\n * Recomputes readiness 300ms after any dependency changes to avoid\n * excessive re-renders during rapid state transitions (e.g., typing\n * in address fields).\n */\nexport function useOrderReadiness(params: OrderReadinessParams) {\n const [enableProcessOrderBtn, setEnableProcessOrderBtn] = useState(false);\n const [processingValidation, setProcessingValidation] = useState(false);\n\n useEffect(() => {\n setProcessingValidation(true);\n\n const timeoutId = setTimeout(() => {\n const ready = determineOrderReadiness(params);\n setEnableProcessOrderBtn(ready);\n setProcessingValidation(false);\n }, 300);\n\n return () => clearTimeout(timeoutId);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n params.billingAddress,\n params.shippingAddress,\n params.isEditShippingInfo,\n params.isEditShippingMethods,\n params.isEditBillingInfo,\n params.editCc,\n params.isFreeShipping,\n params.unifiedPaymentAccountId,\n params.unifiedBilling,\n params.paymentMethod,\n params.processingOrder,\n params.carrierId,\n params.shippingFee,\n params.shippingMethodSaved,\n params.showBillingInfoSummary,\n params.cartHdrUid,\n ]);\n\n return { enableProcessOr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