import BaseService from '../index'; import { IDomain, IPopUpCallback, IPopupData } from './popup.interface'; import { COUNT_POPUP_CALLBACK, COUNT_POPUP_WISHLIST, GET_DOMAIN, GET_POPUP, GET_POPUP_IMAGE, SAVE_DOMAIN, SAVE_DOMAIN_LINK, SAVE_LOGO, SAVE_POPUP, SAVE_POPUP_CALLBACK, } from './popup.routes'; /** * Saves domain * @param {IDomain} data * @return { Promise } */ export const saveDomain = async (data: IDomain): Promise => await BaseService.post(SAVE_DOMAIN, data); /** * get Saves domain links * @return { Promise } */ export const getDomainLinks = async (): Promise => await BaseService.get(SAVE_DOMAIN_LINK); /** * Gets domain * @return { Promise } */ export const getDomain = async (): Promise => await BaseService.get(GET_DOMAIN); /** * Saves popup setting * @param {IPopupData} data * @return { Promise } */ export const savePopupData = async (data: IPopupData): Promise => await BaseService.post(SAVE_POPUP, data); /** * save logo * @param {FormData} data * @return { Promise } */ export const saveLogo = async (data: FormData): Promise => await BaseService.post(SAVE_LOGO, data); /** * gets popup data * @return { Promise } */ export const getPopupData = async (): Promise => await BaseService.get(GET_POPUP); /** * gets popup data * @return { Promise } */ export const getPopupImage = async ({ modelId, }: { modelId: string; }): Promise => await BaseService.get(GET_POPUP_IMAGE + modelId + '/LOGO'); /** * Gets media by model id and type * @param {string} modelId * @param {string} mediaType * @return { Promise } */ export const getMedia = async ( modelId: string, mediaType: string ): Promise => await BaseService.get(GET_POPUP_IMAGE + modelId + '/' + mediaType); /** * Create popup callback * @param {IPopUpCallback} data * @return { Promise } */ export const createPopUpCallback = async ({ data, }: { data: IPopUpCallback; }): Promise => await BaseService.post(SAVE_POPUP_CALLBACK, data); /** * Count popup callback * @param {IPopupData} data * @return { Promise } */ export const countPopupCallback = async ({ popUpId, }: { popUpId: string; }): Promise => await BaseService.get(`${COUNT_POPUP_CALLBACK}/${popUpId}`); /** * Count popup callback * @param {IPopupData} data * @return { Promise } */ export const countPopupWishList = async ({ popUpId, }: { popUpId: string; }): Promise => await BaseService.get(`${COUNT_POPUP_WISHLIST}/${popUpId}`);