From 439ccb38b37f731baac6fac8580f54be8875438d Mon Sep 17 00:00:00 2001 From: Robert Field Date: Tue, 15 Sep 2026 14:11:29 +0100 Subject: [PATCH] fix(commerce-elastic-path): declare every /server export in server.d.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dist/server.d.ts is not derived from src/server.ts — it is a template string in build-server.mjs, hand-mirrored from the source, and it had drifted. 17 of the entry's 105 exports shipped working JavaScript with no type, so importing any of them failed a consumer's typecheck while the runtime worked. The example app imports createManualAdapter, handleResumePayment and handleAbandonPayment from /server, so bumping it to 0.6.0 would have broken next build on three counts. Declares all 105 rather than only this release's additions: the six that predate it are equally unusable, and two of them are what the example app needs. The SSR cart-seed helpers are documented for use in a consumer's root layout, so they are public API too. --- .../commerce-providers/elastic-path/build-server.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plasmicpkgs/commerce-providers/elastic-path/build-server.mjs b/plasmicpkgs/commerce-providers/elastic-path/build-server.mjs index ee7638ed21..e275a4bf94 100644 --- a/plasmicpkgs/commerce-providers/elastic-path/build-server.mjs +++ b/plasmicpkgs/commerce-providers/elastic-path/build-server.mjs @@ -85,7 +85,7 @@ for (const file of CLIENT_ENTRY_FILES) { // is hand-mirrored here; a missing line means the runtime export works but has // no type, breaking consumer typechecks. const dts = `\ -export { handleCreateSession, handleGetSession, handleUpdateSession, handleCalculateShipping, handlePay, handleConfirm } from "./api/endpoints/checkout-session"; +export { handleCreateSession, handleGetSession, handleUpdateSession, handleCalculateShipping, handlePay, handleConfirm, handleAbandonPayment, handleResumePayment } from "./api/endpoints/checkout-session"; export { CookieSessionStore } from "./checkout/session/cookie-store"; export { createAdapterRegistry } from "./checkout/session/adapter-registry"; export { createCloverAdapter } from "./checkout/session/adapters/clover-adapter"; @@ -94,7 +94,13 @@ export { createStripeAdapter } from "./checkout/session/adapters/stripe-adapter" export type { StripeAdapterConfig } from "./checkout/session/adapters/stripe-adapter"; export { createClientCredentialsTokenResolver } from "./auth/ep-plugin/client-credentials-resolver"; export type { ClientCredentialsResolverConfig, ClientCredentialsTokenResolver } from "./auth/ep-plugin/client-credentials-resolver"; -export type { SessionRequest, SessionResponse, SessionHandlerContext, EPCredentials, AdapterRegistry, SessionStore, PaymentAdapter, CustomAttributeAllowList } from "./checkout/session/types"; +export { createManualAdapter } from "./checkout/session/adapters/manual-adapter"; +export type { ManualAdapterConfig, ManualPaymentMethod } from "./checkout/session/adapters/manual-adapter"; +export { isCartPaymentIntentAdapter, isLegacyPaymentAdapter, isOrderFirstAdapter } from "./checkout/session/payment-sequence"; +export { EP_CART_CACHE_KEY, epCartCacheKey } from "./cart-provider/cache-keys"; +export type { EpCartCacheKey } from "./cart-provider/cache-keys"; +export { seedCartFallback } from "./cart-provider/seed-cart-fallback"; +export type { SessionRequest, SessionResponse, SessionHandlerContext, EPCredentials, AdapterRegistry, SessionStore, PaymentAdapter, CustomAttributeAllowList, CartPaymentIntentAdapter, LegacyPaymentAdapter, OrderFirstAdapter, PaymentSequence, PaymentSetupRequest } from "./checkout/session/types"; export { createEpAuth, createBetterEpAuth, extractEpProviderConfig, epPlugin, epAuthMiddleware, createEpAuthRoutes, createCartRoutes, createEpProxyRoutes, enforceOriginGate, isTrustedOrigin, passesOriginGate, assertProductionSecret, resolveAuthSecret, DEFAULT_HOST_ALLOWLIST, isAllowedEpHost } from "./auth"; export type { EpAuth, EpAuthConfig, EpSession, EpProviderBundleConfig, ExtractEpProviderConfigOptions, EpPluginOptions, EpProxyRoutes } from "./auth"; export { epGetProduct, epGetCart, epGetProductList, epGetProductPage, epGetRelatedProducts, epAddCartItem, epApplyCartAdjustment, epUpdateCartItem, epRemoveCartItem, epPlaceOrder, addCustomCartItem, CART_ADJUSTMENT_KINDS, registerEpCustomFunctions, buildEpCtx, withEpSession, getCurrentEpSession } from "./ep-server-functions";