@openlup/platform 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +138 -218
- package/README.md +229 -16
- package/dist/commerce/adapters/managed/commerceOmsControlPlane.d.ts +3 -0
- package/dist/commerce/adapters/managed/commerceOmsControlPlane.js +71 -0
- package/dist/commerce/adapters/managed/commerceOmsMutations.d.ts +10 -0
- package/dist/commerce/adapters/managed/commerceOmsMutations.js +119 -0
- package/dist/commerce/adapters/managed/commerceOmsPort.d.ts +28 -0
- package/dist/commerce/adapters/managed/commerceOmsPort.js +101 -0
- package/dist/commerce/adapters/managed/oms/accounting.d.ts +3 -0
- package/dist/commerce/adapters/managed/oms/accounting.js +13 -0
- package/dist/commerce/adapters/managed/oms/fulfillmentReads.d.ts +17 -0
- package/dist/commerce/adapters/managed/oms/fulfillmentReads.js +81 -0
- package/dist/commerce/adapters/managed/oms/inboundEvents.d.ts +9 -0
- package/dist/commerce/adapters/managed/oms/inboundEvents.js +40 -0
- package/dist/commerce/adapters/managed/oms/outboxEvents.d.ts +2 -0
- package/dist/commerce/adapters/managed/oms/outboxEvents.js +23 -0
- package/dist/commerce/adapters/managed/oms/paymentAttempts.d.ts +3 -0
- package/dist/commerce/adapters/managed/oms/paymentAttempts.js +15 -0
- package/dist/commerce/adapters/managed/oms/queueSelection.d.ts +12 -0
- package/dist/commerce/adapters/managed/oms/queueSelection.js +109 -0
- package/dist/commerce/adapters/managed/oms/readProjections.d.ts +18 -0
- package/dist/commerce/adapters/managed/oms/readProjections.js +13 -0
- package/dist/commerce/adapters/managed/oms/readQueries.d.ts +16 -0
- package/dist/commerce/adapters/managed/oms/readQueries.js +276 -0
- package/dist/commerce/adapters/managed/oms/types.d.ts +2 -0
- package/dist/commerce/adapters/managed/oms/types.js +7 -0
- package/dist/commerce/checkoutCommandSchemas.d.ts +89 -0
- package/dist/commerce/checkoutCommandSchemas.js +70 -0
- package/dist/commerce/checkoutHelpers.d.ts +21 -0
- package/dist/commerce/checkoutHelpers.js +29 -0
- package/dist/commerce/checkoutResumeSchemas.d.ts +158 -0
- package/dist/commerce/checkoutResumeSchemas.js +145 -0
- package/dist/commerce/checkoutSchemas.d.ts +158 -0
- package/dist/commerce/checkoutSchemas.js +161 -0
- package/dist/commerce/commerceReturnsPort.d.ts +97 -0
- package/dist/commerce/commerceReturnsPort.js +39 -0
- package/dist/commerce/configuratorIntentPersistenceSchemas.d.ts +20 -0
- package/dist/commerce/configuratorIntentPersistenceSchemas.js +21 -0
- package/dist/commerce/configuratorIntentSchemas.d.ts +63 -0
- package/dist/commerce/configuratorIntentSchemas.js +43 -0
- package/dist/commerce/contractPrimitives.d.ts +50 -0
- package/dist/commerce/contractPrimitives.js +25 -0
- package/dist/commerce/contracts/availability.d.ts +23 -0
- package/dist/commerce/contracts/availability.js +1 -0
- package/dist/commerce/contracts/fulfillmentRecovery.d.ts +25 -0
- package/dist/commerce/contracts/fulfillmentRecovery.js +1 -0
- package/dist/commerce/contracts/index.d.ts +13 -0
- package/dist/commerce/contracts/index.js +1 -0
- package/dist/commerce/contracts/intent.d.ts +86 -0
- package/dist/commerce/contracts/intent.js +1 -0
- package/dist/commerce/contracts/omsTypes.d.ts +1216 -0
- package/dist/commerce/contracts/omsTypes.js +1 -0
- package/dist/commerce/contracts/order.d.ts +39 -0
- package/dist/commerce/contracts/order.js +1 -0
- package/dist/commerce/contracts/orderMoney.d.ts +52 -0
- package/dist/commerce/contracts/orderMoney.js +1 -0
- package/dist/commerce/contracts/ports.d.ts +113 -0
- package/dist/commerce/contracts/ports.js +1 -0
- package/dist/commerce/contracts/recovery.d.ts +11 -0
- package/dist/commerce/contracts/recovery.js +1 -0
- package/dist/commerce/contracts/runtimePorts.d.ts +196 -0
- package/dist/commerce/contracts/runtimePorts.js +1 -0
- package/dist/commerce/contracts/state.d.ts +26 -0
- package/dist/commerce/contracts/state.js +43 -0
- package/dist/commerce/customerDefaultsSnapshotSchemas.d.ts +51 -0
- package/dist/commerce/customerDefaultsSnapshotSchemas.js +106 -0
- package/dist/commerce/errors.d.ts +18 -0
- package/dist/commerce/errors.js +36 -0
- package/dist/commerce/fulfillmentEligibility.d.ts +6 -0
- package/dist/commerce/fulfillmentEligibility.js +31 -0
- package/dist/commerce/index.d.ts +72 -0
- package/dist/commerce/index.js +67 -0
- package/dist/commerce/model/customerFulfillmentRecovery.d.ts +40 -0
- package/dist/commerce/model/customerFulfillmentRecovery.js +144 -0
- package/dist/commerce/model/fulfillmentCancellationEligibility.d.ts +7 -0
- package/dist/commerce/model/fulfillmentCancellationEligibility.js +9 -0
- package/dist/commerce/model/omsAccountingVisibility.d.ts +12 -0
- package/dist/commerce/model/omsAccountingVisibility.js +118 -0
- package/dist/commerce/model/omsBillingInvoiceBuyer.d.ts +2 -0
- package/dist/commerce/model/omsBillingInvoiceBuyer.js +15 -0
- package/dist/commerce/model/omsCurrency.d.ts +4 -0
- package/dist/commerce/model/omsCurrency.js +5 -0
- package/dist/commerce/model/omsFulfillmentDebug.d.ts +20 -0
- package/dist/commerce/model/omsFulfillmentDebug.js +122 -0
- package/dist/commerce/model/omsFulfillmentSummary.d.ts +16 -0
- package/dist/commerce/model/omsFulfillmentSummary.js +189 -0
- package/dist/commerce/model/omsListTotals.d.ts +13 -0
- package/dist/commerce/model/omsListTotals.js +32 -0
- package/dist/commerce/model/omsOperationalLadder.d.ts +51 -0
- package/dist/commerce/model/omsOperationalLadder.js +158 -0
- package/dist/commerce/model/omsOrderLineMoney.d.ts +4 -0
- package/dist/commerce/model/omsOrderLineMoney.js +25 -0
- package/dist/commerce/model/omsPaymentMethodSummary.d.ts +5 -0
- package/dist/commerce/model/omsPaymentMethodSummary.js +11 -0
- package/dist/commerce/model/omsReadModel.d.ts +43 -0
- package/dist/commerce/model/omsReadModel.js +211 -0
- package/dist/commerce/model/omsReadModelCommunication.d.ts +3 -0
- package/dist/commerce/model/omsReadModelCommunication.js +29 -0
- package/dist/commerce/model/omsReadModelHelpers.d.ts +125 -0
- package/dist/commerce/model/omsReadModelHelpers.js +212 -0
- package/dist/commerce/model/omsReadModelList.d.ts +33 -0
- package/dist/commerce/model/omsReadModelList.js +50 -0
- package/dist/commerce/model/omsReadModelListSummary.d.ts +3 -0
- package/dist/commerce/model/omsReadModelListSummary.js +13 -0
- package/dist/commerce/model/omsReadModelPricing.d.ts +5 -0
- package/dist/commerce/model/omsReadModelPricing.js +36 -0
- package/dist/commerce/model/omsReadModelProjections.d.ts +1 -0
- package/dist/commerce/model/omsReadModelProjections.js +1 -0
- package/dist/commerce/model/omsReadModelRowCore.d.ts +79 -0
- package/dist/commerce/model/omsReadModelRowCore.js +149 -0
- package/dist/commerce/model/omsReadModelRows.d.ts +1 -0
- package/dist/commerce/model/omsReadModelRows.js +6 -0
- package/dist/commerce/offerAvailability.d.ts +18 -0
- package/dist/commerce/offerAvailability.js +53 -0
- package/dist/commerce/offerAvailabilitySchemas.d.ts +43 -0
- package/dist/commerce/offerAvailabilitySchemas.js +42 -0
- package/dist/commerce/offerEvidenceSchemas.d.ts +7 -0
- package/dist/commerce/offerEvidenceSchemas.js +13 -0
- package/dist/commerce/oms/omsContractBase.d.ts +130 -0
- package/dist/commerce/oms/omsContractBase.js +86 -0
- package/dist/commerce/oms/omsContractReadAuxSchemas.d.ts +222 -0
- package/dist/commerce/oms/omsContractReadAuxSchemas.js +123 -0
- package/dist/commerce/oms/omsContractReadSchemas.d.ts +2266 -0
- package/dist/commerce/oms/omsContractReadSchemas.js +277 -0
- package/dist/commerce/oms/omsContractRequests.d.ts +196 -0
- package/dist/commerce/oms/omsContractRequests.js +118 -0
- package/dist/commerce/oms/omsContracts.d.ts +5 -0
- package/dist/commerce/oms/omsContracts.js +4 -0
- package/dist/commerce/oms/omsControlPlane.d.ts +275 -0
- package/dist/commerce/oms/omsControlPlane.js +72 -0
- package/dist/commerce/oms/omsFulfillmentContractSchemas.d.ts +203 -0
- package/dist/commerce/oms/omsFulfillmentContractSchemas.js +94 -0
- package/dist/commerce/oms/omsFulfillmentDebugSchemas.d.ts +69 -0
- package/dist/commerce/oms/omsFulfillmentDebugSchemas.js +33 -0
- package/dist/commerce/oms/omsFulfillmentHealthSchemas.d.ts +67 -0
- package/dist/commerce/oms/omsFulfillmentHealthSchemas.js +44 -0
- package/dist/commerce/oms/omsPorts.d.ts +84 -0
- package/dist/commerce/oms/omsPorts.js +148 -0
- package/dist/commerce/oms/omsPrimitives.d.ts +5 -0
- package/dist/commerce/oms/omsPrimitives.js +3 -0
- package/dist/commerce/oms/omsProviderEvidenceSchemas.d.ts +15 -0
- package/dist/commerce/oms/omsProviderEvidenceSchemas.js +12 -0
- package/dist/commerce/orderDraftErrors.d.ts +13 -0
- package/dist/commerce/orderDraftErrors.js +20 -0
- package/dist/commerce/orderEmailEligibility.d.ts +54 -0
- package/dist/commerce/orderEmailEligibility.js +123 -0
- package/dist/commerce/orderEmailLines.d.ts +12 -0
- package/dist/commerce/orderEmailLines.js +8 -0
- package/dist/commerce/orderFeedbackContracts.d.ts +41 -0
- package/dist/commerce/orderFeedbackContracts.js +33 -0
- package/dist/commerce/orderMoney.d.ts +6 -0
- package/dist/commerce/orderMoney.js +168 -0
- package/dist/commerce/orderReviewContracts.d.ts +475 -0
- package/dist/commerce/orderReviewContracts.js +94 -0
- package/dist/commerce/orderReviewPorts.d.ts +140 -0
- package/dist/commerce/orderReviewPorts.js +1 -0
- package/dist/commerce/outboxDispatchContracts.d.ts +30 -0
- package/dist/commerce/outboxDispatchContracts.js +1 -0
- package/dist/commerce/outboxEventSchemas.d.ts +162 -0
- package/dist/commerce/outboxEventSchemas.js +164 -0
- package/dist/commerce/outboxOrderDraftEmailPorts.d.ts +207 -0
- package/dist/commerce/outboxOrderDraftEmailPorts.js +12 -0
- package/dist/commerce/paymentContinuation.d.ts +4 -0
- package/dist/commerce/paymentContinuation.js +4 -0
- package/dist/commerce/ports.d.ts +8 -0
- package/dist/commerce/ports.js +1 -0
- package/dist/commerce/recoveryDestination.d.ts +3 -0
- package/dist/commerce/recoveryDestination.js +17 -0
- package/dist/commerce/runtimeErrors.d.ts +8 -0
- package/dist/commerce/runtimeErrors.js +16 -0
- package/dist/commerce/salesChannelEnvelope.d.ts +20 -0
- package/dist/commerce/salesChannelEnvelope.js +7 -0
- package/dist/commerce/schemas.d.ts +174 -0
- package/dist/commerce/schemas.js +84 -0
- package/dist/commerce/server/checkoutCompensation.d.ts +21 -0
- package/dist/commerce/server/checkoutCompensation.js +32 -0
- package/dist/commerce/server/checkoutConflictClassifiers.d.ts +17 -0
- package/dist/commerce/server/checkoutConflictClassifiers.js +38 -0
- package/dist/commerce/server/checkoutExpiredRecoveryPolicy.d.ts +38 -0
- package/dist/commerce/server/checkoutExpiredRecoveryPolicy.js +85 -0
- package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.d.ts +22 -0
- package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.js +30 -0
- package/dist/commerce/server/checkoutOfferPolicyPort.d.ts +33 -0
- package/dist/commerce/server/checkoutOfferPolicyPort.js +49 -0
- package/dist/commerce/server/checkoutPaymentContinuationCredential.d.ts +58 -0
- package/dist/commerce/server/checkoutPaymentContinuationCredential.js +154 -0
- package/dist/commerce/server/checkoutQuoteTypes.d.ts +19 -0
- package/dist/commerce/server/checkoutQuoteTypes.js +1 -0
- package/dist/commerce/server/checkoutRecoveryOrderPort.d.ts +42 -0
- package/dist/commerce/server/checkoutRecoveryOrderPort.js +1 -0
- package/dist/commerce/server/checkoutRecoveryToken.d.ts +40 -0
- package/dist/commerce/server/checkoutRecoveryToken.js +26 -0
- package/dist/commerce/server/checkoutRefusalContinuation.d.ts +24 -0
- package/dist/commerce/server/checkoutRefusalContinuation.js +18 -0
- package/dist/commerce/server/checkoutRuntimeTypes.d.ts +81 -0
- package/dist/commerce/server/checkoutRuntimeTypes.js +1 -0
- package/dist/commerce/server/commerceCheckoutCommandExecution.d.ts +60 -0
- package/dist/commerce/server/commerceCheckoutCommandExecution.js +136 -0
- package/dist/commerce/server/commerceCheckoutCompensation.d.ts +26 -0
- package/dist/commerce/server/commerceCheckoutCompensation.js +46 -0
- package/dist/commerce/server/commerceCheckoutContinuationTerms.d.ts +50 -0
- package/dist/commerce/server/commerceCheckoutContinuationTerms.js +66 -0
- package/dist/commerce/server/commerceCheckoutCustomerDefaults.d.ts +18 -0
- package/dist/commerce/server/commerceCheckoutCustomerDefaults.js +17 -0
- package/dist/commerce/server/commerceCheckoutFailureHandler.d.ts +51 -0
- package/dist/commerce/server/commerceCheckoutFailureHandler.js +90 -0
- package/dist/commerce/server/commerceCheckoutHandler.d.ts +213 -0
- package/dist/commerce/server/commerceCheckoutHandler.js +196 -0
- package/dist/commerce/server/commerceCheckoutHandlerAdmission.d.ts +58 -0
- package/dist/commerce/server/commerceCheckoutHandlerAdmission.js +94 -0
- package/dist/commerce/server/commerceCheckoutHandlerHelpers.d.ts +67 -0
- package/dist/commerce/server/commerceCheckoutHandlerHelpers.js +155 -0
- package/dist/commerce/server/commerceCheckoutOrchestrationError.d.ts +9 -0
- package/dist/commerce/server/commerceCheckoutOrchestrationError.js +14 -0
- package/dist/commerce/server/commerceCheckoutPromotionPriceChange.d.ts +47 -0
- package/dist/commerce/server/commerceCheckoutPromotionPriceChange.js +43 -0
- package/dist/commerce/server/commerceCheckoutProviderPayment.d.ts +34 -0
- package/dist/commerce/server/commerceCheckoutProviderPayment.js +37 -0
- package/dist/commerce/server/commerceCheckoutQuoteGuard.d.ts +62 -0
- package/dist/commerce/server/commerceCheckoutQuoteGuard.js +106 -0
- package/dist/commerce/server/commerceCheckoutResume.d.ts +29 -0
- package/dist/commerce/server/commerceCheckoutResume.js +81 -0
- package/dist/commerce/server/commerceCheckoutResumeGuard.d.ts +54 -0
- package/dist/commerce/server/commerceCheckoutResumeGuard.js +138 -0
- package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.d.ts +39 -0
- package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.js +44 -0
- package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.d.ts +7 -0
- package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.js +39 -0
- package/dist/commerce/server/commerceCheckoutTiming.d.ts +8 -0
- package/dist/commerce/server/commerceCheckoutTiming.js +31 -0
- package/dist/commerce/server/commerceDiagnostics.d.ts +6 -0
- package/dist/commerce/server/commerceDiagnostics.js +31 -0
- package/dist/commerce/server/commerceOmsCancelOrderHandler.d.ts +7 -0
- package/dist/commerce/server/commerceOmsCancelOrderHandler.js +22 -0
- package/dist/commerce/server/commerceOmsControlPlaneHandlers.d.ts +18 -0
- package/dist/commerce/server/commerceOmsControlPlaneHandlers.js +60 -0
- package/dist/commerce/server/commerceOmsHandlers.d.ts +47 -0
- package/dist/commerce/server/commerceOmsHandlers.js +176 -0
- package/dist/commerce/server/commerceOmsMarkRefundedHandler.d.ts +7 -0
- package/dist/commerce/server/commerceOmsMarkRefundedHandler.js +19 -0
- package/dist/commerce/server/commerceOrderDraft.d.ts +24 -0
- package/dist/commerce/server/commerceOrderDraft.js +92 -0
- package/dist/commerce/server/commercePaidOrderOrchestration.d.ts +131 -0
- package/dist/commerce/server/commercePaidOrderOrchestration.js +140 -0
- package/dist/commerce/server/commerceProviderAttemptFailure.d.ts +133 -0
- package/dist/commerce/server/commerceProviderAttemptFailure.js +175 -0
- package/dist/commerce/server/commerceReturnsHandlers.d.ts +41 -0
- package/dist/commerce/server/commerceReturnsHandlers.js +100 -0
- package/dist/commerce/server/commerceRuntimePort.d.ts +16 -0
- package/dist/commerce/server/commerceRuntimePort.js +57 -0
- package/dist/commerce/server/commerceRuntimeService.d.ts +98 -0
- package/dist/commerce/server/commerceRuntimeService.js +186 -0
- package/dist/commerce/server/commerceRuntimeStartResponse.d.ts +37 -0
- package/dist/commerce/server/commerceRuntimeStartResponse.js +56 -0
- package/dist/commerce/server/commerceStarterOfferGuard.d.ts +55 -0
- package/dist/commerce/server/commerceStarterOfferGuard.js +128 -0
- package/dist/commerce/server/configuratorIntentPersistence.d.ts +47 -0
- package/dist/commerce/server/configuratorIntentPersistence.js +85 -0
- package/dist/commerce/server/configuratorIntentPersistenceHandler.d.ts +14 -0
- package/dist/commerce/server/configuratorIntentPersistenceHandler.js +42 -0
- package/dist/commerce/server/emailRuntime.d.ts +47 -0
- package/dist/commerce/server/emailRuntime.js +1 -0
- package/dist/commerce/server/handlerSupport.d.ts +68 -0
- package/dist/commerce/server/handlerSupport.js +1 -0
- package/dist/commerce/server/index.d.ts +178 -0
- package/dist/commerce/server/index.js +127 -0
- package/dist/commerce/server/offerAvailability.d.ts +21 -0
- package/dist/commerce/server/offerAvailability.js +163 -0
- package/dist/commerce/server/orderDraftRpcPayload.d.ts +20 -0
- package/dist/commerce/server/orderDraftRpcPayload.js +21 -0
- package/dist/commerce/server/orderFeedbackSubmit.d.ts +20 -0
- package/dist/commerce/server/orderFeedbackSubmit.js +16 -0
- package/dist/commerce/server/orderFeedbackTokenCheck.d.ts +17 -0
- package/dist/commerce/server/orderFeedbackTokenCheck.js +14 -0
- package/dist/commerce/server/orderReviewAdminHandlers.d.ts +47 -0
- package/dist/commerce/server/orderReviewAdminHandlers.js +41 -0
- package/dist/commerce/server/orderReviewHandlers.d.ts +114 -0
- package/dist/commerce/server/orderReviewHandlers.js +42 -0
- package/dist/commerce/server/orderReviewLifecycle.d.ts +10 -0
- package/dist/commerce/server/orderReviewLifecycle.js +121 -0
- package/dist/commerce/server/orderReviewMedia.d.ts +11 -0
- package/dist/commerce/server/orderReviewMedia.js +172 -0
- package/dist/commerce/server/orderReviewRawUploadHandler.d.ts +40 -0
- package/dist/commerce/server/orderReviewRawUploadHandler.js +316 -0
- package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.js +57 -0
- package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.js +150 -0
- package/dist/commerce/server/outboxDispatchRegistry.d.ts +46 -0
- package/dist/commerce/server/outboxDispatchRegistry.js +184 -0
- package/dist/commerce/server/outboxDispatchRegistryComposition.d.ts +6 -0
- package/dist/commerce/server/outboxDispatchRegistryComposition.js +23 -0
- package/dist/commerce/server/outboxOrderDraftEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxOrderDraftEmailHandler.js +130 -0
- package/dist/commerce/server/outboxOrderPaidEmailHandler.d.ts +21 -0
- package/dist/commerce/server/outboxOrderPaidEmailHandler.js +93 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.d.ts +3 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.js +1 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.d.ts +3 -0
- package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.js +1 -0
- package/dist/commerce/server/outboxOrderRefundedEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxOrderRefundedEmailHandler.js +42 -0
- package/dist/commerce/server/outboxPaymentFailedEmailHandler.d.ts +14 -0
- package/dist/commerce/server/outboxPaymentFailedEmailHandler.js +65 -0
- package/dist/commerce/server/outboxReturnEmailHandlers.d.ts +26 -0
- package/dist/commerce/server/outboxReturnEmailHandlers.js +53 -0
- package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.d.ts +17 -0
- package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.js +52 -0
- package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.js +87 -0
- package/dist/commerce/server/outboxShipmentExceptionEmailHandler.d.ts +13 -0
- package/dist/commerce/server/outboxShipmentExceptionEmailHandler.js +46 -0
- package/dist/commerce/server/referenceCheckoutHandler.d.ts +48 -0
- package/dist/commerce/server/referenceCheckoutHandler.js +68 -0
- package/dist/commerce/server/reservationSweepPort.d.ts +31 -0
- package/dist/commerce/server/reservationSweepPort.js +45 -0
- package/dist/commerce/server/starterTermsPort.d.ts +22 -0
- package/dist/commerce/server/starterTermsPort.js +1 -0
- package/dist/commerce/server/supabaseCommerceReturnsPort.d.ts +13 -0
- package/dist/commerce/server/supabaseCommerceReturnsPort.js +56 -0
- package/dist/communications/consentPurposeRegistry.d.ts +1 -1
- package/dist/communications/newsletterIntegrationContracts.d.ts +5 -5
- package/dist/composition/commerceContribution.d.ts +21 -0
- package/dist/composition/commerceContribution.js +27 -0
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/fulfillment/handlerSchemas.d.ts +41 -41
- package/dist/fulfillment/index.d.ts +1 -1
- package/dist/fulfillment/index.js +1 -1
- package/dist/fulfillment/paidHandoff.d.ts +12 -1
- package/dist/fulfillment/paidHandoff.js +2 -2
- package/dist/fulfillment/providerDispatchWorker.d.ts +4 -4
- package/dist/identity/customerContracts.d.ts +2 -2
- package/dist/inventory/bindings.d.ts +3 -0
- package/dist/inventory/bindings.js +10 -4
- package/dist/inventory/index.d.ts +1 -0
- package/dist/inventory/index.js +1 -0
- package/dist/inventory/managedStockAvailability.d.ts +15 -0
- package/dist/inventory/managedStockAvailability.js +16 -0
- package/dist/inventory/postgresStockAvailability.js +2 -25
- package/dist/inventory/schemas.d.ts +1 -1
- package/dist/inventory/stockReadResponse.d.ts +4 -0
- package/dist/inventory/stockReadResponse.js +27 -0
- package/dist/pricing/browser/index.d.ts +6 -0
- package/dist/pricing/browser/index.js +6 -0
- package/dist/promotions/adminPromotionsContracts.d.ts +2 -2
- package/dist/subscriptions/index.d.ts +3 -2
- package/dist/subscriptions/index.js +3 -2
- package/package.json +22 -2
- package/release-gates.json +63 -8
- package/src/commerce/adapters/managed/commerceOmsControlPlane.ts +80 -0
- package/src/commerce/adapters/managed/commerceOmsMutations.ts +145 -0
- package/src/commerce/adapters/managed/commerceOmsPort.ts +158 -0
- package/src/commerce/adapters/managed/oms/accounting.ts +18 -0
- package/src/commerce/adapters/managed/oms/fulfillmentReads.ts +82 -0
- package/src/commerce/adapters/managed/oms/inboundEvents.ts +45 -0
- package/src/commerce/adapters/managed/oms/outboxEvents.ts +30 -0
- package/src/commerce/adapters/managed/oms/paymentAttempts.ts +19 -0
- package/src/commerce/adapters/managed/oms/queueSelection.ts +132 -0
- package/src/commerce/adapters/managed/oms/readProjections.ts +22 -0
- package/src/commerce/adapters/managed/oms/readQueries.ts +292 -0
- package/src/commerce/adapters/managed/oms/types.ts +9 -0
- package/src/commerce/checkoutCommandSchemas.ts +93 -0
- package/src/commerce/checkoutHelpers.ts +47 -0
- package/src/commerce/checkoutResumeSchemas.ts +164 -0
- package/src/commerce/checkoutSchemas.ts +182 -0
- package/src/commerce/commerceReturnsPort.ts +67 -0
- package/src/commerce/configuratorIntentPersistenceSchemas.ts +26 -0
- package/src/commerce/configuratorIntentSchemas.ts +47 -0
- package/src/commerce/contractPrimitives.ts +30 -0
- package/src/commerce/contracts/availability.ts +21 -0
- package/src/commerce/contracts/fulfillmentRecovery.ts +26 -0
- package/src/commerce/contracts/index.ts +17 -0
- package/src/commerce/contracts/intent.ts +58 -0
- package/src/commerce/contracts/omsTypes.ts +1217 -0
- package/src/commerce/contracts/order.ts +44 -0
- package/src/commerce/contracts/orderMoney.ts +75 -0
- package/src/commerce/contracts/ports.ts +124 -0
- package/src/commerce/contracts/recovery.ts +24 -0
- package/src/commerce/contracts/runtimePorts.ts +201 -0
- package/src/commerce/contracts/state.ts +64 -0
- package/src/commerce/customerDefaultsSnapshotSchemas.ts +117 -0
- package/src/commerce/errors.ts +53 -0
- package/src/commerce/fulfillmentEligibility.ts +32 -0
- package/src/commerce/index.ts +82 -0
- package/src/commerce/model/customerFulfillmentRecovery.ts +185 -0
- package/src/commerce/model/fulfillmentCancellationEligibility.ts +18 -0
- package/src/commerce/model/omsAccountingVisibility.ts +135 -0
- package/src/commerce/model/omsBillingInvoiceBuyer.ts +20 -0
- package/src/commerce/model/omsCurrency.ts +8 -0
- package/src/commerce/model/omsFulfillmentDebug.ts +157 -0
- package/src/commerce/model/omsFulfillmentSummary.ts +225 -0
- package/src/commerce/model/omsListTotals.ts +38 -0
- package/src/commerce/model/omsOperationalLadder.ts +181 -0
- package/src/commerce/model/omsOrderLineMoney.ts +34 -0
- package/src/commerce/model/omsPaymentMethodSummary.ts +19 -0
- package/src/commerce/model/omsReadModel.ts +302 -0
- package/src/commerce/model/omsReadModelCommunication.ts +32 -0
- package/src/commerce/model/omsReadModelHelpers.ts +279 -0
- package/src/commerce/model/omsReadModelList.ts +90 -0
- package/src/commerce/model/omsReadModelListSummary.ts +19 -0
- package/src/commerce/model/omsReadModelPricing.ts +57 -0
- package/src/commerce/model/omsReadModelProjections.ts +1 -0
- package/src/commerce/model/omsReadModelRowCore.ts +193 -0
- package/src/commerce/model/omsReadModelRows.ts +7 -0
- package/src/commerce/offerAvailability.ts +75 -0
- package/src/commerce/offerAvailabilitySchemas.ts +56 -0
- package/src/commerce/offerEvidenceSchemas.ts +17 -0
- package/src/commerce/oms/omsContractBase.ts +92 -0
- package/src/commerce/oms/omsContractReadAuxSchemas.ts +130 -0
- package/src/commerce/oms/omsContractReadSchemas.ts +303 -0
- package/src/commerce/oms/omsContractRequests.ts +143 -0
- package/src/commerce/oms/omsContracts.ts +6 -0
- package/src/commerce/oms/omsControlPlane.ts +85 -0
- package/src/commerce/oms/omsFulfillmentContractSchemas.ts +113 -0
- package/src/commerce/oms/omsFulfillmentDebugSchemas.ts +38 -0
- package/src/commerce/oms/omsFulfillmentHealthSchemas.ts +46 -0
- package/src/commerce/oms/omsPorts.ts +165 -0
- package/src/commerce/oms/omsPrimitives.ts +3 -0
- package/src/commerce/oms/omsProviderEvidenceSchemas.ts +13 -0
- package/src/commerce/orderDraftErrors.ts +28 -0
- package/src/commerce/orderEmailEligibility.ts +131 -0
- package/src/commerce/orderEmailLines.ts +22 -0
- package/src/commerce/orderFeedbackContracts.ts +47 -0
- package/src/commerce/orderMoney.ts +207 -0
- package/src/commerce/orderReviewContracts.ts +124 -0
- package/src/commerce/orderReviewPorts.ts +94 -0
- package/src/commerce/outboxDispatchContracts.ts +30 -0
- package/src/commerce/outboxEventSchemas.ts +230 -0
- package/src/commerce/outboxOrderDraftEmailPorts.ts +241 -0
- package/src/commerce/paymentContinuation.ts +5 -0
- package/src/commerce/ports.ts +7 -0
- package/src/commerce/recoveryDestination.ts +23 -0
- package/src/commerce/runtimeErrors.ts +19 -0
- package/src/commerce/salesChannelEnvelope.ts +28 -0
- package/src/commerce/schemas.ts +104 -0
- package/src/commerce/server/checkoutCompensation.ts +49 -0
- package/src/commerce/server/checkoutConflictClassifiers.ts +53 -0
- package/src/commerce/server/checkoutExpiredRecoveryPolicy.ts +107 -0
- package/src/commerce/server/checkoutInvoiceBuyerSnapshot.ts +36 -0
- package/src/commerce/server/checkoutOfferPolicyPort.ts +60 -0
- package/src/commerce/server/checkoutPaymentContinuationCredential.ts +222 -0
- package/src/commerce/server/checkoutQuoteTypes.ts +9 -0
- package/src/commerce/server/checkoutRecoveryOrderPort.ts +40 -0
- package/src/commerce/server/checkoutRecoveryToken.ts +63 -0
- package/src/commerce/server/checkoutRefusalContinuation.ts +29 -0
- package/src/commerce/server/checkoutRuntimeTypes.ts +26 -0
- package/src/commerce/server/commerceCheckoutCommandExecution.ts +188 -0
- package/src/commerce/server/commerceCheckoutCompensation.ts +66 -0
- package/src/commerce/server/commerceCheckoutContinuationTerms.ts +87 -0
- package/src/commerce/server/commerceCheckoutCustomerDefaults.ts +24 -0
- package/src/commerce/server/commerceCheckoutFailureHandler.ts +144 -0
- package/src/commerce/server/commerceCheckoutHandler.ts +269 -0
- package/src/commerce/server/commerceCheckoutHandlerAdmission.ts +157 -0
- package/src/commerce/server/commerceCheckoutHandlerHelpers.ts +223 -0
- package/src/commerce/server/commerceCheckoutOrchestrationError.ts +15 -0
- package/src/commerce/server/commerceCheckoutPromotionPriceChange.ts +83 -0
- package/src/commerce/server/commerceCheckoutProviderPayment.ts +45 -0
- package/src/commerce/server/commerceCheckoutQuoteGuard.ts +172 -0
- package/src/commerce/server/commerceCheckoutResume.ts +132 -0
- package/src/commerce/server/commerceCheckoutResumeGuard.ts +195 -0
- package/src/commerce/server/commerceCheckoutSavedPaymentMethod.ts +85 -0
- package/src/commerce/server/commerceCheckoutStartRuntimeFailure.ts +59 -0
- package/src/commerce/server/commerceCheckoutTiming.ts +53 -0
- package/src/commerce/server/commerceDiagnostics.ts +37 -0
- package/src/commerce/server/commerceOmsCancelOrderHandler.ts +43 -0
- package/src/commerce/server/commerceOmsControlPlaneHandlers.ts +71 -0
- package/src/commerce/server/commerceOmsHandlers.ts +275 -0
- package/src/commerce/server/commerceOmsMarkRefundedHandler.ts +39 -0
- package/src/commerce/server/commerceOrderDraft.ts +131 -0
- package/src/commerce/server/commercePaidOrderOrchestration.ts +275 -0
- package/src/commerce/server/commerceProviderAttemptFailure.ts +257 -0
- package/src/commerce/server/commerceReturnsHandlers.ts +143 -0
- package/src/commerce/server/commerceRuntimePort.ts +75 -0
- package/src/commerce/server/commerceRuntimeService.ts +229 -0
- package/src/commerce/server/commerceRuntimeStartResponse.ts +76 -0
- package/src/commerce/server/commerceStarterOfferGuard.ts +200 -0
- package/src/commerce/server/configuratorIntentPersistence.ts +161 -0
- package/src/commerce/server/configuratorIntentPersistenceHandler.ts +54 -0
- package/src/commerce/server/emailRuntime.ts +30 -0
- package/src/commerce/server/handlerSupport.ts +22 -0
- package/src/commerce/server/index.ts +181 -0
- package/src/commerce/server/offerAvailability.ts +275 -0
- package/src/commerce/server/orderDraftRpcPayload.ts +39 -0
- package/src/commerce/server/orderFeedbackSubmit.ts +40 -0
- package/src/commerce/server/orderFeedbackTokenCheck.ts +28 -0
- package/src/commerce/server/orderReviewAdminHandlers.ts +43 -0
- package/src/commerce/server/orderReviewHandlers.ts +57 -0
- package/src/commerce/server/orderReviewLifecycle.ts +129 -0
- package/src/commerce/server/orderReviewMedia.ts +170 -0
- package/src/commerce/server/orderReviewRawUploadHandler.ts +300 -0
- package/src/commerce/server/outboxCheckoutExpiredEmailHandler.ts +86 -0
- package/src/commerce/server/outboxCheckoutRecoveryEmailHandler.ts +188 -0
- package/src/commerce/server/outboxDispatchRegistry.ts +269 -0
- package/src/commerce/server/outboxDispatchRegistryComposition.ts +31 -0
- package/src/commerce/server/outboxOrderDraftEmailHandler.ts +162 -0
- package/src/commerce/server/outboxOrderPaidEmailHandler.ts +147 -0
- package/src/commerce/server/outboxOrderPaidFulfillmentHandler.ts +4 -0
- package/src/commerce/server/outboxOrderPaidFulfillmentPorts.ts +3 -0
- package/src/commerce/server/outboxOrderRefundedEmailHandler.ts +58 -0
- package/src/commerce/server/outboxPaymentFailedEmailHandler.ts +99 -0
- package/src/commerce/server/outboxReturnEmailHandlers.ts +92 -0
- package/src/commerce/server/outboxShipmentDeliveredEmailHandler.ts +94 -0
- package/src/commerce/server/outboxShipmentDispatchedEmailHandler.ts +112 -0
- package/src/commerce/server/outboxShipmentExceptionEmailHandler.ts +73 -0
- package/src/commerce/server/referenceCheckoutHandler.ts +87 -0
- package/src/commerce/server/reservationSweepPort.ts +67 -0
- package/src/commerce/server/starterTermsPort.ts +22 -0
- package/src/commerce/server/supabaseCommerceReturnsPort.ts +81 -0
- package/src/composition/commerceContribution.ts +35 -0
- package/src/composition/index.ts +1 -0
- package/src/fulfillment/index.ts +1 -1
- package/src/fulfillment/paidHandoff.ts +2 -2
- package/src/inventory/bindings.ts +12 -4
- package/src/inventory/index.ts +1 -0
- package/src/inventory/managedStockAvailability.ts +23 -0
- package/src/inventory/postgresStockAvailability.ts +2 -21
- package/src/inventory/stockReadResponse.ts +25 -0
- package/src/pricing/browser/index.ts +6 -0
- package/src/subscriptions/index.ts +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CartStatus, CheckoutStatus, OrderDraftStatus, OrderStatus, PaymentStatus } from "./state.js";
|
|
2
|
+
export interface CartDraft<Line, Currency> {
|
|
3
|
+
id: string;
|
|
4
|
+
status: CartStatus;
|
|
5
|
+
lines: Line[];
|
|
6
|
+
currency: Currency;
|
|
7
|
+
}
|
|
8
|
+
export interface CheckoutSessionPlaceholder {
|
|
9
|
+
id: string;
|
|
10
|
+
cartId: string;
|
|
11
|
+
status: CheckoutStatus;
|
|
12
|
+
redirectUrl: string | null;
|
|
13
|
+
paymentProviderSessionId: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface OrderDraftSummary<Quote, Version extends string> {
|
|
16
|
+
orderId: string;
|
|
17
|
+
status: OrderDraftStatus;
|
|
18
|
+
paymentStatus: "not_started";
|
|
19
|
+
idempotencyKey: string;
|
|
20
|
+
quoteSnapshot: {
|
|
21
|
+
contractVersion: Version;
|
|
22
|
+
quote: Quote;
|
|
23
|
+
};
|
|
24
|
+
replayed: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface OrderSummary<Line, Money> {
|
|
27
|
+
id: string;
|
|
28
|
+
status: OrderStatus;
|
|
29
|
+
paymentStatus: PaymentStatus;
|
|
30
|
+
total: Money | null;
|
|
31
|
+
lines: Line[];
|
|
32
|
+
}
|
|
33
|
+
export interface PaymentSummary<Money> {
|
|
34
|
+
id: string;
|
|
35
|
+
orderId: string;
|
|
36
|
+
status: PaymentStatus;
|
|
37
|
+
amount: Money | null;
|
|
38
|
+
providerReference: string | null;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type OrderMoneyIssueCode = "allocated_discount_mismatch" | "catalog_subtotal_mismatch" | "effective_subtotal_mismatch" | "header_equation_mismatch" | "item_catalog_equation_mismatch" | "item_catalog_money_out_of_range" | "item_discount_out_of_range" | "item_effective_money_out_of_range" | "item_gross_equation_mismatch" | "item_net_vat_mismatch" | "item_quantity_out_of_range" | "item_vat_rate_out_of_range" | "missing_item_canonical_money" | "mixed_vat_rates" | "product_discount_out_of_range" | "shipping_discount_out_of_range" | "tax_total_mismatch" | "total_positions_mismatch";
|
|
2
|
+
export interface OrderMoneyHeaderRow {
|
|
3
|
+
id?: string;
|
|
4
|
+
currency: string;
|
|
5
|
+
subtotal_cents: number;
|
|
6
|
+
discount_cents: number;
|
|
7
|
+
shipping_cents: number;
|
|
8
|
+
shipping_discount_cents: number;
|
|
9
|
+
tax_cents: number;
|
|
10
|
+
total_cents: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OrderMoneyItemRow {
|
|
13
|
+
id?: string;
|
|
14
|
+
quantity: number;
|
|
15
|
+
unit_price_cents: number;
|
|
16
|
+
total_cents: number;
|
|
17
|
+
discount_allocated_cents: number | null | undefined;
|
|
18
|
+
effective_total_cents: number | null | undefined;
|
|
19
|
+
effective_net_cents: number | null | undefined;
|
|
20
|
+
vat_rate_bps: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CanonicalOrderMoneyLine {
|
|
23
|
+
id: string | null;
|
|
24
|
+
quantity: number;
|
|
25
|
+
catalogUnit: number;
|
|
26
|
+
catalogTotal: number;
|
|
27
|
+
discountAllocated: number;
|
|
28
|
+
effectiveGross: number;
|
|
29
|
+
effectiveNet: number;
|
|
30
|
+
vatRateBps: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CanonicalOrderMoney {
|
|
33
|
+
orderId: string | null;
|
|
34
|
+
currency: string;
|
|
35
|
+
subtotal: number;
|
|
36
|
+
productDiscount: number;
|
|
37
|
+
shippingGross: number;
|
|
38
|
+
shippingDiscount: number;
|
|
39
|
+
shippingEffective: number;
|
|
40
|
+
tax: number;
|
|
41
|
+
total: number;
|
|
42
|
+
lines: CanonicalOrderMoneyLine[];
|
|
43
|
+
validationScope: "full" | "header";
|
|
44
|
+
reconciled: boolean;
|
|
45
|
+
issueCodes: OrderMoneyIssueCode[];
|
|
46
|
+
}
|
|
47
|
+
export interface OrderMoneyDiagnostic {
|
|
48
|
+
event: "commerce_order_money_unreconciled";
|
|
49
|
+
orderId: string | null;
|
|
50
|
+
validationScope: CanonicalOrderMoney["validationScope"];
|
|
51
|
+
issueCodes: OrderMoneyIssueCode[];
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { AsyncCheckoutStatus, CheckoutKind } from "./index.js";
|
|
2
|
+
export interface ConfiguratorIntentPersistencePort<Request, Response> {
|
|
3
|
+
persistIntent(request: Request): Promise<Response>;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the identity already provisioned under a COMPLETED idempotency key,
|
|
6
|
+
* or null when none exists. Lets checkout recover the `clientId` when
|
|
7
|
+
* `persistIntent` raises an idempotency conflict (same key, mutated payload) so
|
|
8
|
+
* the client's in-flight order can be resumed instead of surfacing a
|
|
9
|
+
* transient-looking error. Optional: adapters that cannot read back the
|
|
10
|
+
* completed row simply omit it and the caller falls back to a 409.
|
|
11
|
+
*/
|
|
12
|
+
findCompletedIdentity?(idempotencyKey: string): Promise<Response | null>;
|
|
13
|
+
}
|
|
14
|
+
export interface CommerceRecommendationPort<Request, Response> {
|
|
15
|
+
recommend(request: Request): Promise<Response>;
|
|
16
|
+
}
|
|
17
|
+
export interface CommerceProductCompatibilityPort<Request, Response> {
|
|
18
|
+
getCompatibility(request: Request): Promise<Response>;
|
|
19
|
+
}
|
|
20
|
+
export interface CommerceCustomerDefaultsReadPort<Snapshot> {
|
|
21
|
+
getCustomerDefaultsSnapshot(input: {
|
|
22
|
+
clientId: string;
|
|
23
|
+
checkoutKind: CheckoutKind;
|
|
24
|
+
}): Promise<Snapshot | null>;
|
|
25
|
+
}
|
|
26
|
+
export interface CommerceCheckoutResumeDraftUpsertInput<Section, State> {
|
|
27
|
+
tokenHash: string;
|
|
28
|
+
idempotencyKeyHash: string | null;
|
|
29
|
+
lastSectionId: Section;
|
|
30
|
+
draftState: State;
|
|
31
|
+
expiresAt: string;
|
|
32
|
+
now: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CommerceCheckoutResumeDraftReadInput {
|
|
35
|
+
tokenHash: string;
|
|
36
|
+
now: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CommerceCheckoutResumeDraftPort<Section, State, Draft> {
|
|
39
|
+
upsertDraft(input: CommerceCheckoutResumeDraftUpsertInput<Section, State>): Promise<Draft>;
|
|
40
|
+
readDraftByTokenHash(input: CommerceCheckoutResumeDraftReadInput): Promise<Draft | null>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Server-resolved options for the order draft. Passed OUT-OF-BAND by the caller
|
|
44
|
+
* (orchestration -> provisioned.clientId; standalone route -> none/null) — NEVER
|
|
45
|
+
* sourced from the client request body — so the persisted client_id (which the
|
|
46
|
+
* outbox dispatcher resolves into an email recipient) cannot be forged.
|
|
47
|
+
*/
|
|
48
|
+
export interface CreateOrderDraftOptions {
|
|
49
|
+
clientId?: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface CommerceOrderDraftWritePort<Request, Response> {
|
|
52
|
+
createOrderDraft(request: Request, options?: CreateOrderDraftOptions): Promise<Response>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A still-in-flight order found for a client, for the checkout handler's
|
|
56
|
+
* duplicate-charge guard. `status` is always an in-flight `AsyncCheckoutStatus`.
|
|
57
|
+
*/
|
|
58
|
+
export interface ResumableOrderSnapshot {
|
|
59
|
+
orderId: string;
|
|
60
|
+
paymentIntentId: string;
|
|
61
|
+
status: AsyncCheckoutStatus;
|
|
62
|
+
metadata?: Record<string, unknown> | null;
|
|
63
|
+
/**
|
|
64
|
+
* True when the submitting journey PRODUCED this order — a cart edit, not a
|
|
65
|
+
* cross-device return. Never resume one: superseding re-prices the cart.
|
|
66
|
+
*/
|
|
67
|
+
sameJourney: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface CommerceResumableOrderReadPort {
|
|
70
|
+
/**
|
|
71
|
+
* Newest still-resumable order for `clientId` within `withinMinutes`, or null.
|
|
72
|
+
* Resumable = payment neither settled nor terminally failed, so a charge may
|
|
73
|
+
* be in flight and re-submitting would double-charge; a paid/dead order is NOT
|
|
74
|
+
* returned. `journeyKey` is resolved here to set `sameJourney`.
|
|
75
|
+
*/
|
|
76
|
+
findResumableOrderForClient(input: {
|
|
77
|
+
clientId: string;
|
|
78
|
+
withinMinutes: number;
|
|
79
|
+
now: Date;
|
|
80
|
+
journeyKey: string;
|
|
81
|
+
}): Promise<ResumableOrderSnapshot | null>;
|
|
82
|
+
}
|
|
83
|
+
/** Neutral sizing seam; the host defines demand units and line names. */
|
|
84
|
+
export interface CommercePackageSizingPort<Input, Result> {
|
|
85
|
+
recomputeQuantities(input: Input): Promise<Result>;
|
|
86
|
+
eligibleVariantIds(): Promise<Set<string>>;
|
|
87
|
+
}
|
|
88
|
+
export type CheckoutOfferResolution = {
|
|
89
|
+
kind: "bound";
|
|
90
|
+
offerVersion: string;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "refused";
|
|
93
|
+
reason: string;
|
|
94
|
+
};
|
|
95
|
+
/** Offer policy binds or refuses an opaque client ask; evidence is server minted. No executor is included. */
|
|
96
|
+
export interface CheckoutOfferPolicyPort<Intent, Quote> {
|
|
97
|
+
resolve(input: {
|
|
98
|
+
intent: Intent;
|
|
99
|
+
checkoutKind: CheckoutKind;
|
|
100
|
+
}): Promise<CheckoutOfferResolution>;
|
|
101
|
+
evidence(input: {
|
|
102
|
+
intent: Intent;
|
|
103
|
+
offerVersion: string;
|
|
104
|
+
quote: Quote;
|
|
105
|
+
}): Promise<Record<string, unknown>>;
|
|
106
|
+
}
|
|
107
|
+
/** Shared journey projection; pricing and host metadata types are supplied by composition. */
|
|
108
|
+
export interface CheckoutJourney<Request, Policy> {
|
|
109
|
+
idempotencyKey: string;
|
|
110
|
+
contactEmail: string;
|
|
111
|
+
createQuoteRequest: () => Request;
|
|
112
|
+
createRuntimeMetadata: (pricingPolicy?: Policy) => Record<string, unknown>;
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type RecoveryDestinationIntent = "checkout_recovery" | "account_payment_recovery" | "customer_dashboard" | "fresh_checkout";
|
|
2
|
+
export type RecoveryDestinationState = "recoverable" | "unrecoverable" | "terminal_expired";
|
|
3
|
+
export type RecoveryDestinationSource = "checkout_recovery" | "subscription_dunning" | "checkout_expired";
|
|
4
|
+
export interface RecoveryDestinationPolicyInput {
|
|
5
|
+
state: RecoveryDestinationState;
|
|
6
|
+
source: RecoveryDestinationSource;
|
|
7
|
+
orderMode?: "one_time_order" | "subscription_cycle" | null;
|
|
8
|
+
hasOrderSubscription?: boolean;
|
|
9
|
+
requestedSubscriptionContext?: boolean;
|
|
10
|
+
clientHasLiveOrPendingSubscription?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export interface CommercePaymentRuntimeVocabulary {
|
|
2
|
+
currency: string;
|
|
3
|
+
intentStatus: string;
|
|
4
|
+
executionProvider: string;
|
|
5
|
+
executionAttemptStatus: string;
|
|
6
|
+
nextActionKind: string;
|
|
7
|
+
attemptStatus: string;
|
|
8
|
+
targetKind: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FinalizedCheckoutOrderItem {
|
|
11
|
+
orderItemId: string;
|
|
12
|
+
skuId: string;
|
|
13
|
+
sku: string;
|
|
14
|
+
quantity: number;
|
|
15
|
+
}
|
|
16
|
+
export interface FinalizedCheckoutOrder<Currency> {
|
|
17
|
+
orderId: string;
|
|
18
|
+
orderRef: string;
|
|
19
|
+
mode: "one_time" | "subscription_cycle";
|
|
20
|
+
clientId: string;
|
|
21
|
+
shippingAddressId: string;
|
|
22
|
+
subscriptionId: string | null;
|
|
23
|
+
subscriptionCycleId: string | null;
|
|
24
|
+
total: {
|
|
25
|
+
amountMinor: number;
|
|
26
|
+
currency: Currency;
|
|
27
|
+
};
|
|
28
|
+
items: FinalizedCheckoutOrderItem[];
|
|
29
|
+
replayed: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CommerceCheckoutRuntimeOrderPort<Request, Order> {
|
|
32
|
+
finalizeOrderForCheckout(request: Request): Promise<Order>;
|
|
33
|
+
}
|
|
34
|
+
export interface InventoryCheckoutReservationPort<Order, PaymentStatus, Reservation> {
|
|
35
|
+
reserveOrderItems(input: {
|
|
36
|
+
idempotencyKey: string;
|
|
37
|
+
order: Order;
|
|
38
|
+
paymentStatus: PaymentStatus;
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
}): Promise<Reservation[]>;
|
|
41
|
+
releaseOrderReservations(input: {
|
|
42
|
+
idempotencyKey: string;
|
|
43
|
+
orderId: string;
|
|
44
|
+
reason: string;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
releasedCount: number;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
export interface PaymentControlRuntimePort<V extends CommercePaymentRuntimeVocabulary, Result extends {
|
|
50
|
+
resultStatus: string;
|
|
51
|
+
}, Evidence = never> {
|
|
52
|
+
createIntent(input: {
|
|
53
|
+
idempotencyKey: string;
|
|
54
|
+
targetKind: V["targetKind"];
|
|
55
|
+
orderId: string;
|
|
56
|
+
subscriptionId: string | null;
|
|
57
|
+
subscriptionCycleId: string | null;
|
|
58
|
+
amountMinor: number;
|
|
59
|
+
currency: V["currency"];
|
|
60
|
+
metadata: Record<string, unknown>;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
paymentIntentId: string;
|
|
63
|
+
paymentId: string;
|
|
64
|
+
status: V["intentStatus"];
|
|
65
|
+
replayed: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
recordAttempt(input: {
|
|
68
|
+
idempotencyKey: string;
|
|
69
|
+
paymentIntentId: string;
|
|
70
|
+
provider: V["executionProvider"];
|
|
71
|
+
providerAttemptId: string | null;
|
|
72
|
+
providerSessionId: string | null;
|
|
73
|
+
attemptStatus: V["executionAttemptStatus"];
|
|
74
|
+
nextActionKind: V["nextActionKind"] | null;
|
|
75
|
+
requestPayload: Record<string, unknown>;
|
|
76
|
+
responsePayload: Record<string, unknown>;
|
|
77
|
+
}): Promise<{
|
|
78
|
+
paymentAttemptId: string;
|
|
79
|
+
status: V["attemptStatus"];
|
|
80
|
+
replayed: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
applyResult(input: Result): Promise<{
|
|
83
|
+
paymentIntentId: string;
|
|
84
|
+
paymentAttemptId: string;
|
|
85
|
+
paymentId: string;
|
|
86
|
+
orderId: string;
|
|
87
|
+
status: Result["resultStatus"];
|
|
88
|
+
kind: string;
|
|
89
|
+
replayed: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
reopenInteractivePreparedAttempt?(input: {
|
|
92
|
+
idempotencyKey: string;
|
|
93
|
+
paymentIntentId: string;
|
|
94
|
+
paymentAttemptId: string;
|
|
95
|
+
expectedOrderId: string;
|
|
96
|
+
expectedSubscriptionId: string | null;
|
|
97
|
+
expectedSubscriptionCycleId: string | null;
|
|
98
|
+
evidence: Evidence;
|
|
99
|
+
}): Promise<{
|
|
100
|
+
paymentAttemptId: string;
|
|
101
|
+
paymentIntentId: string;
|
|
102
|
+
paymentAttemptStatus: "failed";
|
|
103
|
+
paymentIntentStatus: "failed";
|
|
104
|
+
replayed: boolean;
|
|
105
|
+
}>;
|
|
106
|
+
}
|
|
107
|
+
export interface InteractivePreparedAttemptRuntimePort<V extends CommercePaymentRuntimeVocabulary, Result extends {
|
|
108
|
+
resultStatus: string;
|
|
109
|
+
}, Evidence> extends PaymentControlRuntimePort<V, Result, Evidence> {
|
|
110
|
+
reopenInteractivePreparedAttempt(input: {
|
|
111
|
+
idempotencyKey: string;
|
|
112
|
+
paymentIntentId: string;
|
|
113
|
+
paymentAttemptId: string;
|
|
114
|
+
expectedOrderId: string;
|
|
115
|
+
expectedSubscriptionId: string | null;
|
|
116
|
+
expectedSubscriptionCycleId: string | null;
|
|
117
|
+
evidence: Evidence;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
paymentAttemptId: string;
|
|
120
|
+
paymentIntentId: string;
|
|
121
|
+
paymentAttemptStatus: "failed";
|
|
122
|
+
paymentIntentStatus: "failed";
|
|
123
|
+
replayed: boolean;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
export interface PreparedProviderAttemptRuntimePort<V extends CommercePaymentRuntimeVocabulary, Result extends {
|
|
127
|
+
resultStatus: string;
|
|
128
|
+
}, Evidence = never> extends PaymentControlRuntimePort<V, Result, Evidence> {
|
|
129
|
+
prepareProviderAttempt(input: {
|
|
130
|
+
idempotencyKey: string;
|
|
131
|
+
paymentIntentId: string;
|
|
132
|
+
provider: V["executionProvider"];
|
|
133
|
+
providerIdempotencyKey: string;
|
|
134
|
+
providerRequestFingerprint: string;
|
|
135
|
+
providerFlow: string;
|
|
136
|
+
paymentMethodRef?: string | null;
|
|
137
|
+
requestPayload: Record<string, unknown>;
|
|
138
|
+
}): Promise<{
|
|
139
|
+
paymentAttemptId: string;
|
|
140
|
+
status: V["attemptStatus"];
|
|
141
|
+
replayed: boolean;
|
|
142
|
+
providerAttemptId: string | null;
|
|
143
|
+
providerSessionId: string | null;
|
|
144
|
+
nextActionKind: V["nextActionKind"] | null;
|
|
145
|
+
}>;
|
|
146
|
+
finalizeProviderAttempt(input: {
|
|
147
|
+
idempotencyKey: string;
|
|
148
|
+
paymentIntentId: string;
|
|
149
|
+
paymentAttemptId: string;
|
|
150
|
+
providerIdempotencyKey: string;
|
|
151
|
+
providerRequestFingerprint: string;
|
|
152
|
+
providerAttemptId: string | null;
|
|
153
|
+
providerSessionId: string | null;
|
|
154
|
+
attemptStatus: V["executionAttemptStatus"];
|
|
155
|
+
nextActionKind: V["nextActionKind"] | null;
|
|
156
|
+
requestPayload: Record<string, unknown>;
|
|
157
|
+
responsePayload: Record<string, unknown>;
|
|
158
|
+
}): Promise<{
|
|
159
|
+
paymentAttemptId: string;
|
|
160
|
+
status: V["attemptStatus"];
|
|
161
|
+
replayed: boolean;
|
|
162
|
+
providerAttemptId: string | null;
|
|
163
|
+
providerSessionId: string | null;
|
|
164
|
+
nextActionKind: V["nextActionKind"] | null;
|
|
165
|
+
}>;
|
|
166
|
+
}
|
|
167
|
+
export interface CommerceRuntimeReadinessPort<Readiness> {
|
|
168
|
+
evaluateOrderReadiness(input: {
|
|
169
|
+
orderId: string;
|
|
170
|
+
fallbackOrderItemCount: number | null;
|
|
171
|
+
allOrderItemsHaveSku: boolean;
|
|
172
|
+
}): Promise<Readiness>;
|
|
173
|
+
}
|
|
174
|
+
export interface CommerceCheckoutRuntimePort<StartRequest, StartResponse, ResultRequest, ResultResponse> {
|
|
175
|
+
startRuntime(request: StartRequest): Promise<StartResponse>;
|
|
176
|
+
applyPaymentResult(request: ResultRequest): Promise<ResultResponse>;
|
|
177
|
+
}
|
|
178
|
+
export interface CheckoutCommandPersistencePort<Command, Persistence> {
|
|
179
|
+
persistCheckoutCommand(command: Command): Promise<Persistence>;
|
|
180
|
+
}
|
|
181
|
+
export interface CheckoutCommandRuntimeRequest<Command, Provider> {
|
|
182
|
+
command: Command;
|
|
183
|
+
paymentProvider: Provider;
|
|
184
|
+
paymentAttemptSequence?: number;
|
|
185
|
+
metadata?: Record<string, unknown>;
|
|
186
|
+
}
|
|
187
|
+
export interface CheckoutCommandRuntimeResult<Quote, Persistence, OrderDraft, Runtime, Settlement> {
|
|
188
|
+
quoteSnapshot: Quote;
|
|
189
|
+
persistence: Persistence;
|
|
190
|
+
orderDraft: OrderDraft;
|
|
191
|
+
runtime: Runtime;
|
|
192
|
+
settlement: Settlement | null;
|
|
193
|
+
}
|
|
194
|
+
export interface CheckoutCommandRuntimePort<Request, Response> {
|
|
195
|
+
startCheckoutCommand(request: Request): Promise<Response>;
|
|
196
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const CART_STATUSES: readonly ["draft"];
|
|
2
|
+
export declare const CHECKOUT_STATUSES: readonly ["not_configured", "created", "expired"];
|
|
3
|
+
export declare const ORDER_DRAFT_STATUSES: readonly ["draft"];
|
|
4
|
+
export declare const ORDER_STATUSES: readonly ["draft", "pending_payment", "paid", "failed", "expired", "fulfillment_pending", "cancelled", "fulfilled", "refunded"];
|
|
5
|
+
export declare const PAYMENT_STATUSES: readonly ["not_started", "requires_action", "processing", "paid", "failed", "expired", "refunded", "partially_refunded", "disputed"];
|
|
6
|
+
export declare const OMS_FULFILLMENT_BLOCK_REASONS: readonly ["order_not_paid", "payment_not_succeeded", "subscription_cycle_not_paid", "active_hold", "missing_shipping_address", "inventory_review", "risk_review"];
|
|
7
|
+
export declare const OMS_INVENTORY_STATUSES: readonly ["not_checked", "reserved", "missing", "released", "expired", "consumed", "review_required"];
|
|
8
|
+
export type CartStatus = (typeof CART_STATUSES)[number];
|
|
9
|
+
export type CheckoutStatus = (typeof CHECKOUT_STATUSES)[number];
|
|
10
|
+
export type OrderDraftStatus = (typeof ORDER_DRAFT_STATUSES)[number];
|
|
11
|
+
export type OrderStatus = (typeof ORDER_STATUSES)[number];
|
|
12
|
+
export type PaymentStatus = (typeof PAYMENT_STATUSES)[number];
|
|
13
|
+
export type OmsFulfillmentBlockReason = (typeof OMS_FULFILLMENT_BLOCK_REASONS)[number];
|
|
14
|
+
export type OmsInventoryStatus = (typeof OMS_INVENTORY_STATUSES)[number];
|
|
15
|
+
export interface CommerceFulfillmentEligibilityInput<PaymentState extends string = string, SubscriptionState extends string = string> {
|
|
16
|
+
orderMode: "one_time" | "subscription_cycle";
|
|
17
|
+
orderStatus: OrderStatus;
|
|
18
|
+
paymentStatus: PaymentState;
|
|
19
|
+
subscriptionCycleStatus?: SubscriptionState | null;
|
|
20
|
+
activeHoldCount: number;
|
|
21
|
+
hasShippingAddress: boolean;
|
|
22
|
+
inventoryStatus?: OmsInventoryStatus;
|
|
23
|
+
inventoryReviewRequired?: boolean;
|
|
24
|
+
riskReviewRequired?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type OmsPaymentStatus<PaymentState extends string> = "not_started" | PaymentState;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const CART_STATUSES = ["draft"];
|
|
2
|
+
export const CHECKOUT_STATUSES = ["not_configured", "created", "expired"];
|
|
3
|
+
export const ORDER_DRAFT_STATUSES = ["draft"];
|
|
4
|
+
export const ORDER_STATUSES = [
|
|
5
|
+
"draft",
|
|
6
|
+
"pending_payment",
|
|
7
|
+
"paid",
|
|
8
|
+
"failed",
|
|
9
|
+
"expired",
|
|
10
|
+
"fulfillment_pending",
|
|
11
|
+
"cancelled",
|
|
12
|
+
"fulfilled",
|
|
13
|
+
"refunded",
|
|
14
|
+
];
|
|
15
|
+
export const PAYMENT_STATUSES = [
|
|
16
|
+
"not_started",
|
|
17
|
+
"requires_action",
|
|
18
|
+
"processing",
|
|
19
|
+
"paid",
|
|
20
|
+
"failed",
|
|
21
|
+
"expired",
|
|
22
|
+
"refunded",
|
|
23
|
+
"partially_refunded",
|
|
24
|
+
"disputed",
|
|
25
|
+
];
|
|
26
|
+
export const OMS_FULFILLMENT_BLOCK_REASONS = [
|
|
27
|
+
"order_not_paid",
|
|
28
|
+
"payment_not_succeeded",
|
|
29
|
+
"subscription_cycle_not_paid",
|
|
30
|
+
"active_hold",
|
|
31
|
+
"missing_shipping_address",
|
|
32
|
+
"inventory_review",
|
|
33
|
+
"risk_review",
|
|
34
|
+
];
|
|
35
|
+
export const OMS_INVENTORY_STATUSES = [
|
|
36
|
+
"not_checked",
|
|
37
|
+
"reserved",
|
|
38
|
+
"missing",
|
|
39
|
+
"released",
|
|
40
|
+
"expired",
|
|
41
|
+
"consumed",
|
|
42
|
+
"review_required",
|
|
43
|
+
];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CUSTOMER_DEFAULTS_SNAPSHOT_VERSION = "commerce.customer_defaults_snapshot.v1";
|
|
3
|
+
export declare const commerceCustomerDefaultsRedactedFieldSchema: z.ZodEnum<{
|
|
4
|
+
delivery_notes: "delivery_notes";
|
|
5
|
+
courier_instructions: "courier_instructions";
|
|
6
|
+
contact: "contact";
|
|
7
|
+
orderer_profile: "orderer_profile";
|
|
8
|
+
shipping_address: "shipping_address";
|
|
9
|
+
billing_address: "billing_address";
|
|
10
|
+
payment_provider: "payment_provider";
|
|
11
|
+
payment_secret: "payment_secret";
|
|
12
|
+
}>;
|
|
13
|
+
export declare function createCustomerDefaultsSnapshotSchemas<Scope extends z.ZodType, Method extends z.ZodType>(input: {
|
|
14
|
+
paymentPreferenceScopeSchema: Scope;
|
|
15
|
+
paymentMethodKindSchema: Method;
|
|
16
|
+
additionalForbiddenKeys?: readonly string[];
|
|
17
|
+
}): {
|
|
18
|
+
commerceCustomerDefaultsSnapshotSchema: z.ZodObject<{
|
|
19
|
+
version: z.ZodLiteral<"commerce.customer_defaults_snapshot.v1">;
|
|
20
|
+
clientId: z.ZodGUID;
|
|
21
|
+
payment: z.ZodObject<{
|
|
22
|
+
available: z.ZodBoolean;
|
|
23
|
+
scope: z.ZodNullable<Scope>;
|
|
24
|
+
methodKind: z.ZodNullable<Method>;
|
|
25
|
+
source: z.ZodLiteral<"customer_payment_preferences">;
|
|
26
|
+
applied: z.ZodLiteral<false>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
addresses: z.ZodObject<{
|
|
29
|
+
hasDefaultShippingAddress: z.ZodBoolean;
|
|
30
|
+
defaultShippingAddressId: z.ZodNullable<z.ZodGUID>;
|
|
31
|
+
hasDefaultBillingAddress: z.ZodBoolean;
|
|
32
|
+
defaultBillingAddressId: z.ZodNullable<z.ZodGUID>;
|
|
33
|
+
hasDefaultOrdererProfile: z.ZodBoolean;
|
|
34
|
+
defaultOrdererProfileId: z.ZodNullable<z.ZodGUID>;
|
|
35
|
+
hasDeliveryNotes: z.ZodBoolean;
|
|
36
|
+
hasCourierInstructions: z.ZodBoolean;
|
|
37
|
+
source: z.ZodLiteral<"customer_address_profiles">;
|
|
38
|
+
applied: z.ZodLiteral<false>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
redactedFields: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
delivery_notes: "delivery_notes";
|
|
42
|
+
courier_instructions: "courier_instructions";
|
|
43
|
+
contact: "contact";
|
|
44
|
+
orderer_profile: "orderer_profile";
|
|
45
|
+
shipping_address: "shipping_address";
|
|
46
|
+
billing_address: "billing_address";
|
|
47
|
+
payment_provider: "payment_provider";
|
|
48
|
+
payment_secret: "payment_secret";
|
|
49
|
+
}>>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const CUSTOMER_DEFAULTS_SNAPSHOT_VERSION = "commerce.customer_defaults_snapshot.v1";
|
|
3
|
+
const uuidSchema = z.guid();
|
|
4
|
+
export const commerceCustomerDefaultsRedactedFieldSchema = z.enum([
|
|
5
|
+
"contact",
|
|
6
|
+
"orderer_profile",
|
|
7
|
+
"shipping_address",
|
|
8
|
+
"billing_address",
|
|
9
|
+
"delivery_notes",
|
|
10
|
+
"courier_instructions",
|
|
11
|
+
"payment_provider",
|
|
12
|
+
"payment_secret",
|
|
13
|
+
]);
|
|
14
|
+
export function createCustomerDefaultsSnapshotSchemas(input) {
|
|
15
|
+
const customerPaymentPreferenceScopeSchema = input.paymentPreferenceScopeSchema;
|
|
16
|
+
const customerPaymentMethodKindSchema = input.paymentMethodKindSchema;
|
|
17
|
+
const forbiddenKeys = new Set([...FORBIDDEN_DEFAULTS_KEYS, ...(input.additionalForbiddenKeys ?? [])]);
|
|
18
|
+
const commerceCustomerDefaultsSnapshotSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
version: z.literal(CUSTOMER_DEFAULTS_SNAPSHOT_VERSION),
|
|
21
|
+
clientId: uuidSchema,
|
|
22
|
+
payment: z
|
|
23
|
+
.object({
|
|
24
|
+
available: z.boolean(),
|
|
25
|
+
scope: customerPaymentPreferenceScopeSchema.nullable(),
|
|
26
|
+
methodKind: customerPaymentMethodKindSchema.nullable(),
|
|
27
|
+
source: z.literal("customer_payment_preferences"),
|
|
28
|
+
applied: z.literal(false),
|
|
29
|
+
})
|
|
30
|
+
.strict(),
|
|
31
|
+
addresses: z
|
|
32
|
+
.object({
|
|
33
|
+
hasDefaultShippingAddress: z.boolean(),
|
|
34
|
+
defaultShippingAddressId: uuidSchema.nullable(),
|
|
35
|
+
hasDefaultBillingAddress: z.boolean(),
|
|
36
|
+
defaultBillingAddressId: uuidSchema.nullable(),
|
|
37
|
+
hasDefaultOrdererProfile: z.boolean(),
|
|
38
|
+
defaultOrdererProfileId: uuidSchema.nullable(),
|
|
39
|
+
hasDeliveryNotes: z.boolean(),
|
|
40
|
+
hasCourierInstructions: z.boolean(),
|
|
41
|
+
source: z.literal("customer_address_profiles"),
|
|
42
|
+
applied: z.literal(false),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
45
|
+
redactedFields: z.array(commerceCustomerDefaultsRedactedFieldSchema).default([]),
|
|
46
|
+
})
|
|
47
|
+
.strict()
|
|
48
|
+
.superRefine((snapshot, ctx) => {
|
|
49
|
+
const forbiddenPath = findForbiddenDefaultsPath(snapshot, [], forbiddenKeys);
|
|
50
|
+
if (forbiddenPath) {
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
53
|
+
message: "customer defaults snapshot cannot include raw PII, address or payment payloads",
|
|
54
|
+
path: forbiddenPath,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return { commerceCustomerDefaultsSnapshotSchema };
|
|
59
|
+
}
|
|
60
|
+
const FORBIDDEN_DEFAULTS_KEYS = new Set([
|
|
61
|
+
"name",
|
|
62
|
+
"firstName",
|
|
63
|
+
"lastName",
|
|
64
|
+
"fullName",
|
|
65
|
+
"email",
|
|
66
|
+
"phone",
|
|
67
|
+
"contactPhone",
|
|
68
|
+
"recipientName",
|
|
69
|
+
"companyName",
|
|
70
|
+
"taxId",
|
|
71
|
+
"line1",
|
|
72
|
+
"line2",
|
|
73
|
+
"street",
|
|
74
|
+
"postalCode",
|
|
75
|
+
"city",
|
|
76
|
+
"country",
|
|
77
|
+
"address",
|
|
78
|
+
"deliveryNotes",
|
|
79
|
+
"courierInstructions",
|
|
80
|
+
"providerPayload",
|
|
81
|
+
"pspReference",
|
|
82
|
+
"paymentProvider",
|
|
83
|
+
"paymentMethodRef",
|
|
84
|
+
"card",
|
|
85
|
+
"rawFormPayload",
|
|
86
|
+
]);
|
|
87
|
+
function findForbiddenDefaultsPath(value, path = [], forbiddenKeys = FORBIDDEN_DEFAULTS_KEYS) {
|
|
88
|
+
if (!value || typeof value !== "object")
|
|
89
|
+
return null;
|
|
90
|
+
if (Array.isArray(value)) {
|
|
91
|
+
for (const [index, item] of value.entries()) {
|
|
92
|
+
const result = findForbiddenDefaultsPath(item, [...path, index], forbiddenKeys);
|
|
93
|
+
if (result)
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
99
|
+
if (forbiddenKeys.has(key))
|
|
100
|
+
return [...path, key];
|
|
101
|
+
const result = findForbiddenDefaultsPath(nestedValue, [...path, key], forbiddenKeys);
|
|
102
|
+
if (result)
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class CommerceNotEnabledError extends Error {
|
|
2
|
+
constructor(feature: "cart" | "checkout" | "order draft" | "order" | "payment");
|
|
3
|
+
}
|
|
4
|
+
export declare class CommerceOrderDraftConflictError extends Error {
|
|
5
|
+
readonly details: Record<string, unknown>;
|
|
6
|
+
constructor(message?: string, details?: Record<string, unknown>);
|
|
7
|
+
}
|
|
8
|
+
export declare class CommerceOrderDraftInvalidResponseError extends Error {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
export declare class CommerceOrderDraftPersistenceError extends Error {
|
|
12
|
+
readonly details: Record<string, unknown>;
|
|
13
|
+
constructor(message?: string, details?: Record<string, unknown>);
|
|
14
|
+
}
|
|
15
|
+
export declare class CommerceCheckoutResumePersistenceError extends Error {
|
|
16
|
+
readonly details: Record<string, unknown>;
|
|
17
|
+
constructor(message?: string, details?: Record<string, unknown>);
|
|
18
|
+
}
|