1"use strict";(globalThis["webpackChunkellacard"]=globalThis["webpackChunkellacard"]||[]).push([[185],{9207:(t,e,s)=>{s.d(e,{Z:()=>_});var a=s(43501),i=s(86080),n=s(74654),r=s(11012),o=s(69782),l=s(24609),d=s(28914),c=s(84791),u=s(51734),m=s(23276),p=s(80911),h=s(31050),v=s(74987),f=s(2653);const g=["title"],y=(0,v.Z)(l.Z,d.Z,u.Z,(0,c.d)("radioGroup"),m.Z),_=y.extend().extend({name:"v-radio",inheritAttrs:!1,props:{disabled:Boolean,id:String,label:String,name:String,offIcon:{type:String,default:"$radioOff"},onIcon:{type:String,default:"$radioOn"},readonly:Boolean,value:{default:null}},data:()=>({isFocused:!1}),computed:{classes(){return(0,i.Z)((0,i.Z)({"v-radio--is-disabled":this.isDisabled,"v-radio--is-focused":this.isFocused},this.themeClasses),this.groupClasses)},computedColor(){if(!this.isDisabled)return p.Z.options.computed.computedColor.call(this)},computedIcon(){return this.isActive?this.onIcon:this.offIcon},computedId(){return o.Z.options.computed.computedId.call(this)},hasLabel:o.Z.options.computed.hasLabel,hasState(){return(this.radioGroup||{}).hasState},isDisabled(){return this.disabled||!!this.radioGroup&&this.radioGroup.isDisabled},isReadonly(){return this.readonly||!!this.radioGroup&&this.radioGroup.isReadonly},computedName(){return this.name||!this.radioGroup?this.name:this.radioGroup.name||`radio-${this.radioGroup._uid}`},rippleState(){return p.Z.options.computed.rippleState.call(this)},validationState(){return(this.radioGroup||{}).validationState||this.computedColor}},methods:{genInput(t){return p.Z.options.methods.genInput.call(this,"radio",t)},genLabel(){return this.hasLabel?this.$createElement(n.Z,{on:{click:p.X},attrs:{for:this.computedId},props:{color:this.validationState,focused:this.hasState}},(0,h.z9)(this,"label")||this.label):null},genRadio(){const t=this.attrs$,{title:e}=t,s=(0,a.Z)(t,g);return this.$createElement("div",{staticClass:"v-input--selection-controls__input"},[this.$createElement(r.Z,this.setTextColor(this.validationState,{props:{dense:this.radioGroup&&this.radioGroup.dense}}),this.computedIcon),this.genInput((0,i.Z)({name:this.computedName,value:this.value},s)),this.genRipple(this.setTextColor(this.rippleState))])},onFocus(t){this.isFocused=!0,this.$emit("focus",t)},onBlur(t){this.isFocused=!1,this.$emit("blur",t)},onChange(){this.isDisabled||this.isReadonly||this.isActive||this.toggle()},onKeydown:()=>{}},render(t){const e={staticClass:"v-radio",class:this.classes,on:(0,f.bp)({click:this.onChange},this.listeners$),attrs:{title:this.attrs$.title}};return t("div",e,[this.genRadio(),this.genLabel()])}})},42564:(t,e,s)=>{s.d(e,{Z:()=>l});var a=s(86080),i=(s(47393),s(69782)),n=s(2021),r=s(74987);const o=(0,r.Z)(n.y,i.Z),l=o.extend({name:"v-radio-group",provide(){return{radioGroup:this}},props:{column:{type:Boolean,default:!0},height:{type:[Number,String],default:"auto"},name:String,row:Boolean,value:null},computed:{classes(){return(0,a.Z)((0,a.Z)({},i.Z.options.computed.classes.call(this)),{},{"v-input--selection-controls v-input--radio-group":!0,"v-input--radio-group--column":this.column&&!this.row,"v-input--radio-group--row":this.row})}},methods:{genDefaultSlot(){return this.$createElement("div",{staticClass:"v-input--radio-group__input",attrs:{id:this.id,role:"radiogroup","aria-labelledby":this.computedId}},i.Z.options.methods.genDefaultSlot.call(this))},genInputSlot(){const t=i.Z.options.methods.genInputSlot.call(this);return delete t.data.on.click,t},genLabel(){const t=i.Z.options.methods.genLabel.call(this);return t?(t.data.attrs.id=this.computedId,delete t.data.attrs.for,t.tag="legend",t):null},onClick:n.y.options.methods.onClick},render(t){const e=i.Z.options.render.call(this,t);return this._b(e.data,"div",this.attrs$),e}})},22680:(t,e,s)=>{s.d(e,{Z:()=>r});var a=s(86080),i=s(23276),n=s(74987);const r=(0,n.Z)(i.Z).extend({name:"v-subheader",props:{inset:Boolean},render(t){return t("div",{staticClass:"v-subheader",class:(0,a.Z)({"v-subheader--inset":this.inset},this.themeClasses),attrs:this.$attrs,on:this.$listeners},this.$slots.default)}})},76660:(t,e,s)=>{s.d(e,{Z:()=>m});var a=s(43501),i=s(86080),n=(s(62795),s(13383),s(47393),s(80911)),r=s(69782),o=s(43134),l=s(83422),d=s(56275),c=s(31050);const u=["title"],m=n.Z.extend({name:"v-switch",directives:{Touch:o.Z},props:{inset:Boolean,loading:{type:[Boolean,String],default:!1},flat:{type:Boolean,default:!1}},computed:{classes(){return(0,i.Z)((0,i.Z)({},r.Z.options.computed.classes.call(this)),{},{"v-input--selection-controls v-input--switch":!0,"v-input--switch--flat":this.flat,"v-input--switch--inset":this.inset})},attrs(){return{"aria-checked":String(this.isActive),"aria-disabled":String(this.isDisabled),role:"switch"}},validationState(){return this.hasError&&this.shouldValidate?"error":this.hasSuccess?"success":null!==this.hasColor?this.computedColor:void 0},switchData(){return this.setTextColor(this.loading?void 0:this.validationState,{class:this.themeClasses})}},methods:{genDefaultSlot(){return[this.genSwitch(),this.genLabel()]},genSwitch(){const t=this.attrs$,{title:e}=t,s=(0,a.Z)(t,u);return this.$createElement("div",{staticClass:"v-input--selection-controls__input"},[this.genInput("checkbox",(0,i.Z)((0,i.Z)({},this.attrs),s)),this.genRipple(this.setTextColor(this.validationState,{directives:[{name:"touch",value:{left:this.onSwipeLeft,right:this.onSwipeRight}}]})),this.$createElement("div",(0,i.Z)({staticClass:"v-input--switch__track"},this.switchData)),this.$createElement("div",(0,i.Z)({staticClass:"v-input--switch__thumb"},this.switchData),[this.genProgress()])])},genProgress(){return this.$createElement(l.b0,{},[!1===this.loading?null:this.$slots.progress||this.$createElement(d.Z,{props:{color:!0===this.loading||""===this.loading?this.color||"primary":this.loading,size:16,width:2,indeterminate:!0}})])},onSwipeLeft(){this.isActive&&this.onChange()},onSwipeRight(){this.isActive||this.onChange()},onKeydown(t){(t.keyCode===c.keyCodes.left&&this.isActive||t.keyCode===c.keyCodes.right&&!this.isActive)&&this.onChange()}}})},30740:(t,e,s)=>{s.d(e,{H:()=>o});s(76265),s(78730),s(79307),s(98858),s(61318),s(33228),s(64043),s(61514);var a=s(25809);const i=864e5,n={},r={embed_root:null},o={mixins:[a.Z],methods:{async getOrgLinkOpts(t){return t?((!n[t]||new Date-n[t].t>i)&&(n[t]={t:new Date,p:this.$call("get-org-link-props",{org_id:t})}),await n[t].p):r},buildOrgLinkWithOpts(t,e,s){const{embed_root:a}=s||r;if(a){const e=new URL(a);return e.search=e.search+(e.search?"&":"?")+"q="+encodeURIComponent(t),e.href}return location.origin+"/"+t},async buildOrgLink(t,e){return this.buildOrgLinkWithOpts(t,e,await this.getOrgLinkOpts(e))}}}},83524:(t,e,s)=>{s.d(e,{Z:()=>i});s(64043),s(7409),s(57267);function a(t,e){const s=document.createElement("a");s.href="data:text/csv;charset=utf-8,"+encodeURIComponent(t.map((t=>t.map((t=>_.isNil(t)?"":"string"==typeof t&&/^\s|\s$|,|"|\n/.test(t)?'"'+t.replace(/"/g,'""')+'"':t)).join(","))).join("\n")),s.download=e,document.body.appendChild(s),s.click(),s.remove()}const i=a},9452:(t,e,s)=>{s.d(e,{D:()=>i,I:()=>n});s(76265),s(64043),s(22462),s(57267),s(268),s(9873),s(70560);const a=/(\+\d{11,})|((\+\d{1,3}[\.\-_ ]?)?(\(\d{1,3}\))?([\.\-_ ]?\d+)+)|(00\d+([\.\-_ ]?\d+)+)|(\d{10})/g;function i(t,e="1",s=!0){const n=[];for(const r of(t||"").match(a)||[]){let t=r.replace(/\D+/g,"");
1if(r.startsWith("00")&&(t=t.slice(2)),t.length>10||r.startsWith("+")||r.startsWith("00"))if(t.length>13){if(s&&t.length>=20){let t=r.split(/ +/).reverse();const s=t.last;t.length>1&&s.replace(/\D+/g,"").length<10&&(t=[...t.slice(0,-2),s+t[t.length-2]]);for(const a of t)n.push(...i(a,e,!1))}}else n.push("+"+t);else 10==t.length&&e&&n.push("+"+e+t)}return n}function n(t,e="1"){return i(t,e,!1)[0]||""}},96208:(t,e,s)=>{s.r(e),s.d(e,{default:()=>h});s(64043),s(61514);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("v-btn",{staticClass:"root",class:{show:t.show},attrs:{rounded:"",text:"",ripple:!1,color:t.color,"input-value":t.show}},[s("input",{ref:"search",attrs:{type:"text",disabled:!t.show},domProps:{value:t.value},on:{input:function(e){return t.$emit("input",e.target.value)},keydown:[function(e){if(!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.show=!!t.value,t.$refs.search.blur()},function(e){if(!e.type.indexOf("key")&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"]))return null;e.stopPropagation(),t.show=!!t.value,t.$refs.search.blur()},function(e){if(!e.type.indexOf("key")&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.show=!!t.value}],blur:function(e){var s;(null===(s=e.relatedTarget)||void 0===s?void 0:s.previousSibling)!=e.target&&(t.show=!!t.value)},"!click":function(t){t.stopPropagation()}}}),s("v-btn",{attrs:{icon:"",loading:t.loading,color:t.color},on:{click:function(){t.show&&t.value?t.$emit("input",""):t.show=!t.show}}},[s("v-icon",{domProps:{innerHTML:t._s(t.value?t.mdiClose:t.mdiMagnify)}})],1),t.tooltip&&!t.show?s("span",{staticClass:"btn-tooltip bottom left",staticStyle:{"margin-top":"-6px"}},[t._v(t._s(t.tooltip))]):t._e()],1)},i=[],n=s(3098);const r={name:"btn-search",props:["value","tooltip","loading"],data(){return{show:!1}},computed:{color(){return this.value?"warning":"primary"}},created(){Object.assign(this,{mdiClose:n.r5M,mdiMagnify:n.I0v})},watch:{async show(t){await this.$nextTick(),t&&this.$refs.search.focus()},value:{immediate:!0,handler(t){t&&(this.show=!0)}}}},o=r;var l=s(1001),d=s(43453),c=s.n(d),u=s(37179),m=s(5057),p=(0,l.Z)(o,a,i,!1,null,"0e017159",null);const h=p.exports;c()(p,{VBtn:u.Z,VIcon:m.Z})},79787:(t,e,s)=>{s.r(e),s.d(e,{default:()=>c});var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticStyle:{"vertical-align":"middle","line-height":"32px","font-size":"32px","aspect-ratio":"2"},style:t.isValid?{}:{filter:"brightness(0)"},domProps:{textContent:t._s(t.flag)}})},i=[];s(76265);function n(t){try{const e=new Intl.DisplayNames(["en"],{type:"region"});return e.of(t.toUpperCase())!=t.toUpperCase()}catch(e){return!1}}const r={name:"country-flag",props:["country"],computed:{isValid(){return n(this.country)},flag(){if(!this.isValid)return"ðºð¸";const t=this.country.toUpperCase().split("").map((t=>127397+t.charCodeAt()));return String.fromCodePoint(...t)}}},o=r;var l=s(1001),d=(0,l.Z)(o,a,i,!1,null,null,null);const c=d.exports},18671:(t,e,s)=>{s.r(e),s.d(e,{default:()=>_});s(268);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"d-flex relative",on:{focusin:function(e){t.focus=!0},focusout:t.onFocusOut}}
1,[t.hideContacts?t._e():[t.showContacts?[t.isSignedIn?s("contacts-dialog",{attrs:{single:"","email-only":t.emailOnly},on:{select:function(e){t.staged=t.$options.filters["email-phone"](e),t.showContacts=!1},close:function(e){t.showContacts=!1}}}):s("sign-in-dialog",{attrs:{value:!0},on:{input:function(e){t.$nextTick((function(){return t.showContacts=!!t.isSignedIn}))}},scopedSlots:t._u([{key:"title",fn:function(){return[t._v("Ellacard contacts")]},proxy:!0},{key:"subtitle",fn:function(){return[t._v("Sign in to access / import your contacts")]},proxy:!0}],null,!1,1299667221)})]:t._e(),s("div",{staticClass:"flex-shrink-0 focus-btn-container",class:{fixed:t.fixed,focus:t.focus}},[s("v-btn",{staticClass:"btn-tooltip left persistent px-2",attrs:{hover:"",icon:"",dark:"",tabindex:"-1"},on:{click:function(e){t.showContacts=!0}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiCardAccountPhone)}})],1)],1)],s("v-text-field",{ref:"input",staticClass:"email-phone-field white inline-error",attrs:{type:"text",outlined:"",flat:"",dense:"",autocomplete:"do-not-autocomplete",placeholder:t.hidePlaceholder?"":"Email address"+(t.emailOnly?"":" / phone number"),"persistent-placeholder":t.persistentPlaceholder,hint:t.status,"persistent-hint":!!t.status,label:t.label,readonly:t.readonly,disabled:t.disabled,rules:t.disabled?[]:[function(e){return!t.e164||t.e164.startsWith("+1")||"US / CA phone numbers only"},function(e){return!t.required||!!t.target},function(e){return!t.counts||(t.counts[t.e164||t.staged.toLowerCase()]||0)<=1||"Duplicate"}].concat(t.rules),"append-icon":t.isValidEmail&&t.mdiAt||t.isValidPhone&&t.mdiMessage||null},on:{paste:t.onPaste,focus:function(e){return t.$emit("focus",e)},blur:function(e){t.isValidPhone&&(t.staged=t.$options.filters["email-phone"](t.e164)),t.$emit("blur",e)},keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:function(e){return t.$emit("enter",e)}.apply(null,arguments)}},model:{value:t.staged,callback:function(e){t.staged=e},expression:"staged"}})],2)},i=[],n=(s(64043),s(7409),s(57267),s(59573)),r=s(25194),o=s(86345),l=s(9452),d=s(3098);const c={name:"email-phone-field",components:{ContactsDialog:n["default"],SignInDialog:r["default"]},props:{value:String,counts:Object,hideContacts:Boolean,hidePlaceholder:Boolean,persistentPlaceholder:Boolean,required:Boolean,disabled:Boolean,readonly:Boolean,fixed:Boolean,label:String,status:String,emailOnly:Boolean,rules:{type:Array,default:()=>[]}},data(){return{staged:"",showContacts:!1,focus:!1}},created(){Object.assign(this,{mdiCardAccountPhone:d.IVJ,mdiAt:d.bn2,mdiMessage:d.Np8,mdiHelp:d.HET})},computed:{trimmed(){return(this.staged||"").trim()},isValidEmail(){return o.C.test(this.trimmed)},e164(){return(0,l.I)(this.trimmed)},isValidPhone(){return 12==this.e164.length&&this.e164.startsWith("+1")&&"1"!=this.e164[2]},target(){return this.isValidEmail?this.trimmed:this.isValidPhone?this.e164:""}},methods:{validate(){return this.$refs.input.validate()},async onPaste(){await new Promise((t=>setTimeout(t))),this.staged=(this.staged||"").replace(/[^-+=.~`,()[\]<>;:!@#$%^&*(){}[\]\\|;:'",<>?/\s\w]/g,"").trim()},onFocusOut(){setTimeout((()=>this.focus=!1),200)}},watch:{value:{immediate:!0,handler(t){this.ignore?this.ignore=!1:this.staged=t&&this.$options.filters["email-phone"](t)}},target(t){this.ignore=!0,this.$emit("input",t)}}},u=c;var m=s(1001),p=s(43453),h=s.n(p),v=s(37179),f=s(5057),g=s(75251),y=(0,m.Z)(u,a,i,!1,null,"1a19be92",null);const _=y.exports;h()(y,{VBtn:v.Z,VIcon:f.Z,VTextField:g.Z})},89549:(t,e,s)=>{s.r(e),s.d(e,{default:()=>C});s(43843);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"white py-2 text-body-2",staticStyle:{width:"330px","max-width":"min(100%, 330px)"},on:{click:function(t){t.stopPropagation()}}},[s("error-dialog",{attrs:{status:t.resendStatus}}),"open"==t.action?[s("div",{staticClass:"px-3 py-1 text--label-active"},[t._v("Resend options")]),s("div",[t.order.send_to_self?t._e():s("v-list-item",{staticClass:"mb-1 simple primary--text",attrs:{disabled:t.disabled}
1,on:{click:function(e){t.opt="EC"==t.opt?null:"EC"}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiEmailSync)}}),s("div",{staticClass:"flex-grow-1 flex-shrink-1"},[t._v(" Resend from Ellacard "),s("v-icon",{staticStyle:{color:"inherit"},style:{transform:"EC"==t.opt?null:"rotate(-90deg)"},domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1)],1),s("v-expand-transition",["EC"==t.opt?s("div",{staticClass:"px-2"},[s("email-phone-field",{ref:"email-phone",attrs:{fixed:"",required:"",disabled:t.resendStatus.pending},model:{value:t.staged,callback:function(e){t.staged=e},expression:"staged"}}),s("div",{staticClass:"pl-12"},[t.stagedGroup&&!t.stagedGroupHasTarget?s("div",{staticClass:"text--label-active warning--text mt-1"},[t._v(" This "+t._s(t.staged.includes("@")?"email address":"phone number")+" has already been added to a different "+t._s("INVITATION"==t.order.type?"guest":"recipient")+" ")]):t.stagedHasPreviousError?s("div",{staticClass:"text--label-active warning--text mt-1"},[t._v(" Delivery to this "+t._s(t.staged.includes("@")?"email address":"phone number")+" previously failed â please update it or choose a different method ")]):t._e(),s("div",{staticClass:"py-2 text-right"},[s("v-btn",{attrs:{small:"",color:"primary",disabled:!t.staged||!(!t.stagedGroup||t.stagedGroupHasTarget)||t.stagedHasPreviousError,loading:t.resendStatus.pending},on:{click:function(e){return t.resend(t.staged,!1)}}},[s("v-icon",{staticClass:"mr-1",attrs:{small:""},domProps:{innerHTML:t._s(t.mdiSend)}}),t._v(" Send ")],1)],1)])],1):t._e()])],1),s("div",[s("v-list-item",{staticClass:"mb-1 simple primary--text",attrs:{disabled:t.disabled},on:{click:function(e){t.opt="FW"==t.opt?null:"FW"}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiEmailArrowRight)}}),s("div",{staticClass:"flex-grow-1 flex-shrink-1"},[t._v(" Forward delivery email "),s("v-icon",{staticStyle:{color:"inherit"},style:{transform:"FW"==t.opt?null:"rotate(-90deg)"},domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1)],1),s("v-expand-transition",["FW"==t.opt?s("div",{staticClass:"pl-14 pr-2"},[s("div",{staticClass:"text--label-active mb-1"},[t._v(" We'll send "),s("i",[t._v("you")]),t._v(" ( "),s("i",[t._v(t._s(t.global.profile.email))]),t._v(" ) the delivery email and "),s("i",[t._v("you")]),t._v(" will forward it on to the intended recipient ")]),s("div",{staticClass:"py-2 text-right"},[s("v-btn",{attrs:{small:"",color:"primary",loading:t.resendStatus.pending},on:{click:function(e){return t.resend(t.target,!0)}}},[s("v-icon",{staticClass:"mr-1",attrs:{small:""},domProps:{innerHTML:t._s(t.mdiSend)}}),t._v(" Send ")],1)],1)]):t._e()])],1),s("div",[s("v-list-item",{staticClass:"simple primary--text",attrs:{disabled:t.disabled},on:{click:function(e){t.opt="LI"==t.opt?null:"LI"}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiLinkVariant)}}),s("div",{staticClass:"flex-grow-1 flex-shrink-1"},[t._v(" Share link directly "),s("v-icon",{staticStyle:{color:"inherit"},style:{transform:"LI"==t.opt?null:"rotate(-90deg)"},domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1)],1),s("v-expand-transition",["LI"==t.opt?s("div",{staticClass:"pl-14 pr-2"},[t.order.multiple_recipients?s("div",{staticClass:"text--label-active warning--text my-1"},[t._v(" This is a personalized link intended only for this recipient ")]):t._e(),s("div",{staticClass:"text-body-2 ml-n14 mr-n2"},[s("v-list-item",{staticClass:"pl-13 simple primary--text",on:{click:function(e){t.copyToClipboard(t.url),t.$emit("close")}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClipboardArrowUp)}}),s("div",[t._v("Copy link")])],1),t._l(t.handlers,(function(e){var a=e[0],i=e[1],n=e[2];return s("v-list-item",{key:i,staticClass:"pl-13 simple primary--text",attrs:{_target:"blank",href:n},on:{click:function(e){return t.$emit("close")}}},[s("v-icon",{domProps:{innerHTML:t._s(a)}}),s("div",[t._v(t._s(i))])],1)}))],2)]):t._e()])],1)]:[s("div",{staticClass:"px-3 py-1 text--label-active"},[t._v("Share group signing link directly")]),s("div",{staticClass:"text-body-2"},[s("v-list-item",{staticClass:"simple primary--text",attrs:{disabled:t.disabled},on:{click:function(e){return t.copyToClipboard(t.url)}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClipboardArrowUp)}}),s("div",[t._v("Copy link")])],1),t._l(t.handlers,(function(e){var a=e[0],i=e[1],n=e[2];return s("v-list-item",{key:i,staticClass:"simple primary--text",attrs:{_target:"blank",href:n}},[s("v-icon",{domProps:{innerHTML:t._s(a)}}
1),s("div",[t._v(t._s(i))])],1)}))],2)]],2)},i=[],n=(s(76265),s(64043),s(57267),s(56532),s(18671)),r=s(91809),o=s(92626),l=s(21111),d=s(3098);const c={name:"resend-options",components:{EmailPhoneField:n["default"]},props:["orderId","order","deliveriesByTarget","to","target","action","token","dirty","disabled"],data(){return{opt:null,staged:this.target,showEdit:!1,resendStatus:this.$track("resend")}},computed:{stagedLower(){return(this.staged||"").toLowerCase()},stagedGroup(){return this.staged?this.order.info.recipient_groups.find((t=>t.targets.find((t=>t.toLowerCase()==this.stagedLower)))):null},stagedGroupHasTarget(){const t=this.target.toLowerCase();return!(!this.stagedGroup||!this.stagedGroup.targets.find((e=>e.toLowerCase()==t)))},stagedHasPreviousError(){return(this.deliveriesByTarget[this.stagedLower]||[]).some((t=>t.error))},targets(){return new Set(_.flatten(this.order.info.recipient_groups.map((t=>t.targets))).map((t=>t.toLowerCase())))},counts(){const t={};for(const e of this.order.info.recipient_groups)for(const s of e.targets||[]){if(!s)continue;const e=s.toLowerCase();t[e]||(t[e]=0),t[e]++}return t},url(){return`https://ellacard.com/${this.action}/${this.token}`},cardTypeInfo(){return(0,r.IR)(this.order)},msg(){let t;return"sign"==this.action?this.globalUserId==this.order.user_id&&this.order.msg?t=this.order.msg.replaceAll("\n"," "):(t=`We're making a group ${this.cardTypeInfo.type}`,!this.order.multiple_recipients&&this.order.info.to&&(t+=" for "+this.order.info.to),this.order.send_started_at?t+=". It has already been sent, so please add to it as soon as possible.":this.order.info.send_at?t+=`. It'll get sent ${(0,l.WU)(this.order.info.send_at,"relative",o.TZ,"en-US")}, so please add to it before then.`:t+=". Please add to it."):t=`Open this ${this.cardTypeInfo.type} on Ellacard:`,t+" "+this.url},handlers(){let t;"sign"==this.action?(t=`Please add to this group ${this.cardTypeInfo.type}`,this.order.info.to&&(t+=` for ${this.order.info.to}`)):t=this.order.skin.email_subject||this.cardTypeInfo.emailSubject;const e={email:"",phone:""};this.target&&(e[this.target.includes("@")?"email":"phone"]=this.target);for(const[a,i]of Object.entries(this.deliveriesByTarget)){const t=a.includes("@")?"email":"phone";!e[t]&&i.every((t=>!t.error))&&(e[t]=a)}const s=encodeURIComponent(this.msg);return[[d.bn2,"Send as email",`mailto:${e.email}?subject=${encodeURIComponent(t)}&body=${s}`],[d.Np8,"Send as text message",`sms:${e.phone}?&body=${s}`]]}},created(){Object.assign(this,{mdiEmailSync:d.M_O,mdiPencil:d.r9,mdiEmailArrowRight:d.zSR,mdiLinkVariant:d.$jG,mdiSend:d.NN1,mdiMenuDown:d.iW9,mdiClipboardArrowUp:d.PZJ,mdiAt:d.bn2,mdiMessage:d.Np8})},methods:{async resend(t,e){try{const s=this.deliveriesByTarget[t.toLowerCase()];if(s)await this.$call("resend-delivery",{delivery_id:s.last.id,send_to_self:e}),e||this.$emit("load-deliveries");else{if(this.dirty){const e=t.includes("@")?"email address":"phone number";return void this.$confirm({title:"Unsaved changes",msg:`Please save or discard your other changes before attempting to resend to a new ${e}.`,buttons:["Ok"],primary:"Ok"})}{const e={to:this.to||"",[t.includes("@")?"email":"phone"]:t};await this.$call("resend-to-new-recipient",{order_id:this.orderId,recipient:e,resend_target:this.target||void 0}),this.$emit("add-target",t)}}this.$notify((e||t.includes("@")?"Email":"Text message")+" sent"),this.$emit("close")}catch(s){if("ClientException"==s.type){const t=(t,e)=>{throw new VisibleError(t+(e?" â please try a different method":""))};switch(s.message){case"RESENDS_EXCEEDED_DELIVERY":t("You've exceed the allowed number of resends for this delivery",!0);case"RESENDS_EXCEEDED_ORDER":t("You've exceed the allowed number of resends with new / corrected contact info",!0);case"UNSUBSCRIBED":t("This person has <i>unsubscribed</i> from your messages sent via Ellacard",!0);case"ACCOUNT_LOCKED":t('Your account is locked â please contact Ellacard support: <a href="mailto:[email protected]">[email protected]</a>',!1)}}throw s}}},watch:{async opt(t){await this.$nextTick(),"EC"==t&&(!this.staged||this.stagedGroup&&!this.stagedGroupHasTarget||this.stagedHasPreviousError)&&this.$refs["email-phone"].$el.querySelector("input").focus()}}},u=c;var m=s(1001),p=s(43453),h=s.n(p),v=s(37179),f=s(83422),g=s(5057),y=s(61908),b=(0,m.Z)(u,a,i,!1,null,null,null);const C=b.exports;h()(b,{VBtn:v.Z,VExpandTransition:f.Fx,VIcon:g.Z,VListItem:y.Z})},36366:(t,e,s)=>{s.r(e),s.d(e,{default:()=>I});s(43843);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("span",[t.warnDelivery?s("dialog-scroll-lock",{attrs:{width:"300",persistent:""},model:{value:t.activeWarn,callback:function(e){t.activeWarn=e},expression:"activeWarn"}},[s("v-card",[s("v-card-title",[t._v("Are you sure?")]),s("v-card-text",[t._v(" The "),s("i",[t._v("delivery link")]),t._v(" is for sharing the "+t._s(t.cardTypeInfo.deliveryDisambiguation)+" with its final addressed recipient, but no one else has added to this group "+t._s(t.cardTypeInfo.type)+" yet. ")]),!t.order.lock&&t.order.method_contributors.includes("link")?[s("v-card-text",[s("div",{staticClass:"mb-2"},[t._v("Did you mean to share the "),s("i",[t._v("group-signing")]),t._v(" link instead?")]),s("share-card-btn",{attrs:{action:"sign",order:t.order,token:t.orderId},on:{share:function(e,s,a){return t.$emit("share","sign",s,a)}},scopedSlots:t._u([{key:"default",fn:function(e){return[s("v-btn",t._g(t._b({attrs:{small:""}},"v-btn",e.attrs,!1),e.on),[s("v-icon",{staticClass:"mr-1",attrs:{small:""},domProps:{innerHTML:t._s(t.mdiLinkVariant)}}),t._v(" Share group signing link "),s("v-icon",{staticClass:"menu-down mr-n1",domProps:{innerHTML:t._s(t.mdiMenuDown)}}
1)],1)]}}],null,!1,4205692446)})],1)]:t._e(),s("v-card-actions",{staticClass:"justify-end"},[s("v-btn",{attrs:{text:""},on:{click:function(e){t.activeWarn=!1}}},[t._v("Cancel")]),s("v-btn",{attrs:{text:"",color:"primary"},on:{click:function(e){t.ack=!0,t.activeWarn=!1,t.activeMenu=!0}}},[t._v("Continue")])],1)],2)],1):t._e(),s("v-menu",t._b({attrs:{"content-class":"overflow-visible contain-none",bottom:"","offset-y":"",width:"300","max-width":"300","nudge-bottom":"4"},scopedSlots:t._u([{key:"activator",fn:function(e){var s=e.on,a=e.attrs;return[t._t("default",null,null,{on:s,attrs:Object.assign({},a,{disabled:"CANCELLED"==t.order.state})})]}}],null,!0),model:{value:t.activeMenu,callback:function(e){t.activeMenu=e},expression:"activeMenu"}},"v-menu",t.$attrs,!1),[s("v-list",{staticClass:"pt-0",staticStyle:{"border-radius":"4px",width:"100%"},attrs:{dense:""}},["open"==t.action?[s("div",{staticClass:"relative",staticStyle:{"aspect-ratio":"16 / 9","background-size":"cover","border-radius":"4px 4px 0 0"},style:{"background-color":t.order.skin.page_background_color,"background-image":t.img?`url('${t.img}')`:null},on:{click:function(t){t.stopPropagation()}}},[s("v-card",{staticClass:"absolute",staticStyle:{"z-index":"1",left:"17.1875%",top:"8.3333%",width:"65.625%"},attrs:{tile:""}},[s("div",{staticClass:"relative",staticStyle:{"aspect-ratio":"7 / 5"}},[s("envelope",{ref:"env",staticStyle:{position:"absolute",inset:"-20% 0 -20% 0"},attrs:{"allow-empty":"",skin:t.order.skin,from:t.order.info.from,to:(t.lastEnv?t.lastEnv.to:t.order.info.to)||"","edit-to":t.editTo&&!t.disabled,"show-text-edit-reset":{to:t.order.info.to||""}},on:{"update:to":function(e){return t.lastEnv={to:e}},"close:selected":function(){t.setAsDefault&&(t.order.info.to=t.lastEnv.to||"")}},scopedSlots:t._u([{key:"edit-blob-label",fn:function(e){var a=e.dark;return[s("v-checkbox",{staticClass:"pt-0 mt-0",attrs:{"hide-details":"",label:"Set as default",dark:a,disabled:!t.lastEnv||t.lastEnv.to==t.order.info.to,"input-value":t.setAsDefault},on:{change:function(e){return t.setAsDefault=e}}})]}}],null,!1,1184527601)})],1)])],1),s("v-divider",{staticClass:"mb-2"})]:t._e(),"PENDING"==t.order.state||t.editTo?["PENDING"==t.order.state?s("v-list-item",{staticClass:"simple"},[s("v-icon",{attrs:{color:"warning"},domProps:{innerHTML:t._s(t.mdiAlert)}}),s("div",{staticClass:"flex-shrink-1 text--label-active font-italic warning--text",staticStyle:{"white-space":"normal"}},[t._v("This link is only available after checkout")])],1):t._e(),t.editTo?s("v-list-item",{staticClass:"simple",class:{"primary--text":!t.disabled},attrs:{disabled:t.disabled},on:{click:function(e){return e.stopPropagation(),t.showEditTo.apply(null,arguments)}}},[s("v-icon",{domProps:{innerHTML:t._s(t.iconPathEnvTo)}}),s("v-list-item-title",{staticStyle:{"white-space":"normal"}},[t._v("Address envelope for this linkâ¦")])],1):t._e(),s("v-divider",{staticClass:"my-2"})]:t._e(),s("v-list-item",{staticClass:"simple",class:{"primary--text":!t.disabled},attrs:{disabled:t.disabled},on:{click:function(e){t.copyToClipboard(t.url),t.onShare("copy",t.url)}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClipboardArrowUp)}}),s("v-list-item-title",[t._v("Copy link")])],1),t._l(t.handlers,(function(e){var a=e[0],i=e[1],n=e[2];return s("v-list-item",{directives:[{name:"href-fallback",rawName:"v-href-fallback"}],key:i,staticClass:"simple",class:{"primary--text":!t.disabled},attrs:{target:"_blank",href:n,disabled:t.disabled},on:{click:function(e){return t.onShare(i,n)}}},[s("v-icon",{domProps:{innerHTML:t._s(a)}}),s("v-list-item-title",{domProps:{innerHTML:t._s(i)}})],1)})),t.hideSocial?t._e():[s("v-divider",{staticClass:"my-2"}),s("div",{staticClass:"px-1"},t._l(t.external,(function(e){var a=e[0],i=e[1],n=e[2],r=e[3];return s("v-btn",{key:n,staticClass:"ma-1",style:{color:a},attrs:{large:"",icon:"",target:"_blank",href:r,disabled:t.disabled},on:{click:function(e){return t.onShare(n,r)}}},[s("v-icon",{attrs:{large:""},domProps:{innerHTML:t._s(i)}}),s("span",{staticClass:"btn-tooltip bottom"},[t._v(t._s(n))])],1)})),1)]],2)],1)],1)},i=[],n=(s(64043),s(57267),s(56532),s(2918),s(11219)),r=s(91809),o=s(9262
16),l=s(21111);const d="M 2 4 L 19 4 C 20.05 4 21 4.95 21 6 L 21 18 C 21 19.05 20.05 20 19 20 L 2 20 C 0.95 20 0 19.05 0 18 L 0 6 C 0 4.95 0.95 4 2 4 Z M 7 10 L 7 11 L 14 11 L 14 10 Z M 7 12 L 7 13 L 12 13 L 12 12 Z";var c=s(35987),u=s(3098);const m={name:"share-card-btn",props:{action:String,token:String,query:Object,order:Object,orderId:String,warnDelivery:Boolean,hideSocial:Boolean},components:{Envelope:n["default"]},data(){return{activeWarn:!1,activeMenu:!1,ack:!1,lastEnv:null,setAsDefault:!1}},computed:{disabled(){return"COMPLETED"!=this.order.state},editTo(){return"open"==this.action&&this.order.multiple_recipients&&this.token==this.order.read_token},url(){let t=`https://ellacard.com/${this.action}/${this.token}`;return this.editTo&&(t+="?to="+encodeURIComponent((this.lastEnv?this.lastEnv.to:this.order.info.to)||"")),t},cardTypeInfo(){return(0,r.IR)(this.order)},msg(){let t;return"sign"==this.action?this.globalUserId==this.order.user_id&&this.order.msg?t=this.order.msg.replaceAll("\n"," "):(t=`We're making a group ${this.cardTypeInfo.type}`,!this.order.multiple_recipients&&this.order.info.to&&(t+=" for "+this.order.info.to),this.order.send_started_at?t+=". It has already been sent, so please add to it as soon as possible.":this.order.info.send_at?t+=`. It'll get sent ${(0,l.WU)(this.order.info.send_at,"relative",o.TZ,"en-US")}, so please add to it before then.`:t+=". Please add to it."):t=`Open this ${this.cardTypeInfo.type} on Ellacard:`,t+" "+this.url},handlers(){const t=encodeURIComponent(this.msg);let e;return"sign"==this.action?(e=`Please add to this group ${this.cardTypeInfo.type}`,this.order.info.to&&(e+=` for ${this.order.info.to}`)):e=this.order.skin.email_subject||this.cardTypeInfo.emailSubject,[[u.bn2,"Send as email",`mailto:?subject=${encodeURIComponent(e)}&body=${t}`],[u.Np8,"Send as text message",`sms:?&body=${t}`]]},external(){const{action:t,order:e}=this,s=this.cardTypeInfo.type;let a,i;"PERSONAL"==e.type?(a=s[0].toUpperCase()+s.slice(1),i=`Open this ${s} on Ellacard`):"GROUP"==e.type?(a=`Group ${s}`,i=`${"sign"==t?"Add to":"Open"} this group ${s} on Ellacard`):"INVITATION"==e.type&&(a=e.event.name||"Invitation",i="Open this invitation on Ellacard");const n=encodeURIComponent(this.url);return[["#1877f2",u.JPJ,"Facebook",`https://www.facebook.com/sharer.php?u=${n}&title=${a}&description=${i}&hashtag=%23Ellacard`],["#007bb5",u.rbi,"LinkedIn",`https://linkedin.com/sharing/share-offsite/?url=${n}`],["#ff4500",u.J1f,"Reddit",`https://reddit.com/submit?url=${n}&title=${a}`],["#000",c.Z,"X",`https://x.com/intent/tweet?url=${n}&text=${i}&hashtags=Ellacard`]]},img(){const t=this.order.skin.page_background_img;return(t||"").endsWith(".mp4")?t.slice(0,-4)+".poster.jpg":t}},created(){Object.assign(this,{iconPathEnvTo:d,mdiClipboardArrowUp:u.PZJ,mdiAlert:u.jZI,mdiLinkVariant:u.$jG,mdiMenuDown:u.iW9})},methods:{showEditTo(){const t=this.$refs.env;t.selected=t.blobTo,this.$nextTick((()=>t.$refs.blob.focus()))},onShare(t,e){$event.log(`share-${this.action}-link`,{token:this.token,method:t,url:e}),this.$emit("share",this.action,t,e)}},watch:{async activeMenu(t){t&&this.warnDelivery&&!this.ack?(await this.$nextTick(),this.activeMenu=!1,this.activeWarn=!0):this.ack=!1}}},p=m;var h=s(1001),v=s(43453),f=s.n(v),g=s(37179),y=s(73385),_=s(75223),b=s(46072),C=s(84192),k=s(5057),w=s(70248),x=s(61908),S=s(64831),$=s(60092),P=(0,h.Z)(p,a,i,!1,null,null,null);const I=P.exports;f()(P,{VBtn:g.Z,VCard:y.Z,VCardActions:_.h7,VCardText:_.ZB,VCardTitle:_.EB,VCheckbox:b.Z,VDivider:C.Z,VIcon:k.Z,VList:w.Z,VListItem:x.Z,VListItemTitle:S.V9,VMenu:$.Z})},97130:(t,e,s)=>{s.r(e),s.d(e,{default:()=>U});s(64043),s(61514);var a=function(){var t,e=this,s=e.$createElement,a=e._self._c||s;return a("div",{staticClass:"d-flex"},[a("error-dialog",{attrs:{status:e.handleSpreadsheetUploadStatus}}),a("error-dialog",{attrs:{status:e.importContactsFromGoogleStatus}}),a("error-dialog",{attrs:{status:e.downloadStatus}}),a("error-dialog",{attrs:{status:e.deleteContactsStatus}}),a("error-dialog",{attrs:{status:e.readSpreadsheetStatus}}),a("error-dialog",{attrs:{status:e.createGroupStatus}}),a("error-dialog",{attrs:{status:e.deleteGroupStatus}}
1),a("error-dialog",{attrs:{status:e.readSpreadsheetStatus}}),a("input",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],ref:"file-upload",attrs:{type:"file",accept:".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"},on:{change:e.handleSpreadsheetUpload}}),e.editGroup?a("contact-group-dialog",{attrs:{group:e.editGroup,"delete-group-status":e.deleteGroupStatus},on:{delete:e.deleteGroup,close:function(t){e.editGroup=null,t&&e.$refs.table.reload()}}}):e._e(),e.showImport?a("dialog-scroll-lock",{attrs:{width:"500"},model:{value:e.showImport,callback:function(t){e.showImport=t},expression:"showImport"}},[a("v-card",[a("v-btn",{staticClass:"ma-3",staticStyle:{"z-index":"1",top:"0",right:"0"},attrs:{absolute:"",icon:""},on:{click:function(t){e.showImport=!1}}},[a("v-icon",{domProps:{innerHTML:e._s(e.mdiClose)}})],1),a("v-card-title",[e._v("Import from spreadsheet")]),a("v-card-subtitle",[e._v("csv, xls, xlsx")]),a("v-card-text",[a("ul",[a("li",[e._v("At least one of "),a("code",[e._v("email")]),e._v(" or "),a("code",[e._v("phone")]),e._v(" is required (must be unique across all contacts, US phone numbers only)")]),a("li",[e._v("Custom columns / fields are allowed, dates are automatically detected")])]),a("table",{staticClass:"mt-6 spreadsheet-example"},[a("tr",[a("th",[e._v("name")]),a("th",[e._v("email")]),a("th",[e._v("phone")]),a("th",{staticClass:"grey--text"},[e._v("birthday")])]),e._l(e.EXAMPLE_ROWS,(function(t){return a("tr",e._l(t,(function(t){return a("td",{domProps:{textContent:e._s(t)}})})),0)}))],2),a("v-btn",{staticClass:"my-3",attrs:{small:""},on:{click:e.downloadExample}},[a("v-icon",{staticClass:"mr-2",attrs:{small:""},domProps:{innerHTML:e._s(e.mdiDownload)}}),e._v(" Download template ")],1)],1),a("v-card-actions",{staticClass:"justify-end"},[a("v-btn",{attrs:{color:"primary",loading:e.handleSpreadsheetUploadStatus.pending},on:{click:function(t){return e.$refs["file-upload"].click()}}},[a("v-icon",{staticClass:"mr-2",domProps:{innerHTML:e._s(e.mdiUpload)}}),e._v(" Upload⦠")],1)],1)],1)],1):e._e(),e.$vuetify.breakpoint.smAndUp||e.showGroups?a("div",{style:{width:e.$vuetify.breakpoint.smAndUp?"300px":"100%","max-width":e.$vuetify.breakpoint.smAndUp?"300px":null}},[a("div",{staticClass:"ma-2 d-flex align-center"},[a("div",{staticClass:"flex-grow-1 overline"},[e._v("Contact groups")]),e.groups.length>1?a("v-menu",{attrs:{bottom:"","offset-y":"","max-width":"300"},scopedSlots:e._u([{key:"activator",fn:function(t){var s=t.on,i=t.attrs;return[a("v-btn",e._g(e._b({directives:[{name:"blur",rawName:"v-blur"}],attrs:{icon:""}},"v-btn",i,!1),s),[a("v-icon",{domProps:{innerHTML:e._s({name:[e.mdiSortAlphabeticalAscending,e.mdiSortAlphabeticalDescending],"date added":[e.mdiSortClockAscending,e.mdiSortClockDescending]}[e.sortGroups][Number(e.sortGroupsDescending)])}})],1)]}}],null,!1,1176228238)},[a("v-list",{staticClass:"text--label-active",attrs:{dense:""}},e._l([["name",e.mdiSortAlphabeticalAscending,e.mdiSortAlphabeticalDescending],["date added",e.mdiSortClockAscending,e.mdiSortClockDescending]],(function(t){var s=t[0],i=t[1],n=t[2];return a("v-list-item",{key:s,staticClass:"simple py-1",attrs:{"input-value":e.sortGroups==s},on:{click:function(t){e.sortGroups=s}}},[a("div",{staticClass:"flex-grow-1"},[e._v("By "+e._s(s))]),a("div",{staticClass:"flex-grow-0",staticStyle:{"white-space":"nowrap"}},[a("v-btn",{attrs:{icon:"",color:e.sortGroups!=s||e.sortGroupsDescending?null:"primary"},on:{click:function(t){e.sortGroupsDescending=!1}}},[a("v-icon",{domProps:{innerHTML:e._s(i)}})],1),a("v-btn",{attrs:{icon:"",color:e.sortGroups==s&&e.sortGroupsDescending?"primary":null},on:{click:function(t){e.sortGroupsDescending=!0}}},[a("v-icon",{domProps:{innerHTML:e._s(n)}})],1)],1)])})),1)],1):e._e(),a("v-btn",{attrs:{icon:"",loading:e.createGroupStatus.pending},on:{click:e.createGroup}},[a("v-icon",{domProps:{innerHTML:e._s(e.mdiPlus)}}),a("div",{staticClass:"btn-tooltip bottom left"},[e._v("Add contact group")])],1)],1),a("v-list",{staticClass:"pt-0",attrs:{dense:""}},e._l([{name:"All contacts",id:null}].concat(e.sortedGroups),(function(t){return a("v-list-item",{key:t.id,attrs:{loading:!0,"input-value":t.id==e.search.groups[0]||null},on:{click:function(){return e.search=Object.assign({},e.search,{groups:t.id?[t.id]:[]})}}},[a("v-list-item-content",[a("v-list-item-title",{domProps:{textContent:e._s(t.name)}}),t.id?a("v-list-item-subtitle",[e._v(e._s(e._f("moment")(t.created)))]):e._e(
1)],1),a("v-list-item-action",{staticClass:"hidden-sm-and-up"},[e.isLoading&&t.id==e.search.groups[0]?a("v-progress-circular",{attrs:{indeterminate:"",size:"24",width:"2"}}):a("v-icon",{domProps:{innerHTML:e._s(e.mdiChevronRight)}})],1)],1)})),1)],1):e._e(),a("v-divider",{staticClass:"hidden-xs-only mr-2",attrs:{vertical:""}}),a("div",{directives:[{name:"show",rawName:"v-show",value:e.$vuetify.breakpoint.smAndUp||!e.showGroups,expression:"$vuetify.breakpoint.smAndUp || !showGroups"}],staticClass:"flex-grow-1"},[a("div",{staticClass:"ma-2 d-flex align-center"},[a("v-btn",{staticClass:"hidden-sm-and-up pl-1 ml-1 mr-2",attrs:{small:"",text:"",color:"primary"},on:{click:function(t){e.showGroups=!0}}},[a("v-icon",{staticClass:"mr-2",domProps:{innerHTML:e._s(e.mdiChevronLeft)}}),e._v(" Groups ")],1),a("div",{staticClass:"flex-grow-1 overline short"},[e._v(e._s((null===(t=e.groups.find((function(t){return t.id==e.search.groups[0]})))||void 0===t?void 0:t.name)||"All contacts"))]),a("div",{staticStyle:{"white-space":"nowrap"}},[a("v-menu",{attrs:{bottom:"","offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){var s=t.on,i=t.attrs;return[a("v-btn",e._g(e._b({directives:[{name:"blur",rawName:"v-blur"}],attrs:{icon:"",loading:e.importContactsFromGoogleStatus.pending||e.handleSpreadsheetUploadStatus.pending}},"v-btn",i,!1),s),[a("v-icon",{domProps:{innerHTML:e._s(e.mdiAccountPlus)}}),a("div",{staticClass:"btn-tooltip bottom left"},[e._v("Add / import contacts")])],1)]}}])},[a("v-list",{attrs:{dense:""}},[a("v-list-item",{on:{click:function(t){e.$refs.table.selected={contact:{groups:e.editGroup?[e.editGroup.id]:[]}}}}},[a("v-list-item-icon",[a("v-icon",{domProps:{innerHTML:e._s(e.mdiAccountPlus)}})],1),a("v-list-item-title",[e._v("Add new contactâ¦")])],1),a("v-list-item",{on:{click:function(t){e.showImport=!0}}},[a("v-list-item-icon",[a("v-icon",{domProps:{innerHTML:e._s(e.mdiUpload)}})],1),a("v-list-item-title",[e._v("Upload spreadsheetâ¦")])],1),a("v-list-item",{on:{click:e.importContactsFromGoogle}},[a("v-list-item-icon",[a("v-icon",{domProps:{innerHTML:e._s(e.mdiGoogle)}})],1),a("v-list-item-title",[e._v("Import from Googleâ¦")])],1)],1)],1),a("v-expand-x-transition",[e.search.groups.length?a("v-btn",{directives:[{name:"blur",rawName:"v-blur"}],attrs:{icon:""},on:{click:function(t){e.editGroup=e.groups.find((function(t){return t.id==e.search.groups[0]}))}}},[a("v-icon",{domProps:{innerHTML:e._s(e.mdiPencil)}}),a("div",{staticClass:"btn-tooltip bottom left"},[e._v("Edit group")])],1):e._e()],1),a("v-btn",{directives:[{name:"blur",rawName:"v-blur"}],attrs:{icon:"",disabled:!e.nContacts,loading:e.downloadStatus.pending},on:{click:e.download}},[a("v-icon",{domProps:{innerHTML:e._s(e.mdiDownload)}}),a("div",{staticClass:"btn-tooltip bottom left"},[e._v("Download "+e._s(e.search.groups.length?"group":"all contacts"))])],1)],1)],1),a("div",{staticClass:"d-flex flex-wrap justify-end"},[a("contacts-search",{ref:"search",attrs:{"content-class":"ma-2 match-btn-height","hide-groups":!0,disabled:e.isLoading,types:e.types},on:{search:function(t){return e.search=t}}})],1),a("contacts-table",{ref:"table",attrs:{search:e.search,types:e.types,loading:e.isLoading,n:e.nContacts},on:{"update:types":function(t){e.types=t},"update:loading":function(t){e.isLoading=t},"update:n":function(t){e.nContacts=t},create:e.onCreate}}),!e.isLoading&&e.nContacts?a("div",{staticClass:"mt-12 text-right"},[a("v-btn",{attrs:{icon:"",loading:e.deleteContactsStatus.pending},on:{click:e.deleteContacts}},[a("v-icon",{domProps:{innerHTML:e._s(e.mdiDeleteSweep)}}),a("div",{staticClass:"btn-tooltip left"},[e._v("Delete "+e._s(1==e.nContacts?"this contact":"these contacts")+"â¦")])],1)],1):e._e()],1)],1)},i=[],n=s(86080),r=(s(57267),s(7409),s(76265),s(65137),s(43843),s(32320),s(268),s(21057),s(2918),s(85415),s(22462),s(70560),s(70163)),o=s(5690),l=s(69166),d=s(45835),c=s(83524),u=s(86345),m=s(57753),p=s(3098);const h={january:31,february:29,march:31,april:30,may:31,june:30,july:31,august:31,september:30,october:31,november:30,december:31},v=[31,29,31,30,31,30,31,31,30,31,30,31],f=[["Alex","[email protected]","","04-12"],["Kelly","","555-123-4567","April 12th"],["Mark","[email protected]","555-234-5678","5 JUN"]],g={name:"account-contacts",routerViewMeta:{title:"Contacts",description:"Manage your Ellacard contacts"},mixins:[d.Z],components:{ContactGroupDialog:r["default"],ContactsSearch:o["default"],ContactsTable:l["default"]},data(){return{isLoading:!1,showGroups:!1,editGroup:null,groups:[],search:{groups:[],mode:"AND",filters:[]},showImport:!1,searchFields:[{key:"first",type:"text",value:""},{key:"last",type:"text",value:""},{key:"email",type:"text",value:""},{key:"phone",type:"phone number",value:""},{key:"birthday",type:"date",value:""}],types:{},nContacts:0,showSpreadsheetOptions:[],sortGroups:"date added",sortGroupsDescending:!0,handleSpreadsheetUploadStatus:this.$track("handleSpreadsheetUpload"),importContactsFromGoogleStatus:this.$track("importContactsFromGoogle"),downloadStatus:this.$track("download"),deleteContactsStatus:this.$track("deleteContacts"),createGroupStatus:this.$track("createGroup"),deleteGroupStatus:this.$track("deleteGroup")}},computed:{searchAdvancedFilters(){return this.searchFields.map((t=>{const e=t.value||"";switch(t.type){case"text":return e?[t.key,e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")]:null;case"date":if(!e)return null;const s=e.split("-");for(let t=0;t<s;t++)/^0+$/.test(s[t])&&(s[t]=s[t].replace("0","\\d"));return[t.key,"^"+s.join("-")+"$"];case"phone number":return e?[t.key,e]:null;case"is set":return[t.key,"."];case"regular expression":return e?[t.key,e]:null}})).filter((t=>t))},sortedGroups(){const t=_.sortBy(this.groups,"name"==this.sortGroups?"name":"created");return this.sortGroupsDescending&&t.reverse(),t}},created(){Object.assign(this,{EXAMPLE_ROWS:f,mdiClose:p.r5M,mdiAccountMultiplePlus:p.kcu,mdiAccountPlus:p.psO,mdiDownload:p.OGU,mdiUpload:p.xyB,mdiCardAccountMail:p.rKd,mdiGoogle:p._5o,mdiFacebook:p.JPJ,mdiMenuDown:p.iW9,mdiPlus:p.q
1X5,mdiMagnify:p.I0v,mdiAccountGroup:p.L_H,mdiChevronLeft:p.gAv,mdiDelete:p.x9U,mdiPencil:p.r9,mdiImport:p.A6b,mdiChevronRight:p.zrb,mdiTableLarge:p.bgG,mdiSortAlphabeticalAscending:p.L0I,mdiSortAlphabeticalDescending:p.P18,mdiSortClockAscending:p.qFV,mdiSortClockDescending:p.jC$,mdiDeleteSweep:p.MNB})},methods:{async loadGroups(){const t=await this.$call("list-contact-groups");this.groups=t.map((([t,{name:e,created:s}])=>({id:t,name:e,created:s}))),this.groups.sort(((t,e)=>t.name.localeCompare(e.name)))},async handleSpreadsheetUpload(t){try{await this.handleSpreadsheetUploadKernel(t)}catch(t){if(t instanceof VisibleError)throw t;throw console.error(t),new VisibleError('We could not automatically extract contacts from this file. Please check that the spreadsheet contains a header row and does not contain any extraneous rows / values. Please contact <a href="mailto:[email protected]">[email protected]</a> and attach the spreadsheet if you can\'t resolve this issue.')}},async handleSpreadsheetUploadKernel(t){const e=t.target.files[0];if(this.$refs["file-upload"].value=null,e.size/1024/1024>100)throw new VisibleError("File is too large (100 MB limit)");const s=await this.readSpreadsheet(e,{headersCaseSensitive:!1,headerWarnings:[t=>t.includes("name")||"Missing <code>name</code> header"],headerErrors:[t=>t.includes("email")||t.includes("phone")||"Must contain at least an <code>email</code> or <code>phone</code> header"],preParse:async(t,e)=>{let s;for(const a of e)for(const t of Object.values(a)){const e=/^(\d\d?)(\D+)(\d\d?)(\D+(\d\d(\d\d)?))?$/.exec((t||"").trim());if(e){if(parseInt(e[1])>12)return void(this.monthFirst=!1);if(parseInt(e[3])>12)return void(this.monthFirst=!0);s=e[2]}}if(s){const t=["mm"+s+"dd","dd"+s+"mm"],e=await this.$confirm({title:"Ambiguous dates detected",msg:`Did you specify your dates as <i>${t[0]}</i> or <i>${t[1]}</i>?`,buttons:t,primary:t[0]});this.monthFirst=e==t[0]}},parse:t=>{if(!t)return t;let e,s,a,i;if(e=/^(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t))i=parseInt(e[1]),s=parseInt(e[2]),a=parseInt(e[3]);else if(e=/^(\d\d?)\D+(\d\d?)(\D+(\d\d(\d\d)?))?$/.exec(t)){i=void 0==e[4]?-1:e[4],i=e[4]?2==e[4].length?(parseInt(e[4])>50?1900:2e3)+parseInt(e[4]):parseInt(e[4]):-1;const t=[parseInt(e[1]),parseInt(e[2])];this.monthFirst?[s,a]=t:[a,s]=t}else(e=/^([a-z]+)\W+(\d+)[stndrh]?[stndrh]?(\D+(\d\d\d\d))?$/i.exec(t))?(s=Object.keys(h).findIndex((t=>t.startsWith(e[1].toLowerCase())))+1,i=void 0==e[4]?-1:parseInt(e[4]),a=parseInt(e[2])):(e=/^(\d+)[a-z]*\W+([a-z]+)(\D+(\d\d\d\d))?$/i.exec(t))&&(i=void 0==e[4]?-1:parseInt(e[4]),s=Object.keys(h).findIndex((t=>t.startsWith(e[2].toLowerCase())))+1,a=parseInt(e[1]));return!s||s<1||s>12||!a||a<1||a>v[s-1]?t:`${-1==i?"0000":String(i).padStart(4,"0")}-${String(s).padStart(2,"0")}-${String(a).padStart(2,"0")}`},parsers:{email:t=>{if(!t||u.C.test(t))return t;throw new Error("Invalid email address")},phone:t=>{if(!t)return t;const e=t.replace(/\D/g,"");if(11==e.length&&e.startsWith("1")||10==e.length)return"+1"+e.slice(-10);throw new Error("invalid US phone number")}}});if(!s)return;let{headers:a,items:i}=s;for(const l of i){var n,r;null!==(n=l.email)&&void 0!==n&&n.endsWith("@example.com")&&(l.email=""),null!==(r=l.phone)&&void 0!==r&&r.startsWith("+1555")&&(l.phone="")}if(i=i.filter((t=>t.email||t.phone)).map((t=>Object.fromEntries(Object.entries(t).filter((t=>t[1]))))),!i.length)throw new VisibleError("No contacts found");const o=this.search.groups.length&&this.search.groups[0]||null;if(i.length<=500){const{n_created:t,n_skipped:e}=await this.$call("import-contacts",{contacts:i,group:o});this.$confirm({title:"Import complete",msg:`New contacts created: ${t}<br>Number of dupliactes skipped: ${e}`,buttons:["Ok"],primary:"Ok"}),this.$refs.table.reload()}else{const t=t=>t.match(/,|"/)?'"'+t.replace(/"/g,'""')+'"':t,e=[a.map(t).join(",")+"\n"];for(const n of i)e.push(a.map((e=>t(n[e]||""))).join(",")+"\n");const s=new File(e,"contacts.csv",{type:"text/csv"});await this.$call("import-contacts-from-csv-file",{file:s,group:o,notify:!0}),this.$confirm({title:"Import started",msg:"We'll send you an email when we've finished importing your contacts",buttons:["Ok"],primary:"Ok"})}this.showImport=!1,this.loadGroups()},async importContactsFromGoogle(){await(0,m.Z)("https://accounts.google.com/gsi/client");const t=`${{"service-url":"https://service.ellacard.com","google-client-id":"631862768577-4scl851mrknps9077ftq5hnfsivp2pl9","google-analytics-id":"G-89TW4G9JJE","google-ads-id":"AW-603946660","google-ads-conversion-id":"1FC4CKzs1-gBEKT9_Z8C","recaptcha-site-key-v2":"6Lfn0PEaAAAAAE37Uc4qkTBHLdkp7_BMuByo7rjb","recaptcha-site-key-v3":"6LclbM8sAAAAADgIDFUh5nmRKkGLn_H97mtDd4H9","facebook-app-id":"284354916099194","paypal-client-id":"Ab2nDkDzWuCGJ7fDZIFEDPRbqH4sD2H2DQdsHfAlaX8TIA68UAyDOgoXaCs9vj2x7raOZpM5Me1lS8rx","giphy-api-key":"v2l21iqEgG0ZcE1sxlzep7NZSZYjV278","tenor-api-key":"AIzaSyCc4RABQZ2y02LYVZ6MOIJsLiqBwoFA6tI","klipy-api-key":"jN9rDCaw4giLtIrn2RTG3Ug9LKXFTYfXvIvOumB5s7lsPXm4iNNzBeOLqlwf4KKu","stripe-api-key":"pk_live_51JIMfYCbfgqsVjCGrnZuqGPo0SAl9zX9kagpNXQTgTDhoDmIi9ovJGohKODINHY9YqqxGPCBTRRpdAaDN165aH2t00U6FMk3uK",sitemap:!0,"finix-application-id":"AP94oKnk3iB1F8RPvDH9LRGM","finix-env":"sandbox"}["google-client-id"]}.apps.googleusercontent.com`,e="https://www.googleapis.com/auth/contacts.readonly",s=await new Promise((s=>google.accounts.oauth2.initTokenClient({client_id:t,scope:e,callback:s,error_callback:()=>s()}).requestAccessToken())),a=null===s||void 0===s?void 0:s.access_token;if(!a)return;const{is_async:i,n_created:n,n_skipped:r}=await this.$call("import-contacts-from-google",{token:a});i?this.$confirm({title:"Import started",msg:"This may take a while depending on the number of contacts to import. We'll send you an email when the import is complete.",buttons:["Ok"],primary:"Ok"}):(this.$confirm({title:"Import complete",msg:`New contacts created: ${n}<br>Number of dupliactes skipped: ${r}`,buttons:["Ok"],primary:"Ok"}),this.$refs.table.reload())},async download(){await this.$call("export-contacts",(0,n.Z)((0,n.Z)({},this.search),{},{notify:!0})),this.$confirm({title:"Export started",msg:"We'll email you a link
1when we've finished exporting your contacts",buttons:["Ok"],primary:"Ok"})},downloadExample(){const t=[["name","email","phone"],...f];(0,c.Z)(t,"ellacard_import_contacts_template.csv")},async deleteContacts(){const t=this.$refs.table.n;if(!t)return;const e=await this.$confirm({title:"Are you sure?",msg:`Are you sure you want to delete ${t} contact${1==t?"":"s"}?${t>50?" This operation may take a while.":""}`,primary:"No"});"No"!=e&&(await this.$call("delete-contacts",this.search),this.$refs.table.reload())},async createGroup(){const[t]=await this.$call("update-contact-group-name",{name:"New contact group"});this.loadGroups().then((()=>{this.search=(0,n.Z)((0,n.Z)({},this.search),{},{groups:[t]}),this.editGroup=this.groups.find((e=>e.id==t))}))},async deleteGroup(){if(this.nContacts){const t=await this.$confirm({title:"Are you sure?",msg:"Are you sure you want to delete this contact group?"});if("No"==t)return}await this.$call("delete-contact-group",{id:this.search.groups[0]}),this.loadGroups(),this.editGroup=null,this.search=(0,n.Z)((0,n.Z)({},this.search),{},{groups:[]})},async onCreate(t,e){const s=this.search.groups[0];s&&(await this.$call("update-contact",{contact_id:t,contact:e,groups:[s]}),this.$refs.table.reload())}},watch:{globalUserId:{immediate:!0,handler(t){this.loadGroups()}},isLoading(t){t||(this.showGroups=!1)}}},y=g;var b=s(1001),C=s(43453),k=s.n(C),w=s(37179),x=s(73385),S=s(75223),$=s(84192),P=s(83422),I=s(5057),T=s(70248),D=s(61908),L=s(72755),E=s(64831),A=s(48228),Z=s(60092),M=s(56275),O=(0,b.Z)(y,a,i,!1,null,"914cf788",null);const U=O.exports;k()(O,{VBtn:w.Z,VCard:x.Z,VCardActions:S.h7,VCardSubtitle:S.Qq,VCardText:S.ZB,VCardTitle:S.EB,VDivider:$.Z,VExpandXTransition:P.Zq,VIcon:I.Z,VList:T.Z,VListItem:D.Z,VListItemAction:L.Z,VListItemContent:E.km,VListItemIcon:A.Z,VListItemSubtitle:E.oZ,VListItemTitle:E.V9,VMenu:Z.Z,VProgressCircular:M.Z})},48622:(t,e,s)=>{s.r(e),s.d(e,{default:()=>k});s(76265);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"px-3 px-sm-0 text-body-2"},[s("error-dialog",{attrs:{status:t.createStatus}}),s("dialog-scroll-lock",{attrs:{width:"500"},model:{value:t.showCreate,callback:function(e){t.showCreate=e},expression:"showCreate"}},[s("v-card",[s("v-btn",{staticClass:"float-right ma-3",attrs:{icon:""},on:{click:function(e){t.showCreate=!1}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClose)}})],1),s("v-card-title",[t._v(" API key scope ")]),s("v-divider"),s("v-card-text",{staticClass:"pt-5"},[s("v-radio-group",{model:{value:t.createParams.scope,callback:function(e){t.$set(t.createParams,"scope",e)},expression:"createParams.scope"}},[s("v-radio",{attrs:{label:"Test",value:"TEST"}}),s("v-radio",{attrs:{label:"Production",value:"PROD"}})],1),s("div",{staticClass:"mb-12"},[t._v("Cards created with a "),s("i",[t._v("Test")]),t._v(" key will "),s("i",[t._v("not")]),t._v(" deduct from your credits, but they "),s("i",[t._v("will")]),t._v(" contain a watermark.")]),s("v-radio-group",{model:{value:t.createParams.embed,callback:function(e){t.$set(t.createParams,"embed",e)},expression:"createParams.embed"}},[s("v-radio",{attrs:{label:"API access",value:!1}}),s("v-radio",{attrs:{label:"Embedded checkout",value:!0}})],1),s("div",[t._v("A standard "),s("i",[t._v("API access")]),t._v(" key is designed for use with the functions as described in our "),s("router-link",{attrs:{to:{name:"api-docs"}}},[t._v("documentation here")]),t._v(". It should be kept private. An "),s("i",[t._v("embedded checkout")]),t._v(" key is necessary only if you intend to host the Ellacard checkout experience on your own website â see "),s("router-link",{attrs:{to:{name:"account-org-embedding"}}},[t._v("the embedding tab")]),t._v(" for more details.")],1)],1),s("v-divider"),s("v-card-actions",[s("v-spacer"),s("v-btn",{on:{click:function(e){t.showCreate=!1}}},[t._v(" Cancel ")]),s("v-btn",{attrs:{color:"primary",loading:t.createStatus.pending},on:{click:t.create}},[t._v(" Create ")])],1)],1)],1),t.account.org.api?[s("div",[t._v("Manage your API access keys to use the Ellacard API to programatically create and send cards or to add the embedded checkout experience to your own site. See the "),s("router-link",{attrs:{target:"_blank",to:{name:"api-docs"}}},[t._v("API documentation here")]),t._v(".")],1),s("v-btn",{staticClass:"my-6",attrs:{small:"",color:"primary"},on:{click:function(e){t.showCreate=!0}}},[t._v(" Create new key⦠")]),s("v-data-table",{staticClass:"transparent",attrs:{"must-sort":"","sort-desc":"","sort-by":"created_at",headers:[{text:"Scope / type",value:"scope",sortable:!1},{text:"Key",value:"key"},{text:"Created",value:"created_at"},{value:"delete",sortable:!1,width:1}],items:t.keys,"items-per-page":50,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[50]},loading:t.loadAPIKeysStatus.pending},scopedSlots:t._u([{key:"item.key",fn:function(e){return[s("div",{staticStyle:{cursor:"pointer"},on:{click:function(s){return t.copyToClipboard(e.item.key)}}},[s("v-btn",{staticClass:"ml-n2",attrs:{icon:""}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClipboardArrowUp)}})],1),t._v(" "+t._s(e.value)+" ")],1)]}},{key:"item.scope",fn:function(e){return[s("div",[t._v(t._s(e.item.embed?"Embedded checkout":"API access"))]),s("div",{staticClass:"text--label-active",class:("PROD"==e.value?"success":"warning")+"--text"},[t._v(t._s({PROD:"Production",TEST:"Test"}[e.value]))])]}},{key:"item.created_at",fn:function(e){return[t._v(t._s(t._f("moment")(e.value,"short")))]}},{key:"item.delete",fn:function(e){return[s("v-btn",{attrs:{icon:""},on:{click:function(s){return t.remove(e.item.id)}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiDelete)}})],1)]}}],null,!1,1110979833)})]:[t._v(" Ellacard provides an API to allow you to build your own integrations using our customizable cards, including multi-media processing and hosting. Documentation is available "),s("router-link",{attrs:{to:{name:"api-docs"}}},[t._v("here")]),t._v(". Please contact us and describe your use case to get access: "),s("a",{attrs:{href:"mailto:[email protected]"}},[t._v("[email protected]")])]],2)},i=[],n=s(86080),r=s(3098);const o={name:"account-org-keys",routerViewMeta:{$subtitle:"Keys"}
1,props:["account"],data(){return{showCreate:!1,createParams:{scope:"TEST",embed:!1},keys:[],createStatus:this.$track("create"),loadAPIKeysStatus:this.$track("loadAPIKeys")}},created(){Object.assign(this,{mdiClipboardArrowUp:r.PZJ,mdiClose:r.r5M,mdiDelete:r.x9U})},methods:{async loadAPIKeys(){const t=await this.$call("list-api-keys",{org_id:this.account.org.id});this.keys=t.map((t=>(0,n.Z)({id:t.api_key_id},t.api_key)))},async create(){await this.$call("generate-api-key",(0,n.Z)({org_id:this.global.profile.org_id},this.createParams)),this.showCreate=!1,this.loadAPIKeys()},async remove(t){const e=await this.$confirm({title:"Are you sure?",msg:"Are you sure you want to remove this key? Make sure no clients are actively using it."});"No"!=e&&(await this.$call("delete-api-key",{api_key_id:t}),this.loadAPIKeys())}},watch:{"account.org.api":{immediate:!0,async handler(t){t&&this.loadAPIKeys()}}}},l=o;var d=s(1001),c=s(43453),u=s.n(c),m=s(37179),p=s(73385),h=s(75223),v=s(57652),f=s(84192),g=s(5057),y=s(9207),_=s(42564),b=s(55234),C=(0,d.Z)(l,a,i,!1,null,null,null);const k=C.exports;u()(C,{VBtn:m.Z,VCard:p.Z,VCardActions:h.h7,VCardText:h.ZB,VCardTitle:h.EB,VDataTable:v.Z,VDivider:f.Z,VIcon:g.Z,VRadio:y.Z,VRadioGroup:_.Z,VSpacer:b.Z})},40365:(t,e,s)=>{s.r(e),s.d(e,{default:()=>k});var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("error-dialog",{attrs:{status:t.unsubscribeStatus}}),s("error-dialog",{attrs:{status:t.resubscribeStatus}}),s("error-dialog",{attrs:{status:t.loadUnsubscribesStatus}}),t.showAddUnsubscribe?s("dialog-scroll-lock",{attrs:{width:"400"},model:{value:t.showAddUnsubscribe,callback:function(e){t.showAddUnsubscribe=e},expression:"showAddUnsubscribe"}},[s("v-card",[s("v-btn",{staticClass:"float-right ma-3",attrs:{icon:""},on:{click:function(e){t.showAddUnsubscribe=!1}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClose)}})],1),s("v-card-title",[t._v("Add global unsubscribe")]),s("v-card-subtitle",[t._v(" This recipient will be immediately blocked from receiving messages from your entire organization ")]),s("v-card-text",[s("email-phone-field",{attrs:{label:"Recipient email / phone","hide-contacts":"",rules:[function(t){return!!t}]},model:{value:t.unsubscribeTarget,callback:function(e){t.unsubscribeTarget=e},expression:"unsubscribeTarget"}})],1),s("v-card-actions",{staticClass:"justify-end"},[s("v-btn",{attrs:{text:""},on:{click:function(e){t.showAddUnsubscribe=!1}}},[t._v("Cancel")]),s("v-btn",{attrs:{text:"",color:"primary",disabled:!t.unsubscribeTarget},on:{click:t.unsubscribe}},[t._v("Unsubscribe")])],1)],1)],1):t._e(),s("div",{staticClass:"d-flex justify-end flex-wrap px-3 px-sm-0 mb-4"},[s("v-btn",{attrs:{icon:"",color:"primary"},on:{click:function(e){t.showAddUnsubscribe=!0}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiPlus)}}),s("div",{staticClass:"btn-tooltip bottom left"},[t._v("Add global unsubscribeâ¦")])],1),s("v-btn",{attrs:{icon:"",color:"primary"},on:{click:t.download}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiDownload)}}),s("div",{staticClass:"btn-tooltip bottom left"},[t._v("Download")])],1),s("btn-search",{attrs:{tooltip:"Search recipients"},model:{value:t.filter,callback:function(e){t.filter=e},expression:"filter"}})],1),s("v-data-table",{attrs:{"must-sort":"","items-per-page":500,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[500]},"sort-by":"t","sort-desc":"",headers:[{text:"Date / time",value:"t"},{text:"Sender",value:"sender"},{text:"Recipient email address",value:"email"},{text:"Recipient phone number",value:"phone"},{value:"action",sortable:!1,width:"1px"}],items:t.filtered,loading:t.loadUnsubscribesStatus.pending},scopedSlots:t._u([{key:"item.sender",fn:function(e){return[e.value?[t._v(t._s(e.value))]:s("span",{staticClass:"grey--text"},[t._v("All senders")])]}},{key:"item.phone",fn:function(e){return[t._v(t._s(t._f("phone")(e.value)))]}},{key:"item.t",fn:function(e){return[t._v(t._s(t._f("moment")(e.value,"short")))]}},{key:"item.action",fn:function(e){return[e.item.sender?t._e():s("v-btn",{staticClass:"mr-n2",attrs:{icon:"",color:"warning",loading:t.resubscribing===e.item},on:{click:function(s){return t.resubscribe(e.item)}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiDelete)}})],1)]}}])})],1)},i=[],n=s(86080),r=(s(43843),s(268),s(76265),s(96208)),o=s(18671),l=s(30740),d=s(83524),c=(s(92955),s(3098));const u={name:"account-org-unsubscribes",routerViewMeta:{$subtitle:"Unsubscribes"},mixins:[l.H],components:{BtnSearch:r["default"],EmailPhoneField:o["default"]},props:["account"],data(){return{unsubscribes:[],filter:null,resubscribing:null,showAddUnsubscribe:!1,unsubscribeTarget:null,unsubscribeStatus:this.$track("unsubscribe"),resubscribeStatus:this.$track("resubscribe"),loadUnsubscribesStatus:this.$track("loadUnsubscribes")}},created(){Object.assign(this,{mdiClose:c.r5M,mdiDownload:c.OGU,mdiMagnify:c.I0v,mdiOpenInNew:c.fOx,mdiInformation:c.geb,mdiPlus:c.qX5,mdiDelete:c.x9U})},computed:{filtered(){if(!this.filter)return this.unsubscribes;const t=this.filter.toLowerCase();return this.unsubscribes.filter((e=>e._filter.includes(t)))},orgId(){return this.account.org.id}},methods:{async unsubscribe(){const t=this.unsubscribeTarget.startsWith("+")?"phone":"email";await this.$call("create-org-unsubscribe",{[t]:this.unsubscribeTarget}),this.unsubscribeTarget=null,this.showAddUnsubscribe=!1,this.loadUnsubscribes()},async resubscribe(t){this.resubscribing=t;try{const e=await this.$confirm({title:"Are you sure?",msg:`Are you sure you want to allow <i>${t.email||this.$options.filters.phone(t.phone)}</i> to receive messages from your organization?`});if("Yes"!=e)return;const s=t.email?{email:t.email}:{phone:t.phone},a=await this.$call("get-org-unsubscribe",(0,n.Z)({org_id:this.orgId},s));a&&await this.$call("delete-org-unsubscribe",{org_id:this.orgId,unsubscribe_id:a[0]})}finally{this.resubscribing=null}this.unsubscribes=this.unsubscribes.filter((e=>e!==t))},async download(){const t=[["Date / time","Sender","Recipient email address","Recipient phone number"],...this.unsubscribes.map((t=>
1[t.t,t.sender,t.email,t.phone]))];(0,d.Z)(t,"unsubscribes.csv")},async loadUnsubscribes(){const t=await this.$call("list-org-unsubscribes");this.unsubscribes=t.map((([t,e,s,a])=>({sender:t,email:e,phone:s,t:a,_filter:`${t||""} ${e||""} ${this.$options.filters.phone(s)}`.toLowerCase()})))}},watch:{orgId:{immediate:!0,handler(){this.loadUnsubscribes()}}}},m=u;var p=s(1001),h=s(43453),v=s.n(h),f=s(37179),g=s(73385),y=s(75223),_=s(57652),b=s(5057),C=(0,p.Z)(m,a,i,!1,null,null,null);const k=C.exports;v()(C,{VBtn:f.Z,VCard:g.Z,VCardActions:y.h7,VCardSubtitle:y.Qq,VCardText:y.ZB,VCardTitle:y.EB,VDataTable:_.Z,VIcon:b.Z})},28542:(t,e,s)=>{s.r(e),s.d(e,{default:()=>P});s(70560);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"px-3 pb-16 text-body-2"},[s("error-dialog",{attrs:{status:t.loadStatus}}),s("error-dialog",{attrs:{status:t.loadUnaccountedOrdersStatus}}),s("error-dialog",{attrs:{status:t.loadNonZeroAccountBalancesStatus}}),s("div",{staticClass:"title mb-3"},[t._v("Accounting")]),s("div",{staticClass:"ma-n1 d-flex flex-wrap align-center"},[s("v-select",{staticClass:"ma-1",staticStyle:{"max-width":"130px"},attrs:{"hide-details":"",dense:"",outlined:"","persistent-placeholder":"",label:"Date range",items:t.dateRanges,value:(t.query.start||"")+":"+(t.query.end||"")},on:{input:function(e){var s=e.split(":"),a=s[0],i=s[1];t.query.start=a||null,t.query.end=i||null,t.$router.push({query:t.query})}}}),s("v-text-field",{staticClass:"ma-1",staticStyle:{"max-width":"166px"},attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",label:"From date",type:"date"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.$router.push({query:t.query})}},model:{value:t.query.start,callback:function(e){t.$set(t.query,"start",e)},expression:"query.start"}}),s("v-text-field",{staticClass:"ma-1",staticStyle:{"max-width":"166px"},attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",label:"To date",type:"date"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.$router.push({query:t.query})}},model:{value:t.query.end,callback:function(e){t.$set(t.query,"end",e)},expression:"query.end"}}),s("v-btn",{staticClass:"ma-1 px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:"",color:"primary",disabled:t.$route.query.start==t.query.start&&t.$route.query.end==t.query.end,loading:t.loadStatus.pending},on:{click:function(e){return t.$router.push({query:t.query})}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiMagnify)}})],1),s("v-spacer"),s("v-btn",{attrs:{text:"",color:"primary",target:"_blank",disabled:!t.$route.query.start||!t.$route.query.end,to:{name:"admin-payments",query:{mode:"date",from_date:t.$route.query.start,to_date:t.$route.query.end}}}},[s("span",{staticClass:"mr-2"},[t._v("Payments")]),s("v-icon",{domProps:{innerHTML:t._s(t.mdiOpenInNew)}})],1)],1),t.summary?[t.summary?s("table",{staticClass:"mt-3 summary"},t._l(t.SUMMARY_TABLE,(function(e){return s("tr",t._l(e,(function(e){var a=e[0],i=e[1];return s("td",[s("div",{staticClass:"text--label-active"},[t._v(t._s(a))]),s("div",[t._v(t._s((Number.isFinite(t.summary[i])?t.fmtNumber:t.fmtUSD)(t.summary[i])))])])})),0)})),0):t._e(),s("div",{staticClass:"mt-3 text--label-active"},[t._v("Claimed gift card sales by year")]),s("table",{staticClass:"mx-n3"},t._l(t.totalPaidInByYear,(function(e){var a=e.year,i=e.amt;return s("tr",[s("td",[t._v(t._s(a))]),s("td",[t._v(t._s(t.fmtUSD(i)))])])})),0),s("div",{staticClass:"mt-3 text--label-active"},[t._v("Outstanding balance*")]),s("div",[t._v(t._s(t.fmtUSD(t.outstandingBalance)))]),s("div",{staticClass:"mt-3 text--label-active"},[t._v("Outstanding account balance*")]),s("div",[t._v(t._s(t.fmtUSD(t.summary.outstanding_account_balance)))]),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showBalancesByCurrency)},on:{click:function(e){t.showBalancesByCurrency=!t.showBalancesByCurrency}}},[t._v(" Outstanding earmarked balances by currency* "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}}
1)],1),t.showBalancesByCurrency?s("table",t._l(t.balancesByCur,(function(e){var a=e.cur,i=e.balances;return s("tr",[s("td",[t._v(t._s(a))]),s("td",[t._v(t._s(t.fmtNumber(i.balance_cur)))]),s("td",{staticClass:"text--label-active"},[t._v("paid in: "+t._s(t.fmtUSD(i.balance_usd)))])])})),0):t._e()],1),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showClaimedByCurrencyInitial)},on:{click:function(e){t.showClaimedByCurrencyInitial=!t.showClaimedByCurrencyInitial}}},[t._v(" Caimed by currency (initial) "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1),t.showClaimedByCurrencyInitial?s("table",t._l(t.totalClaimedByCur.claimed_by_cur_initial,(function(e){var a=e.cur,i=e.amt,n=e.amt_cur,r=e.value;return s("tr",[s("td",[t._v(t._s(a))]),s("td",[t._v(t._s(t.fmtNumber(n)))]),s("td",{staticClass:"text--label-active"},[t._v("value: "+t._s(t.fmtUSD(r)))]),s("td",{staticClass:"text--label-active"},[t._v("paid in: "+t._s(t.fmtUSD(i)))])])})),0):t._e()],1),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showClaimedByCurrencyResolved)},on:{click:function(e){t.showClaimedByCurrencyResolved=!t.showClaimedByCurrencyResolved}}},[t._v(" Caimed by currency (resolved) "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1),t.showClaimedByCurrencyResolved?s("table",t._l(t.totalClaimedByCur.claimed_by_cur_resolved,(function(e){var a=e.cur,i=e.amt,n=e.amt_cur,r=e.value,o=e.by_src;return s("tr",[s("td",[t._v(t._s(a))]),s("td",[t._v(t._s(t.fmtNumber(n)))]),s("td",{staticClass:"text--label-active"},[t._v("value: "+t._s(t.fmtUSD(r)))]),s("td",{staticClass:"text--label-active"},[t._v("paid in: "+t._s(t.fmtUSD(i)))]),t._l(["EC","RU","TR"],(function(e){return o[e]?s("td",{staticClass:"text--label-active"},[t._v(" paid out "+t._s(e)+": "+t._s(t.fmtUSD(o[e]))+" ")]):t._e()}))],2)})),0):t._e()],1),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showUnaccounted)},on:{click:function(e){t.showUnaccounted=!t.showUnaccounted}}},[t._v(" Unaccounted claims "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1),t.showUnaccounted?s("v-data-table",{attrs:{"items-per-page":500,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[500]},headers:[{text:"Claim ID",value:"claim_id"},{text:"Message",value:"msg"},{text:"Claim amount",value:"amt"},{text:"Earmarked",value:"amt_cur_earmarked"},{text:"Earmarked (USD)",value:"amt_earmarked"},{text:"Value",value:"claim_value"},{text:"Existing",value:"sum_sources"}],items:t.summary.claimed_unaccounted},scopedSlots:t._u([{key:"item.claim_id",fn:function(e){return[s("router-link",{attrs:{to:{name:"admin-gift-card-claims",query:{id:e.value}},target:"_blank"}},[t._v(" "+t._s(e.value.slice(0,8))+"⦠")])]}},{key:"item.amt",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[t._v(t._s(e.item.cur)+" "+t._s(t.fmtNumber(e.value)))])]}},{key:"item.amt_cur_earmarked",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[t._v(t._s(e.item.cur)+" "+t._s(t.fmtNumber(e.value)))])]}},{key:"item.amt_earmarked",fn:function(e){return[t._v(t._s(t.fmtUSD(e.value)))]}},{key:"item.claim_value",fn:function(e){return[t._v(t._s(t.fmtUSD(e.value)))]}},{key:"item.sum_sources",fn:function(e){return[t._v(t._s(t.fmtUSD(e.value)))]}}],null,!1,1770336103)}):t._e()],1),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showNonZeroAccountBalances)},on:{click:function(e){t.showNonZeroAccountBalances=!t.showNonZeroAccountBalances}}},[t._v(" Non-zero account balances* "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}})],1),t.showNonZeroAccountBalances?s("v-data-table",{attrs:{"items-per-page":500,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[500]},headers:[{text:"Entity type",value:"type"},{text:"Entity ID",value:"id"},{text:"Amount",value:"amt"},{text:"Entity flags",value:"flags"}],loading:t.loadNonZeroAccountBalancesStatus.pending,items:t.accountBalances||[]},scopedSlots:t._u([{key:"item.id",fn:function(e){return[s("router-link",{attrs:{to:{name:"admin-gift-card-transactions",query:{"entity-type":e.item.type,"entity-id":e.value}}}},[t._v(" "+t._s(e.value.slice(0,8))+"⦠")])]}},{key:"item.amt",fn:function(e){return[t._v(t._s(t.fmtUSD(e.value)))]}},{key:"item.flags",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[e.value.lock?s("v-icon",{attrs:{color:"warning"},domProps:{innerHTML:t._s(t.mdiLock)}}):t._e(),e.value.hold?s("v-icon",{attrs:{color:"warning"},domProps:{innerHTML:t._s(t.mdiGiftOff)}}):t._e()],1)]}}],null,!1,391832616)}):t._e()],1),s("div",{staticClass:"mt-2 mx-n3"},[s("v-list-item",{staticClass:"simple py-2 px-3 text--label-active",attrs:{"aria-expanded":String(t.showUnaccountedOrders)},on:{click:function(e){t.showUnaccountedOrders=!t.showUnaccountedOrders}}},[t._v(" Unaccounted orders* "),s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}}
1)],1),t.showUnaccountedOrders?s("v-data-table",{attrs:{"items-per-page":500,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[500]},headers:[{text:"Order ID",value:"order_id"},{text:"Currency",value:"cur"},{text:"Earmarked / claimed in USD",value:"in_usd"},{text:"Earmarked / claimed in currency",value:"in_cur"}],loading:t.loadUnaccountedOrdersStatus.pending,items:t.unaccountedOrders||[]},scopedSlots:t._u([{key:"item.order_id",fn:function(e){return[s("router-link",{attrs:{to:{name:"admin-order",params:{token:e.value}}}},[t._v(" "+t._s(e.value.slice(0,8))+"⦠")])]}},{key:"item.cur",fn:function(e){return t._l(Object.entries(e.item.data_by_cur),(function(e){var a=e[0];e[1];return s("div",[t._v(t._s(a))])}))}},{key:"item.in_usd",fn:function(e){return t._l(Object.entries(e.item.data_by_cur),(function(e){e[0];var a=e[1];return s("div",[t._v(" "+t._s(t.fmtUSD(a.earmarked_usd))+" / "+t._s(t.fmtUSD(a.claimed_usd))+" ")])}))}},{key:"item.in_cur",fn:function(e){return t._l(Object.entries(e.item.data_by_cur),(function(e){e[0];var a=e[1];return s("div",[t._v(" "+t._s(t.fmtNumber(a.earmarked_cur))+" / "+t._s(t.fmtNumber(a.claimed_cur))+" ")])}))}}],null,!1,3266611936)}):t._e()],1)]:t._e()],2)},i=[],n=s(86080),r=(s(76265),s(80939),s(64043),s(57267),s(83524)),o=s(21111),l=s(3098);function d({src:t,id:e}){return t+":"+e}function c(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(t)}function u(t){return new Intl.NumberFormat("en-US",{style:"decimal"}).format(t)}const m=[[["Net cash flow","net_cash_flow"],["Net gift card sales","net_giftcard_sales"],["Net revenue","net_revenue"]],[["Sales","sales"],["Sales (gift cards)","sales_giftcards"],["Sales (non-gift cards)","sales_non_giftcards"]],[["Refunds","refunds"],["Refunds (gift cards)","refunds_giftcards"],["Refunds (non-gift cards)","refunds_non_giftcards"]],[["Claimed gift card value","claimed_value"],["Unclaimed gift card value","net_giftcard_balance"],["Claimed (paid to Ellacard)","claimed_paid_in"],["Claimed (paid by Ellacard)","claimed_paid_out"],["Claimed revenue","claimed_revenue"],["Claimed revenue from FX gain / loss","claimed_revenue_fx"],["Claimed fraud loss","claimed_fraud_loss"]],[["# of payments (all)","n_payments"],["# of payments (real)","n_real_payments"],["# of claims","claimed_n"],["# of unaccounted claims","claimed_n_unaccounted"],["Value of unaccounted claims","claimed_amt_unaccounted"]]],p={name:"admin-accounting",data(){return{query:{start:null,end:null},summary:null,showBalancesByCurrency:!1,showClaimedByCurrencyInitial:!1,showClaimedByCurrencyResolved:!1,showUnaccounted:!1,showUnaccountedOrders:!1,unaccountedOrders:null,showNonZeroAccountBalances:!1,accountBalances:null,loadStatus:this.$track("load"),loadUnaccountedOrdersStatus:this.$track("loadUnaccountedOrders"),loadNonZeroAccountBalancesStatus:this.$track("loadNonZeroAccountBalances")}},created(){Object.assign(this,{SUMMARY_TABLE:m,fmtUSD:c,fmtNumber:u,mdiDownload:l.OGU,mdiOpenInNew:l.fOx,mdiMagnify:l.I0v,mdiWalletGiftcard:l.alS,mdiMenuDown:l.iW9,mdiCards:l.u4Q,mdiLock:l.d5D,mdiGiftOff:l.jXf})},computed:{dateRanges(){const t=(0,o.WU)(new Date,"iso-date"),e=[["Today",t,t],["YTD",t.slice(0,4)+"-01-01",t]];for(let s=(new Date).getFullYear();s>=2020;s--){s+"-12-31"<t&&e.push([s,s+"-01-01",s+"-12-31"]);const a=[["01-01","03-31"],["04-01","06-30"],["07-01","09-30"],["10-01","12-31"]];for(let i=4;i>=1;i--)s+"-"+a[i-1][1]<t&&e.push([s+" Q"+i,s+"-"+a[i-1][0],s+"-"+a[i-1][1]])}return e.map((([t,e,s])=>({text:t,value:e+":"+s})))},totalPaidIn(){return Array.from(Object.values(this.summary.claimed_paid_in_by_year)).sum},totalPaidInByYear(){const t=Object.entries(this.summary.claimed_paid_in_by_year).map((([t,e])=>({year:t,amt:e})));return _.orderBy(t,["year"],["desc"])},totalClaimedByCur(){const t={};for(const e of["claimed_by_cur_initial","claimed_by_cur_resolved"])t[e]=_.sortBy(Object.entries(this.summary[e]).map((([t,e])=>(0,n.Z)({cur:t},e))),"cur");return t},balancesByCur(){return _.sortBy(Object.entries(this.summary.outstanding_earmarked_balance).map((([t,e])=>({cur:t,balances:e}))),"cur")},outstandingBalance(){let t=parseFloat(this.summary.outstanding_account_balance);for(const{balance_usd:e}of Object.values(this.summary.outstanding_earmarked_balance))t+=parseFloat(e);return t}},methods:{async updateQuery(){await this.$nextTick(),this.$router.push({query:_.cloneDeep(this.query)})},async load(){this.$route.query.start&&this.$route.query.end&&(this.summary=null,this.summary=await this.$call("get-accounting-summary",this.$route.query))},async loadUnaccountedOrders(){this.unaccountedOrders=null,this.unaccountedOrders=(await this.$call("list-unaccounted-orders",{up_to_date:this.$route.query.end})).unaccounted_orders},async loadNonZeroAccountBalances(){this.accountBalances=null;const t=await this.$call("list-non-zero-account-balances",{up_to_date:this.$route.query.end});this.accountBalances=t.map((([t,e,s,a])=>{var i;return{type:t,id:e,amt:s,flags:{lock:a.lock||(null===(i=a.auth)||void 0===i?void 0:i.lock),hold:a.hold_giftcards}}}))},async download(){const t=[["Claimed at","Claimed by","Initial","Initial currency","Initial amount","Override","Resolved","Resolved currency","Resolved amount","Cost currency","Cost amount","Cost USD","External ID","Order ID","Blob ID"],...this.filtered.map((t=>[t.claimed_at,t.email,d(t.initial),t.initial.cur,t.initial.amt,t.recipient_choice?d(t.recipient_choice):"",d(t.resolved),t.resolved.cur,t.resolved.amt,t.price.cur,t.price.amt,t.price_usd,t.external_id,t.order_id,t.blob_id]))];(0,r.Z)(t,`gift_card_claims_${Object.values(this.loaded).join("_")}`.replace(/\W/g,"_")+".csv")}},watch:{"$route.query":{immediate:!0,handler(t){if(t.start&&t.end)this.query.start=t.start,this.query.end=t.end,this.load();else{const[t,e]=this.dateRanges[0].value.split(":");this.$router.replace({query:{start:t,end:e}})}}},showUnaccountedOrders(t){t&&this.loadUnaccountedOrders()},showNonZeroAccountBalances(t){t&&this.loadNonZeroAccountBalances()}}},h=p;var v=s(1001),f=s(43453),g=s.n(f),y=s(37179),b=s(57652),C=s(5057),k=s(61908),w=s(82927),x=s(55234),S=s(75251),$=(0,v.Z)(h,a,i,!1,null,"3cf418f1",null);const P=$.exports;g()($,{VBtn:y.Z,VDataTable:b.Z,VIcon:C.Z,VListItem:k.Z,VSelect:w.Z,VSpacer:x.Z,VTextField:S.Z})},12583:(t,e,s)=>{s.r(e),s.d(e,{default:()=>Z});s(70560),s(97389);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"pa-3"},[s("error-dialog",{attrs:{status:t.loadStatus}}),s("error-dialog",{attrs:{status:t.undoClaimStatus}}),s("error-dialog",{attrs:{status:t.updateClaimStatus}}),s("error-dialog",{attrs:{status:t.loadPaymentSourcesStatus}}),t.selected?s("dialog-scroll-lock",{attrs:{width:"500",value:!0},on:{input:function(e){return t.$router.push({query:null})}}},[s("v-card",[s("v-btn",{staticClass:"float-right mt-3 mx-3",attrs:{icon:""},on:{click:function(e){return t.$router.push({query:null})}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClose)}})],1),s("v-card-title",[t._v("Claim")]),s("v-card-subtitle",{staticClass:"pb-0"},[t._v(t._s(t.$route.query.id))]),t.selected.undone_at?s("v-card-subtitle",{staticClass:"pb-0 warning--text"},[t._v(" Undone "+t._s(t._f("moment")(t.selected.undone_at))+" ")]):t._e(),s("div",{staticClass:"text-body-2"},[s("v-list-item",{staticClass:"mt-n1 mb-3 py-1 simple pl-6 flex-column align-start",attrs:{"aria-expanded":String(t.showPaymentSources)},on:{click:function(e){t.showPaymentSources=!t.showPaymentSources}}},[s("div",{staticClass:"grey--text text--darken-2"},[t._v(" Show payment sources "),s("v-btn",{attrs:{small:"",icon:"",loading:t.loadPaymentSourcesStatus.pending}},[s("v-icon",{staticClass:"menu-down",domProps:{innerHTML:t._s(t.mdiMenuDown)}}
1)],1)],1),t.showPaymentSources&&t.paymentSources?s("div",{staticClass:"pr-4",staticStyle:{width:"100%"}},[s("div",{staticClass:"text--label-active"},[t._v("Earmarks")]),s("ul",{staticClass:"pl-0"},t._l(t.paymentSources.sources_earmarked,(function(e){return s("li",{staticClass:"my-1 d-flex"},[s("router-link",{staticClass:"primary--text",attrs:{to:{name:"admin-payments",query:{mode:"id",payment_id:e.payment_id}}}},[t._v(t._s(e.payment_id))]),s("v-spacer"),s("div",{staticClass:"ml-2"},[t._v(t._s(t.staged.resolved.cur)+" "+t._s(e.amt_cur.toFixed(2)))]),s("div",{staticClass:"ml-2"},[t._v(t._s(t.FMT(e.amt)))])],1)})),0),s("div",{staticClass:"mt-3 text--label-active"},[t._v("Funding sources")]),s("ul",{staticClass:"pl-0"},t._l(t.paymentSources.sources_real,(function(e){return s("li",{staticClass:"my-1 d-flex"},[s("router-link",{staticClass:"primary--text",attrs:{to:{name:"admin-payments",query:{mode:"id",payment_id:e.payment_id}}}},[t._v(t._s(e.payment_id))]),s("v-spacer"),s("div",{staticClass:"ml-2"},[t._v(t._s(t.FMT(e.amt)))])],1)})),0)]):t._e()])],1),s("v-card-text",{staticStyle:{"white-space":"pre-wrap"},domProps:{innerHTML:t._s(t.selectedStr)}}),s("v-divider"),s("v-card-text",[s("v-row",[s("v-col",{attrs:{cols:"12",sm:"4"}},[s("v-checkbox",{attrs:{"hide-details":"",label:"Is test"},model:{value:t.staged.is_test,callback:function(e){t.$set(t.staged,"is_test",e)},expression:"staged.is_test"}})],1),s("v-col",{attrs:{cols:"12",sm:"4"}},[s("v-checkbox",{attrs:{"hide-details":"",label:"Is fraud"},model:{value:t.staged.is_fraud,callback:function(e){t.$set(t.staged,"is_fraud",e)},expression:"staged.is_fraud"}})],1),s("v-col",{attrs:{cols:"12",sm:"4"}},[s("v-checkbox",{attrs:{"hide-details":"",label:"Is reclaimed"},model:{value:t.staged.is_reclaimed,callback:function(e){t.$set(t.staged,"is_reclaimed",e)},expression:"staged.is_reclaimed"}})],1)],1),s("v-textarea",{staticClass:"mt-6",attrs:{"hide-details":"","persistent-placeholder":"",outlined:"","auto-grow":"",rows:"3",label:"Notes"},model:{value:t.staged.notes,callback:function(e){t.$set(t.staged,"notes",e)},expression:"staged.notes"}})],1),s("v-card-actions",[s("v-spacer"),s("v-btn",{attrs:{text:"",disabled:!!t.selected.undone_at,loading:t.undoClaimStatus.pending},on:{click:t.undoClaim}},[t._v("\\ Undo claim⦠")]),s("v-btn",{attrs:{text:"",color:"primary",disabled:!t.isSelectedDirty,loading:t.updateClaimStatus.pending},on:{click:t.updateClaim}},[t._v(" Update ")])],1)],1)],1):t._e(),s("div",{staticClass:"title mb-3"},[t._v("Claimed gift cards")]),s("div",{staticClass:"ma-n1 d-flex flex-wrap"},[s("v-text-field",{staticClass:"ma-1",staticStyle:{"max-width":"166px"},attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",label:"From date",type:"date"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.load.apply(null,arguments)}},model:{value:t.params.from,callback:function(e){t.$set(t.params,"from",e)},expression:"params.from"}}),s("v-text-field",{staticClass:"ma-1",staticStyle:{"max-width":"166px"},attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",label:"To date",type:"date"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.load.apply(null,arguments)}},model:{value:t.params.to,callback:function(e){t.$set(t.params,"to",e)},expression:"params.to"}}),s("v-text-field",{staticClass:"ma-1",attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",clearable:"",label:"Email"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.load.apply(null,arguments)}},model:{value:t.params.email,callback:function(e){t.$set(t.params,"email",e)},expression:"params.email"}}),s("v-text-field",{staticClass:"ma-1",attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",clearable:"",label:"Order ID"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.load.apply(null,arguments)}},model:{value:t.params.order_id,callback:function(e){t.$set(t.params,"order_id",e)},expression:"params.order_id"}}),s("v-text-field",{staticClass:"ma-1",attrs:{dense:"",outlined:"","hide-details":"","persistent-placeholder":"",clearable:"",label:"Resolved as"},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.load.apply(null,arguments)}},model:{value:t.params.resolved_id,callback:function(e){t.$set(t.params,"resolved_id",e)},expression:"params.resolved_id"}}),s("v-btn",{staticClass:"ma-1 px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:"",color:"primary",loading:t.loadStatus.pending,disabled:!t.needsReload},on:{click:t.load}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiMagnify)}})],1),s("div",{staticClass:"ma-1 btn-group btn-group-horizontal"},[s("v-btn",{staticClass:"px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:""},on:{click:function(e){t.setLastMonth(),t.load()}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiCalendarBlank)}}),s("span",{staticClass:"btn-tooltip bottom"},[t._v("Load last month")])],1),s("v-btn",{staticClass:"px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:""},on:{click:function(e){t.setLastDay(),t.load()}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiCalendar)}}),s("span",{staticClass:"btn-tooltip bottom"},[t._v("Load last day")])],1),s("v-btn",{staticClass:"px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:""},on:{click:function(e){t.setExpiring(),t.load()}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiClockAlert)}}),s("span",{staticClass:"btn-tooltip bottom"},[t._v("Load expiring")])],1)],1),t.global.profile["admin+"]?s("v-btn",{staticClass:"ma-1 px-3",staticStyle:{"min-width":"unset",height:"40px"},attrs:{outlined:"",disabled:t.loadStatus.pending},on:{click:t.download}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiDownload)}})],1):t._e()],1),s("v-data-table",{staticClass:"mt-6",attrs:{"items-per-page":500,"footer-props":{disableItemsPerPage:!0,itemsPerPageOptions:[500]}
1,"sort-by":t.sortBy,"sort-desc":t.sortDesc,page:t.page,headers:[{text:"Claimed at",value:"claimed_at"},{text:"Claimed by",value:"email"},{text:"Initial",value:"initial",sortable:!1},{text:"Initial value",value:"initial.amt"},{text:"Override",value:"recipient_choice",sortable:!1},{text:"Resolved",value:"resolved",sortable:!1},{text:"Resolved value",value:"resolved.amt"},{text:"Cost USD",value:"_price_int"},{text:"External link",value:"external_id",sortable:!1},{text:"Order",value:"order_id",sortable:!1,width:1}],items:t.filtered,loading:t.loadStatus.pending},on:{"update:page":function(e){t.page=e},"click:row":function(e){return t.$router.push({query:{id:e.id}})}},scopedSlots:t._u([{key:"item.claimed_at",fn:function(e){return[t._v(t._s(t._f("moment")(e.value,"short")))]}},{key:"item.email",fn:function(e){return[t._v(t._s(e.value))]}},{key:"item.initial.amt",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[t._v(t._s(e.item.initial.cur)+" "+t._s(e.item.initial.amt))])]}},{key:"item.initial",fn:function(e){return[s("span",{domProps:{innerHTML:t._s(t.buildLinkEl(e.value))}})]}},{key:"item.recipient_choice",fn:function(e){return[e.value?s("span",{domProps:{innerHTML:t._s(t.buildLinkEl(e.value))}}):t._e()]}},{key:"item.resolved",fn:function(e){return[s("span",{domProps:{innerHTML:t._s(t.buildLinkEl(e.value))}})]}},{key:"item.resolved.amt",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[t._v(t._s(e.item.resolved.cur)+" "+t._s(e.item.resolved.amt))])]}},{key:"item._price_int",fn:function(e){return[s("span",{staticStyle:{"white-space":"nowrap"}},[t._v(t._s(t.FMT(e.item.price_usd)))])]}},{key:"item.external_id",fn:function(e){return[s("a",{attrs:{href:t.buildURLProvider(e.item),target:"_blank"},on:{click:function(t){t.stopPropagation()}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiOpenInNew)}})],1)]}},{key:"item.order_id",fn:function(e){return[s("router-link",{attrs:{to:{name:"admin-order",params:{token:e.value}},target:"_blank"},nativeOn:{click:function(t){t.stopPropagation()}}},[s("v-icon",{domProps:{innerHTML:t._s(t.mdiOpenInNew)}})],1)]}}])})],1)},i=[],n=s(43501),r=(s(43843),s(48324),s(76265),s(32320),s(64043),s(57267),s(83524)),o=s(21111),l=s(3098);const d=["id","_price_int"];function c({src:t,id:e}){return t+":"+e}function u({src:t,id:e}){return`<a href="/gift-cards/${t}:${e}">${t}:${e}</a>`}function m(t){let e;return t.resolved?(e="TR"==t.resolved.src?"app.tremendous.com/apps/8SG97TOB6LBJ/history/orders/all":10==t.external_id.length?"connect.runa.io/connect/orders":"app.runa.io/orders",`https://${e}/${t.external_id}`):null}const p=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format,h={name:"admin-gift-card-claims",data(){return{params:{from:null,to:null,email:null,order_id:null,blob_id:null,resolved_src:null,resolved_id:null},loaded:null,filterResolved:"",items:[],sortBy:"claimed_at",sortDesc:!0,page:1,showExpiring:!1,selected:null,staged:null,showCancel:!1,showPaymentSources:!1,paymentSources:null,loadStatus:this.$track("load"),undoClaimStatus:this.$track("undoClaim"),updateClaimStatus:this.$track("updateClaim"),loadPaymentSourcesStatus:this.$track("loadPaymentSources")}},created(){Object.assign(this,{FMT:p,buildLinkEl:u,buildURLProvider:m,mdiDownload:l.OGU,mdiOpenInNew:l.fOx,mdiMagnify:l.I0v,mdiClockAlert:l.cBY,mdiCalendar:l.xnT,mdiCalendarBlank:l.SNP,mdiClose:l.r5M,mdiMenuDown:l.iW9})},mounted(){this.setLastDay(),this.load()},computed:{filtered(){return this.items.filter((t=>!this.filterResolved||c(t.resolved).includes(this.filterResolved)))},needsReload(){return!_.isEqual(_.omitBy(this.params,(t=>!t)),_.omitBy(this.loaded,(t=>!t)))},selectedStr(){const t=_.cloneDeep(this.selected);return t.order_id=`<a href='/admin/order/${t.order_id}'>${t.order_id}</a>`,t.read_token&&(t.read_token=`<a href='/admin/order/${t.read_token}'>${t.read_token}</a>`),t.external_id=`<a href='${m(t)}'>${t.external_id}</a>`,`<pre>${JSON.stringify(t,null,2)}</pre>`},isSelectedDirty(){return!_.isEqual(this.selected,this.staged)}},methods:{async load(){if(!this.needsReload)return;this.loaded=_.cloneDeep(this.params);
1const t=await this.$call("search-giftcard-claims",_.omitBy(this.params,(t=>!t)));for(const e of t)e.price_usd&&(e._price_int=parseInt(e.price_usd.replace(".","")));this.items=t.filter((t=>t.resolved)),this.page=1},async undoClaim(){const t=await this.$confirm({title:"Are you sure?",msg:"Are you sure you want to restore the value of this claim back to the order?"});if("No"==t)return;const e=await this.$call("undo-giftcard-claim",{claim_id:this.$route.query.id});Object.assign(this.selected,e),Object.assign(this.staged,e),Object.assign(this.items.find((t=>t.id==this.selected.id)),e)},async updateClaim(){await this.$call("update-giftcard-claim",{claim_id:this.$route.query.id,claim:this.staged}),this.selected=_.cloneDeep(this.staged),Object.assign(this.items.find((t=>t.id==this.selected.id)),this.selected)},setLastDay(){const t=new Date;t.setDate(t.getDate()-1),this.params.from=(0,o.WU)(t,"iso-date"),this.params.to=(0,o.WU)(new Date,"iso-date")},setLastMonth(){const t=new Date;t.setMonth(t.getMonth()-1),this.params.from=(0,o.WU)(t,"iso-date"),this.params.to=(0,o.WU)(new Date,"iso-date")},setExpiring(){const t=new Date;this.params.from=(0,o.WU)(new Date(t.getFullYear(),t.getMonth()-6,1),"iso-date"),this.params.to=(0,o.WU)(new Date(t.getFullYear(),t.getMonth()-5,0),"iso-date"),this.params.resolved_id="VISA-US"},async loadPaymentSources(){this.paymentSources=await this.$call("get-giftcard-claim-source-payments",{claim_id:this.$route.query.id})},async download(){const t=[["Claimed at","Claimed by","Initial","Initial currency","Initial amount","Override","Resolved","Resolved currency","Resolved amount","Cost currency","Cost amount","Cost USD","External ID","Order ID","Blob ID"],...this.filtered.map((t=>[t.claimed_at,t.email,c(t.initial),t.initial.cur,t.initial.amt,t.recipient_choice?c(t.recipient_choice):"",c(t.resolved),t.resolved.cur,t.resolved.amt,t.price.cur,t.price.amt,t.price_usd,t.external_id,t.order_id,t.blob_id]))];(0,r.Z)(t,`gift_card_claims_${Object.values(this.loaded).join("_")}`.replace(/\W/g,"_")+".csv")}},watch:{"$route.query.id":{immediate:!0,async handler(t){if(t){const e=this.items.find((e=>e.id==t))||{},{id:s,_price_int:a}=e,i=(0,n.Z)(e,d),r=s?i:await this.$call("get-giftcard-claim",{claim_id:t});this.selected=Object.assign({is_test:!1,is_fraud:!1,is_reclaimed:!1,notes:""},r),this.staged=_.cloneDeep(this.selected)}else this.selected=null;this.paymentSources=null}},showPaymentSources(t){t&&!this.paymentSources&&this.loadPaymentSources()}}},v=h;var f=s(1001),g=s(43453),y=s.n(g),b=s(37179),C=s(73385),k=s(75223),w=s(46072),x=s(24437),S=s(57652),$=s(84192),P=s(5057),I=s(61908),T=s(5294),D=s(55234),L=s(75251),E=s(75617),A=(0,f.Z)(v,a,i,!1,null,null,null);const Z=A.exports;y()(A,{VBtn:b.Z,VCard:C.Z,VCardActions:k.h7,VCardSubtitle:k.Qq,VCardText:k.ZB,VCardTitle:k.EB,VCheckbox:w.Z,VCol:x.Z,VDataTable:S.Z,VDivider:$.Z,VIcon:P.Z,VListItem:I.Z,VRow:T.Z,VSpacer:D.Z,VTextField:L.Z,VTextarea:E.Z})},56532:(t,e,s)=>{var a=s(79989),i=s(22615),n=s(68844),r=s(74684),o=s(69985),l=s(48999),d=s(91245),c=s(34327),u=s(54849),m=s(63477),p=s(27017),h=s(44201),v=s(53931),f=h("replace"),g=TypeError,y=n("".indexOf),_=n("".replace),b=n("".slice),C=Math.max;a({target:"String",proto:!0},{replaceAll:function(t,e){var s,a,n,h,k,w,x,S,$,P,I=r(this),T=0,D="";if(l(t)){if(s=d(t),s&&(a=c(r(m(t))),!~y(a,"g")))throw new g("`.replaceAll` does not allow non-global regexes");if(n=u(t,f),n)return i(n,t,I,e);if(v&&s)return _(c(I),t,e)}h=c(I),k=c(t),w=o(e),w||(e=c(e)),x=k.length,S=C(1,x),$=y(h,k);while(-1!==$)P=w?c(e(k,$,h)):p(k,h,$,[],void 0,e),D+=b(h,T,$)+P,T=$+x,$=$+S>h.length?-1:y(h,k,$+S);return T<h.length&&(D+=b(h,T)),D}})}}]); 2//# sourceMappingURL=view-ShareCardBtn-vue.3d86d735.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.