@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.
Files changed (603) hide show
  1. package/CHANGELOG.md +305 -327
  2. package/README.md +332 -16
  3. package/dist/account-support/accountReadFacade.d.ts +8 -0
  4. package/dist/account-support/accountReadFacade.js +10 -0
  5. package/dist/account-support/accountReadModels.d.ts +69 -0
  6. package/dist/account-support/accountReadModels.js +272 -0
  7. package/dist/account-support/bindings.d.ts +23 -0
  8. package/dist/account-support/bindings.js +16 -0
  9. package/dist/account-support/contracts/account.d.ts +281 -0
  10. package/dist/account-support/contracts/account.js +1 -0
  11. package/dist/account-support/contracts/capabilities.d.ts +44 -0
  12. package/dist/account-support/contracts/capabilities.js +1 -0
  13. package/dist/account-support/contracts/commands.d.ts +307 -0
  14. package/dist/account-support/contracts/commands.js +1 -0
  15. package/dist/account-support/contracts/customer360.d.ts +154 -0
  16. package/dist/account-support/contracts/customer360.js +1 -0
  17. package/dist/account-support/contracts/index.d.ts +10 -0
  18. package/dist/account-support/contracts/index.js +1 -0
  19. package/dist/account-support/contracts/invoice.d.ts +79 -0
  20. package/dist/account-support/contracts/invoice.js +1 -0
  21. package/dist/account-support/contracts/operator.d.ts +289 -0
  22. package/dist/account-support/contracts/operator.js +1 -0
  23. package/dist/account-support/contribution.d.ts +24 -0
  24. package/dist/account-support/contribution.js +22 -0
  25. package/dist/account-support/customer360.d.ts +106 -0
  26. package/dist/account-support/customer360.js +163 -0
  27. package/dist/account-support/customerAccountReadDiagnostics.d.ts +11 -0
  28. package/dist/account-support/customerAccountReadDiagnostics.js +71 -0
  29. package/dist/account-support/index.d.ts +26 -0
  30. package/dist/account-support/index.js +15 -0
  31. package/dist/account-support/invoiceAccess.d.ts +57 -0
  32. package/dist/account-support/invoiceAccess.js +40 -0
  33. package/dist/account-support/migrations.d.ts +14 -0
  34. package/dist/account-support/migrations.js +7 -0
  35. package/dist/account-support/operatorAuthority.d.ts +67 -0
  36. package/dist/account-support/operatorAuthority.js +379 -0
  37. package/dist/account-support/operatorRecovery.d.ts +66 -0
  38. package/dist/account-support/operatorRecovery.js +129 -0
  39. package/dist/account-support/orderHistory.d.ts +50 -0
  40. package/dist/account-support/orderHistory.js +188 -0
  41. package/dist/account-support/paymentMethodComposition.d.ts +5 -0
  42. package/dist/account-support/paymentMethodComposition.js +4 -0
  43. package/dist/account-support/postgresOperatorAuthority.d.ts +16 -0
  44. package/dist/account-support/postgresOperatorAuthority.js +93 -0
  45. package/dist/account-support/selfService.d.ts +6 -0
  46. package/dist/account-support/selfService.js +81 -0
  47. package/dist/account-support/subscriptionCommandCodec.d.ts +10 -0
  48. package/dist/account-support/subscriptionCommandCodec.js +38 -0
  49. package/dist/catalog/draftSchemas.d.ts +1 -1
  50. package/dist/catalog/foundationSchemas.d.ts +3 -3
  51. package/dist/catalog/resolvedSkuProjection.d.ts +2 -2
  52. package/dist/catalog/sellableSchemas.d.ts +2 -2
  53. package/dist/commerce/adapters/managed/commerceOmsControlPlane.d.ts +3 -0
  54. package/dist/commerce/adapters/managed/commerceOmsControlPlane.js +71 -0
  55. package/dist/commerce/adapters/managed/commerceOmsMutations.d.ts +10 -0
  56. package/dist/commerce/adapters/managed/commerceOmsMutations.js +119 -0
  57. package/dist/commerce/adapters/managed/commerceOmsPort.d.ts +28 -0
  58. package/dist/commerce/adapters/managed/commerceOmsPort.js +101 -0
  59. package/dist/commerce/adapters/managed/oms/accounting.d.ts +3 -0
  60. package/dist/commerce/adapters/managed/oms/accounting.js +13 -0
  61. package/dist/commerce/adapters/managed/oms/fulfillmentReads.d.ts +17 -0
  62. package/dist/commerce/adapters/managed/oms/fulfillmentReads.js +81 -0
  63. package/dist/commerce/adapters/managed/oms/inboundEvents.d.ts +9 -0
  64. package/dist/commerce/adapters/managed/oms/inboundEvents.js +40 -0
  65. package/dist/commerce/adapters/managed/oms/outboxEvents.d.ts +2 -0
  66. package/dist/commerce/adapters/managed/oms/outboxEvents.js +23 -0
  67. package/dist/commerce/adapters/managed/oms/paymentAttempts.d.ts +3 -0
  68. package/dist/commerce/adapters/managed/oms/paymentAttempts.js +15 -0
  69. package/dist/commerce/adapters/managed/oms/queueSelection.d.ts +12 -0
  70. package/dist/commerce/adapters/managed/oms/queueSelection.js +109 -0
  71. package/dist/commerce/adapters/managed/oms/readProjections.d.ts +18 -0
  72. package/dist/commerce/adapters/managed/oms/readProjections.js +13 -0
  73. package/dist/commerce/adapters/managed/oms/readQueries.d.ts +16 -0
  74. package/dist/commerce/adapters/managed/oms/readQueries.js +276 -0
  75. package/dist/commerce/adapters/managed/oms/types.d.ts +2 -0
  76. package/dist/commerce/adapters/managed/oms/types.js +7 -0
  77. package/dist/commerce/checkoutCommandSchemas.d.ts +89 -0
  78. package/dist/commerce/checkoutCommandSchemas.js +70 -0
  79. package/dist/commerce/checkoutHelpers.d.ts +21 -0
  80. package/dist/commerce/checkoutHelpers.js +29 -0
  81. package/dist/commerce/checkoutResumeSchemas.d.ts +158 -0
  82. package/dist/commerce/checkoutResumeSchemas.js +145 -0
  83. package/dist/commerce/checkoutSchemas.d.ts +158 -0
  84. package/dist/commerce/checkoutSchemas.js +161 -0
  85. package/dist/commerce/commerceReturnsPort.d.ts +97 -0
  86. package/dist/commerce/commerceReturnsPort.js +39 -0
  87. package/dist/commerce/configuratorIntentPersistenceSchemas.d.ts +20 -0
  88. package/dist/commerce/configuratorIntentPersistenceSchemas.js +21 -0
  89. package/dist/commerce/configuratorIntentSchemas.d.ts +63 -0
  90. package/dist/commerce/configuratorIntentSchemas.js +43 -0
  91. package/dist/commerce/contractPrimitives.d.ts +50 -0
  92. package/dist/commerce/contractPrimitives.js +25 -0
  93. package/dist/commerce/contracts/availability.d.ts +23 -0
  94. package/dist/commerce/contracts/availability.js +1 -0
  95. package/dist/commerce/contracts/fulfillmentRecovery.d.ts +25 -0
  96. package/dist/commerce/contracts/fulfillmentRecovery.js +1 -0
  97. package/dist/commerce/contracts/index.d.ts +13 -0
  98. package/dist/commerce/contracts/index.js +1 -0
  99. package/dist/commerce/contracts/intent.d.ts +86 -0
  100. package/dist/commerce/contracts/intent.js +1 -0
  101. package/dist/commerce/contracts/omsTypes.d.ts +1216 -0
  102. package/dist/commerce/contracts/omsTypes.js +1 -0
  103. package/dist/commerce/contracts/order.d.ts +39 -0
  104. package/dist/commerce/contracts/order.js +1 -0
  105. package/dist/commerce/contracts/orderMoney.d.ts +52 -0
  106. package/dist/commerce/contracts/orderMoney.js +1 -0
  107. package/dist/commerce/contracts/ports.d.ts +113 -0
  108. package/dist/commerce/contracts/ports.js +1 -0
  109. package/dist/commerce/contracts/recovery.d.ts +11 -0
  110. package/dist/commerce/contracts/recovery.js +1 -0
  111. package/dist/commerce/contracts/runtimePorts.d.ts +196 -0
  112. package/dist/commerce/contracts/runtimePorts.js +1 -0
  113. package/dist/commerce/contracts/state.d.ts +26 -0
  114. package/dist/commerce/contracts/state.js +43 -0
  115. package/dist/commerce/customerDefaultsSnapshotSchemas.d.ts +51 -0
  116. package/dist/commerce/customerDefaultsSnapshotSchemas.js +106 -0
  117. package/dist/commerce/errors.d.ts +18 -0
  118. package/dist/commerce/errors.js +36 -0
  119. package/dist/commerce/fulfillmentEligibility.d.ts +6 -0
  120. package/dist/commerce/fulfillmentEligibility.js +31 -0
  121. package/dist/commerce/index.d.ts +72 -0
  122. package/dist/commerce/index.js +67 -0
  123. package/dist/commerce/model/customerFulfillmentRecovery.d.ts +40 -0
  124. package/dist/commerce/model/customerFulfillmentRecovery.js +144 -0
  125. package/dist/commerce/model/fulfillmentCancellationEligibility.d.ts +7 -0
  126. package/dist/commerce/model/fulfillmentCancellationEligibility.js +9 -0
  127. package/dist/commerce/model/omsAccountingVisibility.d.ts +12 -0
  128. package/dist/commerce/model/omsAccountingVisibility.js +118 -0
  129. package/dist/commerce/model/omsBillingInvoiceBuyer.d.ts +2 -0
  130. package/dist/commerce/model/omsBillingInvoiceBuyer.js +15 -0
  131. package/dist/commerce/model/omsCurrency.d.ts +4 -0
  132. package/dist/commerce/model/omsCurrency.js +5 -0
  133. package/dist/commerce/model/omsFulfillmentDebug.d.ts +20 -0
  134. package/dist/commerce/model/omsFulfillmentDebug.js +122 -0
  135. package/dist/commerce/model/omsFulfillmentSummary.d.ts +16 -0
  136. package/dist/commerce/model/omsFulfillmentSummary.js +189 -0
  137. package/dist/commerce/model/omsListTotals.d.ts +13 -0
  138. package/dist/commerce/model/omsListTotals.js +32 -0
  139. package/dist/commerce/model/omsOperationalLadder.d.ts +51 -0
  140. package/dist/commerce/model/omsOperationalLadder.js +158 -0
  141. package/dist/commerce/model/omsOrderLineMoney.d.ts +4 -0
  142. package/dist/commerce/model/omsOrderLineMoney.js +25 -0
  143. package/dist/commerce/model/omsPaymentMethodSummary.d.ts +5 -0
  144. package/dist/commerce/model/omsPaymentMethodSummary.js +11 -0
  145. package/dist/commerce/model/omsReadModel.d.ts +43 -0
  146. package/dist/commerce/model/omsReadModel.js +211 -0
  147. package/dist/commerce/model/omsReadModelCommunication.d.ts +3 -0
  148. package/dist/commerce/model/omsReadModelCommunication.js +29 -0
  149. package/dist/commerce/model/omsReadModelHelpers.d.ts +125 -0
  150. package/dist/commerce/model/omsReadModelHelpers.js +212 -0
  151. package/dist/commerce/model/omsReadModelList.d.ts +33 -0
  152. package/dist/commerce/model/omsReadModelList.js +50 -0
  153. package/dist/commerce/model/omsReadModelListSummary.d.ts +3 -0
  154. package/dist/commerce/model/omsReadModelListSummary.js +13 -0
  155. package/dist/commerce/model/omsReadModelPricing.d.ts +5 -0
  156. package/dist/commerce/model/omsReadModelPricing.js +36 -0
  157. package/dist/commerce/model/omsReadModelProjections.d.ts +1 -0
  158. package/dist/commerce/model/omsReadModelProjections.js +1 -0
  159. package/dist/commerce/model/omsReadModelRowCore.d.ts +79 -0
  160. package/dist/commerce/model/omsReadModelRowCore.js +149 -0
  161. package/dist/commerce/model/omsReadModelRows.d.ts +1 -0
  162. package/dist/commerce/model/omsReadModelRows.js +6 -0
  163. package/dist/commerce/offerAvailability.d.ts +18 -0
  164. package/dist/commerce/offerAvailability.js +53 -0
  165. package/dist/commerce/offerAvailabilitySchemas.d.ts +43 -0
  166. package/dist/commerce/offerAvailabilitySchemas.js +42 -0
  167. package/dist/commerce/offerEvidenceSchemas.d.ts +7 -0
  168. package/dist/commerce/offerEvidenceSchemas.js +13 -0
  169. package/dist/commerce/oms/omsContractBase.d.ts +130 -0
  170. package/dist/commerce/oms/omsContractBase.js +86 -0
  171. package/dist/commerce/oms/omsContractReadAuxSchemas.d.ts +222 -0
  172. package/dist/commerce/oms/omsContractReadAuxSchemas.js +123 -0
  173. package/dist/commerce/oms/omsContractReadSchemas.d.ts +2266 -0
  174. package/dist/commerce/oms/omsContractReadSchemas.js +277 -0
  175. package/dist/commerce/oms/omsContractRequests.d.ts +196 -0
  176. package/dist/commerce/oms/omsContractRequests.js +118 -0
  177. package/dist/commerce/oms/omsContracts.d.ts +5 -0
  178. package/dist/commerce/oms/omsContracts.js +4 -0
  179. package/dist/commerce/oms/omsControlPlane.d.ts +275 -0
  180. package/dist/commerce/oms/omsControlPlane.js +72 -0
  181. package/dist/commerce/oms/omsFulfillmentContractSchemas.d.ts +203 -0
  182. package/dist/commerce/oms/omsFulfillmentContractSchemas.js +94 -0
  183. package/dist/commerce/oms/omsFulfillmentDebugSchemas.d.ts +69 -0
  184. package/dist/commerce/oms/omsFulfillmentDebugSchemas.js +33 -0
  185. package/dist/commerce/oms/omsFulfillmentHealthSchemas.d.ts +67 -0
  186. package/dist/commerce/oms/omsFulfillmentHealthSchemas.js +44 -0
  187. package/dist/commerce/oms/omsPorts.d.ts +84 -0
  188. package/dist/commerce/oms/omsPorts.js +148 -0
  189. package/dist/commerce/oms/omsPrimitives.d.ts +5 -0
  190. package/dist/commerce/oms/omsPrimitives.js +3 -0
  191. package/dist/commerce/oms/omsProviderEvidenceSchemas.d.ts +15 -0
  192. package/dist/commerce/oms/omsProviderEvidenceSchemas.js +12 -0
  193. package/dist/commerce/orderDraftErrors.d.ts +13 -0
  194. package/dist/commerce/orderDraftErrors.js +20 -0
  195. package/dist/commerce/orderEmailEligibility.d.ts +54 -0
  196. package/dist/commerce/orderEmailEligibility.js +123 -0
  197. package/dist/commerce/orderEmailLines.d.ts +12 -0
  198. package/dist/commerce/orderEmailLines.js +8 -0
  199. package/dist/commerce/orderFeedbackContracts.d.ts +41 -0
  200. package/dist/commerce/orderFeedbackContracts.js +33 -0
  201. package/dist/commerce/orderMoney.d.ts +6 -0
  202. package/dist/commerce/orderMoney.js +168 -0
  203. package/dist/commerce/orderReviewContracts.d.ts +475 -0
  204. package/dist/commerce/orderReviewContracts.js +94 -0
  205. package/dist/commerce/orderReviewPorts.d.ts +140 -0
  206. package/dist/commerce/orderReviewPorts.js +1 -0
  207. package/dist/commerce/outboxDispatchContracts.d.ts +30 -0
  208. package/dist/commerce/outboxDispatchContracts.js +1 -0
  209. package/dist/commerce/outboxEventSchemas.d.ts +162 -0
  210. package/dist/commerce/outboxEventSchemas.js +164 -0
  211. package/dist/commerce/outboxOrderDraftEmailPorts.d.ts +207 -0
  212. package/dist/commerce/outboxOrderDraftEmailPorts.js +12 -0
  213. package/dist/commerce/paymentContinuation.d.ts +4 -0
  214. package/dist/commerce/paymentContinuation.js +4 -0
  215. package/dist/commerce/ports.d.ts +8 -0
  216. package/dist/commerce/ports.js +1 -0
  217. package/dist/commerce/recoveryDestination.d.ts +3 -0
  218. package/dist/commerce/recoveryDestination.js +17 -0
  219. package/dist/commerce/runtimeErrors.d.ts +8 -0
  220. package/dist/commerce/runtimeErrors.js +16 -0
  221. package/dist/commerce/salesChannelEnvelope.d.ts +20 -0
  222. package/dist/commerce/salesChannelEnvelope.js +7 -0
  223. package/dist/commerce/schemas.d.ts +174 -0
  224. package/dist/commerce/schemas.js +84 -0
  225. package/dist/commerce/server/checkoutCompensation.d.ts +21 -0
  226. package/dist/commerce/server/checkoutCompensation.js +32 -0
  227. package/dist/commerce/server/checkoutConflictClassifiers.d.ts +17 -0
  228. package/dist/commerce/server/checkoutConflictClassifiers.js +38 -0
  229. package/dist/commerce/server/checkoutExpiredRecoveryPolicy.d.ts +38 -0
  230. package/dist/commerce/server/checkoutExpiredRecoveryPolicy.js +85 -0
  231. package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.d.ts +22 -0
  232. package/dist/commerce/server/checkoutInvoiceBuyerSnapshot.js +30 -0
  233. package/dist/commerce/server/checkoutOfferPolicyPort.d.ts +33 -0
  234. package/dist/commerce/server/checkoutOfferPolicyPort.js +49 -0
  235. package/dist/commerce/server/checkoutPaymentContinuationCredential.d.ts +58 -0
  236. package/dist/commerce/server/checkoutPaymentContinuationCredential.js +154 -0
  237. package/dist/commerce/server/checkoutQuoteTypes.d.ts +19 -0
  238. package/dist/commerce/server/checkoutQuoteTypes.js +1 -0
  239. package/dist/commerce/server/checkoutRecoveryOrderPort.d.ts +42 -0
  240. package/dist/commerce/server/checkoutRecoveryOrderPort.js +1 -0
  241. package/dist/commerce/server/checkoutRecoveryToken.d.ts +40 -0
  242. package/dist/commerce/server/checkoutRecoveryToken.js +26 -0
  243. package/dist/commerce/server/checkoutRefusalContinuation.d.ts +24 -0
  244. package/dist/commerce/server/checkoutRefusalContinuation.js +18 -0
  245. package/dist/commerce/server/checkoutRuntimeTypes.d.ts +81 -0
  246. package/dist/commerce/server/checkoutRuntimeTypes.js +1 -0
  247. package/dist/commerce/server/commerceCheckoutCommandExecution.d.ts +60 -0
  248. package/dist/commerce/server/commerceCheckoutCommandExecution.js +136 -0
  249. package/dist/commerce/server/commerceCheckoutCompensation.d.ts +26 -0
  250. package/dist/commerce/server/commerceCheckoutCompensation.js +46 -0
  251. package/dist/commerce/server/commerceCheckoutContinuationTerms.d.ts +50 -0
  252. package/dist/commerce/server/commerceCheckoutContinuationTerms.js +66 -0
  253. package/dist/commerce/server/commerceCheckoutCustomerDefaults.d.ts +18 -0
  254. package/dist/commerce/server/commerceCheckoutCustomerDefaults.js +17 -0
  255. package/dist/commerce/server/commerceCheckoutFailureHandler.d.ts +51 -0
  256. package/dist/commerce/server/commerceCheckoutFailureHandler.js +90 -0
  257. package/dist/commerce/server/commerceCheckoutHandler.d.ts +213 -0
  258. package/dist/commerce/server/commerceCheckoutHandler.js +196 -0
  259. package/dist/commerce/server/commerceCheckoutHandlerAdmission.d.ts +58 -0
  260. package/dist/commerce/server/commerceCheckoutHandlerAdmission.js +94 -0
  261. package/dist/commerce/server/commerceCheckoutHandlerHelpers.d.ts +67 -0
  262. package/dist/commerce/server/commerceCheckoutHandlerHelpers.js +155 -0
  263. package/dist/commerce/server/commerceCheckoutOrchestrationError.d.ts +9 -0
  264. package/dist/commerce/server/commerceCheckoutOrchestrationError.js +14 -0
  265. package/dist/commerce/server/commerceCheckoutPromotionPriceChange.d.ts +47 -0
  266. package/dist/commerce/server/commerceCheckoutPromotionPriceChange.js +43 -0
  267. package/dist/commerce/server/commerceCheckoutProviderPayment.d.ts +34 -0
  268. package/dist/commerce/server/commerceCheckoutProviderPayment.js +37 -0
  269. package/dist/commerce/server/commerceCheckoutQuoteGuard.d.ts +62 -0
  270. package/dist/commerce/server/commerceCheckoutQuoteGuard.js +106 -0
  271. package/dist/commerce/server/commerceCheckoutResume.d.ts +29 -0
  272. package/dist/commerce/server/commerceCheckoutResume.js +81 -0
  273. package/dist/commerce/server/commerceCheckoutResumeGuard.d.ts +54 -0
  274. package/dist/commerce/server/commerceCheckoutResumeGuard.js +138 -0
  275. package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.d.ts +39 -0
  276. package/dist/commerce/server/commerceCheckoutSavedPaymentMethod.js +44 -0
  277. package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.d.ts +7 -0
  278. package/dist/commerce/server/commerceCheckoutStartRuntimeFailure.js +39 -0
  279. package/dist/commerce/server/commerceCheckoutTiming.d.ts +8 -0
  280. package/dist/commerce/server/commerceCheckoutTiming.js +31 -0
  281. package/dist/commerce/server/commerceDiagnostics.d.ts +6 -0
  282. package/dist/commerce/server/commerceDiagnostics.js +31 -0
  283. package/dist/commerce/server/commerceOmsCancelOrderHandler.d.ts +7 -0
  284. package/dist/commerce/server/commerceOmsCancelOrderHandler.js +22 -0
  285. package/dist/commerce/server/commerceOmsControlPlaneHandlers.d.ts +18 -0
  286. package/dist/commerce/server/commerceOmsControlPlaneHandlers.js +60 -0
  287. package/dist/commerce/server/commerceOmsHandlers.d.ts +47 -0
  288. package/dist/commerce/server/commerceOmsHandlers.js +176 -0
  289. package/dist/commerce/server/commerceOmsMarkRefundedHandler.d.ts +7 -0
  290. package/dist/commerce/server/commerceOmsMarkRefundedHandler.js +19 -0
  291. package/dist/commerce/server/commerceOrderDraft.d.ts +24 -0
  292. package/dist/commerce/server/commerceOrderDraft.js +92 -0
  293. package/dist/commerce/server/commercePaidOrderOrchestration.d.ts +131 -0
  294. package/dist/commerce/server/commercePaidOrderOrchestration.js +140 -0
  295. package/dist/commerce/server/commerceProviderAttemptFailure.d.ts +133 -0
  296. package/dist/commerce/server/commerceProviderAttemptFailure.js +175 -0
  297. package/dist/commerce/server/commerceReturnsHandlers.d.ts +41 -0
  298. package/dist/commerce/server/commerceReturnsHandlers.js +100 -0
  299. package/dist/commerce/server/commerceRuntimePort.d.ts +16 -0
  300. package/dist/commerce/server/commerceRuntimePort.js +57 -0
  301. package/dist/commerce/server/commerceRuntimeService.d.ts +98 -0
  302. package/dist/commerce/server/commerceRuntimeService.js +186 -0
  303. package/dist/commerce/server/commerceRuntimeStartResponse.d.ts +37 -0
  304. package/dist/commerce/server/commerceRuntimeStartResponse.js +56 -0
  305. package/dist/commerce/server/commerceStarterOfferGuard.d.ts +55 -0
  306. package/dist/commerce/server/commerceStarterOfferGuard.js +128 -0
  307. package/dist/commerce/server/configuratorIntentPersistence.d.ts +47 -0
  308. package/dist/commerce/server/configuratorIntentPersistence.js +85 -0
  309. package/dist/commerce/server/configuratorIntentPersistenceHandler.d.ts +14 -0
  310. package/dist/commerce/server/configuratorIntentPersistenceHandler.js +42 -0
  311. package/dist/commerce/server/emailRuntime.d.ts +47 -0
  312. package/dist/commerce/server/emailRuntime.js +1 -0
  313. package/dist/commerce/server/handlerSupport.d.ts +68 -0
  314. package/dist/commerce/server/handlerSupport.js +1 -0
  315. package/dist/commerce/server/index.d.ts +178 -0
  316. package/dist/commerce/server/index.js +127 -0
  317. package/dist/commerce/server/offerAvailability.d.ts +21 -0
  318. package/dist/commerce/server/offerAvailability.js +163 -0
  319. package/dist/commerce/server/orderDraftRpcPayload.d.ts +20 -0
  320. package/dist/commerce/server/orderDraftRpcPayload.js +21 -0
  321. package/dist/commerce/server/orderFeedbackSubmit.d.ts +20 -0
  322. package/dist/commerce/server/orderFeedbackSubmit.js +16 -0
  323. package/dist/commerce/server/orderFeedbackTokenCheck.d.ts +17 -0
  324. package/dist/commerce/server/orderFeedbackTokenCheck.js +14 -0
  325. package/dist/commerce/server/orderReviewAdminHandlers.d.ts +47 -0
  326. package/dist/commerce/server/orderReviewAdminHandlers.js +41 -0
  327. package/dist/commerce/server/orderReviewHandlers.d.ts +114 -0
  328. package/dist/commerce/server/orderReviewHandlers.js +42 -0
  329. package/dist/commerce/server/orderReviewLifecycle.d.ts +10 -0
  330. package/dist/commerce/server/orderReviewLifecycle.js +121 -0
  331. package/dist/commerce/server/orderReviewMedia.d.ts +11 -0
  332. package/dist/commerce/server/orderReviewMedia.js +172 -0
  333. package/dist/commerce/server/orderReviewRawUploadHandler.d.ts +40 -0
  334. package/dist/commerce/server/orderReviewRawUploadHandler.js +316 -0
  335. package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.d.ts +14 -0
  336. package/dist/commerce/server/outboxCheckoutExpiredEmailHandler.js +57 -0
  337. package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.d.ts +13 -0
  338. package/dist/commerce/server/outboxCheckoutRecoveryEmailHandler.js +150 -0
  339. package/dist/commerce/server/outboxDispatchRegistry.d.ts +46 -0
  340. package/dist/commerce/server/outboxDispatchRegistry.js +184 -0
  341. package/dist/commerce/server/outboxDispatchRegistryComposition.d.ts +6 -0
  342. package/dist/commerce/server/outboxDispatchRegistryComposition.js +23 -0
  343. package/dist/commerce/server/outboxOrderDraftEmailHandler.d.ts +14 -0
  344. package/dist/commerce/server/outboxOrderDraftEmailHandler.js +130 -0
  345. package/dist/commerce/server/outboxOrderPaidEmailHandler.d.ts +21 -0
  346. package/dist/commerce/server/outboxOrderPaidEmailHandler.js +93 -0
  347. package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.d.ts +3 -0
  348. package/dist/commerce/server/outboxOrderPaidFulfillmentHandler.js +1 -0
  349. package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.d.ts +3 -0
  350. package/dist/commerce/server/outboxOrderPaidFulfillmentPorts.js +1 -0
  351. package/dist/commerce/server/outboxOrderRefundedEmailHandler.d.ts +13 -0
  352. package/dist/commerce/server/outboxOrderRefundedEmailHandler.js +42 -0
  353. package/dist/commerce/server/outboxPaymentFailedEmailHandler.d.ts +14 -0
  354. package/dist/commerce/server/outboxPaymentFailedEmailHandler.js +65 -0
  355. package/dist/commerce/server/outboxReturnEmailHandlers.d.ts +26 -0
  356. package/dist/commerce/server/outboxReturnEmailHandlers.js +53 -0
  357. package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.d.ts +17 -0
  358. package/dist/commerce/server/outboxShipmentDeliveredEmailHandler.js +52 -0
  359. package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.d.ts +13 -0
  360. package/dist/commerce/server/outboxShipmentDispatchedEmailHandler.js +87 -0
  361. package/dist/commerce/server/outboxShipmentExceptionEmailHandler.d.ts +13 -0
  362. package/dist/commerce/server/outboxShipmentExceptionEmailHandler.js +46 -0
  363. package/dist/commerce/server/referenceCheckoutHandler.d.ts +48 -0
  364. package/dist/commerce/server/referenceCheckoutHandler.js +68 -0
  365. package/dist/commerce/server/reservationSweepPort.d.ts +31 -0
  366. package/dist/commerce/server/reservationSweepPort.js +45 -0
  367. package/dist/commerce/server/starterTermsPort.d.ts +22 -0
  368. package/dist/commerce/server/starterTermsPort.js +1 -0
  369. package/dist/commerce/server/supabaseCommerceReturnsPort.d.ts +13 -0
  370. package/dist/commerce/server/supabaseCommerceReturnsPort.js +56 -0
  371. package/dist/communications/consentPurposeRegistry.d.ts +1 -1
  372. package/dist/communications/newsletterIntegrationContracts.d.ts +10 -10
  373. package/dist/composition/accountSupportContribution.d.ts +18 -0
  374. package/dist/composition/accountSupportContribution.js +21 -0
  375. package/dist/composition/commerceContribution.d.ts +21 -0
  376. package/dist/composition/commerceContribution.js +27 -0
  377. package/dist/composition/index.d.ts +2 -0
  378. package/dist/composition/index.js +2 -0
  379. package/dist/fulfillment/handlerSchemas.d.ts +69 -69
  380. package/dist/fulfillment/index.d.ts +1 -1
  381. package/dist/fulfillment/index.js +1 -1
  382. package/dist/fulfillment/paidHandoff.d.ts +12 -1
  383. package/dist/fulfillment/paidHandoff.js +2 -2
  384. package/dist/fulfillment/providerDispatchWorker.d.ts +4 -4
  385. package/dist/identity/customerContracts.d.ts +4 -4
  386. package/dist/inventory/bindings.d.ts +3 -0
  387. package/dist/inventory/bindings.js +10 -4
  388. package/dist/inventory/index.d.ts +1 -0
  389. package/dist/inventory/index.js +1 -0
  390. package/dist/inventory/managedStockAvailability.d.ts +15 -0
  391. package/dist/inventory/managedStockAvailability.js +16 -0
  392. package/dist/inventory/postgresStockAvailability.js +2 -25
  393. package/dist/inventory/schemas.d.ts +1 -1
  394. package/dist/inventory/stockReadResponse.d.ts +4 -0
  395. package/dist/inventory/stockReadResponse.js +27 -0
  396. package/dist/invoicing/snapshot.d.ts +1 -1
  397. package/dist/pricing/acquisitionQuoteBinding.d.ts +1 -1
  398. package/dist/pricing/browser/index.d.ts +6 -0
  399. package/dist/pricing/browser/index.js +6 -0
  400. package/dist/pricing/catalogFactsSchemas.d.ts +1 -1
  401. package/dist/pricing/quotePromotionEvidence.d.ts +1 -1
  402. package/dist/pricing/quoteSchemas.d.ts +56 -56
  403. package/dist/promotions/adminPromotionCodesContracts.d.ts +30 -30
  404. package/dist/promotions/adminPromotionsContracts.d.ts +16 -16
  405. package/dist/subscriptions/index.d.ts +3 -2
  406. package/dist/subscriptions/index.js +3 -2
  407. package/package.json +32 -2
  408. package/release-gates.json +90 -8
  409. package/sql/20261026120000_account_support_operator_authority.sql +693 -0
  410. package/src/account-support/accountReadFacade.ts +15 -0
  411. package/src/account-support/accountReadModels.ts +371 -0
  412. package/src/account-support/bindings.ts +28 -0
  413. package/src/account-support/contracts/account.ts +306 -0
  414. package/src/account-support/contracts/capabilities.ts +30 -0
  415. package/src/account-support/contracts/commands.ts +243 -0
  416. package/src/account-support/contracts/customer360.ts +150 -0
  417. package/src/account-support/contracts/index.ts +141 -0
  418. package/src/account-support/contracts/invoice.ts +44 -0
  419. package/src/account-support/contracts/operator.ts +123 -0
  420. package/src/account-support/contribution.ts +35 -0
  421. package/src/account-support/customer360.ts +268 -0
  422. package/src/account-support/customerAccountReadDiagnostics.ts +83 -0
  423. package/src/account-support/index.ts +72 -0
  424. package/src/account-support/invoiceAccess.ts +63 -0
  425. package/src/account-support/migrations.ts +7 -0
  426. package/src/account-support/operatorAuthority.ts +393 -0
  427. package/src/account-support/operatorRecovery.ts +136 -0
  428. package/src/account-support/orderHistory.ts +309 -0
  429. package/src/account-support/paymentMethodComposition.ts +8 -0
  430. package/src/account-support/postgresOperatorAuthority.ts +92 -0
  431. package/src/account-support/selfService.ts +83 -0
  432. package/src/account-support/subscriptionCommandCodec.ts +48 -0
  433. package/src/commerce/adapters/managed/commerceOmsControlPlane.ts +80 -0
  434. package/src/commerce/adapters/managed/commerceOmsMutations.ts +145 -0
  435. package/src/commerce/adapters/managed/commerceOmsPort.ts +158 -0
  436. package/src/commerce/adapters/managed/oms/accounting.ts +18 -0
  437. package/src/commerce/adapters/managed/oms/fulfillmentReads.ts +82 -0
  438. package/src/commerce/adapters/managed/oms/inboundEvents.ts +45 -0
  439. package/src/commerce/adapters/managed/oms/outboxEvents.ts +30 -0
  440. package/src/commerce/adapters/managed/oms/paymentAttempts.ts +19 -0
  441. package/src/commerce/adapters/managed/oms/queueSelection.ts +132 -0
  442. package/src/commerce/adapters/managed/oms/readProjections.ts +22 -0
  443. package/src/commerce/adapters/managed/oms/readQueries.ts +292 -0
  444. package/src/commerce/adapters/managed/oms/types.ts +9 -0
  445. package/src/commerce/checkoutCommandSchemas.ts +93 -0
  446. package/src/commerce/checkoutHelpers.ts +47 -0
  447. package/src/commerce/checkoutResumeSchemas.ts +164 -0
  448. package/src/commerce/checkoutSchemas.ts +182 -0
  449. package/src/commerce/commerceReturnsPort.ts +67 -0
  450. package/src/commerce/configuratorIntentPersistenceSchemas.ts +26 -0
  451. package/src/commerce/configuratorIntentSchemas.ts +47 -0
  452. package/src/commerce/contractPrimitives.ts +30 -0
  453. package/src/commerce/contracts/availability.ts +21 -0
  454. package/src/commerce/contracts/fulfillmentRecovery.ts +26 -0
  455. package/src/commerce/contracts/index.ts +17 -0
  456. package/src/commerce/contracts/intent.ts +58 -0
  457. package/src/commerce/contracts/omsTypes.ts +1217 -0
  458. package/src/commerce/contracts/order.ts +44 -0
  459. package/src/commerce/contracts/orderMoney.ts +75 -0
  460. package/src/commerce/contracts/ports.ts +124 -0
  461. package/src/commerce/contracts/recovery.ts +24 -0
  462. package/src/commerce/contracts/runtimePorts.ts +201 -0
  463. package/src/commerce/contracts/state.ts +64 -0
  464. package/src/commerce/customerDefaultsSnapshotSchemas.ts +117 -0
  465. package/src/commerce/errors.ts +53 -0
  466. package/src/commerce/fulfillmentEligibility.ts +32 -0
  467. package/src/commerce/index.ts +82 -0
  468. package/src/commerce/model/customerFulfillmentRecovery.ts +185 -0
  469. package/src/commerce/model/fulfillmentCancellationEligibility.ts +18 -0
  470. package/src/commerce/model/omsAccountingVisibility.ts +135 -0
  471. package/src/commerce/model/omsBillingInvoiceBuyer.ts +20 -0
  472. package/src/commerce/model/omsCurrency.ts +8 -0
  473. package/src/commerce/model/omsFulfillmentDebug.ts +157 -0
  474. package/src/commerce/model/omsFulfillmentSummary.ts +225 -0
  475. package/src/commerce/model/omsListTotals.ts +38 -0
  476. package/src/commerce/model/omsOperationalLadder.ts +181 -0
  477. package/src/commerce/model/omsOrderLineMoney.ts +34 -0
  478. package/src/commerce/model/omsPaymentMethodSummary.ts +19 -0
  479. package/src/commerce/model/omsReadModel.ts +302 -0
  480. package/src/commerce/model/omsReadModelCommunication.ts +32 -0
  481. package/src/commerce/model/omsReadModelHelpers.ts +279 -0
  482. package/src/commerce/model/omsReadModelList.ts +90 -0
  483. package/src/commerce/model/omsReadModelListSummary.ts +19 -0
  484. package/src/commerce/model/omsReadModelPricing.ts +57 -0
  485. package/src/commerce/model/omsReadModelProjections.ts +1 -0
  486. package/src/commerce/model/omsReadModelRowCore.ts +193 -0
  487. package/src/commerce/model/omsReadModelRows.ts +7 -0
  488. package/src/commerce/offerAvailability.ts +75 -0
  489. package/src/commerce/offerAvailabilitySchemas.ts +56 -0
  490. package/src/commerce/offerEvidenceSchemas.ts +17 -0
  491. package/src/commerce/oms/omsContractBase.ts +92 -0
  492. package/src/commerce/oms/omsContractReadAuxSchemas.ts +130 -0
  493. package/src/commerce/oms/omsContractReadSchemas.ts +303 -0
  494. package/src/commerce/oms/omsContractRequests.ts +143 -0
  495. package/src/commerce/oms/omsContracts.ts +6 -0
  496. package/src/commerce/oms/omsControlPlane.ts +85 -0
  497. package/src/commerce/oms/omsFulfillmentContractSchemas.ts +113 -0
  498. package/src/commerce/oms/omsFulfillmentDebugSchemas.ts +38 -0
  499. package/src/commerce/oms/omsFulfillmentHealthSchemas.ts +46 -0
  500. package/src/commerce/oms/omsPorts.ts +165 -0
  501. package/src/commerce/oms/omsPrimitives.ts +3 -0
  502. package/src/commerce/oms/omsProviderEvidenceSchemas.ts +13 -0
  503. package/src/commerce/orderDraftErrors.ts +28 -0
  504. package/src/commerce/orderEmailEligibility.ts +131 -0
  505. package/src/commerce/orderEmailLines.ts +22 -0
  506. package/src/commerce/orderFeedbackContracts.ts +47 -0
  507. package/src/commerce/orderMoney.ts +207 -0
  508. package/src/commerce/orderReviewContracts.ts +124 -0
  509. package/src/commerce/orderReviewPorts.ts +94 -0
  510. package/src/commerce/outboxDispatchContracts.ts +30 -0
  511. package/src/commerce/outboxEventSchemas.ts +230 -0
  512. package/src/commerce/outboxOrderDraftEmailPorts.ts +241 -0
  513. package/src/commerce/paymentContinuation.ts +5 -0
  514. package/src/commerce/ports.ts +7 -0
  515. package/src/commerce/recoveryDestination.ts +23 -0
  516. package/src/commerce/runtimeErrors.ts +19 -0
  517. package/src/commerce/salesChannelEnvelope.ts +28 -0
  518. package/src/commerce/schemas.ts +104 -0
  519. package/src/commerce/server/checkoutCompensation.ts +49 -0
  520. package/src/commerce/server/checkoutConflictClassifiers.ts +53 -0
  521. package/src/commerce/server/checkoutExpiredRecoveryPolicy.ts +107 -0
  522. package/src/commerce/server/checkoutInvoiceBuyerSnapshot.ts +36 -0
  523. package/src/commerce/server/checkoutOfferPolicyPort.ts +60 -0
  524. package/src/commerce/server/checkoutPaymentContinuationCredential.ts +222 -0
  525. package/src/commerce/server/checkoutQuoteTypes.ts +9 -0
  526. package/src/commerce/server/checkoutRecoveryOrderPort.ts +40 -0
  527. package/src/commerce/server/checkoutRecoveryToken.ts +63 -0
  528. package/src/commerce/server/checkoutRefusalContinuation.ts +29 -0
  529. package/src/commerce/server/checkoutRuntimeTypes.ts +26 -0
  530. package/src/commerce/server/commerceCheckoutCommandExecution.ts +188 -0
  531. package/src/commerce/server/commerceCheckoutCompensation.ts +66 -0
  532. package/src/commerce/server/commerceCheckoutContinuationTerms.ts +87 -0
  533. package/src/commerce/server/commerceCheckoutCustomerDefaults.ts +24 -0
  534. package/src/commerce/server/commerceCheckoutFailureHandler.ts +144 -0
  535. package/src/commerce/server/commerceCheckoutHandler.ts +269 -0
  536. package/src/commerce/server/commerceCheckoutHandlerAdmission.ts +157 -0
  537. package/src/commerce/server/commerceCheckoutHandlerHelpers.ts +223 -0
  538. package/src/commerce/server/commerceCheckoutOrchestrationError.ts +15 -0
  539. package/src/commerce/server/commerceCheckoutPromotionPriceChange.ts +83 -0
  540. package/src/commerce/server/commerceCheckoutProviderPayment.ts +45 -0
  541. package/src/commerce/server/commerceCheckoutQuoteGuard.ts +172 -0
  542. package/src/commerce/server/commerceCheckoutResume.ts +132 -0
  543. package/src/commerce/server/commerceCheckoutResumeGuard.ts +195 -0
  544. package/src/commerce/server/commerceCheckoutSavedPaymentMethod.ts +85 -0
  545. package/src/commerce/server/commerceCheckoutStartRuntimeFailure.ts +59 -0
  546. package/src/commerce/server/commerceCheckoutTiming.ts +53 -0
  547. package/src/commerce/server/commerceDiagnostics.ts +37 -0
  548. package/src/commerce/server/commerceOmsCancelOrderHandler.ts +43 -0
  549. package/src/commerce/server/commerceOmsControlPlaneHandlers.ts +71 -0
  550. package/src/commerce/server/commerceOmsHandlers.ts +275 -0
  551. package/src/commerce/server/commerceOmsMarkRefundedHandler.ts +39 -0
  552. package/src/commerce/server/commerceOrderDraft.ts +131 -0
  553. package/src/commerce/server/commercePaidOrderOrchestration.ts +275 -0
  554. package/src/commerce/server/commerceProviderAttemptFailure.ts +257 -0
  555. package/src/commerce/server/commerceReturnsHandlers.ts +143 -0
  556. package/src/commerce/server/commerceRuntimePort.ts +75 -0
  557. package/src/commerce/server/commerceRuntimeService.ts +229 -0
  558. package/src/commerce/server/commerceRuntimeStartResponse.ts +76 -0
  559. package/src/commerce/server/commerceStarterOfferGuard.ts +200 -0
  560. package/src/commerce/server/configuratorIntentPersistence.ts +161 -0
  561. package/src/commerce/server/configuratorIntentPersistenceHandler.ts +54 -0
  562. package/src/commerce/server/emailRuntime.ts +30 -0
  563. package/src/commerce/server/handlerSupport.ts +22 -0
  564. package/src/commerce/server/index.ts +181 -0
  565. package/src/commerce/server/offerAvailability.ts +275 -0
  566. package/src/commerce/server/orderDraftRpcPayload.ts +39 -0
  567. package/src/commerce/server/orderFeedbackSubmit.ts +40 -0
  568. package/src/commerce/server/orderFeedbackTokenCheck.ts +28 -0
  569. package/src/commerce/server/orderReviewAdminHandlers.ts +43 -0
  570. package/src/commerce/server/orderReviewHandlers.ts +57 -0
  571. package/src/commerce/server/orderReviewLifecycle.ts +129 -0
  572. package/src/commerce/server/orderReviewMedia.ts +170 -0
  573. package/src/commerce/server/orderReviewRawUploadHandler.ts +300 -0
  574. package/src/commerce/server/outboxCheckoutExpiredEmailHandler.ts +86 -0
  575. package/src/commerce/server/outboxCheckoutRecoveryEmailHandler.ts +188 -0
  576. package/src/commerce/server/outboxDispatchRegistry.ts +269 -0
  577. package/src/commerce/server/outboxDispatchRegistryComposition.ts +31 -0
  578. package/src/commerce/server/outboxOrderDraftEmailHandler.ts +162 -0
  579. package/src/commerce/server/outboxOrderPaidEmailHandler.ts +147 -0
  580. package/src/commerce/server/outboxOrderPaidFulfillmentHandler.ts +4 -0
  581. package/src/commerce/server/outboxOrderPaidFulfillmentPorts.ts +3 -0
  582. package/src/commerce/server/outboxOrderRefundedEmailHandler.ts +58 -0
  583. package/src/commerce/server/outboxPaymentFailedEmailHandler.ts +99 -0
  584. package/src/commerce/server/outboxReturnEmailHandlers.ts +92 -0
  585. package/src/commerce/server/outboxShipmentDeliveredEmailHandler.ts +94 -0
  586. package/src/commerce/server/outboxShipmentDispatchedEmailHandler.ts +112 -0
  587. package/src/commerce/server/outboxShipmentExceptionEmailHandler.ts +73 -0
  588. package/src/commerce/server/referenceCheckoutHandler.ts +87 -0
  589. package/src/commerce/server/reservationSweepPort.ts +67 -0
  590. package/src/commerce/server/starterTermsPort.ts +22 -0
  591. package/src/commerce/server/supabaseCommerceReturnsPort.ts +81 -0
  592. package/src/composition/accountSupportContribution.ts +28 -0
  593. package/src/composition/commerceContribution.ts +35 -0
  594. package/src/composition/index.ts +2 -0
  595. package/src/fulfillment/index.ts +1 -1
  596. package/src/fulfillment/paidHandoff.ts +2 -2
  597. package/src/inventory/bindings.ts +12 -4
  598. package/src/inventory/index.ts +1 -0
  599. package/src/inventory/managedStockAvailability.ts +23 -0
  600. package/src/inventory/postgresStockAvailability.ts +2 -21
  601. package/src/inventory/stockReadResponse.ts +25 -0
  602. package/src/pricing/browser/index.ts +6 -0
  603. package/src/subscriptions/index.ts +3 -2
