import { EventsScript } from './events' import { ShowcasesScript } from './showcases' import { SearchScript } from './search' import { TryOnScript } from './try-on' import { logger } from './utils/logger' const scriptElement = document.currentScript if (scriptElement && scriptElement instanceof HTMLScriptElement) { const store = scriptElement.dataset.store if (store) { const [storeName, plataform] = getPlataformAndStore(store) new EventsScript(storeName).execute() new SearchScript(storeName).execute() new ShowcasesScript(storeName).execute() new TryOnScript(storeName).execute() } else { logger.error('Invalid data-store attribute on script tag.') } } else { logger.error('The script code must the src in a script tag.') } function getPlataformAndStore(store: string) { return store.split('-') }