import type { ListLoyaltyProgramPointHistoryQueryParams, SaveCustomerFormDataInput, UseLoyaltyPointsQueryParams } from "../../../storefront-api/src"; import { APIResponse } from "../../../storefront-api-client/src"; import { AccountInfoForm, AddressForm, ContactForm, CouponCodeForm, DeactivateCustomerForm, ForgotPasswordForm, IkasContactForm, IkasCustomer, IkasCustomerAddress, IkasCustomerAttributeValue, IkasCustomerReviewForm, IkasFavoriteProduct, IkasOrder, IkasOrderTransaction, IkasProduct, IkasProductFile, LoginForm, NewsletterSubscriptionForm, OrderTrackingForm, RecoverPasswordForm, RegisterForm, SmsLoginForm, VerifyPhoneNumberForm } from "../../../storefront-models/src"; import { IkasCustomerStore } from "../../../stores/customer"; import { IkasLoginError, IkasRegisterError } from "../../api/customer"; export type SocialLoginProvider = "facebook" | "google" | "twitch" | "miles_smiles"; /** * Initialize the customer store by loading tokens, refreshing authentication, and fetching customer data. * * @ai-category Customer, Authentication * @ai-related waitForCustomerStoreInit, hasCustomer, logout * * @param customerStore - The customer store instance * @returns Promise that resolves when initialization is complete * * @example * ```typescript * import { customerStore, initCustomerStore } from "@ikas/bp-storefront"; * * async function bootstrap() { * await initCustomerStore(customerStore); * console.log("Customer store initialized"); * } * ``` */ export declare function initCustomerStore(customerStore: IkasCustomerStore): Promise; /** * The already-restored session of another store instance, as plain data. `null` means that * instance settled as a guest (or failed) — the seeded store then settles as a guest too. */ export type CustomerSessionSnapshot = { customer: IkasCustomer; favoriteProducts?: IkasFavoriteProduct[]; } | null; /** * Initialize the customer store from a session another store instance already restored, instead * of restoring it again. A page can run two copies of this SDK (a host theme and an embedded * component bundle); both share one localStorage session, so letting each copy run * `initCustomerStore` duplicates the refresh-token and get-customer requests and double-counts * the visit analytics event. The copy that restored the session hands its result over as plain * data; this seeds the other copy with no network traffic at all. * * The token is still read from localStorage rather than taken from the snapshot: the restoring * copy's refresh already persisted the rotated token there, and `loadToken` also wires it into * this copy's API client config. * * `requiredCustomerFields` is the version-skew escape hatch. The snapshot's customer was fetched * by the OTHER copy's get-customer query, which froze when that copy was built — so a snapshot * from a much older copy can lack fields this copy's components rely on. Keys are checked for * PRESENCE (`in`), not truthiness: a field the query asked for arrives even when null. When one * is missing, this copy runs its own customer fetch — one request, and only against stale peers; * an up-to-date peer's snapshot carries every key and stays at zero. If that fetch fails, the * partially seeded customer is kept: stale data a page can render beats none. */ export declare function seedCustomerSession(customerStore: IkasCustomerStore, snapshot: CustomerSessionSnapshot, requiredCustomerFields?: string[]): Promise; /** * Reset this store's session state locally — no network, no analytics, no cart mutation. This is * NOT `logout` (which revokes the session and fires the logout side effects); it is for the other * SDK copy on the page, whose `logout` already did all of that, to bring this copy in line. * Idempotent, and safe to call on a store that never held a session. */ export declare function clearCustomerSession(customerStore: IkasCustomerStore): void; /** * Check whether a customer is eligible to create an email subscription. * * @ai-category Customer, Registration * @ai-related createEmailSubscription, getNewsletterSubscriptionForm * * @param customerStore - The customer store instance * @returns True if the customer can create an email subscription, false otherwise * * @example * ```typescript * import { customerStore, canCustomerCreateEmailSubscription } from "@ikas/bp-storefront"; * * function NewsletterBanner() { * const canSubscribe = canCustomerCreateEmailSubscription(customerStore); * if (!canSubscribe) return null; * * return
Subscribe to our newsletter!
; * } * ``` */ export declare function canCustomerCreateEmailSubscription(customerStore: IkasCustomerStore): boolean; /** * Convert the current customer data to an analytics-compatible customer object, including consent status. * * @ai-category Customer * @ai-related hasCustomer, getCustomerConsentGranted * * @param customerStore - The customer store instance * @returns An analytics customer object with consent information * * @example * ```typescript * import { customerStore, customerToAnalyticsCustomer } from "@ikas/bp-storefront"; * * function trackEvent() { * const analyticsCustomer = customerToAnalyticsCustomer(customerStore); * sendAnalyticsEvent("page_view", { customer: analyticsCustomer }); * } * ``` */ export declare function customerToAnalyticsCustomer(customerStore: IkasCustomerStore): any; /** * Initiate social login (OAuth) with a provider. * Redirects user to the provider's login page. * * @ai-category Customer * @ai-related handleSocialLogin, customerLogin * * @param customerStore - The customer store instance * @param provider - The social login provider ("facebook", "google", or "twitch") * * @example * ```typescript * import { customerStore, socialLogin } from "@ikas/bp-storefront"; * * function SocialLoginButtons() { * return ( *
* * *
* ); * } * ``` */ export declare function socialLogin(customerStore: IkasCustomerStore, provider: SocialLoginProvider): Promise; /** * Handle the social login callback after OAuth redirect. * Call this on your login page to complete social authentication. * * @ai-category Customer * @ai-related socialLogin, customerLogin * * @param customerStore - The customer store instance * @returns Object with status ("success" or "fail") and optional message * * @example * ```typescript * import { customerStore, handleSocialLogin } from "@ikas/bp-storefront"; * import { useEffect, useState } from "react"; * * function LoginPage() { * const [error, setError] = useState(null); * * useEffect(() => { * async function checkSocialLogin() { * const result = await handleSocialLogin(customerStore); * if (result.status === "success") { * // Redirect to account page * Router.navigateToPage("ACCOUNT"); * } else if (result.message) { * setError(result.message); * } * } * checkSocialLogin(); * }, []); * * return error ?

{error}

: null; * } * ``` */ export declare function handleSocialLogin(customerStore: IkasCustomerStore): Promise; /** * Complete social login authentication using a token received from the OAuth provider callback. * * @ai-category Customer, Authentication, Login * @ai-related socialLogin, handleSocialLogin, customerLogin * * @param customerStore - The customer store instance * @param token - The social login token from the OAuth callback * @returns True if login was successful, false otherwise * * @example * ```typescript * import { customerStore, socialLoginToken } from "@ikas/bp-storefront"; * * async function completeSocialAuth(token: string) { * const success = await socialLoginToken(customerStore, token); * if (success) { * Router.navigateToPage("ACCOUNT"); * } else { * showToast("Social login failed"); * } * } * ``` */ export declare function socialLoginToken(customerStore: IkasCustomerStore, token: string): Promise; /** * Delete a customer address from their address list. * * @ai-category Customer, Address * @ai-related saveCustomer, getEmptyAddressForm * * @param customerStore - The customer store instance * @param address - The address object to delete * @returns True if the address was successfully deleted, false otherwise * * @example * ```typescript * import { customerStore, deleteCustomerAddress } from "@ikas/bp-storefront"; * import { IkasCustomerAddress } from "@ikas/bp-storefront"; * * async function handleDeleteAddress(address: IkasCustomerAddress) { * const success = await deleteCustomerAddress(customerStore, address); * if (success) { * showToast("Address deleted"); * } else { * showToast("Failed to delete address"); * } * } * ``` */ export declare function deleteCustomerAddress(customerStore: IkasCustomerStore, address: IkasCustomerAddress): Promise; /** * Submit a refund request for an order based on the refund quantities set on each line item. * * @ai-category Customer * @ai-related getOrder, getOrders, getOrderRefundSettings * * @param customerStore - The customer store instance * @param order - The order to request a refund for * @param email - Optional email address for guest order refunds * @returns True if the refund request was successfully submitted, false otherwise * * @example * ```typescript * import { customerStore, refundOrder, getOrder } from "@ikas/bp-storefront"; * * async function handleRefundRequest(orderId: string) { * const order = await getOrder(customerStore, orderId); * if (!order) return; * * const success = await refundOrder(customerStore, order); * if (success) { * showToast("Refund request submitted"); * } else { * showToast("Refund request failed"); * } * } * ``` */ export declare function refundOrder(customerStore: IkasCustomerStore, order: IkasOrder, email?: string | null): Promise; /** * Login a customer with email/password or phone. * * @ai-category Customer * @ai-related logout, socialLogin, getLoginForm * * @param customerStore - The customer store instance * @param email - Customer email address * @param password - Customer password * @param phone - Optional phone number for SMS login * @returns Object with isSuccess flag and errorCodes array * * @example * ```typescript * import { customerStore, customerLogin, getLoginForm } from "@ikas/bp-storefront"; * * async function handleLogin() { * const form = getLoginForm(customerStore); * * const result = await customerLogin( * customerStore, * form.email.value, * form.password.value * ); * * if (result.isSuccess) { * Router.navigateToPage("ACCOUNT"); * } else { * // Handle errors * if (result.errorCodes.includes("WRONG_PASSWORD")) { * showToast("Invalid password"); * } else if (result.errorCodes.includes("CUSTOMER_NOT_FOUND")) { * showToast("Email not found"); * } * } * } * ``` */ export declare function customerLogin(customerStore: IkasCustomerStore, email?: string, password?: string, phone?: string): Promise<{ isSuccess: boolean; errorCodes: IkasLoginError[]; otpSend: boolean | null; flowId: string | null; } | { isSuccess: boolean; errorCodes: IkasLoginError[]; otpSend?: undefined; flowId?: undefined; }>; /** * Logout the current customer. * Clears customer data, tokens, and cart. * * @ai-category Customer * @ai-related customerLogin, hasCustomer * * @param customerStore - The customer store instance * * @example * ```typescript * import { customerStore, logout } from "@ikas/bp-storefront"; * * async function handleLogout() { * await logout(customerStore); * Router.navigateToPage("INDEX"); * showToast("You have been logged out"); * } * ``` */ export declare function logout(customerStore: IkasCustomerStore): Promise; /** * Register a new customer account with the provided details. * * @ai-category Customer, Registration * @ai-related customerLogin, getRegisterForm, activateCustomer * * @param customerStore - The customer store instance * @param firstName - Customer's first name * @param lastName - Customer's last name * @param email - Customer's email address * @param password - Optional password for the account * @param isMarketingAccepted - Whether the customer accepts marketing communications * @param attributes - Optional custom customer attributes * @param phone - Optional phone number * @param flowId - Optional flow ID for multi-step registration * @returns Object with isSuccess flag and errorCodes array * * @example * ```typescript * import { customerStore, register, getRegisterForm } from "@ikas/bp-storefront"; * * async function handleRegister() { * const form = getRegisterForm(customerStore); * const result = await register( * customerStore, * form.firstName.value, * form.lastName.value, * form.email.value, * form.password.value, * form.isMarketingAccepted.value * ); * * if (result.isSuccess) { * Router.navigateToPage("ACCOUNT"); * } else { * console.error("Registration errors:", result.errorCodes); * } * } * ``` */ export declare function register(customerStore: IkasCustomerStore, firstName: string, lastName: string, email: string, password?: string, isMarketingAccepted?: boolean, attributes?: IkasCustomerAttributeValue[], phone?: string | null, flowId?: string | null): Promise<{ isSuccess: boolean; errorCodes: IkasRegisterError[]; }>; /** * Activate a customer account using the activation token from the URL query parameters. * * @ai-category Customer, Registration * @ai-related register, resendCustomerActivationMail * * @param customerStore - The customer store instance * @returns True if the customer was successfully activated, false otherwise * * @example * ```typescript * import { customerStore, activateCustomer } from "@ikas/bp-storefront"; * * async function ActivationPage() { * const isActivated = await activateCustomer(customerStore); * if (isActivated) { * showToast("Your account has been activated!"); * Router.navigateToPage("LOGIN"); * } else { * showToast("Activation failed. Please try again."); * } * } * ``` */ export declare function activateCustomer(customerStore: IkasCustomerStore): Promise; /** * Resend the customer account activation email. * * @ai-category Customer, Registration * @ai-related activateCustomer, register * * @param customerStore - The customer store instance * @param email - The email address to resend the activation mail to * @returns True if the activation email was successfully resent, false otherwise * * @example * ```typescript * import { customerStore, resendCustomerActivationMail } from "@ikas/bp-storefront"; * * async function handleResendActivation(email: string) { * const success = await resendCustomerActivationMail(customerStore, email); * if (success) { * showToast("Activation email sent. Check your inbox."); * } else { * showToast("Failed to send activation email."); * } * } * ``` */ export declare function resendCustomerActivationMail(customerStore: IkasCustomerStore, email: string): Promise; /** * Validate a phone verification code submitted by the customer. * * @ai-category Customer, PhoneVerification * @ai-related resendCustomerPhoneVerificationCode, getVerifyPhoneNumberForm * * @param customerStore - The customer store instance * @param verificationCode - The verification code entered by the customer * @param otpInfo - Optional OTP info string for the verification flow * @returns Verification result data if successful, false otherwise * * @example * ```typescript * import { customerStore, validateCustomerPhoneVerificationCode } from "@ikas/bp-storefront"; * * async function handleVerifyPhone(code: string) { * const result = await validateCustomerPhoneVerificationCode(customerStore, code); * if (result) { * showToast("Phone number verified!"); * } else { * showToast("Invalid verification code."); * } * } * ``` */ export declare function validateCustomerPhoneVerificationCode(customerStore: IkasCustomerStore, verificationCode: string, otpInfo?: string | null): Promise; /** * Validate a one-time password (OTP) code during registration or login flows. * * @ai-category Customer, Authentication, PhoneVerification * @ai-related validateCustomerPhoneVerificationCode, register, customerLogin * * @param customerStore - The customer store instance * @param verificationCode - The OTP code entered by the customer * @param otpInfo - Optional OTP info string for the verification flow * @returns Object with isSuccess flag, optional otpSend/flowId, and errorCodes array * * @example * ```typescript * import { customerStore, validateOTPCode } from "@ikas/bp-storefront"; * * async function handleOTPValidation(code: string, otpInfo: string) { * const result = await validateOTPCode(customerStore, code, otpInfo); * if (result.isSuccess && !result.otpSend) { * Router.navigateToPage("ACCOUNT"); * } else if (result.isSuccess && result.otpSend) { * showToast("Additional verification required"); * } else { * console.error("OTP errors:", result.errorCodes); * } * } * ``` */ export declare function validateOTPCode(customerStore: IkasCustomerStore, verificationCode: string, otpInfo?: string | null): Promise<{ isSuccess: boolean; errorCodes: IkasRegisterError[]; otpSend?: undefined; flowId?: undefined; } | { isSuccess: boolean; otpSend: boolean; flowId: string | null; errorCodes: IkasRegisterError[]; }>; /** * Resend the phone verification code to the customer's phone number. * * @ai-category Customer, PhoneVerification * @ai-related validateCustomerPhoneVerificationCode, getVerifyPhoneNumberForm * * @param customerStore - The customer store instance * @returns Verification data if successfully resent, false otherwise * * @example * ```typescript * import { customerStore, resendCustomerPhoneVerificationCode } from "@ikas/bp-storefront"; * * async function handleResendCode() { * const result = await resendCustomerPhoneVerificationCode(customerStore); * if (result) { * showToast("Verification code resent"); * } else { * showToast("Failed to resend code"); * } * } * ``` */ export declare function resendCustomerPhoneVerificationCode(customerStore: IkasCustomerStore): Promise; /** * Submit a contact form to the merchant, triggering analytics and captcha verification. * * @ai-category Customer * @ai-related getContactForm, clearContactForm * * @param customerStore - The customer store instance * @param input - The contact form data to submit * @returns True if the contact form was successfully sent, false otherwise * * @example * ```typescript * import { customerStore, saveContactForm, getContactForm } from "@ikas/bp-storefront"; * * async function handleContactSubmit() { * const form = getContactForm(customerStore); * const success = await saveContactForm(customerStore, { * name: form.name.value, * email: form.email.value, * message: form.message.value, * }); * if (success) { * showToast("Message sent!"); * } * } * ``` */ export declare function saveContactForm(customerStore: IkasCustomerStore, input: IkasContactForm): Promise; /** * Check whether an email address is already registered in the system. * * @ai-category Customer, Authentication * @ai-related register, customerLogin * * @param customerStore - The customer store instance * @param email - The email address to check * @returns True if the email already exists, false otherwise * * @example * ```typescript * import { customerStore, checkEmail } from "@ikas/bp-storefront"; * * async function handleEmailCheck(email: string) { * const exists = await checkEmail(customerStore, email); * if (exists) { * showToast("This email is already registered. Please login."); * } * } * ``` */ export declare function checkEmail(customerStore: IkasCustomerStore, email: string): Promise; /** * Send a forgot-password email to the customer so they can reset their password. * * @ai-category Customer, Password * @ai-related recoverPassword, getForgotPasswordForm * * @param customerStore - The customer store instance * @param email - The email address to send the password reset to * @returns The response data if successful, false otherwise * * @example * ```typescript * import { customerStore, forgotPassword, getForgotPasswordForm } from "@ikas/bp-storefront"; * * async function handleForgotPassword() { * const form = getForgotPasswordForm(customerStore); * const result = await forgotPassword(customerStore, form.email.value); * if (result) { * showToast("Password reset email sent!"); * } else { * showToast("Failed to send password reset email."); * } * } * ``` */ export declare function forgotPassword(customerStore: IkasCustomerStore, email: string): Promise; /** * Recover (reset) the customer's password using a token from the forgot-password email. * * @ai-category Customer, Password * @ai-related forgotPassword, getRecoverPasswordForm * * @param customerStore - The customer store instance * @param password - The new password * @param passwordAgain - The new password confirmation * @param token - The password recovery token from the email link * @returns True if the password was successfully reset, false otherwise * * @example * ```typescript * import { customerStore, recoverPassword, getRecoverPasswordForm } from "@ikas/bp-storefront"; * * async function handleRecoverPassword(token: string) { * const form = getRecoverPasswordForm(customerStore); * const success = await recoverPassword( * customerStore, * form.password.value, * form.passwordAgain.value, * token * ); * if (success) { * showToast("Password reset successfully!"); * Router.navigateToPage("LOGIN"); * } * } * ``` */ export declare function recoverPassword(customerStore: IkasCustomerStore, password: string, passwordAgain: string, token: string): Promise; /** * Save (update) the customer's profile data including addresses, attributes, and personal information. * * @ai-category Customer, Account * @ai-related deleteCustomerAddress, getAccountInfoForm, hasCustomer * * @param customerStore - The customer store instance * @param customer - The customer object with updated data to save * @returns True if the customer was successfully saved, false otherwise * * @example * ```typescript * import { customerStore, saveCustomer } from "@ikas/bp-storefront"; * * async function handleSaveProfile() { * const customer = { ...customerStore.customer! }; * customer.firstName = "Jane"; * customer.lastName = "Doe"; * * const success = await saveCustomer(customerStore, customer); * if (success) { * showToast("Profile updated!"); * } * } * ``` */ export declare function saveCustomer(customerStore: IkasCustomerStore, customer: IkasCustomer): Promise; /** * Get the customer's order history. * * @ai-category Customer * @ai-related getOrder, waitForCustomerStoreInit * * @param customerStore - The customer store instance * @returns Array of customer orders * * @example * ```typescript * import { customerStore, getOrders, waitForCustomerStoreInit } from "@ikas/bp-storefront"; * * async function loadOrderHistory() { * await waitForCustomerStoreInit(customerStore); * * if (!customerStore.customer) { * Router.navigateToPage("LOGIN"); * return []; * } * * const orders = await getOrders(customerStore); * return orders; * } * ``` */ export declare function getOrders(customerStore: IkasCustomerStore): Promise; /** * Get a specific order by ID. * * @ai-category Customer * @ai-related getOrders, getOrderByEmail * * @param customerStore - The customer store instance * @param id - The order ID * @returns The order object, or null if not found * * @example * ```typescript * import { customerStore, getOrder } from "@ikas/bp-storefront"; * * async function loadOrderDetail(orderId: string) { * const order = await getOrder(customerStore, orderId); * * if (!order) { * showToast("Order not found"); * return null; * } * * return order; * } * ``` */ export declare function getOrder(customerStore: IkasCustomerStore, id: string): Promise; /** * Get an order by email and order number, for guest order tracking. * * @ai-category Customer * @ai-related getOrder, getOrders, getOrderTrackingForm * * @param customerStore - The customer store instance * @param email - The email address used for the order * @param orderNumber - The order number to look up * @returns The order object if found, or null * * @example * ```typescript * import { customerStore, getOrderByEmail, getOrderTrackingForm } from "@ikas/bp-storefront"; * * async function handleOrderTracking() { * const form = getOrderTrackingForm(customerStore); * const order = await getOrderByEmail( * customerStore, * form.email.value, * form.orderNumber.value * ); * if (order) { * displayOrderDetails(order); * } else { * showToast("Order not found"); * } * } * ``` */ export declare function getOrderByEmail(customerStore: IkasCustomerStore, email: string, orderNumber: string): Promise; /** * Retrieve payment transactions for an order, checkout, or transaction ID. * * @ai-category Customer * @ai-related getOrder, getOrderByEmail * * @param customerStore - The customer store instance * @param params - Filter parameters containing orderId, checkoutId, or id * @returns Array of order transactions * * @example * ```typescript * import { customerStore, getOrderTransactions } from "@ikas/bp-storefront"; * * async function loadTransactions(orderId: string) { * const transactions = await getOrderTransactions(customerStore, { orderId }); * transactions.forEach(tx => { * console.log(tx.id, tx.amount); * }); * } * ``` */ export declare function getOrderTransactions(customerStore: IkasCustomerStore, params?: GetOrderTransactionParams): Promise; /** * Get the list of favorite product IDs for the current customer. * * @ai-category Customer, ProductList * @ai-related getFavoriteProducts, addProductToFavorites, isFavoriteProduct * * @param customerStore - The customer store instance * @returns Array of favorite product objects with product IDs * * @example * ```typescript * import { customerStore, getFavoriteProductsIds } from "@ikas/bp-storefront"; * * async function loadFavoriteIds() { * const favorites = await getFavoriteProductsIds(customerStore); * const productIds = favorites.map(f => f.productId); * console.log("Favorite product IDs:", productIds); * } * ``` */ export declare function getFavoriteProductsIds(customerStore: IkasCustomerStore): Promise; /** * Get the customer's favorite/wishlist products. * * @ai-category Customer, ProductList * @ai-related addProductToFavorites, removeProductFromFavorites, isFavoriteProduct * * @param customerStore - The customer store instance * @returns Array of favorite products * * @example * ```typescript * import { customerStore, getFavoriteProducts } from "@ikas/bp-storefront"; * * async function loadWishlist() { * const favorites = await getFavoriteProducts(customerStore); * * if (favorites.length === 0) { * return

Your wishlist is empty

; * } * * return favorites.map(product => ( * * )); * } * ``` */ export declare function getFavoriteProducts(customerStore: IkasCustomerStore): Promise; /** * Add a product to customer's favorites/wishlist. * Requires customer to be logged in. * * @ai-category Customer, ProductList * @ai-related getFavoriteProducts, removeProductFromFavorites, isFavoriteProduct * * @param customerStore - The customer store instance * @param productId - The product ID to add * @returns True if successful * * @example * ```typescript * import { customerStore, addProductToFavorites } from "@ikas/bp-storefront"; * import { IkasProduct } from "@ikas/bp-storefront"; * * async function handleAddToWishlist(product: IkasProduct) { * if (!customerStore.customer) { * Router.navigateToPage("LOGIN"); * return; * } * * await addProductToFavorites(customerStore, product.id); * showToast("Added to wishlist!"); * } * ``` */ export declare function addProductToFavorites(customerStore: IkasCustomerStore, productId: string): Promise; /** * Remove a product from customer's favorites/wishlist. * * @ai-category Customer, ProductList * @ai-related getFavoriteProducts, addProductToFavorites, isFavoriteProduct * * @param customerStore - The customer store instance * @param productId - The product ID to remove * @returns True if successful * * @example * ```typescript * import { customerStore, removeProductFromFavorites } from "@ikas/bp-storefront"; * * async function handleRemoveFromWishlist(productId: string) { * await removeProductFromFavorites(customerStore, productId); * showToast("Removed from wishlist"); * } * ``` */ export declare function removeProductFromFavorites(customerStore: IkasCustomerStore, productId: string): Promise; /** * Check if a product is in the customer's favorites list. * * @ai-category Customer, ProductList * @ai-related addProductToFavorites, removeProductFromFavorites * * @param customerStore - The customer store instance * @param productId - The product ID to check * @returns True if product is in favorites * * @example * ```typescript * import { customerStore, isFavoriteProduct } from "@ikas/bp-storefront"; * * function FavoriteIcon({ productId }: { productId: string }) { * const isFavorite = isFavoriteProduct(customerStore, productId); * * return ( * * ♥ * * ); * } * ``` */ export declare function isFavoriteProduct(customerStore: IkasCustomerStore, productId: string): Promise; /** * Create a marketing email subscription for the given email address. * * @ai-category Customer, Registration * @ai-related canCustomerCreateEmailSubscription, getNewsletterSubscriptionForm, saveCustomerFormData * * @param customerStore - The customer store instance * @param email - The email address to subscribe * @returns The API response object * * @example * ```typescript * import { customerStore, createEmailSubscription } from "@ikas/bp-storefront"; * * async function handleSubscribe(email: string) { * const response = await createEmailSubscription(customerStore, email); * if (response.isSuccess) { * showToast("Subscribed to newsletter!"); * } * } * ``` */ export declare function createEmailSubscription(customerStore: IkasCustomerStore, email: string): Promise | APIResponse>; /** * Save customer form data (e.g., newsletter subscription form) and trigger analytics events. * * @ai-category Customer, Registration * @ai-related createEmailSubscription, canCustomerCreateEmailSubscription * * @param customerStore - The customer store instance * @param input - The form data input to save * @returns True if the form data was successfully saved, false otherwise * * @example * ```typescript * import { customerStore, saveCustomerFormData } from "@ikas/bp-storefront"; * * async function handleFormSubmit(formData: SaveCustomerFormDataInput) { * const success = await saveCustomerFormData(customerStore, formData); * if (success) { * showToast("Form submitted successfully!"); * } * } * ``` */ export declare function saveCustomerFormData(customerStore: IkasCustomerStore, input: SaveCustomerFormDataInput): Promise; /** * Submit a product review from the customer. * * @ai-category Customer * @ai-related hasCustomer, getOrder * * @param customerStore - The customer store instance * @param input - The review form data including rating and comment * @returns The created review data, or undefined if review settings are not configured * * @example * ```typescript * import { customerStore, sendReview } from "@ikas/bp-storefront"; * * async function handleSubmitReview(productId: string, rating: number, comment: string) { * const result = await sendReview(customerStore, { * productId, * rating, * body: comment, * author: customerStore.customer?.firstName || "Anonymous", * }); * if (result) { * showToast("Review submitted!"); * } * } * ``` */ export declare function sendReview(customerStore: IkasCustomerStore, input: IkasCustomerReviewForm): Promise; /** * Deactivate (delete) the current customer's account after password verification. * * @ai-category Customer, Account * @ai-related hasCustomer, logout, getDeactivateCustomerForm * * @param customerStore - The customer store instance * @param password - The customer's current password for verification * @returns The API response, or undefined if no customer is logged in * * @example * ```typescript * import { customerStore, deactivateCustomer, logout } from "@ikas/bp-storefront"; * * async function handleDeleteAccount(password: string) { * const result = await deactivateCustomer(customerStore, password); * if (result?.isSuccess) { * await logout(customerStore); * showToast("Account deleted successfully"); * Router.navigateToPage("INDEX"); * } * } * ``` */ export declare function deactivateCustomer(customerStore: IkasCustomerStore, password: string): Promise | APIResponse | undefined>; /** * Export the current customer's personal data (GDPR data export). * * @ai-category Customer, Account * @ai-related hasCustomer, deactivateCustomer * * @param customerStore - The customer store instance * @returns The API response with exported data, or undefined if no customer is logged in * * @example * ```typescript * import { customerStore, exportCustomerPersonalData } from "@ikas/bp-storefront"; * * async function handleExportData() { * const result = await exportCustomerPersonalData(customerStore); * if (result?.isSuccess) { * showToast("Your data export has been sent to your email"); * } * } * ``` */ export declare function exportCustomerPersonalData(customerStore: IkasCustomerStore): Promise | APIResponse | undefined>; /** * Handle the customer granting consent (e.g., cookie/data consent) and persist it locally. * * @ai-category Customer * @ai-related getCustomerConsentGranted, removeCustomerConsent * * @param customerStore - The customer store instance * * @example * ```typescript * import { customerStore, handleCustomerConsentGrant } from "@ikas/bp-storefront"; * * function ConsentBanner() { * return ( *
*

We use cookies to improve your experience.

* *
* ); * } * ``` */ export declare function handleCustomerConsentGrant(customerStore: IkasCustomerStore): void; /** * Wait for customer store to finish initialization. * Use this before checking customer.customer to ensure data is loaded. * * @ai-category Customer * @ai-related hasCustomer, getOrders * * @param customerStore - The customer store instance * @returns Promise that resolves when customer store is initialized * * @example * ```typescript * import { customerStore, waitForCustomerStoreInit } from "@ikas/bp-storefront"; * * async function initializePage() { * await waitForCustomerStoreInit(customerStore); * * if (customerStore.customer) { * // Customer is logged in * console.log("Welcome,", customerStore.customer.firstName); * } else { * // Not logged in * Router.navigateToPage("LOGIN"); * } * } * ``` */ export declare function waitForCustomerStoreInit(customerStore: IkasCustomerStore): Promise; /** * Wait for the captcha token to be initialized before proceeding with captcha-protected operations. * * @ai-category Customer, Authentication * @ai-related setCaptchaToken * * @param customerStore - The customer store instance * @returns Promise that resolves when the captcha token is available * * @example * ```typescript * import { customerStore, waitForCaptchaTokenInit } from "@ikas/bp-storefront"; * * async function ensureCaptchaReady() { * await waitForCaptchaTokenInit(customerStore); * console.log("Captcha token is ready"); * } * ``` */ export declare function waitForCaptchaTokenInit(customerStore: IkasCustomerStore): Promise; /** * Fetch and resolve all custom customer attributes, linking attribute values to their definitions and options. * * @ai-category Customer, Account * @ai-related saveCustomer, hasCustomer * * @param customerStore - The customer store instance * @returns Array of customer attribute definitions * * @example * ```typescript * import { customerStore, getCustomerAttributes } from "@ikas/bp-storefront"; * * async function loadCustomerProfile() { * const attributes = await getCustomerAttributes(customerStore); * attributes.forEach(attr => { * console.log(attr.name, attr.type); * }); * } * ``` */ export declare function getCustomerAttributes(customerStore: IkasCustomerStore): Promise; /** * Get digital product files associated with an order by their file IDs. * * @ai-category Customer * @ai-related getDigitalProductFileDownloadUrl, getOrder * * @param customerStore - The customer store instance * @param fileIds - Array of product file IDs to retrieve * @returns Array of product file objects * * @example * ```typescript * import { customerStore, getOrderProductFiles } from "@ikas/bp-storefront"; * * async function loadDigitalFiles(fileIds: string[]) { * const files = await getOrderProductFiles(customerStore, fileIds); * files.forEach(file => { * console.log(file.name, file.variantId); * }); * } * ``` */ export declare function getOrderProductFiles(customerStore: IkasCustomerStore, fileIds: string[]): Promise; /** * Download a digital product file by fetching its download URL and triggering a browser download. * * @ai-category Customer * @ai-related getOrderProductFiles, getOrder * * @param customerStore - The customer store instance * @param order - The order containing the digital product * @param productFile - The product file to download * * @example * ```typescript * import { customerStore, getDigitalProductFileDownloadUrl } from "@ikas/bp-storefront"; * import { IkasOrder, IkasProductFile } from "@ikas/bp-storefront"; * * async function handleDownload(order: IkasOrder, file: IkasProductFile) { * await getDigitalProductFileDownloadUrl(customerStore, order, file); * // Download is triggered automatically in the browser * } * ``` */ export declare function getDigitalProductFileDownloadUrl(customerStore: IkasCustomerStore, order: IkasOrder, productFile: IkasProductFile): Promise; /** * Fetch and cache the order refund settings for the store. * * @ai-category Customer * @ai-related refundOrder, getOrder * * @param customerStore - The customer store instance * * @example * ```typescript * import { customerStore, getOrderRefundSettings } from "@ikas/bp-storefront"; * * async function loadRefundPolicy() { * await getOrderRefundSettings(customerStore); * const settings = customerStore._refundSettings; * if (settings) { * console.log("Refund settings loaded"); * } * } * ``` */ export declare function getOrderRefundSettings(customerStore: IkasCustomerStore): Promise; /** * Set the captcha token on the customer store, typically called from a captcha widget callback. * * @ai-category Customer, Authentication * @ai-related waitForCaptchaTokenInit * * @param customerStore - The customer store instance * @param token - The captcha token string from the captcha widget * * @example * ```typescript * import { customerStore, setCaptchaToken } from "@ikas/bp-storefront"; * * function onCaptchaVerified(token: string) { * setCaptchaToken(customerStore, token); * } * ``` */ export declare function setCaptchaToken(customerStore: IkasCustomerStore, token: string): void; /** * Store the last viewed products snapshot and its API response for caching purposes. * * @ai-category Customer * @ai-related getLastViewedProducts, customerStore_onProductView * * @param customerStore - The customer store instance * @param response - The API response containing last viewed products data * * @example * ```typescript * import { customerStore, setSavedLastViewedProductsResponse } from "@ikas/bp-storefront"; * * function cacheViewedProducts(response: APIResponse) { * setSavedLastViewedProductsResponse(customerStore, response); * } * ``` */ export declare function setSavedLastViewedProductsResponse(customerStore: IkasCustomerStore, response: APIResponse): void; /** * Get the list of last viewed products for the customer, fetching from API for logged-in users or local storage for guests. * * @ai-category Customer * @ai-related customerStore_onProductView, setSavedLastViewedProductsResponse * * @param customerStore - The customer store instance * @returns Array of last viewed product objects with productId and variantId * * @example * ```typescript * import { customerStore, getLastViewedProducts } from "@ikas/bp-storefront"; * * async function loadRecentlyViewed() { * const products = await getLastViewedProducts(customerStore); * products.forEach(p => { * console.log("Viewed product:", p.productId); * }); * } * ``` */ export declare function getLastViewedProducts(customerStore: IkasCustomerStore): Promise; /** * Record a product view event, saving it to the API for logged-in users or local storage for guests. * * @ai-category Customer * @ai-related getLastViewedProducts, setSavedLastViewedProductsResponse * * @param customerStore - The customer store instance * @param productId - The viewed product's ID * @param variantId - The viewed product variant's ID * * @example * ```typescript * import { customerStore, customerStore_onProductView } from "@ikas/bp-storefront"; * * function ProductPage({ productId, variantId }: { productId: string; variantId: string }) { * useEffect(() => { * customerStore_onProductView(customerStore, productId, variantId); * }, [productId, variantId]); * * return
Product Details
; * } * ``` */ export declare function customerStore_onProductView(customerStore: IkasCustomerStore, productId: string, variantId: string): Promise; /** * Check whether the customer has granted consent (e.g., cookie/data consent). * * @ai-category Customer * @ai-related handleCustomerConsentGrant, removeCustomerConsent * * @param customerStore - The customer store instance * @returns True if consent has been granted * * @example * ```typescript * import { customerStore, getCustomerConsentGranted } from "@ikas/bp-storefront"; * * function ConsentBanner() { * const hasConsent = getCustomerConsentGranted(customerStore); * if (hasConsent) return null; * * return
Please accept cookies to continue.
; * } * ``` */ export declare function getCustomerConsentGranted(customerStore: IkasCustomerStore): boolean; /** * Remove the customer's stored consent from local storage. * * @ai-category Customer * @ai-related getCustomerConsentGranted, handleCustomerConsentGrant * * @param customerStore - The customer store instance * * @example * ```typescript * import { customerStore, removeCustomerConsent } from "@ikas/bp-storefront"; * * function handleRevokeConsent() { * removeCustomerConsent(customerStore); * showToast("Consent revoked"); * } * ``` */ export declare function removeCustomerConsent(customerStore: IkasCustomerStore): void; export declare function cs_listEarningMethods(customerStore: IkasCustomerStore): Promise; export declare function cs_listSpendingMethodsByCartId(customerStore: IkasCustomerStore): Promise; export declare function cs_removeLoyaltyPointsFromCart(customerStore: IkasCustomerStore): Promise; export declare function cs_getLoyaltyCustomerInfo(customerStore: IkasCustomerStore): Promise; export declare function cs_listLoyaltyProgramTiers(customerStore: IkasCustomerStore): Promise; export declare function cs_listLoyaltyProgramPointHistory(customerStore: IkasCustomerStore, params: ListLoyaltyProgramPointHistoryQueryParams): Promise; export declare function cs_useLoyaltyPoints(customerStore: IkasCustomerStore, params: UseLoyaltyPointsQueryParams): Promise; /** * Check if a customer is currently logged in. * * @ai-category Customer * @ai-related waitForCustomerStoreInit, customerLogin, logout * * @param customerStore - The customer store instance * @returns True if customer is logged in * * @example * ```typescript * import { customerStore, hasCustomer } from "@ikas/bp-storefront"; * * function AuthButton() { * if (hasCustomer(customerStore)) { * return ; * } * return ; * } * ``` */ export declare function hasCustomer(customerStore: IkasCustomerStore): boolean; export type GetOrderTransactionParams = { checkoutId?: string; id?: string; orderId?: string; }; type HandleSocialLoginReturnType = { status?: "fail" | "success"; message?: string; }; /** * Get or initialize the account info form with validation for updating customer profile details. * * @ai-category Customer, Account * @ai-related clearAccountInfoForm, saveCustomer * * @param customerStore - The customer store instance * @returns The account info form object with validated fields * * @example * ```typescript * import { customerStore, getAccountInfoForm } from "@ikas/bp-storefront"; * * function AccountInfoPage() { * const form = getAccountInfoForm(customerStore); * * return ( *
* form.firstName.value = e.target.value} * /> * form.lastName.value = e.target.value} * /> *
* ); * } * ``` */ export declare function getAccountInfoForm(customerStore: IkasCustomerStore): AccountInfoForm; /** * Clear the cached account info form, forcing a fresh form on next retrieval. * * @ai-category Customer, Account * @ai-related getAccountInfoForm * * @param customerStore - The customer store instance * * @example * ```typescript * import { customerStore, clearAccountInfoForm } from "@ikas/bp-storefront"; * * function handleAccountInfoReset() { * clearAccountInfoForm(customerStore); * } * ``` */ export declare function clearAccountInfoForm(customerStore: IkasCustomerStore): void; /** * Get or initialize the contact form with validation for submitting messages to the merchant. * * @ai-category Customer * @ai-related clearContactForm, saveContactForm * * @param customerStore - The customer store instance * @returns The contact form object with validated fields * * @example * ```typescript * import { customerStore, getContactForm } from "@ikas/bp-storefront"; * * function ContactPage() { * const form = getContactForm(customerStore); * * return ( *
* form.name.value = e.target.value} * /> *