@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.
41 lines • 1.8 kB
JavaScript
/*
* 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.
*/
/**
* Submits a rating for a purchased product.
*
* @param product_id - The ID of the product being rated.
* @param user_rating - An object where the key is a string representing the user and the value is a number between 1 and 5.
* @returns A promise that resolves to the response of the rating submission.
*
* @example
* ```typescript
* // Assuming you have an instance of XapiProductRate
* const xapiProductRate = new XapiProductRate();
*
* // Submit a rating
* window.$storefront.products.rate.submitMyRate(12345, { "user123": 5 })
* .then(response => {
* console.log('Rating submitted successfully:', response);
* })
* .catch(error => {
* console.error('Error submitting rating:', error);
* });
* ```
*/
export default function XapiProductRateSubmit(product_id, user_rating) {
const url = window.XAPI.POST_SET_PRODUCT_RATING(this.shop_name, product_id);
const params = { user_rating: user_rating };
return this.postNow(url, params);
}
//# sourceMappingURL=XapiProductRateSubmit.js.map