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.

57 lines 2.27 kB
/* * Copyright (c) 2023-2024. 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. */ /** * STEP 2. * Verifies the OTP (One-Time Password) sent to the provided email. * * This function constructs the necessary parameters and URL to send a POST request * to the XAPI endpoint for verifying the OTP. It then sends the request and returns * the response containing the authentication token and its expiration time. * * @param this - The XapiAuthEmail instance, bound to the function. * @param email - The email address to verify with the OTP. * @param verification_code - The OTP sent to the email address. * @param source - The source from which the verification is requested. * @returns A Promise that resolves to an IResponse object containing the token and expiration time. * * @example * ```typescript * verifyOTP() { * this.busy = true; * * window.$storefront.auth.email * .verifyOTP(this.email, this.otp, this.source) * .then(({ token, expires_in }) => { * // Success verifying OTP and Login * this.token = token; * }) * .catch((error) => { * console.error(error); * }) * .finally(() => { * this.busy = false; * }); * } * ``` */ export default function XapiAuthEmailVerifyOtp(email, verification_code, source) { const params = { email: email, verification_code: verification_code, source: source, }; const url = window.XAPI.POST_SHOP_LOGIN_EMAIL_VERIFY(this.shop_name); return this.postNow(url, params); } //# sourceMappingURL=XapiAuthEmailVerifyOtp.js.map