@abtasty/google-form-modal
Advanced tools
Comparing version 1.6.7 to 1.6.8
@@ -1,1 +0,1 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).widgetForm=o()}(this,(function(){"use strict";const e="style",o="layout",t="content",l="conditions",a="short-separator",i="select",n="colorpicker",r="number",_="selectelement",c="radio",p="switch",m="slider",d="group",g="inlinenotification",u="https://widgets-images.abtasty.com/",s="week",y="month",b=[{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:s},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:y},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],v={category:l,type:m,min:1},w=[{...v,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...v,propName:s,label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...v,propName:y,label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],h={category:l,type:i,options:b,value:"everytime"},f={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},N={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},k={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},x=w.map((({type:e,min:o,propName:t,label:a,value:i,max:n})=>({category:l,type:e,min:o,max:n,label:a,value:i,propName:`${f.propName}_${t}`,conditions:[{field:f.propName,value:t}]}))),B=w.map((({type:e,min:o,propName:t,label:a,value:i,max:n})=>({category:l,type:e,min:o,max:n,label:a,value:i,propName:`${N.propName}_${t}`,conditions:[{field:N.propName,value:t}]}))),I=w.map((({type:e,min:o,propName:t,label:a,value:i,max:n})=>({category:l,type:e,min:o,max:n,label:a,value:i,propName:`${k.propName}_${t}`,conditions:[{field:k.propName,value:t}]}))),P={category:l,type:a};N.condition=({closeButton:e,layout:o,overlay:t,overlayClickable:l,linkType:a})=>!("string"!=typeof a||!a.includes("Close"))||("popin"!==o||!1!==e||!1!==t&&!1!==l)&&(void 0===o||"popin"===o||!1!==e);const U={category:l,type:d,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[f,...x,{...P,condition:N.condition},N,...B,{...P},k,...I]},C="triggerEvent",T={category:l,type:m,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},S={...T,propName:"triggerEventReengageDelay",value:10,max:180},z={category:l,type:_,propName:"triggerEventClick",value:"body"},R={...z,propName:"triggerEventElementVisible"},O={category:l,type:"codeeditor",label:"widget_common_conditions_triggering_label_customTriggerJSCode",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\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},W={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"}},D={category:l,type:p,propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},E={category:l,type:i,label:"widget_common_conditions_triggering_label",options:[W.pageLoad,W.direct,W.exitIntent,W.reengage,W.click,W.elementVisible,W.customScript],propName:C,value:"pageLoad"};z.conditions=[{field:C,value:"click"}],S.conditions=[{field:C,value:"reengage"}],R.conditions=[{field:C,value:"elementVisible"}],O.conditions=[{field:C,value:"script"}],T.conditions=[{field:C,value:e=>"reengage"!==e}],D.conditions=[{field:C,value:e=>"click"===e||"script"===e}];const H={category:l,type:d,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[E,z,R,O,D,S,T]},$={category:o,type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${u}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${u}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${u}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${u}layout/icon-layout-freePlacement.png`}]},V={category:o,type:_,propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},L={category:o,type:c,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"}]},A={category:o,type:"positioninput",propName:"popinPosition",label:"widget_common_layout_blockTitle_layout",value:[{x:1,y:1}],condition:({layout:e})=>"popin"===e},X=[{field:"layout",value:"free"}];V.conditions=X,L.conditions=X;const M={category:o,type:d,label:"widget_common_layout_blockTitle_layout",collapsible:!0,children:[$,V,A,L]},j={category:o,type:p,label:"widget_common_layout_toggler_widgetDimensionsBasedOnContent",propName:"autoWidth",value:!0},F=[{label:"px",value:"px"},{label:"%",value:"%"},{label:"em",value:"em"},{label:"vw (% of viewport width)",value:"vw"},{label:"vh (% of viewport height)",value:"vh"},{label:"vmin (% of viewport minimum size)",value:"vmin"},{label:"vmax (% of viewport maximum size)",value:"vmax"}],J={category:o,type:p,propName:"autoHeight",label:"widget_common_layout_toggler_label_keepHeightAuto",value:!0},q={category:o,type:i,propName:"widthUnit",value:"vw",options:F},G={category:o,type:i,propName:"heightUnit",value:"vh",condition:({autoHeight:e})=>!e,options:F},K={category:o,type:r,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPercentWidth",value:50,max:100,condition:({widthUnit:e,layout:o})=>"px"!==e&&"popin"===o},Q={category:o,type:r,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPixelsWidth",value:parseInt(window.innerWidth/2.5,10),max:window.innerWidth,condition:({widthUnit:e,layout:o})=>"px"===e&&"popin"===o},Y={category:o,type:r,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPercentHeight",value:50,max:100,condition:({autoHeight:e,heightUnit:o,layout:t})=>!e&&"px"!==o&&"popin"===t},Z={category:o,type:r,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPixelsHeight",value:parseInt(window.innerHeight/2.5,10),max:window.innerHeight,condition:({autoHeight:e,heightUnit:o,layout:t})=>!e&&"px"===o&&"popin"===t},ee=({autoWidth:e})=>!e,oe={category:o,type:d,collapsible:!0,label:"widget_common_layout_blockTitle_dimensions",children:[j,...[K,Q,q,J,Y,Z,G].reduce(((e,o)=>{let t;const{condition:l}=o;return t=l?{...o,condition:e=>l(e)&&ee(e)}:{...o,condition:ee},[...e,t]}),[])],conditions:[{field:"layout",value:"popin"}]},te={category:o,type:g,label:"widget_common_layout_zindex_alert_text",hrefUrl:"widget_common_layout_zindex_alert_link"},le={category:o,type:d,label:"widget_common_layout_blockTitle_layering",collapsible:!0,children:[{category:o,type:c,propName:"zindex",value:"9999",label:"widget_common_layout_zIndex_label",options:[{label:"widget_common_layout_zIndex_radio_option_above",value:"2147483647"},{label:"widget_common_layout_zIndex_radio_option_default",value:"9999"},{label:"widget_common_layout_zIndex_radio_option_auto",value:"auto"},{label:"widget_common_layout_zIndex_radio_option_under",value:"-1"},{label:"widget_common_layout_zIndex_radio_option_custom",value:"custom"}]},{category:o,type:r,propName:"zindexCustom",label:"widget_common_layout_zIndex_custom_numberInput_label",value:1,min:-2147483647,max:2147483647,conditions:[{field:"zindex",value:"custom"}]}],conditions:[{field:"layout",value:e=>"free"!==e}]},ae={field:"isBackgroundImage",value:!0},ie={field:"backgroundSize",value:e=>"100% 100%"!==e},ne={category:e,type:n,label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:"rgba(247, 247, 247, 1)"},re={category:e,type:p,label:"widget_common_style_toggler_label_backgroundImage",propName:"isBackgroundImage",value:!1},_e={category:e,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:"",conditions:[ae]},ce={category:e,type:c,label:"widget_common_style_backgroundImageUploader_imageOptions_label",propName:"backgroundSize",value:"cover",options:[{label:"widget_common_style_backgroundImageUploader_imageOptions_option_cover",value:"cover"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_contain",value:"contain"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_fill",value:"100% 100%"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_none",value:"auto"}],conditions:[ae]},pe={category:e,type:i,label:"widget_common_style_backgroundImageUploader_imagePosition_select_label",propName:"backgroundPosition",value:"center",options:[{label:"widget_common_style_backgroundImageUploader_imagePosition_option_top",value:"top"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottom",value:"bottom"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_center",value:"center"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_left",value:"left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_right",value:"right"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_topLeft",value:"top left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_topRight",value:"top right"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottomLeft",value:"bottom left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottomRight",value:"bottom right"}],conditions:[ae,ie]},me={category:e,type:p,label:"widget_common_style_backgroundImageUploader_toggler_repeatBackgroundImage",propName:"backgroundRepeat",value:!1,conditions:[ae,ie,{field:"backgroundSize",value:e=>"cover"!==e}]},de={category:e,type:n,label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},ge={category:e,type:m,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},ue={category:e,type:m,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},se={category:e,type:"areainput"},ye={...se,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},be={...se,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},ve={category:e,type:p,label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},we={category:e,type:n,label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},he={category:e,type:m,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},fe={category:e,type:p,label:"widget_common_style_closeButton_label_displayCloseButton",propName:"closeButton",value:!0},Ne={category:e,type:c,label:"widget_common_style_closeButton_radio_closeButtonPosition",propName:"closeButtonPosition",value:"in",options:[{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_inside",value:"in"},{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_outside",value:"out"}]},ke={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonSize",propName:"closeButtonSize",value:16,min:10,max:50},xe={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonColor",propName:"closeButtonColor",value:"rgba(119, 119, 119, 1)",condition:({closeButtonBorderWidth:e})=>e>0},Be={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonBackgroundColor",propName:"closeButtonBackgroundColor",value:"rgba(255, 255, 255, 0)"},Ie={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonBorderRadius",propName:"closeButtonBorderRadius",value:0,min:0,max:50},Pe={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonBorderThickness",propName:"closeButtonBorderWidth",value:0,min:0,max:50},Ue={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonBorderColor",propName:"closeButtonBorderColor",value:"rgba(57, 57, 57, 1)"},Ce={category:e,type:p,propName:"overlay",label:"widget_common_style_blockTitle_overlay",value:!0},Te={category:e,type:n,label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Se={category:e,type:p,label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},ze=[ne,re,_e,ce,pe,me],Re=[{field:ue.propName,value:e=>e>0}];de.conditions=Re;const Oe={category:e,type:d,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[ue,de,ge]},We={category:e,type:a},De=[{field:"dropShadow",value:!0}];we.conditions=De,he.conditions=De;const Ee={category:e,type:d,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[ye,be,{...We},...ze,{...We},ve,we,he]},He=[{field:"overlay"}];Te.conditions=He,Se.conditions=He;const $e={category:e,type:d,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Ce,Te,Se],conditions:[{field:"layout",value:"popin"}]},Ve={category:e,type:a},Le=({closeButton:e})=>e,Ae={category:e,type:d,label:"widget_common_style_blockTitle_closeButton",collapsible:!0,children:[fe,...[Ne,{...Ve},ke,xe,Be,{...Ve},Ie,Pe,Ue].reduce(((e,o)=>{let t;const{condition:l}=o;return t=l?{...o,condition:e=>Le(e)&&l(e)}:{...o,condition:Le},[...e,t]}),[])]};Ee.collapsed=!1,M.collapsed=!1,H.collapsed=!1,Ee.children.find((function(e){return"containerPadding"===e.propName})).value=[{top:0,left:0,bottom:0,right:0}];var Xe=M.children.find((function(e){return"layout"===e.propName}));Xe.options=Xe.options.filter((function(e){return!e.value.includes("banner")})),U.children=U.children.filter((function(e,o){return!e.propName&&"validationRecurrence"!==U.children[o+1].propName||e.propName&&!e.propName.includes("validationRecurrence")}));var Me=oe.children.find((function(e){return"autoWidth"===e.propName})),je=oe.children.find((function(e){return"autoHeight"===e.propName}));return Me.value=!1,je.value=!1,[M,oe,te,le,{type:g,category:t,label:"widget_iframe_closable_alert_text",hrefUrl:"widget_iframe_closable_alert_link"},{propName:"iframeUrl",type:"url",category:t,label:"widget_iframe_content_label_iframeUrl",value:"widget_iframe_content_defaultUrl"},Ee,Oe,$e,Ae,H,U]})); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).widgetForm=o()}(this,function(){"use strict";const e="style",o="layout",t="content",l="conditions",i="short-separator",a="select",n="colorpicker",r="number",_="selectelement",c="radio",p="switch",d="slider",m="group",g="inlinenotification",u="https://widgets-images.abtasty.com/",s="week",y="month",b=[{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:s},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:y},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],v={category:l,type:d,min:1},w=[{...v,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...v,propName:s,label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...v,propName:y,label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],h={category:l,type:a,options:b,value:"everytime"},f={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},N={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},k={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},x=w.map(({type:e,min:o,propName:t,label:i,value:a,max:n})=>({category:l,type:e,min:o,max:n,label:i,value:a,propName:`${f.propName}_${t}`,conditions:[{field:f.propName,value:t}]})),B=w.map(({type:e,min:o,propName:t,label:i,value:a,max:n})=>({category:l,type:e,min:o,max:n,label:i,value:a,propName:`${N.propName}_${t}`,conditions:[{field:N.propName,value:t}]})),I=w.map(({type:e,min:o,propName:t,label:i,value:a,max:n})=>({category:l,type:e,min:o,max:n,label:i,value:a,propName:`${k.propName}_${t}`,conditions:[{field:k.propName,value:t}]})),P={category:l,type:i};N.condition=({closeButton:e,layout:o,overlay:t,overlayClickable:l,linkType:i})=>!("string"!=typeof i||!i.includes("Close"))||("popin"!==o||!1!==e||!1!==t&&!1!==l)&&(void 0===o||"popin"===o||!1!==e);const U={category:l,type:m,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[f,...x,{...P,condition:N.condition},N,...B,{...P},k,...I]},C="triggerEvent",T={category:l,type:d,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0},S={...T,propName:"triggerEventReengageDelay",value:10,max:180},z={category:l,type:_,propName:"triggerEventClick",value:"body"},R={...z,propName:"triggerEventElementVisible"},O={category:l,type:"codeeditor",label:"widget_common_conditions_triggering_label_customTriggerJSCode",propName:"triggerEventCustomScript",value:"/* In this example snippet, the widget will be triggered as soon as any scroll is detected.\nCreate your own by resolving resolve() with true (which does trigger) or false (which doesn't trigger) */\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},W={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"}},D={category:l,type:p,propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce"},E={category:l,type:a,label:"widget_common_conditions_triggering_label",options:[W.pageLoad,W.direct,W.exitIntent,W.reengage,W.click,W.elementVisible,W.customScript],propName:C,value:"pageLoad"};z.conditions=[{field:C,value:"click"}],S.conditions=[{field:C,value:"reengage"}],R.conditions=[{field:C,value:"elementVisible"}],O.conditions=[{field:C,value:"script"}],T.conditions=[{field:C,value:e=>"reengage"!==e}],D.conditions=[{field:C,value:e=>"click"===e||"script"===e}];const H={category:l,type:m,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[E,z,R,O,D,S,T]},$={category:o,type:"radioImage",propName:"layout",label:"widget_common_layout_label_selectALayout",value:"popin",style:"big",options:[{label:"widget_common_layout_option_modal",value:"popin",src:`${u}layout/icon-layout-modal.png`},{label:"widget_common_layout_option_topBanner",value:"bannerTop",src:`${u}layout/icon-layout-topBanner.png`},{label:"widget_common_layout_option_bottomBanner",value:"bannerBottom",src:`${u}layout/icon-layout-bottomBanner.png`},{label:"widget_common_layout_option_freePlacement",value:"free",src:`${u}layout/icon-layout-freePlacement.png`}]},V={category:o,type:_,propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},L={category:o,type:c,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"}]},A={category:o,type:"positioninput",propName:"popinPosition",label:"widget_common_layout_blockTitle_layout",value:[{x:1,y:1}],condition:({layout:e})=>"popin"===e},X=[{field:"layout",value:"free"}];V.conditions=X,L.conditions=X;const M={category:o,type:m,label:"widget_common_layout_blockTitle_layout",collapsible:!0,children:[$,V,A,L]},j={category:o,type:p,label:"widget_common_layout_toggler_widgetDimensionsBasedOnContent",propName:"autoWidth",value:!0},F=[{label:"px",value:"px"},{label:"%",value:"%"},{label:"em",value:"em"},{label:"vw (% of viewport width)",value:"vw"},{label:"vh (% of viewport height)",value:"vh"},{label:"vmin (% of viewport minimum size)",value:"vmin"},{label:"vmax (% of viewport maximum size)",value:"vmax"}],J={category:o,type:p,propName:"autoHeight",label:"widget_common_layout_toggler_label_keepHeightAuto",value:!0},q={category:o,type:a,propName:"widthUnit",value:"vw",options:F},G={category:o,type:a,propName:"heightUnit",value:"vh",condition:({autoHeight:e})=>!e,options:F},K={category:o,type:r,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPercentWidth",value:50,max:100,condition:({widthUnit:e,layout:o})=>"px"!==e&&"popin"===o},Q={category:o,type:r,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPixelsWidth",value:parseInt(window.innerWidth/2.5,10),max:window.innerWidth,condition:({widthUnit:e,layout:o})=>"px"===e&&"popin"===o},Y={category:o,type:r,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPercentHeight",value:50,max:100,condition:({autoHeight:e,heightUnit:o,layout:t})=>!e&&"px"!==o&&"popin"===t},Z={category:o,type:r,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPixelsHeight",value:parseInt(window.innerHeight/2.5,10),max:window.innerHeight,condition:({autoHeight:e,heightUnit:o,layout:t})=>!e&&"px"===o&&"popin"===t},ee=({autoWidth:e})=>!e;q.condition=ee,J.condition=ee;const oe=K.condition;K.condition=e=>oe(e)&&ee(e);const te=Q.condition;Q.condition=e=>te(e)&&ee(e);const le=Y.condition;Y.condition=e=>le(e)&&ee(e);const ie=Z.condition;Z.condition=e=>ie(e)&&ee(e);const ae=G.condition;G.condition=e=>ae(e)&&ee(e);const ne={category:o,type:m,collapsible:!0,label:"widget_common_layout_blockTitle_dimensions",children:[j,K,Q,q,J,Y,Z,G],conditions:[{field:"layout",value:"popin"}]},re={category:o,type:g,label:"widget_common_layout_zindex_alert_text",hrefUrl:"widget_common_layout_zindex_alert_link"},_e={category:o,type:m,label:"widget_common_layout_blockTitle_layering",collapsible:!0,children:[{category:o,type:c,propName:"zindex",value:"9999",label:"widget_common_layout_zIndex_label",options:[{label:"widget_common_layout_zIndex_radio_option_above",value:"2147483647"},{label:"widget_common_layout_zIndex_radio_option_default",value:"9999"},{label:"widget_common_layout_zIndex_radio_option_auto",value:"auto"},{label:"widget_common_layout_zIndex_radio_option_under",value:"-1"},{label:"widget_common_layout_zIndex_radio_option_custom",value:"custom"}]},{category:o,type:r,propName:"zindexCustom",label:"widget_common_layout_zIndex_custom_numberInput_label",value:1,min:-2147483647,max:2147483647,conditions:[{field:"zindex",value:"custom"}]}],conditions:[{field:"layout",value:e=>"free"!==e}]},ce={field:"isBackgroundImage",value:!0},pe={field:"backgroundSize",value:e=>"100% 100%"!==e},de={category:e,type:n,label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:"rgba(247, 247, 247, 1)"},me={category:e,type:p,label:"widget_common_style_toggler_label_backgroundImage",propName:"isBackgroundImage",value:!1},ge={category:e,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:"",conditions:[ce]},ue={category:e,type:c,label:"widget_common_style_backgroundImageUploader_imageOptions_label",propName:"backgroundSize",value:"cover",options:[{label:"widget_common_style_backgroundImageUploader_imageOptions_option_cover",value:"cover"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_contain",value:"contain"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_fill",value:"100% 100%"},{label:"widget_common_style_backgroundImageUploader_imageOptions_option_none",value:"auto"}],conditions:[ce]},se={category:e,type:a,label:"widget_common_style_backgroundImageUploader_imagePosition_select_label",propName:"backgroundPosition",value:"center",options:[{label:"widget_common_style_backgroundImageUploader_imagePosition_option_top",value:"top"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottom",value:"bottom"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_center",value:"center"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_left",value:"left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_right",value:"right"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_topLeft",value:"top left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_topRight",value:"top right"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottomLeft",value:"bottom left"},{label:"widget_common_style_backgroundImageUploader_imagePosition_option_bottomRight",value:"bottom right"}],conditions:[ce,pe]},ye={category:e,type:p,label:"widget_common_style_backgroundImageUploader_toggler_repeatBackgroundImage",propName:"backgroundRepeat",value:!1,conditions:[ce,pe,{field:"backgroundSize",value:e=>"cover"!==e}]},be={category:e,type:n,label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},ve={category:e,type:d,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},we={category:e,type:d,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},he={category:e,type:"areainput"},fe={...he,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},Ne={...he,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},ke={category:e,type:p,label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},xe={category:e,type:n,label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},Be={category:e,type:d,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},Ie={category:e,type:p,label:"widget_common_style_closeButton_label_displayCloseButton",propName:"closeButton",value:!0},Pe={category:e,type:c,label:"widget_common_style_closeButton_radio_closeButtonPosition",propName:"closeButtonPosition",value:"in",options:[{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_inside",value:"in"},{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_outside",value:"out"}]},Ue={category:e,type:d,label:"widget_common_style_closeButton_label_closeButtonSize",propName:"closeButtonSize",value:16,min:10,max:50},Ce={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonColor",propName:"closeButtonColor",value:"rgba(119, 119, 119, 1)"},Te={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonBackgroundColor",propName:"closeButtonBackgroundColor",value:"rgba(255, 255, 255, 0)"},Se={category:e,type:d,label:"widget_common_style_closeButton_label_closeButtonBorderRadius",propName:"closeButtonBorderRadius",value:0,min:0,max:50},ze={category:e,type:d,label:"widget_common_style_closeButton_label_closeButtonBorderThickness",propName:"closeButtonBorderWidth",value:0,min:0,max:50},Re={category:e,type:n,label:"widget_common_style_closeButton_label_closeButtonBorderColor",propName:"closeButtonBorderColor",value:"rgba(57, 57, 57, 1)",condition:({closeButtonBorderWidth:e})=>e>0},Oe={category:e,type:p,propName:"overlay",label:"widget_common_style_blockTitle_overlay",value:!0},We={category:e,type:n,label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},De={category:e,type:p,label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Ee=[de,me,ge,ue,se,ye],He=[{field:we.propName,value:e=>e>0}];be.conditions=He;const $e={category:e,type:m,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[we,be,ve]},Ve={category:e,type:i},Le=[{field:"dropShadow",value:!0}];xe.conditions=Le,Be.conditions=Le;const Ae={category:e,type:m,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[fe,Ne,{...Ve},...Ee,{...Ve},ke,xe,Be]},Xe=[{field:"overlay"}];We.conditions=Xe,De.conditions=Xe;const Me={category:e,type:m,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[Oe,We,De],conditions:[{field:"layout",value:"popin"}]},je=({closeButton:e})=>e,Fe={category:e,type:i,condition:je},Je=Re.condition;Pe.condition=je,Ue.condition=je,Ce.condition=je,Te.condition=je,Se.condition=je,ze.condition=je,Re.condition=e=>Je(e)&&je(e);const qe={category:e,type:m,label:"widget_common_style_blockTitle_closeButton",collapsible:!0,children:[Ie,Pe,{...Fe},Ue,Ce,Te,{...Fe},Se,ze,Re]};Ae.collapsed=!1,M.collapsed=!1,H.collapsed=!1,Ae.children.find(function(e){return"containerPadding"===e.propName}).value=[{top:0,left:0,bottom:0,right:0}];var Ge=M.children.find(function(e){return"layout"===e.propName});Ge.options=Ge.options.filter(function(e){return!e.value.includes("banner")}),U.children=U.children.filter(function(e,o){return!e.propName&&"validationRecurrence"!==U.children[o+1].propName||e.propName&&!e.propName.includes("validationRecurrence")});var Ke=ne.children.find(function(e){return"autoWidth"===e.propName}),Qe=ne.children.find(function(e){return"autoHeight"===e.propName});return Ke.value=!1,Qe.value=!1,[M,ne,re,_e,{type:g,category:t,label:"widget_iframe_closable_alert_text",hrefUrl:"widget_iframe_closable_alert_link"},{propName:"iframeUrl",type:"url",category:t,label:"widget_iframe_content_label_iframeUrl",value:"widget_iframe_content_defaultUrl"},Ae,$e,Me,qe,H,U]}); |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{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},s=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},i=()=>!e()&&(s()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),n=()=>window.ABTasty&&!0===window.ABTasty.consentReady,r="style",o="layout",a="select",c="colorpicker",l="number",h="switch",d="slider",u="remove",g="rebuild",m="rgba(57, 57, 57, 1)",p="https://api-social-proof.abtasty.com/clients/",v=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},y=()=>{const e=v();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},w=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,b=t=>{if((()=>{if(e()||s())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})()){const e=y();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${t}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},f=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise(((e,s)=>{t.resolve=e,t.reject=s})),t},$=(e,t)=>{let s=document.querySelector(e);const i=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],n=()=>o.disconnect(),r=()=>o.observe(...i),o=new MutationObserver((()=>(s=document.querySelector(e),s&&!n()&&t(s))));return s?setTimeout((()=>t(s)),0):r(),{selector:e,clear:n,observe:r}};function S(e,t){return t(e)||!e.parentElement?e:S(e.parentElement,t)}function T(){return"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||(e="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",new Promise(((t,s)=>{const i=window.document.getElementsByTagName("script")[0],n=window.document.createElement("script");n.src=e,i.parentNode.insertBefore(n,i),n.onload=t,n.onerror=s})));var e}class C{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 document.body&&e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const s=this.inViewportTargets.find((({element:s,selector:i})=>{if(s.isSameNode(e))return!0;const n=[...e.querySelectorAll(i)];if(n.length){if(n.includes(s))return!0}if(t.includes(s))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(s))return!0;if(a.some((e=>[...e.querySelectorAll(i)].includes(s))))return!0}return!1}));if(s&&this.isElementVisible(s.element)){const{selector:e,element:t,uniqueId:i}=s,n=this.targets.find((t=>t.selector===e&&t.uniqueId===i));n&&n.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"===S(e,(e=>"0"===window.getComputedStyle(e).opacity)).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),s=[[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,n=0;for(;!i&&n<s.length;){const t=document.elementFromPoint(...s[n]);i=e===t||e.contains(t),n+=1}return i}checkElements(){this.targets.forEach((({selector:e,uniqueId:t})=>{const s=document.querySelector(e);s&&!this.existingTargets.find((s=>s.element.matches(e)&&s.uniqueId===t))&&(this.existingTargets.push({element:s,selector:e,uniqueId:t}),this.visibilityObserver.observe(s))})),this.existingTargets=this.existingTargets.filter((({selector:e,element:t})=>!!document.querySelector(e)||(t&&this.visibilityObserver.unobserve(t),!1))),this.inViewportTargets=this.inViewportTargets.filter((({selector:e,element:t,uniqueId:s})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find((t=>t.selector===e&&t.uniqueId===s));return i&&i.resolve(t),this.clear(e,s),!1}return!0}))}watch(e,t,s){this.targets.push({selector:e,resolve:t,uniqueId:s});const i=()=>{this.startMutationObserver(),this.checkElements()};document.body?i():$("body",i)}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map((s=>s.filter((({selector:s,uniqueId:i})=>s!==e&&i!==t))));const s=document.querySelector(e);s&&this.visibilityObserver.unobserve(s),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class E{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:s}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*s,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:t}){const s=f(`${this.event}DomReady`);this.promises.push(s);const i=await this.onPageLoad(s),n=await async function(e){let t;switch(e){case"IntersectionObserver":t=await T();break;default:t=!0}return t}("IntersectionObserver"),r=new C;if(this.visibilityObservers.push(r),n&&i){const e=w();r.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const s=()=>"complete"===document.readyState;if(!s()){const i=["readystatechange",({isTrusted:e})=>e&&s()&&t(!0),{passive:!0}];return this.eventsListeners.push(i),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const s=document.createElement("style");s.type="text/css",s.id=`Click_${w()}`,s.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(s),this.elementsSelectors.push(`#${s.id}`);const i=e=>[...document.querySelectorAll(this.selector)].some((t=>t.isSameNode(e)||!!e.closest(this.selector))),n=["click",({isTrusted:e,target:s})=>e&&i(s)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(n),document.addEventListener(...n),e}onExitIntent({promise:e,resolve:t}){const s=["mouseleave",({isTrusted:e,clientY:s})=>{e&&s<=0&&t(!0)},{passive:!0}],i=$("body",(e=>{e.addEventListener(...s),this.eventsListeners.push([e,...s]),this.elementsWaiters=this.elementsWaiters.filter((e=>e!==i))}));return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const s=this.delay;let i=s;const n=[({isTrusted:e})=>{e&&(i=s)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach((e=>{document.addEventListener(e,...n),this.eventsListeners.push([e,...n])}));const r=setInterval((()=>{i<=0?t(!0):i-=100}),100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:s}=DATA;return new Function(`return new Promise(async resolve => {${s}})`)().then((e=>e&&t(!0))),e}getSocialProofPurchases({promise:e,resolve:s}){const i=window.ABTastyProductKey,n=t(),{viewInterval:r,triggerSocialProofMinPurchases:o,spNoTrim:a}=DATA;if(i||(b("Not able to find ABTastyProductKey, impossible to call the API."),s(!1)),i&&n){fetch(`${p}${n}/metrics/i?key=${i}${a?"&noTrim=true":""}`).then((e=>e.ok&&e.json())).then((e=>(e=>{if(void 0===r||void 0===o)return!1;const t=void 0!==e[r]&&e[r]>=o;return t||b(`Widget will not be shown, product has been purchased ${e[r]} times while ${o} are required`),t})(e)&&s(`${e[r]}`))).catch((()=>b("Failed to fetch datas from server.")))}else s(!1);return e}getSocialProofPageViews({promise:e,resolve:s}){const{viewInterval:i,triggerSocialProofMinPageViews:n,spNoTrim:r}=DATA,o=encodeURIComponent(r?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),a=t();if(o&&a){fetch(`${p}${a}/metrics/pv?key=${o}${r?"&noTrim=true":""}`).then((e=>e.ok&&e.json())).then((e=>(e=>{if(void 0===i||void 0===n)return!1;const t=void 0!==e[i]&&e[i]>=n;return t||b(`Widget will not be shown, page has been seen ${e[i]} times while ${n} are required`),t})(e)&&s(`${e[i]}`))).catch((()=>b("Failed to fetch datas from server.")))}else s(!1);return e}onConsent({promise:e,resolve:t}){if(!n()){const s=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(s),window.addEventListener(...s),e}return t(!0),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,...s]="string"==typeof e[0]?[document,...e]:e;t&&s.length>1&&t.removeEventListener(...s)})),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=w();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=f(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),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)},s=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();this.clear();return"reengage"!==this.event&&this.delay?s&&await(async()=>{const e=f(`${this.event}Delay`);return this.promises.push(e),setTimeout((()=>{e.resolve(!0),this.clear()}),this.delay),e.promise})():s}}const _="display",A="closing",x="validation",B="ABTastyWidgets",I="ABTastyWidgetsTemporary";class P{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:s},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(s),this.onSetCallback=i,this.widgetName=v(),this.uniqueId=w(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(I),s=sessionStorage.getItem(B);"ABTastyData"===e&&!t&&s&&localStorage.setItem(I,s)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(B);return JSON.parse(t)}catch(t){return e.removeItem(B),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:s,...i}=t;return Object.entries(i).length?(e.setItem(B,JSON.stringify(i)),i):(e.removeItem(B),!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(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(I),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(B,e),localStorage.removeItem(I));const s=this.getLocalRecurrence(),i=(s?parseFloat(s.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,t){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(s()||!i&&"object"!=typeof i)return!1;const{storageString:r,storageMethod:o}=i,a=this.getStamp(e),c={type:t,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!n()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new E({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let s;"session"===r?e?s=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),s=this.getSessionRecurrenceStorageParsed()):"local"===r&&(t?s=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),s=this.getLocalRecurrenceStorageParsed()));const i=s?{[this.recurrenceKey]:c,...s}:{[this.recurrenceKey]:c};o.setItem(B,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&t!==x)if(t===A&&l!==x)h();else{if(t!==_||l===x||l===A)return!1;h()}else h();return a}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 N{constructor(e,t,s){this.recurrence=e,this.isWidgetApplied=t,this.callback=s,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=i(),{type:s}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let n;const r=this.isWidgetApplied(),o=(()=>{const t=this.recurrenceIsDone();return e&&"display"===s||t})();return!r&&t&&o?n=g:(r&&(!t||!o)||!r&&!t)&&(n=u),"string"==typeof n&&(this.clearWatcher(),this.callback(n,e),this.watch()),this}eventHandler(){let e=i();return[250,500].forEach((t=>{setTimeout((()=>{const s=i();return 500===t&&s===e?this:(e=s,this.decisionHandler(!1))}),t)})),this}observerHandler(e){return e.some((e=>["removedNodes","addedNodes"].some((t=>e[t]&&e[t].length))))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=$("body",(()=>{t(),this.elementsWaiters=this.elementsWaiters.filter((t=>t!==e))}));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}}const R=/.+\/([^.]+)\.(otf|ttf)$/;class L{constructor(){this.children=void 0,this.uniqueId=w(),this.widgetName=v(),this.prettyName=y(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:s,validationRecurrence:i}=DATA;if(e()||!t&&!s&&!i)return!1;const n={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 t&&(r.displayRecurrence=n[t]("displayRecurrence")),s&&(r.closingRecurrence=n[s]("closingRecurrence")),i&&(r.validationRecurrence=n[i]("validationRecurrence")),r})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:s,triggerEventReengageDelay:i,socialProofContentType:n,triggerEventElementVisible:r,triggerEventDelay:o}=DATA;if(e()||!t&&!n)return!1;const a={click:()=>s,elementVisible:()=>r},c=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",l="reengage"===t?i:o;return n&&(t=1===n?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new P(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new E(this.triggerParams),this.pageWatcher=new N(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||(!(!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.isConnected}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=new Promise((e=>{const t=$("head",(t=>{this.elementsWaiters=this.elementsWaiters.filter((({selector:e})=>"head"!==e)),e(t.appendChild(this.styleElement))}));this.elementsWaiters.push(t)})),t=new Promise((e=>{const{elementReferrer:t="body",referrerInsertType:s="beforeend"}=DATA,i=$(t,(i=>{this.elementsWaiters=this.elementsWaiters.filter((e=>e.selector!==t)),this.removeOldDomElement(),e(i.insertAdjacentElement(s,this.domElement))}));this.elementsWaiters.push(i)}));return Promise.all([t,e]).then((()=>this))}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach((e=>e&&e.isConnected&&e.remove())),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then((({response:e})=>e?this.show():this)),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||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!e()&&this.hasBeenShown&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){const s=e(),n=i(),r=this.trigger&&this.trigger.promises.length,o=!this.recurrence||this.recurrence.isOver();if(!s&&!n||r||!o)return!1;this.pageWatcher.watch();const a=s||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!a&&(await this.insert(),this.addCloseEvent(),s||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),{container:this,response:a})}onPageChange(e,t){const s=()=>this.init().then((({response:e})=>e&&this.show()));t||(this.hasBeenShown=!1);const i=this.isWidgetApplied(),n={[u]:()=>{i?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch())},[g]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():i||this.insert().then((e=>e.show())).catch(this.pageWatcher.watch):s()}};"function"==typeof n[e]&&n[e]()}addCloseEvent(...t){const{closeButton:s,overlay:i,overlayClickable:n,layout:r}=DATA,o=[];if(void 0!==i&&!0!==i||!0!==n||"popin"!==r||o.push(`.${this.overlayClassName}`),void 0!==s&&s&&o.push(`.${this.closeButtonClassName}`),!o.length)return this;const a=this.domElement.querySelectorAll(o.join(", "));return a.length?(t.push(...a),t.forEach((t=>{e()&&(t.dataset.abtastyActionnable="true"),t.addEventListener("click",(t=>{(t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout((()=>this.remove()),1e3)}),{once:!0,capture:!0})})),this):this}getDom(){const{closeButton:e,layout:t,overlay:s=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,i.innerHTML=`\n\t\t\t${"popin"===t&&!0===s?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}"><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>`,i}loadFont(e,t){if(!e||"inherit"===e)return;const s=document.createElement("style"),i=t.match(R)?t.match(R)[1]:"";s.appendChild(document.createTextNode(`\t\t\t@font-face { \t\tfont-family: '${e}_${i}'; src: url('${t}');\t\t\t}\t\t`)),document.head.appendChild(s)}getStyleTag(t=""){const{noStyles:s,layout:i}=DATA,{backgroundColor:n,isBackgroundImage:r,backgroundImage:o,backgroundSize:a,backgroundPosition:c,backgroundRepeat:l,borderColor:h,borderRadius:d,borderWidth:u,textColor:g,textAlign:p,fontName:v,fontStyle:y,fontSize:w,isTitle:b,titleTextAlign:f,titleTextColor:$,titleFontName:S,titleFontStyle:T,titleFontSize:C,overlay:E,overlayColor:_,dropShadow:A,dropShadowColor:x,dropShadowBlur:B,containerMargin:I,containerPadding:P,closeButton:N,closeButtonPosition:L,closeButtonSize:O,closeButtonBorderRadius:k,closeButtonBorderWidth:W,closeButtonBorderColor:D,closeButtonColor:q,closeButtonBackgroundColor:V,buttonsBorderWidth:H,buttonsBorderColor:j,buttonsBorderRadius:z,buttonsBackgroundColor:M,buttonsTextColor:U,buttonsFontName:F,buttonsFontStyle:G,buttonsFontSize:K}=s?{}:DATA,Y=document.createElement("style");Y.type="text/css",e()&&Y.setAttribute("abtasty-script-added","true"),this.loadFont(v,y),this.loadFont(S,T),this.loadFont(F,G);const J=`background: ${["string"==typeof n?n:"rgba(255, 255, 255, 1)",r&&"string"==typeof o&&o.length?`url(${o})`:"",r&&"string"==typeof c&&"100% 100%"!==a?c:"0 0",r&&"string"==typeof a?`/ ${a}`:"/ auto",r&&l&&!["cover","100% 100%"].includes(a)?"repeat":"no-repeat"].join(" ").trim()};`,Q="number"==typeof u&&u>0,X=`border: ${[Q?`${u}px`:"unset",Q?"solid":"",Q&&"string"==typeof h&&h.length?h:""].join(" ").trim()};`,Z=void 0!==d?`border-radius: ${d}px;`:"",ee=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",te=void 0!==p?`text-align: ${p};`:"",se=v&&"inherit"!==v?`font-family:${v}_${y.match(R)?y.match(R)[1]:""};`:y||"",ie=w?`font-size: ${w}px;`:"",ne=void 0!==A&&A?`box-shadow: 0 5px ${B}px 0 ${x};`:"",re=I instanceof Array&&1===I.length&&I[0],oe=re?`margin: ${re.top}px ${re.right}px ${re.bottom}px ${re.left}px;`:"",ae=re?`margin: calc(${re.top}px * 0.5) calc(${re.right}px * 0.5) calc(${re.bottom}px * 0.5) calc(${re.left}px * 0.5);`:"",ce=P instanceof Array&&1===P.length&&P[0],le=ce?`padding: ${ce.top}px ${ce.right}px ${ce.bottom}px ${ce.left}px;`:"",he=ce?`padding: calc(${ce.top}px * 0.5) calc(${ce.right}px * 0.5) calc(${ce.bottom}px * 0.5) calc(${ce.left}px * 0.5);`:"",de=void 0!==H&&H?`border-width: ${H}px; border-style: solid;`:"",ue=[j,H].every((e=>void 0!==e))&&H?`border-color: ${j};`:"",ge=void 0!==z?`border-radius: ${z}px;`:"",me=void 0!==M?`background-color: ${M};`:"",pe=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",ve=F&&"inherit"!==F?`font-family:${F}_${G.match(R)?G.match(R)[1]:""};`:G||"",ye=K?`font-size: ${K}px;`:"",we="popin"!==i||void 0!==E&&!0!==E?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==_?_:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),be="number"==typeof O?O:16,fe=be/2,$e=s||void 0!==N&&N?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===L?`bottom: calc(100% + ${fe}px)`:`top: ${fe}px`)+";",`right: ${fe}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;",""+("number"==typeof k?`border-radius: ${k}px;`:""),""+("number"==typeof W&&W>0?`border: ${W}px solid ${void 0!==D?D:m};`:""),""+("string"==typeof V?`background-color: ${V};`:""),"}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${be}px;`,`height: ${be}px;`,""+("string"==typeof q?`fill: ${q};`:""),"}"].join(""):"",Se=b&&"string"==typeof $?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${$}; fill: ${$}; -webkit-text-fill-color: ${$};`,void 0!==f?`text-align: ${f};`:"",S&&"inherit"!==S?`font-family:${S}_${T.match(R)?T.match(R)[1]:""};`:T||"",C?`font-size: ${C}px;`:"","}"].join(""):"";return Y.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,J,Z,X,ee,te,ne,oe,se,ie,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ee,te,se,ie,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",le,se,ie,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,"box-sizing: border-box;","display: inline-block;",de,ue,ge,me,pe,ve,ye,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,pe,ve,ye,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,ae,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,he,"}","}",we,$e,Se,`${t}`].join(""),Y}}const O=["top: 0;","top: 50%;","bottom: 0;"],k=["left: 0;","left: 50%;","right: 0;"],W=e=>1===e?"-50%":0,D=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,s=`translate(${W(t)}, ${W(e)});`;return`${O[e]}${k[t]}transform: ${s}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},q=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,V=()=>{if(q())return"width: auto;height: auto;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:s,autoHeight:i,popinPercentHeight:n,popinPixelsHeight:r,heightUnit:o}=DATA;return`width: ${"px"===s?t:e}${s};height: ${i?"auto":`${"px"===o?r:n}${o}`};`};class H extends L{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,overlay:s}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"opacity: 1;","transition: opacity 0.25s ease;","background: none;","pointer-events: "+(!1===s?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",D(),V(),"pointer-events: all","}",`${q()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class j extends L{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const z=[{label:"px",value:"px"},{label:"%",value:"%"},{label:"em",value:"em"},{label:"vw (% of viewport width)",value:"vw"},{label:"vh (% of viewport height)",value:"vh"},{label:"vmin (% of viewport minimum size)",value:"vmin"},{label:"vmax (% of viewport maximum size)",value:"vmax"}],M={category:o,type:h,propName:"autoHeight",label:"widget_common_layout_toggler_label_keepHeightAuto",value:!0},U={category:o,type:a,propName:"widthUnit",value:"vw",options:z},F={category:o,type:a,propName:"heightUnit",value:"vh",condition:({autoHeight:e})=>!e,options:z},G={category:o,type:l,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPercentWidth",value:50,max:100,condition:({widthUnit:e,layout:t})=>"px"!==e&&"popin"===t},K={category:o,type:l,label:"widget_common_layout_popinDimensions_label_width",propName:"popinPixelsWidth",value:parseInt(window.innerWidth/2.5,10),max:window.innerWidth,condition:({widthUnit:e,layout:t})=>"px"===e&&"popin"===t},Y={category:o,type:l,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPercentHeight",value:50,max:100,condition:({autoHeight:e,heightUnit:t,layout:s})=>!e&&"px"!==t&&"popin"===s},J={category:o,type:l,label:"widget_common_layout_popinDimensions_label_height",propName:"popinPixelsHeight",value:parseInt(window.innerHeight/2.5,10),max:window.innerHeight,condition:({autoHeight:e,heightUnit:t,layout:s})=>!e&&"px"===t&&"popin"===s},Q=({autoWidth:e})=>!e,X=([G,K,U,M,Y,J,F].reduce(((e,t)=>{let s;const{condition:i}=t;return s=i?{...t,condition:e=>i(e)&&Q(e)}:{...t,condition:Q},[...e,s]}),[]),{category:r,type:d,label:"widget_common_style_closeButton_label_closeButtonSize",propName:"closeButtonSize",value:16,min:10,max:50}),Z={category:r,type:c,label:"widget_common_style_closeButton_label_closeButtonColor",propName:"closeButtonColor",value:"rgba(119, 119, 119, 1)",condition:({closeButtonBorderWidth:e})=>e>0},ee={category:r,type:c,label:"widget_common_style_closeButton_label_closeButtonBackgroundColor",propName:"closeButtonBackgroundColor",value:"rgba(255, 255, 255, 0)"},te={category:r,type:d,label:"widget_common_style_closeButton_label_closeButtonBorderRadius",propName:"closeButtonBorderRadius",value:0,min:0,max:50},se={category:r,type:d,label:"widget_common_style_closeButton_label_closeButtonBorderThickness",propName:"closeButtonBorderWidth",value:0,min:0,max:50},ie={category:r,type:c,label:"widget_common_style_closeButton_label_closeButtonBorderColor",propName:"closeButtonBorderColor",value:m},ne={category:r,type:"short-separator"},re=({closeButton:e})=>e;[{category:r,type:"radio",label:"widget_common_style_closeButton_radio_closeButtonPosition",propName:"closeButtonPosition",value:"in",options:[{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_inside",value:"in"},{label:"widget_common_style_closeButton_radio_closeButtonPosition_option_outside",value:"out"}]},{...ne},X,Z,ee,{...ne},te,se,ie].reduce(((e,t)=>{let s;const{condition:i}=t;return s=i?{...t,condition:e=>re(e)&&i(e)}:{...t,condition:re},[...e,s]}),[]);function oe(){var e,t=DATA,s=t.layout,i=t.frameReferrerInsertType,n=t.frameElementReferrer;switch(s){case"popin":e=new H;break;default:e=new j(i,n)}var r,o,a,c=e.domElement.querySelector(".".concat(e.contentClassName)),l=function(e){var t=DATA.iframeUrl,s=document.createElement("iframe");return s.id="tasty_frame_".concat(e),s.src=t,s}(e.uniqueId);return r=e.styleElement,o=e.uniqueId,a="\n #tasty_frame_".concat(o," {\n box-sizing: border-box;\n border: none;\n width: 100%;\n height: 100%;\n }"),r.insertAdjacentHTML("beforeend",a),c.appendChild(l),e.init().then((function(t){return t&&e.show()})),{parentContainer:e}}var ae;"string"==typeof(ae=DATA.iframeUrl)&&ae.length&&oe()}(); | ||
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{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},s=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},i=()=>!e()&&(s()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),r=()=>window.ABTasty&&!0===window.ABTasty.consentReady,n="remove",o="rebuild",a="https://api-social-proof.abtasty.com/clients/",c=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},h=()=>{const e=c();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},l=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,d=t=>{if((()=>{if(e()||s())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0})()){const e=h();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${t}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},u=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,s)=>{t.resolve=e,t.reject=s}),t},g=(e,t)=>{let s=document.querySelector(e);const i=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],r=()=>o.disconnect(),n=()=>o.observe(...i),o=new MutationObserver(()=>(s=document.querySelector(e),s&&!r()&&t(s)));return s?setTimeout(()=>t(s),0):n(),{selector:e,clear:r,observe:n}};function m(e,t){return t(e)||!e.parentElement?e:m(e.parentElement,t)}class p{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 document.body&&e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),e}onMouseOver({target:e,path:t}){const s=this.inViewportTargets.find(({element:s,selector:i})=>{if(s.isSameNode(e))return!0;const r=[...e.querySelectorAll(i)];if(r.length&&r.includes(s))return!0;if(t.includes(s))return!0;const n=[...e.parentElement.children],o=n.findIndex(t=>t.isSameNode(e)),a=n.filter((e,t)=>t>o);if(a.length){if(a.includes(s))return!0;if(a.some(e=>[...e.querySelectorAll(i)].includes(s)))return!0}return!1});if(s&&this.isElementVisible(s.element)){const{selector:e,element:t,uniqueId:i}=s,r=this.targets.find(t=>t.selector===e&&t.uniqueId===i);r&&r.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"===m(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),s=[[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,r=0;for(;!i&&r<s.length;){const t=document.elementFromPoint(...s[r]);i=e===t||e.contains(t),r+=1}return i}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const s=document.querySelector(e);s&&!this.existingTargets.find(s=>s.element.matches(e)&&s.uniqueId===t)&&(this.existingTargets.push({element:s,selector:e,uniqueId:t}),this.visibilityObserver.observe(s))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:s})=>{if(t.matches(e)&&this.isElementVisible(t)){const i=this.targets.find(t=>t.selector===e&&t.uniqueId===s);return i&&i.resolve(t),this.clear(e,s),!1}return!0})}watch(e,t,s){this.targets.push({selector:e,resolve:t,uniqueId:s});const i=()=>{this.startMutationObserver(),this.checkElements()};document.body?i():g("body",i)}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(s=>s.filter(({selector:s,uniqueId:i})=>s!==e&&i!==t));const s=document.querySelector(e);s&&this.visibilityObserver.unobserve(s),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class v{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:s}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=1e3*s,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:e,resolve:t}){const s=u(`${this.event}DomReady`);this.promises.push(s);const i=await this.onPageLoad(s),r=await async function(){let e;return e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||new Promise((e,t)=>{const s=window.document.getElementsByTagName("script")[0],i=window.document.createElement("script");i.src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver",s.parentNode.insertBefore(i,s),i.onload=e,i.onerror=t})),e}(),n=new p;if(this.visibilityObservers.push(n),r&&i){const e=l();n.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const s=()=>"complete"===document.readyState;if(!s()){const i=["readystatechange",({isTrusted:e})=>e&&s()&&t(!0),{passive:!0}];return this.eventsListeners.push(i),document.addEventListener(...i),e}return t(!0),e}onClick({promise:e,resolve:t}){const s=document.createElement("style");s.type="text/css",s.id=`Click_${l()}`,s.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(s),this.elementsSelectors.push(`#${s.id}`);const i=e=>[...document.querySelectorAll(this.selector)].some(t=>t.isSameNode(e)||!!e.closest(this.selector)),r=["click",({isTrusted:e,target:s})=>e&&i(s)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(r),document.addEventListener(...r),e}onExitIntent({promise:e,resolve:t}){const s=["mouseleave",({isTrusted:e,clientY:s})=>{e&&s<=0&&t(!0)},{passive:!0}],i=g("body",e=>{e.addEventListener(...s),this.eventsListeners.push([e,...s]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==i)});return this.elementsWaiters.push(i),e}onReengage({promise:e,resolve:t}){const s=this.delay;let i=s;const r=[({isTrusted:e})=>{e&&(i=s)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...r),this.eventsListeners.push([e,...r])});const n=setInterval(()=>{i<=0?t(!0):i-=100},100);return this.intervals.push(n),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:s}=DATA;return new Function(`return new Promise(async resolve => {${s}})`)().then(e=>e&&t(!0)),e}getSocialProofPurchases({promise:e,resolve:s}){const i=window.ABTastyProductKey,r=t(),{viewInterval:n,triggerSocialProofMinPurchases:o,spNoTrim:c}=DATA;return i||(d("Not able to find ABTastyProductKey, impossible to call the API."),s(!1)),i&&r?fetch(`${a}${r}/metrics/i?key=${i}${c?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===n||void 0===o)return!1;const t=void 0!==e[n]&&e[n]>=o;return t||d(`Widget will not be shown, product has been purchased ${e[n]} times while ${o} are required`),t})(e)&&s(`${e[n]}`)).catch(()=>d("Failed to fetch datas from server.")):s(!1),e}getSocialProofPageViews({promise:e,resolve:s}){const{viewInterval:i,triggerSocialProofMinPageViews:r,spNoTrim:n}=DATA,o=encodeURIComponent(n?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),c=t();return o&&c?fetch(`${a}${c}/metrics/pv?key=${o}${n?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(e=>(e=>{if(void 0===i||void 0===r)return!1;const t=void 0!==e[i]&&e[i]>=r;return t||d(`Widget will not be shown, page has been seen ${e[i]} times while ${r} are required`),t})(e)&&s(`${e[i]}`)).catch(()=>d("Failed to fetch datas from server.")):s(!1),e}onConsent({promise:e,resolve:t}){if(!r()){const s=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(s),window.addEventListener(...s),e}return t(!0),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,...s]="string"==typeof e[0]?[document,...e]:e;t&&s.length>1&&t.removeEventListener(...s)}),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=l();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=u(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),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)},s=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?s&&await(async()=>{const e=u(`${this.event}Delay`);return this.promises.push(e),setTimeout(()=>{e.resolve(!0),this.clear()},this.delay),e.promise})():s}}const y="closing",w="validation",b="ABTastyWidgets",f="ABTastyWidgetsTemporary";class ${constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:s},i){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(s),this.onSetCallback=i,this.widgetName=c(),this.uniqueId=l(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(f),s=sessionStorage.getItem(b);"ABTastyData"===e&&!t&&s&&localStorage.setItem(f,s)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(b);return JSON.parse(t)}catch(t){return e.removeItem(b),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:s,...i}=t;return Object.entries(i).length?(e.setItem(b,JSON.stringify(i)),i):(e.removeItem(b),!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(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(f),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(b,e),localStorage.removeItem(f));const s=this.getLocalRecurrence(),i=(s?parseFloat(s.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&i&&!this.getLocalRecurrence()&&!t}setRecurrence(e,t){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const i=this.getTypeOfStorage(e);if(s()||!i&&"object"!=typeof i)return!1;const{storageString:n,storageMethod:o}=i,a=this.getStamp(e),c={type:t,stamp:a},{type:h}=this.getCurrentRecurrence(),l=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new v({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let s;"session"===n?e?s=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),s=this.getSessionRecurrenceStorageParsed()):"local"===n&&(t?s=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),s=this.getLocalRecurrenceStorageParsed()));const i=s?{[this.recurrenceKey]:c,...s}:{[this.recurrenceKey]:c};o.setItem(b,JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(h&&t!==w)if(t===y&&h!==w)l();else{if("display"!==t||h===w||h===y)return!1;l()}else l();return a}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 S{constructor(e,t,s){this.recurrence=e,this.isWidgetApplied=t,this.callback=s,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=i(),{type:s}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let r;const a=this.isWidgetApplied(),c=(()=>{const t=this.recurrenceIsDone();return e&&"display"===s||t})();return!a&&t&&c?r=o:(a&&(!t||!c)||!a&&!t)&&(r=n),"string"==typeof r&&(this.clearWatcher(),this.callback(r,e),this.watch()),this}eventHandler(){let e=i();return[250,500].forEach(t=>{setTimeout(()=>{const s=i();return 500===t&&s===e?this:(e=s,this.decisionHandler(!1))},t)}),this}observerHandler(e){return e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=g("body",()=>{t(),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});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}}const T=/.+\/([^.]+)\.(otf|ttf)$/;class C{constructor(){this.children=void 0,this.uniqueId=l(),this.widgetName=c(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:s,validationRecurrence:i}=DATA;if(e()||!t&&!s&&!i)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},n={};return t&&(n.displayRecurrence=r[t]("displayRecurrence")),s&&(n.closingRecurrence=r[s]("closingRecurrence")),i&&(n.validationRecurrence=r[i]("validationRecurrence")),n})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:s,triggerEventReengageDelay:i,socialProofContentType:r,triggerEventElementVisible:n,triggerEventDelay:o}=DATA;if(e()||!t&&!r)return!1;const a={click:()=>s,elementVisible:()=>n},c=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",h="reengage"===t?i:o;return r&&(t=1===r?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:c,triggerDelay:h}})(),this.recurrence=!!this.recurrenceParams&&new $(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new v(this.triggerParams),this.pageWatcher=new S(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!(!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.isConnected}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=new Promise(e=>{const t=g("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(({selector:e})=>"head"!==e),e(t.appendChild(this.styleElement))});this.elementsWaiters.push(t)}),t=new Promise(e=>{const{elementReferrer:t="body",referrerInsertType:s="beforeend"}=DATA,i=g(t,i=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==t),this.removeOldDomElement(),e(i.insertAdjacentElement(s,this.domElement))});this.elementsWaiters.push(i)});return Promise.all([t,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(e=>e&&e.isConnected&&e.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||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!e()&&this.hasBeenShown&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){const s=e(),r=i(),n=this.trigger&&this.trigger.promises.length,o=!this.recurrence||this.recurrence.isOver();if(!s&&!r||n||!o)return!1;this.pageWatcher.watch();const a=s||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!a&&(await this.insert(),this.addCloseEvent(),s||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),{container:this,response:a})}onPageChange(e,t){const s=()=>this.init().then(({response:e})=>e&&this.show());t||(this.hasBeenShown=!1);const i=this.isWidgetApplied(),r={[n]:()=>{i?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch())},[o]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():i||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):s()}};"function"==typeof r[e]&&r[e]()}addCloseEvent(...t){const{closeButton:s,overlay:i,overlayClickable:r,layout:n}=DATA,o=[];if(void 0!==i&&!0!==i||!0!==r||"popin"!==n||o.push(`.${this.overlayClassName}`),void 0!==s&&s&&o.push(`.${this.closeButtonClassName}`),!o.length)return this;const a=this.domElement.querySelectorAll(o.join(", "));return a.length?(t.push(...a),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.addEventListener("click",t=>{(t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{once:!0,capture:!0})}),this):this}getDom(){const{closeButton:e,layout:t,overlay:s=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,i.innerHTML=`\n\t\t\t${"popin"===t&&!0===s?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}"><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>`,i}loadFont(e,t){if(!e||"inherit"===e)return;const s=document.createElement("style"),i=t.match(T)?t.match(T)[1]:"";s.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}');}`,document.head.appendChild(s)}getStyleTag(t=""){const{noStyles:s,layout:i}=DATA,{backgroundColor:r,isBackgroundImage:n,backgroundImage:o,backgroundSize:a,backgroundPosition:c,backgroundRepeat:h,borderColor:l,borderRadius:d,borderWidth:u,textColor:g,textAlign:m,fontName:p,fontStyle:v,fontSize:y,isTitle:w,titleTextAlign:b,titleTextColor:f,titleFontName:$,titleFontStyle:S,titleFontSize:C,overlay:E,overlayColor:A,dropShadow:I,dropShadowColor:x,dropShadowBlur:P,containerMargin:R,containerPadding:N,closeButton:B,closeButtonPosition:L,closeButtonSize:O,closeButtonBorderRadius:k,closeButtonBorderWidth:W,closeButtonBorderColor:D,closeButtonColor:_,closeButtonBackgroundColor:q,buttonsBorderWidth:V,buttonsBorderColor:j,buttonsBorderRadius:M,buttonsBackgroundColor:H,buttonsTextColor:F,buttonsFontName:z,buttonsFontStyle:U,buttonsFontSize:G}=s?{}:DATA,K=document.createElement("style");K.type="text/css",e()&&K.setAttribute("abtasty-script-added","true"),this.loadFont(p,v),this.loadFont($,S),this.loadFont(z,U);const Y=`background: ${["string"==typeof r?r:"rgba(255, 255, 255, 1)",n&&"string"==typeof o&&o.length?`url(${o})`:"",n&&"string"==typeof c&&"100% 100%"!==a?c:"0 0",n&&"string"==typeof a?`/ ${a}`:"/ auto",n&&h&&!["cover","100% 100%"].includes(a)?"repeat":"no-repeat"].join(" ").trim()};`,J="number"==typeof u&&u>0,Q=`border: ${[J?`${u}px`:"unset",J?"solid":"",J&&"string"==typeof l&&l.length?l:""].join(" ").trim()};`,X=void 0!==d?`border-radius: ${d}px;`:"",Z=void 0!==g?`color: ${g}; fill: ${g}; -webkit-text-fill-color: ${g};`:"",ee=void 0!==m?`text-align: ${m};`:"",te=p&&"inherit"!==p?`font-family:${p}_${v.match(T)?v.match(T)[1]:""};`:v||"",se=y?`font-size: ${y}px;`:"",ie=void 0!==I&&I?`box-shadow: 0 5px ${P}px 0 ${x};`:"",re=R instanceof Array&&1===R.length&&R[0],ne=re?`margin: ${re.top}px ${re.right}px ${re.bottom}px ${re.left}px;`:"",oe=re?`margin: calc(${re.top}px * 0.5) calc(${re.right}px * 0.5) calc(${re.bottom}px * 0.5) calc(${re.left}px * 0.5);`:"",ae=N instanceof Array&&1===N.length&&N[0],ce=ae?`padding: ${ae.top}px ${ae.right}px ${ae.bottom}px ${ae.left}px;`:"",he=ae?`padding: calc(${ae.top}px * 0.5) calc(${ae.right}px * 0.5) calc(${ae.bottom}px * 0.5) calc(${ae.left}px * 0.5);`:"",le=void 0!==V&&V?`border-width: ${V}px; border-style: solid;`:"",de=[j,V].every(e=>void 0!==e)&&V?`border-color: ${j};`:"",ue=void 0!==M?`border-radius: ${M}px;`:"",ge=void 0!==H?`background-color: ${H};`:"",me=void 0!==F?`color: ${F}; fill: ${F}; -webkit-text-fill-color: ${F};`:"",pe=z&&"inherit"!==z?`font-family:${z}_${U.match(T)?U.match(T)[1]:""};`:U||"",ve=G?`font-size: ${G}px;`:"",ye="popin"!==i||void 0!==E&&!0!==E?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==A?A:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),we="number"==typeof O?O:16,be=we/2,fe=s||void 0!==B&&B?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===L?`bottom: calc(100% + ${be}px)`:`top: ${be}px`)+";",`right: ${be}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof k?`border-radius: ${k}px;`:"","number"==typeof W&&W>0?`border: ${W}px solid ${void 0!==D?D:"rgba(57, 57, 57, 1)"};`:"","string"==typeof q?`background-color: ${q};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${we}px;`,`height: ${we}px;`,"string"==typeof _?`fill: ${_};`:"","}"].join(""):"",$e=w&&"string"==typeof f?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${f}; fill: ${f}; -webkit-text-fill-color: ${f};`,void 0!==b?`text-align: ${b};`:"",$&&"inherit"!==$?`font-family:${$}_${S.match(T)?S.match(T)[1]:""};`:S||"",C?`font-size: ${C}px;`:"","}"].join(""):"";return K.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,Y,X,Q,Z,ee,ie,ne,te,se,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,Z,ee,te,se,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",ce,te,se,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,"box-sizing: border-box;","display: inline-block;",le,de,ue,ge,me,pe,ve,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,me,pe,ve,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,oe,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,he,"}","}",ye,fe,$e,`${t}`].join(""),K}}const E=["top: 0;","top: 50%;","bottom: 0;"],A=["left: 0;","left: 50%;","right: 0;"],I=e=>1===e?"-50%":0,x=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,s=`translate(${I(t)}, ${I(e)});`;return`${E[e]}${A[t]}transform: ${s}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},P=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,R=()=>{if(P())return"width: auto;height: auto;";const{popinPercentWidth:e,popinPixelsWidth:t,widthUnit:s,autoHeight:i,popinPercentHeight:r,popinPixelsHeight:n,heightUnit:o}=DATA;return`width: ${"px"===s?t:e}${s};height: ${i?"auto":`${"px"===o?n:r}${o}`};`};class N extends C{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t,overlay:s}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;",`z-index: ${"custom"===e?t:e};`,"opacity: 1;","transition: opacity 0.25s ease;","background: none;","pointer-events: "+(!1===s?"none":"all"),"}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;",x(),R(),"pointer-events: all","}",`${P()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class B extends C{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}var L;"string"==typeof(L=DATA.iframeUrl)&&L.length&&function(){var e,t=DATA,s=t.layout,i=t.frameReferrerInsertType,r=t.frameElementReferrer;switch(s){case"popin":e=new N;break;default:e=new B(i,r)}var n,o,a,c=e.domElement.querySelector(".".concat(e.contentClassName)),h=function(e){var t=DATA.iframeUrl,s=document.createElement("iframe");return s.id="tasty_frame_".concat(e),s.src=t,s}(e.uniqueId);n=e.styleElement,o=e.uniqueId,a="\n #tasty_frame_".concat(o," {\n box-sizing: border-box;\n border: none;\n width: 100%;\n height: 100%;\n }"),n.insertAdjacentHTML("beforeend",a),c.appendChild(h),e.init().then(function(t){return t&&e.show()})}()}(); |
{ | ||
"name": "@abtasty/google-form-modal", | ||
"description": "Widget for AB Tasty", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"form": "dist/form.js", | ||
@@ -37,4 +37,4 @@ "main": "dist/main.js", | ||
"dependencies": { | ||
"@abtasty/widget-utils": "^1.18.13" | ||
"@abtasty/widget-utils": "^1.18.15" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
48061
181