import React from 'react'; import SnippetLoader from '../SnippetLoader'; import { NewsletterLoaderLoaderTypes } from './NewsletterLoaderLoader.types'; const appPath = 'de.pinuts.cmsbs.newsletter.Widget/index'; /** * NewsletterLoader is a functional component that loads a newsletter snippet. * * @param {NewsletterLoaderLoaderTypes} props - The properties passed to the component. * @param {string} props.restUrl - The REST-Proxy URL. * @param {string} props.appId - The appId from Form Instance in UM. * @param {string} props.locale - The locale for the widget. * @param {string} props.containerId - The ID of the container where the newsletter will be loaded. * @param {string} [props.actionName] - This option can be used to restrict the functionality of the widget to one action. * @param {string} [props.ctp] - The CTP value. Optional. * @param {string} props.messageLoadingFailed - The message to display when the widget failed to load. Overrides the default message * @param {string} props.messageIsLoading - The message to display while the widget is loading. Override the default message. * @returns {JSX.Element} The div component with loader Script for the Newsletter widget. */ export const NewsletterLoader = ({ actionName, ctp, restUrl, appId, locale, containerId, messageLoadingFailed, messageIsLoading, }: NewsletterLoaderLoaderTypes) => { const optionalUrlParams: Record = { ...(actionName && { actionName }), ...(ctp && { ctp }), }; return ( ); };