@assaabloy/amarr-wc-dealer-leads-program 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e){function t(t){for(var a,i,c=t[0],l=t[1],u=t[2],s=0,f=[];s<c.length;s++)i=c[s],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&f.push(r[i][0]),r[i]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a]);for(d&&d(t);f.length;)f.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],a=!0,c=1;c<n.length;c++){var l=n[c];0!==r[l]&&(a=!1)}a&&(o.splice(t--,1),e=i(i.s=n[0]))}return e}var a={},r={24:0},o=[];function i(t){if(a[t])return a[t].exports;var n=a[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=a,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var c=this["webpackJsonpamarr-frontend-components"]=this["webpackJsonpamarr-frontend-components"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var u=0;u<c.length;u++)t(c[u]);var d=l;o.push([472,0]),n()}({0:function(e,t){e.exports=React},1:function(e,t,n){"use strict";n.d(t,"g",(function(){return r})),n.d(t,"N",(function(){return o})),n.d(t,"i",(function(){return i})),n.d(t,"B",(function(){return c})),n.d(t,"D",(function(){return l})),n.d(t,"t",(function(){return u})),n.d(t,"z",(function(){return d})),n.d(t,"n",(function(){return s})),n.d(t,"p",(function(){return f})),n.d(t,"E",(function(){return m})),n.d(t,"K",(function(){return p})),n.d(t,"s",(function(){return g})),n.d(t,"h",(function(){return b})),n.d(t,"r",(function(){return v})),n.d(t,"w",(function(){return h})),n.d(t,"u",(function(){return w})),n.d(t,"A",(function(){return x})),n.d(t,"q",(function(){return y})),n.d(t,"o",(function(){return E})),n.d(t,"C",(function(){return j})),n.d(t,"L",(function(){return N})),n.d(t,"l",(function(){return A})),n.d(t,"j",(function(){return I})),n.d(t,"m",(function(){return S})),n.d(t,"k",(function(){return P})),n.d(t,"x",(function(){return _})),n.d(t,"G",(function(){return z})),n.d(t,"v",(function(){return L})),n.d(t,"M",(function(){return T})),n.d(t,"b",(function(){return C})),n.d(t,"J",(function(){return D})),n.d(t,"y",(function(){return B})),n.d(t,"a",(function(){return J})),n.d(t,"d",(function(){return R})),n.d(t,"f",(function(){return U})),n.d(t,"e",(function(){return $})),n.d(t,"c",(function(){return H})),n.d(t,"O",(function(){return M})),n.d(t,"F",(function(){return Z})),n.d(t,"H",(function(){return F})),n.d(t,"I",(function(){return q}));var a=n(3),r=function(e){return JSON.parse(decodeURIComponent(escape(atob(e))))},o=function(e){return btoa(unescape(encodeURIComponent(e)))},i=function(e){return e.toUpperCase()},c=function(e){return e.replaceAll(" ","-").toLowerCase()},l=new a.a(!1),u=new a.a(!1),d=new a.a(!1),s=new a.a(!1),f=new a.a(""),m=new a.a(!1),p=new a.a(!1),g=new a.a(!1),b=new a.a(!1),v=new a.a(""),h=new a.a(!0),w=new a.a(!0),x=new a.a(!0),y=new a.a(!0),E=new a.a(!0),O=new a.a(!1),k=0,j=new a.a(!1),N=new a.a(""),A=new a.a(""),I=new a.a(""),S=new a.a(""),P=new a.a(""),_=new a.a(""),z=new a.a(""),L=new a.a(!1),T=new a.a(!1),C=function(){setTimeout((function(){k++,O.next(!0)}),0)},D=function(){setTimeout((function(){k>0&&k--,0==k&&O.next(!1)}),0)},B=function(){return O.asObservable()},J=function(e){return!!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},R=function(e){return e.match(/^[a-zA-Z\xc0-\xff-. ]*$/)},U=function(e){return/^[0-9a-zA-Z !@#\$%\^\&*\)\(+=._-]+$/.test(e)},$=function(e){return/^\(?([0-9]{3})\)\s[0-9]{3}-[0-9]{4}$/.test(e)},H=function(e){return/^[0-9]*$/.test(e)},M=function(e){return!!/^[-a-zA-Z0-9+&@#/%?=~|!:,.;]*[-a-zA-Z0-9+&@#/%=~|]$/.test(e)},Z=function(e){if(e&&""!==e&&-1===e.indexOf("(")&&-1===e.indexOf(") ")&&-1===e.indexOf("-")){return"("+e.substring(0,3)+") "+e.substring(3,6)+"-"+e.substring(6,e.length)}return e},F=function(e){return e&&(e=e.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")),0!==e&&"0"!==e||(e=e.toFixed(2)),e},q=function(e,t){return e=e?Number(e):0,(0===(t=t?Number(t):0)||"0"===t?0:(e-t)/t*100).toFixed(2)}},135:function(e,t,n){"use strict";var a=n(2),r=n(0),o=n.n(r),i=n(1),c=n(4).default.section.withConfig({displayName:"styles__Content",componentId:"sc-1qku8b4-0"})([".capitalize{text-transform:capitalize;}.uppercase{text-transform:uppercase;}.dealer-leads-program{padding:12px 0px 24px 24px;.row{margin-bottom:26px;}@media(max-width:1680px){.row{margin-bottom:20px;}}}.parent-container-gap{row-gap:24px;}.container-gap{gap:24px;row-gap:24px;}.box-container{border:1px solid #8d8d8d;border-radius:4px;flex-wrap:wrap;justify-content:space-between;}.child{margin-bottom:-5px;flex:0 0 50%;max-width:calc(50% - 24px);@media screen and (max-width:767px){flex:0 0 100%;max-width:100%;}}.leads-button button{padding-right:36px;padding-left:36px;}.leads-button{padding-top:8px;}"]),l=n(5),u=n(6),d=n.n(u),s=n(8),f=n(9),m=function(e){var t=e.dealerLeadsProgramData,n=Object(i.g)(t),u=Object(r.useState)(!1),m=Object(a.a)(u,2),p=m[0],g=m[1],b=Object(r.useState)([]),v=Object(a.a)(b,2),h=v[0],w=v[1];return Object(r.useEffect)((function(){if(Object(i.y)().subscribe((function(e){g(e)})),localStorage.getItem("dealer")){var e=localStorage.getItem("dealer");JSON.parse(e).isParentAccount&&(window.location.href=n.parentRedirectURL)}var t="";window.location.search.substring(1,window.location.search.length).split("&").forEach((function(e){if("acc"===e.split("=")[0]&&(t=e.split("=")[1]),"ids"===e.split("=")[0]){var a=e.split("=")[1].split(","),r=[],o=[];if(a.forEach((function(e){if(""!==e){var a=new FormData,i=n.bodyStringPOST.replace("${locationId}",e);i=JSON.parse(i);a.append("json",JSON.stringify(i)),r.push({locationListingUrl:n.locationListingByIdAPIPath.replace("{accountNumber}",t).replace("{dealerListingLocationId}",e),iframeBodyData:a}),o.push(d()({method:"post",url:n.leadsProgramDataApiPath,data:a,headers:{"Content-Type":"multipart/form-data"}}))}})),r.length>0){var c=[];r.forEach((function(e){var t;Object(i.b)();var a={};null===(t=Object(f.c)({url:e.locationListingUrl}))||void 0===t||t.then((function(t){a=t.data,d.a.post(n.leadsProgramDataApiPath,e.iframeBodyData,{headers:{"Content-Type":"multipart/form-data"}}).then((function(e){a.iframeUrl=e.data,Object(i.J)()}),(function(e){Object(i.J)()})).catch((function(e){Object(i.J)()})),c.push(a)}),(function(e){w(c),Object(i.J)()})).catch((function(e){w(c),Object(i.J)()}))})),p||w(c)}}}))}),[]),o.a.createElement(c,null,p&&o.a.createElement(s.a,null),o.a.createElement("div",{className:"container d-flex flex-column parent-container-gap pb-5 mb-2"},h&&0===h.length&&!p&&o.a.createElement("div",{className:"body-text2"},n.noDataMessage),h&&h.length>0&&h.map((function(e,t){var a,r,c,u,d,s,f;return o.a.createElement("div",{className:"d-flex box-container container-gap"},o.a.createElement("div",{className:"dealer-leads-program child"},o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12"},o.a.createElement("div",{className:"amarr-h4 mb-1 mb-xl-2"},n.locationReviewIdLabel),o.a.createElement("p",{className:"m-0 body-text1 capitalize"},null===e||void 0===e?void 0:e.name.toLowerCase()),o.a.createElement("p",{className:"m-0 body-text1 uppercase"},null===e||void 0===e||null===(a=e.address)||void 0===a?void 0:a.address1.toLowerCase()," ",(null===e||void 0===e||null===(r=e.address)||void 0===r?void 0:r.address2)&&(null===e||void 0===e||null===(c=e.address)||void 0===c?void 0:c.address2.toLowerCase())," ",null===e||void 0===e||null===(u=e.address)||void 0===u?void 0:u.city.toLowerCase()," ",null===e||void 0===e||null===(d=e.address)||void 0===d?void 0:d.state," ",null===e||void 0===e||null===(s=e.address)||void 0===s?void 0:s.country," ",null===e||void 0===e||null===(f=e.address)||void 0===f?void 0:f.zip))),o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12"},o.a.createElement("div",{className:"amarr-h4 mb-1 mb-xl-2"},n.enrolmentLabel),o.a.createElement("p",{className:"m-0 body-text1"},(null===e||void 0===e?void 0:e.enrolledInDispatch)?n.enrolledText:n.notEnrolledText))),o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12 leads-button"},"tertiary"!==n.cta.color&&"noTheme"!==n.cta.color&&o.a.createElement(l.a,{label:Object(i.i)(n.cta.label),link:!0,target:n.cta.linkAction,linkHref:n.cta.url,inverse:"inverse"===n.cta.color}),"tertiary"===n.cta.color&&n.cta.isInternal&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction}),"tertiary"===n.cta.color&&!n.cta.isInternal&&"_self"===n.cta.linkAction&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction}),"tertiary"===n.cta.color&&n.cta.isInternal&&"_blank"===n.cta.linkAction&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction,rel:"noopener"}),"noTheme"===n.cta.color&&n.cta.isInternal&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction},e.label),"noTheme"===n.cta.color&&!n.cta.isInternal&&"_self"===n.cta.linkAction&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction},e.label),"noTheme"===n.cta.color&&!n.cta.isInternal&&"_blank"===n.cta.linkAction&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction,rel:"noopener"},n.cta.label)))),o.a.createElement("div",{className:"child"},o.a.createElement("iframe",{src:"".concat(null===e||void 0===e?void 0:e.iframeUrl),width:"100%",height:"360px","aria-label":"iframe"})))}))))};m.defaultProps={theme:"",dealerLeadsProgramData:""};t.a=m},18:function(e,t){e.exports=ReactDOM},383:function(e,t,n){"use strict";n.r(t);var a=n(13),r=n(135);t.default=a.a.create({component:r.a,configuration:{tagname:"amarr-dealer-leads-program",useShadow:!1},plugins:[]})},5:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var a=n(20),r=n(0),o=n.n(r),i=n(4),c=i.default.div.withConfig({displayName:"styles__View",componentId:"sc-1jt3i0i-0"})([""]),l=i.default.button.withConfig({displayName:"styles__Button",componentId:"sc-1jt3i0i-1"})(['font-size:12px;font-family:"Open Sans";font-weight:600;font-stretch:normal;font-style:normal;line-height:1.5;letter-spacing:normal;text-align:center;color:#fff;padding:12px 19px 12px 20px;border-radius:4px;background-color:#006166;box-shadow:none;border:none;transition:all ease 300ms;&:hover{transform:scale(1.1);background-color:#338084;color:#fff;}&:focus{transform:scale(1);box-shadow:none !important;background-color:#004347;}&:active{background-color:#006166 !important;box-shadow:none !important;transform:scale(1);border:none !important;}&.btn-inverse{color:#333333;background:#b2cfd1;&:hover{background:#8EB8BB;}&:focus{background:#8EA5A7;border:none;transform:scale(1);box-shadow:none !important;}&:active{background-color:#8EA5A7 !important;border:none !important;transform:scale(1.1);box-shadow:none !important;}}@media(min-width:1201px){font-size:16px;}.button-icon{vertical-align:top;padding-right:8px;}']),u=function(e){var t=e.label,n=void 0===t?"label":t,r=e.classStyle,i=void 0===r?"default":r,u=e.link,d=void 0!==u&&u,s=e.disabled,f=void 0!==s&&s,m=e.datatoggle,p=void 0===m?"":m,g=e.datatarget,b=void 0===g?"":g,v=e.linkHref,h=e.target,w=void 0===h?"_self":h,x=e.downloadLink,y=void 0!==x&&x,E=e.inverse,O=void 0!==E&&E,k=e.icon,j=void 0===k?"":k,N=e.iconAlt,A=void 0===N?"":N,I=e.dataItemName,S=void 0===I?"":I,P=e.id,_=void 0===P?"":P,z=e.type,L=void 0===z?"button":z,T=Object(a.a)(e,["label","classStyle","link","disabled","datatoggle","datatarget","linkHref","target","downloadLink","inverse","icon","iconAlt","dataItemName","id","type"]);return o.a.createElement(c,null,o.a.createElement("div",{className:""},d?o.a.createElement("a",{href:v,download:y,target:w,"data-item-name":S,id:_},o.a.createElement(l,Object.assign({disabled:f,classStyle:"".concat(i)},T,{type:L,className:O?"btn-inverse btn btn-success":"btn btn-success"}),""!=j?o.a.createElement("div",{"data-toggle":p,"data-target":b},o.a.createElement("img",{className:"button-icon",src:j,alt:A}),o.a.createElement("span",null,n)):o.a.createElement("span",null,n))):o.a.createElement(l,Object.assign({disabled:f,classStyle:i,className:O?"btn-inverse btn btn-success":"btn btn-success",id:_,"data-item-name":S,type:L},T),o.a.createElement("span",null,n))))}},8:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var a=n(15),r=n(0),o=n.n(r),i=n(4),c=(n(30),i.default.div.withConfig({displayName:"styles__View",componentId:"sc-10ksvu2-0"})([".loader{position:fixed;left:0;right:0;top:0;bottom:0;text-align:center;z-index:9999;background:rgba(0,0,0,0.5);overflow:hidden;div{align-items:center;}}"])),l=n(23),u=n.n(l),d=function(e){return Object(a.a)(e),o.a.createElement(c,null,o.a.createElement("div",{className:"d-flex justify-content-center loader"},o.a.createElement("div",{className:"d-flex"},o.a.createElement(u.a,{type:"ThreeDots",color:"rgb(0, 97, 102)",height:100,width:100}))))}},9:function(e,t,n){"use strict";n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"e",(function(){return u})),n.d(t,"a",(function(){return d}));var a=n(28),r=n(6),o=n.n(r);function i(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"GET",headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function c(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"DELETE",headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function l(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"POST",data:e.data,headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function u(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"PUT",data:e.data,headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function d(e){return o()({url:e,method:"GET"})}o.a.interceptors.request.use((function(e){return!(window.location.pathname.indexOf(".html")>-1)&&Object(a.a)({},e)})),o.a.interceptors.response.use((function(e){return 201===e.status&&console.log("Posted Successfully"),401===e.status&&console.log("not found"),400===e.status&&console.log("unauthorized"),e}),(function(e){return window.location.pathname.indexOf("/dealer/")>-1&&401===e.response.status&&(localStorage.removeItem("user"),localStorage.removeItem("dealer"),localStorage.removeItem("expiry"),localStorage.removeItem("token"),document.cookie="usertype=null; max-age=0;secure",localStorage.removeItem("primaryRole"),sessionStorage.removeItem("amarrRoles"),window.location.href=window.location.origin),Promise.reject(e)}))}});
1
+ !function(e){function t(t){for(var a,i,c=t[0],l=t[1],u=t[2],s=0,f=[];s<c.length;s++)i=c[s],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&f.push(r[i][0]),r[i]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a]);for(d&&d(t);f.length;)f.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],a=!0,c=1;c<n.length;c++){var l=n[c];0!==r[l]&&(a=!1)}a&&(o.splice(t--,1),e=i(i.s=n[0]))}return e}var a={},r={24:0},o=[];function i(t){if(a[t])return a[t].exports;var n=a[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=a,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(n,a,function(t){return e[t]}.bind(null,a));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var c=this["webpackJsonpamarr-frontend-components"]=this["webpackJsonpamarr-frontend-components"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var u=0;u<c.length;u++)t(c[u]);var d=l;o.push([472,0]),n()}({0:function(e,t){e.exports=React},1:function(e,t,n){"use strict";n.d(t,"g",(function(){return r})),n.d(t,"O",(function(){return o})),n.d(t,"i",(function(){return i})),n.d(t,"B",(function(){return c})),n.d(t,"D",(function(){return l})),n.d(t,"t",(function(){return u})),n.d(t,"z",(function(){return d})),n.d(t,"n",(function(){return s})),n.d(t,"p",(function(){return f})),n.d(t,"E",(function(){return m})),n.d(t,"K",(function(){return p})),n.d(t,"s",(function(){return g})),n.d(t,"h",(function(){return b})),n.d(t,"r",(function(){return v})),n.d(t,"w",(function(){return h})),n.d(t,"u",(function(){return w})),n.d(t,"A",(function(){return x})),n.d(t,"q",(function(){return y})),n.d(t,"o",(function(){return E})),n.d(t,"C",(function(){return j})),n.d(t,"L",(function(){return N})),n.d(t,"l",(function(){return A})),n.d(t,"j",(function(){return I})),n.d(t,"m",(function(){return S})),n.d(t,"k",(function(){return P})),n.d(t,"x",(function(){return _})),n.d(t,"G",(function(){return z})),n.d(t,"v",(function(){return L})),n.d(t,"M",(function(){return T})),n.d(t,"N",(function(){return C})),n.d(t,"b",(function(){return D})),n.d(t,"J",(function(){return B})),n.d(t,"y",(function(){return J})),n.d(t,"a",(function(){return R})),n.d(t,"d",(function(){return U})),n.d(t,"f",(function(){return $})),n.d(t,"e",(function(){return H})),n.d(t,"c",(function(){return M})),n.d(t,"P",(function(){return Z})),n.d(t,"F",(function(){return F})),n.d(t,"H",(function(){return q})),n.d(t,"I",(function(){return G}));var a=n(3),r=function(e){return JSON.parse(decodeURIComponent(escape(atob(e))))},o=function(e){return btoa(unescape(encodeURIComponent(e)))},i=function(e){return e.toUpperCase()},c=function(e){return e.replaceAll(" ","-").toLowerCase()},l=new a.a(!1),u=new a.a(!1),d=new a.a(!1),s=new a.a(!1),f=new a.a(""),m=new a.a(!1),p=new a.a(!1),g=new a.a(!1),b=new a.a(!1),v=new a.a(""),h=new a.a(!0),w=new a.a(!0),x=new a.a(!0),y=new a.a(!0),E=new a.a(!0),O=new a.a(!1),k=0,j=new a.a(!1),N=new a.a(""),A=new a.a(""),I=new a.a(""),S=new a.a(""),P=new a.a(""),_=new a.a(""),z=new a.a(""),L=new a.a(!1),T=new a.a(!1),C=new a.a(!1),D=function(){setTimeout((function(){k++,O.next(!0)}),0)},B=function(){setTimeout((function(){k>0&&k--,0==k&&O.next(!1)}),0)},J=function(){return O.asObservable()},R=function(e){return!!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},U=function(e){return e.match(/^[a-zA-Z\xc0-\xff-. ]*$/)},$=function(e){return/^[0-9a-zA-Z !@#\$%\^\&*\)\(+=._-]+$/.test(e)},H=function(e){return/^\(?([0-9]{3})\)\s[0-9]{3}-[0-9]{4}$/.test(e)},M=function(e){return/^[0-9]*$/.test(e)},Z=function(e){return!!/^[-a-zA-Z0-9+&@#/%?=~|!:,.;]*[-a-zA-Z0-9+&@#/%=~|]$/.test(e)},F=function(e){if(e&&""!==e&&-1===e.indexOf("(")&&-1===e.indexOf(") ")&&-1===e.indexOf("-")){return"("+e.substring(0,3)+") "+e.substring(3,6)+"-"+e.substring(6,e.length)}return e},q=function(e){return e&&(e=e.toFixed(2).replace(/\d(?=(\d{3})+\.)/g,"$&,")),0!==e&&"0"!==e||(e=e.toFixed(2)),e},G=function(e,t){return e=e?Number(e):0,(0===(t=t?Number(t):0)||"0"===t?0:(e-t)/t*100).toFixed(2)}},135:function(e,t,n){"use strict";var a=n(2),r=n(0),o=n.n(r),i=n(1),c=n(4).default.section.withConfig({displayName:"styles__Content",componentId:"sc-1qku8b4-0"})([".capitalize{text-transform:capitalize;}.uppercase{text-transform:uppercase;}.dealer-leads-program{padding:12px 0px 24px 24px;.row{margin-bottom:26px;}@media(max-width:1680px){.row{margin-bottom:20px;}}}.parent-container-gap{row-gap:24px;}.container-gap{gap:24px;row-gap:24px;}.box-container{border:1px solid #8d8d8d;border-radius:4px;flex-wrap:wrap;justify-content:space-between;}.child{margin-bottom:-5px;flex:0 0 50%;max-width:calc(50% - 24px);@media screen and (max-width:767px){flex:0 0 100%;max-width:100%;}}.leads-button button{padding-right:36px;padding-left:36px;}.leads-button{padding-top:8px;}"]),l=n(5),u=n(6),d=n.n(u),s=n(8),f=n(9),m=function(e){var t=e.dealerLeadsProgramData,n=Object(i.g)(t),u=Object(r.useState)(!1),m=Object(a.a)(u,2),p=m[0],g=m[1],b=Object(r.useState)([]),v=Object(a.a)(b,2),h=v[0],w=v[1];return Object(r.useEffect)((function(){if(Object(i.y)().subscribe((function(e){g(e)})),localStorage.getItem("dealer")){var e=localStorage.getItem("dealer");JSON.parse(e).isParentAccount&&(window.location.href=n.parentRedirectURL)}var t="";window.location.search.substring(1,window.location.search.length).split("&").forEach((function(e){if("acc"===e.split("=")[0]&&(t=e.split("=")[1]),"ids"===e.split("=")[0]){var a=e.split("=")[1].split(","),r=[],o=[];if(a.forEach((function(e){if(""!==e){var a=new FormData,i=n.bodyStringPOST.replace("${locationId}",e);i=JSON.parse(i);a.append("json",JSON.stringify(i)),r.push({locationListingUrl:n.locationListingByIdAPIPath.replace("{accountNumber}",t).replace("{dealerListingLocationId}",e),iframeBodyData:a}),o.push(d()({method:"post",url:n.leadsProgramDataApiPath,data:a,headers:{"Content-Type":"multipart/form-data"}}))}})),r.length>0){var c=[];r.forEach((function(e){var t;Object(i.b)();var a={};null===(t=Object(f.c)({url:e.locationListingUrl}))||void 0===t||t.then((function(t){a=t.data,d.a.post(n.leadsProgramDataApiPath,e.iframeBodyData,{headers:{"Content-Type":"multipart/form-data"}}).then((function(e){a.iframeUrl=e.data,Object(i.J)()}),(function(e){Object(i.J)()})).catch((function(e){Object(i.J)()})),c.push(a)}),(function(e){w(c),Object(i.J)()})).catch((function(e){w(c),Object(i.J)()}))})),p||w(c)}}}))}),[]),o.a.createElement(c,null,p&&o.a.createElement(s.a,null),o.a.createElement("div",{className:"container d-flex flex-column parent-container-gap pb-5 mb-2"},h&&0===h.length&&!p&&o.a.createElement("div",{className:"body-text2"},n.noDataMessage),h&&h.length>0&&h.map((function(e,t){var a,r,c,u,d,s,f;return o.a.createElement("div",{className:"d-flex box-container container-gap"},o.a.createElement("div",{className:"dealer-leads-program child"},o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12"},o.a.createElement("div",{className:"amarr-h4 mb-1 mb-xl-2"},n.locationReviewIdLabel),o.a.createElement("p",{className:"m-0 body-text1 capitalize"},null===e||void 0===e?void 0:e.name.toLowerCase()),o.a.createElement("p",{className:"m-0 body-text1 uppercase"},null===e||void 0===e||null===(a=e.address)||void 0===a?void 0:a.address1.toLowerCase()," ",(null===e||void 0===e||null===(r=e.address)||void 0===r?void 0:r.address2)&&(null===e||void 0===e||null===(c=e.address)||void 0===c?void 0:c.address2.toLowerCase())," ",null===e||void 0===e||null===(u=e.address)||void 0===u?void 0:u.city.toLowerCase()," ",null===e||void 0===e||null===(d=e.address)||void 0===d?void 0:d.state," ",null===e||void 0===e||null===(s=e.address)||void 0===s?void 0:s.country," ",null===e||void 0===e||null===(f=e.address)||void 0===f?void 0:f.zip))),o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12"},o.a.createElement("div",{className:"amarr-h4 mb-1 mb-xl-2"},n.enrolmentLabel),o.a.createElement("p",{className:"m-0 body-text1"},(null===e||void 0===e?void 0:e.enrolledInDispatch)?n.enrolledText:n.notEnrolledText))),o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col-12 leads-button"},"tertiary"!==n.cta.color&&"noTheme"!==n.cta.color&&o.a.createElement(l.a,{label:Object(i.i)(n.cta.label),link:!0,target:n.cta.linkAction,linkHref:n.cta.url,inverse:"inverse"===n.cta.color}),"tertiary"===n.cta.color&&n.cta.isInternal&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction}),"tertiary"===n.cta.color&&!n.cta.isInternal&&"_self"===n.cta.linkAction&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction}),"tertiary"===n.cta.color&&n.cta.isInternal&&"_blank"===n.cta.linkAction&&o.a.createElement("a",{href:n.cta.url,target:n.cta.linkAction,rel:"noopener"}),"noTheme"===n.cta.color&&n.cta.isInternal&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction},e.label),"noTheme"===n.cta.color&&!n.cta.isInternal&&"_self"===n.cta.linkAction&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction},e.label),"noTheme"===n.cta.color&&!n.cta.isInternal&&"_blank"===n.cta.linkAction&&o.a.createElement("a",{className:"amarrHighlight",href:n.cta.url,target:n.cta.linkAction,rel:"noopener"},n.cta.label)))),o.a.createElement("div",{className:"child"},o.a.createElement("iframe",{src:"".concat(null===e||void 0===e?void 0:e.iframeUrl),width:"100%",height:"360px","aria-label":"iframe"})))}))))};m.defaultProps={theme:"",dealerLeadsProgramData:""};t.a=m},18:function(e,t){e.exports=ReactDOM},383:function(e,t,n){"use strict";n.r(t);var a=n(13),r=n(135);t.default=a.a.create({component:r.a,configuration:{tagname:"amarr-dealer-leads-program",useShadow:!1},plugins:[]})},5:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var a=n(20),r=n(0),o=n.n(r),i=n(4),c=i.default.div.withConfig({displayName:"styles__View",componentId:"sc-1jt3i0i-0"})([""]),l=i.default.button.withConfig({displayName:"styles__Button",componentId:"sc-1jt3i0i-1"})(['font-size:12px;font-family:"Open Sans";font-weight:600;font-stretch:normal;font-style:normal;line-height:1.5;letter-spacing:normal;text-align:center;color:#fff;padding:12px 19px 12px 20px;border-radius:4px;background-color:#006166;box-shadow:none;border:none;transition:all ease 300ms;&:hover{transform:scale(1.1);background-color:#338084;color:#fff;}&:focus{transform:scale(1);box-shadow:none !important;background-color:#004347;}&:active{background-color:#006166 !important;box-shadow:none !important;transform:scale(1);border:none !important;}&.btn-inverse{color:#333333;background:#b2cfd1;&:hover{background:#8EB8BB;}&:focus{background:#8EA5A7;border:none;transform:scale(1);box-shadow:none !important;}&:active{background-color:#8EA5A7 !important;border:none !important;transform:scale(1.1);box-shadow:none !important;}}@media(min-width:1201px){font-size:16px;}.button-icon{vertical-align:top;padding-right:8px;}']),u=function(e){var t=e.label,n=void 0===t?"label":t,r=e.classStyle,i=void 0===r?"default":r,u=e.link,d=void 0!==u&&u,s=e.disabled,f=void 0!==s&&s,m=e.datatoggle,p=void 0===m?"":m,g=e.datatarget,b=void 0===g?"":g,v=e.linkHref,h=e.target,w=void 0===h?"_self":h,x=e.downloadLink,y=void 0!==x&&x,E=e.inverse,O=void 0!==E&&E,k=e.icon,j=void 0===k?"":k,N=e.iconAlt,A=void 0===N?"":N,I=e.dataItemName,S=void 0===I?"":I,P=e.id,_=void 0===P?"":P,z=e.type,L=void 0===z?"button":z,T=Object(a.a)(e,["label","classStyle","link","disabled","datatoggle","datatarget","linkHref","target","downloadLink","inverse","icon","iconAlt","dataItemName","id","type"]);return o.a.createElement(c,null,o.a.createElement("div",{className:""},d?o.a.createElement("a",{href:v,download:y,target:w,"data-item-name":S,id:_},o.a.createElement(l,Object.assign({disabled:f,classStyle:"".concat(i)},T,{type:L,className:O?"btn-inverse btn btn-success":"btn btn-success"}),""!=j?o.a.createElement("div",{"data-toggle":p,"data-target":b},o.a.createElement("img",{className:"button-icon",src:j,alt:A}),o.a.createElement("span",null,n)):o.a.createElement("span",null,n))):o.a.createElement(l,Object.assign({disabled:f,classStyle:i,className:O?"btn-inverse btn btn-success":"btn btn-success",id:_,"data-item-name":S,type:L},T),o.a.createElement("span",null,n))))}},8:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var a=n(15),r=n(0),o=n.n(r),i=n(4),c=(n(30),i.default.div.withConfig({displayName:"styles__View",componentId:"sc-10ksvu2-0"})([".loader{position:fixed;left:0;right:0;top:0;bottom:0;text-align:center;z-index:9999;background:rgba(0,0,0,0.5);overflow:hidden;div{align-items:center;}}"])),l=n(23),u=n.n(l),d=function(e){return Object(a.a)(e),o.a.createElement(c,null,o.a.createElement("div",{className:"d-flex justify-content-center loader"},o.a.createElement("div",{className:"d-flex"},o.a.createElement(u.a,{type:"ThreeDots",color:"rgb(0, 97, 102)",height:100,width:100}))))}},9:function(e,t,n){"use strict";n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"e",(function(){return u})),n.d(t,"a",(function(){return d}));var a=n(28),r=n(6),o=n.n(r);function i(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"GET",headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function c(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"DELETE",headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function l(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"POST",data:e.data,headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function u(e){var t=localStorage.getItem("token");if(e)return o()({url:e.url,method:"PUT",data:e.data,headers:{Authorization:"Bearer "+t,"content-type":"application/json"}})}function d(e){return o()({url:e,method:"GET"})}o.a.interceptors.request.use((function(e){return!(window.location.pathname.indexOf(".html")>-1)&&Object(a.a)({},e)})),o.a.interceptors.response.use((function(e){return 201===e.status&&console.log("Posted Successfully"),401===e.status&&console.log("not found"),400===e.status&&console.log("unauthorized"),e}),(function(e){return window.location.pathname.indexOf("/dealer/")>-1&&401===e.response.status&&(localStorage.removeItem("user"),localStorage.removeItem("dealer"),localStorage.removeItem("expiry"),localStorage.removeItem("token"),document.cookie="usertype=null; max-age=0;secure",localStorage.removeItem("primaryRole"),sessionStorage.removeItem("amarrRoles"),window.location.href=window.location.origin),Promise.reject(e)}))}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assaabloy/amarr-wc-dealer-leads-program",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Web component - Dealer-leads-program",
5
5
  "type": "module",
6
6
  "main": "dealer-leads-program.js",
@@ -11,5 +11,5 @@
11
11
  },
12
12
  "author": "Nagarro",
13
13
  "license": "MIT",
14
- "gitHead": "1c77c090eb727e639d98eda473f368555434c60a"
14
+ "gitHead": "492c0fcdf690f0e94235150f0ab548d9553868a7"
15
15
  }