@openlup/platform 0.26.0 → 0.28.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 +305 -327
- package/README.md +332 -16
- package/dist/account-support/accountReadFacade.d.ts +8 -0
- package/dist/account-support/accountReadFacade.js +10 -0
- package/dist/account-support/accountReadModels.d.ts +69 -0
- package/dist/account-support/accountReadModels.js +272 -0
- package/dist/account-support/bindings.d.ts +23 -0
- package/dist/account-support/bindings.js +16 -0
- package/dist/account-support/contracts/account.d.ts +281 -0
- package/dist/account-support/contracts/account.js +1 -0
- package/dist/account-support/contracts/capabilities.d.ts +44 -0
- package/dist/account-support/contracts/capabilities.js +1 -0
- package/dist/account-support/contracts/commands.d.ts +307 -0
- package/dist/account-support/contracts/commands.js +1 -0
- package/dist/account-support/contracts/customer360.d.ts +154 -0
- package/dist/account-support/contracts/customer360.js +1 -0
- package/dist/account-support/contracts/index.d.ts +10 -0
- package/dist/account-support/contracts/index.js +1 -0
- package/dist/account-support/contracts/invoice.d.ts +79 -0
- package/dist/account-support/contracts/invoice.js +1 -0
- package/dist/account-support/contracts/operator.d.ts +289 -0
- package/dist/account-support/contracts/operator.js +1 -0
- package/dist/account-support/contribution.d.ts +24 -0
- package/dist/account-support/contribution.js +22 -0
- package/dist/account-support/customer360.d.ts +106 -0
- package/dist/account-support/customer360.js +163 -0
- package/dist/account-support/customerAccountReadDiagnostics.d.ts +11 -0
- package/dist/account-support/customerAccountReadDiagnostics.js +71 -0
- package/dist/account-support/index.d.ts +26 -0
- package/dist/account-support/index.js +15 -0
- package/dist/account-support/invoiceAccess.d.ts +57 -0
- package/dist/account-support/invoiceAccess.js +40 -0
- package/dist/account-support/migrations.d.ts +14 -0
- package/dist/account-support/migrations.js +7 -0
- package/dist/account-support/operatorAuthority.d.ts +67 -0
- package/dist/account-support/operatorAuthority.js +379 -0
- package/dist/account-support/operatorRecovery.d.ts +66 -0
- package/dist/account-support/operatorRecovery.js +129 -0
- package/dist/account-support/orderHistory.d.ts +50 -0
- package/dist/account-support/orderHistory.js +188 -0
- package/dist/account-support/paymentMethodComposition.d.ts +5 -0
- package/dist/account-support/paymentMethodComposition.js +4 -0
- package/dist/account-support/postgresOperatorAuthority.d.ts +16 -0
- package/dist/account-support/postgresOperatorAuthority.js +93 -0
- package/dist/account-support/selfService.d.ts +6 -0
- package/dist/account-support/selfService.js +81 -0
- package/dist/account-support/subscriptionCommandCodec.d.ts +10 -0
- package/dist/account-support/subscriptionCommandCodec.js +38 -0
- package/dist/catalog/draftSchemas.d.ts +1 -1
- package/dist/catalog/foundationSchemas.d.ts +3 -3
- package/dist/catalog/resolvedSkuProjection.d.ts +2 -2
- package/dist/catalog/sellableSchemas.d.ts +2 -2
- 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 +10 -10
- package/dist/composition/accountSupportContribution.d.ts +18 -0
- package/dist/composition/accountSupportContribution.js +21 -0
- package/dist/composition/commerceContribution.d.ts +21 -0
- package/dist/composition/commerceContribution.js +27 -0
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/index.js +2 -0
- package/dist/fulfillment/handlerSchemas.d.ts +69 -69
- 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 +4 -4
- 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/invoicing/snapshot.d.ts +1 -1
- package/dist/pricing/acquisitionQuoteBinding.d.ts +1 -1
- package/dist/pricing/browser/index.d.ts +6 -0
- package/dist/pricing/browser/index.js +6 -0
- package/dist/pricing/catalogFactsSchemas.d.ts +1 -1
- package/dist/pricing/quotePromotionEvidence.d.ts +1 -1
- package/dist/pricing/quoteSchemas.d.ts +56 -56
- package/dist/promotions/adminPromotionCodesContracts.d.ts +30 -30
- package/dist/promotions/adminPromotionsContracts.d.ts +16 -16
- package/dist/subscriptions/index.d.ts +3 -2
- package/dist/subscriptions/index.js +3 -2
- package/package.json +32 -2
- package/release-gates.json +90 -8
- package/sql/20261026120000_account_support_operator_authority.sql +693 -0
- package/src/account-support/accountReadFacade.ts +15 -0
- package/src/account-support/accountReadModels.ts +371 -0
- package/src/account-support/bindings.ts +28 -0
- package/src/account-support/contracts/account.ts +306 -0
- package/src/account-support/contracts/capabilities.ts +30 -0
- package/src/account-support/contracts/commands.ts +243 -0
- package/src/account-support/contracts/customer360.ts +150 -0
- package/src/account-support/contracts/index.ts +141 -0
- package/src/account-support/contracts/invoice.ts +44 -0
- package/src/account-support/contracts/operator.ts +123 -0
- package/src/account-support/contribution.ts +35 -0
- package/src/account-support/customer360.ts +268 -0
- package/src/account-support/customerAccountReadDiagnostics.ts +83 -0
- package/src/account-support/index.ts +72 -0
- package/src/account-support/invoiceAccess.ts +63 -0
- package/src/account-support/migrations.ts +7 -0
- package/src/account-support/operatorAuthority.ts +393 -0
- package/src/account-support/operatorRecovery.ts +136 -0
- package/src/account-support/orderHistory.ts +309 -0
- package/src/account-support/paymentMethodComposition.ts +8 -0
- package/src/account-support/postgresOperatorAuthority.ts +92 -0
- package/src/account-support/selfService.ts +83 -0
- package/src/account-support/subscriptionCommandCodec.ts +48 -0
- 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/accountSupportContribution.ts +28 -0
- package/src/composition/commerceContribution.ts +35 -0
- package/src/composition/index.ts +2 -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,272 @@
|
|
|
1
|
+
export const CUSTOMER_ACCOUNT_V2_CONTRACT_VERSION = "customer.account.v3";
|
|
2
|
+
/** Two observation stages, including the original nested subscription fan-out. Auth/ownership precedes this call. */
|
|
3
|
+
export async function readAccountSnapshot(sources, policy, client) {
|
|
4
|
+
const clientId = text(client.id);
|
|
5
|
+
const [extension, allRows, addresses, ordererProfiles, paymentPreferences, deliveryPreferences, orders, events] = await Promise.all([
|
|
6
|
+
sources.readExtension(clientId),
|
|
7
|
+
sources.readSubscriptionRows(clientId, 50),
|
|
8
|
+
sources.readAddresses(clientId),
|
|
9
|
+
sources.readOrdererProfiles(clientId),
|
|
10
|
+
sources.readPaymentPreferences(clientId),
|
|
11
|
+
sources.readDeliveryPreferences(clientId),
|
|
12
|
+
sources.readOrders(clientId, 20),
|
|
13
|
+
sources.readEvents(clientId),
|
|
14
|
+
]);
|
|
15
|
+
const rows = allRows.filter(isCustomerVisibleSubscription);
|
|
16
|
+
const ids = rows.map(row => text(row.id));
|
|
17
|
+
const [subscriptions, states] = await Promise.all([
|
|
18
|
+
assemble(sources, policy, rows, clientId, nullableText(client.email)),
|
|
19
|
+
sources.readActionStates(ids),
|
|
20
|
+
]);
|
|
21
|
+
return {
|
|
22
|
+
contractVersion: CUSTOMER_ACCOUNT_V2_CONTRACT_VERSION,
|
|
23
|
+
profile: profile(client),
|
|
24
|
+
extension,
|
|
25
|
+
subscriptions,
|
|
26
|
+
addresses,
|
|
27
|
+
ordererProfiles,
|
|
28
|
+
billingProfiles: ordererProfiles,
|
|
29
|
+
paymentPreferences,
|
|
30
|
+
deliveryPreferences,
|
|
31
|
+
recentOrders: orders.orders,
|
|
32
|
+
events,
|
|
33
|
+
actionRequired: buildActionRequired(subscriptions, orders.orders, states, policy.canUsePaymentMethodForRenewal)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function assemble(sources, policy, rows, clientId, clientEmail) {
|
|
37
|
+
const ids = rows.map(row => text(row.id));
|
|
38
|
+
const cycles = new Map(rows.map(row => [text(row.id), nullableText(row.next_cycle_at)]));
|
|
39
|
+
const [lines, blockers, pauses, evidence, alignments, next] = await Promise.all([
|
|
40
|
+
sources.readSubscriptionLines(ids),
|
|
41
|
+
sources.readSubscriptionBlockers(ids, cycles),
|
|
42
|
+
sources.readPauseWindows(ids),
|
|
43
|
+
sources.readPaymentEvidence(ids),
|
|
44
|
+
sources.readDeliveryAlignments(cycles),
|
|
45
|
+
sources.readNextCharges(rows),
|
|
46
|
+
]);
|
|
47
|
+
return rows.map(row => {
|
|
48
|
+
const subscriptionId = text(row.id), status = text(row.status);
|
|
49
|
+
const cutoff = editCutoff(nullableText(row.next_cycle_at), typeof row.edit_window_hours === "number" ? row.edit_window_hours : null);
|
|
50
|
+
const paymentMethodStatus = policy.paymentMethodStatus({ clientId, clientEmail, row, evidence: evidence.get(subscriptionId) });
|
|
51
|
+
const edit = computeEditState({
|
|
52
|
+
subscriptionId,
|
|
53
|
+
status,
|
|
54
|
+
nextCycleAt: nullableText(row.next_cycle_at),
|
|
55
|
+
editCutoffAt: cutoff,
|
|
56
|
+
paymentMethodKind: nullableText(row.payment_method_kind),
|
|
57
|
+
paymentMethodRefPresent: Boolean(nullableText(row.payment_method_ref)),
|
|
58
|
+
paymentMethodStatus
|
|
59
|
+
}, blockers, policy.canUsePaymentMethodForRenewal);
|
|
60
|
+
const items = lines.get(subscriptionId) ?? [], pause = pauses.get(subscriptionId);
|
|
61
|
+
return {
|
|
62
|
+
subscriptionId,
|
|
63
|
+
shippingAddressId: nullableText(row.shipping_address_id),
|
|
64
|
+
status,
|
|
65
|
+
pausePreset: pause?.pausePreset ?? null,
|
|
66
|
+
pauseStartedAt: pause?.pauseStartedAt ?? null,
|
|
67
|
+
pauseEndsAt: pause?.pauseEndsAt ?? null,
|
|
68
|
+
cadenceDays: Number(row.cadence_days),
|
|
69
|
+
nextCycleAt: nullableText(row.next_cycle_at),
|
|
70
|
+
...(alignments.has(subscriptionId) ? { deliveryAlignment: alignments.get(subscriptionId) } : {}),
|
|
71
|
+
editCutoffAt: cutoff,
|
|
72
|
+
canEditUpcomingPackage: edit.canEdit,
|
|
73
|
+
editBlockedReason: edit.reason,
|
|
74
|
+
paymentMethodKind: nullableText(row.payment_method_kind),
|
|
75
|
+
paymentMethodStatus,
|
|
76
|
+
templateVersion: Number(row.template_version),
|
|
77
|
+
sizeConstraint: record(row.size_constraint),
|
|
78
|
+
packageSummary: policy.packageSummary(items, row.size_constraint),
|
|
79
|
+
...policy.withNextCharge(recurringPrice(items), next.get(subscriptionId)),
|
|
80
|
+
lines: items
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function isCustomerVisibleSubscription(row) {
|
|
85
|
+
return ["active", "paused", "pending_activation"].includes(text(row.status))
|
|
86
|
+
|| (row.status === "cancelled" && row.cancellation_source === "customer_self_service");
|
|
87
|
+
}
|
|
88
|
+
export function recurringPrice(lines) {
|
|
89
|
+
if (!lines.length)
|
|
90
|
+
return null;
|
|
91
|
+
let amount = 0, currency = null;
|
|
92
|
+
for (const line of lines) {
|
|
93
|
+
const money = line.lineSubtotal;
|
|
94
|
+
if (typeof money?.amountMinor !== "number" || typeof money.currency !== "string"
|
|
95
|
+
|| (currency !== null && currency !== money.currency))
|
|
96
|
+
return null;
|
|
97
|
+
currency = money.currency;
|
|
98
|
+
amount += money.amountMinor;
|
|
99
|
+
}
|
|
100
|
+
if (currency === null)
|
|
101
|
+
return null;
|
|
102
|
+
return {
|
|
103
|
+
subtotalGross: { amountMinor: amount, currency },
|
|
104
|
+
totalGross: { amountMinor: amount, currency },
|
|
105
|
+
currency,
|
|
106
|
+
source: "frozen_quote_line"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function editCutoff(nextCycleAt, editWindowHours) {
|
|
110
|
+
if (!nextCycleAt)
|
|
111
|
+
return null;
|
|
112
|
+
const date = new Date(nextCycleAt);
|
|
113
|
+
date.setHours(date.getHours() - (editWindowHours ?? 72));
|
|
114
|
+
return date.toISOString();
|
|
115
|
+
}
|
|
116
|
+
export function computeEditState(input, blockers, canUse) {
|
|
117
|
+
if (input.status !== "active")
|
|
118
|
+
return { canEdit: false, reason: "not_active" };
|
|
119
|
+
const reason = blockers.get(input.subscriptionId);
|
|
120
|
+
if (reason)
|
|
121
|
+
return { canEdit: false, reason };
|
|
122
|
+
const usable = input.paymentMethodStatus
|
|
123
|
+
? canUse(input.paymentMethodStatus)
|
|
124
|
+
: Boolean(input.paymentMethodKind && input.paymentMethodRefPresent);
|
|
125
|
+
if (!usable)
|
|
126
|
+
return { canEdit: false, reason: "missing_payment_method" };
|
|
127
|
+
if (input.editCutoffAt && new Date(input.editCutoffAt).getTime() <= Date.now())
|
|
128
|
+
return { canEdit: false, reason: "edit_window_closed" };
|
|
129
|
+
return { canEdit: true, reason: null };
|
|
130
|
+
}
|
|
131
|
+
export function buildActionRequired(subscriptions, orders, states = new Map(), canUse) {
|
|
132
|
+
const actions = [];
|
|
133
|
+
for (const s of subscriptions) {
|
|
134
|
+
const state = states.get(s.subscriptionId);
|
|
135
|
+
const base = {
|
|
136
|
+
entityType: "subscription",
|
|
137
|
+
entityId: s.subscriptionId,
|
|
138
|
+
subscriptionId: s.subscriptionId,
|
|
139
|
+
orderId: state?.orderId ?? null,
|
|
140
|
+
failureCause: state?.failureCause ?? "unknown",
|
|
141
|
+
dueAt: state?.dueAt ?? s.nextCycleAt,
|
|
142
|
+
nextRetryAt: state?.nextRetryAt ?? null,
|
|
143
|
+
recoveryEligible: state?.recoveryEligible ?? false
|
|
144
|
+
};
|
|
145
|
+
if (state?.blockedReason === "subscription_activation_missing_mandate") {
|
|
146
|
+
actions.push({
|
|
147
|
+
...base,
|
|
148
|
+
actionId: `subscription:${s.subscriptionId}:activation_missing_mandate`,
|
|
149
|
+
kind: "payment_method_missing",
|
|
150
|
+
severity: "critical",
|
|
151
|
+
messageCode: "subscription_activation_missing_mandate",
|
|
152
|
+
blockedReason: "subscription_activation_missing_mandate",
|
|
153
|
+
failureCause: "unknown",
|
|
154
|
+
title: "First order paid, subscription needs a payment method",
|
|
155
|
+
body: "The first order is paid. Add a card to enable future renewals without charging that order again.",
|
|
156
|
+
cta: "repair_payment",
|
|
157
|
+
recoveryEligible: false,
|
|
158
|
+
dueAt: state.dueAt,
|
|
159
|
+
nextRetryAt: null
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (s.status !== "active" && s.status !== "paused")
|
|
164
|
+
continue;
|
|
165
|
+
if (state?.blockedReason === "payment_expired") {
|
|
166
|
+
actions.push({
|
|
167
|
+
...base,
|
|
168
|
+
actionId: `subscription:${s.subscriptionId}:payment_expired`,
|
|
169
|
+
kind: "payment_recovery",
|
|
170
|
+
severity: "critical",
|
|
171
|
+
messageCode: "payment_expired",
|
|
172
|
+
blockedReason: "payment_expired",
|
|
173
|
+
title: "Subscription paused after payment could not be collected",
|
|
174
|
+
body: "Every retry has been used, so nothing else will be attempted. Update the payment method to resume; the unpaid cycle is skipped and a new one starts from the resume date.",
|
|
175
|
+
cta: "repair_payment",
|
|
176
|
+
dueAt: state.dueAt,
|
|
177
|
+
nextRetryAt: null
|
|
178
|
+
});
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (state) {
|
|
182
|
+
actions.push({
|
|
183
|
+
...base,
|
|
184
|
+
actionId: `subscription:${s.subscriptionId}:payment_blocked`,
|
|
185
|
+
kind: state.recoveryEligible ? "payment_recovery" : "subscription_blocked",
|
|
186
|
+
severity: "critical",
|
|
187
|
+
messageCode: state.blockedReason ?? "payment_blocked",
|
|
188
|
+
blockedReason: state.blockedReason,
|
|
189
|
+
title: "Payment needs attention",
|
|
190
|
+
body: state.recoveryEligible
|
|
191
|
+
? "Your subscription is blocked until the payment method is recovered."
|
|
192
|
+
: "Your subscription has a payment issue that needs support review.",
|
|
193
|
+
cta: state.recoveryEligible ? "repair_payment" : "contact_support"
|
|
194
|
+
});
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (!(s.paymentMethodStatus ? canUse(s.paymentMethodStatus) : Boolean(s.paymentMethodKind)))
|
|
198
|
+
actions.push({
|
|
199
|
+
...base,
|
|
200
|
+
actionId: `subscription:${s.subscriptionId}:payment_method_missing`,
|
|
201
|
+
kind: "payment_method_missing",
|
|
202
|
+
severity: "warning",
|
|
203
|
+
messageCode: "missing_payment_method",
|
|
204
|
+
blockedReason: "missing_payment_method",
|
|
205
|
+
title: "Payment method missing",
|
|
206
|
+
body: "Add or recover a payment method before the next subscription cycle.",
|
|
207
|
+
cta: "contact_support"
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
for (const order of orders) {
|
|
211
|
+
const status = order.paymentStatus?.toLowerCase() ?? "", failed = ["failed", "payment_failed", "requires_payment_method"].includes(status), required = ["requires_action", "requires_confirmation"].includes(status);
|
|
212
|
+
if (failed || required)
|
|
213
|
+
actions.push({
|
|
214
|
+
actionId: `order:${order.orderId}:${required ? "requires_action" : "payment_failed"}`,
|
|
215
|
+
kind: "order_attention",
|
|
216
|
+
severity: "critical",
|
|
217
|
+
entityType: "order",
|
|
218
|
+
entityId: order.orderId,
|
|
219
|
+
subscriptionId: null,
|
|
220
|
+
orderId: order.orderId,
|
|
221
|
+
messageCode: required ? "payment_requires_action" : "payment_failed",
|
|
222
|
+
blockedReason: required ? "payment_requires_action" : "payment_failed",
|
|
223
|
+
failureCause: "unknown",
|
|
224
|
+
title: required ? "Payment requires action" : "Payment failed",
|
|
225
|
+
body: "Open the order details to review the payment status and next step.",
|
|
226
|
+
cta: "view_order",
|
|
227
|
+
recoveryEligible: false,
|
|
228
|
+
dueAt: order.updatedAt,
|
|
229
|
+
nextRetryAt: null
|
|
230
|
+
});
|
|
231
|
+
const invoice = order.invoice;
|
|
232
|
+
if (invoice && !invoice.downloadAvailable && ["issued", "accepted"].includes(invoice.status))
|
|
233
|
+
actions.push({
|
|
234
|
+
actionId: `invoice:${invoice.invoiceId}:pdf_unavailable`,
|
|
235
|
+
kind: "invoice_attention",
|
|
236
|
+
severity: "info",
|
|
237
|
+
entityType: "invoice",
|
|
238
|
+
entityId: invoice.invoiceId,
|
|
239
|
+
subscriptionId: null,
|
|
240
|
+
orderId: order.orderId,
|
|
241
|
+
messageCode: "invoice_pdf_unavailable",
|
|
242
|
+
blockedReason: "invoice_pdf_unavailable",
|
|
243
|
+
failureCause: "unknown",
|
|
244
|
+
title: "Invoice PDF unavailable",
|
|
245
|
+
body: "The invoice is visible, but the PDF cannot be downloaded from the account yet.",
|
|
246
|
+
cta: "contact_support",
|
|
247
|
+
recoveryEligible: false,
|
|
248
|
+
dueAt: invoice.issuedAt ?? invoice.createdAt,
|
|
249
|
+
nextRetryAt: null
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return actions.slice(0, 8);
|
|
253
|
+
}
|
|
254
|
+
function profile(row) {
|
|
255
|
+
return {
|
|
256
|
+
clientId: text(row.id),
|
|
257
|
+
email: text(row.email),
|
|
258
|
+
firstName: nullableText(row.first_name),
|
|
259
|
+
lastName: nullableText(row.last_name),
|
|
260
|
+
phone: nullableText(row.phone),
|
|
261
|
+
lifecycleStage: text(row.lifecycle_stage)
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function text(value) {
|
|
265
|
+
return typeof value === "string" ? value : "";
|
|
266
|
+
}
|
|
267
|
+
function nullableText(value) {
|
|
268
|
+
return typeof value === "string" && value ? value : null;
|
|
269
|
+
}
|
|
270
|
+
function record(value) {
|
|
271
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
272
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AccountSupportCapabilities } from "./contracts/index.js";
|
|
2
|
+
/** Already bound owner methods; the host retains authentication and dispatch. */
|
|
3
|
+
export type AccountSupportCallable = (...args: never[]) => unknown;
|
|
4
|
+
export type AccountSupportOperations = Readonly<Record<string, AccountSupportCallable | null>>;
|
|
5
|
+
export type AccountSupportHostBindingRequired = {
|
|
6
|
+
readonly kind: "unsupported";
|
|
7
|
+
readonly code: "host_binding_required";
|
|
8
|
+
};
|
|
9
|
+
type CommerceArguments<F> = F extends AccountSupportCallable ? Parameters<F> : unknown[];
|
|
10
|
+
/** Capture one graph and one executor per logical operation, without calling either. */
|
|
11
|
+
export declare function createAccountSupportBindings<O extends AccountSupportOperations, C extends AccountSupportOperations = AccountSupportOperations>(input: {
|
|
12
|
+
graph: "managed" | "native";
|
|
13
|
+
capabilities: AccountSupportCapabilities;
|
|
14
|
+
operations: O;
|
|
15
|
+
commerce?: C | null;
|
|
16
|
+
}): Readonly<{
|
|
17
|
+
graph: "managed" | "native";
|
|
18
|
+
capabilities: Readonly<AccountSupportCapabilities>;
|
|
19
|
+
operations: Readonly<O>;
|
|
20
|
+
/** No draft commerce import or fallback executor. An absent record/member is explicit. */
|
|
21
|
+
commerce<K extends keyof C & string>(key: K, ...args: CommerceArguments<C[K]>): Promise<Awaited<ReturnType<Extract<C[K], AccountSupportCallable>>> | AccountSupportHostBindingRequired>;
|
|
22
|
+
}>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const HOST_BINDING_REQUIRED = Object.freeze({ kind: "unsupported", code: "host_binding_required" });
|
|
2
|
+
/** Capture one graph and one executor per logical operation, without calling either. */
|
|
3
|
+
export function createAccountSupportBindings(input) {
|
|
4
|
+
if (input.graph !== input.capabilities.graph)
|
|
5
|
+
throw new Error("customer_graph_mismatch");
|
|
6
|
+
const capabilities = Object.freeze({ ...input.capabilities, subscriptions: Object.freeze({ ...input.capabilities.subscriptions }) });
|
|
7
|
+
const operations = Object.freeze({ ...input.operations });
|
|
8
|
+
const commerce = Object.freeze({ ...input.commerce });
|
|
9
|
+
return Object.freeze({ graph: input.graph, capabilities, operations,
|
|
10
|
+
/** No draft commerce import or fallback executor. An absent record/member is explicit. */
|
|
11
|
+
async commerce(key, ...args) {
|
|
12
|
+
const operation = Object.hasOwn(commerce, key) ? commerce[key] : null;
|
|
13
|
+
return operation ? operation(...args) : HOST_BINDING_REQUIRED;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/** Host-verified selection; never an authorization claim from a request body. */
|
|
2
|
+
export interface CustomerContext {
|
|
3
|
+
principalId: string;
|
|
4
|
+
clientId: string;
|
|
5
|
+
graph: "managed" | "native";
|
|
6
|
+
}
|
|
7
|
+
export type AccountReadRefusal = "FORBIDDEN" | "NOT_FOUND" | "UPSTREAM_UNAVAILABLE" | "INVALID_RESPONSE";
|
|
8
|
+
/** Owner DTOs stay host supplied, including private profile and market fields.
|
|
9
|
+
* Null and thrown failures retain their existing host mappings. No cursor is promised.
|
|
10
|
+
*/
|
|
11
|
+
export interface AccountReadPort<Account, OrderList, OrderDetail> {
|
|
12
|
+
getAccount(userId: string): Promise<Account | null>;
|
|
13
|
+
listOrders(userId: string, input: {
|
|
14
|
+
limit: number;
|
|
15
|
+
}): Promise<OrderList | null>;
|
|
16
|
+
getOrderDetail(userId: string, orderId: string): Promise<OrderDetail | null>;
|
|
17
|
+
}
|
|
18
|
+
import type { AccountSupportMoney, SubscriptionPaymentMethodStatus } from "./commands.js";
|
|
19
|
+
import type { CustomerDocumentDeliveryStatus } from "./invoice.js";
|
|
20
|
+
export interface AccountProfile {
|
|
21
|
+
clientId: string;
|
|
22
|
+
email: string;
|
|
23
|
+
firstName: string | null;
|
|
24
|
+
lastName: string | null;
|
|
25
|
+
phone: string | null;
|
|
26
|
+
lifecycleStage: "lead" | "tester" | "customer" | "inactive";
|
|
27
|
+
}
|
|
28
|
+
export interface AccountAddress {
|
|
29
|
+
addressId: string;
|
|
30
|
+
kind: "shipping" | "billing" | "both";
|
|
31
|
+
label: string | null;
|
|
32
|
+
recipientName: string | null;
|
|
33
|
+
contactPhone: string | null;
|
|
34
|
+
companyName: string | null;
|
|
35
|
+
taxId: string | null;
|
|
36
|
+
line1: string;
|
|
37
|
+
line2: string | null;
|
|
38
|
+
city: string;
|
|
39
|
+
postalCode: string;
|
|
40
|
+
country: string;
|
|
41
|
+
isDefault: boolean;
|
|
42
|
+
deliveryNotes: string | null;
|
|
43
|
+
courierInstructions: string | null;
|
|
44
|
+
lastUsedAt: string | null;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AccountBillingProfile {
|
|
49
|
+
profileId: string;
|
|
50
|
+
label: string | null;
|
|
51
|
+
fullName: string;
|
|
52
|
+
email: string;
|
|
53
|
+
phone: string | null;
|
|
54
|
+
companyName: string | null;
|
|
55
|
+
taxId: string | null;
|
|
56
|
+
companyVerificationLevel?: "registry_verified" | "provider_verified" | "manual_unverified" | "invalid" | null;
|
|
57
|
+
companyIdentitySource?: string | null;
|
|
58
|
+
companyIdentityEvidenceHash?: string | null;
|
|
59
|
+
isDefault: boolean;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
}
|
|
63
|
+
/** Method/provider vocabulary is supplied by the selected host, never a platform provider list. */
|
|
64
|
+
export interface AccountPaymentPreference<Method extends string = string> {
|
|
65
|
+
scope: "one_time" | "subscription" | "any";
|
|
66
|
+
methodKind: Method;
|
|
67
|
+
lastSelectedAt: string;
|
|
68
|
+
}
|
|
69
|
+
export interface AccountPickupPoint {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
address: {
|
|
73
|
+
line1: string;
|
|
74
|
+
postalCode: string;
|
|
75
|
+
city: string;
|
|
76
|
+
country: string;
|
|
77
|
+
} | null;
|
|
78
|
+
}
|
|
79
|
+
export interface AccountDeliverySelection {
|
|
80
|
+
deliveryKind: "courier" | "parcel-locker";
|
|
81
|
+
providerKind: string | null;
|
|
82
|
+
carrierKind: string | null;
|
|
83
|
+
carrierCode: string | null;
|
|
84
|
+
serviceCode: string | null;
|
|
85
|
+
pickupPoint: AccountPickupPoint | null;
|
|
86
|
+
}
|
|
87
|
+
export interface AccountDeliveryPreference<Provider extends string = string> extends AccountDeliverySelection {
|
|
88
|
+
scope: "one_time" | "subscription" | "any";
|
|
89
|
+
providerKind: Provider;
|
|
90
|
+
carrierKind: string;
|
|
91
|
+
carrierCode: string;
|
|
92
|
+
serviceCode: string;
|
|
93
|
+
lastSelectedAt: string;
|
|
94
|
+
}
|
|
95
|
+
export interface AccountEvent {
|
|
96
|
+
eventId: string;
|
|
97
|
+
eventType: string;
|
|
98
|
+
entityType: string;
|
|
99
|
+
entityId: string | null;
|
|
100
|
+
occurredAt: string;
|
|
101
|
+
}
|
|
102
|
+
export interface AccountSubscriptionLine {
|
|
103
|
+
lineId: string;
|
|
104
|
+
variantId: string;
|
|
105
|
+
qty: number;
|
|
106
|
+
sortOrder: number;
|
|
107
|
+
isAddon: boolean;
|
|
108
|
+
title: string | null;
|
|
109
|
+
sku: string | null;
|
|
110
|
+
productSlug?: string | null;
|
|
111
|
+
displayLabel?: string | null;
|
|
112
|
+
accentColor?: string | null;
|
|
113
|
+
unitPrice?: AccountSupportMoney | null;
|
|
114
|
+
lineSubtotal?: AccountSupportMoney | null;
|
|
115
|
+
}
|
|
116
|
+
export interface AccountSubscription {
|
|
117
|
+
subscriptionId: string;
|
|
118
|
+
shippingAddressId: string | null;
|
|
119
|
+
status: "pending_activation" | "active" | "paused" | "cancelled" | "activation_failed" | "completed";
|
|
120
|
+
pausePreset: "2_weeks" | "1_month" | "indefinite" | null;
|
|
121
|
+
pauseStartedAt: string | null;
|
|
122
|
+
pauseEndsAt: string | null;
|
|
123
|
+
cadenceDays: number;
|
|
124
|
+
nextCycleAt: string | null;
|
|
125
|
+
deliveryAlignment?: {
|
|
126
|
+
state: "protected" | "aligned";
|
|
127
|
+
};
|
|
128
|
+
editCutoffAt: string | null;
|
|
129
|
+
canEditUpcomingPackage: boolean;
|
|
130
|
+
editBlockedReason: "not_active" | "edit_window_closed" | "cycle_locked" | "payment_blocked" | "missing_payment_method" | null;
|
|
131
|
+
paymentMethodKind: string | null;
|
|
132
|
+
paymentMethodStatus?: SubscriptionPaymentMethodStatus;
|
|
133
|
+
templateVersion: number;
|
|
134
|
+
sizeConstraint: Record<string, unknown> | null;
|
|
135
|
+
packageSummary: string | null;
|
|
136
|
+
recurringPrice: {
|
|
137
|
+
subtotalGross: AccountSupportMoney;
|
|
138
|
+
totalGross: AccountSupportMoney;
|
|
139
|
+
currency: string;
|
|
140
|
+
source: "frozen_quote_line" | "missing";
|
|
141
|
+
} | null;
|
|
142
|
+
nextCharge?: {
|
|
143
|
+
totalGross: AccountSupportMoney;
|
|
144
|
+
starterStage: "delivery2" | "graduation" | null;
|
|
145
|
+
} | null;
|
|
146
|
+
lines: AccountSubscriptionLine[];
|
|
147
|
+
}
|
|
148
|
+
export interface AccountTrackingReference {
|
|
149
|
+
providerKind: string;
|
|
150
|
+
trackingNumber: string;
|
|
151
|
+
trackingUrl: string | null;
|
|
152
|
+
carrierKind: string | null;
|
|
153
|
+
service: string | null;
|
|
154
|
+
updatedAt: string | null;
|
|
155
|
+
}
|
|
156
|
+
export interface AccountTrackingEvent {
|
|
157
|
+
eventType: string;
|
|
158
|
+
label: string;
|
|
159
|
+
occurredAt: string | null;
|
|
160
|
+
source: "webhook" | "reconciliation" | "manual" | "simulator" | "fulfillment";
|
|
161
|
+
}
|
|
162
|
+
export interface AccountInvoiceSummary {
|
|
163
|
+
invoiceId: string;
|
|
164
|
+
orderId: string;
|
|
165
|
+
invoiceRef: string;
|
|
166
|
+
status: string;
|
|
167
|
+
providerInvoiceNumber: string | null;
|
|
168
|
+
ksefNumber: string | null;
|
|
169
|
+
ksefStatus: string;
|
|
170
|
+
documentDeliveryStatus: CustomerDocumentDeliveryStatus;
|
|
171
|
+
totalGross: AccountSupportMoney;
|
|
172
|
+
issuedAt: string | null;
|
|
173
|
+
downloadAvailable: boolean;
|
|
174
|
+
downloadUrl: string | null;
|
|
175
|
+
createdAt: string;
|
|
176
|
+
}
|
|
177
|
+
export interface AccountInvoiceDocument extends Omit<AccountInvoiceSummary, "totalGross"> {
|
|
178
|
+
documentKey: string;
|
|
179
|
+
role: "original" | "correction" | "replacement";
|
|
180
|
+
artifact: "invoice" | "correction";
|
|
181
|
+
isCurrent: boolean;
|
|
182
|
+
totalGross: AccountSupportMoney | null;
|
|
183
|
+
}
|
|
184
|
+
export interface AccountOrderSummary {
|
|
185
|
+
orderId: string;
|
|
186
|
+
orderRef: string;
|
|
187
|
+
orderNumber: string | null;
|
|
188
|
+
subscriptionId: string | null;
|
|
189
|
+
status: string;
|
|
190
|
+
paymentStatus: string | null;
|
|
191
|
+
fulfillmentStatus: string | null;
|
|
192
|
+
customerFulfillmentStep?: "paid" | "accepted" | "packing" | "transit" | "delivered" | "exception" | "cancelled";
|
|
193
|
+
total: AccountSupportMoney;
|
|
194
|
+
trackingNumber: string | null;
|
|
195
|
+
trackingNumbers: string[];
|
|
196
|
+
trackingUrl: string | null;
|
|
197
|
+
carrierKind: string | null;
|
|
198
|
+
service: string | null;
|
|
199
|
+
trackingReferences: AccountTrackingReference[];
|
|
200
|
+
trackingTimeline: AccountTrackingEvent[];
|
|
201
|
+
deliverySelection: AccountDeliverySelection | null;
|
|
202
|
+
invoice: AccountInvoiceSummary | null;
|
|
203
|
+
invoiceDocuments: AccountInvoiceDocument[];
|
|
204
|
+
invoiceRequestStatus: "not_requested" | "preparing" | "available";
|
|
205
|
+
createdAt: string;
|
|
206
|
+
updatedAt: string;
|
|
207
|
+
}
|
|
208
|
+
export interface AccountOrderLine {
|
|
209
|
+
lineId: string;
|
|
210
|
+
skuId: string | null;
|
|
211
|
+
title: string;
|
|
212
|
+
quantity: number;
|
|
213
|
+
unitPrice: AccountSupportMoney;
|
|
214
|
+
total: AccountSupportMoney;
|
|
215
|
+
variantName: string | null;
|
|
216
|
+
productSlug?: string | null;
|
|
217
|
+
displayLabel?: string | null;
|
|
218
|
+
accentColor?: string | null;
|
|
219
|
+
listTotal?: AccountSupportMoney | null;
|
|
220
|
+
discount?: AccountSupportMoney | null;
|
|
221
|
+
}
|
|
222
|
+
export interface AccountFulfillmentSummary {
|
|
223
|
+
fulfillmentOrderId: string | null;
|
|
224
|
+
status: string | null;
|
|
225
|
+
providerKind: string | null;
|
|
226
|
+
trackingNumber: string | null;
|
|
227
|
+
trackingNumbers: string[];
|
|
228
|
+
trackingReferences: AccountTrackingReference[];
|
|
229
|
+
lastEventType: string | null;
|
|
230
|
+
updatedAt: string | null;
|
|
231
|
+
trackingTimeline: AccountTrackingEvent[];
|
|
232
|
+
}
|
|
233
|
+
export interface AccountOrderDetail extends AccountOrderSummary {
|
|
234
|
+
subtotal: AccountSupportMoney;
|
|
235
|
+
discount: AccountSupportMoney;
|
|
236
|
+
shipping: AccountSupportMoney;
|
|
237
|
+
tax: AccountSupportMoney;
|
|
238
|
+
lines: AccountOrderLine[];
|
|
239
|
+
fulfillment: AccountFulfillmentSummary | null;
|
|
240
|
+
}
|
|
241
|
+
export interface AccountOrderList {
|
|
242
|
+
contractVersion: "customer.orders.v2";
|
|
243
|
+
orders: AccountOrderSummary[];
|
|
244
|
+
}
|
|
245
|
+
export interface AccountOrderDetailResponse {
|
|
246
|
+
contractVersion: "customer.orders.v2";
|
|
247
|
+
order: AccountOrderDetail;
|
|
248
|
+
}
|
|
249
|
+
export interface AccountActionRequired {
|
|
250
|
+
actionId: string;
|
|
251
|
+
kind: "payment_recovery" | "payment_method_missing" | "subscription_blocked" | "order_attention" | "invoice_attention";
|
|
252
|
+
severity: "info" | "warning" | "critical";
|
|
253
|
+
entityType: "subscription" | "order" | "invoice" | "account";
|
|
254
|
+
entityId: string | null;
|
|
255
|
+
subscriptionId: string | null;
|
|
256
|
+
orderId: string | null;
|
|
257
|
+
messageCode: AccountActionMessage;
|
|
258
|
+
blockedReason: AccountActionMessage | null;
|
|
259
|
+
title: string;
|
|
260
|
+
body: string | null;
|
|
261
|
+
cta: "repair_payment" | "view_subscription" | "view_order" | "contact_support" | null;
|
|
262
|
+
failureCause: "needs_confirmation" | "method_cannot_recur" | "method_dead" | "method_data_invalid" | "method_missing" | "unknown";
|
|
263
|
+
recoveryEligible: boolean;
|
|
264
|
+
dueAt: string | null;
|
|
265
|
+
nextRetryAt: string | null;
|
|
266
|
+
}
|
|
267
|
+
export type AccountActionMessage = "payment_blocked" | "payment_expired" | "missing_payment_method" | "payment_failed" | "payment_requires_action" | "subscription_edit_blocked" | "invoice_pdf_unavailable" | "subscription_activation_missing_mandate";
|
|
268
|
+
export interface AccountSnapshot<Extension = unknown> {
|
|
269
|
+
contractVersion: "customer.account.v3";
|
|
270
|
+
profile: AccountProfile;
|
|
271
|
+
extension: Extension;
|
|
272
|
+
subscriptions: AccountSubscription[];
|
|
273
|
+
addresses: AccountAddress[];
|
|
274
|
+
ordererProfiles: AccountBillingProfile[];
|
|
275
|
+
billingProfiles: AccountBillingProfile[];
|
|
276
|
+
paymentPreferences: AccountPaymentPreference[];
|
|
277
|
+
deliveryPreferences: AccountDeliveryPreference[];
|
|
278
|
+
recentOrders: AccountOrderSummary[];
|
|
279
|
+
events: AccountEvent[];
|
|
280
|
+
actionRequired: AccountActionRequired[];
|
|
281
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SubscriptionCapabilities } from "./commands.js";
|
|
2
|
+
export type AccountSupportCapability<Code extends string> = {
|
|
3
|
+
supported: true;
|
|
4
|
+
} | {
|
|
5
|
+
supported: false;
|
|
6
|
+
refusalCode: Code;
|
|
7
|
+
};
|
|
8
|
+
export type AccountSupportLaneUnavailable<Code extends string> = Extract<AccountSupportCapability<Code>, {
|
|
9
|
+
supported: false;
|
|
10
|
+
}>;
|
|
11
|
+
/** Explicit driver selections; importing the module installs no capability. */
|
|
12
|
+
export interface AccountSupportCapabilities {
|
|
13
|
+
graph: "managed" | "native";
|
|
14
|
+
accountRead: AccountSupportCapability<"host_binding_required">;
|
|
15
|
+
customer360Read: AccountSupportCapability<"host_binding_required">;
|
|
16
|
+
invoiceAccess: AccountSupportCapability<"host_binding_required">;
|
|
17
|
+
paymentMethodSetup: AccountSupportCapability<"unsupported">;
|
|
18
|
+
commerceRecovery: AccountSupportCapability<"host_binding_required">;
|
|
19
|
+
configuredPurchase: AccountSupportCapability<"host_binding_required">;
|
|
20
|
+
operatorSubscription: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
21
|
+
operatorContact: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
22
|
+
subscriptions: SubscriptionCapabilities;
|
|
23
|
+
communicationGifts: AccountSupportCapability<"unsupported_preference">;
|
|
24
|
+
}
|
|
25
|
+
/** Per-action/subcase truth, independent of the host's unrelated read selections. */
|
|
26
|
+
export interface OperatorAuthorityCapabilities {
|
|
27
|
+
graph: "managed" | "native";
|
|
28
|
+
email: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
29
|
+
phone: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
30
|
+
link: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
31
|
+
address: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
32
|
+
shortBand: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
33
|
+
unpaidResume: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
34
|
+
preparedAttemptPause: AccountSupportCapability<"operator_subscription_authority_unavailable">;
|
|
35
|
+
pause: {
|
|
36
|
+
supported: true;
|
|
37
|
+
};
|
|
38
|
+
resume: {
|
|
39
|
+
supported: true;
|
|
40
|
+
};
|
|
41
|
+
slide: {
|
|
42
|
+
supported: true;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|