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