@abtasty/google-form-modal 1.6.10 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/form.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +3 -3
package/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Engage Plugin Base
|
package/dist/form.js
CHANGED
@@ -1 +1 @@
|
|
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",i="short-separator",n="select",a="colorpicker",r="number",c="selectelement",_="radio",d="switch",p="slider",m="group",g="inlinenotification",u="https://widgets-images.abtasty.com/",s=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","audio","canvas","iframe","optgroup","option","progress","select","svg","textarea","video"],y="week",b="month",v=[{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:y},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:b},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],w={category:l,type:p,min:1},f=[{...w,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...w,propName:y,label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...w,propName:b,label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],h={category:l,type:n,options:v,value:"everytime",render:!1},N={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},k={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},x={...h,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},B=f.map(({type:e,min:o,propName:t,label:i,value:n,max:a})=>({category:l,type:e,min:o,max:a,label:i,value:n,render:!1,propName:`${N.propName}_${t}`,conditions:[{field:N.propName,value:t}]})),I=f.map(({type:e,min:o,propName:t,label:i,value:n,max:a})=>({category:l,type:e,min:o,max:a,label:i,value:n,render:!1,propName:`${k.propName}_${t}`,conditions:[{field:k.propName,value:t}]})),T=f.map(({type:e,min:o,propName:t,label:i,value:n,max:a})=>({category:l,type:e,min:o,max:a,label:i,value:n,render:!1,propName:`${x.propName}_${t}`,conditions:[{field:x.propName,value:t}]})),C={category:l,type:i};k.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 P={category:l,type:m,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[N,...B,{...C,condition:k.condition},k,...I,{...C},x,...T]},U="triggerEvent",S={category:l,type:p,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0,render:!1},z={...S,propName:"triggerEventReengageDelay",value:10,max:180,render:!1},R={category:l,type:c,propName:"triggerEventClick",value:"body",render:!1},D={...R,propName:"triggerEventElementVisible",render:!1},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,render:!1},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"}},E={category:l,type:d,propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce",render:!1},A={category:l,type:n,label:"widget_common_conditions_triggering_label",options:[W.pageLoad,W.direct,W.exitIntent,W.reengage,W.click,W.elementVisible,W.customScript],propName:U,value:"pageLoad",render:!1};R.conditions=[{field:U,value:"click"}],z.conditions=[{field:U,value:"reengage"}],D.conditions=[{field:U,value:"elementVisible"}],O.conditions=[{field:U,value:"script"}],S.conditions=[{field:U,value:e=>"reengage"!==e}],E.conditions=[{field:U,value:e=>"click"===e||"script"===e}];const H={category:l,type:m,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[A,R,D,O,E,z,S]},L={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`}]},$={category:o,type:c,propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},V=({elementReferrer:e})=>{try{const o=window.ABTASTY_S&&window.ABTASTY_S.CLIENT_MANAGER.getDocument();return!s.includes(o.querySelector(e).tagName.toLowerCase())}catch(e){return!0}},M={category:o,type:_,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",condition:V,fallback:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend",condition:V,fallback:"afterend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},X={category:o,type:"positioninput",propName:"popinPosition",label:"widget_common_layout_blockTitle_layout",value:[{x:1,y:1}],condition:({layout:e})=>"popin"===e},Y=[{field:"layout",value:"free"}];$.conditions=Y,M.conditions=Y;const j={category:o,type:m,label:"widget_common_layout_blockTitle_layout",collapsible:!0,children:[L,$,X,M]},q={category:o,type:d,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"}],G={category:o,type:d,propName:"autoHeight",label:"widget_common_layout_toggler_label_keepHeightAuto",value:!0},J={category:o,type:n,propName:"widthUnit",value:"vw",options:F},K={category:o,type:n,propName:"heightUnit",value:"vh",condition:({autoHeight:e})=>!e,options:F},Q={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},Z={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},ee={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},oe={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},te=({autoWidth:e})=>!e;J.condition=te,G.condition=te;const le=Q.condition;Q.condition=e=>le(e)&&te(e);const ie=Z.condition;Z.condition=e=>ie(e)&&te(e);const ne=ee.condition;ee.condition=e=>ne(e)&&te(e);const ae=oe.condition;oe.condition=e=>ae(e)&&te(e);const re=K.condition;K.condition=e=>re(e)&&te(e);const ce={category:o,type:m,collapsible:!0,label:"widget_common_layout_blockTitle_dimensions",children:[q,Q,Z,J,G,ee,oe,K],conditions:[{field:"layout",value:"popin"}]},_e={category:o,type:g,label:"widget_common_layout_zindex_alert_text",hrefUrl:"widget_common_layout_zindex_alert_link"},de={category:o,type:m,label:"widget_common_layout_blockTitle_layering",collapsible:!0,children:[{category:o,type:_,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}]},pe={field:"isBackgroundImage",value:!0},me={field:"backgroundSize",value:e=>"100% 100%"!==e},ge={category:e,type:a,label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:"rgba(247, 247, 247, 1)"},ue={category:e,type:d,label:"widget_common_style_toggler_label_backgroundImage",propName:"isBackgroundImage",value:!1},se={category:e,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:"",conditions:[pe]},ye={category:e,type:_,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:[pe]},be={category:e,type:n,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:[pe,me]},ve={category:e,type:d,label:"widget_common_style_backgroundImageUploader_toggler_repeatBackgroundImage",propName:"backgroundRepeat",value:!1,conditions:[pe,me,{field:"backgroundSize",value:e=>"cover"!==e}]},we={category:e,type:a,label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},fe={category:e,type:p,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},he={category:e,type:p,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},Ne={category:e,type:"areainput"},ke={...Ne,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},xe={...Ne,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},Be={category:e,type:d,label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Ie={category:e,type:a,label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},Te={category:e,type:p,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},Ce={category:e,type:d,label:"widget_common_style_closeButton_label_displayCloseButton",propName:"closeButton",value:!0},Pe={category:e,type:_,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:p,label:"widget_common_style_closeButton_label_closeButtonSize",propName:"closeButtonSize",value:16,min:10,max:50},Se={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonColor",propName:"closeButtonColor",value:"rgba(119, 119, 119, 1)"},ze={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonBackgroundColor",propName:"closeButtonBackgroundColor",value:"rgba(255, 255, 255, 0)"},Re={category:e,type:p,label:"widget_common_style_closeButton_label_closeButtonBorderRadius",propName:"closeButtonBorderRadius",value:0,min:0,max:50},De={category:e,type:p,label:"widget_common_style_closeButton_label_closeButtonBorderThickness",propName:"closeButtonBorderWidth",value:0,min:0,max:50},Oe={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonBorderColor",propName:"closeButtonBorderColor",value:"rgba(57, 57, 57, 1)",condition:({closeButtonBorderWidth:e})=>e>0},We={category:e,type:d,propName:"overlay",label:"widget_common_style_blockTitle_overlay",value:!0},Ee={category:e,type:a,label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Ae={category:e,type:d,label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},He=[ge,ue,se,ye,be,ve],Le=[{field:he.propName,value:e=>e>0}];we.conditions=Le;const $e={category:e,type:m,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[he,we,fe]},Ve={category:e,type:i},Me=[{field:"dropShadow",value:!0}];Ie.conditions=Me,Te.conditions=Me;const Xe={category:e,type:m,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[ke,xe,{...Ve},...He,{...Ve},Be,Ie,Te]},Ye=[{field:"overlay"}];Ee.conditions=Ye,Ae.conditions=Ye;const je={category:e,type:m,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[We,Ee,Ae],conditions:[{field:"layout",value:"popin"}]},qe=({closeButton:e})=>e,Fe={category:e,type:i,condition:qe},Ge=Oe.condition;Pe.condition=qe,Ue.condition=qe,Se.condition=qe,ze.condition=qe,Re.condition=qe,De.condition=qe,Oe.condition=e=>Ge(e)&&qe(e);const Je={category:e,type:m,label:"widget_common_style_blockTitle_closeButton",collapsible:!0,children:[Ce,Pe,{...Fe},Ue,Se,ze,{...Fe},Re,De,Oe]};Xe.collapsed=!1,j.collapsed=!1,H.collapsed=!1,Xe.children.find(function(e){return"containerPadding"===e.propName}).value=[{top:0,left:0,bottom:0,right:0}];var Ke=j.children.find(function(e){return"layout"===e.propName});Ke.options=Ke.options.filter(function(e){return!e.value.includes("banner")}),P.children=P.children.filter(function(e,o){return!e.propName&&"validationRecurrence"!==P.children[o+1].propName||e.propName&&!e.propName.includes("validationRecurrence")});var Qe=ce.children.find(function(e){return"autoWidth"===e.propName}),Ze=ce.children.find(function(e){return"autoHeight"===e.propName});return Qe.value=!1,Ze.value=!1,[j,ce,_e,de,{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"},Xe,$e,je,Je,H,P]});
|
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",i="conditions",n="short-separator",l="select",a="colorpicker",r="number",_="selectelement",c="radio",d="switch",m="slider",g="group",p="inlinenotification",u="https://widgets-images.abtasty.com/",s=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","audio","canvas","iframe","optgroup","option","progress","select","svg","textarea","video"],b="week",y="month",v=[{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:b},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:y},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],w={category:i,type:m,min:1},h=[{...w,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...w,propName:b,label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...w,propName:y,label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],f={category:i,type:l,options:v,value:"everytime",render:!1},N={...f,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},k={...f,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"},x={...f,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"},B=h.map(({type:e,min:o,propName:t,label:n,value:l,max:a})=>({category:i,type:e,min:o,max:a,label:n,value:l,render:!1,propName:`${N.propName}_${t}`,conditions:[{field:N.propName,value:t}]})),I=h.map(({type:e,min:o,propName:t,label:n,value:l,max:a})=>({category:i,type:e,min:o,max:a,label:n,value:l,render:!1,propName:`${k.propName}_${t}`,conditions:[{field:k.propName,value:t}]})),P=h.map(({type:e,min:o,propName:t,label:n,value:l,max:a})=>({category:i,type:e,min:o,max:a,label:n,value:l,render:!1,propName:`${x.propName}_${t}`,conditions:[{field:x.propName,value:t}]})),C={category:i,type:n};k.condition=({closeButton:e,layout:o,overlay:t,overlayClickable:i,linkType:n})=>!("string"!=typeof n||!n.includes("Close"))||("popin"!==o||!1!==e||!1!==t&&!1!==i)&&(void 0===o||"popin"===o||!1!==e);const S={category:i,type:g,label:"widget_common_conditions_recurrence_blockTitle",collapsible:!0,children:[N,...B,{...C,condition:k.condition},k,...I,{...C},x,...P]},T="triggerEvent",U={category:i,type:m,propName:"triggerEventDelay",label:"widget_common_conditions_triggering_delay_label",min:0,max:60,value:0,render:!1},z={...U,propName:"triggerEventReengageDelay",value:10,max:180,render:!1},R={category:i,type:_,propName:"triggerEventClick",value:"body",render:!1},E={...R,propName:"triggerEventElementVisible",render:!1},D={category:i,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,render:!1},V={category:i,type:_,propName:"triggerEventHover",value:"body",render:!1},O={category:i,type:m,label:"widget_common_conditions_triggering_percent_scroll_to_reach",propName:"triggerEventScrollPercent",value:50,min:0,max:100,render:!1},W={category:i,type:m,label:"widget_common_conditions_triggering_number_rageclick_required",propName:"triggerEventRageClickQuantity",value:3,min:2,max:10,render:!1},H={category:i,type:m,label:"widget_common_conditions_triggering_number_rageclick_delay",propName:"triggerEventRageClickDelay",value:750,min:250,max:5e3,render:!1},A={category:i,type:m,propName:"triggerEventMinPagesViewed",value:3,min:2,max:10,render:!1},L={category:i,type:"text",propName:"triggerEventTrackingSent",value:"",placeholder:"Tracking name",render:!1},$={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"},hover:{label:"widget_common_conditions_triggering_option_hover",value:"hover"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},scrollUp:{label:"widget_common_conditions_triggering_option_scrollup",value:"scrollUp"},scrollPercent:{label:"widget_common_conditions_triggering_option_scroll_percent",value:"scrollPercent"},rageClick:{label:"widget_common_conditions_triggering_option_rageclick",value:"rageClick"},minPagesViewed:{label:"widget_common_conditions_triggering_option_pageview",value:"minPagesViewed"},trackingSent:{label:"widget_common_conditions_triggering_option_tracking",value:"trackingSent"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}},M={category:i,type:d,propName:"isOncePerPageTrigger",value:!0,label:"widget_common_conditions_triggering_label_triggerOnlyOnce",render:!1},X={category:i,type:l,label:"widget_common_conditions_triggering_label",options:[$.pageLoad,$.direct,$.exitIntent,$.reengage,$.click,$.hover,$.elementVisible,$.scrollUp,$.scrollPercent,$.minPagesViewed,$.trackingSent,$.rageClick,$.customScript],propName:T,value:"pageLoad",render:!1};R.conditions=[{field:T,value:"click"}],z.conditions=[{field:T,value:"reengage"}],E.conditions=[{field:T,value:"elementVisible"}],D.conditions=[{field:T,value:"script"}],V.conditions=[{field:T,value:"hover"}],O.conditions=[{field:T,value:"scrollPercent"}],W.conditions=[{field:T,value:"rageClick"}],H.conditions=[{field:T,value:"rageClick"}],A.conditions=[{field:T,value:"minPagesViewed"}],L.conditions=[{field:T,value:"trackingSent"}],U.conditions=[{field:T,value:e=>"reengage"!==e}],M.conditions=[{field:T,value:e=>["click","hover","scrollUp","script"].includes(e)}];const q={category:i,type:g,label:"widget_common_conditions_triggering_blockTitle",collapsible:!0,children:[X,R,E,D,V,O,W,H,A,L,M,z,U]},Y={category:i,type:l,propName:"animation",label:"widget_common_conditions_animation_label",value:"none",options:[{label:"widget_common_conditions_animation_option_none",value:"none"},{label:"widget_common_conditions_animation_option_fade",value:"fade"},{label:"widget_common_conditions_animation_option_slide",value:"slide"}]},j={category:i,type:m,propName:"animationDuration",label:"widget_common_conditions_animation_duration_label",value:500,min:250,max:5e3},F={category:i,type:l,propName:"animationBehaviour",label:"widget_common_conditions_animation_behaviour_label",value:"ease",options:[{label:"widget_common_conditions_animation_behaviour_option_linear",value:"linear"},{label:"widget_common_conditions_animation_behaviour_option_ease",value:"ease"},{label:"widget_common_conditions_animation_behaviour_option_ease_in",value:"ease-in"},{label:"widget_common_conditions_animation_behaviour_option_ease_out",value:"ease-out"},{label:"widget_common_conditions_animation_behaviour_option_ease_in_out",value:"ease-in-out"}]},G={category:i,type:l,propName:"animationSlideDirection",label:"widget_common_conditions_animation_slide_direction_label",value:"left",options:[{label:"widget_common_style_label_top",value:"top"},{label:"widget_common_style_label_right",value:"right"},{label:"widget_common_style_label_bottom",value:"bottom"},{label:"widget_common_style_label_left",value:"left"}]};j.conditions=[{field:"animation",value:e=>"none"!==e}],F.conditions=[{field:"animation",value:e=>"none"!==e}],G.conditions=[{field:"animation",value:"slide"}];const J={category:i,type:g,label:"widget_common_conditions_animation_blockTitle",collapsible:!0,children:[Y,j,F,G]},Q={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`}]},K={category:o,type:_,propName:"elementReferrer",label:"widget_common_layout_label_selectElementContainWidget",value:"body"},Z=({elementReferrer:e})=>{try{const o=window.ABTASTY_S&&window.ABTASTY_S.CLIENT_MANAGER.getDocument();return!s.includes(o.querySelector(e).tagName.toLowerCase())}catch(e){return!0}},ee={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",condition:Z,fallback:"beforebegin"},{label:"widget_common_layout_positioning_option_atTheEnd",value:"beforeend",condition:Z,fallback:"afterend"},{label:"widget_common_layout_positioning_option_after",value:"afterend"}]},oe={category:o,type:"positioninput",propName:"popinPosition",label:"widget_common_layout_blockTitle_layout",value:[{x:1,y:1}],condition:({layout:e})=>"popin"===e},te=[{field:"layout",value:"free"}];K.conditions=te,ee.conditions=te;const ie={category:o,type:g,label:"widget_common_layout_blockTitle_layout",collapsible:!0,children:[Q,K,oe,ee]},ne={category:o,type:d,label:"widget_common_layout_toggler_widgetDimensionsBasedOnContent",propName:"autoWidth",value:!0},le=[{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"}],ae={category:o,type:d,propName:"autoHeight",label:"widget_common_layout_toggler_label_keepHeightAuto",value:!0},re={category:o,type:l,propName:"widthUnit",value:"vw",options:le},_e={category:o,type:l,propName:"heightUnit",value:"vh",condition:({autoHeight:e})=>!e,options:le},ce={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},de={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},me={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},ge={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},pe=({autoWidth:e})=>!e;re.condition=pe,ae.condition=pe;const ue=ce.condition;ce.condition=e=>ue(e)&&pe(e);const se=de.condition;de.condition=e=>se(e)&&pe(e);const be=me.condition;me.condition=e=>be(e)&&pe(e);const ye=ge.condition;ge.condition=e=>ye(e)&&pe(e);const ve=_e.condition;_e.condition=e=>ve(e)&&pe(e);const we={category:o,type:g,collapsible:!0,label:"widget_common_layout_blockTitle_dimensions",children:[ne,ce,de,re,ae,me,ge,_e],conditions:[{field:"layout",value:"popin"}]},he={category:o,type:p,label:"widget_common_layout_zindex_alert_text",hrefUrl:"widget_common_layout_zindex_alert_link"},fe={category:o,type:g,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}]},Ne={field:"isBackgroundImage",value:!0},ke={field:"backgroundSize",value:e=>"100% 100%"!==e},xe={category:e,type:a,label:"widget_common_style_container_label_backgroundColor",propName:"backgroundColor",value:"rgba(247, 247, 247, 1)"},Be={category:e,type:d,label:"widget_common_style_toggler_label_backgroundImage",propName:"isBackgroundImage",value:!1},Ie={category:e,type:"mediaupload",label:"widget_common_style_toggler_label_backgroundImage",propName:"backgroundImage",value:"",conditions:[Ne]},Pe={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:[Ne]},Ce={category:e,type:l,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:[Ne,ke]},Se={category:e,type:d,label:"widget_common_style_backgroundImageUploader_toggler_repeatBackgroundImage",propName:"backgroundRepeat",value:!1,conditions:[Ne,ke,{field:"backgroundSize",value:e=>"cover"!==e}]},Te={category:e,type:a,label:"widget_common_style_border_label_borderColor",propName:"borderColor",value:"rgba(0, 127, 145, 1)"},Ue={category:e,type:m,label:"widget_common_style_border_label_borderRadius",propName:"borderRadius",value:4,unit:"px"},ze={category:e,type:m,label:"widget_common_style_border_label_borderThickness",propName:"borderWidth",value:2,min:0,max:50,unit:"px"},Re={category:e,type:"areainput"},Ee={...Re,label:"widget_common_style_container_label_margin",propName:"containerMargin",value:[{top:0,left:0,bottom:0,right:0}]},De={...Re,label:"widget_common_style_container_label_padding",propName:"containerPadding",value:[{top:35,left:60,bottom:35,right:60}]},Ve={category:e,type:d,label:"widget_common_style_container_dropShadow_blockTitle",propName:"dropShadow",value:!1},Oe={category:e,type:a,label:"widget_common_style_container_dropShadow_label_color",propName:"dropShadowColor",value:"rgba(57, 57, 57, 0.25);"},We={category:e,type:m,label:"widget_common_style_container_dropShadow_label_blurRadius",propName:"dropShadowBlur",value:10,unit:"px"},He={category:e,type:d,label:"widget_common_style_closeButton_label_displayCloseButton",propName:"closeButton",value:!0},Ae={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"}]},Le={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonSize",propName:"closeButtonSize",value:16,min:10,max:50},$e={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonColor",propName:"closeButtonColor",value:"rgba(119, 119, 119, 1)"},Me={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonBackgroundColor",propName:"closeButtonBackgroundColor",value:"rgba(255, 255, 255, 0)"},Xe={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonBorderRadius",propName:"closeButtonBorderRadius",value:0,min:0,max:50},qe={category:e,type:m,label:"widget_common_style_closeButton_label_closeButtonBorderThickness",propName:"closeButtonBorderWidth",value:0,min:0,max:50},Ye={category:e,type:a,label:"widget_common_style_closeButton_label_closeButtonBorderColor",propName:"closeButtonBorderColor",value:"rgba(57, 57, 57, 1)",condition:({closeButtonBorderWidth:e})=>e>0},je={category:e,type:d,propName:"overlay",label:"widget_common_style_blockTitle_overlay",value:!0},Fe={category:e,type:a,label:"widget_common_style_overlay_label_overlayColor",propName:"overlayColor",value:"rgba(0, 0, 0, 0.6)"},Ge={category:e,type:d,label:"widget_common_style_overlay_label_overlayClickable",propName:"overlayClickable",value:!0},Je=[xe,Be,Ie,Pe,Ce,Se],Qe=[{field:ze.propName,value:e=>e>0}];Te.conditions=Qe;const Ke={category:e,type:g,label:"widget_common_style_blockTitle_border",collapsible:!0,children:[ze,Te,Ue]},Ze={category:e,type:n},eo=[{field:"dropShadow",value:!0}];Oe.conditions=eo,We.conditions=eo;const oo={category:e,type:g,label:"widget_common_style_blockTitle_container",collapsible:!0,children:[Ee,De,{...Ze},...Je,{...Ze},Ve,Oe,We]},to=[{field:"overlay"}];Fe.conditions=to,Ge.conditions=to;const io={category:e,type:g,label:"widget_common_style_blockTitle_overlay",collapsible:!0,children:[je,Fe,Ge],conditions:[{field:"layout",value:"popin"}]},no=({closeButton:e})=>e,lo={category:e,type:n,condition:no},ao=Ye.condition;Ae.condition=no,Le.condition=no,$e.condition=no,Me.condition=no,Xe.condition=no,qe.condition=no,Ye.condition=e=>ao(e)&&no(e);const ro={category:e,type:g,label:"widget_common_style_blockTitle_closeButton",collapsible:!0,children:[He,Ae,{...lo},Le,$e,Me,{...lo},Xe,qe,Ye]};oo.collapsed=!1,ie.collapsed=!1,q.collapsed=!1,oo.children.find(function(e){return"containerPadding"===e.propName}).value=[{top:0,left:0,bottom:0,right:0}];var _o=ie.children.find(function(e){return"layout"===e.propName});_o.options=_o.options.filter(function(e){return!e.value.includes("banner")}),S.children=S.children.filter(function(e,o){return!e.propName&&"validationRecurrence"!==S.children[o+1].propName||e.propName&&!e.propName.includes("validationRecurrence")});var co=we.children.find(function(e){return"autoWidth"===e.propName}),mo=we.children.find(function(e){return"autoHeight"===e.propName});return co.value=!1,mo.value=!1,[ie,we,he,fe,{type:p,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"},oo,Ke,io,ro,q,S,J]});
|
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
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]),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)=>{const s=()=>{try{return document.querySelector(e)}catch(e){return null}};let i=s();const r=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],n=()=>a.disconnect(),o=()=>a.observe(...r),a=new MutationObserver(()=>(i=s(),i&&!n()&&t(i)));return i?setTimeout(()=>t(i),0):o(),{selector:e,clear:n,observe:o}};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="",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"}="free"===DATA.layout?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="",s=DATA){const{noStyles:i,layout:r}=s,{backgroundColor:n,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:h,backgroundRepeat:l,borderColor:d,borderRadius:u,borderWidth:g,textColor:m,textAlign:p,fontName:v,fontStyle:y,fontSize:w,isTitle:b,titleTextAlign:f,titleTextColor:$,titleFontName:S,titleFontStyle:C,titleFontSize:E,overlay:A,overlayColor:I,dropShadow:x,dropShadowColor:P,dropShadowBlur:R,containerMargin:N,containerPadding:B,closeButton:L,closeButtonPosition:O,closeButtonSize:k,closeButtonBorderRadius:W,closeButtonBorderWidth:D,closeButtonBorderColor:_,closeButtonColor:V,closeButtonBackgroundColor:q,buttonsBorderWidth:j,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:F,buttonsTextColor:z,buttonsFontName:U,buttonsFontStyle:G,buttonsFontSize:K}=i?{}:s,Y=document.createElement("style");Y.type="text/css",e()&&Y.setAttribute("abtasty-script-added","true"),this.loadFont(v,y),this.loadFont(S,C),this.loadFont(U,G);const J=`background: ${["string"==typeof n?n:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof h&&"100% 100%"!==c?h:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&l&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,Q="number"==typeof g&&g>0,X=`border: ${[Q?`${g}px`:"unset",Q?"solid":"",Q&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,Z=void 0!==u?`border-radius: ${u}px;`:"",ee=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",te=void 0!==p?`text-align: ${p};`:"",se=v&&"inherit"!==v?`font-family:${v}_${y.match(T)?y.match(T)[1]:""};`:y||"",ie=w?`font-size: ${w}px;`:"",re=void 0!==x&&x?`box-shadow: 0 5px ${R}px 0 ${P};`:"",ne=N instanceof Array&&1===N.length&&N[0],oe=ne?`margin: ${ne.top}px ${ne.right}px ${ne.bottom}px ${ne.left}px;`:"",ae=ne?`margin: calc(${ne.top}px * 0.5) calc(${ne.right}px * 0.5) calc(${ne.bottom}px * 0.5) calc(${ne.left}px * 0.5);`:"",ce=B instanceof Array&&1===B.length&&B[0],he=ce?`padding: ${ce.top}px ${ce.right}px ${ce.bottom}px ${ce.left}px;`:"",le=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!==j&&j?`border-width: ${j}px; border-style: solid;`:"",ue=[M,j].every(e=>void 0!==e)&&j?`border-color: ${M};`:"",ge=void 0!==H?`border-radius: ${H}px;`:"",me=void 0!==F?`background-color: ${F};`:"",pe=void 0!==z?`color: ${z}; fill: ${z}; -webkit-text-fill-color: ${z};`:"",ve=U&&"inherit"!==U?`font-family:${U}_${G.match(T)?G.match(T)[1]:""};`:G||"",ye=K?`font-size: ${K}px;`:"",we="popin"!==r||void 0!==A&&!0!==A?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==I?I:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),be="number"==typeof k?k:16,fe=be/2,$e=i||void 0!==L&&L?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===O?`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 W?`border-radius: ${W}px;`:"","number"==typeof D&&D>0?`border: ${D}px solid ${void 0!==_?_:"rgba(57, 57, 57, 1)"};`:"","string"==typeof q?`background-color: ${q};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${be}px;`,`height: ${be}px;`,"string"==typeof V?`fill: ${V};`:"","}"].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}_${C.match(T)?C.match(T)[1]:""};`:C||"",E?`font-size: ${E}px;`:"","}"].join(""):"";return Y.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,J,Z,X,ee,te,re,oe,se,ie,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,ee,te,se,ie,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",he,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} > * {`,le,"}","}",we,$e,Se,`${t}`].join(""),Y}}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()})}()}();
|
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]),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}`:""}`},l=()=>{const e=c();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},h=()=>`${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=l();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)=>{const s=()=>{try{return document.querySelector(e)}catch(e){return null}};let i=s();const r=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],n=()=>a.disconnect(),o=()=>a.observe(...r),a=new MutationObserver(()=>(i=s(),i&&!n()&&t(i)));return i?setTimeout(()=>t(i),0):o(),{selector:e,clear:n,observe:o}};function m(e,t){return t(e)||!e.parentElement?e:m(e.parentElement,t)}const p=(e,t)=>[...document.querySelectorAll(t)].some(s=>s.isSameNode(e)||!!e.closest(t));class v{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 y{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 v;if(this.visibilityObservers.push(n),r&&i){const e=h();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([document,...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_${h()}`,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=["click",({isTrusted:e,target:s})=>e&&p(s,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onHover({promise:e,resolve:t}){const s=["mouseenter",({isTrusted:e,target:s})=>e&&p(s,this.selector)&&t(!0),{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...s]),document.documentElement.addEventListener(...s),e}onExitIntent({promise:e,resolve:t}){const s=["mouseleave",({isTrusted:e,clientY:s})=>{e&&s<=0&&t(!0)},{passive:!0}],i=g("body",e=>{this.eventsListeners.push([e,...s]),e.addEventListener(...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=>{this.eventsListeners.push([document,e,...r]),document.addEventListener(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}onScrollUp({promise:e,resolve:t}){let s=0;const i=["scroll",({isTrusted:e})=>{e&&(window.pageYOffset<s?t(!0):s=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:s}=DATA,i=["scroll",({isTrusted:e})=>{if(!e)return;const i=(()=>{const{documentElement:e,body:t}=document,s=e.scrollTop||t.scrollTop,i=e.scrollHeight||t.scrollHeight;return Math.trunc(s/(i-e.clientHeight)*100,10)})();s<i&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...i]),document.addEventListener(...i),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}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:s}=DATA;let i=localStorage.getItem("ABTastyData");const r=()=>JSON.parse(i).ActionTracking.find(({name:e})=>e===s),n=["storage",()=>{i=localStorage.getItem("ABTastyData"),r()&&t(!0)},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...n]),window.addEventListener(...n)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:s}=DATA;let i=localStorage.getItem("ABTastyData");const r=()=>s<=(i?JSON.parse(i).VisitedPages.length:0),n=["storage",()=>{i=localStorage.getItem("ABTastyData"),r()&&t(!0)},{passive:!0,capture:!0}];return i&&r()?t(!0):(()=>{this.eventsListeners.push([window,...n]),window.addEventListener(...n)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:s,triggerEventRageClickDelay:i}=DATA;let r=0,n=!1;const o=["click",({isTrusted:e})=>{e&&(r+=1,r>=s&&t(!0),n||(n=!0,setTimeout(()=>{r=0,n=!1},i)))},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),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]=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=h();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const e=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),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(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 w="closing",f="validation",b="ABTastyWidgets",$="ABTastyWidgetsTemporary";class S{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=h(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem($),s=sessionStorage.getItem(b);"ABTastyData"===e&&!t&&s&&localStorage.setItem($,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($),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(b,e),localStorage.removeItem($));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:l}=this.getCurrentRecurrence(),h=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new y({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(l&&t!==f)if(t===w&&l!==f)h();else{if("display"!==t||l===f||l===w)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 T{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 C=/.+\/([^.]+)\.(otf|ttf)$/;class E{constructor(){this.children=void 0,this.uniqueId=h(),this.widgetName=c(),this.prettyName=l(),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,triggerEventHover:i,triggerEventReengageDelay:r,socialProofContentType:n,triggerEventElementVisible:o,triggerEventDelay:a}=DATA;if(e()||!t&&!n)return!1;const c={click:()=>s,hover:()=>i,elementVisible:()=>o},l=Object.prototype.hasOwnProperty.call(c,t)?c[t]():"body",h="reengage"===t?r:a;return n&&(t=1===n?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:l,triggerDelay:h}})(),this.recurrence=!!this.recurrenceParams&&new S(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new y(this.triggerParams),this.pageWatcher=new T(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(t)||e})(),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"}="free"===DATA.layout?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,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),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,animationDuration:o=1e3}=DATA,a=[];if(void 0!==i&&!0!==i||!0!==r||"popin"!==n||a.push(`.${this.overlayClassName}`),void 0!==s&&s&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));return c.length?(t.push(...c),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(),1.05*o)},{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(C)?t.match(C)[1]:"";s.innerHTML=`@font-face { font-family: '${e}_${i}'; src: url('${t}');}`,document.head.appendChild(s)}getStyleTag(t="",s=DATA){const{noStyles:i,layout:r}=s,{backgroundColor:n,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:d,borderRadius:u,borderWidth:g,textColor:m,textAlign:p,fontName:v,fontStyle:y,fontSize:w,isTitle:f,titleTextAlign:b,titleTextColor:$,titleFontName:S,titleFontStyle:T,titleFontSize:E,overlay:A,overlayColor:I,dropShadow:P,dropShadowColor:R,dropShadowBlur:x,containerMargin:N,containerPadding:B,closeButton:L,closeButtonPosition:k,closeButtonSize:D,closeButtonBorderRadius:O,closeButtonBorderWidth:W,closeButtonBorderColor:_,closeButtonColor:V,closeButtonBackgroundColor:q,buttonsBorderWidth:j,buttonsBorderColor:M,buttonsBorderRadius:H,buttonsBackgroundColor:F,buttonsTextColor:U,buttonsFontName:z,buttonsFontStyle:G,buttonsFontSize:K,animation:Y,animationDuration:J,animationBehaviour:Q,animationSlideDirection:X}=i?{}:s,Z=document.createElement("style");Z.type="text/css",e()&&Z.setAttribute("abtasty-script-added","true"),this.loadFont(v,y),this.loadFont(S,T),this.loadFont(z,G);const ee=`background: ${["string"==typeof n?n:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,te="number"==typeof g&&g>0,se=`border: ${[te?`${g}px`:"unset",te?"solid":"",te&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,ie=void 0!==u?`border-radius: ${u}px;`:"",re=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",ne=void 0!==p?`text-align: ${p};`:"",oe=v&&"inherit"!==v?`font-family:${v}_${y.match(C)?y.match(C)[1]:""};`:y||"",ae=w?`font-size: ${w}px;`:"",ce=void 0!==P&&P?`box-shadow: 0 5px ${x}px 0 ${R};`:"",le=N instanceof Array&&1===N.length&&N[0],he=le?`margin: ${le.top}px ${le.right}px ${le.bottom}px ${le.left}px;`:"",de=le?`margin: calc(${le.top}px * 0.5) calc(${le.right}px * 0.5) calc(${le.bottom}px * 0.5) calc(${le.left}px * 0.5);`:"",ue=B instanceof Array&&1===B.length&&B[0],ge=ue?`padding: ${ue.top}px ${ue.right}px ${ue.bottom}px ${ue.left}px;`:"",me=ue?`padding: calc(${ue.top}px * 0.5) calc(${ue.right}px * 0.5) calc(${ue.bottom}px * 0.5) calc(${ue.left}px * 0.5);`:"",pe=void 0!==j&&j?`border-width: ${j}px; border-style: solid;`:"",ve=[M,j].every(e=>void 0!==e)&&j?`border-color: ${M};`:"",ye=void 0!==H?`border-radius: ${H}px;`:"",we=void 0!==F?`background-color: ${F};`:"",fe=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",be=z&&"inherit"!==z?`font-family:${z}_${G.match(C)?G.match(C)[1]:""};`:G||"",$e=K?`font-size: ${K}px;`:"",Se="popin"!==r||void 0!==A&&!0!==A?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==I?I:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),Te="number"==typeof D?D:16,Ce=Te/2,Ee=i||void 0!==L&&L?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===k?`bottom: calc(100% + ${Ce}px)`:`top: ${Ce}px`)+";",`right: ${Ce}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 O?`border-radius: ${O}px;`:"","number"==typeof W&&W>0?`border: ${W}px solid ${void 0!==_?_:"rgba(57, 57, 57, 1)"};`:"","string"==typeof q?`background-color: ${q};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${Te}px;`,`height: ${Te}px;`,"string"==typeof V?`fill: ${V};`:"","}"].join(""):"",Ae=f&&"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!==b?`text-align: ${b};`:"",S&&"inherit"!==S?`font-family:${S}_${T.match(C)?T.match(C)[1]:""};`:T||"",E?`font-size: ${E}px;`:"","}"].join(""):"";let Ie="";if("string"==typeof Y){const t=(J/1e3).toFixed(2),s=["top","bottom"].includes(X),i=Number(s),r=[(["top","left"].includes(X)?"-":"")+"100vmax",this.translateValues?this.translateValues[i]:"0"];s&&r.reverse(),Ie={none:[],fade:[`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${Q};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${Q};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${r.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${Q};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":Y].join("")}return Z.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,ee,ie,se,re,ne,ce,he,oe,ae,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,re,ne,oe,ae,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",ge,oe,ae,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,"box-sizing: border-box;","display: inline-block;",pe,ve,ye,we,fe,be,$e,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a *, `,`#${this.widgetContainerId} .${this.contentClassName} > * button * {`,fe,be,$e,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,de,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,me,"}","}",Se,Ee,Ae,Ie,`${t}`].join(""),Z}}const A=["top: 0;","top: 50%;","bottom: 0;"],I=["left: 0;","left: 50%;","right: 0;"],P=e=>1===e?"-50%":0,R=()=>{if(Array.isArray(DATA.popinPosition)){const{popinPosition:[{x:e,y:t}]}=DATA,s=`translate(${P(t)}, ${P(e)});`;return`${A[e]}${I[t]}transform: ${s}`}return"left: 50%;top: 50%;transform: translate(-50%, -50%);"},x=()=>"autoWidth"in DATA&&!0===DATA.autoWidth,N=()=>{if(x())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 B extends E{constructor(){super(),this.translateValues=Object.values(DATA.popinPosition[0]).map(e=>P(e)),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};`,"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;",R(),N(),"pointer-events: all","}",`${x()?"":[`#${this.widgetContainerId} .${this.contentClassName} > div {`,"height: 100%;","overflow: auto;","box-sizing: border-box;","}"].join("")}`,`${x()?"":["@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}`].join("")}}class L extends E{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 k;"string"==typeof(k=DATA.iframeUrl)&&k.length&&function(){var e,t=DATA,s=t.layout,i=t.frameReferrerInsertType,r=t.frameElementReferrer;switch(s){case"popin":e=new B;break;default:e=new L(i,r)}var n,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);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(l),e.init().then(function(t){return t&&e.show()})}()}();
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abtasty/google-form-modal",
|
3
3
|
"description": "Widget for AB Tasty",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.7.0",
|
5
5
|
"form": "dist/form.js",
|
6
6
|
"main": "dist/main.js",
|
7
7
|
"files": [
|
@@ -34,6 +34,6 @@
|
|
34
34
|
"rollup-plugin-terser": "^7.0.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@abtasty/widget-utils": "^1.18.
|
37
|
+
"@abtasty/widget-utils": "^1.18.22"
|
38
38
|
}
|
39
|
-
}
|
39
|
+
}
|