import { BareEventCallback, BNPLInfo, BnplPayload, CompletedBnplProvidersResponse, Environment, EvaluatedOffersList, Identifier, Language, Offer, OfferFlowPayload, OfferFlowPayloadBnpl, OfferPayload, PassportThemeConfig, PromotionOffersPayload, PublicEncryptionKey, PushClaimEventCallback, ShowPromotionOffers, UserProfile } from "./type"; import { PRODUCT_TYPE } from "./constants/global"; /** * Instantiates the SDK * @param apiKey - The org's apiKey * @param marketId - The org's ID * @param env - The development environment: "SANDBOX" or "PRODUCTION" * @param theme - The theme customization * */ declare const initialize: (env: Environment, apiKey: string, marketId: string, theme?: PassportThemeConfig) => void; /** * To add logic after bnpl payment complete * @param e - The event that will be executed after completeting BNPL payment */ declare const registerBNPLPaymentCompleteHandler: (e: BareEventCallback) => void; /** * Credify Login with OIDC Client set up URL */ declare const login: (setupUrl: string) => Promise; /** * Credify Login with Credify endpoint * This one is for debugging */ declare const loginWithCredify: (clientId: string, key?: Identifier) => Promise; /** * Begins offer flow * @param data - A payload that contains an offer fetched from getOffers API and profile containing user info * @param pushClaimTokenCB - A callback for an organization to push the user's claim tokens * * @deprecated Using `showOfferByCode()` instead */ declare const startOfferFlow: (data: OfferFlowPayload, pushClaimTokenCB?: PushClaimEventCallback) => void; /** * Begins offer flow * @param data - A payload that contains an `offerCode` that you want to show, profile containing user info and customization * theme(PassportThemeConfig object). The theme is optional. * @param pushClaimTokenCB - A callback for an organization to push the user's claim tokens */ declare const showOfferByCode: (data: OfferPayload, pushClaimTokenCB?: PushClaimEventCallback) => void; /** * Begins offer flow for BNPL * @param shouldRedirect - True: Redirect on the current url. False: open new window * @param data - A payload that contains an offer fetched from getOffers API and profile containing user info * @param pushClaimTokenCB - A callback for an organization to push the user's claim tokens * @param newWindow - New window in case * * @deprecated Using `showBnplByCodes()` instead */ declare const startOfferFlowBnpl: (shouldRedirect: boolean, data: OfferFlowPayloadBnpl, pushClaimTokenCB?: PushClaimEventCallback, newWindow?: Window) => void; /** * Begins offer flow for BNPL * @param shouldRedirect - True: Redirect on the current url. False: open new window * @param data - A payload that contains `offerCode` list/`productCode`(get from offer object), * profile containing user info and order info is required. * @param pushClaimTokenCB - A callback for an organization to push the user's claim tokens * @param newWindow - New window in case */ declare const showBnplByCodes: (shouldRedirect: boolean, data: BnplPayload, pushClaimTokenCB?: PushClaimEventCallback, newWindow?: Window) => void; interface WindowSize { width: number; height: number; top: number; left: number; systemZoom: number; } /** * Return meta data of new window that preparing to open * @returns `{ width, height, top, left, systemZoom }` */ declare const calculateResizeWindow: () => WindowSize; /** * A function to registerd window object before opening new window. To resolving issue for opening new popup on Safari */ declare const getPreparedWindowToOpen: () => Window | null; /** * Gets a list of offers after filtering for a specific user. * @param id - User ID in your service. * @param options - phoneNumber (e.g. 32123456789 - no 0 at the head), countryCode (e.g. +84 - needs +), credifyId (ID in Credify system). * @returns list of offers */ declare const getOffers: (id?: string, options?: { phoneNumber?: string; countryCode?: string; credifyId?: string; productTypes?: string[]; }, params?: { [key: string]: any; } | undefined) => Promise; /** * Gets a list of offers along with credifyId * @param id - User ID in your service. * @param options - phoneNumber (e.g. 32123456789 - no 0 at the head), countryCode (e.g. +84 - needs +), credifyId (ID in Credify system). * @returns list of offers */ declare const getEvaluatedOffers: (id?: string, options?: { phoneNumber?: string; countryCode?: string; credifyId?: string; }) => Promise; declare const getCompletedBnplProviders: (credifyId: string) => Promise; /** * Handle login for only clients with role market on proxy page * @param loginCallback - Code logic after login */ declare const proxyLogin: (loginCallback: BareEventCallback) => void; /** * If we want to handle events like refresh data when the redemption flow finishes, we need to set the call back here * @param cb - callback */ declare const setPassportCloseCallback: (cb: BareEventCallback) => void; /** * Redirect user to passport consent page to finish the redemption flow */ declare const redirectToConsentPage: () => void; declare const startServiceInstanceFlow: (marketId: string, userProfile?: UserProfile, productTypes?: PRODUCT_TYPE[]) => void; /** * Get bnpl information in bnpl flow * @param id user's id * @param options meta data from user profile * @returns result checking if bnpl flow is available, offer list, provider list * * @deprecated It'll be removed in the future. */ declare const getBNPLInfo: (id?: string, options?: { phoneNumber?: string; countryCode?: string; credifyId?: string; productTypes: string[]; }) => Promise; declare const getPublicEncryptionKey: () => Promise; /** * @deprecated Using `showPromotionOffersByCodes()` instead */ declare const showPromotionOffers: (props: ShowPromotionOffers, callBack: PushClaimEventCallback) => void; declare const showPromotionOffersByCodes: (props: PromotionOffersPayload, callBack: PushClaimEventCallback) => void; declare const setLanguage: (newLanguage: Language) => void; export { initialize, startOfferFlow, showOfferByCode, startOfferFlowBnpl, showBnplByCodes, getOffers, getCompletedBnplProviders, login, loginWithCredify, getEvaluatedOffers, proxyLogin, setPassportCloseCallback, redirectToConsentPage, registerBNPLPaymentCompleteHandler, calculateResizeWindow, getPreparedWindowToOpen, getBNPLInfo, startServiceInstanceFlow, PRODUCT_TYPE, getPublicEncryptionKey, showPromotionOffers, showPromotionOffersByCodes, setLanguage, }; export * from "./type"; export { loadUserCredential, saveUserCredential } from "./storage";