UNPKG

@selldone/sdk-storefront

Version:

A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.

60 lines 2.4 kB
/* * Copyright (c) 2023. Selldone® Business OS™ * * Author: M.Pajuhaan * Web: https://selldone.com * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ * * All rights reserved. In the weave of time, where traditions and innovations intermingle, this content was crafted. * From the essence of thought, through the corridors of creativity, each word, and sentiment has been molded. * Not just to exist, but to inspire. Like an artist's stroke or a sculptor's chisel, every nuance is deliberate. * Our journey is not just about reaching a destination, but about creating a masterpiece. * Tread carefully, for you're treading on dreams. */ import { APIAbstract } from "@selldone/core-js"; import { XapiExchangeRate } from "./exchange-rates/XapiExchangeRate"; import { StorefrontLocalStorages } from "@selldone/core-js/helper/local-storage/StorefrontLocalStorages"; import { XapiLanguage } from "./language/XapiLanguage"; /** * The `XapiShop` class provides an interface to interact with the shop-related * services on the backend, particularly around retrieving shop information. * It extends the base `APIAbstract` class. * * @extends APIAbstract */ export class XapiShop extends APIAbstract { /** Name of the shop for which the API operations will be performed. */ shop_name; /** * API abstraction for exchange rate related operations. */ exchange; /** * API abstraction for language related operations. */ language; /** * Creates an instance of the `XapiShop`. * * @param shop_name - Name of the shop. */ constructor(shop_name) { super(); this.shop_name = shop_name; this.exchange = new XapiExchangeRate(shop_name); this.language = new XapiLanguage(shop_name); } /** * Fetches information about a shop. * * @returns Promise that resolves with shop information. */ fetchShop() { const url = window.XAPI.GET_SHOP_INFO(this.shop_name); // @ts-ignore const guest_codes = StorefrontLocalStorages.GetShopHistoryGuestAllCodes().limit(10); // We use it to get pending transactions! const params = { guest_codes: guest_codes }; return this.getNow(url, params); } } //# sourceMappingURL=XapiShop.js.map