@liquidcommerceteam/elements-sdk
Version:
LiquidCommerce Elements SDK
38 lines (37 loc) • 2.13 kB
TypeScript
import type { IAddressAutocompleteResult, IAddressDetailsResult, ICart, ICartUpdateParams, ICheckoutCompleteParams, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILoc } from 'interfaces/cloud';
import type { IAllConfigs } from 'interfaces/configs';
import type { AuthService } from '@/core/auth.service';
import type { IPersistedStore } from '@/core/store';
import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
import type { IProductData } from '@/modules/product';
export declare class ApiClientService {
private client;
private logger;
static getInstance(): ApiClientService;
setClient(client: AuthService): Promise<void>;
/**
* Fetches all configurations from the API.
* @returns {Promise<IAllConfigs>} The configurations data.
* @throws {Error} If the API client is not initialized or if the response data is invalid.
* @throws {Error} If there is an error during the API request.
*/
getAllConfigs(): Promise<IAllConfigs>;
/**
* Fetches the persisted store for a given user device ID.
* @param {string} userDeviceId - The ID of the user device.
* @returns {Promise<IPersistedStore>} The persisted store data.
* @throws {Error} If there is an error during the API request.
*/
getPersistedStore(userDeviceId: string): Promise<IPersistedStore>;
getProductData(identifier: string, location: ILoc | null): Promise<IProductData>;
getCartData(id: string | null): Promise<ICart>;
updateCart(params: ICartUpdateParams, location?: ILoc): Promise<ICart>;
getAddressSuggestions(query: string): Promise<IAddressAutocompleteResult[]>;
getAddressDetails(id: string): Promise<IAddressDetailsResult>;
prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<string>;
checkoutComplete(params: ICheckoutCompleteParams): Promise<string>;
private validResponseData;
private ensureClientInitialized;
}