@trymeai/sdk-types
v0.3.0
Published
Public TypeScript types for the TryMeAI SDK — the partner-facing surface of window.TryMeAIMini (the handle @trymeai/sdk resolves). Zero runtime.
Readme
@trymeai/sdk-types
The public TypeScript types for the TryMeAI SDK — the partner-facing surface of
window.TryMeAIMini, i.e. the handle that @trymeai/sdk's
loadTryMeAI() resolves to. Zero runtime (types only).
npm install -D @trymeai/sdk-typesWhat it exports
TryMeAIMini— the minimal partner-facing handle interface (init · tryOn · openTryOnModal · getSession · subscribeToSession · ensureSession · refreshIdentity · findMySize · destroy).The public data types:
TryMeAIInitConfig,TryOnParams,PartnerSessionToken,SdkPublicSession,SessionState,StartSessionOptions,FindMySizeResult,UserType(plus the shapes they reference).Add to cart (SDK 1.4.0+):
AddToCartEventPayload— thetrymeai:addToCartdetail, including the variant-card fieldsvariantId,salePrice,currency,market,availability,offerUpdatedAt,offerSourceandpdpUrl, all optional and present only on an add from the variant card — plusAddToCartAckandAddToCartAckResultfor answering one.The answer is expected within 1.5 s, via
detail.ack({ ok })on the event or theackargument ofTryMeAIInitConfig.onAddToCart, which is called for every add alongside (never instead of) the window event. Without an answer the card shows "Couldn't add — please try again".
Single source of truth
Every type here is re-exported from the SDK core's real src/core/types.ts — never
hand-copied. The one authored declaration, the TryMeAIMini interface, is
drift-guarded: the core build contains a compile-time check that the concrete
TryMeAIMiniSdk instance satisfies this interface, so a public method that is
renamed, removed, or whose signature drifts fails the core's tsc — the published
types can't silently diverge from the implementation.
@trymeai/sdkre-exports these types, so app code usually imports from@trymeai/sdkdirectly and never needs to depend on this package explicitly.
