{"version":3,"sources":["webpack://fxsWidgets/../src/js/widgets/calendar-settings/components/SettingsOptions.js","webpack://fxsWidgets/../src/js/widgets/calendar-settings/store.js","webpack://fxsWidgets/../src/js/widgets/calendar-settings/index.js","webpack://fxsWidgets/../src/js/widgets/calendar-settings/components/SettingsContainer.js","webpack://fxsWidgets/../src/js/widgets/calendar-settings/constants/gtmIds.js"],"names":["SettingsOptions","_Component","props","_this","_callSuper","e","isComposing","keyCode","search","target","value","_inherits","key","_ref","config","data","translate","onCheckboxChanged","notificationSoundOn","view","onOptionChange","toggle","onApply","h","class","SoundAlert","locale","this","culture","ConfigureView","onOptionSelected","option","showDescription","notificationsHelper","hasNotifications","for","title","IconSearchSolid","onKeyUp","filter","type","placeholder","name","autocomplete","colspan","x","isVisible","map","item","id","checked","onClick","tracking","GTM_ID","CONFIGURATION_PUSH_SELECT","GA4EVENT","NAMES","FEATURES_CALENDAR","ELEMENTS","concat","countryCode","toLowerCase","currencyCode","role","CONFIGURATION_APPLY","Component","connectWithTranslations","actions","SETTING_KEYS","INITIAL_STATE","calendarApiUrl","CALENDAR_API_URL","show","openCloseEventName","subscriptionChangedEventName","hasPremium","premiumUrl","isFetching","fetchError","lastUpdated","settings","settingsMapper","state","defaultSettings","CALENDAR_VIEW","Configure_View_Default","undefined","resultState","_objectSpread","storageSettings","getSetting","convertCulture","input","Object","keys","translations","includes","CalendarSettingsWidget","store","createCustomStore","createStore","Provider","SettingsContainer","_defineProperty","items","actualFilterType","FILTER_TYPE","custom","saveData","setState","showAdvice","noChangeView","saveState","then","clockEvent","CustomEvent","SETTINGS_SAVED_EVENT_NAME","detail","document","dispatchEvent","lenght","toUnsubscribe","unsubscribeToEvents","close","fetchLocalizations","initEventNotifications","openCloseListener","updateSettingsFromStorage","nextProps","Configure_View_Premium","_this2","Promise","resolve","persistSettings","saveSettings","_this3","tabindex","CONFIGURATION_CLOSE","IconTimes","ConfirmationPopUp","cancel","save","applySettings","NOTIFICATIONS","eventDateId"],"mappings":"yr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W,CACpBC,MAAO,CAAEC,kBAAmB,qBAC5BC,SAAU,CACNqF,cAAe,8BACf/E,oBAAqB,sBACrByE,oBAAqB,sBACrBnF,0BAA2B,SAACJ,GAAO,OACnCA,EAAU,uBAAH,wBAAoD,G","file":"calendar-settings.93592138e6333939d122.js","sourcesContent":["import { Component } from \"preact\";\r\nimport { connectWithTranslations } from \"../../common/helpers/translationsHelpers\";\r\nimport actions from \"../actions\";\r\nimport { GTM_ID, GA4EVENT } from \"../constants\";\r\nimport SoundAlert from \"../../calendar-common/components/SoundAlert\";\r\nimport ConfigureView from \"../../calendar-common/components/ConfigureView\";\r\nimport IconSearchSolid from \"../../common/components/icons/IconSearchSolid\";\r\nclass SettingsOptions extends Component {\r\n    constructor(props) {\r\n        super(props);\r\n    }\r\n\r\n    filter = (e) => {\r\n        if (e.isComposing || e.keyCode === 229) {\r\n            return;\r\n        }\r\n        let value = e.target.value;\r\n        this.props.search(value);\r\n    };\r\n\r\n    render({\r\n        config,\r\n        data,\r\n        translate,\r\n        onCheckboxChanged,\r\n        notificationSoundOn,\r\n        view,\r\n        onOptionChange,\r\n        toggle,\r\n        onApply,\r\n    }) {\r\n        return (\r\n            <div>\r\n                <div class=\"fxs_detail fxs_cs_detail\">\r\n                    <h2 class=\"fxs_headline_from_small_to_medium fxs_marginBase_bottom_big\">\r\n                        {translate(\"Notifications_Title\")}\r\n                    </h2>\r\n                    <SoundAlert\r\n                        onCheckboxChanged={() => onCheckboxChanged()}\r\n                        notificationSoundOn={notificationSoundOn}\r\n                        locale={this.props.config.culture}\r\n                    ></SoundAlert>\r\n                    <ConfigureView\r\n                        view={view}\r\n                        onOptionSelected={(option) => onOptionChange(option)}\r\n                        showDescription={true}\r\n                        locale={this.props.config.culture}\r\n                    ></ConfigureView>\r\n                    {(config.notificationsHelper ||\r\n                        config.hasNotifications) && (\r\n                            <div>\r\n                                <h3 class=\"fxs_headline_small\">\r\n                                    {translate(\"Notifications\")}\r\n                                </h3>\r\n                                <p class=\"fxs_entryPlain_txt\">\r\n                                    {translate(\"Notifications_Summary_1\")}\r\n                                    <br />\r\n                                    {translate(\"Notifications_Summary_2\")}\r\n                                </p>\r\n                                <div class=\"fxs_search_module fxs_cs_search_module\">\r\n                                    <div class=\"fxs_search_box fxs_cs_search_box\">\r\n                                        <label\r\n                                            for=\"searchEvent\"\r\n                                            class=\"fxs_btn_filter\"\r\n                                            title=\"Search event\"\r\n                                        >\r\n                                            <IconSearchSolid />\r\n                                            <span class=\"fxs_skip\">\r\n                                                {\" \"}\r\n                                                {translate(\r\n                                                    \"Notifications_Search_Event\"\r\n                                                )}\r\n                                            </span>\r\n                                        </label>\r\n                                        <input\r\n                                            onKeyUp={this.filter}\r\n                                            type=\"search\"\r\n                                            class=\"fxs_search_input\"\r\n                                            placeholder=\"Search event\"\r\n                                            name=\"search\"\r\n                                            autocomplete=\"off\"\r\n                                        />\r\n                                    </div>\r\n                                </div>\r\n                                <div class=\"fxs_cs_table_wrapper\">\r\n                                    <table class=\"fxs_cs_table\">\r\n                                        <thead class=\"fxs_cs_header\">\r\n                                            <tr>\r\n                                                <th class=\"fxs_cs_item\">\r\n                                                    {translate(\r\n                                                        \"Notifications_NotifyMe\"\r\n                                                    )}\r\n                                                </th>\r\n                                                <th class=\"fxs_cs_item\" colspan=\"2\">\r\n                                                    {translate(\r\n                                                        \"Notifications_Currency\"\r\n                                                    )}\r\n                                                </th>\r\n                                                <th class=\"fxs_cs_item fxs_cs_event\">\r\n                                                    {translate(\r\n                                                        \"Notifications_Event\"\r\n                                                    )}\r\n                                                </th>\r\n                                            </tr>\r\n                                        </thead>\r\n                                        <tbody>\r\n                                            {data &&\r\n                                                data\r\n                                                    .filter((x) => x.isVisible)\r\n                                                    .map((item) => (\r\n                                                        <tr class=\"fxs_cs_row\">\r\n                                                            <td class=\"fxs_cs_item fxs_cs_checkbox\">\r\n                                                                <input\r\n                                                                    key={\r\n                                                                        item.id +\r\n                                                                        \"_calendarsettings\"\r\n                                                                    }\r\n                                                                    type=\"checkbox\"\r\n                                                                    value={item.id}\r\n                                                                    checked={\r\n                                                                        item.checked\r\n                                                                    }\r\n                                                                    onClick={() =>\r\n                                                                        toggle(item)\r\n                                                                    }\r\n                                                                    data-gtmid={\r\n                                                                        config.tracking &&\r\n                                                                        GTM_ID.CONFIGURATION_PUSH_SELECT(\r\n                                                                            item.id,\r\n                                                                            item.checked\r\n                                                                        )\r\n                                                                    }\r\n                                                                    data-ga4event-clk-name={config.tracking && GA4EVENT.NAMES.FEATURES_CALENDAR}\r\n                                                                    data-ga4event-element={config.tracking && GA4EVENT.ELEMENTS.CONFIGURATION_PUSH_SELECT(item.checked)}\r\n                                                                    data-ga4event-eventdateid={item.id}\r\n                                                                ></input>\r\n                                                            </td>\r\n                                                            <td class=\"fxs_cs_item fxs_cs_flag\">\r\n                                                                <span\r\n                                                                    class={`fxs_flag fxs_${item.countryCode.toLowerCase()}`}\r\n                                                                ></span>\r\n                                                            </td>\r\n                                                            <td class=\"fxs_cs_item fxs_cs_currency\">\r\n                                                                <span>\r\n                                                                    {\r\n                                                                        item.currencyCode\r\n                                                                    }\r\n                                                                </span>\r\n                                                            </td>\r\n                                                            <td class=\"fxs_cs_item fxs_cs_name\">\r\n                                                                {item.name}\r\n                                                            </td>\r\n                                                        </tr>\r\n                                                    ))}\r\n                                        </tbody>\r\n                                    </table>\r\n                                </div>\r\n                            </div>\r\n                        )}\r\n                    <button\r\n                        type=\"button\"\r\n                        onClick={() => onApply(data)}\r\n                        class=\"fxs_btn fxs_btn_cta fxs_fRight fxs_marginBase_top\"\r\n                        role=\"button\"\r\n                        data-gtmid={\r\n                            config.tracking && GTM_ID.CONFIGURATION_APPLY\r\n                        }\r\n                        data-ga4event-clk-name={config.tracking && GA4EVENT.NAMES.FEATURES_CALENDAR}\r\n                        data-ga4event-element={config.tracking && GA4EVENT.ELEMENTS.CONFIGURATION_APPLY}\r\n\r\n                    >\r\n                        {translate(\"Notifications_Apply\")}\r\n                    </button>\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n}\r\nexport default connectWithTranslations(\r\n    \"settings, config, data\",\r\n    actions\r\n)(SettingsOptions);\r\n","import { getSetting } from \"../common/helpers/settingStorageHelpers\";\r\nimport { createCustomStore } from \"../common/helpers/storeHelpers\";\r\nimport { translations } from \"./actions/localizationActions\";\r\nimport { CALENDAR_VIEW } from \"../calendar-common/constants/view\";\r\n\r\nconst SETTING_KEYS = {\r\n    Settings: 'calendarSettings'\r\n}\r\n\r\nconst INITIAL_STATE = {\r\n    config: {\r\n        culture: \"en\",\r\n        calendarApiUrl: CALENDAR_API_URL,\r\n        notificationsHelper: null,\r\n        show: false,\r\n        openCloseEventName: null,\r\n        subscriptionChangedEventName: null,\r\n        tracking: false,\r\n        hasPremium: false,\r\n        premiumUrl:'',\r\n        hasNotifications: false\r\n    },\r\n    isFetching: false,\r\n    fetchError: false,\r\n    data: null,\r\n    lastUpdated: null,\r\n    settings: {},\r\n};\r\n\r\nconst settingsMapper = (state) => {\r\n    const defaultSettings = {\r\n        notificationSoundOn: false,\r\n        view: CALENDAR_VIEW.Configure_View_Default\r\n    }\r\n\r\n    if (state.config.notificationSoundOn)\r\n        defaultSettings.notificationSoundOn = state.config.notificationSoundOn\r\n\r\n    if (state.config.premiumUrl != undefined && state.config.premiumUrl != \"\")\r\n        state.config.hasPremium = true;\r\n\r\n    let resultState = {\r\n        ...state,\r\n        defaultSettings,\r\n    }\r\n\r\n    let settings = {}\r\n    let storageSettings = getSetting(SETTING_KEYS.Settings)\r\n\r\n    if (storageSettings){\r\n        settings.notificationSoundOn = storageSettings.notificationSoundOn ? storageSettings.notificationSoundOn : false;\r\n        settings.view = storageSettings.view ? storageSettings.view : CALENDAR_VIEW.Configure_View_Default;\r\n    }\r\n    else{\r\n        settings = defaultSettings\r\n    }\r\n\r\n    resultState = {\r\n        ...resultState,\r\n        settings\r\n    }\r\n\r\n    return resultState\r\n}\r\nconst convertCulture = (input) => {\r\n    const result =\r\n        input && Object.keys(translations).includes(input.toLowerCase())\r\n            ? input.toLowerCase()\r\n            : \"en\";\r\n    return result;\r\n};\r\n\r\nconst createStore = (props) => {\r\n    const result = createCustomStore(props,\r\n        INITIAL_STATE, {\r\n        culture: convertCulture\r\n    }, settingsMapper);\r\n    return result;\r\n};\r\n\r\nexport { createStore };\r\n","import { h, Component } from 'preact'\r\nimport { Provider } from 'unistore/preact'\r\nimport { createStore } from './store'\r\nimport SettingsContainer from './components/SettingsContainer'\r\n\r\nclass CalendarSettingsWidget extends Component {\r\n    constructor(props) {\r\n        super(props)\r\n        this.store = createStore(props)\r\n    }\r\n\r\n    render(props) {\r\n        return (\r\n            <Provider store={this.store}>\r\n                <SettingsContainer />\r\n            </Provider>\r\n        )\r\n    }\r\n}\r\n\r\nexport default CalendarSettingsWidget\r\n","import { Component } from \"preact\";\r\nimport { connectWithTranslations } from \"../../common/helpers/translationsHelpers\";\r\nimport actions from \"../actions\";\r\nimport { persistSettings } from \"../../calendar-common/helpers/settingsHelper\";\r\nimport {\r\n    CALENDAR_VIEW,\r\n    FILTER_TYPE,\r\n    SETTINGS_SAVED_EVENT_NAME,\r\n} from \"../../calendar-common/constants\";\r\nimport SettingsOptions from \"./SettingsOptions\";\r\nimport IconTimes from \"../../common/components/icons/IconTimes\";\r\nimport { GTM_ID, GA4EVENT} from \"../constants\";\r\nimport ConfirmationPopUp from \"../../calendar-common/components/ConfirmationPopUp\";\r\n\r\nclass SettingsContainer extends Component {\r\n    constructor(props) {\r\n        super(props);\r\n        this.state = {\r\n            settings: {\r\n                notificationSoundOn: null,\r\n                view: null,\r\n            },\r\n            showAdvice: false,\r\n        };\r\n    }\r\n\r\n    componentWillMount() {\r\n        this.props.fetchLocalizations();\r\n        this.props.initEventNotifications();\r\n        this.props.openCloseListener();\r\n        this.props.updateSettingsFromStorage();\r\n\r\n        const { settings } = this.props;\r\n        this.setState({ settings });\r\n    }\r\n\r\n    componentWillReceiveProps(nextProps) {\r\n        const { settings } = nextProps;\r\n        this.setState({ settings });\r\n    }\r\n\r\n    toggle = (item) => {\r\n        item.checked = !item.checked;\r\n    };\r\n\r\n    onCheckboxChanged() {\r\n        this.setState({\r\n            settings: {\r\n                ...this.state.settings,\r\n                notificationSoundOn: !this.state.settings.notificationSoundOn,\r\n            },\r\n        });\r\n    }\r\n\r\n    onOptionChange(option) {\r\n        // Disabled for premium view\r\n        if (option != CALENDAR_VIEW.Configure_View_Premium)\r\n            this.setState({\r\n                settings: { ...this.state.settings, view: option },\r\n            });\r\n    }\r\n\r\n    saveState() {\r\n        return new Promise((resolve, reject) => {\r\n            persistSettings(this.state.settings);\r\n            this.props.saveSettings(this.state.settings);\r\n\r\n            return resolve();\r\n        });\r\n    }\r\n    close() {\r\n        const { settings } = this.props;\r\n        this.setState({ ...settings, showAdvice: false });\r\n        this.props.close();\r\n    }\r\n\r\n    onApply = (items) => {\r\n        const { settings } = this.props;\r\n        if (\r\n            settings.actualFilterType == FILTER_TYPE.custom &&\r\n            settings.view != this.state.settings.view\r\n        ) {\r\n            this.setState({ ...this.state, showAdvice: true });\r\n            return;\r\n        }\r\n        this.saveData(false, false, items);\r\n    };\r\n\r\n    saveData = (noChangeView, showAdvice, items) => {\r\n        this.saveState().then(() => {\r\n            const clockEvent = new CustomEvent(SETTINGS_SAVED_EVENT_NAME, {\r\n                detail: { noChangeView: noChangeView, showAdvice: showAdvice },\r\n            });\r\n            document.dispatchEvent(clockEvent);\r\n        });\r\n\r\n        if (!items || items.lenght === 0) {\r\n            this.setState({ showAdvice: false });\r\n            this.props.close();\r\n        } else {\r\n            var toUnsubscribe = items\r\n                .filter((x) => !x.checked)\r\n                .map((x) => x.id);\r\n            this.props.unsubscribeToEvents(toUnsubscribe).then(() => {\r\n                this.props.close();\r\n                this.setState({ showAdvice: false });\r\n            });\r\n        }\r\n    };\r\n    applySettings(data) {\r\n        this.saveData(false, true, data);\r\n    }\r\n\r\n    cancel(data) {\r\n        const { settings } = this.props;\r\n        this.state.settings.view = settings.view;\r\n        this.saveData(true, true, data);\r\n    }\r\n    render({ config, data, translate }) {\r\n        return (\r\n            config.show && (\r\n                <div\r\n                    class=\"fxs_widget fxs_cs_modal\"\r\n                    tabindex=\"-1\"\r\n                    role=\"dialog\"\r\n                    aria-hidden=\"true\"\r\n                >\r\n                    <div\r\n                        class={`fxs_cs_modal_content ${\r\n                            this.state.showAdvice\r\n                                ? \"fxs_cs_modal_content_advice\"\r\n                                : \"\"\r\n                        }`}\r\n                    >\r\n                        <button\r\n                            type=\"button\"\r\n                            onClick={() => this.close()}\r\n                            class=\"fxs_modal_close fxs_btn_icon close fxs_cs_modal_close\"\r\n                            data-dismiss=\"modal\"\r\n                            aria-label=\"Close Modal\"\r\n                            data-gtmid={\r\n                                config.tracking && GTM_ID.CONFIGURATION_CLOSE\r\n                            }\r\n                            data-ga4event-clk-name={ config.tracking && GA4EVENT.NAMES.FEATURES_CALENDAR}\r\n                            data-ga4event-element = { config.tracking && GA4EVENT.ELEMENTS.CONFIGURATION_CLOSE}\r\n\r\n                        >\r\n                            <IconTimes />\r\n                            <span class=\"fxs_skip\">Close</span>\r\n                        </button>\r\n                        {this.state.showAdvice ? (\r\n                            <ConfirmationPopUp\r\n                                cancel={() => this.cancel(data)}\r\n                                save={() => this.applySettings(data)}\r\n                            ></ConfirmationPopUp>\r\n                        ) : (\r\n                            <SettingsOptions\r\n                                onCheckboxChanged={() =>\r\n                                    this.onCheckboxChanged()\r\n                                }\r\n                                notificationSoundOn={\r\n                                    this.state.settings.notificationSoundOn\r\n                                }\r\n                                view={this.state.settings.view}\r\n                                onOptionChange={(option) =>\r\n                                    this.onOptionChange(option)\r\n                                }\r\n                                toggle={(item) => this.toggle(item)}\r\n                                onApply={(data) => this.onApply(data)}\r\n                            ></SettingsOptions>\r\n                        )}\r\n                    </div>\r\n                </div>\r\n            )\r\n        );\r\n    }\r\n}\r\n\r\nexport default connectWithTranslations(\r\n    \"settings, config, data\",\r\n    actions\r\n)(SettingsContainer);\r\n","export const GTM_ID = {\r\n    NOTIFICATIONS: \"features-calendar-configuration-notifications\",\r\n    CONFIGURATION_APPLY: \"features-calendar-configuration-apply\",\r\n    CONFIGURATION_CLOSE: \"features-calendar-configuration-close\",\r\n    CONFIGURATION_PUSH_SELECT: (eventDateId, checked) =>\r\n        checked ? `features-calendar-configuration-select-${eventDateId}` : `features-calendar-configuration-unselect-${eventDateId}`,\r\n};\r\nexport const GA4EVENT = {\r\n    NAMES: { FEATURES_CALENDAR: \"features-calendar\" },\r\n    ELEMENTS: {\r\n        NOTIFICATIONS: \"configuration-notifications\",\r\n        CONFIGURATION_APPLY: \"configuration-apply\",\r\n        CONFIGURATION_CLOSE: \"configuration-close\",\r\n        CONFIGURATION_PUSH_SELECT: (checked) =>\r\n        checked ? `configuration-select` : `configuration-unselect`,\r\n    }\r\n};\r\n"],"sourceRoot":""}