@abtasty/nps
Advanced tools
Comparing version 0.5.2-6 to 0.5.2-7
@@ -1,1 +0,1 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).widgetForm=o()}(this,(function(){"use strict";var e=function(e,o){(null==o||o>e.length)&&(o=e.length);for(var t=0,l=new Array(o);t<o;t++)l[t]=e[t];return l};var o=function(o){if(Array.isArray(o))return e(o)};var t=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)};var l=function(o,t){if(o){if("string"==typeof o)return e(o,t);var l=Object.prototype.toString.call(o).slice(8,-1);return"Object"===l&&o.constructor&&(l=o.constructor.name),"Map"===l||"Set"===l?Array.from(l):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?e(o,t):void 0}};var n=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var i=function(e){return o(e)||t(e)||l(e)||n()};const a="style",r="content",_="conditions",c="text",p="textarea",d="switch",s="group",g="https://widgets-images.abtasty.com/",m="rgba(247, 247, 247, 1)",u={category:"conditions",type:"slider",min:1},y=[{...u,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...u,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...u,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],b={category:"conditions",type:"select",options:[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],value:"everytime"},v={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},w=y.map(e=>({...e,propName:`${v.propName}_${e.propName}`,conditions:[{field:v.propName,value:e.propName}]})),f={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},N=y.map(e=>({...e,propName:`${f.propName}_${e.propName}`,conditions:[{field:f.propName,value:e.propName}]})),h={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},k=y.map(e=>({...e,propName:`${h.propName}_${e.propName}`,conditions:[{field:h.propName,value:e.propName}]})),x={category:"conditions",type:s,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[v,...w,f,...N,h,...k]},S={category:"conditions",type:"slider",propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:120,value:0},T={...S,propName:"triggerEventReengageDelay",value:10},C={category:"conditions",type:"selectelement",propName:"triggerEventClick",value:"body"},E={...C,propName:"triggerEventElementVisible"},B={category:"conditions",type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example, the widget will be launch as soon any scroll is detect.\nCreate your own by resolving resolve() with true (launch) or false (don't launch) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},A={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},L={category:"conditions",type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},I={category:"conditions",type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(A).map(e=>A[e]),propName:"triggerEvent",value:"pageLoad"};C.conditions=[{field:"triggerEvent",value:"click"}],T.conditions=[{field:"triggerEvent",value:"reengage"}],E.conditions=[{field:"triggerEvent",value:"elementVisible"}],B.conditions=[{field:"triggerEvent",value:"script"}],S.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],L.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const O={category:"conditions",type:s,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[I,...[C,E,B,L,T,S]]},M={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:g+"layout/icon-layout-modal.png"},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:g+"layout/icon-layout-topBanner.png"},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:g+"layout/icon-layout-bottomBanner.png"},{label:"widget_common_layout_option_freePlacement",value:"free",src:g+"layout/icon-layout-freePlacement.png"}]},R={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},P={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},V=[{field:"layout",value:"free"}];R.conditions=V,P.conditions=V;const D={category:"layout",type:s,label:"widget_common_tabName_layout",collapsible:!0,children:[M,R,P]},Q={category:a,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:m},Y={category:a,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},$={category:a,type:"slider",label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},j={category:a,type:"slider",label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},H={category:a,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},W={category:a,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:g+"style/icon-text-alignLeft.png"},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:g+"style/icon-text-alignCenter.png"},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:g+"style/icon-text-alignRight.png"}]},X={category:a,type:"areainput"},q={...X,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},F={...X,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},z={category:a,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},U={category:a,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},G={category:a,type:"slider",label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},J={category:a,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},K={category:a,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Z={category:a,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},ee={category:a,type:"slider",label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},oe={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},te={category:a,type:"slider",label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},le={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},ne={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:m},ie=[{field:j.propName,value:e=>e>0}];Y.conditions=ie;const ae={category:a,type:s,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[j,Y,$]},re={category:a,type:s,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[W,H]},_e=[{field:"dropShadow",value:!0}];U.conditions=_e,G.conditions=_e;const ce={category:a,type:s,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[q,F,Q,z,U,G,J]},pe={category:a,type:s,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[K,Z],conditions:[{field:"layout",value:"popin"}]},de=[{field:ee.propName,value:e=>e>0}];oe.conditions=de;const se={category:a,type:s,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[ee,oe,te,le,ne]};var ge=[{field:"isFeedBackQuestion",value:!0}],me=[{field:"isLegend",value:!0}],ue=[{category:r,type:p,propName:"question",label:"widget_nps_content_question_label",value:"widget_nps_content_question_default"},{category:r,type:d,propName:"isLegend",label:"widget_nps_content_legend_toggler_label_displayLegend",value:!1},{category:r,type:c,propName:"minLegend",label:"widget_nps_content_legend_label_minLegend",value:"widget_nps_content_legend_default_minLegend",conditions:me},{category:r,type:c,propName:"maxLegend",label:"widget_nps_content_legend_label_maxLegend",value:"widget_nps_content_legend_default_maxLegend",conditions:me},{category:r,type:d,propName:"isFeedBackQuestion",label:"widget_nps_content_oeq_toggler_label_askOpenEndedQuestion",value:!1},{category:r,type:p,propName:"feedbackQuestion",label:"widget_nps_style_preview_option_openEndedQuestion",value:"widget_nps_content_defaultOpenEndedQuestionValue",conditions:ge},{category:r,type:c,propName:"buttonText",label:"widget_nps_content_buttonText_label",value:"widget_nps_content_buttonText_default_send",conditions:ge},{category:r,type:d,propName:"isThankYouMessage",label:"widget_nps_content_tym_toggler_label_displayThankYouMessage",value:!1},{category:r,type:p,propName:"thankYouMessage",label:"widget_nps_content_tym_label_thankYouMessage",value:"widget_nps_content_tym_default_thankYouMessage",conditions:[{field:"isThankYouMessage",value:!0}]}],ye=i(D.children),be={category:_,type:d,propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterSubmit"},ve={category:_,type:"slider",propName:"timeHide",value:2,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]};O.collapsed=!1;var we=[O,x,be,ve],fe={category:a,type:s,label:{en:"Preview",fr:"Prévisualisation",es:"Previsualización",de:"Vorschau"},collapsible:!0,collapsed:!1,children:[{category:a,type:"radio",propName:"stepToShow",value:"displayNoteStep",label:"widget_nps_style_preview_label_selectStep",options:[{label:"widget_nps_style_preview_option_npsScore",value:"displayNoteStep"},{label:"widget_nps_style_preview_option_openEndedQuestion",value:"displayFeedbackStep"},{label:"widget_nps_style_preview_option_thankYouMessage",value:"displayThanksStep"}]}]},Ne={category:a,type:d,propName:"noStyles",value:!1,label:"widget_common_style_theme_option_custom"},he=function(e){return!e.noStyles};re.condition=he,se.condition=he,ce.condition=he,ae.condition=he,pe.condition=he,fe.collapsed=!1,re.collapsed=!1;var ke=[fe,Ne,re,se,ce,ae,pe];return[].concat(i(we),i(ue),i(ye),i(ke))})); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e=e||self).widgetForm=o()}(this,(function(){"use strict";var e=function(e,o){(null==o||o>e.length)&&(o=e.length);for(var t=0,l=new Array(o);t<o;t++)l[t]=e[t];return l};var o=function(o){if(Array.isArray(o))return e(o)};var t=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)};var l=function(o,t){if(o){if("string"==typeof o)return e(o,t);var l=Object.prototype.toString.call(o).slice(8,-1);return"Object"===l&&o.constructor&&(l=o.constructor.name),"Map"===l||"Set"===l?Array.from(l):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?e(o,t):void 0}};var n=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var i=function(e){return o(e)||t(e)||l(e)||n()};const a="style",r="content",_="conditions",c="text",p="textarea",d="switch",s="group",g="https://widgets-images.abtasty.com/",m="rgba(247, 247, 247, 1)",u={category:"conditions",type:"slider",min:1},y=[{...u,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...u,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...u,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],b={category:"conditions",type:"select",options:[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],value:"everytime"},v={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},w=y.map(e=>({...e,propName:`${v.propName}_${e.propName}`,conditions:[{field:v.propName,value:e.propName}]})),f={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},N=y.map(e=>({...e,propName:`${f.propName}_${e.propName}`,conditions:[{field:f.propName,value:e.propName}]})),h={...b,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},k=y.map(e=>({...e,propName:`${h.propName}_${e.propName}`,conditions:[{field:h.propName,value:e.propName}]})),x={category:"conditions",type:s,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[v,...w,f,...N,h,...k]},S={category:"conditions",type:"slider",propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},T={...S,propName:"triggerEventReengageDelay",value:10,max:180},C={category:"conditions",type:"selectelement",propName:"triggerEventClick",value:"body"},E={...C,propName:"triggerEventElementVisible"},B={category:"conditions",type:"textarea",label:"widget_common_conditions_triggering_option_customTrigger",propName:"triggerEventCustomScript",value:"/* In this example, the widget will be launch as soon any scroll is detect.\nCreate your own by resolving resolve() with true (launch) or false (don't launch) */\n\nfunction launchIfScroll() {\n\treturn new Promise(resolve => {\n\t\tdocument.addEventListener('scroll', () => resolve(true), {once: true});\n\t});\n}\n\nconst result = await launchIfScroll();\nreturn resolve(result);",rows:15},A={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},L={category:"conditions",type:"switch",propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},I={category:"conditions",type:"select",label:"widget_common_conditions_triggering_label",options:Object.keys(A).map(e=>A[e]),propName:"triggerEvent",value:"pageLoad"};C.conditions=[{field:"triggerEvent",value:"click"}],T.conditions=[{field:"triggerEvent",value:"reengage"}],E.conditions=[{field:"triggerEvent",value:"elementVisible"}],B.conditions=[{field:"triggerEvent",value:"script"}],S.conditions=[{field:"triggerEvent",value:e=>"reengage"!==e}],L.conditions=[{field:"triggerEvent",value:e=>"click"===e||"script"===e}];const O={category:"conditions",type:s,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[I,...[C,E,B,L,T,S]]},M={category:"layout",type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:g+"layout/icon-layout-modal.png"},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:g+"layout/icon-layout-topBanner.png"},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:g+"layout/icon-layout-bottomBanner.png"},{label:"widget_common_layout_option_freePlacement",value:"free",src:g+"layout/icon-layout-freePlacement.png"}]},R={category:"layout",type:"selectelement",propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},P={category:"layout",type:"radio",propName:"referrerInsertType",value:"afterbegin",label:"widget_common_layout_positioning_label_selectPosition",options:[{label:"widget_common_layout_positioning_option_before",value:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheBeginning",value:"afterbegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},V=[{field:"layout",value:"free"}];R.conditions=V,P.conditions=V;const D={category:"layout",type:s,label:"widget_common_tabName_layout",collapsible:!0,children:[M,R,P]},Q={category:a,type:"colorpicker",label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:m},Y={category:a,type:"colorpicker",label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},$={category:a,type:"slider",label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},j={category:a,type:"slider",label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},H={category:a,type:"colorpicker",label:"widget_common_style_text_label_textColor",propName:"textColor",value:"rgba(57, 57, 57, 1)"},W={category:a,type:"radioImage",label:"widget_common_style_text_label_textAlignment",propName:"textAlign",value:"center",style:"little",options:[{label:"widget_common_style_text_textAlignment_option_left",value:"left",src:g+"style/icon-text-alignLeft.png"},{label:"widget_common_style_text_textAlignment_option_center",value:"center",src:g+"style/icon-text-alignCenter.png"},{label:"widget_common_style_text_textAlignment_option_right",value:"right",src:g+"style/icon-text-alignRight.png"}]},X={category:a,type:"areainput"},q={...X,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},F={...X,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},z={category:a,type:"switch",label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},U={category:a,type:"colorpicker",label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},G={category:a,type:"slider",label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},J={category:a,type:"switch",label:"widget_common_style_container_label_displayCloseButton",propName:"closeButton",value:!0},K={category:a,type:"colorpicker",label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Z={category:a,type:"switch",label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},ee={category:a,type:"slider",label:"widget_common_style_buttons_label_buttonBorderThickness",propName:"buttonsBorderWidth",value:1,min:0,max:30,unit:"px"},oe={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBorderColor",propName:"buttonsBorderColor",value:"rgba(87, 184, 199, 1)"},te={category:a,type:"slider",label:"widget_common_style_buttons_label_buttonBorderRadius",propName:"buttonsBorderRadius",value:4,min:0,max:30,unit:"px"},le={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonBackgroundColor",propName:"buttonsBackgroundColor",value:"rgba(0, 127, 145, 1)"},ne={category:a,type:"colorpicker",label:"widget_common_style_buttons_label_buttonTextColor",propName:"buttonsTextColor",value:m},ie=[{field:j.propName,value:e=>e>0}];Y.conditions=ie;const ae={category:a,type:s,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[j,Y,$]},re={category:a,type:s,label:"widget_common_style_blockTitle_text",collapsible:!0,children:[W,H]},_e=[{field:"dropShadow",value:!0}];U.conditions=_e,G.conditions=_e;const ce={category:a,type:s,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[q,F,Q,z,U,G,J]},pe={category:a,type:s,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[K,Z],conditions:[{field:"layout",value:"popin"}]},de=[{field:ee.propName,value:e=>e>0}];oe.conditions=de;const se={category:a,type:s,label:"widget_common_style_blockTitle_buttons",collapsible:!0,children:[ee,oe,te,le,ne]};var ge=[{field:"isFeedBackQuestion",value:!0}],me=[{field:"isLegend",value:!0}],ue=[{category:r,type:p,propName:"question",label:"widget_nps_content_question_label",value:"widget_nps_content_question_default"},{category:r,type:d,propName:"isLegend",label:"widget_nps_content_legend_toggler_label_displayLegend",value:!1},{category:r,type:c,propName:"minLegend",label:"widget_nps_content_legend_label_minLegend",value:"widget_nps_content_legend_default_minLegend",conditions:me},{category:r,type:c,propName:"maxLegend",label:"widget_nps_content_legend_label_maxLegend",value:"widget_nps_content_legend_default_maxLegend",conditions:me},{category:r,type:d,propName:"isFeedBackQuestion",label:"widget_nps_content_oeq_toggler_label_askOpenEndedQuestion",value:!1},{category:r,type:p,propName:"feedbackQuestion",label:"widget_nps_style_preview_option_openEndedQuestion",value:"widget_nps_content_defaultOpenEndedQuestionValue",conditions:ge},{category:r,type:c,propName:"buttonText",label:"widget_nps_content_buttonText_label",value:"widget_nps_content_buttonText_default_send",conditions:ge},{category:r,type:d,propName:"isThankYouMessage",label:"widget_nps_content_tym_toggler_label_displayThankYouMessage",value:!1},{category:r,type:p,propName:"thankYouMessage",label:"widget_nps_content_tym_label_thankYouMessage",value:"widget_nps_content_tym_default_thankYouMessage",conditions:[{field:"isThankYouMessage",value:!0}]}],ye=i(D.children),be={category:_,type:d,propName:"autoHide",value:!0,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterSubmit"},ve={category:_,type:"slider",propName:"timeHide",value:2,max:120,label:"widget_common_conditions_triggering_autohide_toggler_label_autoHideAfterXSeconds",conditions:[{field:"autoHide",value:!0}]};O.collapsed=!1;var we=[O,x,be,ve],fe={category:a,type:s,label:{en:"Preview",fr:"Prévisualisation",es:"Previsualización",de:"Vorschau"},collapsible:!0,collapsed:!1,children:[{category:a,type:"radio",propName:"stepToShow",value:"displayNoteStep",label:"widget_nps_style_preview_label_selectStep",options:[{label:"widget_nps_style_preview_option_npsScore",value:"displayNoteStep"},{label:"widget_nps_style_preview_option_openEndedQuestion",value:"displayFeedbackStep"},{label:"widget_nps_style_preview_option_thankYouMessage",value:"displayThanksStep"}]}]},Ne={category:a,type:d,propName:"noStyles",value:!1,label:"widget_common_style_theme_option_custom"},he=function(e){return!e.noStyles};re.condition=he,se.condition=he,ce.condition=he,ae.condition=he,pe.condition=he,fe.collapsed=!1,re.collapsed=!1;var ke=[fe,Ne,re,se,ce,ae,pe];return[].concat(i(we),i(ue),i(ye),i(ke))})); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var e=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",r=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function a(e,t,n,i){var s=t&&t.prototype instanceof h?t:h,r=Object.create(s.prototype),o=new C(i||[]);return r._invoke=function(e,t,n){var i="suspendedStart";return function(s,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===s)throw r;return S()}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=b(o,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var h=c(e,t,n);if("normal"===h.type){if(i=n.done?"completed":"suspendedYield",h.arg===l)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(i="completed",n.method="throw",n.arg=h.arg)}}}(e,n,o),r}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=a;var l={};function h(){}function u(){}function d(){}var m={};m[s]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(N([])));p&&p!==t&&n.call(p,s)&&(m=p);var v=d.prototype=h.prototype=Object.create(m);function f(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e,t){var i;this._invoke=function(s,r){function o(){return new t((function(i,o){!function i(s,r,o,a){var l=c(e[s],e,r);if("throw"!==l.type){var h=l.arg,u=h.value;return u&&"object"==typeof u&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,o,a)}),(function(e){i("throw",e,o,a)})):t.resolve(u).then((function(e){h.value=e,o(h)}),(function(e){return i("throw",e,o,a)}))}a(l.arg)}(s,r,i,o)}))}return i=i?i.then(o,o):o()}}function b(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=c(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var s=i.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function N(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return u.prototype=v.constructor=d,d.constructor=u,d[o]=u.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},f(y.prototype),y.prototype[r]=function(){return this},e.AsyncIterator=y,e.async=function(t,n,i,s,r){void 0===r&&(r=Promise);var o=new y(a(t,n,i,s),r);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},f(v),v[o]="Generator",v[s]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return o.type="throw",o.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;E(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));function t(e,t,n,i,s,r,o){try{var a=e[r](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,s)}var n=function(e){return function(){var n=this,i=arguments;return new Promise((function(s,r){var o=e.apply(n,i);function a(e){t(o,s,r,a,c,"next",e)}function c(e){t(o,s,r,a,c,"throw",e)}a(void 0)}))}};const i=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const s=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},r=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})(),o=()=>{if(i())return!1;const e=ABTasty.getTestsOnPage()[TEST_ID];return!!e&&Object.keys(e.targetings.qaParameters).length>0},a="https://social-proof-api.abtasty.com/clients/",c=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?"_"+e:""}`},l=()=>{const e=c();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},h=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,u=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},d=e=>{if(o()){const t=l();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},m=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t},g=(e,t,n)=>{let i=0,s=0;try{document.querySelector(e)}catch(t){const i=`Selector «${e}» not valid.`;return u(i),"function"==typeof n&&n(i)}function r(){clearInterval(s),clearTimeout(i)}return i=setTimeout(()=>{r();const t=`Can't find element «${e}».`;return u(t),"function"==typeof n&&n(t)},1e4),s=setInterval(()=>{const n=document.querySelector(e);return null!==n?(r(),"function"==typeof t&&t(n)):n},200),{clear:r}};async function p(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(e){return new Promise((t,n)=>{const i=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=e,i.parentNode.insertBefore(s,i),s.onload=t,s.onerror=n})}("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}class v{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=c(),this.uniqueId=h(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem("ABTastyWidgets",JSON.stringify(i)),i):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const n=this.getTypeOfStorage(e);if(!n&&"object"!=typeof n)return!1;const{storageString:i,storageMethod:s}=n,r=this.getStamp(e),o={type:t,stamp:r},{type:a}=this.getCurrentRecurrence(),c=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===i?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const r=n?{[this.recurrenceKey]:o,...n}:{[this.recurrenceKey]:o};s.setItem("ABTastyWidgets",JSON.stringify(r)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)c();else{if("display"!==t||"validation"===a||"closing"===a)return!1;c()}else c();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class f{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const s=[...e.querySelectorAll(i)];if(s.length&&s.includes(n))return!0;if(t.includes(n))return!0;const r=[...e.parentElement.children],o=r.findIndex(t=>t.isSameNode(e)),a=r.filter((e,t)=>t>o);if(a.length){if(a.includes(n))return!0;if(a.some(e=>[...e.querySelectorAll(i)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,s=this.targets.find(t=>t.selector===e&&t.uniqueId===i);s&&s.resolve(t),this.clear(e,i)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===function e(t,n){return n(t)||!t.parentElement?t:e(t.parentElement,n)}(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,s=0;for(;!i&&s<n.length;){const t=document.elementFromPoint(...n[s]);i=e===t||e.contains(t),s+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=document.querySelector(e);n&&!this.existingTargets.find(e=>e.element===n&&e.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n}),this.startMutationObserver()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class y{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:t}){const n=m(this.event+"DomReady");this.promises.push(n);const i=await this.onPageLoad(n),s=await p("IntersectionObserver"),r=function(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}("VisibilityObserver",f);if(this.visibilityObservers.push(r),s&&i){const e=h();r.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const e=["readystatechange",()=>n()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const n=document.createElement("style");n.type="text/css",n.id="Click_"+h(),n.innerHTML=this.selector+" {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}",document.head.appendChild(n),this.elementsSelectors.push("#"+n.id);const i=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),s=["click",({target:e})=>i(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],i=g("body",e=>{e.addEventListener(...n),this.eventsListeners.push([e,...n]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i)});return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const s=[()=>(i=n,i),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...s),this.eventsListeners.push([e,...s])});const r=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const n=window.ABTastyProductKey,i=s(),{viewInterval:r,triggerSocialProofMinPurchases:o,spNoTrim:c}=DATA;return n||(d("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),n&&i?fetch(`${a}${i}/metrics/i?key=${n}${c?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===r||void 0===o)return!1;const t=e[r]&&e[r]>=o;return t||d(`Widget will not be shown, product has been purchased ${e[r]} times while ${o} are required`),t})(e)&&t(e[r])).catch(()=>d("Failed to fetch datas from server.")):t(!1),e}getSocialProofPageViews({promise:e,resolve:t}){const n=encodeURIComponent(""+window.location.pathname),i=s(),{viewInterval:r,triggerSocialProofMinPageViews:o}=DATA;return n&&i?fetch(`${a}${i}/metrics/pv?key=${n}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===r||void 0===o)return!1;const t=e[r]&&e[r]>=o;return t||d(`Widget will not be shown, page has been seen ${e[r]} times while ${o} are required`),t})(e)&&t(e[r])).catch(()=>d("Failed to fetch datas from server.")):t(!1),e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...n]="string"==typeof e[0]?[document,...e]:e;t&&n.length>1&&t.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=h();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=m(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=m(this.event+"Delay");return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():n}}class b{constructor(e,t,n){this.recurrence=e,this.isWidgetApplied=t,this.callback=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},i=()=>e&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&i()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&i())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=r();return[250,500].forEach(t=>setTimeout(()=>500===t&&r()===e?this:(e=r(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),n=e.some(({addedNodes:e})=>e&&e.length);return t||n?(this.decisionHandler(!0),this):this}watch(){if(i())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const e=g("body",t=>{const n=[t,{childList:!0,subtree:!0}];this.observer.observe(...n),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});return this.elementsWaiters.push(e),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class w{constructor(){this.children=void 0,this.uniqueId=h(),this.widgetName=c(),this.prettyName=l(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:t,validationRecurrence:n}=DATA;if(i()||!e&&!t&&!n)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[e+"_day"],week:e=>7*DATA[e+"_week"],month:e=>30.5*DATA[e+"_month"]},r={};return e&&(r.displayRecurrence=s[e]("displayRecurrence")),t&&(r.closingRecurrence=s[t]("closingRecurrence")),n&&(r.validationRecurrence=s[n]("validationRecurrence")),r})(),this.triggerParams=(()=>{let{triggerEvent:e}=DATA;const{triggerEventClick:t,triggerEventReengageDelay:n,socialProofContentType:s,triggerEventElementVisible:r,triggerEventDelay:o}=DATA;if(i()||!e&&!s)return!1;const a={click:()=>t,elementVisible:()=>r},c=Object.prototype.hasOwnProperty.call(a,e)?a[e]():"body",l="reengage"===e?n:o;return s&&(e=1===s?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:e,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new v(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new y(this.triggerParams),this.pageWatcher=new b(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)})(),this.basicClassName="ab_widget_container_"+this.widgetName,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=this.basicClassName+"_content",this.overlayClassName=this.basicClassName+"_overlay",this.closeButtonClassName=this.basicClassName+"_close_button",this.hideClassName="ab_hide_"+this.uniqueId,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,n)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),d(e),n(e)},t=new Promise((t,n)=>{const i=g("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i),t(e.appendChild(this.styleElement))},t=>e(t,i,n));this.elementsWaiters.push(i)}),n=new Promise((t,n)=>{const{layout:i,elementReferrer:s,referrerInsertType:r}=DATA,{selector:o,position:a}="string"==typeof i&&"free"===i&&"string"==typeof s&&"string"==typeof r?{selector:s,position:r}:{selector:"body",position:"beforeend"},c=g(o,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==c),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,c,n));this.elementsWaiters.push(c)});return Promise.all([n,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():i()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||i()||window.ABTastyEvent(this.prettyName+" displayed",null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!i()&&window.ABTastyEvent(this.prettyName+" closed",null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(e){if(!i()&&!r())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const t=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!t)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const n=i()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!n&&(await this.insert(),this.addCloseEvent(),i()||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(n),{container:this,response:n})}onPageChange(e,t){const n=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):n()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:n,layout:i}=DATA,s=[];if(void 0!==n&&n&&void 0!==i&&"popin"===i&&s.push("."+this.overlayClassName),void 0!==t&&t&&s.push("."+this.closeButtonClassName),!s.length)return this;const r=this.domElement.querySelectorAll(s.join(", "));return r.length?(e.push(...r),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:e,layout:t}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,n.innerHTML=`\n\t\t\t${void 0!==t&&"popin"===t?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${e?`<button class="${this.closeButtonClassName}" ${i()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,n}getStyleTag(e=""){const{noStyles:t,layout:n}=DATA,{backgroundColor:s,backgroundImage:r,borderColor:o,borderRadius:a,borderWidth:c,textColor:l,textAlign:h,overlayColor:u,dropShadow:d,dropShadowColor:m,dropShadowBlur:g,containerMargin:p,containerPadding:v,closeButton:f,buttonsBorderWidth:y,buttonsBorderColor:b,buttonsBorderRadius:w,buttonsBackgroundColor:E,buttonsTextColor:C}=t?{}:DATA,N=document.createElement("style");N.type="text/css",i()&&N.setAttribute("abtasty-script-added","true");const S=`background-color: ${void 0!==s?s:"rgba(255, 255, 255, 1)"};`,_=void 0!==r?`background-image: url(${r});`:"",T=void 0!==a?`border-radius: ${a}px;`:"",x=void 0!==c&&c?`border-width: ${c}px; border-style: solid;`:"",k=[o,c].every(e=>void 0!==e)&&c?`border-color: ${o};`:"",A=void 0!==l?`color: ${l}; fill: ${l};`:"",$=void 0!==h?`text-align: ${h};`:"",L=void 0!==d&&d?`box-shadow: 0 5px ${g}px 0 ${m};`:"",I=p instanceof Array&&1===p.length&&p[0],P=I?`margin: ${I.top}px ${I.right}px ${I.bottom}px ${I.left}px;`:"",O=I?`margin: calc(${I.top}px * 0.5) calc(${I.right}px * 0.5) calc(${I.bottom}px * 0.5) calc(${I.left}px * 0.5);`:"",R=v instanceof Array&&1===v.length&&v[0],B=R?`padding: ${R.top}px ${R.right}px ${R.bottom}px ${R.left}px;`:"",W=R?`padding: calc(${R.top}px * 0.5) calc(${R.right}px * 0.5) calc(${R.bottom}px * 0.5) calc(${R.left}px * 0.5);`:"",D=void 0!==y&&y?`border-width: ${y}px; border-style: solid;`:"",j=[b,y].every(e=>void 0!==e)&&y?`border-color: ${b};`:"",q=void 0!==w?`border-radius: ${w}px;`:"",V=void 0!==E?`background-color: ${E};`:"",M=void 0!==C?`color: ${C};`:"",F=void 0!==n&&"popin"===n?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==u?u:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",H=t||void 0!==f&&f?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",A,"}"].join(""):"";return N.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,S,_,T,x,k,A,$,L,P,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,D,j,q,V,M,"}","@media screen and (max-width: 549px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,O,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,W,"}","}",F,H,""+e].join(""),N}}class E extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 549px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class C extends w{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",this.position+": 0;","left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class N extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const S=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new E;break;case"bannerTop":case"bannerBottom":t=new C;break;case"free":t=new N;break;default:t=new w}return t},_={category:"conditions",type:"slider",min:1},T=[{..._,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{..._,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{..._,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],x={category:"conditions",type:"select",options:[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],value:"everytime"},k={...x,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},A=(T.map(e=>({...e,propName:`${k.propName}_${e.propName}`,conditions:[{field:k.propName,value:e.propName}]})),{...x,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"}),$=(T.map(e=>({...e,propName:`${A.propName}_${e.propName}`,conditions:[{field:A.propName,value:e.propName}]})),{...x,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"}),L=(T.map(e=>({...e,propName:`${$.propName}_${e.propName}`,conditions:[{field:$.propName,value:e.propName}]})),{pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}});Object.keys(L).map(e=>L[e]);var I=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function P(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var O=function(e,t,n){return t&&P(e.prototype,t),n&&P(e,n),e},R=DATA,B=R.isFeedBackQuestion,W=R.isThankYouMessage,D=R.autoHide,j=R.timeHide,q=R.stepToShow,V=R.question,M=R.feedbackQuestion,F=R.buttonText,H=R.thankYouMessage,Y=R.isLegend,G=R.minLegend,U=R.maxLegend,z=R.noStyles,K=function(){function e(t){var n=t.parentContainer;I(this,e),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(n.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return O(e,[{key:"sendNote",value:function(){if(!i()&&!isNaN(this.currentNote)){try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(e){d("Not able to send NPS hit due to old tag version (< 3.0)")}this.parentContainer.recurrence.setValidationRecurrence()}return this}},{key:"insertIn",value:function(e,t){return document.head.insertAdjacentElement("beforeend",this.styleElement),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),D?(setTimeout((function(){e.parentContainer.hide(),setTimeout((function(){e.parentContainer.remove(),e.showNotes(),e.currentNote=NaN,e.userFeedback="",e.feedbackElements.feedbackFormElement.querySelector("textarea").value=""}),1e3)}),1e3*j),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),B&&M&&M.length?this.showFeedBack():W&&H&&H.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){W&&H&&H.length?this.showThankYouMessage():this.complete()}},{key:"showNotes",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),[this.questionElement,this.notesContainer].forEach((function(t){return t.classList.remove(e.hideClassName)})),this}},{key:"showFeedBack",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),Object.values(this.feedbackElements).forEach((function(t){return t.classList.remove(e.hideClassName)})),this}},{key:"showThankYouMessage",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var e=document.createElement("p");return e.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),e.innerHTML=H,i()&&"displayThanksStep"===q&&e.classList.remove(this.hideClassName),e}},{key:"getFeedBackElements",value:function(){var e=this,t=document.createElement("p");t.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),t.innerHTML=M;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),n.addEventListener("submit",(function(e){return e.preventDefault()}),{passive:!1});var s=document.createElement("textarea");s.className="".concat(this.feedbackQuestionClassName,"_textarea");var r=document.createElement("button");return r.className="".concat(this.feedbackQuestionClassName,"_button"),r.innerHTML="<span>".concat(F,"</span>"),r.addEventListener("click",(function(){return e.userFeedback=s.value,e.onFeedbackSend()}),{passive:!0}),i()&&"displayFeedbackStep"===q&&[t,n].forEach((function(t){return t.classList.remove(e.hideClassName)})),n.appendChild(s),n.appendChild(r),{feedbackQuestionElement:t,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var e=this,t=document.createElement("div");t.className=this.notesClassName,i()&&"displayNoteStep"!==q&&t.classList.add(this.hideClassName);for(var n=10;n>=0;){var s=document.createElement("button");s.className=this.notesButtonsClassName,s.dataset.note=n,i()&&s.setAttribute("data-abtasty-actionnable",""),s.innerHTML+="<span>".concat(n,"</span>"),s.addEventListener("click",(function(t){return e.onClickNote(t)}),{passive:!0}),t.insertAdjacentElement("afterbegin",s),5===n&&s.insertAdjacentHTML("afterend","<br>"),n-=1}return Y&&(t.insertAdjacentHTML("afterbegin","<legend>".concat(G,"</legend>")),t.insertAdjacentHTML("beforeend","<legend>".concat(U,"</legend>"))),t}},{key:"getQuestionElement",value:function(){var e=document.createElement("p");return e.className=this.questionClassName,e.innerHTML=V,i()&&"displayNoteStep"!==q&&e.classList.add(this.hideClassName),e}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),B&&Object.values(this.feedbackElements).forEach((function(t){e.npsContainer.appendChild(t)})),W&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getStyleElement",value:function(){var e=document.createElement("style");if(e.type="text/css",i()&&e.setAttribute("abtasty-script-added","true"),z)e.textContent=["#".concat(this.parentContainer.widgetContainerId," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var t=DATA.containerPadding,n=t instanceof Array&&1===t.length&&t[0],s="#".concat(this.parentContainer.widgetContainerId," .").concat(this.className);e.textContent=["".concat(s," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(s,","),"".concat(s," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: 1;","font-family: sans-serif;","}","".concat(s," > * {"),"display: block;","width: 100%;","}","".concat(s," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(s," p {"),"margin-bottom: 15px;","font-size: 1.4em;","}","".concat(s," button {"),"vertical-align: middle;","cursor: pointer;","}","".concat(s," button span {"),"font-size: 1.4em;","pointer-events: none;","}","".concat(s," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: 30px;","height: 30px;","}","".concat(s," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",Y?["".concat(s," legend {"),"position: absolute;","text-decoration: none;","border: none;","font-size: 1em;","}","".concat(s," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(s," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(s," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 550px) {",Y?["".concat(s," .").concat(this.notesClassName," {"),"padding-top: 22px","}","".concat(s," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(s," br {"),"display: none","}","}","@media screen and (max-width: 549px) {","".concat(s," {"),"min-width: ".concat(240+(n.left+n.right/2),"px;"),"}","".concat(s," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(s," br {"),"display: block","}",Y?["".concat(s," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(s," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(s," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(s," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(s," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(s," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(s," textarea {"),"min-width: auto;","}","}"].join("")}return e}}]),e}();function Q(){return(Q=n(e.mark((function t(){var n,i,s;return e.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=S(),i=n.domElement.querySelector(".".concat(n.contentClassName)),s=new K({parentContainer:n}),n.children=s,s.insertIn(i,"beforeend"),n.init().then((function(e){return e.response&&n.show()})),e.abrupt("return",{parentContainer:n,NPS:s});case 8:case"end":return e.stop()}}),t)})))).apply(this,arguments)}!function(){Q.apply(this,arguments)}()}(); | ||
!function(){"use strict";var e=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",r=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function a(e,t,n,i){var s=t&&t.prototype instanceof h?t:h,r=Object.create(s.prototype),o=new C(i||[]);return r._invoke=function(e,t,n){var i="suspendedStart";return function(s,r){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===s)throw r;return S()}for(n.method=s,n.arg=r;;){var o=n.delegate;if(o){var a=b(o,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var h=c(e,t,n);if("normal"===h.type){if(i=n.done?"completed":"suspendedYield",h.arg===l)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(i="completed",n.method="throw",n.arg=h.arg)}}}(e,n,o),r}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=a;var l={};function h(){}function u(){}function d(){}var m={};m[s]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(N([])));p&&p!==t&&n.call(p,s)&&(m=p);var v=d.prototype=h.prototype=Object.create(m);function f(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e,t){var i;this._invoke=function(s,r){function o(){return new t((function(i,o){!function i(s,r,o,a){var l=c(e[s],e,r);if("throw"!==l.type){var h=l.arg,u=h.value;return u&&"object"==typeof u&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){i("next",e,o,a)}),(function(e){i("throw",e,o,a)})):t.resolve(u).then((function(e){h.value=e,o(h)}),(function(e){return i("throw",e,o,a)}))}a(l.arg)}(s,r,i,o)}))}return i=i?i.then(o,o):o()}}function b(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=c(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var s=i.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function N(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i<e.length;)if(n.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return u.prototype=v.constructor=d,d.constructor=u,d[o]=u.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},f(y.prototype),y.prototype[r]=function(){return this},e.AsyncIterator=y,e.async=function(t,n,i,s,r){void 0===r&&(r=Promise);var o=new y(a(t,n,i,s),r);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},f(v),v[o]="Generator",v[s]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},e.values=N,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(n,i){return o.type="throw",o.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s],o=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var a=n.call(r,"catchLoc"),c=n.call(r,"finallyLoc");if(a&&c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var s=i.arg;E(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:N(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));function t(e,t,n,i,s,r,o){try{var a=e[r](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(i,s)}var n=function(e){return function(){var n=this,i=arguments;return new Promise((function(s,r){var o=e.apply(n,i);function a(e){t(o,s,r,a,c,"next",e)}function c(e){t(o,s,r,a,c,"throw",e)}a(void 0)}))}};const i=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const s=()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e},r=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID]||(()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t})(),o=()=>{if(i())return!1;const e=ABTasty.getTestsOnPage()[TEST_ID];return!!e&&Object.keys(e.targetings.qaParameters).length>0},a="https://social-proof-api.abtasty.com/clients/",c=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?"_"+e:""}`},l=()=>{const e=c();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},h=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,u=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},d=e=>{if(o()){const t=l();window.console.log(`%c${t} - QA Mode for campaign ${TEST_ID}\n${e}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},m=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t},g=(e,t,n)=>{let i=0,s=0;try{document.querySelector(e)}catch(t){const i=`Selector «${e}» not valid.`;return u(i),"function"==typeof n&&n(i)}function r(){clearInterval(s),clearTimeout(i)}return i=setTimeout(()=>{r();const t=`Can't find element «${e}».`;return u(t),"function"==typeof n&&n(t)},1e4),s=setInterval(()=>{const n=document.querySelector(e);return null!==n?(r(),"function"==typeof t&&t(n)):n},200),{clear:r}};async function p(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(e){return new Promise((t,n)=>{const i=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=e,i.parentNode.insertBefore(s,i),s.onload=t,s.onerror=n})}("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:t=!0}return t}class v{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:n},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=c(),this.uniqueId=h(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:n,...i}=t;return Object.entries(i).length?(e.setItem("ABTastyWidgets",JSON.stringify(i)),i):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const n=this.getTypeOfStorage(e);if(!n&&"object"!=typeof n)return!1;const{storageString:i,storageMethod:s}=n,r=this.getStamp(e),o={type:t,stamp:r},{type:a}=this.getCurrentRecurrence(),c=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let n;"session"===i?e?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(t?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const r=n?{[this.recurrenceKey]:o,...n}:{[this.recurrenceKey]:o};s.setItem("ABTastyWidgets",JSON.stringify(r)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)c();else{if("display"!==t||"validation"===a||"closing"===a)return!1;c()}else c();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class f{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(e))return!0;const s=[...e.querySelectorAll(i)];if(s.length&&s.includes(n))return!0;if(t.includes(n))return!0;const r=[...e.parentElement.children],o=r.findIndex(t=>t.isSameNode(e)),a=r.filter((e,t)=>t>o);if(a.length){if(a.includes(n))return!0;if(a.some(e=>[...e.querySelectorAll(i)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:e,element:t,uniqueId:i}=n,s=this.targets.find(t=>t.selector===e&&t.uniqueId===i);s&&s.resolve(t),this.clear(e,i)}}mouseOverHandler(){const e=["mouseover",e=>setTimeout(()=>this.onMouseOver(e),50),!0];return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===function e(t,n){return n(t)||!t.parentElement?t:e(t.parentElement,n)}(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),n=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let i=!1,s=0;for(;!i&&s<n.length;){const t=document.elementFromPoint(...n[s]);i=e===t||e.contains(t),s+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const n=document.querySelector(e);n&&!this.existingTargets.find(e=>e.element===n&&e.uniqueId===t)&&(this.existingTargets.push({element:n,selector:e,uniqueId:t}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:n})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);return i&&i.resolve(t),this.clear(e,n),!1}return!0})}watch(e,t,n){this.targets.push({selector:e,resolve:t,uniqueId:n}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==e&&i!==t)),this.visibilityObserver.unobserve(document.querySelector(e)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class y{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:n}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:t}){const n=m(this.event+"DomReady");this.promises.push(n);const i=await this.onPageLoad(n),s=await p("IntersectionObserver"),r=function(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}("VisibilityObserver",f);if(this.visibilityObservers.push(r),s&&i){const e=h();r.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const n=()=>"complete"===document.readyState;if(!n()){const e=["readystatechange",()=>n()&&t(!0),{passive:!0}];this.eventsListeners.push(e),document.addEventListener(...e)}return t(!0),e}onClick({promise:e,resolve:t}){const n=document.createElement("style");n.type="text/css",n.id="Click_"+h(),n.innerHTML=this.selector+" {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}",document.head.appendChild(n),this.elementsSelectors.push("#"+n.id);const i=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),s=["click",({target:e})=>i(e)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),e}onExitIntent({promise:e,resolve:t}){const n=["mouseleave",async({clientY:e})=>{e<=0&&t(!0)},{passive:!0}],i=g("body",e=>{e.addEventListener(...n),this.eventsListeners.push([e,...n]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i)});return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const n=this.delay;let i=n;const s=[()=>(i=n,i),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...s),this.eventsListeners.push([e,...s])});const r=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:t}){const n=window.ABTastyProductKey,i=s(),{viewInterval:r,triggerSocialProofMinPurchases:o,spNoTrim:c}=DATA;return n||(d("Not able to find ABTastyProductKey, impossible to call the API."),t(!1)),n&&i?fetch(`${a}${i}/metrics/i?key=${n}${c?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===r||void 0===o)return!1;const t=e[r]&&e[r]>=o;return t||d(`Widget will not be shown, product has been purchased ${e[r]} times while ${o} are required`),t})(e)&&t(e[r])).catch(()=>d("Failed to fetch datas from server.")):t(!1),e}getSocialProofPageViews({promise:e,resolve:t}){const n=encodeURIComponent(""+window.location.pathname),i=s(),{viewInterval:r,triggerSocialProofMinPageViews:o}=DATA;return n&&i?fetch(`${a}${i}/metrics/pv?key=${n}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===r||void 0===o)return!1;const t=e[r]&&e[r]>=o;return t||d(`Widget will not be shown, page has been seen ${e[r]} times while ${o} are required`),t})(e)&&t(e[r])).catch(()=>d("Failed to fetch datas from server.")):t(!1),e}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...n]="string"==typeof e[0]?[document,...e]:e;t&&n.length>1&&t.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length){const e=h();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=m(this.event);this.promises.push(e);const t={direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),socialProofPurchases:()=>this.getSocialProofPurchases(e),socialProofPageViews:()=>this.getSocialProofPageViews(e)},n=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const e=m(this.event+"Delay");return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():n}}class b{constructor(e,t,n){this.recurrence=e,this.isWidgetApplied=t,this.callback=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},i=()=>e&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&i()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&i())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=r();return[250,500].forEach(t=>setTimeout(()=>500===t&&r()===e?this:(e=r(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),n=e.some(({addedNodes:e})=>e&&e.length);return t||n?(this.decisionHandler(!0),this):this}watch(){if(i())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const e=g("body",t=>{const n=[t,{childList:!0,subtree:!0}];this.observer.observe(...n),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});return this.elementsWaiters.push(e),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class w{constructor(){this.children=void 0,this.uniqueId=h(),this.widgetName=c(),this.prettyName=l(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:t,validationRecurrence:n}=DATA;if(i()||!e&&!t&&!n)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[e+"_day"],week:e=>7*DATA[e+"_week"],month:e=>30.5*DATA[e+"_month"]},r={};return e&&(r.displayRecurrence=s[e]("displayRecurrence")),t&&(r.closingRecurrence=s[t]("closingRecurrence")),n&&(r.validationRecurrence=s[n]("validationRecurrence")),r})(),this.triggerParams=(()=>{let{triggerEvent:e}=DATA;const{triggerEventClick:t,triggerEventReengageDelay:n,socialProofContentType:s,triggerEventElementVisible:r,triggerEventDelay:o}=DATA;if(i()||!e&&!s)return!1;const a={click:()=>t,elementVisible:()=>r},c=Object.prototype.hasOwnProperty.call(a,e)?a[e]():"body",l="reengage"===e?n:o;return s&&(e=1===s?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:e,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new v(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new y(this.triggerParams),this.pageWatcher=new b(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!(!e||!["click","script"].includes(t))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(e=>e===t)})(),this.basicClassName="ab_widget_container_"+this.widgetName,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=this.basicClassName+"_content",this.overlayClassName=this.basicClassName+"_overlay",this.closeButtonClassName=this.basicClassName+"_close_button",this.hideClassName="ab_hide_"+this.uniqueId,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){const e=(e,t,n)=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),d(e),n(e)},t=new Promise((t,n)=>{const i=g("head",e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i),t(e.appendChild(this.styleElement))},t=>e(t,i,n));this.elementsWaiters.push(i)}),n=new Promise((t,n)=>{const{layout:i,elementReferrer:s,referrerInsertType:r}=DATA,{selector:o,position:a}="string"==typeof i&&"free"===i&&"string"==typeof s&&"string"==typeof r?{selector:s,position:r}:{selector:"body",position:"beforeend"},c=g(o,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==c),this.removeOldDomElement(),t(e.insertAdjacentElement(a,this.domElement))},t=>e(t,c,n));this.elementsWaiters.push(c)});return Promise.all([n,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():i()||this.init().then(({response:e})=>e?this.show():this),this}show(){return this.hasBeenShown||i()||window.ABTastyEvent(this.prettyName+" displayed",null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!i()&&window.ABTastyEvent(this.prettyName+" closed",null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(e){if(!i()&&!r())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const t=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!t)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const n=i()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!n&&(await this.insert(),this.addCloseEvent(),i()||e||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(n),{container:this,response:n})}onPageChange(e,t){const n=()=>this.init().then(({response:e})=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):n()}}addCloseEvent(...e){const{closeButton:t,overlayClickable:n,layout:i}=DATA,s=[];if(void 0!==n&&n&&void 0!==i&&"popin"===i&&s.push("."+this.overlayClassName),void 0!==t&&t&&s.push("."+this.closeButtonClassName),!s.length)return this;const r=this.domElement.querySelectorAll(s.join(", "));return r.length?(e.push(...r),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:e,layout:t}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,n.innerHTML=`\n\t\t\t${void 0!==t&&"popin"===t?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t${e?`<button class="${this.closeButtonClassName}" ${i()?"data-abtasty-actionnable":""}><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,n}getStyleTag(e=""){const{noStyles:t,layout:n}=DATA,{backgroundColor:s,backgroundImage:r,borderColor:o,borderRadius:a,borderWidth:c,textColor:l,textAlign:h,overlayColor:u,dropShadow:d,dropShadowColor:m,dropShadowBlur:g,containerMargin:p,containerPadding:v,closeButton:f,buttonsBorderWidth:y,buttonsBorderColor:b,buttonsBorderRadius:w,buttonsBackgroundColor:E,buttonsTextColor:C}=t?{}:DATA,N=document.createElement("style");N.type="text/css",i()&&N.setAttribute("abtasty-script-added","true");const S=`background-color: ${void 0!==s?s:"rgba(255, 255, 255, 1)"};`,_=void 0!==r?`background-image: url(${r});`:"",T=void 0!==a?`border-radius: ${a}px;`:"",x=void 0!==c&&c?`border-width: ${c}px; border-style: solid;`:"",k=[o,c].every(e=>void 0!==e)&&c?`border-color: ${o};`:"",A=void 0!==l?`color: ${l}; fill: ${l};`:"",$=void 0!==h?`text-align: ${h};`:"",L=void 0!==d&&d?`box-shadow: 0 5px ${g}px 0 ${m};`:"",I=p instanceof Array&&1===p.length&&p[0],P=I?`margin: ${I.top}px ${I.right}px ${I.bottom}px ${I.left}px;`:"",O=I?`margin: calc(${I.top}px * 0.5) calc(${I.right}px * 0.5) calc(${I.bottom}px * 0.5) calc(${I.left}px * 0.5);`:"",R=v instanceof Array&&1===v.length&&v[0],B=R?`padding: ${R.top}px ${R.right}px ${R.bottom}px ${R.left}px;`:"",W=R?`padding: calc(${R.top}px * 0.5) calc(${R.right}px * 0.5) calc(${R.bottom}px * 0.5) calc(${R.left}px * 0.5);`:"",D=void 0!==y&&y?`border-width: ${y}px; border-style: solid;`:"",j=[b,y].every(e=>void 0!==e)&&y?`border-color: ${b};`:"",q=void 0!==w?`border-radius: ${w}px;`:"",V=void 0!==E?`background-color: ${E};`:"",M=void 0!==C?`color: ${C};`:"",F=void 0!==n&&"popin"===n?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==u?u:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",H=t||void 0!==f&&f?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",A,"}"].join(""):"";return N.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,S,_,T,x,k,A,$,L,P,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;",B,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,D,j,q,V,M,"}","@media screen and (max-width: 549px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,O,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,W,"}","}",F,H,""+e].join(""),N}}class E extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 549px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class C extends w{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",this.position+": 0;","left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class N extends w{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const S=()=>{const{layout:e}=DATA;let t;switch(e){case"popin":t=new E;break;case"bannerTop":case"bannerBottom":t=new C;break;case"free":t=new N;break;default:t=new w}return t},_={category:"conditions",type:"slider",min:1},T=[{..._,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{..._,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{..._,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],x={category:"conditions",type:"select",options:[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],value:"everytime"},k={...x,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},A=(T.map(e=>({...e,propName:`${k.propName}_${e.propName}`,conditions:[{field:k.propName,value:e.propName}]})),{...x,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"}),$=(T.map(e=>({...e,propName:`${A.propName}_${e.propName}`,conditions:[{field:A.propName,value:e.propName}]})),{...x,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"}),L=(T.map(e=>({...e,propName:`${$.propName}_${e.propName}`,conditions:[{field:$.propName,value:e.propName}]})),{pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}});Object.keys(L).map(e=>L[e]);var I=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function P(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var O=function(e,t,n){return t&&P(e.prototype,t),n&&P(e,n),e},R=DATA,B=R.isFeedBackQuestion,W=R.isThankYouMessage,D=R.autoHide,j=R.timeHide,q=R.stepToShow,V=R.question,M=R.feedbackQuestion,F=R.buttonText,H=R.thankYouMessage,Y=R.isLegend,G=R.minLegend,U=R.maxLegend,z=R.noStyles,K=function(){function e(t){var n=t.parentContainer;I(this,e),this.parentContainer=n,this.baseClassName="nps_container",this.className="".concat(this.baseClassName,"_").concat(n.uniqueId),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(n.uniqueId,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return O(e,[{key:"sendNote",value:function(){if(!i()&&!isNaN(this.currentNote)){try{window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback})}catch(e){d("Not able to send NPS hit due to old tag version (< 3.0)")}this.parentContainer.recurrence.setValidationRecurrence()}return this}},{key:"insertIn",value:function(e,t){return document.head.insertAdjacentElement("beforeend",this.styleElement),e.insertAdjacentElement(t,this.npsElement),this}},{key:"complete",value:function(){var e=this;return this.sendNote(),D?(setTimeout((function(){e.parentContainer.hide(),setTimeout((function(){e.parentContainer.remove(),e.showNotes(),e.currentNote=NaN,e.userFeedback="",e.feedbackElements.feedbackFormElement.querySelector("textarea").value=""}),1e3)}),1e3*j),this):this}},{key:"onClickNote",value:function(e){this.currentNote=Number(e.target.dataset.note),B&&M&&M.length?this.showFeedBack():W&&H&&H.length?this.showThankYouMessage():this.complete()}},{key:"onFeedbackSend",value:function(){W&&H&&H.length?this.showThankYouMessage():this.complete()}},{key:"showNotes",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),[this.questionElement,this.notesContainer].forEach((function(t){return t.classList.remove(e.hideClassName)})),this}},{key:"showFeedBack",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),Object.values(this.feedbackElements).forEach((function(t){return t.classList.remove(e.hideClassName)})),this}},{key:"showThankYouMessage",value:function(){var e=this;return this.npsContainer.childNodes.forEach((function(t){return t.classList.add(e.hideClassName)})),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var e=document.createElement("p");return e.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),e.innerHTML=H,i()&&"displayThanksStep"===q&&e.classList.remove(this.hideClassName),e}},{key:"getFeedBackElements",value:function(){var e=this,t=document.createElement("p");t.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),t.innerHTML=M;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName),n.addEventListener("submit",(function(e){return e.preventDefault()}),{passive:!1});var s=document.createElement("textarea");s.className="".concat(this.feedbackQuestionClassName,"_textarea");var r=document.createElement("button");return r.className="".concat(this.feedbackQuestionClassName,"_button"),r.innerHTML="<span>".concat(F,"</span>"),r.addEventListener("click",(function(){return e.userFeedback=s.value,e.onFeedbackSend()}),{passive:!0}),i()&&"displayFeedbackStep"===q&&[t,n].forEach((function(t){return t.classList.remove(e.hideClassName)})),n.appendChild(s),n.appendChild(r),{feedbackQuestionElement:t,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var e=this,t=document.createElement("div");t.className=this.notesClassName,i()&&"displayNoteStep"!==q&&t.classList.add(this.hideClassName);for(var n=10;n>=0;){var s=document.createElement("button");s.className=this.notesButtonsClassName,s.dataset.note=n,i()&&s.setAttribute("data-abtasty-actionnable",""),s.innerHTML+="<span>".concat(n,"</span>"),s.addEventListener("click",(function(t){return e.onClickNote(t)}),{passive:!0}),t.insertAdjacentElement("afterbegin",s),5===n&&s.insertAdjacentHTML("afterend","<br>"),n-=1}return Y&&(t.insertAdjacentHTML("afterbegin","<legend>".concat(G,"</legend>")),t.insertAdjacentHTML("beforeend","<legend>".concat(U,"</legend>"))),t}},{key:"getQuestionElement",value:function(){var e=document.createElement("p");return e.className=this.questionClassName,e.innerHTML=V,i()&&"displayNoteStep"!==q&&e.classList.add(this.hideClassName),e}},{key:"getContainer",value:function(){var e=document.createElement("div");return e.className="".concat(this.baseClassName," ").concat(this.className),e}},{key:"getNPSElement",value:function(){var e=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),B&&Object.values(this.feedbackElements).forEach((function(t){e.npsContainer.appendChild(t)})),W&&this.npsContainer.appendChild(this.thankYouElement),this.npsContainer}},{key:"getStyleElement",value:function(){var e=document.createElement("style");if(e.type="text/css",i()&&e.setAttribute("abtasty-script-added","true"),z)e.textContent=["#".concat(this.parentContainer.widgetContainerId," .").concat(this.className," .").concat(this.hideClassName," {"),"display: none !important;","}"].join("");else{var t=DATA.containerPadding,n=t instanceof Array&&1===t.length&&t[0],s="#".concat(this.parentContainer.widgetContainerId," .").concat(this.className);e.textContent=["".concat(s," .").concat(this.hideClassName," {"),"display: none !important;","}","".concat(s,","),"".concat(s," * {"),"all: unset;","box-sizing: border-box;","font-size: 10px;","line-height: 1;","font-family: sans-serif;","}","".concat(s," > * {"),"display: block;","width: 100%;","}","".concat(s," .").concat(this.notesClassName," {"),"position: relative;","display: inline-block;","width: auto;","}","".concat(s," p {"),"margin-bottom: 15px;","font-size: 1.4em;","}","".concat(s," button {"),"vertical-align: middle;","cursor: pointer;","}","".concat(s," button span {"),"font-size: 1.4em;","pointer-events: none;","}","".concat(s," .").concat(this.notesClassName," button {"),"margin: 0 5px;","width: 30px;","height: 30px;","}","".concat(s," .").concat(this.feedbackFormClassName," span {"),"display: block;","padding: 6px 24px;","}",Y?["".concat(s," legend {"),"position: absolute;","text-decoration: none;","border: none;","font-size: 1em;","}","".concat(s," legend:nth-of-type(2) {"),"left: auto;","right: 0;","}"].join(""):"","".concat(s," textarea {"),"display: block;","width: 100%;","min-width: 310px;","min-height: 60px;","font-size: 1.4em;","border: 1px solid grey;","border-radius: 4px;","resize: vertical;","margin-bottom: 10px;","text-align: left;","padding: 5px;","}","".concat(s," .").concat(this.thankYouClassName," {"),"margin-bottom: 0;","}","@media screen and (min-width: 550px) {",Y?["".concat(s," .").concat(this.notesClassName," {"),"padding-top: 22px","}","".concat(s," legend {"),"top: 0;","left: 0;","display: inline-block;","width: auto;","}"].join(""):"","".concat(s," br {"),"display: none","}","}","@media screen and (max-width: 549px) {","".concat(s," {"),"min-width: ".concat(240+(n.left+n.right/2),"px;"),"}","".concat(s," .").concat(this.notesClassName," button {"),"margin-bottom: 5px;","}","".concat(s," br {"),"display: block","}",Y?["".concat(s," .").concat(this.notesClassName," {"),"padding-bottom: 35px;","}","".concat(s," legend {"),"bottom: 0;","left: 50%;","transform: translateX(-50%)","}","".concat(s," legend:nth-of-type(1) {"),"bottom: 15px;","}","".concat(s," legend:nth-of-type(2) {"),"left: 50%;","right: unset;","}","".concat(s," legend:nth-of-type(1)::before {"),'content: "0: ";',"}","".concat(s," legend:nth-of-type(2)::before{"),'content: "10: ";',"}"].join(""):"","".concat(s," textarea {"),"min-width: auto;","}","}"].join("")}return e}}]),e}();function Q(){return(Q=n(e.mark((function t(){var n,i,s;return e.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=S(),i=n.domElement.querySelector(".".concat(n.contentClassName)),s=new K({parentContainer:n}),n.children=s,s.insertIn(i,"beforeend"),n.init().then((function(e){return e.response&&n.show()})),e.abrupt("return",{parentContainer:n,NPS:s});case 8:case"end":return e.stop()}}),t)})))).apply(this,arguments)}!function(){Q.apply(this,arguments)}()}(); |
{ | ||
"name": "@abtasty/nps", | ||
"description": "Allow you to add a custom NPS on your website", | ||
"version": "0.5.2-6", | ||
"version": "0.5.2-7", | ||
"form": "dist/form.js", | ||
@@ -37,3 +37,3 @@ "main": "dist/main.js", | ||
"dependencies": { | ||
"@abtasty/widget-utils": "1.16.4", | ||
"@abtasty/widget-utils": "1.16.5-0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.8.3", | ||
@@ -40,0 +40,0 @@ "@rollup/plugin-commonjs": "^11.0.1", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60870
3
+ Added@abtasty/widget-utils@1.16.5-0(transitive)
- Removed@abtasty/widget-utils@1.16.4(transitive)