@@ -0,0 +1,306 @@
1
+ /** Host-verified selection; never an authorization claim from a request body. */
2
+ export interface CustomerContext { principalId: string; clientId: string; graph: "managed" | "native" }
3
+ export type AccountReadRefusal = "FORBIDDEN" | "NOT_FOUND" | "UPSTREAM_UNAVAILABLE" | "INVALID_RESPONSE";
4
+ /** Owner DTOs stay host supplied, including private profile and market fields.
5
+ * Null and thrown failures retain their existing host mappings. No cursor is promised.
6
+ */
7
+ export interface AccountReadPort<Account, OrderList, OrderDetail> {
8
+ getAccount(userId: string): Promise<Account | null>;
9
+ listOrders(userId: string, input: { limit: number }): Promise<OrderList | null>;
10
+ getOrderDetail(userId: string, orderId: string): Promise<OrderDetail | null>;
11
+ }
12
+
13
+ import type { AccountSupportMoney, SubscriptionPaymentMethodStatus } from "./commands.js";
14
+ import type { CustomerDocumentDeliveryStatus } from "./invoice.js";
15
+
16
+ export interface AccountProfile {
17
+ clientId: string;
18
+ email: string;
19
+ firstName: string | null;
20
+ lastName: string | null;
21
+ phone: string | null;
22
+ lifecycleStage: "lead" | "tester" | "customer" | "inactive"
23
+ }
24
+
25
+ export interface AccountAddress {
26
+ addressId: string;
27
+ kind: "shipping" | "billing" | "both";
28
+ label: string | null;
29
+ recipientName: string | null;
30
+ contactPhone: string | null;
31
+ companyName: string | null;
32
+ taxId: string | null;
33
+ line1: string;
34
+ line2: string | null;
35
+ city: string;
36
+ postalCode: string;
37
+ country: string;
38
+ isDefault: boolean;
39
+ deliveryNotes: string | null;
40
+ courierInstructions: string | null;
41
+ lastUsedAt: string | null;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ }
45
+
46
+ export interface AccountBillingProfile {
47
+ profileId: string;
48
+ label: string | null;
49
+ fullName: string;
50
+ email: string;
51
+ phone: string | null;
52
+ companyName: string | null;
53
+ taxId: string | null;
54
+ companyVerificationLevel?: "registry_verified" | "provider_verified" | "manual_unverified" | "invalid" | null;
55
+ companyIdentitySource?: string | null;
56
+ companyIdentityEvidenceHash?: string | null;
57
+ isDefault: boolean;
58
+ createdAt: string;
59
+ updatedAt: string;
60
+ }
61
+
62
+ /** Method/provider vocabulary is supplied by the selected host, never a platform provider list. */
63
+ export interface AccountPaymentPreference<Method extends string = string> {
64
+ scope: "one_time" | "subscription" | "any";
65
+ methodKind: Method;
66
+ lastSelectedAt: string
67
+ }
68
+
69
+ export interface AccountPickupPoint {
70
+ id: string;
71
+ name: string;
72
+ address: { line1: string; postalCode: string; city: string; country: string } | null
73
+ }
74
+
75
+ export interface AccountDeliverySelection {
76
+ deliveryKind: "courier" | "parcel-locker";
77
+ providerKind: string | null;
78
+ carrierKind: string | null;
79
+ carrierCode: string | null;
80
+ serviceCode: string | null;
81
+ pickupPoint: AccountPickupPoint | null;
82
+ }
83
+
84
+ export interface AccountDeliveryPreference<Provider extends string = string> extends AccountDeliverySelection {
85
+ scope: "one_time" | "subscription" | "any";
86
+ providerKind: Provider;
87
+ carrierKind: string;
88
+ carrierCode: string;
89
+ serviceCode: string;
90
+ lastSelectedAt: string;
91
+ }
92
+
93
+ export interface AccountEvent {
94
+ eventId: string;
95
+ eventType: string;
96
+ entityType: string;
97
+ entityId: string | null;
98
+ occurredAt: string
99
+ }
100
+
101
+ export interface AccountSubscriptionLine {
102
+ lineId: string;
103
+ variantId: string;
104
+ qty: number;
105
+ sortOrder: number;
106
+ isAddon: boolean;
107
+ title: string | null;
108
+ sku: string | null;
109
+ productSlug?: string | null;
110
+ displayLabel?: string | null;
111
+ accentColor?: string | null;
112
+ unitPrice?: AccountSupportMoney | null;
113
+ lineSubtotal?: AccountSupportMoney | null;
114
+ }
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?: { state: "protected" | "aligned" };
126
+ editCutoffAt: string | null;
127
+ canEditUpcomingPackage: boolean;
128
+ editBlockedReason: "not_active" | "edit_window_closed" | "cycle_locked" | "payment_blocked" | "missing_payment_method" | null;
129
+ paymentMethodKind: string | null;
130
+ paymentMethodStatus?: SubscriptionPaymentMethodStatus;
131
+ templateVersion: number;
132
+ sizeConstraint: Record<string, unknown> | null;
133
+ packageSummary: string | null;
134
+ recurringPrice: {
135
+ subtotalGross: AccountSupportMoney;
136
+ totalGross: AccountSupportMoney;
137
+ currency: string;
138
+ source: "frozen_quote_line" | "missing"
139
+ }
140
+ | null;
141
+ nextCharge?: { totalGross: AccountSupportMoney; starterStage: "delivery2" | "graduation" | null } | null;
142
+ lines: AccountSubscriptionLine[];
143
+ }
144
+
145
+ export interface AccountTrackingReference {
146
+ providerKind: string;
147
+ trackingNumber: string;
148
+ trackingUrl: string | null;
149
+ carrierKind: string | null;
150
+ service: string | null;
151
+ updatedAt: string | null
152
+ }
153
+
154
+ export interface AccountTrackingEvent {
155
+ eventType: string;
156
+ label: string;
157
+ occurredAt: string | null;
158
+ source: "webhook" | "reconciliation" | "manual" | "simulator" | "fulfillment"
159
+ }
160
+
161
+ export interface AccountInvoiceSummary {
162
+ invoiceId: string;
163
+ orderId: string;
164
+ invoiceRef: string;
165
+ status: string;
166
+ providerInvoiceNumber: string | null;
167
+ ksefNumber: string | null;
168
+ ksefStatus: string;
169
+ documentDeliveryStatus: CustomerDocumentDeliveryStatus;
170
+ totalGross: AccountSupportMoney;
171
+ issuedAt: string | null;
172
+ downloadAvailable: boolean;
173
+ downloadUrl: string | null;
174
+ createdAt: string;
175
+ }
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
+
185
+ export interface AccountOrderSummary {
186
+ orderId: string;
187
+ orderRef: string;
188
+ orderNumber: string | null;
189
+ subscriptionId: string | null;
190
+ status: string;
191
+ paymentStatus: string | null;
192
+ fulfillmentStatus: string | null;
193
+ customerFulfillmentStep?: "paid" | "accepted" | "packing" | "transit" | "delivered" | "exception" | "cancelled";
194
+ total: AccountSupportMoney;
195
+ trackingNumber: string | null;
196
+ trackingNumbers: string[];
197
+ trackingUrl: string | null;
198
+ carrierKind: string | null;
199
+ service: string | null;
200
+ trackingReferences: AccountTrackingReference[];
201
+ trackingTimeline: AccountTrackingEvent[];
202
+ deliverySelection: AccountDeliverySelection | null;
203
+ invoice: AccountInvoiceSummary | null;
204
+ invoiceDocuments: AccountInvoiceDocument[];
205
+ invoiceRequestStatus: "not_requested" | "preparing" | "available";
206
+ createdAt: string;
207
+ updatedAt: string;
208
+ }
209
+
210
+ export interface AccountOrderLine {
211
+ lineId: string;
212
+ skuId: string | null;
213
+ title: string;
214
+ quantity: number;
215
+ unitPrice: AccountSupportMoney;
216
+ total: AccountSupportMoney;
217
+ variantName: string | null;
218
+ productSlug?: string | null;
219
+ displayLabel?: string | null;
220
+ accentColor?: string | null;
221
+ listTotal?: AccountSupportMoney | null;
222
+ discount?: AccountSupportMoney | null;
223
+ }
224
+
225
+ export interface AccountFulfillmentSummary {
226
+ fulfillmentOrderId: string | null;
227
+ status: string | null;
228
+ providerKind: string | null;
229
+ trackingNumber: string | null;
230
+ trackingNumbers: string[];
231
+ trackingReferences: AccountTrackingReference[];
232
+ lastEventType: string | null;
233
+ updatedAt: string | null;
234
+ trackingTimeline: AccountTrackingEvent[];
235
+ }
236
+
237
+ export interface AccountOrderDetail extends AccountOrderSummary {
238
+ subtotal: AccountSupportMoney;
239
+ discount: AccountSupportMoney;
240
+ shipping: AccountSupportMoney;
241
+ tax: AccountSupportMoney;
242
+ lines: AccountOrderLine[];
243
+ fulfillment: AccountFulfillmentSummary | null;
244
+ }
245
+
246
+ export interface AccountOrderList {
247
+ contractVersion: "customer.orders.v2";
248
+ orders: AccountOrderSummary[]
249
+ }
250
+
251
+ export interface AccountOrderDetailResponse {
252
+ contractVersion: "customer.orders.v2";
253
+ order: AccountOrderDetail
254
+ }
255
+
256
+ export interface AccountActionRequired {
257
+ actionId: string;
258
+ kind: "payment_recovery"
259
+ | "payment_method_missing"
260
+ | "subscription_blocked"
261
+ | "order_attention"
262
+ | "invoice_attention";
263
+ severity: "info" | "warning" | "critical";
264
+ entityType: "subscription" | "order" | "invoice" | "account";
265
+ entityId: string | null;
266
+ subscriptionId: string | null;
267
+ orderId: string | null;
268
+ messageCode: AccountActionMessage;
269
+ blockedReason: AccountActionMessage | null;
270
+ title: string;
271
+ body: string | null;
272
+ cta: "repair_payment" | "view_subscription" | "view_order" | "contact_support" | null;
273
+ failureCause: "needs_confirmation"
274
+ | "method_cannot_recur"
275
+ | "method_dead"
276
+ | "method_data_invalid"
277
+ | "method_missing"
278
+ | "unknown";
279
+ recoveryEligible: boolean;
280
+ dueAt: string | null;
281
+ nextRetryAt: string | null;
282
+ }
283
+
284
+ export type AccountActionMessage = "payment_blocked"
285
+ | "payment_expired"
286
+ | "missing_payment_method"
287
+ | "payment_failed"
288
+ | "payment_requires_action"
289
+ | "subscription_edit_blocked"
290
+ | "invoice_pdf_unavailable"
291
+ | "subscription_activation_missing_mandate";
292
+
293
+ export interface AccountSnapshot<Extension = unknown> {
294
+ contractVersion: "customer.account.v3";
295
+ profile: AccountProfile;
296
+ extension: Extension;
297
+ subscriptions: AccountSubscription[];
298
+ addresses: AccountAddress[];
299
+ ordererProfiles: AccountBillingProfile[];
300
+ billingProfiles: AccountBillingProfile[];
301
+ paymentPreferences: AccountPaymentPreference[];
302
+ deliveryPreferences: AccountDeliveryPreference[];
303
+ recentOrders: AccountOrderSummary[];
304
+ events: AccountEvent[];
305
+ actionRequired: AccountActionRequired[];
306
+ }
@@ -0,0 +1,30 @@
1
+ import type { SubscriptionCapabilities } from "./commands.js";
2
+ export type AccountSupportCapability<Code extends string> = { supported: true } | { supported: false; refusalCode: Code };
3
+ export type AccountSupportLaneUnavailable<Code extends string> = Extract<AccountSupportCapability<Code>, { supported: false }>;
4
+ /** Explicit driver selections; importing the module installs no capability. */
5
+ export interface AccountSupportCapabilities {
6
+ graph: "managed" | "native";
7
+ accountRead: AccountSupportCapability<"host_binding_required">;
8
+ customer360Read: AccountSupportCapability<"host_binding_required">;
9
+ invoiceAccess: AccountSupportCapability<"host_binding_required">;
10
+ paymentMethodSetup: AccountSupportCapability<"unsupported">;
11
+ commerceRecovery: AccountSupportCapability<"host_binding_required">;
12
+ configuredPurchase: AccountSupportCapability<"host_binding_required">;
13
+ operatorSubscription: AccountSupportCapability<"operator_subscription_authority_unavailable">;
14
+ operatorContact: AccountSupportCapability<"operator_subscription_authority_unavailable">;
15
+ subscriptions: SubscriptionCapabilities;
16
+ communicationGifts: AccountSupportCapability<"unsupported_preference">;
17
+ }
18
+
19
+ /** Per-action/subcase truth, independent of the host's unrelated read selections. */
20
+ export interface OperatorAuthorityCapabilities {
21
+ graph: "managed" | "native";
22
+ email: AccountSupportCapability<"operator_subscription_authority_unavailable">;
23
+ phone: AccountSupportCapability<"operator_subscription_authority_unavailable">;
24
+ link: AccountSupportCapability<"operator_subscription_authority_unavailable">;
25
+ address: AccountSupportCapability<"operator_subscription_authority_unavailable">;
26
+ shortBand: AccountSupportCapability<"operator_subscription_authority_unavailable">;
27
+ unpaidResume: AccountSupportCapability<"operator_subscription_authority_unavailable">;
28
+ preparedAttemptPause: AccountSupportCapability<"operator_subscription_authority_unavailable">;
29
+ pause: { supported: true }; resume: { supported: true }; slide: { supported: true };
30
+ }
@@ -0,0 +1,243 @@
1
+ import type { CustomerContext } from "./account.js";
2
+ import type { AccountSupportCapabilities, AccountSupportLaneUnavailable } from "./capabilities.js";
3
+ /** Local transcriptions of owner contracts; portFit checks equality against the owners. */
4
+ export interface SubscriptionCommandContext {
5
+ actor: { kind: "customer" | "operator"; actorId: string; clientId: string };
6
+ subscriptionId: string; idempotencyKey: string; now: string;
7
+ }
8
+ export type SubscriptionCommand = SubscriptionCommandContext & (
9
+ | { action: "pause"; pausePreset: string; reason: string | null; survey: string | null; saveOffer: string | null }
10
+ | { action: "resume" | "skip" | "cancel"; reason: string | null; confirmedChargeTiming: boolean }
11
+ | { action: "slide"; newNextCycleAt: string; confirmedChargeTiming: boolean }
12
+ | { action: "edit_future_terms"; shippingAddressId: string; planDays: number; cadenceDays: number;
13
+ expectedTemplateVersion: number;
14
+ /** Empty string means no quote (semantic no-op). */
15
+ acceptedQuoteHash: string; confirmedChargeTiming: boolean;
16
+ coreLines: readonly SubscriptionBundleLine[]; addonLines: readonly SubscriptionBundleLine[];
17
+ compositionConstraint: string }
18
+ );
19
+ export interface SubscriptionBundleLine { sku: string; quantity: number }
20
+ export interface SubscriptionCommandReceipt {
21
+ actorId: string; idempotencyKey: string; commandFingerprint: string;
22
+ outcome: "applied" | "replayed" | "noop"; subscriptionId: string;
23
+ originalState: string; nextCycleAt: string | null; revision: string; eventId: string | null;
24
+ }
25
+ export interface SubscriptionCommandRefusal {
26
+ outcome: "refused";
27
+ /** Stable machine code; never provider, PostgreSQL diagnostic or customer text.
28
+ * Unrecognized native or host diagnostics map to subscription_command_invalid_input. */
29
+ reason:
30
+ | "multi_cycle_prepaid_unsupported"
31
+ | "subscription_command_addon_not_found"
32
+ | "subscription_command_bundle_total_mismatch"
33
+ | "subscription_command_charge_timing_not_confirmed"
34
+ | "subscription_command_idempotency_conflict"
35
+ | "subscription_command_invalid_composition_constraint"
36
+ | "subscription_command_invalid_input"
37
+ | "subscription_command_not_active"
38
+ | "subscription_command_operation_busy"
39
+ | "subscription_command_pause_forbidden"
40
+ | "subscription_command_payment_blocked"
41
+ | "subscription_command_preview_unsupported"
42
+ | "subscription_command_renewal_terms_missing"
43
+ | "subscription_command_unsupported_action"
44
+ | "subscription_edit_catalog_unavailable"
45
+ | "subscription_edit_invalid_lines"
46
+ | "subscription_edit_invalid_request"
47
+ | "subscription_edit_quote_expired"
48
+ | "subscription_edit_quote_required"
49
+ | "subscription_edit_stale_template"
50
+ | "subscription_edit_window_closed"
51
+ | "subscription_lifecycle_invalid_transition"
52
+ | "subscription_lifecycle_invalid_skip"
53
+ | "subscription_lifecycle_invalid_slide"
54
+ | "subscription_lifecycle_payment_blocked";
55
+ }
56
+ export type SubscriptionUnsupportedCode = "multi_cycle_prepaid_unsupported" | "native_generic_bundle_commands_unsupported" | "native_command_bound_receipts_unsupported" | "native_prepared_attempt_store_unsupported";
57
+ export interface SubscriptionUnsupported { supported: false; refusalCode: SubscriptionUnsupportedCode }
58
+ /** Readiness must be selected explicitly; a port declaration does not install a store. */
59
+ export interface SubscriptionCapabilities {
60
+ graph: "managed" | "native";
61
+ multiCyclePrepaid: { supported: false; refusalCode: "multi_cycle_prepaid_unsupported" };
62
+ genericBundleCommands: { supported: true } | { supported: false; refusalCode: "native_generic_bundle_commands_unsupported" };
63
+ commandBoundReceipts: { supported: true } | { supported: false; refusalCode: "native_command_bound_receipts_unsupported" };
64
+ preparedAttemptStore: { supported: true } | { supported: false; refusalCode: "native_prepared_attempt_store_unsupported" };
65
+ retryRecovery: "unavailable" | "selected";
66
+ stockRecovery: "unavailable" | "selected";
67
+ deliveryAdmission: "required";
68
+ executorCount: 1;
69
+ defaultEnabled: false;
70
+ }
71
+ /** Exact raw native owner command; its result still requires a host codec. */
72
+ export interface NativeSubscriptionCommand {
73
+ actorId: string; clientId: string; idempotencyKey: string; subscriptionId: string;
74
+ action: string; payload: Record<string, unknown>; now: string;
75
+ }
76
+
77
+ /** Driver DTOs are explicit type arguments, never a claim that all graphs implement them. */
78
+ export interface SelfServiceCommandFacade<ManagedRequest, ManagedPreviewRequest, ManagedPreview, ManagedReceipt,
79
+ ProfileRequest, ProfileResult, MethodRequest, MethodResult, CommerceRequest, CommerceResult, RecoveryRequest, RecoveryResult, ControlSnapshot = unknown> {
80
+ capabilities: AccountSupportCapabilities;
81
+ managedSubscription: {
82
+ previewAction(userId: string, request: ManagedPreviewRequest): Promise<ManagedPreview | null | AccountSupportLaneUnavailable<"host_binding_required">>;
83
+ applyAction(userId: string, request: ManagedRequest): Promise<ManagedReceipt | null | AccountSupportLaneUnavailable<"host_binding_required">>;
84
+ };
85
+ nativeLegacySubscription: {
86
+ previewAction(userId: string, request: ManagedPreviewRequest): Promise<ManagedPreview | null | AccountSupportLaneUnavailable<"host_binding_required">>;
87
+ applyAction(userId: string, request: ManagedRequest): Promise<ManagedReceipt | null | AccountSupportLaneUnavailable<"host_binding_required">>;
88
+ };
89
+ subscriptionControl: { getSnapshot(userId: string): Promise<ControlSnapshot | AccountSupportLaneUnavailable<"host_binding_required">> };
90
+ nativeRawSubscription: {
91
+ preview(command: NativeSubscriptionCommand): Promise<Record<string, unknown> | AccountSupportLaneUnavailable<"host_binding_required">>;
92
+ apply(command: NativeSubscriptionCommand): Promise<Record<string, unknown> | AccountSupportLaneUnavailable<"host_binding_required">>;
93
+ };
94
+ nativeSubscription: {
95
+ apply(command: SubscriptionCommand): Promise<SubscriptionCommandReceipt | SubscriptionCommandRefusal | SubscriptionUnsupported | AccountSupportLaneUnavailable<"host_binding_required">>;
96
+ preview(command: Extract<SubscriptionCommand, { action: "edit_future_terms" }>): Promise<Record<string, unknown> | SubscriptionCommandRefusal | AccountSupportLaneUnavailable<"host_binding_required">>;
97
+ };
98
+ profile: { updateProfile(userId: string, request: ProfileRequest): Promise<ProfileResult | null | AccountSupportLaneUnavailable<"host_binding_required">> };
99
+ paymentMethod: { execute(userId: string, request: MethodRequest): Promise<MethodResult | AccountSupportLaneUnavailable<"unsupported">> };
100
+ commerce: { execute(userId: string, request: CommerceRequest): Promise<CommerceResult | AccountSupportLaneUnavailable<"host_binding_required">> };
101
+ recovery: { startPaymentRecovery(userId: string, request: RecoveryRequest): Promise<RecoveryResult | null | AccountSupportLaneUnavailable<"host_binding_required">> };
102
+ }
103
+
104
+ export interface AccountSupportMoney { amountMinor: number; currency: string }
105
+ export type SubscriptionPaymentMethodStatus = "usable" | "expiring" | "missing" | "revoked" | "requires_action" | "invalid" | "provider_disabled";
106
+ export type SubscriptionRenewalBlockStatus = "blocked_preflight" | "payment_pending" | "dunning" | "paid_fulfillment_pending" | "fulfillment_blocked" | "catalog_blocked" | "customer_action_required";
107
+ export type EligibilityRefusal =
108
+ | "not_active"
109
+ | "edit_window_closed"
110
+ | "cycle_locked"
111
+ | "payment_blocked"
112
+ | "missing_payment_method"
113
+ | "invalid_address"
114
+ | null;
115
+
116
+ export interface LegacySubscriptionPreviewResponse {
117
+ preview: {
118
+ subscriptionId: string;
119
+ action: string;
120
+ canApply: boolean;
121
+ blockedReason: EligibilityRefusal;
122
+ nextCycleAt: string | null;
123
+ editCutoffAt: string | null;
124
+ templateVersion: number | null;
125
+ lockedCycle?: {
126
+ locked: boolean;
127
+ status: SubscriptionRenewalBlockStatus | null;
128
+ };
129
+ futureTemplate?: {
130
+ templateVersion: number | null;
131
+ effectiveCycleAt: string | null;
132
+ priceAgreementPolicy: "lock_until_edit";
133
+ };
134
+ paymentMethodStatus?: SubscriptionPaymentMethodStatus;
135
+ deliverability?: {
136
+ status: "address_book_validated" | "blocked" | "unknown";
137
+ blockedReason: EligibilityRefusal;
138
+ };
139
+ catalogAvailability?: {
140
+ status: "available" | "blocked" | "unknown";
141
+ blockedReason: EligibilityRefusal;
142
+ };
143
+ quoteHash?: string;
144
+ quoteExpiresAt?: string;
145
+ currentTotal?: AccountSupportMoney;
146
+ newTotal?: AccountSupportMoney;
147
+ delta?: AccountSupportMoney;
148
+ chargeTiming?: {
149
+ requiresConfirmation: boolean;
150
+ confirmed: boolean;
151
+ earliestChargeAt: string | null;
152
+ };
153
+ dateAvailability?: {
154
+ earliestAllowedAt: string;
155
+ latestAllowedAt: string;
156
+ availableDates: string[];
157
+ blockedReason: EligibilityRefusal;
158
+ };
159
+ packageEdit?: {
160
+ currentRecurringPrice: AccountSupportMoney;
161
+ newRecurringPrice: AccountSupportMoney;
162
+ delta: AccountSupportMoney;
163
+ quoteHash: string;
164
+ effectiveCycleAt: string | null;
165
+ priceAgreementPolicy: "lock_until_edit";
166
+ };
167
+ };
168
+ }
169
+
170
+
171
+ /** Already resolved host request. The codec never supplies policy or catalogue fields. */
172
+ export interface LegacySubscriptionRequest<Action extends string = string, Payload extends Record<string, unknown> = Record<string, unknown>> {
173
+ subscriptionId: string;
174
+ idempotencyKey: string;
175
+ action: Action;
176
+ payload: Payload;
177
+ }
178
+ export interface RawSubscriptionCommands {
179
+ preview(command: NativeSubscriptionCommand): Promise<Record<string, unknown>>;
180
+ apply(command: NativeSubscriptionCommand): Promise<Record<string, unknown>>;
181
+ }
182
+ /** Only checked native quote records reach a host projection. */
183
+ export interface NativeSubscriptionPreview extends Record<string, unknown> {
184
+ status: "previewed";
185
+ canApply: true;
186
+ templateVersion: number;
187
+ quoteHash: string;
188
+ quoteExpiresAt: string;
189
+ currentTotalMinor: number;
190
+ newTotalMinor: number;
191
+ lines: { variantId: string; quantity: number; isAddon: boolean; sortOrder: number; unitPriceMinor: number; currency: string }[];
192
+ priceAgreementPolicy: { kind: "lock_until_edit"; proration: "none"; cycleEffect: "future_unlocked_cycles_only" };
193
+ }
194
+ export type NativePreviewProjection<Preview> =
195
+ | { kind: "projected"; preview: Preview }
196
+ | { kind: "owner"; result: Record<string, unknown> };
197
+ export interface SubscriptionDriver<Request, Preview, Receipt> {
198
+ preview(context: CustomerContext, request: Request): Promise<Preview>;
199
+ apply(context: CustomerContext, request: Request): Promise<Receipt>;
200
+ }
201
+ /** Browser-safe transcription of M07 collection; instantiate with its branded handoff. */
202
+ export interface MethodSetupInput {
203
+ customer: string;
204
+ metadata: Record<string, string>;
205
+ idempotencyKey: string;
206
+ }
207
+ export type MethodSetupResult<Handoff> =
208
+ | { kind: "ready"; setupRef: string; handoff: Handoff; replayed: boolean }
209
+ | { kind: "unsupported" };
210
+ export interface MethodSetupPort<Handoff> {
211
+ setupMethod(input: MethodSetupInput): Promise<MethodSetupResult<Handoff>>;
212
+ }
213
+ /** Host parts retain repricing, quote validation, authorization and error construction. */
214
+ export interface NativeLegacySubscriptionParts<Request, PreviewRequest, Preview, Receipt, ControlSnapshot = unknown> {
215
+ explicitPause: { applyAction(userId: string, request: Request): Promise<Receipt | null> };
216
+ control: LegacySubscriptionPort<Request, PreviewRequest, Preview, Receipt> & {
217
+ hasSubscription(userId: string, subscriptionId: string): Promise<boolean>;
218
+ getSnapshot(userId: string): Promise<ControlSnapshot>;
219
+ };
220
+ ownershipRefusal(): unknown;
221
+ }
222
+ export interface LegacySubscriptionPort<Request, PreviewRequest, Preview, Receipt> {
223
+ previewAction(userId: string, request: PreviewRequest): Promise<Preview | null>;
224
+ applyAction(userId: string, request: Request): Promise<Receipt | null>;
225
+ }
226
+ /** The host supplies capabilities and explicitly selects each owner lane. */
227
+ export type SelfServiceCommandFacadeInput<Request, PreviewRequest, Preview, Receipt,
228
+ ProfileRequest, ProfileResult, MethodRequest, MethodResult, CommerceRequest, CommerceResult, RecoveryRequest, RecoveryResult, ControlSnapshot = unknown> =
229
+ {
230
+ context: CustomerContext;
231
+ capabilities: AccountSupportCapabilities;
232
+ managedSubscription?: LegacySubscriptionPort<Request, PreviewRequest, Preview, Receipt>;
233
+ nativeLegacySubscription?: NativeLegacySubscriptionParts<Request, PreviewRequest, Preview, Receipt, ControlSnapshot>;
234
+ nativeRawSubscription?: RawSubscriptionCommands;
235
+ nativeSubscription?: {
236
+ apply(command: SubscriptionCommand): Promise<SubscriptionCommandReceipt | SubscriptionCommandRefusal | SubscriptionUnsupported>;
237
+ preview(command: Extract<SubscriptionCommand, { action: "edit_future_terms" }>): Promise<Record<string, unknown> | SubscriptionCommandRefusal>;
238
+ };
239
+ profile?: { updateProfile(userId: string, request: ProfileRequest): Promise<ProfileResult | null> };
240
+ paymentMethod?: { execute(userId: string, request: MethodRequest): Promise<MethodResult> };
241
+ commerce?: { execute(userId: string, request: CommerceRequest): Promise<CommerceResult> };
242
+ recovery?: { startPaymentRecovery(userId: string, request: RecoveryRequest): Promise<RecoveryResult | null> };
243
+ };