@openlup/platform 0.17.0 → 0.18.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 +96 -0
- package/README.md +284 -6
- package/dist/catalog/activeSkuSelection.d.ts +2 -0
- package/dist/catalog/activeSkuSelection.js +20 -0
- package/dist/catalog/adminBindings.d.ts +72 -0
- package/dist/catalog/adminBindings.js +1 -0
- package/dist/catalog/adminBundleHandler.d.ts +26 -0
- package/dist/catalog/adminBundleHandler.js +111 -0
- package/dist/catalog/adminBundleReadHandler.d.ts +20 -0
- package/dist/catalog/adminBundleReadHandler.js +185 -0
- package/dist/catalog/adminBundleWritePort.d.ts +85 -0
- package/dist/catalog/adminBundleWritePort.js +1 -0
- package/dist/catalog/bundleAvailability.d.ts +63 -0
- package/dist/catalog/bundleAvailability.js +78 -0
- package/dist/catalog/bundleAvailabilityService.d.ts +65 -0
- package/dist/catalog/bundleAvailabilityService.js +89 -0
- package/dist/catalog/bundleBindings.d.ts +33 -0
- package/dist/catalog/bundleBindings.js +1 -0
- package/dist/catalog/bundleCatalogQueries.d.ts +28 -0
- package/dist/catalog/bundleCatalogQueries.js +84 -0
- package/dist/catalog/bundleCatalogReadPort.d.ts +166 -0
- package/dist/catalog/bundleCatalogReadPort.js +36 -0
- package/dist/catalog/bundleCatalogStore.d.ts +3 -0
- package/dist/catalog/bundleCatalogStore.js +152 -0
- package/dist/catalog/bundleRuleCodes.d.ts +41 -0
- package/dist/catalog/bundleRuleCodes.js +110 -0
- package/dist/catalog/bundleRules.d.ts +69 -0
- package/dist/catalog/bundleRules.js +102 -0
- package/dist/catalog/catalogDraftStore.d.ts +4 -0
- package/dist/catalog/catalogDraftStore.js +63 -0
- package/dist/catalog/catalogSkuEnvelope.d.ts +7 -0
- package/dist/catalog/catalogSkuEnvelope.js +142 -0
- package/dist/catalog/catalogSkuEnvelopeMapper.d.ts +38 -0
- package/dist/catalog/catalogSkuEnvelopeMapper.js +88 -0
- package/dist/catalog/contracts/bundleAdmin.d.ts +143 -0
- package/dist/catalog/contracts/bundleAdmin.js +1 -0
- package/dist/catalog/contracts/bundleAvailability.d.ts +61 -0
- package/dist/catalog/contracts/bundleAvailability.js +1 -0
- package/dist/catalog/contracts/bundleRead.d.ts +223 -0
- package/dist/catalog/contracts/bundleRead.js +1 -0
- package/dist/catalog/contracts/draft.d.ts +79 -0
- package/dist/catalog/contracts/draft.js +47 -0
- package/dist/catalog/contracts/foundation.d.ts +78 -0
- package/dist/catalog/contracts/foundation.js +53 -0
- package/dist/catalog/contracts/index.d.ts +14 -0
- package/dist/catalog/contracts/index.js +6 -0
- package/dist/catalog/contracts/lifecycle.d.ts +77 -0
- package/dist/catalog/contracts/lifecycle.js +1 -0
- package/dist/catalog/contracts/productMediaContracts.d.ts +77 -0
- package/dist/catalog/contracts/productMediaContracts.js +149 -0
- package/dist/catalog/contracts/productTypes.d.ts +54 -0
- package/dist/catalog/contracts/productTypes.js +16 -0
- package/dist/catalog/contracts/resolveProductMedia.d.ts +3 -0
- package/dist/catalog/contracts/resolveProductMedia.js +78 -0
- package/dist/catalog/contracts/sellable.d.ts +23 -0
- package/dist/catalog/contracts/sellable.js +1 -0
- package/dist/catalog/draftHandler.d.ts +25 -0
- package/dist/catalog/draftHandler.js +118 -0
- package/dist/catalog/draftPorts.d.ts +18 -0
- package/dist/catalog/draftPorts.js +8 -0
- package/dist/catalog/draftSchemas.d.ts +423 -0
- package/dist/catalog/draftSchemas.js +89 -0
- package/dist/catalog/draftValidation.d.ts +21 -0
- package/dist/catalog/draftValidation.js +125 -0
- package/dist/catalog/foundationSchemas.d.ts +98 -0
- package/dist/catalog/foundationSchemas.js +110 -0
- package/dist/catalog/index.d.ts +43 -0
- package/dist/catalog/index.js +25 -0
- package/dist/catalog/mediaSourcePack.d.ts +51 -0
- package/dist/catalog/mediaSourcePack.js +247 -0
- package/dist/catalog/productTypeSchemas.d.ts +46 -0
- package/dist/catalog/productTypeSchemas.js +72 -0
- package/dist/catalog/publicationPorts.d.ts +42 -0
- package/dist/catalog/publicationPorts.js +1 -0
- package/dist/catalog/readPorts.d.ts +51 -0
- package/dist/catalog/readPorts.js +1 -0
- package/dist/catalog/referenceCatalogHandler.d.ts +7 -0
- package/dist/catalog/referenceCatalogHandler.js +27 -0
- package/dist/catalog/resolvedSkuProjection.d.ts +88 -0
- package/dist/catalog/resolvedSkuProjection.js +60 -0
- package/dist/catalog/sellableBundleHandler.d.ts +46 -0
- package/dist/catalog/sellableBundleHandler.js +84 -0
- package/dist/catalog/sellableSchemas.d.ts +46 -0
- package/dist/catalog/sellableSchemas.js +27 -0
- package/dist/catalog/sql.d.ts +46 -0
- package/dist/catalog/sql.js +13 -0
- package/dist/catalog/validation.d.ts +2 -0
- package/dist/catalog/validation.js +3 -0
- package/dist/communications/contracts/index.d.ts +1 -0
- package/dist/communications/contracts/marketingSync.d.ts +194 -0
- package/dist/communications/contracts/marketingSync.js +1 -0
- package/dist/communications/index.d.ts +1 -0
- package/dist/communications/klaviyo/consentPush.d.ts +51 -0
- package/dist/communications/klaviyo/consentPush.js +19 -0
- package/dist/communications/klaviyo/index.d.ts +110 -0
- package/dist/communications/klaviyo/index.js +860 -0
- package/dist/communications/newsletterIntegrationContracts.d.ts +3 -3
- package/dist/communications/resend/index.d.ts +40 -0
- package/dist/communications/resend/index.js +310 -0
- package/dist/composition/catalogContribution.d.ts +18 -0
- package/dist/composition/catalogContribution.js +21 -0
- package/dist/composition/index.d.ts +1 -0
- package/dist/composition/index.js +1 -0
- package/dist/identity/customerContracts.d.ts +2 -2
- package/dist/inventory/adminInventory.d.ts +13 -0
- package/dist/inventory/adminInventory.js +214 -0
- package/dist/inventory/contracts/forecast.d.ts +86 -0
- package/dist/inventory/contracts/forecast.js +1 -0
- package/dist/inventory/contracts/index.d.ts +4 -0
- package/dist/inventory/contracts/index.js +1 -0
- package/dist/inventory/contracts/inventory.d.ts +157 -0
- package/dist/inventory/contracts/inventory.js +1 -0
- package/dist/inventory/contracts/newPurchaseStock.d.ts +20 -0
- package/dist/inventory/contracts/newPurchaseStock.js +1 -0
- package/dist/inventory/contracts/reservation.d.ts +18 -0
- package/dist/inventory/contracts/reservation.js +1 -0
- package/dist/inventory/forecast.d.ts +24 -0
- package/dist/inventory/forecast.js +200 -0
- package/dist/inventory/index.d.ts +13 -0
- package/dist/inventory/index.js +10 -0
- package/dist/inventory/inventoryHandlers.d.ts +53 -0
- package/dist/inventory/inventoryHandlers.js +151 -0
- package/dist/inventory/newPurchaseStockAvailability.d.ts +47 -0
- package/dist/inventory/newPurchaseStockAvailability.js +75 -0
- package/dist/inventory/ports.d.ts +21 -0
- package/dist/inventory/ports.js +16 -0
- package/dist/inventory/renewalReservation.d.ts +27 -0
- package/dist/inventory/renewalReservation.js +61 -0
- package/dist/inventory/reservationPolicy.d.ts +6 -0
- package/dist/inventory/reservationPolicy.js +19 -0
- package/dist/inventory/schemas.d.ts +137 -0
- package/dist/inventory/schemas.js +112 -0
- package/dist/inventory/sql.d.ts +14 -0
- package/dist/inventory/sql.js +5 -0
- package/dist/inventory/subscriptionForecastCalculation.d.ts +4 -0
- package/dist/inventory/subscriptionForecastCalculation.js +133 -0
- package/dist/pricing/acquisitionFinancialPolicy.d.ts +26 -0
- package/dist/pricing/acquisitionFinancialPolicy.js +1 -0
- package/dist/pricing/acquisitionOfferPricing.d.ts +27 -0
- package/dist/pricing/acquisitionOfferPricing.js +25 -0
- package/dist/pricing/acquisitionOfferPricingHandler.d.ts +20 -0
- package/dist/pricing/acquisitionOfferPricingHandler.js +105 -0
- package/dist/pricing/acquisitionOfferPricingSchemas.d.ts +31 -0
- package/dist/pricing/acquisitionOfferPricingSchemas.js +33 -0
- package/dist/pricing/acquisitionQuoteBinding.d.ts +12 -0
- package/dist/pricing/acquisitionQuoteBinding.js +12 -0
- package/dist/pricing/acquisitionReadiness.d.ts +31 -0
- package/dist/pricing/acquisitionReadiness.js +117 -0
- package/dist/pricing/acquisitionTerms.d.ts +19 -0
- package/dist/pricing/acquisitionTerms.js +126 -0
- package/dist/pricing/acquisitionTermsSchemas.d.ts +59 -0
- package/dist/pricing/acquisitionTermsSchemas.js +42 -0
- package/dist/pricing/catalogFactsProvenance.d.ts +33 -0
- package/dist/pricing/catalogFactsProvenance.js +64 -0
- package/dist/pricing/catalogFactsSchemas.d.ts +45 -0
- package/dist/pricing/catalogFactsSchemas.js +58 -0
- package/dist/pricing/commerceOfferPricing.d.ts +25 -0
- package/dist/pricing/commerceOfferPricing.js +139 -0
- package/dist/pricing/commerceOfferPricingCache.d.ts +10 -0
- package/dist/pricing/commerceOfferPricingCache.js +44 -0
- package/dist/pricing/commerceOfferPricingHandler.d.ts +21 -0
- package/dist/pricing/commerceOfferPricingHandler.js +78 -0
- package/dist/pricing/commercePriceAuthority.d.ts +26 -0
- package/dist/pricing/commercePriceAuthority.js +79 -0
- package/dist/pricing/commercePricingPolicyErrors.d.ts +40 -0
- package/dist/pricing/commercePricingPolicyErrors.js +67 -0
- package/dist/pricing/commerceQuoteBatchHandler.d.ts +37 -0
- package/dist/pricing/commerceQuoteBatchHandler.js +83 -0
- package/dist/pricing/commerceQuoteCatalogReadPort.d.ts +27 -0
- package/dist/pricing/commerceQuoteCatalogReadPort.js +8 -0
- package/dist/pricing/commerceQuoteHandler.d.ts +31 -0
- package/dist/pricing/commerceQuoteHandler.js +110 -0
- package/dist/pricing/commerceQuoteSnapshotExpect.d.ts +9 -0
- package/dist/pricing/commerceQuoteSnapshotExpect.js +22 -0
- package/dist/pricing/contracts/acquisitionTerms.d.ts +32 -0
- package/dist/pricing/contracts/acquisitionTerms.js +2 -0
- package/dist/pricing/contracts/authority.d.ts +27 -0
- package/dist/pricing/contracts/authority.js +1 -0
- package/dist/pricing/contracts/evidence.d.ts +33 -0
- package/dist/pricing/contracts/evidence.js +1 -0
- package/dist/pricing/contracts/index.d.ts +17 -0
- package/dist/pricing/contracts/index.js +7 -0
- package/dist/pricing/contracts/money.d.ts +27 -0
- package/dist/pricing/contracts/money.js +1 -0
- package/dist/pricing/contracts/offer.d.ts +52 -0
- package/dist/pricing/contracts/offer.js +4 -0
- package/dist/pricing/contracts/offerPolicy.d.ts +16 -0
- package/dist/pricing/contracts/offerPolicy.js +5 -0
- package/dist/pricing/contracts/policy.d.ts +22 -0
- package/dist/pricing/contracts/policy.js +3 -0
- package/dist/pricing/contracts/provenance.d.ts +24 -0
- package/dist/pricing/contracts/provenance.js +2 -0
- package/dist/pricing/contracts/quote.d.ts +94 -0
- package/dist/pricing/contracts/quote.js +1 -0
- package/dist/pricing/dbBackedCommerceQuoteHelpers.d.ts +78 -0
- package/dist/pricing/dbBackedCommerceQuoteHelpers.js +146 -0
- package/dist/pricing/dbBackedCommerceQuotePort.d.ts +66 -0
- package/dist/pricing/dbBackedCommerceQuotePort.js +206 -0
- package/dist/pricing/dbBackedCommerceQuoteSnapshotVerifier.d.ts +4 -0
- package/dist/pricing/dbBackedCommerceQuoteSnapshotVerifier.js +25 -0
- package/dist/pricing/index.d.ts +51 -0
- package/dist/pricing/index.js +36 -0
- package/dist/pricing/offerPolicyReadiness.d.ts +21 -0
- package/dist/pricing/offerPolicyReadiness.js +79 -0
- package/dist/pricing/offerPolicySchemas.d.ts +25 -0
- package/dist/pricing/offerPolicySchemas.js +15 -0
- package/dist/pricing/offerPricingSchemas.d.ts +315 -0
- package/dist/pricing/offerPricingSchemas.js +65 -0
- package/dist/pricing/ports.d.ts +13 -0
- package/dist/pricing/ports.js +9 -0
- package/dist/pricing/pricingPolicyToken.d.ts +39 -0
- package/dist/pricing/pricingPolicyToken.js +84 -0
- package/dist/pricing/quoteAcquisitionTerms.d.ts +2 -0
- package/dist/pricing/quoteAcquisitionTerms.js +4 -0
- package/dist/pricing/quoteCodeRejectionDetails.d.ts +20 -0
- package/dist/pricing/quoteCodeRejectionDetails.js +22 -0
- package/dist/pricing/quotePorts.d.ts +30 -0
- package/dist/pricing/quotePorts.js +20 -0
- package/dist/pricing/quotePrimitives.d.ts +13 -0
- package/dist/pricing/quotePrimitives.js +18 -0
- package/dist/pricing/quotePromotionEvidence.d.ts +39 -0
- package/dist/pricing/quotePromotionEvidence.js +73 -0
- package/dist/pricing/quoteSchemas.d.ts +1176 -0
- package/dist/pricing/quoteSchemas.js +196 -0
- package/dist/pricing/subscriptionPricePolicy.d.ts +52 -0
- package/dist/pricing/subscriptionPricePolicy.js +96 -0
- package/dist/pricing/taxProfileGuard.d.ts +2 -0
- package/dist/pricing/taxProfileGuard.js +24 -0
- package/dist/pricing/validation.d.ts +2 -0
- package/dist/pricing/validation.js +3 -0
- package/dist/promotions/adminBindings.d.ts +72 -0
- package/dist/promotions/adminBindings.js +1 -0
- package/dist/promotions/adminPromotionCodesContracts.d.ts +498 -0
- package/dist/promotions/adminPromotionCodesContracts.js +211 -0
- package/dist/promotions/adminPromotionCodesDataPort.d.ts +47 -0
- package/dist/promotions/adminPromotionCodesDataPort.js +1 -0
- package/dist/promotions/adminPromotionCodesHandler.d.ts +14 -0
- package/dist/promotions/adminPromotionCodesHandler.js +194 -0
- package/dist/promotions/adminPromotionsContracts.d.ts +235 -0
- package/dist/promotions/adminPromotionsContracts.js +99 -0
- package/dist/promotions/adminPromotionsDataPort.d.ts +42 -0
- package/dist/promotions/adminPromotionsDataPort.js +1 -0
- package/dist/promotions/adminPromotionsHandler.d.ts +16 -0
- package/dist/promotions/adminPromotionsHandler.js +47 -0
- package/dist/promotions/contracts/index.d.ts +387 -0
- package/dist/promotions/contracts/index.js +1 -0
- package/dist/promotions/index.d.ts +22 -0
- package/dist/promotions/index.js +21 -0
- package/dist/promotions/promoDataPort.d.ts +47 -0
- package/dist/promotions/promoDataPort.js +14 -0
- package/dist/promotions/promotionAcceptanceTelemetry.d.ts +29 -0
- package/dist/promotions/promotionAcceptanceTelemetry.js +45 -0
- package/dist/promotions/promotionBenefitDefinition.d.ts +37 -0
- package/dist/promotions/promotionBenefitDefinition.js +33 -0
- package/dist/promotions/promotionClaimSweepPort.d.ts +14 -0
- package/dist/promotions/promotionClaimSweepPort.js +8 -0
- package/dist/promotions/promotionClaims.d.ts +5 -0
- package/dist/promotions/promotionClaims.js +57 -0
- package/dist/promotions/promotionCodePreview.d.ts +11 -0
- package/dist/promotions/promotionCodePreview.js +154 -0
- package/dist/promotions/promotionCodeQuotePort.d.ts +25 -0
- package/dist/promotions/promotionCodeQuotePort.js +1 -0
- package/dist/promotions/promotionQuoteAcceptance.d.ts +65 -0
- package/dist/promotions/promotionQuoteAcceptance.js +202 -0
- package/dist/promotions/promotionQuoteBinding.d.ts +71 -0
- package/dist/promotions/promotionQuoteBinding.js +85 -0
- package/dist/promotions/quoteAutomaticPromotions.d.ts +24 -0
- package/dist/promotions/quoteAutomaticPromotions.js +36 -0
- package/dist/promotions/quotePromoDiscounts.d.ts +32 -0
- package/dist/promotions/quotePromoDiscounts.js +140 -0
- package/dist/promotions/quotePromotionCodeAdjustments.d.ts +27 -0
- package/dist/promotions/quotePromotionCodeAdjustments.js +223 -0
- package/dist/promotions/quotePromotionV2.d.ts +29 -0
- package/dist/promotions/quotePromotionV2.js +174 -0
- package/dist/promotions/sql.d.ts +14 -0
- package/dist/promotions/sql.js +5 -0
- package/dist/promotions/validation.d.ts +2 -0
- package/dist/promotions/validation.js +3 -0
- package/dist/shipping/addressCanonLookupHandler.d.ts +7 -0
- package/dist/shipping/addressCanonLookupHandler.js +105 -0
- package/dist/shipping/addressCanonical.d.ts +2 -0
- package/dist/shipping/addressCanonical.js +26 -0
- package/dist/shipping/addressPorts.d.ts +39 -0
- package/dist/shipping/addressPorts.js +1 -0
- package/dist/shipping/addressSchemas.d.ts +30 -0
- package/dist/shipping/addressSchemas.js +1 -0
- package/dist/shipping/adminShippingRateHandler.d.ts +4 -0
- package/dist/shipping/adminShippingRateHandler.js +64 -0
- package/dist/shipping/contracts/address.d.ts +144 -0
- package/dist/shipping/contracts/address.js +1 -0
- package/dist/shipping/contracts/delivery.d.ts +110 -0
- package/dist/shipping/contracts/delivery.js +1 -0
- package/dist/shipping/contracts/index.d.ts +3 -0
- package/dist/shipping/contracts/index.js +1 -0
- package/dist/shipping/contracts/shippingRate.d.ts +11 -0
- package/dist/shipping/contracts/shippingRate.js +1 -0
- package/dist/shipping/customerAddressesHandler.d.ts +5 -0
- package/dist/shipping/customerAddressesHandler.js +80 -0
- package/dist/shipping/customerSelfServiceAddressModels.d.ts +27 -0
- package/dist/shipping/customerSelfServiceAddressModels.js +101 -0
- package/dist/shipping/deliverySelectionHandler.d.ts +10 -0
- package/dist/shipping/deliverySelectionHandler.js +77 -0
- package/dist/shipping/deliverySelectionPort.d.ts +8 -0
- package/dist/shipping/deliverySelectionPort.js +1 -0
- package/dist/shipping/deliverySelectionSummary.d.ts +2 -0
- package/dist/shipping/deliverySelectionSummary.js +53 -0
- package/dist/shipping/handlerSchemas.d.ts +21 -0
- package/dist/shipping/handlerSchemas.js +1 -0
- package/dist/shipping/index.d.ts +17 -0
- package/dist/shipping/index.js +8 -0
- package/dist/shipping/pickupPointSearchPort.d.ts +4 -0
- package/dist/shipping/pickupPointSearchPort.js +1 -0
- package/dist/shipping/readDeliverySelectionEvidence.d.ts +2 -0
- package/dist/shipping/readDeliverySelectionEvidence.js +44 -0
- package/dist/shipping/shippingRatePorts.d.ts +52 -0
- package/dist/shipping/shippingRatePorts.js +1 -0
- package/package.json +62 -2
- package/release-gates.json +218 -10
- package/sql/20260807140000_read_parity_catalog.sql +94 -0
- package/sql/20260810120000_storefront_catalog_attributes.sql +51 -0
- package/sql/20260812140000_sellable_bundle_catalog.sql +124 -0
- package/sql/20260812210000_bundle_operator_write_boundary.sql +567 -0
- package/sql/20260814000000_fulfillment_stock_evidence.sql +239 -0
- package/sql/20260815120000_automatic_subscription_renewal.sql +1083 -0
- package/sql/20260817180000_promotion_claim_lifecycle.sql +591 -0
- package/sql/20260817180100_promotion_claim_lifecycle_validation.sql +23 -0
- package/sql/20260827220000_catalog_document_revision_foundation.sql +226 -0
- package/sql/20260827220001_catalog_document_revision_foundation_validate.sql +10 -0
- package/sql/20260908100000_catalog_draft_foundation.sql +217 -0
- package/src/catalog/activeSkuSelection.ts +20 -0
- package/src/catalog/adminBindings.ts +59 -0
- package/src/catalog/adminBundleHandler.ts +165 -0
- package/src/catalog/adminBundleReadHandler.ts +261 -0
- package/src/catalog/adminBundleWritePort.ts +102 -0
- package/src/catalog/bundleAvailability.ts +129 -0
- package/src/catalog/bundleAvailabilityService.ts +171 -0
- package/src/catalog/bundleBindings.ts +29 -0
- package/src/catalog/bundleCatalogQueries.ts +98 -0
- package/src/catalog/bundleCatalogReadPort.ts +177 -0
- package/src/catalog/bundleCatalogStore.ts +269 -0
- package/src/catalog/bundleRuleCodes.ts +134 -0
- package/src/catalog/bundleRules.ts +153 -0
- package/src/catalog/catalogDraftStore.ts +71 -0
- package/src/catalog/catalogSkuEnvelope.ts +214 -0
- package/src/catalog/catalogSkuEnvelopeMapper.ts +160 -0
- package/src/catalog/contracts/bundleAdmin.ts +20 -0
- package/src/catalog/contracts/bundleAvailability.ts +5 -0
- package/src/catalog/contracts/bundleRead.ts +13 -0
- package/src/catalog/contracts/draft.ts +69 -0
- package/src/catalog/contracts/foundation.ts +104 -0
- package/src/catalog/contracts/index.ts +14 -0
- package/src/catalog/contracts/lifecycle.ts +74 -0
- package/src/catalog/contracts/productMediaContracts.ts +170 -0
- package/src/catalog/contracts/productTypes.ts +35 -0
- package/src/catalog/contracts/resolveProductMedia.ts +85 -0
- package/src/catalog/contracts/sellable.ts +12 -0
- package/src/catalog/draftHandler.ts +105 -0
- package/src/catalog/draftPorts.ts +18 -0
- package/src/catalog/draftSchemas.ts +88 -0
- package/src/catalog/draftValidation.ts +100 -0
- package/src/catalog/foundationSchemas.ts +123 -0
- package/src/catalog/index.ts +43 -0
- package/src/catalog/mediaSourcePack.ts +219 -0
- package/src/catalog/productTypeSchemas.ts +70 -0
- package/src/catalog/publicationPorts.ts +44 -0
- package/src/catalog/readPorts.ts +61 -0
- package/src/catalog/referenceCatalogHandler.ts +39 -0
- package/src/catalog/resolvedSkuProjection.ts +76 -0
- package/src/catalog/sellableBundleHandler.ts +133 -0
- package/src/catalog/sellableSchemas.ts +33 -0
- package/src/catalog/sql.ts +14 -0
- package/src/catalog/validation.ts +3 -0
- package/src/communications/contracts/index.ts +1 -0
- package/src/communications/contracts/marketingSync.ts +109 -0
- package/src/communications/index.ts +1 -0
- package/src/communications/klaviyo/consentPush.ts +19 -0
- package/src/communications/klaviyo/index.ts +649 -0
- package/src/communications/resend/index.ts +350 -0
- package/src/composition/catalogContribution.ts +32 -0
- package/src/composition/index.ts +1 -0
- package/src/inventory/adminInventory.ts +251 -0
- package/src/inventory/contracts/forecast.ts +96 -0
- package/src/inventory/contracts/index.ts +18 -0
- package/src/inventory/contracts/inventory.ts +14 -0
- package/src/inventory/contracts/newPurchaseStock.ts +23 -0
- package/src/inventory/contracts/reservation.ts +20 -0
- package/src/inventory/forecast.ts +239 -0
- package/src/inventory/index.ts +21 -0
- package/src/inventory/inventoryHandlers.ts +215 -0
- package/src/inventory/newPurchaseStockAvailability.ts +120 -0
- package/src/inventory/ports.ts +46 -0
- package/src/inventory/renewalReservation.ts +88 -0
- package/src/inventory/reservationPolicy.ts +27 -0
- package/src/inventory/schemas.ts +128 -0
- package/src/inventory/sql.ts +5 -0
- package/src/inventory/subscriptionForecastCalculation.ts +157 -0
- package/src/pricing/acquisitionFinancialPolicy.ts +26 -0
- package/src/pricing/acquisitionOfferPricing.ts +38 -0
- package/src/pricing/acquisitionOfferPricingHandler.ts +157 -0
- package/src/pricing/acquisitionOfferPricingSchemas.ts +35 -0
- package/src/pricing/acquisitionQuoteBinding.ts +12 -0
- package/src/pricing/acquisitionReadiness.ts +148 -0
- package/src/pricing/acquisitionTerms.ts +125 -0
- package/src/pricing/acquisitionTermsSchemas.ts +52 -0
- package/src/pricing/catalogFactsProvenance.ts +102 -0
- package/src/pricing/catalogFactsSchemas.ts +69 -0
- package/src/pricing/commerceOfferPricing.ts +224 -0
- package/src/pricing/commerceOfferPricingCache.ts +53 -0
- package/src/pricing/commerceOfferPricingHandler.ts +137 -0
- package/src/pricing/commercePriceAuthority.ts +104 -0
- package/src/pricing/commercePricingPolicyErrors.ts +88 -0
- package/src/pricing/commerceQuoteBatchHandler.ts +129 -0
- package/src/pricing/commerceQuoteCatalogReadPort.ts +42 -0
- package/src/pricing/commerceQuoteHandler.ts +184 -0
- package/src/pricing/commerceQuoteSnapshotExpect.ts +48 -0
- package/src/pricing/contracts/acquisitionTerms.ts +26 -0
- package/src/pricing/contracts/authority.ts +44 -0
- package/src/pricing/contracts/evidence.ts +25 -0
- package/src/pricing/contracts/index.ts +17 -0
- package/src/pricing/contracts/money.ts +32 -0
- package/src/pricing/contracts/offer.ts +42 -0
- package/src/pricing/contracts/offerPolicy.ts +17 -0
- package/src/pricing/contracts/policy.ts +26 -0
- package/src/pricing/contracts/provenance.ts +19 -0
- package/src/pricing/contracts/quote.ts +106 -0
- package/src/pricing/dbBackedCommerceQuoteHelpers.ts +256 -0
- package/src/pricing/dbBackedCommerceQuotePort.ts +260 -0
- package/src/pricing/dbBackedCommerceQuoteSnapshotVerifier.ts +49 -0
- package/src/pricing/index.ts +52 -0
- package/src/pricing/offerPolicyReadiness.ts +110 -0
- package/src/pricing/offerPolicySchemas.ts +23 -0
- package/src/pricing/offerPricingSchemas.ts +92 -0
- package/src/pricing/ports.ts +17 -0
- package/src/pricing/pricingPolicyToken.ts +119 -0
- package/src/pricing/quoteAcquisitionTerms.ts +10 -0
- package/src/pricing/quoteCodeRejectionDetails.ts +23 -0
- package/src/pricing/quotePorts.ts +58 -0
- package/src/pricing/quotePrimitives.ts +21 -0
- package/src/pricing/quotePromotionEvidence.ts +82 -0
- package/src/pricing/quoteSchemas.ts +230 -0
- package/src/pricing/subscriptionPricePolicy.ts +113 -0
- package/src/pricing/taxProfileGuard.ts +33 -0
- package/src/pricing/validation.ts +3 -0
- package/src/promotions/adminBindings.ts +53 -0
- package/src/promotions/adminPromotionCodesContracts.ts +244 -0
- package/src/promotions/adminPromotionCodesDataPort.ts +56 -0
- package/src/promotions/adminPromotionCodesHandler.ts +254 -0
- package/src/promotions/adminPromotionsContracts.ts +121 -0
- package/src/promotions/adminPromotionsDataPort.ts +48 -0
- package/src/promotions/adminPromotionsHandler.ts +72 -0
- package/src/promotions/contracts/index.ts +387 -0
- package/src/promotions/index.ts +22 -0
- package/src/promotions/promoDataPort.ts +65 -0
- package/src/promotions/promotionAcceptanceTelemetry.ts +73 -0
- package/src/promotions/promotionBenefitDefinition.ts +48 -0
- package/src/promotions/promotionClaimSweepPort.ts +23 -0
- package/src/promotions/promotionClaims.ts +70 -0
- package/src/promotions/promotionCodePreview.ts +183 -0
- package/src/promotions/promotionCodeQuotePort.ts +35 -0
- package/src/promotions/promotionQuoteAcceptance.ts +284 -0
- package/src/promotions/promotionQuoteBinding.ts +158 -0
- package/src/promotions/quoteAutomaticPromotions.ts +58 -0
- package/src/promotions/quotePromoDiscounts.ts +185 -0
- package/src/promotions/quotePromotionCodeAdjustments.ts +277 -0
- package/src/promotions/quotePromotionV2.ts +223 -0
- package/src/promotions/sql.ts +5 -0
- package/src/promotions/validation.ts +3 -0
- package/src/shipping/addressCanonLookupHandler.ts +114 -0
- package/src/shipping/addressCanonical.ts +31 -0
- package/src/shipping/addressPorts.ts +48 -0
- package/src/shipping/addressSchemas.ts +28 -0
- package/src/shipping/adminShippingRateHandler.ts +72 -0
- package/src/shipping/contracts/address.ts +71 -0
- package/src/shipping/contracts/delivery.ts +114 -0
- package/src/shipping/contracts/index.ts +18 -0
- package/src/shipping/contracts/shippingRate.ts +7 -0
- package/src/shipping/customerAddressesHandler.ts +100 -0
- package/src/shipping/customerSelfServiceAddressModels.ts +124 -0
- package/src/shipping/deliverySelectionHandler.ts +94 -0
- package/src/shipping/deliverySelectionPort.ts +10 -0
- package/src/shipping/deliverySelectionSummary.ts +56 -0
- package/src/shipping/handlerSchemas.ts +19 -0
- package/src/shipping/index.ts +23 -0
- package/src/shipping/pickupPointSearchPort.ts +8 -0
- package/src/shipping/readDeliverySelectionEvidence.ts +51 -0
- package/src/shipping/shippingRatePorts.ts +36 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const RESERVE_SQL = `SELECT public.fulfillment_reserve_subscription_renewal(
|
|
2
|
+
$1::uuid, $2::uuid, $3::integer, $4::timestamptz) AS response`;
|
|
3
|
+
const RELEASE_SQL = `SELECT public.fulfillment_release_subscription_renewal(
|
|
4
|
+
$1::uuid, $2::uuid, $3::text, $4::timestamptz) AS response`;
|
|
5
|
+
const EXPIRE_SQL = `SELECT public.fulfillment_expire_subscription_renewals(
|
|
6
|
+
$1::timestamptz, $2::integer) AS expired`;
|
|
7
|
+
/** ATP/reservation adapter; it can reserve only through the fenced public renewal function. */
|
|
8
|
+
export function createPostgresRenewalReservationPort(executor) {
|
|
9
|
+
return {
|
|
10
|
+
async reserve(input) {
|
|
11
|
+
const result = await executor.query(RESERVE_SQL, [
|
|
12
|
+
input.operationId,
|
|
13
|
+
input.claimToken,
|
|
14
|
+
input.holdSeconds ?? 900,
|
|
15
|
+
input.now,
|
|
16
|
+
]);
|
|
17
|
+
const row = requiredRecord(record(result.rows[0])?.response, "reserve_response");
|
|
18
|
+
const status = text(row.status);
|
|
19
|
+
if (!["held", "committed", "consumed", "released", "expired", "refused"].includes(status)) {
|
|
20
|
+
throw new Error("subscription_renewal_reservation_status_invalid");
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
reserved: row.reserved === true,
|
|
24
|
+
replayed: row.replayed === true,
|
|
25
|
+
reservationId: nullableText(row.reservationId),
|
|
26
|
+
status,
|
|
27
|
+
reason: nullableText(row.reason),
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
async releaseReservation(input) {
|
|
31
|
+
const result = await executor.query(RELEASE_SQL, [
|
|
32
|
+
input.operationId,
|
|
33
|
+
input.claimToken,
|
|
34
|
+
input.reason,
|
|
35
|
+
input.now,
|
|
36
|
+
]);
|
|
37
|
+
return requiredRecord(record(result.rows[0])?.response, "release_response");
|
|
38
|
+
},
|
|
39
|
+
async expireReservations(input) {
|
|
40
|
+
const result = await executor.query(EXPIRE_SQL, [input.now, input.limit ?? 100]);
|
|
41
|
+
const value = Number(record(result.rows[0])?.expired);
|
|
42
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
43
|
+
throw new Error("subscription_renewal_expiry_response_invalid");
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function record(value) {
|
|
50
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
51
|
+
? value
|
|
52
|
+
: null;
|
|
53
|
+
}
|
|
54
|
+
function requiredRecord(value, field) {
|
|
55
|
+
const result = record(value);
|
|
56
|
+
if (!result)
|
|
57
|
+
throw new Error(`subscription_renewal_${field}_invalid`);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
function text(value) { return typeof value === "string" ? value.trim() : ""; }
|
|
61
|
+
function nullableText(value) { return text(value) || null; }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReservationPolicyInput, ReservationPolicy } from "./contracts/reservation.js";
|
|
2
|
+
export declare const MIN_CHECKOUT_RESERVATION_TTL_MINUTES: number;
|
|
3
|
+
export declare const MAX_CHECKOUT_RESERVATION_TTL_MINUTES: number;
|
|
4
|
+
export declare const DEFAULT_CHECKOUT_RESERVATION_TTL_MINUTES: number;
|
|
5
|
+
export declare function reservationPolicyFor(input: ReservationPolicyInput): ReservationPolicy;
|
|
6
|
+
export declare function normalizedTtlMinutes(value: number | null | undefined): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const MIN_CHECKOUT_RESERVATION_TTL_MINUTES = 24 * 60;
|
|
2
|
+
export const MAX_CHECKOUT_RESERVATION_TTL_MINUTES = 36 * 60;
|
|
3
|
+
export const DEFAULT_CHECKOUT_RESERVATION_TTL_MINUTES = MIN_CHECKOUT_RESERVATION_TTL_MINUTES;
|
|
4
|
+
export function reservationPolicyFor(input) {
|
|
5
|
+
if (input.reservationKind !== "checkout_payment_window") {
|
|
6
|
+
return { expiresAt: null, ttlMinutes: null };
|
|
7
|
+
}
|
|
8
|
+
const ttlMinutes = normalizedTtlMinutes(input.checkoutTtlMinutes);
|
|
9
|
+
return {
|
|
10
|
+
expiresAt: new Date(input.now.getTime() + ttlMinutes * 60_000).toISOString(),
|
|
11
|
+
ttlMinutes,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function normalizedTtlMinutes(value) {
|
|
15
|
+
if (Number.isFinite(value) && value && value > 0) {
|
|
16
|
+
return Math.min(MAX_CHECKOUT_RESERVATION_TTL_MINUTES, Math.max(MIN_CHECKOUT_RESERVATION_TTL_MINUTES, Math.floor(value)));
|
|
17
|
+
}
|
|
18
|
+
return DEFAULT_CHECKOUT_RESERVATION_TTL_MINUTES;
|
|
19
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const adminInventoryStockRequestSchema: z.ZodObject<{
|
|
3
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
4
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
5
|
+
skuId: z.ZodOptional<z.ZodGUID>;
|
|
6
|
+
locationId: z.ZodOptional<z.ZodGUID>;
|
|
7
|
+
includeZero: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export declare const adminInventoryReservationsRequestSchema: z.ZodObject<{
|
|
10
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
expired: "expired";
|
|
14
|
+
reserved: "reserved";
|
|
15
|
+
released: "released";
|
|
16
|
+
consumed: "consumed";
|
|
17
|
+
}>>;
|
|
18
|
+
orderId: z.ZodOptional<z.ZodGUID>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export declare const adminInventoryStockAdjustmentRequestSchema: z.ZodObject<{
|
|
21
|
+
idempotencyKey: z.ZodString;
|
|
22
|
+
skuId: z.ZodGUID;
|
|
23
|
+
locationId: z.ZodGUID;
|
|
24
|
+
lotId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
25
|
+
quantityDelta: z.ZodNumber;
|
|
26
|
+
reason: z.ZodString;
|
|
27
|
+
note: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export declare const adminInventorySubscriptionForecastRequestSchema: z.ZodObject<{
|
|
30
|
+
horizonDays: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
31
|
+
protectionDays: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export declare const inventoryStockListResponseSchema: z.ZodObject<{
|
|
34
|
+
contractVersion: z.ZodLiteral<"inventory.v0">;
|
|
35
|
+
stock: z.ZodArray<z.ZodObject<{
|
|
36
|
+
skuId: z.ZodGUID;
|
|
37
|
+
sku: z.ZodString;
|
|
38
|
+
locationId: z.ZodGUID;
|
|
39
|
+
locationCode: z.ZodString;
|
|
40
|
+
locationKind: z.ZodEnum<{
|
|
41
|
+
internal_warehouse: "internal_warehouse";
|
|
42
|
+
third_party_logistics: "third_party_logistics";
|
|
43
|
+
supplier: "supplier";
|
|
44
|
+
quarantine: "quarantine";
|
|
45
|
+
virtual: "virtual";
|
|
46
|
+
}>;
|
|
47
|
+
locationStatus: z.ZodEnum<{
|
|
48
|
+
active: "active";
|
|
49
|
+
inactive: "inactive";
|
|
50
|
+
}>;
|
|
51
|
+
fulfillable: z.ZodBoolean;
|
|
52
|
+
lotId: z.ZodNullable<z.ZodGUID>;
|
|
53
|
+
lotCode: z.ZodNullable<z.ZodString>;
|
|
54
|
+
lotStatus: z.ZodNullable<z.ZodEnum<{
|
|
55
|
+
expired: "expired";
|
|
56
|
+
available: "available";
|
|
57
|
+
quarantined: "quarantined";
|
|
58
|
+
recalled: "recalled";
|
|
59
|
+
}>>;
|
|
60
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
61
|
+
onHand: z.ZodNumber;
|
|
62
|
+
reserved: z.ZodNumber;
|
|
63
|
+
unavailable: z.ZodNumber;
|
|
64
|
+
incoming: z.ZodNumber;
|
|
65
|
+
safetyStock: z.ZodNumber;
|
|
66
|
+
availableNow: z.ZodNumber;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
totalCount: z.ZodNumber;
|
|
69
|
+
page: z.ZodNumber;
|
|
70
|
+
pageSize: z.ZodNumber;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export declare const inventoryReservationsListResponseSchema: z.ZodObject<{
|
|
73
|
+
contractVersion: z.ZodLiteral<"inventory.v0">;
|
|
74
|
+
reservations: z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodGUID;
|
|
76
|
+
orderId: z.ZodGUID;
|
|
77
|
+
subscriptionCycleId: z.ZodNullable<z.ZodGUID>;
|
|
78
|
+
status: z.ZodEnum<{
|
|
79
|
+
expired: "expired";
|
|
80
|
+
reserved: "reserved";
|
|
81
|
+
released: "released";
|
|
82
|
+
consumed: "consumed";
|
|
83
|
+
}>;
|
|
84
|
+
kind: z.ZodEnum<{
|
|
85
|
+
checkout_payment_window: "checkout_payment_window";
|
|
86
|
+
subscription_retry_window: "subscription_retry_window";
|
|
87
|
+
manual_ops: "manual_ops";
|
|
88
|
+
}>;
|
|
89
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
90
|
+
createdAt: z.ZodString;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
totalCount: z.ZodNumber;
|
|
93
|
+
page: z.ZodNumber;
|
|
94
|
+
pageSize: z.ZodNumber;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export declare function createInventorySubscriptionForecastResponseSchema(providerSchema: z.ZodType<string>): z.ZodObject<{
|
|
97
|
+
contractVersion: z.ZodLiteral<"inventory.v0">;
|
|
98
|
+
generatedAt: z.ZodString;
|
|
99
|
+
stockMasterProvider: z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>;
|
|
100
|
+
horizonDays: z.ZodNumber;
|
|
101
|
+
protectionDays: z.ZodNumber;
|
|
102
|
+
skus: z.ZodArray<z.ZodObject<{
|
|
103
|
+
skuId: z.ZodGUID;
|
|
104
|
+
sku: z.ZodString;
|
|
105
|
+
providerCurrentForSale: z.ZodNullable<z.ZodNumber>;
|
|
106
|
+
providerStockLastSyncedAt: z.ZodNullable<z.ZodString>;
|
|
107
|
+
providerStockStaleAfter: z.ZodNullable<z.ZodString>;
|
|
108
|
+
stockStatus: z.ZodEnum<{
|
|
109
|
+
stale: "stale";
|
|
110
|
+
missing: "missing";
|
|
111
|
+
fresh: "fresh";
|
|
112
|
+
}>;
|
|
113
|
+
openHardReservations: z.ZodNumber;
|
|
114
|
+
safetyStock: z.ZodNumber;
|
|
115
|
+
sellableNow: z.ZodNumber;
|
|
116
|
+
activeSubscriptionDemand30: z.ZodNumber;
|
|
117
|
+
activeSubscriptionDemand45: z.ZodNumber;
|
|
118
|
+
activeSubscriptionDemand60: z.ZodNumber;
|
|
119
|
+
plannedSupply: z.ZodNumber;
|
|
120
|
+
coverageDays: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
shortageDate: z.ZodNullable<z.ZodString>;
|
|
122
|
+
horizonMissingQty: z.ZodNumber;
|
|
123
|
+
protectionMissingQty: z.ZodNumber;
|
|
124
|
+
missingQty: z.ZodNumber;
|
|
125
|
+
recommendedProductionQty: z.ZodNumber;
|
|
126
|
+
}, z.core.$strict>>;
|
|
127
|
+
totals: z.ZodObject<{
|
|
128
|
+
activeSubscriptionCount: z.ZodNumber;
|
|
129
|
+
excludedSubscriptionCount: z.ZodNumber;
|
|
130
|
+
missingProviderStockSkuCount: z.ZodNumber;
|
|
131
|
+
staleProviderStockSkuCount: z.ZodNumber;
|
|
132
|
+
horizonShortageSkuCount: z.ZodNumber;
|
|
133
|
+
protectionShortageSkuCount: z.ZodNumber;
|
|
134
|
+
shortageSkuCount: z.ZodNumber;
|
|
135
|
+
recommendedProductionQty: z.ZodNumber;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { INVENTORY_CONTRACT_VERSION, inventoryStockLineSchema } from "@openlup/core/inventory";
|
|
3
|
+
z.config({ jitless: true });
|
|
4
|
+
const inventoryReservationStatusSchema = z.enum([
|
|
5
|
+
"reserved",
|
|
6
|
+
"released",
|
|
7
|
+
"consumed",
|
|
8
|
+
"expired",
|
|
9
|
+
]);
|
|
10
|
+
const inventoryReservationKindSchema = z.enum([
|
|
11
|
+
"checkout_payment_window",
|
|
12
|
+
"subscription_retry_window",
|
|
13
|
+
"manual_ops",
|
|
14
|
+
]);
|
|
15
|
+
const uuidSchema = z.guid();
|
|
16
|
+
const datetimeSchema = z.string().datetime({ offset: true });
|
|
17
|
+
const quantitySchema = z.number().int().nonnegative();
|
|
18
|
+
export const adminInventoryStockRequestSchema = z.object({
|
|
19
|
+
page: z.coerce.number().int().min(1).default(1),
|
|
20
|
+
pageSize: z.coerce.number().int().min(1).max(100).default(25),
|
|
21
|
+
skuId: uuidSchema.optional(),
|
|
22
|
+
locationId: uuidSchema.optional(),
|
|
23
|
+
includeZero: z.coerce.boolean().default(false),
|
|
24
|
+
}).strict();
|
|
25
|
+
export const adminInventoryReservationsRequestSchema = z.object({
|
|
26
|
+
page: z.coerce.number().int().min(1).default(1),
|
|
27
|
+
pageSize: z.coerce.number().int().min(1).max(100).default(25),
|
|
28
|
+
status: inventoryReservationStatusSchema.optional(),
|
|
29
|
+
orderId: uuidSchema.optional(),
|
|
30
|
+
}).strict();
|
|
31
|
+
export const adminInventoryStockAdjustmentRequestSchema = z.object({
|
|
32
|
+
idempotencyKey: z.string().trim().min(8).max(120),
|
|
33
|
+
skuId: uuidSchema,
|
|
34
|
+
locationId: uuidSchema,
|
|
35
|
+
lotId: uuidSchema.nullable().optional(),
|
|
36
|
+
quantityDelta: z.number().int(),
|
|
37
|
+
reason: z.string().trim().min(1).max(120),
|
|
38
|
+
note: z.string().trim().max(1000).optional(),
|
|
39
|
+
}).strict();
|
|
40
|
+
export const adminInventorySubscriptionForecastRequestSchema = z.object({
|
|
41
|
+
horizonDays: z.coerce.number().int().min(1).max(180).default(60),
|
|
42
|
+
protectionDays: z.coerce.number().int().min(1).max(180).default(45),
|
|
43
|
+
}).strict().refine((request) => request.protectionDays <= request.horizonDays, {
|
|
44
|
+
message: "protectionDays must be less than or equal to horizonDays",
|
|
45
|
+
path: ["protectionDays"],
|
|
46
|
+
});
|
|
47
|
+
const inventoryReservationSummarySchema = z.object({
|
|
48
|
+
id: uuidSchema,
|
|
49
|
+
orderId: uuidSchema,
|
|
50
|
+
subscriptionCycleId: uuidSchema.nullable(),
|
|
51
|
+
status: inventoryReservationStatusSchema,
|
|
52
|
+
kind: inventoryReservationKindSchema,
|
|
53
|
+
expiresAt: datetimeSchema.nullable(),
|
|
54
|
+
createdAt: datetimeSchema,
|
|
55
|
+
}).strict();
|
|
56
|
+
export const inventoryStockListResponseSchema = z.object({
|
|
57
|
+
contractVersion: z.literal(INVENTORY_CONTRACT_VERSION),
|
|
58
|
+
stock: z.array(inventoryStockLineSchema.extend({ availableNow: quantitySchema })),
|
|
59
|
+
totalCount: z.number().int().min(0),
|
|
60
|
+
page: z.number().int().min(1),
|
|
61
|
+
pageSize: z.number().int().min(1),
|
|
62
|
+
}).strict();
|
|
63
|
+
export const inventoryReservationsListResponseSchema = z.object({
|
|
64
|
+
contractVersion: z.literal(INVENTORY_CONTRACT_VERSION),
|
|
65
|
+
reservations: z.array(inventoryReservationSummarySchema),
|
|
66
|
+
totalCount: z.number().int().min(0),
|
|
67
|
+
page: z.number().int().min(1),
|
|
68
|
+
pageSize: z.number().int().min(1),
|
|
69
|
+
}).strict();
|
|
70
|
+
const inventorySubscriptionForecastStockStatusSchema = z.enum(["fresh", "stale", "missing"]);
|
|
71
|
+
const inventorySubscriptionForecastSkuSchema = z.object({
|
|
72
|
+
skuId: uuidSchema,
|
|
73
|
+
sku: z.string().trim().min(1),
|
|
74
|
+
providerCurrentForSale: quantitySchema.nullable(),
|
|
75
|
+
providerStockLastSyncedAt: datetimeSchema.nullable(),
|
|
76
|
+
providerStockStaleAfter: datetimeSchema.nullable(),
|
|
77
|
+
stockStatus: inventorySubscriptionForecastStockStatusSchema,
|
|
78
|
+
openHardReservations: quantitySchema,
|
|
79
|
+
safetyStock: quantitySchema,
|
|
80
|
+
sellableNow: quantitySchema,
|
|
81
|
+
activeSubscriptionDemand30: quantitySchema,
|
|
82
|
+
activeSubscriptionDemand45: quantitySchema,
|
|
83
|
+
activeSubscriptionDemand60: quantitySchema,
|
|
84
|
+
plannedSupply: quantitySchema,
|
|
85
|
+
coverageDays: z.number().int().nonnegative().nullable(),
|
|
86
|
+
shortageDate: datetimeSchema.nullable(),
|
|
87
|
+
horizonMissingQty: quantitySchema,
|
|
88
|
+
protectionMissingQty: quantitySchema,
|
|
89
|
+
missingQty: quantitySchema,
|
|
90
|
+
recommendedProductionQty: quantitySchema,
|
|
91
|
+
}).strict();
|
|
92
|
+
const inventorySubscriptionForecastTotalsSchema = z.object({
|
|
93
|
+
activeSubscriptionCount: quantitySchema,
|
|
94
|
+
excludedSubscriptionCount: quantitySchema,
|
|
95
|
+
missingProviderStockSkuCount: quantitySchema,
|
|
96
|
+
staleProviderStockSkuCount: quantitySchema,
|
|
97
|
+
horizonShortageSkuCount: quantitySchema,
|
|
98
|
+
protectionShortageSkuCount: quantitySchema,
|
|
99
|
+
shortageSkuCount: quantitySchema,
|
|
100
|
+
recommendedProductionQty: quantitySchema,
|
|
101
|
+
}).strict();
|
|
102
|
+
export function createInventorySubscriptionForecastResponseSchema(providerSchema) {
|
|
103
|
+
return z.object({
|
|
104
|
+
contractVersion: z.literal(INVENTORY_CONTRACT_VERSION),
|
|
105
|
+
generatedAt: datetimeSchema,
|
|
106
|
+
stockMasterProvider: providerSchema,
|
|
107
|
+
horizonDays: z.number().int().min(1),
|
|
108
|
+
protectionDays: z.number().int().min(1),
|
|
109
|
+
skus: z.array(inventorySubscriptionForecastSkuSchema),
|
|
110
|
+
totals: inventorySubscriptionForecastTotalsSchema,
|
|
111
|
+
}).strict();
|
|
112
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Sparse projections of canonical units, never an install chain. */
|
|
2
|
+
export declare const INVENTORY_MIGRATIONS: readonly [{
|
|
3
|
+
readonly id: "20260814000000_fulfillment_stock_evidence";
|
|
4
|
+
readonly catalogPath: "db/platform/migrations/20260814000000_fulfillment_stock_evidence.sql";
|
|
5
|
+
readonly position: 27;
|
|
6
|
+
readonly sha256: "df20c2491cb0196b4e28d19e7578c95bfa5c87b8f89fb0b6284c0e0695a3cc1d";
|
|
7
|
+
readonly url: URL;
|
|
8
|
+
}, {
|
|
9
|
+
readonly id: "20260815120000_automatic_subscription_renewal";
|
|
10
|
+
readonly catalogPath: "db/platform/migrations/20260815120000_automatic_subscription_renewal.sql";
|
|
11
|
+
readonly position: 33;
|
|
12
|
+
readonly sha256: "edef131f4f483a009e0bb6728a071ab78b6c9ac2aa8047aa7107646a11baec73";
|
|
13
|
+
readonly url: URL;
|
|
14
|
+
}];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Sparse projections of canonical units, never an install chain. */
|
|
2
|
+
export const INVENTORY_MIGRATIONS = [
|
|
3
|
+
{ id: "20260814000000_fulfillment_stock_evidence", catalogPath: "db/platform/migrations/20260814000000_fulfillment_stock_evidence.sql", position: 27, sha256: "df20c2491cb0196b4e28d19e7578c95bfa5c87b8f89fb0b6284c0e0695a3cc1d", url: new URL("../../sql/20260814000000_fulfillment_stock_evidence.sql", import.meta.url) },
|
|
4
|
+
{ id: "20260815120000_automatic_subscription_renewal", catalogPath: "db/platform/migrations/20260815120000_automatic_subscription_renewal.sql", position: 33, sha256: "edef131f4f483a009e0bb6728a071ab78b6c9ac2aa8047aa7107646a11baec73", url: new URL("../../sql/20260815120000_automatic_subscription_renewal.sql", import.meta.url) },
|
|
5
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SubscriptionForecastCalculationInput, SubscriptionForecastCounts, SubscriptionForecastSku, SubscriptionForecastTotals } from "./contracts/forecast.js";
|
|
2
|
+
export declare function calculateSubscriptionForecastSkus(input: SubscriptionForecastCalculationInput): SubscriptionForecastSku[];
|
|
3
|
+
/** Kept separate so native envelopes can read their metadata before count getters. */
|
|
4
|
+
export declare function calculateSubscriptionForecastTotals(input: SubscriptionForecastCounts, skus: SubscriptionForecastSku[]): SubscriptionForecastTotals;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
2
|
+
export function calculateSubscriptionForecastSkus(input) {
|
|
3
|
+
const generatedAtMs = Date.parse(input.generatedAt);
|
|
4
|
+
const horizonAtMs = generatedAtMs + input.horizonDays * DAY_MS;
|
|
5
|
+
const protectionAtMs = generatedAtMs + input.protectionDays * DAY_MS;
|
|
6
|
+
const demand = input.demand
|
|
7
|
+
.filter((line) => !["skipped", "cancelled"].includes(line.status))
|
|
8
|
+
.filter((line) => Date.parse(line.dueAt) <= horizonAtMs);
|
|
9
|
+
const plannedSupply = input.supply
|
|
10
|
+
.filter((line) => line.status === "planned")
|
|
11
|
+
.filter((line) => Date.parse(line.expectedAt) <= horizonAtMs);
|
|
12
|
+
const providerBySku = new Map(input.providerCurrent.map((line) => [line.skuId, line]));
|
|
13
|
+
const skuIds = new Set([
|
|
14
|
+
...input.providerCurrent.map((line) => line.skuId),
|
|
15
|
+
...input.openHardReservations.map((line) => line.skuId),
|
|
16
|
+
...input.stock.map((line) => line.skuId),
|
|
17
|
+
...demand.map((line) => line.skuId),
|
|
18
|
+
...plannedSupply.map((line) => line.skuId),
|
|
19
|
+
]);
|
|
20
|
+
const skus = [...skuIds].map((skuId) => {
|
|
21
|
+
const provider = providerBySku.get(skuId) ?? null;
|
|
22
|
+
const stockLines = input.stock.filter((line) => line.skuId === skuId);
|
|
23
|
+
const demandLines = demand.filter((line) => line.skuId === skuId);
|
|
24
|
+
const supplyLines = plannedSupply.filter((line) => line.skuId === skuId);
|
|
25
|
+
const sku = provider?.sku ?? stockLines[0]?.sku ?? demandLines[0]?.sku ?? "unknown";
|
|
26
|
+
const stockStatus = provider === null
|
|
27
|
+
? "missing"
|
|
28
|
+
: Date.parse(provider.staleAfter) <= generatedAtMs
|
|
29
|
+
? "stale"
|
|
30
|
+
: "fresh";
|
|
31
|
+
const openHardReservations = sum(input.openHardReservations
|
|
32
|
+
.filter((line) => line.skuId === skuId)
|
|
33
|
+
.map((line) => line.quantity));
|
|
34
|
+
const safetyStock = sum(stockLines
|
|
35
|
+
.filter((line) => line.fulfillable && line.locationStatus === "active")
|
|
36
|
+
.map((line) => line.safetyStock));
|
|
37
|
+
const sellableNow = stockStatus === "fresh" && provider
|
|
38
|
+
? Math.max(0, provider.forSaleQuantity - openHardReservations - safetyStock)
|
|
39
|
+
: 0;
|
|
40
|
+
const shortage = simulateSubscriptionCoverage({
|
|
41
|
+
generatedAtMs,
|
|
42
|
+
protectionAtMs,
|
|
43
|
+
sellableNow,
|
|
44
|
+
demand: demandLines,
|
|
45
|
+
supply: supplyLines,
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
skuId,
|
|
49
|
+
sku,
|
|
50
|
+
providerCurrentForSale: provider?.forSaleQuantity ?? null,
|
|
51
|
+
providerStockLastSyncedAt: provider?.lastSyncedAt ?? null,
|
|
52
|
+
providerStockStaleAfter: provider?.staleAfter ?? null,
|
|
53
|
+
stockStatus,
|
|
54
|
+
openHardReservations,
|
|
55
|
+
safetyStock,
|
|
56
|
+
sellableNow,
|
|
57
|
+
activeSubscriptionDemand30: demandQuantityWithin(demandLines, generatedAtMs + 30 * DAY_MS),
|
|
58
|
+
activeSubscriptionDemand45: demandQuantityWithin(demandLines, generatedAtMs + 45 * DAY_MS),
|
|
59
|
+
activeSubscriptionDemand60: demandQuantityWithin(demandLines, generatedAtMs + 60 * DAY_MS),
|
|
60
|
+
plannedSupply: sum(supplyLines.map((line) => line.quantity)),
|
|
61
|
+
coverageDays: shortage.shortageDate
|
|
62
|
+
? Math.max(0, Math.ceil((Date.parse(shortage.shortageDate) - generatedAtMs) / DAY_MS))
|
|
63
|
+
: null,
|
|
64
|
+
shortageDate: shortage.shortageDate,
|
|
65
|
+
horizonMissingQty: shortage.horizonMissingQty,
|
|
66
|
+
protectionMissingQty: shortage.protectionMissingQty,
|
|
67
|
+
missingQty: shortage.protectionMissingQty,
|
|
68
|
+
recommendedProductionQty: shortage.protectionMissingQty,
|
|
69
|
+
};
|
|
70
|
+
}).sort((a, b) => a.sku.localeCompare(b.sku));
|
|
71
|
+
return skus;
|
|
72
|
+
}
|
|
73
|
+
/** Kept separate so native envelopes can read their metadata before count getters. */
|
|
74
|
+
export function calculateSubscriptionForecastTotals(input, skus) {
|
|
75
|
+
return {
|
|
76
|
+
activeSubscriptionCount: input.activeSubscriptionCount,
|
|
77
|
+
excludedSubscriptionCount: input.excludedSubscriptionCount,
|
|
78
|
+
missingProviderStockSkuCount: skus.filter((line) => line.stockStatus === "missing").length,
|
|
79
|
+
staleProviderStockSkuCount: skus.filter((line) => line.stockStatus === "stale").length,
|
|
80
|
+
horizonShortageSkuCount: skus.filter((line) => line.shortageDate !== null).length,
|
|
81
|
+
protectionShortageSkuCount: skus.filter((line) => line.protectionMissingQty > 0).length,
|
|
82
|
+
shortageSkuCount: skus.filter((line) => line.shortageDate !== null).length,
|
|
83
|
+
recommendedProductionQty: sum(skus.map((line) => line.recommendedProductionQty)),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function simulateSubscriptionCoverage(input) {
|
|
87
|
+
let available = input.sellableNow;
|
|
88
|
+
let shortageDate = null;
|
|
89
|
+
let horizonMissingQty = 0;
|
|
90
|
+
let protectionMissingQty = 0;
|
|
91
|
+
const events = [
|
|
92
|
+
...input.supply.map((line) => ({
|
|
93
|
+
type: "supply",
|
|
94
|
+
at: line.expectedAt,
|
|
95
|
+
quantity: line.quantity,
|
|
96
|
+
})),
|
|
97
|
+
...input.demand.map((line) => ({
|
|
98
|
+
type: "demand",
|
|
99
|
+
at: line.dueAt,
|
|
100
|
+
quantity: line.quantity,
|
|
101
|
+
})),
|
|
102
|
+
].sort((a, b) => {
|
|
103
|
+
const dateDelta = Date.parse(a.at) - Date.parse(b.at);
|
|
104
|
+
if (dateDelta !== 0)
|
|
105
|
+
return dateDelta;
|
|
106
|
+
return a.type === "supply" && b.type === "demand" ? -1 : 1;
|
|
107
|
+
});
|
|
108
|
+
for (const event of events) {
|
|
109
|
+
if (event.type === "supply") {
|
|
110
|
+
available += event.quantity;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (available >= event.quantity) {
|
|
114
|
+
available -= event.quantity;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const missing = event.quantity - available;
|
|
118
|
+
available = 0;
|
|
119
|
+
shortageDate ??= event.at;
|
|
120
|
+
horizonMissingQty += missing;
|
|
121
|
+
if (Date.parse(event.at) <= input.protectionAtMs)
|
|
122
|
+
protectionMissingQty += missing;
|
|
123
|
+
}
|
|
124
|
+
return { shortageDate, horizonMissingQty, protectionMissingQty };
|
|
125
|
+
}
|
|
126
|
+
function demandQuantityWithin(lines, dueAtOrBeforeMs) {
|
|
127
|
+
return sum(lines
|
|
128
|
+
.filter((line) => Date.parse(line.dueAt) <= dueAtOrBeforeMs)
|
|
129
|
+
.map((line) => line.quantity));
|
|
130
|
+
}
|
|
131
|
+
function sum(values) {
|
|
132
|
+
return values.reduce((total, value) => total + value, 0);
|
|
133
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AcquisitionTermsMetadata } from "./contracts/acquisitionTerms.js";
|
|
2
|
+
export type AcquisitionRowFacts = Readonly<{
|
|
3
|
+
id: string;
|
|
4
|
+
active: boolean;
|
|
5
|
+
regionCodes: readonly string[];
|
|
6
|
+
validFrom: string;
|
|
7
|
+
validTo: string | null;
|
|
8
|
+
mirrorOf: unknown;
|
|
9
|
+
metadataPresent: boolean;
|
|
10
|
+
metadata: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
export type AcquisitionClassification = Readonly<{
|
|
13
|
+
baselineLegacy: boolean;
|
|
14
|
+
target: boolean;
|
|
15
|
+
canonicalRow: boolean;
|
|
16
|
+
unconfiguredLegacyEligible: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/** Required host policy. No financial predicates or schedules are inferred. */
|
|
19
|
+
export interface AcquisitionFinancialPolicy<Row> {
|
|
20
|
+
facts(row: Row): AcquisitionRowFacts;
|
|
21
|
+
classify(row: Row): AcquisitionClassification;
|
|
22
|
+
validateMetadata(row: Row, terms: AcquisitionTermsMetadata): void;
|
|
23
|
+
pairMatches(legacy: Row, mirror: Row): boolean;
|
|
24
|
+
initialDiscountBps(row: Row, purpose: "resolved_target" | "filter_validation"): unknown;
|
|
25
|
+
unconfiguredTerms(legacy: Row, mirror: Row): AcquisitionTermsMetadata;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type CommerceOfferPricingDeps } from "./commerceOfferPricing.js";
|
|
2
|
+
import { type AcquisitionOfferPricingResponse } from "./contracts/offer.js";
|
|
3
|
+
import { ACQUISITION_TERMS_CAPABILITY, type AcquisitionTerms } from "./contracts/acquisitionTerms.js";
|
|
4
|
+
import type { CommerceQuoteCatalogItem } from "./commerceQuoteCatalogReadPort.js";
|
|
5
|
+
import type { CreateQuoteRequest } from "./contracts/quote.js";
|
|
6
|
+
export declare function acquisitionProjectionFreshness(acquisitionTerms: AcquisitionTerms, observedAt: string, nextBoundaryAt?: string | null): {
|
|
7
|
+
acquisitionTerms: {
|
|
8
|
+
initialDiscountBps: number;
|
|
9
|
+
effectiveFrom: string;
|
|
10
|
+
effectiveTo: string | null;
|
|
11
|
+
schemaVersion: "subscription-acquisition.v1";
|
|
12
|
+
revision: string;
|
|
13
|
+
delivery2DiscountBps: number;
|
|
14
|
+
};
|
|
15
|
+
observedAt: string;
|
|
16
|
+
validUntil: string;
|
|
17
|
+
};
|
|
18
|
+
/** Explicit opt-in projection; the incumbent projector receives no new defaults. */
|
|
19
|
+
export declare function projectAcquisitionOfferPricing<Item extends CommerceQuoteCatalogItem, ScopeV1 extends string, ScopeV2 extends string>(input: Omit<CommerceOfferPricingDeps<Item, ScopeV1, ScopeV2>, "requestFor"> & {
|
|
20
|
+
acquisitionTerms: AcquisitionTerms;
|
|
21
|
+
observedAt: string;
|
|
22
|
+
nextBoundaryAt?: string | null;
|
|
23
|
+
requestFor(product: Item, mode: "one_time" | "subscription", acquisition: {
|
|
24
|
+
acquisitionCapability: typeof ACQUISITION_TERMS_CAPABILITY;
|
|
25
|
+
atTime: string;
|
|
26
|
+
}): CreateQuoteRequest;
|
|
27
|
+
}): Promise<AcquisitionOfferPricingResponse<ScopeV2>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { projectCommerceOfferPricing } from "./commerceOfferPricing.js";
|
|
2
|
+
import { COMMERCE_OFFER_PRICING_V2_CONTRACT_VERSION, COMMERCE_OFFER_PRICING_V3_CONTRACT_VERSION } from "./contracts/offer.js";
|
|
3
|
+
import { ACQUISITION_TERMS_CAPABILITY } from "./contracts/acquisitionTerms.js";
|
|
4
|
+
import { ACQUISITION_PROJECTION_MAX_AGE_MS, acquisitionProjectionFreshnessSchema } from "./acquisitionOfferPricingSchemas.js";
|
|
5
|
+
export function acquisitionProjectionFreshness(acquisitionTerms, observedAt, nextBoundaryAt) {
|
|
6
|
+
const boundary = nextBoundaryAt ?? acquisitionTerms.effectiveTo;
|
|
7
|
+
const validUntil = new Date(Math.min(Date.parse(observedAt) + ACQUISITION_PROJECTION_MAX_AGE_MS, boundary == null ? Infinity : Date.parse(boundary))).toISOString();
|
|
8
|
+
return acquisitionProjectionFreshnessSchema.parse({ acquisitionTerms, observedAt, validUntil });
|
|
9
|
+
}
|
|
10
|
+
/** Explicit opt-in projection; the incumbent projector receives no new defaults. */
|
|
11
|
+
export async function projectAcquisitionOfferPricing(input) {
|
|
12
|
+
const freshness = acquisitionProjectionFreshness(input.acquisitionTerms, input.observedAt, input.nextBoundaryAt);
|
|
13
|
+
if (input.pricingPolicy?.offerPolicyVersion !== "commerce.offer-policy.v2" ||
|
|
14
|
+
input.pricingPolicy.promotionEngineVersion !== "promotion-engine.v2") {
|
|
15
|
+
throw new Error("commerce_acquisition_projection_policy_invalid");
|
|
16
|
+
}
|
|
17
|
+
const projection = await projectCommerceOfferPricing({ ...input,
|
|
18
|
+
requestFor: (product, mode) => input.requestFor(product, mode, {
|
|
19
|
+
acquisitionCapability: ACQUISITION_TERMS_CAPABILITY, atTime: input.observedAt,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
if (projection.contractVersion !== COMMERCE_OFFER_PRICING_V2_CONTRACT_VERSION)
|
|
23
|
+
throw new Error("commerce_acquisition_projection_policy_invalid");
|
|
24
|
+
return { ...projection, contractVersion: COMMERCE_OFFER_PRICING_V3_CONTRACT_VERSION, ...freshness };
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HttpRequest, HttpResponse } from "../http/index.js";
|
|
2
|
+
import type { BffResponder } from "../bff/index.js";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
import { type AcquisitionOfferPricingResponse, type CommerceOfferPricingResponse } from "./contracts/offer.js";
|
|
5
|
+
import type { AcquisitionCapability } from "./contracts/acquisitionTerms.js";
|
|
6
|
+
import type { PricingPolicyRequest, PricingPolicySnapshot } from "./contracts/offerPolicy.js";
|
|
7
|
+
export declare const ACQUISITION_CAPABILITY_HEADER = "x-commerce-acquisition-capability";
|
|
8
|
+
export interface AcquisitionOfferPricingHandlerDeps {
|
|
9
|
+
responder: BffResponder;
|
|
10
|
+
commerceOfferPricingResponseSchema: z.ZodType<AcquisitionOfferPricingResponse | CommerceOfferPricingResponse>;
|
|
11
|
+
incumbentHandler(req: HttpRequest, res: HttpResponse): Promise<void>;
|
|
12
|
+
readOfferPricing(pricingPolicy?: PricingPolicySnapshot, acquisitionCapability?: AcquisitionCapability): Promise<AcquisitionOfferPricingResponse | CommerceOfferPricingResponse>;
|
|
13
|
+
requirePricingPolicy?: boolean;
|
|
14
|
+
resolvePricingPolicy?(request: {
|
|
15
|
+
visitorId: string;
|
|
16
|
+
pricingPolicy: PricingPolicyRequest;
|
|
17
|
+
}): PricingPolicySnapshot | undefined | Promise<PricingPolicySnapshot | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createAcquisitionOfferPricingHandler({ responder, commerceOfferPricingResponseSchema, incumbentHandler, readOfferPricing, resolvePricingPolicy, requirePricingPolicy, }: AcquisitionOfferPricingHandlerDeps): (req: HttpRequest, res: HttpResponse) => Promise<void>;
|
|
20
|
+
export declare function readAcquisitionCapability(req: HttpRequest): AcquisitionCapability | undefined | null;
|