import { Cart } from '../../core/src/index.ts'; import { Cart as Cart_2 } from '../../../core/src/index.ts'; import { CommerceClient } from '../../core/src/index.ts'; import { CommerceClient as CommerceClient_2 } from '../../../core/src/index.ts'; import { ConnectivityStatus } from '../../core/src/index.ts'; import { default as default_2 } from 'handlebars'; import { ProblemDetails } from '../../../core/src/index.ts'; export declare interface AltazionActionErrorDetail { name: string; message: string; status?: number; problem?: ProblemDetails; isOffline: boolean; isConflict: boolean; } export declare interface AltazionActionEventDetail { module: TModule; action: TAction; element: Element; payload: Record; result?: TResult; error?: unknown; errorDetail?: AltazionActionErrorDetail; } export declare type AltazionCartActionName = 'getCart' | 'getValidationStatus' | 'addItem' | 'updateItem' | 'removeItem' | 'applyCoupon' | 'removeCoupon'; export declare type AltazionCartEventDetail = AltazionActionEventDetail<'cart', AltazionCartActionName, TResult>; export declare interface AltazionConnectivityEventDetail { status: ConnectivityStatus; isOnline: boolean; isOffline: boolean; root: Element; } export declare interface AltazionExtensionHandle { dispose(): void; } export declare interface AltazionHtmxConfig { /** Instance CommerceClient déjà initialisée */ client: CommerceClient; /** * Instance Handlebars (global ou importée). * Si omis, les helpers ne sont pas enregistrés. */ handlebars?: typeof default_2; /** * Sélecteur CSS de l'élément DOM à basculer avec la classe `altz-offline` * lorsque la connectivité est perdue/restaurée. * @default 'body' */ offlineSelector?: string; /** Configuration UI du mode hors ligne borne. */ terminalMode?: AltazionTerminalModeConfig; } export declare interface AltazionHtmxInstance { /** Templates Handlebars compilés prêts à l'emploi */ templates: { productCard: HandlebarsTemplateDelegate_2; cartMini: HandlebarsTemplateDelegate_2; productList: HandlebarsTemplateDelegate_2; }; /** Détruit les listeners et libère les ressources */ dispose(): void; } export declare type AltazionMarketingActionName = 'getItem' | 'getItems'; export declare type AltazionMarketingEventDetail = AltazionActionEventDetail<'marketing', AltazionMarketingActionName, TResult>; export declare type AltazionSessionActionName = 'getSession'; export declare type AltazionSessionEventDetail = AltazionActionEventDetail<'session', AltazionSessionActionName, TResult>; export declare type AltazionStoresActionName = 'findByLocation' | 'findByPostalCode' | 'getStore'; export declare type AltazionStoresEventDetail = AltazionActionEventDetail<'stores', AltazionStoresActionName, TResult>; export declare type AltazionSuccessEventKind = 'loaded' | 'updated' | 'changed' | 'none'; export declare interface AltazionTerminalModeConfig { /** Zones interactives à masquer en mode hors ligne. */ interactiveSelectors?: SelectorInput; /** Zones passives à afficher en mode hors ligne. */ offlineScreenSelectors?: SelectorInput; } export { Cart } declare type HandlebarsInstance = typeof default_2; declare type HandlebarsInstance_2 = typeof default_2; declare type HandlebarsInstance_3 = typeof default_2; declare type HandlebarsTemplateDelegate_2 = (context?: any) => string; export declare const init: typeof initAltazionHtmx; /** * Initialise le SDK HTMX Altazion. * * - Enregistre l'extension HTMX (headers contexte) si htmx est présent * - Enregistre les helpers Handlebars (prix, produits, panier) si hbs est fourni * - Active l'indicateur d'état offline sur le DOM * - Retourne les templates compilés * * @example * ```ts * import Handlebars from 'handlebars' * const sdk = init({ client, handlebars: Handlebars }) * const html = sdk.templates.productCard(product) * document.getElementById('product')!.innerHTML = html * ``` */ export declare function initAltazionHtmx(config: AltazionHtmxConfig): AltazionHtmxInstance; export declare const registerAltazionAuthExtension: typeof registerAltazionExtension; /** * Extension HTMX Altazion. * * - Ajoute les headers de contexte Altazion sur les requêtes HTMX * - Interprète les attributs `hx-altazion-cart-action`, `hx-altazion-session-action`, * `hx-altazion-marketing-action`, `hx-altazion-payments-action` et `hx-altazion-stores-action` * pour appeler le SDK core * - Émet des événements DOM `altazion:cart:*`, `altazion:session:*`, * `altazion:marketing:*`, `altazion:payments:*` et `altazion:stores:*` * exploitables par HTMX */ export declare function registerAltazionExtension(client: CommerceClient_2): AltazionExtensionHandle; /** * Helpers Handlebars liés au panier. * * Nécessite un getter réactif sur le panier actuel. * Usage : * Nombre d'articles : {{cartCount}} * Total : {{cartTotal}} * {{#if cartHasItems}} ... {{/if}} */ export declare function registerCartHelpers(hbs: HandlebarsInstance_3, getCart: () => Cart_2 | null, defaults: { locale: string; currency: string; }): void; /** * Formate un montant selon la locale et la devise. * Usage : {{formatPrice 19.99 "EUR" "fr-FR"}} * Si locale/currency sont omis, utilise les valeurs passées au registre. */ export declare function registerPriceHelpers(hbs: HandlebarsInstance, defaults: { locale: string; currency: string; }): void; /** * Helpers Handlebars liés aux produits. * * Usage : * {{productUrl reference}} * {{thumbnailUrl imageUrl 400}} * {{#if (isAvailable availability)}} ... {{/if}} */ export declare function registerProductHelpers(hbs: HandlebarsInstance_2, siteUrl: string): void; declare type SelectorInput = string | string[]; export { } declare global { interface Window { htmx?: { on(eventName: string, listener: (event: Event) => void): void; off(eventName: string, listener: (event: Event) => void): void; ajax(method: string, path: string, context?: { source?: Element; target?: Element | string; swap?: string; select?: string; values?: Record; }): Promise | void; }; } }