"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("immutable"),S=require("./embeddable-api.js");function O(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const R=O(I),a="SEND_SHOW_CASE",o="SEND_SHOW_CASE_DONE",r="SEND_SHOW_CASE_FAILURE",u="SHOW_CASE_RESET",_="NEWS_LETTER_SUBSCRIBE",c="NEWS_LETTER_SUBSCRIBE_DONE",E="NEWS_LETTER_SUBSCRIBE_FAILURE",l="NEWS_LETTER_SET_EMAIL",i="POST_LOADED",T=e=>(t,s)=>{t({type:i})},C=R.Map({}),m=e=>(t,s)=>{t({type:l,eMail:e})},p=e=>(t,s)=>{t({type:_}),S.subscribe(e).then(n=>{n.status===500?t({type:E}):t({type:c})}).catch(n=>{t({type:E})})},N=e=>(t,s)=>{t({type:a}),S.sendShowCase(e).then(n=>{n.status===500?t({type:r}):t({type:o})}).catch(n=>{t({type:r})})},d=e=>(t,s)=>{t({type:u})},b=(e=C,t)=>{switch(t.type){case a:return e.setIn(["showCase","loading"],!0).setIn(["showCase","status"],null);case o:return e.setIn(["showCase","status"],"OK");case r:return e.setIn(["showCase","status"],"ERROR");case u:return e.setIn(["showCase","status"],null);case _:return e.setIn(["newsletter","loading"],!0).setIn(["newsletter","status"],null);case c:return e.setIn(["newsletter","status"],"OK").setIn(["newsletter","email"],"");case E:return e.setIn(["newsletter","status"],"ERROR");case l:{const{eMail:s}=t;return e.setIn(["newsletter","email"],s)}case i:return e.setIn(["random"],Math.random());default:return e}};exports.default=b;exports.newsletterSubscription=p;exports.postLoaded=T;exports.reset=d;exports.sendShowCaseForm=N;exports.setEmail=m;
