harperdb 4.5.2 → 4.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/bin/harperdb.js +74 -74
  3. package/bin/lite.js +72 -72
  4. package/launchServiceScripts/launchNatsIngestService.js +72 -72
  5. package/launchServiceScripts/launchNatsReplyService.js +72 -72
  6. package/launchServiceScripts/launchUpdateNodes4-0-0.js +72 -72
  7. package/npm-shrinkwrap.json +78 -69
  8. package/package.json +2 -1
  9. package/resources/auditStore.d.ts +3 -3
  10. package/resources/blob.d.ts +1 -1
  11. package/server/jobs/jobProcess.js +72 -72
  12. package/server/threads/threadServer.js +72 -72
  13. package/studio/build-local/asset-manifest.json +34 -34
  14. package/studio/build-local/index.html +1 -1
  15. package/studio/build-local/static/js/{164.f552d832.chunk.js → 164.13a1ca36.chunk.js} +1 -1
  16. package/studio/build-local/static/js/{708.1805e937.chunk.js → 656.c59b30a3.chunk.js} +2 -2
  17. package/studio/build-local/static/js/{833.5847bc85.chunk.js → 833.4f9ba8bb.chunk.js} +1 -1
  18. package/studio/build-local/static/js/{browse-csvupload.97e20c4a.chunk.js → browse-csvupload.098dfbf3.chunk.js} +1 -1
  19. package/studio/build-local/static/js/{browse-datatable.339fb83c.chunk.js → browse-datatable.dfc8d899.chunk.js} +1 -1
  20. package/studio/build-local/static/js/{browse-entitymanager.fd37a083.chunk.js → browse-entitymanager.efe8323a.chunk.js} +1 -1
  21. package/studio/build-local/static/js/{browse-jsonviewer.f57cc39c.chunk.js → browse-jsonviewer.02fc2ff0.chunk.js} +1 -1
  22. package/studio/build-local/static/js/{custom-functions.f682aa33.chunk.js → custom-functions.b5bc3a63.chunk.js} +1 -1
  23. package/studio/build-local/static/js/{instance-cluster.e2dba73f.chunk.js → instance-cluster.6b4d5fe7.chunk.js} +1 -1
  24. package/studio/build-local/static/js/{instance-config.4e2c4644.chunk.js → instance-config.d949e132.chunk.js} +1 -1
  25. package/studio/build-local/static/js/{instance-logs.bcec2256.chunk.js → instance-logs.37ca1ae8.chunk.js} +1 -1
  26. package/studio/build-local/static/js/{instance-roles.1ad69c74.chunk.js → instance-roles.2e4a1bd0.chunk.js} +1 -1
  27. package/studio/build-local/static/js/{instance-status.4e190908.chunk.js → instance-status.4c0f4e09.chunk.js} +1 -1
  28. package/studio/build-local/static/js/{instance-users-datatable.4a2c57e4.chunk.js → instance-users-datatable.b15433ca.chunk.js} +1 -1
  29. package/studio/build-local/static/js/{instance-users-edit.ecf717d1.chunk.js → instance-users-edit.8b70ada6.chunk.js} +1 -1
  30. package/studio/build-local/static/js/{instance-users.967796d9.chunk.js → instance-users.a8e27d45.chunk.js} +1 -1
  31. package/studio/build-local/static/js/{instance.809ece1e.chunk.js → instance.23ed04ec.chunk.js} +1 -1
  32. package/studio/build-local/static/js/{instances.2eb16b86.chunk.js → instances.bf9a8758.chunk.js} +1 -1
  33. package/studio/build-local/static/js/{main.2384076c.js → main.bef07e50.js} +2 -2
  34. package/studio/build-local/static/js/{offline-app.86377447.chunk.js → offline-app.49a81d63.chunk.js} +1 -1
  35. package/studio/build-local/static/js/{online-app.e65f9ef3.chunk.js → online-app.0a0cf21a.chunk.js} +1 -1
  36. package/studio/build-local/static/js/{organization-billing.1c318ac1.chunk.js → organization-billing.c4519987.chunk.js} +1 -1
  37. package/studio/build-local/static/js/{organization-users.36a2ed5a.chunk.js → organization-users.1ec6dae2.chunk.js} +1 -1
  38. package/studio/build-local/static/js/{organization.9a81d022.chunk.js → organization.e39f6cd2.chunk.js} +1 -1
  39. package/studio/build-local/static/js/{organizations.af48c8e8.chunk.js → organizations.b4583aa2.chunk.js} +1 -1
  40. package/studio/build-local/static/js/{profile.190afea3.chunk.js → profile.a5f8dae5.chunk.js} +1 -1
  41. package/studio/build-local/static/js/{resetPassword.50fa5b91.chunk.js → resetPassword.2dd720ac.chunk.js} +1 -1
  42. package/studio/build-local/static/js/{roles-jsonviewer.b5d5a908.chunk.js → roles-jsonviewer.55d5c685.chunk.js} +1 -1
  43. package/studio/build-local/static/js/{signIn.8fbf4021.chunk.js → signIn.90642da2.chunk.js} +1 -1
  44. package/studio/build-local/static/js/{signUp.459d42df.chunk.js → signUp.88e90055.chunk.js} +1 -1
  45. package/studio/build-local/static/js/{structure-reloader.ceaf6675.chunk.js → structure-reloader.760c8015.chunk.js} +1 -1
  46. package/studio/build-local/static/js/{topnav.79dbd3ab.chunk.js → topnav.a8ee396a.chunk.js} +1 -1
  47. package/studio/build-local/static/js/{updatePassword.b05821cb.chunk.js → updatePassword.0fd3692f.chunk.js} +1 -1
  48. package/utility/hdbTerms.d.ts +2 -0
  49. package/utility/scripts/restartHdb.js +72 -72
  50. /package/studio/build-local/static/js/{708.1805e937.chunk.js.LICENSE.txt → 656.c59b30a3.chunk.js.LICENSE.txt} +0 -0
  51. /package/studio/build-local/static/js/{main.2384076c.js.LICENSE.txt → main.bef07e50.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[214],{9167:(e,s,n)=>{n.r(s),n.d(s,{default:()=>k});var i=n(9950),l=n(1345),t=n(7348),d=n(8040),a=n(9435),r=n(5283),c=n(5996),o=n(4979),h=n(3150),u=n(884),j=n(7372),p=n(5971),x=n(4319),v=n(4414);const m=(0,i.lazy)((()=>n.e(83).then(n.bind(n,5928)))),A=(0,i.lazy)((()=>Promise.all([n.e(759),n.e(358)]).then(n.bind(n,7408)))),f=(0,i.lazy)((()=>n.e(881).then(n.bind(n,6304))));const b=function(){var e,s;const n=(0,l.Zp)(),t=(0,l.zy)(),[d,b]=(0,i.useState)(!0),[k,g]=(0,r.A)({}),[_]=(0,x.A)({});return(0,i.useEffect)((()=>{(0,p.A)(null===k||void 0===k?void 0:k.theme)}),[null===k||void 0===k?void 0:k.theme]),(0,i.useEffect)((()=>{(0,j.A)({currentPath:t.pathname,navigate:n,persistedUser:k,setPersistedUser:g,setFetchingUser:b,instanceAuths:_,controller:undefined})}),[]),(0,v.jsxs)("div",{id:"local-studio",className:`${k.theme}`,children:[(0,v.jsxs)("div",{className:"vh-100",children:[(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsx)(m,{loggedIn:null===_||void 0===_||null===(e=_.local)||void 0===e?void 0:e.valid})}),d?(0,v.jsx)(o.A,{header:"Signing in",spinner:!0}):null!==_&&void 0!==_&&null!==(s=_.local)&&void 0!==s&&s.valid?(0,v.jsx)("div",{id:"app-container",children:(0,v.jsx)(a.tH,{FallbackComponent:h.A,children:(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsxs)(l.BV,{children:[(0,v.jsx)(l.qh,{element:(0,v.jsx)(A,{}),path:"/o/:customer_id/i/:compute_stack_id/*"}),(0,v.jsx)(l.qh,{element:(0,v.jsx)(l.C5,{to:"/",replace:!0})})]})})})}):(0,v.jsx)("div",{className:"d-flex justify-content-center align-items-center h-100",children:(0,v.jsx)(a.tH,{FallbackComponent:u.A,children:(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsx)(l.BV,{children:(0,v.jsx)(l.qh,{element:(0,v.jsx)(f,{}),path:"/"})})})})})]}),(0,v.jsx)("div",{id:"app-bg-color"}),(0,v.jsxs)("div",{className:"version",children:["Harper Local Studio v",c.A.studio_version]})]})};const k=function(){return(0,v.jsx)(t.Kq,{template:d.A,timeout:4e3,position:t.Xq.TOP_CENTER,children:(0,v.jsx)(l.Kd,{children:(0,v.jsx)(b,{})})})}},4319:(e,s,n)=>{n.d(s,{A:()=>i});const i=(0,n(6997).A)("instanceAuths")}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[214],{9167:(e,s,n)=>{n.r(s),n.d(s,{default:()=>k});var i=n(9950),l=n(5201),t=n(7348),d=n(8040),a=n(9435),r=n(5283),c=n(5996),o=n(4979),h=n(3150),u=n(884),j=n(7372),p=n(5971),x=n(4319),v=n(4414);const m=(0,i.lazy)((()=>n.e(83).then(n.bind(n,5928)))),A=(0,i.lazy)((()=>Promise.all([n.e(759),n.e(358)]).then(n.bind(n,7408)))),f=(0,i.lazy)((()=>n.e(881).then(n.bind(n,6304))));const b=function(){var e,s;const n=(0,l.Zp)(),t=(0,l.zy)(),[d,b]=(0,i.useState)(!0),[k,g]=(0,r.A)({}),[_]=(0,x.A)({});return(0,i.useEffect)((()=>{(0,p.A)(null===k||void 0===k?void 0:k.theme)}),[null===k||void 0===k?void 0:k.theme]),(0,i.useEffect)((()=>{(0,j.A)({currentPath:t.pathname,navigate:n,persistedUser:k,setPersistedUser:g,setFetchingUser:b,instanceAuths:_,controller:undefined})}),[]),(0,v.jsxs)("div",{id:"local-studio",className:`${k.theme}`,children:[(0,v.jsxs)("div",{className:"vh-100",children:[(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsx)(m,{loggedIn:null===_||void 0===_||null===(e=_.local)||void 0===e?void 0:e.valid})}),d?(0,v.jsx)(o.A,{header:"Signing in",spinner:!0}):null!==_&&void 0!==_&&null!==(s=_.local)&&void 0!==s&&s.valid?(0,v.jsx)("div",{id:"app-container",children:(0,v.jsx)(a.tH,{FallbackComponent:h.A,children:(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsxs)(l.BV,{children:[(0,v.jsx)(l.qh,{element:(0,v.jsx)(A,{}),path:"/o/:customer_id/i/:compute_stack_id/*"}),(0,v.jsx)(l.qh,{element:(0,v.jsx)(l.C5,{to:"/",replace:!0})})]})})})}):(0,v.jsx)("div",{className:"d-flex justify-content-center align-items-center h-100",children:(0,v.jsx)(a.tH,{FallbackComponent:u.A,children:(0,v.jsx)(i.Suspense,{fallback:(0,v.jsx)(o.A,{header:" ",spinner:!0}),children:(0,v.jsx)(l.BV,{children:(0,v.jsx)(l.qh,{element:(0,v.jsx)(f,{}),path:"/"})})})})})]}),(0,v.jsx)("div",{id:"app-bg-color"}),(0,v.jsxs)("div",{className:"version",children:["Harper Local Studio v",c.A.studio_version]})]})};const k=function(){return(0,v.jsx)(t.Kq,{template:d.A,timeout:4e3,position:t.Xq.TOP_CENTER,children:(0,v.jsx)(l.Kd,{children:(0,v.jsx)(b,{})})})}},4319:(e,s,n)=>{n.d(s,{A:()=>i});const i=(0,n(6997).A)("instanceAuths")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[924],{7338:(e,s,n)=>{n.r(s),n.d(s,{default:()=>W});var t=n(9950),a=n(1345),i=n(5604),r=n(7348),l=n(7202),o=n(5996);const c=(0,l.c)(o.A.stripe_public_key);var d=n(8040),h=n(7732),m=n(6713),p=n(135),u=n(9435),x=n(4283),j=n(5553),f=n(5283),A=n(4979),b=n(4414);const v=function(){return(0,b.jsx)(A.A,{header:"Harper Studio Is Being Updated",body:"Please check back in a few minutes and get ready for a whole new batch of awesome!"})};var g=n(3150),y=n(884),N=n(2763),_=n(7806),w=n(1129),k=n(2676);var q=n(7372),I=n(1659),E=n(5971),z=n(8342),O=n(9335),S=n(7176),$=n(6114);const C=function(){return(0,b.jsx)(O.A,{fluid:"xs",className:"h-100",children:(0,b.jsxs)(S.A,{xs:"1",sm:"2",className:"h-100",children:[(0,b.jsx)($.A,{className:"p-5 auth-studio-info d-none d-sm-flex justify-content-center align-items-center",children:(0,b.jsxs)("div",{className:"auth-studio-info-container",children:[(0,b.jsx)("h1",{className:"auth-title",children:"Harper Studio"}),(0,b.jsx)("span",{className:"mb-4 auth-subtitle d-inline-block",children:"Manage all your Harper instances."}),(0,b.jsxs)("ul",{className:"auth-info-list-items",children:[(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Manage All Instances"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Set access, cluster, monitor, and more."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Embedded API Server"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Harper components give you unlimited application flexibility."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Fully Managed Cloud & 5G Instances"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Go from zero to code in minutes."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Deploy Anywhere"}),(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsx)("a",{href:"https://hub.docker.com/r/harperdb/harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"Docker"}),(0,b.jsx)("a",{href:"https://www.npmjs.com/package/harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"npm"}),(0,b.jsx)("a",{href:"https://docs.harperdb.io/docs/deployments/install-harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"all options"})]})]})]})]})}),(0,b.jsx)($.A,{className:"p-5 d-flex justify-content-center align-items-center auth-form-container",children:(0,b.jsx)(a.sv,{})})]})})},P=(0,t.lazy)((()=>n.e(83).then(n.bind(n,5928)))),M=(0,t.lazy)((()=>n.e(195).then(n.bind(n,6269)))),H=(0,t.lazy)((()=>n.e(881).then(n.bind(n,5559)))),T=(0,t.lazy)((()=>n.e(75).then(n.bind(n,3550)))),R=(0,t.lazy)((()=>n.e(607).then(n.bind(n,2553)))),F=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(478)]).then(n.bind(n,52)))),U=(0,t.lazy)((()=>Promise.all([n.e(851),n.e(678)]).then(n.bind(n,5203)))),B=(0,t.lazy)((()=>Promise.all([n.e(851),n.e(279),n.e(860),n.e(913)]).then(n.bind(n,7270)))),D=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(358)]).then(n.bind(n,7408)))),V=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(138)]).then(n.bind(n,4244)))),G={timeout:0,position:r.Xq.BOTTOM_CENTER};let K;function X(e){const{customer_id:s}=(0,a.g)();return e.auth.orgs.some((e=>e.customer_id===s))?(0,b.jsx)(a.sv,{}):(0,b.jsx)(a.C5,{to:"/organization",replace:!0})}const L=function(){const e=document.querySelector('link[rel="canonical"]'),s=(0,a.Zp)(),n=(0,r.MW)(),i=(0,a.zy)(),{search:l,pathname:c}=i,{redirect:d}=x.A.parse(l),O=(0,m.O$)(j.A,(e=>e.auth)),S=(0,m.O$)(j.A,(e=>e.theme)),$=(0,m.O$)(j.A,(e=>e.products)),L=(0,m.O$)(j.A,(e=>e.regions)),W=(0,m.O$)(j.A,(e=>e.wavelengthRegions)),Z=(0,m.O$)(j.A,(e=>e.akamaiRegions)),J=(0,m.O$)(j.A,(e=>e.version)),[Q,Y]=(0,t.useState)(!0),[ee,se]=(0,t.useState)(!1),[ne,te]=(0,f.A)({}),ae=null===O||void 0===O?void 0:O.user_id,ie=ae&&-1===(null===O||void 0===O?void 0:O.email.indexOf("harperdb.io"))&&-1===(null===O||void 0===O?void 0:O.email.indexOf("deliciousmonster.com")),re=(null===J||void 0===J?void 0:J.maintenance)&&ie;return h.Ay.initialize(o.A.google_analytics_code),(0,t.useEffect)((()=>{h.Ay.send({hitType:"pageview",page:window.location.pathname+window.location.search})}),[i.pathname]),(0,t.useEffect)((()=>{(0,E.A)(null===ne||void 0===ne?void 0:ne.theme)}),[null===ne||void 0===ne?void 0:ne.theme]),(0,t.useEffect)((()=>{se((e=>{let{apiVersion:s}=e;if(s){let e=!1;try{const n=o.A.studio_version.split("."),t=s.split("."),a=parseInt(n[0],10)<parseInt(t[0],10),i=parseInt(n[0],10)===parseInt(t[0],10)&&parseInt(n[1],10)<parseInt(t[1],10),r=parseInt(n[0],10)===parseInt(t[0],10)&&parseInt(n[1],10)===parseInt(t[1],10)&&parseInt(n[2],10)<parseInt(t[2],10);(a||i||r)&&(e=s)}catch(n){return!1}return e}return!1})({apiVersion:J.studio}))}),[J.studio]),(0,t.useEffect)((()=>{null!==O&&void 0!==O&&O.email&&(window._kmq&&window._kmq.push(["identify",O.email]),null!==O&&void 0!==O&&O.update_password&&s("/update-password"),d&&s(d))}),[null===O||void 0===O?void 0:O.email]),(0,t.useEffect)((()=>{ee&&n.info(`Harper Studio v${ee} is now available. Refresh to update.`,G)}),[ee]),(0,t.useEffect)((()=>{e.href=window.location.href}),[i,e]),(0,t.useEffect)((()=>{(0,q.A)({currentPath:i.pathname,navigate:s,persistedUser:ne,setPersistedUser:te,setFetchingUser:Y,controller:K})}),[]),(0,p.A)((()=>{$||(0,N.A)(),L||(0,_.A)(),W||(0,w.A)(),Z||(0,z.A)()}),o.A.refresh_content_interval),(0,p.A)((()=>{(0,k.A)(),(0,I.A)({auth:O,controller:K})}),o.A.check_version_interval),(0,b.jsxs)("div",{className:`${S} ${o.A.maintenance?"maintenance":""}`,children:[(0,b.jsx)(t.Suspense,{fallback:(0,b.jsx)(A.A,{header:" ",spinner:!0}),children:(0,b.jsx)(P,{isMaintenance:re,loggedIn:ae})}),Q?(0,b.jsx)("div",{className:"vh-100",children:(0,b.jsx)(A.A,{header:"Signing in...",spinner:!0})}):(0,b.jsx)("main",{id:ae?"app-container":"",className:ae?"":"auth-container",children:(0,b.jsx)(u.tH,{FallbackComponent:ae?g.A:y.A,children:(0,b.jsx)(t.Suspense,{fallback:(0,b.jsx)(A.A,{header:"Loading...",spinner:!0}),children:(0,b.jsx)(a.BV,{children:ae?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(R,{}),path:"/update-password"}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(V,{}),path:"/profile/*"}),(0,b.jsxs)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(X,{auth:O}),children:[(0,b.jsx)(a.qh,{element:(0,b.jsx)(D,{}),path:"/o/:customer_id/i/:compute_stack_id/*"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(B,{}),path:"/o/:customer_id/instances/:action?/:purchaseStep?"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(F,{}),path:"/o/:customer_id/*"})]}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(U,{}),path:"/:list?/:action?"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(a.C5,{to:"/",replace:!0})})]}):(0,b.jsxs)(a.qh,{element:(0,b.jsx)(C,{}),children:[(0,b.jsx)(a.qh,{element:(0,b.jsx)(H,{}),path:"/"}),(0,b.jsx)(a.qh,{element:o.A.maintenance?(0,b.jsx)(v,{}):(0,b.jsx)(M,{}),path:"/sign-up"}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(T,{}),path:"/reset-password"}),(0,b.jsx)(a.qh,{path:"*",element:(0,b.jsx)(a.C5,{to:`/?redirect=${c}${l}`,replace:!0})})]})})})})}),(0,b.jsx)("div",{id:"app-bg-color"}),(0,b.jsxs)("div",{className:"version",children:["Harper Studio v",o.A.studio_version,J.maintenance&&" - MAINTENANCE MODE"]})]})};const W=function(){return(0,b.jsx)(i.Elements,{stripe:c,children:(0,b.jsx)(r.Kq,{template:d.A,timeout:4e3,position:r.Xq.TOP_CENTER,children:(0,b.jsx)(a.Kd,{children:(0,b.jsx)(L,{})})})})}}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[924],{7338:(e,s,n)=>{n.r(s),n.d(s,{default:()=>W});var t=n(9950),a=n(5201),i=n(5604),r=n(7348),l=n(7202),o=n(5996);const c=(0,l.c)(o.A.stripe_public_key);var d=n(8040),h=n(7732),m=n(6713),p=n(135),u=n(9435),x=n(4283),j=n(5553),f=n(5283),A=n(4979),b=n(4414);const v=function(){return(0,b.jsx)(A.A,{header:"Harper Studio Is Being Updated",body:"Please check back in a few minutes and get ready for a whole new batch of awesome!"})};var g=n(3150),y=n(884),N=n(2763),_=n(7806),w=n(1129),k=n(2676);var q=n(7372),I=n(1659),E=n(5971),z=n(8342),O=n(9335),S=n(7176),$=n(6114);const C=function(){return(0,b.jsx)(O.A,{fluid:"xs",className:"h-100",children:(0,b.jsxs)(S.A,{xs:"1",sm:"2",className:"h-100",children:[(0,b.jsx)($.A,{className:"p-5 auth-studio-info d-none d-sm-flex justify-content-center align-items-center",children:(0,b.jsxs)("div",{className:"auth-studio-info-container",children:[(0,b.jsx)("h1",{className:"auth-title",children:"Harper Studio"}),(0,b.jsx)("span",{className:"mb-4 auth-subtitle d-inline-block",children:"Manage all your Harper instances."}),(0,b.jsxs)("ul",{className:"auth-info-list-items",children:[(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Manage All Instances"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Set access, cluster, monitor, and more."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Embedded API Server"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Harper components give you unlimited application flexibility."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Fully Managed Cloud & 5G Instances"}),(0,b.jsx)("span",{className:"item-subtitle",children:"Go from zero to code in minutes."})]}),(0,b.jsxs)("li",{children:[(0,b.jsx)("h3",{className:"item-title",children:"Deploy Anywhere"}),(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsx)("a",{href:"https://hub.docker.com/r/harperdb/harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"Docker"}),(0,b.jsx)("a",{href:"https://www.npmjs.com/package/harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"npm"}),(0,b.jsx)("a",{href:"https://docs.harperdb.io/docs/deployments/install-harperdb",target:"_blank",rel:"noreferrer",className:"deploy-subitem",children:"all options"})]})]})]})]})}),(0,b.jsx)($.A,{className:"p-5 d-flex justify-content-center align-items-center auth-form-container",children:(0,b.jsx)(a.sv,{})})]})})},P=(0,t.lazy)((()=>n.e(83).then(n.bind(n,5928)))),M=(0,t.lazy)((()=>n.e(195).then(n.bind(n,6269)))),H=(0,t.lazy)((()=>n.e(881).then(n.bind(n,5559)))),T=(0,t.lazy)((()=>n.e(75).then(n.bind(n,3550)))),R=(0,t.lazy)((()=>n.e(607).then(n.bind(n,2553)))),F=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(478)]).then(n.bind(n,52)))),U=(0,t.lazy)((()=>Promise.all([n.e(851),n.e(678)]).then(n.bind(n,5203)))),B=(0,t.lazy)((()=>Promise.all([n.e(851),n.e(279),n.e(860),n.e(913)]).then(n.bind(n,7270)))),D=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(358)]).then(n.bind(n,7408)))),V=(0,t.lazy)((()=>Promise.all([n.e(759),n.e(138)]).then(n.bind(n,4244)))),G={timeout:0,position:r.Xq.BOTTOM_CENTER};let K;function X(e){const{customer_id:s}=(0,a.g)();return e.auth.orgs.some((e=>e.customer_id===s))?(0,b.jsx)(a.sv,{}):(0,b.jsx)(a.C5,{to:"/organization",replace:!0})}const L=function(){const e=document.querySelector('link[rel="canonical"]'),s=(0,a.Zp)(),n=(0,r.MW)(),i=(0,a.zy)(),{search:l,pathname:c}=i,{redirect:d}=x.A.parse(l),O=(0,m.O$)(j.A,(e=>e.auth)),S=(0,m.O$)(j.A,(e=>e.theme)),$=(0,m.O$)(j.A,(e=>e.products)),L=(0,m.O$)(j.A,(e=>e.regions)),W=(0,m.O$)(j.A,(e=>e.wavelengthRegions)),Z=(0,m.O$)(j.A,(e=>e.akamaiRegions)),J=(0,m.O$)(j.A,(e=>e.version)),[Q,Y]=(0,t.useState)(!0),[ee,se]=(0,t.useState)(!1),[ne,te]=(0,f.A)({}),ae=null===O||void 0===O?void 0:O.user_id,ie=ae&&-1===(null===O||void 0===O?void 0:O.email.indexOf("harperdb.io"))&&-1===(null===O||void 0===O?void 0:O.email.indexOf("deliciousmonster.com")),re=(null===J||void 0===J?void 0:J.maintenance)&&ie;return h.Ay.initialize(o.A.google_analytics_code),(0,t.useEffect)((()=>{h.Ay.send({hitType:"pageview",page:window.location.pathname+window.location.search})}),[i.pathname]),(0,t.useEffect)((()=>{(0,E.A)(null===ne||void 0===ne?void 0:ne.theme)}),[null===ne||void 0===ne?void 0:ne.theme]),(0,t.useEffect)((()=>{se((e=>{let{apiVersion:s}=e;if(s){let e=!1;try{const n=o.A.studio_version.split("."),t=s.split("."),a=parseInt(n[0],10)<parseInt(t[0],10),i=parseInt(n[0],10)===parseInt(t[0],10)&&parseInt(n[1],10)<parseInt(t[1],10),r=parseInt(n[0],10)===parseInt(t[0],10)&&parseInt(n[1],10)===parseInt(t[1],10)&&parseInt(n[2],10)<parseInt(t[2],10);(a||i||r)&&(e=s)}catch(n){return!1}return e}return!1})({apiVersion:J.studio}))}),[J.studio]),(0,t.useEffect)((()=>{null!==O&&void 0!==O&&O.email&&(window._kmq&&window._kmq.push(["identify",O.email]),null!==O&&void 0!==O&&O.update_password&&s("/update-password"),d&&s(d))}),[null===O||void 0===O?void 0:O.email]),(0,t.useEffect)((()=>{ee&&n.info(`Harper Studio v${ee} is now available. Refresh to update.`,G)}),[ee]),(0,t.useEffect)((()=>{e.href=window.location.href}),[i,e]),(0,t.useEffect)((()=>{(0,q.A)({currentPath:i.pathname,navigate:s,persistedUser:ne,setPersistedUser:te,setFetchingUser:Y,controller:K})}),[]),(0,p.A)((()=>{$||(0,N.A)(),L||(0,_.A)(),W||(0,w.A)(),Z||(0,z.A)()}),o.A.refresh_content_interval),(0,p.A)((()=>{(0,k.A)(),(0,I.A)({auth:O,controller:K})}),o.A.check_version_interval),(0,b.jsxs)("div",{className:`${S} ${o.A.maintenance?"maintenance":""}`,children:[(0,b.jsx)(t.Suspense,{fallback:(0,b.jsx)(A.A,{header:" ",spinner:!0}),children:(0,b.jsx)(P,{isMaintenance:re,loggedIn:ae})}),Q?(0,b.jsx)("div",{className:"vh-100",children:(0,b.jsx)(A.A,{header:"Signing in...",spinner:!0})}):(0,b.jsx)("main",{id:ae?"app-container":"",className:ae?"":"auth-container",children:(0,b.jsx)(u.tH,{FallbackComponent:ae?g.A:y.A,children:(0,b.jsx)(t.Suspense,{fallback:(0,b.jsx)(A.A,{header:"Loading...",spinner:!0}),children:(0,b.jsx)(a.BV,{children:ae?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(R,{}),path:"/update-password"}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(V,{}),path:"/profile/*"}),(0,b.jsxs)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(X,{auth:O}),children:[(0,b.jsx)(a.qh,{element:(0,b.jsx)(D,{}),path:"/o/:customer_id/i/:compute_stack_id/*"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(B,{}),path:"/o/:customer_id/instances/:action?/:purchaseStep?"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(F,{}),path:"/o/:customer_id/*"})]}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(U,{}),path:"/:list?/:action?"}),(0,b.jsx)(a.qh,{element:(0,b.jsx)(a.C5,{to:"/",replace:!0})})]}):(0,b.jsxs)(a.qh,{element:(0,b.jsx)(C,{}),children:[(0,b.jsx)(a.qh,{element:(0,b.jsx)(H,{}),path:"/"}),(0,b.jsx)(a.qh,{element:o.A.maintenance?(0,b.jsx)(v,{}):(0,b.jsx)(M,{}),path:"/sign-up"}),(0,b.jsx)(a.qh,{element:re?(0,b.jsx)(v,{}):(0,b.jsx)(T,{}),path:"/reset-password"}),(0,b.jsx)(a.qh,{path:"*",element:(0,b.jsx)(a.C5,{to:`/?redirect=${c}${l}`,replace:!0})})]})})})})}),(0,b.jsx)("div",{id:"app-bg-color"}),(0,b.jsxs)("div",{className:"version",children:["Harper Studio v",o.A.studio_version,J.maintenance&&" - MAINTENANCE MODE"]})]})};const W=function(){return(0,b.jsx)(i.Elements,{stripe:c,children:(0,b.jsx)(r.Kq,{template:d.A,timeout:4e3,position:r.Xq.TOP_CENTER,children:(0,b.jsx)(a.Kd,{children:(0,b.jsx)(L,{})})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[588],{1192:(e,t,s)=>{s.r(t),s.d(t,{default:()=>F});var r=s(9950),n=s(7176),a=s(6114),o=s(1345),i=s(6713),c=s(9163),d=s.n(c),l=s(5553),u=s(4084),m=s(8156),p=s(3452),x=s(9435),h=s(2714);var v=s(8188),j=s(5887),A=s(9519),f=s(3150),_=s(3628),g=s(4414);const b=function(e){var t,s,c,b,y,N,C,w,k,S,O,P,E,T,$;let{setEditingCard:R,customerCard:z,formStateHeight:F,badCard:H}=e;const{customer_id:I}=(0,o.g)(),q=(0,i.O$)(l.A,(e=>e.auth)),M=(0,i.O$)(l.A,(e=>e.instances)),D=(0,i.O$)(l.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),[B,L]=(0,r.useState)({});return d()((async()=>{const{submitted:e}=B;if(e){if(M.find((e=>e.totalPrice)))L({error:"You have active, non-free instances."}),setTimeout((()=>L({})),2e3);else{L({processing:!0});const e=await(async e=>{let{auth:t,payment_method_id:s,stripe_id:r,customer_id:n}=e;return(0,h.A)({endpoint:"removePaymentMethod",method:"POST",payload:{payment_method_id:s,stripe_id:r,customer_id:n},auth:t})})({auth:q,stripe_id:D,payment_method_id:z.id,customer_id:I});e.error?(L({error:e.message}),setTimeout((()=>L({})),2e3)):(L({success:!0}),await(0,A.A)({auth:q,customer_id:I}),L({}),setTimeout((()=>R(!1)),0))}}}),[B]),(0,g.jsx)(x.tH,{onError:(e,t)=>(0,_.A)({error:{message:e.message,componentStack:t},customer_id:I}),FallbackComponent:f.A,children:B.processing?(0,g.jsx)(v.A,{height:F,status:"processing",header:"Removing Card From Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):B.success?(0,g.jsx)(v.A,{height:F,status:"success",header:"Card Removed Successfully",subhead:"Your account is now limited to free products."}):B.error?(0,g.jsx)(v.A,{height:F,status:"error",header:B.error,subhead:"You must remove them to remove your card."}):(0,g.jsx)(u.A,{children:(0,g.jsxs)(m.A,{children:[H&&(0,g.jsx)(j.A,{}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"card number"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsxs)("div",{className:"input-static",children:["**** **** ****",null===z||void 0===z||null===(t=z.card)||void 0===t?void 0:t.last4]})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"expiration"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:`${null===z||void 0===z||null===(s=z.card)||void 0===s?void 0:s.exp_month} / ${null===z||void 0===z||null===(c=z.card)||void 0===c?void 0:c.exp_year}`})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"cvcc"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:"***"})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"country"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(b=z.billing_details)||void 0===b||null===(y=b.address)||void 0===y?void 0:y.country})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"state/province"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(N=z.billing_details)||void 0===N||null===(C=N.address)||void 0===C?void 0:C.state})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"address"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(w=z.billing_details)||void 0===w||null===(k=w.address)||void 0===k?void 0:k.line1})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"apt/unit"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(S=z.billing_details)||void 0===S||null===(O=S.address)||void 0===O?void 0:O.line2})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"city"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(P=z.billing_details)||void 0===P||null===(E=P.address)||void 0===E?void 0:E.city})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"billing postal code"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(T=z.billing_details)||void 0===T||null===($=T.address)||void 0===$?void 0:$.postal_code})})]}),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"removeCard",title:"Remove Card",disabled:B.submitted,onClick:()=>L({submitted:!0}),block:!0,className:"mt-3",color:"danger",children:"Remove Card"})}),(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"updateCard",block:!0,color:"success",className:"mt-3",onClick:()=>R(!0),children:"Update Card"})})]})]})})})};var y=s(5604),N=s(4283),C=s(1701),w=s(414);const k=function(e){let{setEditingCard:t,customerCard:s,formStateHeight:c,badCard:h}=e;const{customer_id:b}=(0,o.g)(),k=(0,i.O$)(l.A,(e=>e.auth)),S=(0,i.O$)(l.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),[O,P]=(0,r.useState)({postal_code:!1,card:!1,expire:!1,cvc:!1}),[E,T]=(0,r.useState)({}),$=(0,y.useStripe)(),R=(0,y.useElements)(),z=(0,o.Zp)(),{search:F}=(0,o.zy)(),{returnURL:H}=N.A.parse(F);return d()((async()=>{const{submitted:e,processing:s}=E;if(e&&!s){const{card:e,expire:s,cvc:r,postal_code:n,line1:a,line2:o,state:i,city:c,country:d}=O;if(e&&s&&r&&n&&a&&i&&c&&d){const e=await $.createPaymentMethod({type:"card",card:R.getElement(y.CardNumberElement),billing_details:{address:{postal_code:n,line1:a,line2:o,state:i,city:c,country:d}}});if(T({processing:!0}),e.error)T({...E,error:e.error.message}),setTimeout((()=>T({...E,error:!1})),2e3);else{const s=await(0,C.A)({auth:k,payment_method_id:e.paymentMethod.id,stripe_id:S,customer_id:b});s.error?(T({...E,error:s.message}),setTimeout((()=>T({...E,error:!1})),2e3)):(window._kmq&&window._kmq.push(["record","added credit card - billing page"]),T({success:s.message}),await(0,A.A)({auth:k,customer_id:b}),H?z(H):t(!1))}}else T({error:"All fields are required"})}}),[E]),(0,g.jsx)(x.tH,{onError:(e,t)=>(0,_.A)({error:{message:e.message,componentStack:t},customer_id:b}),FallbackComponent:f.A,children:E.processing?(0,g.jsx)(v.A,{height:c,status:"processing",header:"Adding Card To Your Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):E.success?(0,g.jsx)(v.A,{height:c,status:"success",header:"Success!",subhead:"Credit Card was successfully added to your account."}):E.error?(0,g.jsx)(v.A,{height:c,status:"error",header:E.error,subhead:"Please try again"}):(0,g.jsx)(u.A,{children:(0,g.jsxs)(m.A,{children:[h&&(0,g.jsx)(j.A,{}),(0,g.jsx)(w.A,{setFormData:P,formData:O}),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[s&&(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"editCard",onClick:()=>t(!1),block:!0,color:"danger",className:"mt-3",children:"Cancel"})}),(0,g.jsx)(a.A,{children:(0,g.jsx)(p.A,{id:s?"saveNewCard":"addCardToAccount",title:s?"Save New Card":"Add Card To Account",disabled:E.submitted||!O.card||!O.expire||!O.cvc||!O.postal_code||!$||!R,onClick:()=>T({submitted:!0}),block:!0,className:"mt-3",color:"success",children:s?"Save New Card":"Add Card To Account"})})]})]})})})};const S=function(){const[e,t]=(0,r.useState)(!1),s=(0,i.O$)(l.A,(e=>e.hasCard),[e]),n=(0,i.O$)(l.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),a="582px";return(0,g.jsx)("div",{className:"mt-3 mb-4",children:e||!s?(0,g.jsx)(k,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n}):(0,g.jsx)(b,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n})})};var O=s(5996);let P;const E=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.auth)),s=(0,i.O$)(l.A,(e=>e.invoices));return d()((()=>{P=new AbortController,(async e=>{let{auth:t,signal:s,customer_id:r}=e,n=null;try{n=await(0,h.A)({endpoint:"getInvoices",method:"POST",payload:{customer_id:r},signal:s,auth:t});let e=[];return Array.isArray(n)&&(e=n),l.A.update((t=>{t.invoices=e.filter((e=>e.amount_paid))}))}catch(a){return(0,_.A)({type:"lms data",status:"error",url:O.A.lms_api_url,operation:"getInvoices",request:{customer_id:r},error:{catch:a.toString()},customer_id:r})}})({auth:t,signal:P.signal,customer_id:e})}),(()=>{var e;return null===(e=P)||void 0===e?void 0:e.abort()}),[]),(0,g.jsx)(x.tH,{onError:(t,s)=>(0,_.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:f.A,children:(0,g.jsx)(u.A,{className:"my-3",children:(0,g.jsx)(m.A,{children:s?s.length?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-bold text-small",children:"date"}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text-bold text-small",children:"amount"}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text-bold text-small",children:"print"})]}),s.map((e=>(0,g.jsxs)(r.Fragment,{children:[(0,g.jsx)("hr",{className:"mt-2"}),(0,g.jsxs)(n.A,{className:"pb-2",children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap",children:new Date(1e3*e.created).toLocaleString()}),(0,g.jsxs)(a.A,{xs:"3",className:"text-end text text-nowrap",children:["$",(e.total/100).toFixed(2)]}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text text-nowrap",children:(0,g.jsx)("a",{title:"print invoice",href:e.hosted_invoice_url,target:"_blank",rel:"noopener noreferrer",children:(0,g.jsx)("i",{className:"fa fa-print text-purple"})})})]})]},e.id)))]}):(0,g.jsx)("div",{className:"py-5 text-center",children:"You have not yet received an invoice."}):(0,g.jsx)("div",{className:"py-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-purple"})})})})})};var T=s(2257);const $=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.customer.stripe_coupons));return(0,g.jsx)(x.tH,{onError:(t,s)=>(0,_.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:f.A,children:(0,g.jsx)(u.A,{className:"my-3",children:(0,g.jsxs)(m.A,{children:[(0,g.jsx)(T.A,{}),null!==t&&void 0!==t&&t.length?(0,g.jsxs)("div",{className:"mt-2",children:[t.map((e=>(0,g.jsxs)(r.Fragment,{children:[(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",children:e.name}),(0,g.jsxs)(a.A,{xs:"6",className:"text-end",children:["$",parseInt(e.amount_off/100,10)]})]})]},e.id))),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",children:(0,g.jsx)("b",{children:"Total Credit"})}),(0,g.jsx)(a.A,{xs:"6",className:"text-end",children:(0,g.jsxs)("b",{children:["$",t.reduce(((e,t)=>e+parseInt(t.amount_off/100,10)),0)]})})]})]}):null]})})})};var R=s(5345),z=s(3906);const F=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.auth)),s=(0,i.O$)(l.A,(e=>e.products)),c=(0,i.O$)(l.A,(e=>e.regions)),u=(0,i.O$)(l.A,(e=>e.subscriptions)),m=(0,i.O$)(l.A,(e=>e.instances)),p=(0,i.O$)(l.A,(e=>e.customer.is_unpaid));return(0,r.useEffect)((()=>{(0,A.A)({auth:t,customer_id:e})}),[]),d()((()=>{t&&s&&c&&u&&e&&(null===m||void 0===m||!m.length)&&(0,z.A)({auth:t,customer_id:e,products:s,regions:c,subscriptions:u,instanceCount:null===m||void 0===m?void 0:m.length})}),[t,s,c,e,u,m]),(0,g.jsxs)(n.A,{children:[p&&(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)(R.A,{})}),(0,g.jsxs)(a.A,{md:"6",children:[(0,g.jsx)("span",{className:"floating-card-header",children:"card"}),(0,g.jsx)(S,{})]}),(0,g.jsxs)(a.A,{md:"6",children:[(0,g.jsx)("span",{className:"floating-card-header",children:"coupons"}),(0,g.jsx)($,{}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"floating-card-header",children:"invoices"}),(0,g.jsx)(E,{})]})]})}},5887:(e,t,s)=>{s.d(t,{A:()=>n});s(9950);var r=s(4414);const n=function(){return(0,r.jsxs)("div",{className:"text-danger",children:[(0,r.jsx)("i",{children:"Your most recent card payment failed. Please update your card below."}),(0,r.jsx)("hr",{className:"mt-3 mb-2"})]})}},2257:(e,t,s)=>{s.d(t,{A:()=>g});var r=s(9950),n=s(7176),a=s(6114),o=s(5488),i=s(3452),c=s(9163),d=s.n(c),l=s(6713),u=s(9435),m=s(1345),p=s(4283),x=s(5553),h=s(2714);var v=s(9519),j=s(3150),A=s(3628),f=s(4414);let _;const g=function(){const{customer_id:e}=(0,m.g)(),{search:t}=(0,m.zy)(),{code:s}=p.A.parse(t),c=(0,l.O$)(x.A,(e=>e.auth)),[g,b]=(0,r.useState)({coupon_code:s||""}),[y,N]=(0,r.useState)({}),[C,w]=(0,r.useState)(!1);return d()((async()=>{if(y.submitted){const{coupon_code:t}=g;if(t){_=new AbortController;const s=await(async e=>{let{auth:t,customer_id:s,coupon_code:r}=e;return(0,h.A)({endpoint:"addCoupon",method:"POST",auth:t,payload:{customer_id:s,coupon_code:r,user_id:t.user_id}})})({auth:c,customer_id:e,coupon_code:t});!1===s.result||s.error?N({error:s.message}):(window._kmq&&window._kmq.push(["record","user added coupon"]),await(0,v.A)({auth:c,customer_id:e}),C&&(b({coupon_code:""}),N({})))}else N({error:"Please enter a valid coupon code"})}}),(()=>{var e;return null===(e=_)||void 0===e?void 0:e.abort()}),[y]),d()((()=>{y.submitted||N({})}),[g]),d()((()=>{w(!0),g.coupon_code&&N({submitted:!0})}),(()=>w(!1)),[]),(0,f.jsx)(u.tH,{onError:(t,s)=>(0,A.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:j.A,children:(0,f.jsxs)(n.A,{children:[(0,f.jsx)(a.A,{md:"6",children:(0,f.jsx)(o.A,{id:"coupon_code",className:"mb-2",type:"text",value:g.coupon_code,invalid:!!y.error,disabled:y.submitted,placeholder:"coupon code",onChange:e=>b({coupon_code:e.target.value.toUpperCase()})})}),(0,f.jsx)(a.A,{md:"6",children:(0,f.jsx)(i.A,{id:"addCoupon",color:"success",disabled:y.submitted,block:!0,onClick:()=>N({submitted:!0}),children:y.submitted?(0,f.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,f.jsx)("span",{children:"Add Coupon"})})}),(0,f.jsxs)(a.A,{xs:"12",className:"text-center text-danger text-small",children:[y.error,"\xa0"]})]})})}},414:(e,t,s)=>{s.d(t,{A:()=>v});var r=s(9950),n=s(7176),a=s(6114),o=s(5488),i=s(5604),c=s(5285),d=s(6713),l=s(1345),u=s(9435);var m=s(5553),p=s(3150),x=s(3628),h=s(4414);const v=function(e){let{setFormData:t,formData:s}=e;const{customer_id:v}=(0,l.g)(),[j,A]=(0,r.useState)({}),f=(e=>{let{theme:t}=e;return{style:{base:{iconColor:"#403b8a",color:"dark"===t?"#ffffff":"#212121",fontWeight:100,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans", Arial, Helvetica, Verdana, Sans-Serif',fontSize:"14px",fontSmoothing:"antialiased","::placeholder":{color:"#bcbcbc"}},invalid:{iconColor:"#ea4c89",color:"#ea4c89"}}}})({theme:(0,d.O$)(m.A,(e=>e.theme))});return(0,h.jsx)(u.tH,{onError:(e,t)=>(0,x.A)({error:{message:e.message,componentStack:t},customer_id:v}),FallbackComponent:p.A,children:(0,h.jsxs)(n.A,{children:[(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"card number"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.cardError?"error":""),children:(0,h.jsx)(i.CardNumberElement,{options:f,id:"ccCardNumber",onChange:e=>{var r;A({...j,cardError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,card:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"expiration"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.expError?"error":""),children:(0,h.jsx)(i.CardExpiryElement,{options:f,id:"ccExpire",onChange:e=>{var r;A({...j,expError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,expire:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"cvcc"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.cvcError?"error":""),children:(0,h.jsx)(i.CardCvcElement,{id:"ccCVC",options:f,onChange:e=>{var r;A({...j,cvcError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,cvc:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"country"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(c.wP,{id:"ccCountry",valueType:"short",value:s.country,priorityOptions:["CA","US","GB"],defaultOptionLabel:"select your country",onChange:e=>t({...s,country:e})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"state/province"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(c.mM,{id:"ccRegion",blankOptionLabel:"select country first",defaultOptionLabel:"select state / province",valueType:"short",countryValueType:"short",country:s.country,value:s.state,onChange:e=>t({...s,state:e})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"address"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccLine1",onChange:e=>t({...s,line1:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"apt/unit"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccApt",onChange:e=>t({...s,line2:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"city"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccCity",onChange:e=>t({...s,city:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"billing postal code"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccPostalCode",onChange:e=>t({...s,postal_code:e.target.value})})})]})})}},8188:(e,t,s)=>{s.d(t,{A:()=>o});s(9950);var r=s(4084),n=s(8156),a=s(4414);const o=function(e){let{header:t,subhead:s=" ",height:o,status:i,className:c}=e;return(0,a.jsx)(r.A,{className:`form-status ${c}`,children:(0,a.jsxs)(n.A,{className:"text-center",style:{height:o},children:[(0,a.jsx)("div",{className:"text-bold",children:t}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsx)("i",{className:"fa fa-lg "+("processing"===i?"fa-spinner fa-spin text-purple":"success"===i?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,a.jsx)("div",{className:"text-grey",children:s})]})})}},5345:(e,t,s)=>{s.d(t,{A:()=>o});s(9950);var r=s(4084),n=s(8156),a=s(4414);const o=function(){return(0,a.jsx)(r.A,{color:"danger",className:"mb-4",children:(0,a.jsx)(n.A,{className:"text-center text-danger",children:"This Organization Will Not Be Billed"})})}},1701:(e,t,s)=>{s.d(t,{A:()=>n});var r=s(2714);const n=async e=>{let{auth:t,payment_method_id:s,stripe_id:n,customer_id:a}=e;return(0,r.A)({endpoint:"addPaymentMethod",method:"POST",payload:{payment_method_id:s,stripe_id:n,customer_id:a},auth:t})}},9519:(e,t,s)=>{s.d(t,{A:()=>c});var r=s(2714),n=s(5553),a=s(3628),o=s(5996),i=s(7596);const c=async e=>{let{auth:t,customer_id:s}=e,c=null;try{var d;return c=await(0,r.A)({endpoint:"getCustomer",method:"POST",payload:{customer_id:s},auth:t}),(0,i.A)({auth:t,customer_id:s,stripe_id:null===(d=c)||void 0===d?void 0:d.stripe_id}),c.error||n.A.update((e=>{var t;e.customer={...c,customer_id:s},e.hasCard=null===(t=c.stripe_payment_methods)||void 0===t?void 0:t[0]})),c}catch(l){return(0,a.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"getCustomer",request:{customer_id:s},error:{catch:l.toString()},customer_id:s})}}},3906:(e,t,s)=>{s.d(t,{A:()=>d});var r=s(2714),n=s(5553),a=s(4549);const o=e=>{let{is_local:t,wavelength_zone_id:s,cloud_provider:r}=e;switch(!0){case s:return"wavelength_compute";case t:return"local_compute";case"akamai"===r:return"akamai_compute";default:return"cloud_compute"}};var i=s(3628),c=s(5996);const d=async e=>{let{auth:t,customer_id:s,products:d,regions:l,subscriptions:u,instanceCount:m=0}=e,p=null;try{if(p=await(0,r.A)({endpoint:"getInstances",method:"POST",payload:{customer_id:s,user_id:t.user_id},auth:t}),Array.isArray(p)){const e=p.map((e=>{const t=(e=>{let{instance:t,products:s,regions:r,subscriptions:n}=e;try{var i,c;const e=t.compute_subscription_id?n[o(t)]:s[o(t)],d=null===e||void 0===e?void 0:e.find((e=>e.value.stripe_plan_id===t.stripe_plan_id&&(!t.compute_subscription_id||e.value.compute_subscription_id===t.compute_subscription_id))),l=t.storage_subscription_id?n.cloud_storage:s.cloud_storage,u=!t.is_local&&(null===l||void 0===l?void 0:l.find((e=>e.value.data_volume_size===t.data_volume_size&&e.value.stripe_storage_plan_id===t.stripe_storage_plan_id&&(!t.storage_subscription_id||e.value.storage_subscription_id===t.storage_subscription_id)))),m=parseFloat((null===d||void 0===d||null===(i=d.value)||void 0===i?void 0:i.compute_price)||0)+parseFloat((null===u||void 0===u||null===(c=u.value)||void 0===c?void 0:c.storage_price)||0),p=m?`$${(0,a.A)(m.toFixed(2))}`:"FREE",x=t.compute_subscription_id&&t.storage_subscription_id?"PREPAID":m?`${p}/${d.value.compute_interval}`:"FREE",h=!t.is_local&&r.find((e=>e.value===t.instance_region));return{compute:null===d||void 0===d?void 0:d.value,storage:null===u||void 0===u?void 0:u.value,totalPrice:m,totalPriceString:p,totalPriceStringWithInterval:x,region:h}}catch(d){return console.log(d)}})({instance:e,products:d,regions:l,subscriptions:u});return{...e,...t}})),t=e.sort(((e,t)=>e.instance_name>t.instance_name?1:-1));return n.A.update((e=>{e.instances=t})),t}return!m&&n.A.update((e=>{e.instances=[]}))}catch(x){return(0,i.A)({type:"lms data",status:"error",url:c.A.lms_api_url,operation:"getInstances",request:{customer_id:s},error:{catch:x.toString()},customer_id:s})}}},7596:(e,t,s)=>{s.d(t,{A:()=>d});var r=s(2714),n=s(5553),a=s(3628),o=s(2434),i=s(2696),c=s(5996);const d=async e=>{let{auth:t,customer_id:s,stripe_id:d}=e;try{const e=await(0,r.A)({endpoint:"getPrepaidSubscriptions",method:"POST",payload:{customer_id:s,stripe_id:d},auth:t});return!e.error&&n.A.update((t=>{t.subscriptions={cloud_storage:(0,i.A)(e.cloud_storage||[]),cloud_compute:(0,o.A)(e.cloud_compute||[]),wavelength_compute:(0,o.A)(e.wavelength_compute||[]),local_compute:(0,o.A)(e.local_compute||[])}}))}catch(l){return(0,a.A)({type:"lms data",status:"error",url:c.A.lms_api_url,operation:"getPrepaidSubscriptions",error:{catch:l.toString()}})}}},5488:(e,t,s)=>{s.d(t,{A:()=>_});var r=s(9950),n=s(1942),a=s.n(n),o=s(8738),i=s.n(o),c=s(1497);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}var l=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},u.apply(this,arguments)}function m(e,t){if(null==e)return{};var s,r,n=function(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)s=a[r],t.indexOf(s)>=0||(n[s]=e[s]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)s=a[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function p(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function h(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,r=j(e);if(t){var n=j(this).constructor;s=Reflect.construct(r,arguments,n)}else s=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,s)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}var A={children:a().node,type:a().string,size:a().oneOfType([a().number,a().string]),bsSize:a().string,valid:a().bool,invalid:a().bool,tag:c.Wx,innerRef:a().oneOfType([a().object,a().func,a().string]),plaintext:a().bool,addon:a().bool,className:a().string,cssModule:a().object},f=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(o,e);var t,s,n,a=h(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).getRef=t.getRef.bind(v(t)),t.focus=t.focus.bind(v(t)),t}return t=o,(s=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,s=e.cssModule,n=e.type,a=void 0===n?"text":n,o=e.bsSize,d=e.valid,p=e.invalid,x=e.tag,h=e.addon,v=e.plaintext,j=e.innerRef,A=m(e,l),f=["switch","radio","checkbox"].indexOf(a)>-1,_="select"===a,g="range"===a,b=x||(_||"textarea"===a?a:"input"),y="form-control";v?(y="".concat(y,"-plaintext"),b=x||"input"):g?y="form-range":_?y="form-select":f&&(y=h?null:"form-check-input"),A.size&&/\D/g.test(A.size)&&((0,c.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=A.size,delete A.size);var N=(0,c.qO)(i()(t,p&&"is-invalid",d&&"is-valid",!!o&&(_?"form-select-".concat(o):"form-control-".concat(o)),y),s);return("input"===b||x&&"function"===typeof x)&&(A.type="switch"===a?"checkbox":a),A.children&&!v&&"select"!==a&&"string"===typeof b&&"select"!==b&&((0,c.mc)('Input with a type of "'.concat(a,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete A.children),r.createElement(b,u({},A,{ref:j,className:N,"aria-invalid":p}))}}])&&p(t.prototype,s),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component);f.propTypes=A;const _=f}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[588],{1192:(e,t,s)=>{s.r(t),s.d(t,{default:()=>F});var r=s(9950),n=s(7176),a=s(6114),o=s(5201),i=s(6713),c=s(9163),d=s.n(c),l=s(5553),u=s(4084),m=s(8156),p=s(3452),x=s(9435),h=s(2714);var v=s(8188),j=s(5887),A=s(9519),f=s(3150),_=s(3628),g=s(4414);const b=function(e){var t,s,c,b,y,N,C,w,k,S,O,P,E,T,$;let{setEditingCard:R,customerCard:z,formStateHeight:F,badCard:H}=e;const{customer_id:I}=(0,o.g)(),q=(0,i.O$)(l.A,(e=>e.auth)),M=(0,i.O$)(l.A,(e=>e.instances)),D=(0,i.O$)(l.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),[B,L]=(0,r.useState)({});return d()((async()=>{const{submitted:e}=B;if(e){if(M.find((e=>e.totalPrice)))L({error:"You have active, non-free instances."}),setTimeout((()=>L({})),2e3);else{L({processing:!0});const e=await(async e=>{let{auth:t,payment_method_id:s,stripe_id:r,customer_id:n}=e;return(0,h.A)({endpoint:"removePaymentMethod",method:"POST",payload:{payment_method_id:s,stripe_id:r,customer_id:n},auth:t})})({auth:q,stripe_id:D,payment_method_id:z.id,customer_id:I});e.error?(L({error:e.message}),setTimeout((()=>L({})),2e3)):(L({success:!0}),await(0,A.A)({auth:q,customer_id:I}),L({}),setTimeout((()=>R(!1)),0))}}}),[B]),(0,g.jsx)(x.tH,{onError:(e,t)=>(0,_.A)({error:{message:e.message,componentStack:t},customer_id:I}),FallbackComponent:f.A,children:B.processing?(0,g.jsx)(v.A,{height:F,status:"processing",header:"Removing Card From Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):B.success?(0,g.jsx)(v.A,{height:F,status:"success",header:"Card Removed Successfully",subhead:"Your account is now limited to free products."}):B.error?(0,g.jsx)(v.A,{height:F,status:"error",header:B.error,subhead:"You must remove them to remove your card."}):(0,g.jsx)(u.A,{children:(0,g.jsxs)(m.A,{children:[H&&(0,g.jsx)(j.A,{}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"card number"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsxs)("div",{className:"input-static",children:["**** **** ****",null===z||void 0===z||null===(t=z.card)||void 0===t?void 0:t.last4]})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"expiration"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:`${null===z||void 0===z||null===(s=z.card)||void 0===s?void 0:s.exp_month} / ${null===z||void 0===z||null===(c=z.card)||void 0===c?void 0:c.exp_year}`})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"cvcc"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:"***"})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"country"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(b=z.billing_details)||void 0===b||null===(y=b.address)||void 0===y?void 0:y.country})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"state/province"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(N=z.billing_details)||void 0===N||null===(C=N.address)||void 0===C?void 0:C.state})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"address"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(w=z.billing_details)||void 0===w||null===(k=w.address)||void 0===k?void 0:k.line1})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"apt/unit"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(S=z.billing_details)||void 0===S||null===(O=S.address)||void 0===O?void 0:O.line2})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"city"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(P=z.billing_details)||void 0===P||null===(E=P.address)||void 0===E?void 0:E.city})}),(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)("hr",{className:"my-2"})}),(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"billing postal code"}),(0,g.jsx)(a.A,{md:"6",xs:"12",children:(0,g.jsx)("div",{className:"input-static",children:null===z||void 0===z||null===(T=z.billing_details)||void 0===T||null===($=T.address)||void 0===$?void 0:$.postal_code})})]}),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"removeCard",title:"Remove Card",disabled:B.submitted,onClick:()=>L({submitted:!0}),block:!0,className:"mt-3",color:"danger",children:"Remove Card"})}),(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"updateCard",block:!0,color:"success",className:"mt-3",onClick:()=>R(!0),children:"Update Card"})})]})]})})})};var y=s(5604),N=s(4283),C=s(1701),w=s(414);const k=function(e){let{setEditingCard:t,customerCard:s,formStateHeight:c,badCard:h}=e;const{customer_id:b}=(0,o.g)(),k=(0,i.O$)(l.A,(e=>e.auth)),S=(0,i.O$)(l.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),[O,P]=(0,r.useState)({postal_code:!1,card:!1,expire:!1,cvc:!1}),[E,T]=(0,r.useState)({}),$=(0,y.useStripe)(),R=(0,y.useElements)(),z=(0,o.Zp)(),{search:F}=(0,o.zy)(),{returnURL:H}=N.A.parse(F);return d()((async()=>{const{submitted:e,processing:s}=E;if(e&&!s){const{card:e,expire:s,cvc:r,postal_code:n,line1:a,line2:o,state:i,city:c,country:d}=O;if(e&&s&&r&&n&&a&&i&&c&&d){const e=await $.createPaymentMethod({type:"card",card:R.getElement(y.CardNumberElement),billing_details:{address:{postal_code:n,line1:a,line2:o,state:i,city:c,country:d}}});if(T({processing:!0}),e.error)T({...E,error:e.error.message}),setTimeout((()=>T({...E,error:!1})),2e3);else{const s=await(0,C.A)({auth:k,payment_method_id:e.paymentMethod.id,stripe_id:S,customer_id:b});s.error?(T({...E,error:s.message}),setTimeout((()=>T({...E,error:!1})),2e3)):(window._kmq&&window._kmq.push(["record","added credit card - billing page"]),T({success:s.message}),await(0,A.A)({auth:k,customer_id:b}),H?z(H):t(!1))}}else T({error:"All fields are required"})}}),[E]),(0,g.jsx)(x.tH,{onError:(e,t)=>(0,_.A)({error:{message:e.message,componentStack:t},customer_id:b}),FallbackComponent:f.A,children:E.processing?(0,g.jsx)(v.A,{height:c,status:"processing",header:"Adding Card To Your Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):E.success?(0,g.jsx)(v.A,{height:c,status:"success",header:"Success!",subhead:"Credit Card was successfully added to your account."}):E.error?(0,g.jsx)(v.A,{height:c,status:"error",header:E.error,subhead:"Please try again"}):(0,g.jsx)(u.A,{children:(0,g.jsxs)(m.A,{children:[h&&(0,g.jsx)(j.A,{}),(0,g.jsx)(w.A,{setFormData:P,formData:O}),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[s&&(0,g.jsx)(a.A,{sm:"6",children:(0,g.jsx)(p.A,{id:"editCard",onClick:()=>t(!1),block:!0,color:"danger",className:"mt-3",children:"Cancel"})}),(0,g.jsx)(a.A,{children:(0,g.jsx)(p.A,{id:s?"saveNewCard":"addCardToAccount",title:s?"Save New Card":"Add Card To Account",disabled:E.submitted||!O.card||!O.expire||!O.cvc||!O.postal_code||!$||!R,onClick:()=>T({submitted:!0}),block:!0,className:"mt-3",color:"success",children:s?"Save New Card":"Add Card To Account"})})]})]})})})};const S=function(){const[e,t]=(0,r.useState)(!1),s=(0,i.O$)(l.A,(e=>e.hasCard),[e]),n=(0,i.O$)(l.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),a="582px";return(0,g.jsx)("div",{className:"mt-3 mb-4",children:e||!s?(0,g.jsx)(k,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n}):(0,g.jsx)(b,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n})})};var O=s(5996);let P;const E=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.auth)),s=(0,i.O$)(l.A,(e=>e.invoices));return d()((()=>{P=new AbortController,(async e=>{let{auth:t,signal:s,customer_id:r}=e,n=null;try{n=await(0,h.A)({endpoint:"getInvoices",method:"POST",payload:{customer_id:r},signal:s,auth:t});let e=[];return Array.isArray(n)&&(e=n),l.A.update((t=>{t.invoices=e.filter((e=>e.amount_paid))}))}catch(a){return(0,_.A)({type:"lms data",status:"error",url:O.A.lms_api_url,operation:"getInvoices",request:{customer_id:r},error:{catch:a.toString()},customer_id:r})}})({auth:t,signal:P.signal,customer_id:e})}),(()=>{var e;return null===(e=P)||void 0===e?void 0:e.abort()}),[]),(0,g.jsx)(x.tH,{onError:(t,s)=>(0,_.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:f.A,children:(0,g.jsx)(u.A,{className:"my-3",children:(0,g.jsx)(m.A,{children:s?s.length?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-bold text-small",children:"date"}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text-bold text-small",children:"amount"}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text-bold text-small",children:"print"})]}),s.map((e=>(0,g.jsxs)(r.Fragment,{children:[(0,g.jsx)("hr",{className:"mt-2"}),(0,g.jsxs)(n.A,{className:"pb-2",children:[(0,g.jsx)(a.A,{xs:"6",className:"text text-nowrap",children:new Date(1e3*e.created).toLocaleString()}),(0,g.jsxs)(a.A,{xs:"3",className:"text-end text text-nowrap",children:["$",(e.total/100).toFixed(2)]}),(0,g.jsx)(a.A,{xs:"3",className:"text-end text text-nowrap",children:(0,g.jsx)("a",{title:"print invoice",href:e.hosted_invoice_url,target:"_blank",rel:"noopener noreferrer",children:(0,g.jsx)("i",{className:"fa fa-print text-purple"})})})]})]},e.id)))]}):(0,g.jsx)("div",{className:"py-5 text-center",children:"You have not yet received an invoice."}):(0,g.jsx)("div",{className:"py-5 text-center",children:(0,g.jsx)("i",{className:"fa fa-spinner fa-spin text-purple"})})})})})};var T=s(2257);const $=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.customer.stripe_coupons));return(0,g.jsx)(x.tH,{onError:(t,s)=>(0,_.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:f.A,children:(0,g.jsx)(u.A,{className:"my-3",children:(0,g.jsxs)(m.A,{children:[(0,g.jsx)(T.A,{}),null!==t&&void 0!==t&&t.length?(0,g.jsxs)("div",{className:"mt-2",children:[t.map((e=>(0,g.jsxs)(r.Fragment,{children:[(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",children:e.name}),(0,g.jsxs)(a.A,{xs:"6",className:"text-end",children:["$",parseInt(e.amount_off/100,10)]})]})]},e.id))),(0,g.jsx)("hr",{className:"my-2"}),(0,g.jsxs)(n.A,{children:[(0,g.jsx)(a.A,{xs:"6",children:(0,g.jsx)("b",{children:"Total Credit"})}),(0,g.jsx)(a.A,{xs:"6",className:"text-end",children:(0,g.jsxs)("b",{children:["$",t.reduce(((e,t)=>e+parseInt(t.amount_off/100,10)),0)]})})]})]}):null]})})})};var R=s(5345),z=s(3906);const F=function(){const{customer_id:e}=(0,o.g)(),t=(0,i.O$)(l.A,(e=>e.auth)),s=(0,i.O$)(l.A,(e=>e.products)),c=(0,i.O$)(l.A,(e=>e.regions)),u=(0,i.O$)(l.A,(e=>e.subscriptions)),m=(0,i.O$)(l.A,(e=>e.instances)),p=(0,i.O$)(l.A,(e=>e.customer.is_unpaid));return(0,r.useEffect)((()=>{(0,A.A)({auth:t,customer_id:e})}),[]),d()((()=>{t&&s&&c&&u&&e&&(null===m||void 0===m||!m.length)&&(0,z.A)({auth:t,customer_id:e,products:s,regions:c,subscriptions:u,instanceCount:null===m||void 0===m?void 0:m.length})}),[t,s,c,e,u,m]),(0,g.jsxs)(n.A,{children:[p&&(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)(R.A,{})}),(0,g.jsxs)(a.A,{md:"6",children:[(0,g.jsx)("span",{className:"floating-card-header",children:"card"}),(0,g.jsx)(S,{})]}),(0,g.jsxs)(a.A,{md:"6",children:[(0,g.jsx)("span",{className:"floating-card-header",children:"coupons"}),(0,g.jsx)($,{}),(0,g.jsx)("br",{}),(0,g.jsx)("span",{className:"floating-card-header",children:"invoices"}),(0,g.jsx)(E,{})]})]})}},5887:(e,t,s)=>{s.d(t,{A:()=>n});s(9950);var r=s(4414);const n=function(){return(0,r.jsxs)("div",{className:"text-danger",children:[(0,r.jsx)("i",{children:"Your most recent card payment failed. Please update your card below."}),(0,r.jsx)("hr",{className:"mt-3 mb-2"})]})}},2257:(e,t,s)=>{s.d(t,{A:()=>g});var r=s(9950),n=s(7176),a=s(6114),o=s(5488),i=s(3452),c=s(9163),d=s.n(c),l=s(6713),u=s(9435),m=s(5201),p=s(4283),x=s(5553),h=s(2714);var v=s(9519),j=s(3150),A=s(3628),f=s(4414);let _;const g=function(){const{customer_id:e}=(0,m.g)(),{search:t}=(0,m.zy)(),{code:s}=p.A.parse(t),c=(0,l.O$)(x.A,(e=>e.auth)),[g,b]=(0,r.useState)({coupon_code:s||""}),[y,N]=(0,r.useState)({}),[C,w]=(0,r.useState)(!1);return d()((async()=>{if(y.submitted){const{coupon_code:t}=g;if(t){_=new AbortController;const s=await(async e=>{let{auth:t,customer_id:s,coupon_code:r}=e;return(0,h.A)({endpoint:"addCoupon",method:"POST",auth:t,payload:{customer_id:s,coupon_code:r,user_id:t.user_id}})})({auth:c,customer_id:e,coupon_code:t});!1===s.result||s.error?N({error:s.message}):(window._kmq&&window._kmq.push(["record","user added coupon"]),await(0,v.A)({auth:c,customer_id:e}),C&&(b({coupon_code:""}),N({})))}else N({error:"Please enter a valid coupon code"})}}),(()=>{var e;return null===(e=_)||void 0===e?void 0:e.abort()}),[y]),d()((()=>{y.submitted||N({})}),[g]),d()((()=>{w(!0),g.coupon_code&&N({submitted:!0})}),(()=>w(!1)),[]),(0,f.jsx)(u.tH,{onError:(t,s)=>(0,A.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:j.A,children:(0,f.jsxs)(n.A,{children:[(0,f.jsx)(a.A,{md:"6",children:(0,f.jsx)(o.A,{id:"coupon_code",className:"mb-2",type:"text",value:g.coupon_code,invalid:!!y.error,disabled:y.submitted,placeholder:"coupon code",onChange:e=>b({coupon_code:e.target.value.toUpperCase()})})}),(0,f.jsx)(a.A,{md:"6",children:(0,f.jsx)(i.A,{id:"addCoupon",color:"success",disabled:y.submitted,block:!0,onClick:()=>N({submitted:!0}),children:y.submitted?(0,f.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,f.jsx)("span",{children:"Add Coupon"})})}),(0,f.jsxs)(a.A,{xs:"12",className:"text-center text-danger text-small",children:[y.error,"\xa0"]})]})})}},414:(e,t,s)=>{s.d(t,{A:()=>v});var r=s(9950),n=s(7176),a=s(6114),o=s(5488),i=s(5604),c=s(5285),d=s(6713),l=s(5201),u=s(9435);var m=s(5553),p=s(3150),x=s(3628),h=s(4414);const v=function(e){let{setFormData:t,formData:s}=e;const{customer_id:v}=(0,l.g)(),[j,A]=(0,r.useState)({}),f=(e=>{let{theme:t}=e;return{style:{base:{iconColor:"#403b8a",color:"dark"===t?"#ffffff":"#212121",fontWeight:100,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans", Arial, Helvetica, Verdana, Sans-Serif',fontSize:"14px",fontSmoothing:"antialiased","::placeholder":{color:"#bcbcbc"}},invalid:{iconColor:"#ea4c89",color:"#ea4c89"}}}})({theme:(0,d.O$)(m.A,(e=>e.theme))});return(0,h.jsx)(u.tH,{onError:(e,t)=>(0,x.A)({error:{message:e.message,componentStack:t},customer_id:v}),FallbackComponent:p.A,children:(0,h.jsxs)(n.A,{children:[(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"card number"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.cardError?"error":""),children:(0,h.jsx)(i.CardNumberElement,{options:f,id:"ccCardNumber",onChange:e=>{var r;A({...j,cardError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,card:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"expiration"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.expError?"error":""),children:(0,h.jsx)(i.CardExpiryElement,{options:f,id:"ccExpire",onChange:e=>{var r;A({...j,expError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,expire:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"cvcc"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)("div",{className:"fake-input "+(j.cvcError?"error":""),children:(0,h.jsx)(i.CardCvcElement,{id:"ccCVC",options:f,onChange:e=>{var r;A({...j,cvcError:null===(r=e.error)||void 0===r?void 0:r.message}),t({...s,cvc:e.complete})}})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"country"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(c.wP,{id:"ccCountry",valueType:"short",value:s.country,priorityOptions:["CA","US","GB"],defaultOptionLabel:"select your country",onChange:e=>t({...s,country:e})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"state/province"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(c.mM,{id:"ccRegion",blankOptionLabel:"select country first",defaultOptionLabel:"select state / province",valueType:"short",countryValueType:"short",country:s.country,value:s.state,onChange:e=>t({...s,state:e})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"address"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccLine1",onChange:e=>t({...s,line1:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"apt/unit"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccApt",onChange:e=>t({...s,line2:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"city"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccCity",onChange:e=>t({...s,city:e.target.value})})}),(0,h.jsx)(a.A,{xs:"12",children:(0,h.jsx)("hr",{className:"my-2"})}),(0,h.jsx)(a.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"billing postal code"}),(0,h.jsx)(a.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,h.jsx)(o.A,{id:"ccPostalCode",onChange:e=>t({...s,postal_code:e.target.value})})})]})})}},8188:(e,t,s)=>{s.d(t,{A:()=>o});s(9950);var r=s(4084),n=s(8156),a=s(4414);const o=function(e){let{header:t,subhead:s=" ",height:o,status:i,className:c}=e;return(0,a.jsx)(r.A,{className:`form-status ${c}`,children:(0,a.jsxs)(n.A,{className:"text-center",style:{height:o},children:[(0,a.jsx)("div",{className:"text-bold",children:t}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsx)("i",{className:"fa fa-lg "+("processing"===i?"fa-spinner fa-spin text-purple":"success"===i?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,a.jsx)("div",{className:"text-grey",children:s})]})})}},5345:(e,t,s)=>{s.d(t,{A:()=>o});s(9950);var r=s(4084),n=s(8156),a=s(4414);const o=function(){return(0,a.jsx)(r.A,{color:"danger",className:"mb-4",children:(0,a.jsx)(n.A,{className:"text-center text-danger",children:"This Organization Will Not Be Billed"})})}},1701:(e,t,s)=>{s.d(t,{A:()=>n});var r=s(2714);const n=async e=>{let{auth:t,payment_method_id:s,stripe_id:n,customer_id:a}=e;return(0,r.A)({endpoint:"addPaymentMethod",method:"POST",payload:{payment_method_id:s,stripe_id:n,customer_id:a},auth:t})}},9519:(e,t,s)=>{s.d(t,{A:()=>c});var r=s(2714),n=s(5553),a=s(3628),o=s(5996),i=s(7596);const c=async e=>{let{auth:t,customer_id:s}=e,c=null;try{var d;return c=await(0,r.A)({endpoint:"getCustomer",method:"POST",payload:{customer_id:s},auth:t}),(0,i.A)({auth:t,customer_id:s,stripe_id:null===(d=c)||void 0===d?void 0:d.stripe_id}),c.error||n.A.update((e=>{var t;e.customer={...c,customer_id:s},e.hasCard=null===(t=c.stripe_payment_methods)||void 0===t?void 0:t[0]})),c}catch(l){return(0,a.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"getCustomer",request:{customer_id:s},error:{catch:l.toString()},customer_id:s})}}},3906:(e,t,s)=>{s.d(t,{A:()=>d});var r=s(2714),n=s(5553),a=s(4549);const o=e=>{let{is_local:t,wavelength_zone_id:s,cloud_provider:r}=e;switch(!0){case s:return"wavelength_compute";case t:return"local_compute";case"akamai"===r:return"akamai_compute";default:return"cloud_compute"}};var i=s(3628),c=s(5996);const d=async e=>{let{auth:t,customer_id:s,products:d,regions:l,subscriptions:u,instanceCount:m=0}=e,p=null;try{if(p=await(0,r.A)({endpoint:"getInstances",method:"POST",payload:{customer_id:s,user_id:t.user_id},auth:t}),Array.isArray(p)){const e=p.map((e=>{const t=(e=>{let{instance:t,products:s,regions:r,subscriptions:n}=e;try{var i,c;const e=t.compute_subscription_id?n[o(t)]:s[o(t)],d=null===e||void 0===e?void 0:e.find((e=>e.value.stripe_plan_id===t.stripe_plan_id&&(!t.compute_subscription_id||e.value.compute_subscription_id===t.compute_subscription_id))),l=t.storage_subscription_id?n.cloud_storage:s.cloud_storage,u=!t.is_local&&(null===l||void 0===l?void 0:l.find((e=>e.value.data_volume_size===t.data_volume_size&&e.value.stripe_storage_plan_id===t.stripe_storage_plan_id&&(!t.storage_subscription_id||e.value.storage_subscription_id===t.storage_subscription_id)))),m=parseFloat((null===d||void 0===d||null===(i=d.value)||void 0===i?void 0:i.compute_price)||0)+parseFloat((null===u||void 0===u||null===(c=u.value)||void 0===c?void 0:c.storage_price)||0),p=m?`$${(0,a.A)(m.toFixed(2))}`:"FREE",x=t.compute_subscription_id&&t.storage_subscription_id?"PREPAID":m?`${p}/${d.value.compute_interval}`:"FREE",h=!t.is_local&&r.find((e=>e.value===t.instance_region));return{compute:null===d||void 0===d?void 0:d.value,storage:null===u||void 0===u?void 0:u.value,totalPrice:m,totalPriceString:p,totalPriceStringWithInterval:x,region:h}}catch(d){return console.log(d)}})({instance:e,products:d,regions:l,subscriptions:u});return{...e,...t}})),t=e.sort(((e,t)=>e.instance_name>t.instance_name?1:-1));return n.A.update((e=>{e.instances=t})),t}return!m&&n.A.update((e=>{e.instances=[]}))}catch(x){return(0,i.A)({type:"lms data",status:"error",url:c.A.lms_api_url,operation:"getInstances",request:{customer_id:s},error:{catch:x.toString()},customer_id:s})}}},7596:(e,t,s)=>{s.d(t,{A:()=>d});var r=s(2714),n=s(5553),a=s(3628),o=s(2434),i=s(2696),c=s(5996);const d=async e=>{let{auth:t,customer_id:s,stripe_id:d}=e;try{const e=await(0,r.A)({endpoint:"getPrepaidSubscriptions",method:"POST",payload:{customer_id:s,stripe_id:d},auth:t});return!e.error&&n.A.update((t=>{t.subscriptions={cloud_storage:(0,i.A)(e.cloud_storage||[]),cloud_compute:(0,o.A)(e.cloud_compute||[]),wavelength_compute:(0,o.A)(e.wavelength_compute||[]),local_compute:(0,o.A)(e.local_compute||[])}}))}catch(l){return(0,a.A)({type:"lms data",status:"error",url:c.A.lms_api_url,operation:"getPrepaidSubscriptions",error:{catch:l.toString()}})}}},5488:(e,t,s)=>{s.d(t,{A:()=>_});var r=s(9950),n=s(1942),a=s.n(n),o=s(8738),i=s.n(o),c=s(1497);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}var l=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},u.apply(this,arguments)}function m(e,t){if(null==e)return{};var s,r,n=function(e,t){if(null==e)return{};var s,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)s=a[r],t.indexOf(s)>=0||(n[s]=e[s]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)s=a[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function p(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function h(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,r=j(e);if(t){var n=j(this).constructor;s=Reflect.construct(r,arguments,n)}else s=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,s)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}var A={children:a().node,type:a().string,size:a().oneOfType([a().number,a().string]),bsSize:a().string,valid:a().bool,invalid:a().bool,tag:c.Wx,innerRef:a().oneOfType([a().object,a().func,a().string]),plaintext:a().bool,addon:a().bool,className:a().string,cssModule:a().object},f=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(o,e);var t,s,n,a=h(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=a.call(this,e)).getRef=t.getRef.bind(v(t)),t.focus=t.focus.bind(v(t)),t}return t=o,(s=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,s=e.cssModule,n=e.type,a=void 0===n?"text":n,o=e.bsSize,d=e.valid,p=e.invalid,x=e.tag,h=e.addon,v=e.plaintext,j=e.innerRef,A=m(e,l),f=["switch","radio","checkbox"].indexOf(a)>-1,_="select"===a,g="range"===a,b=x||(_||"textarea"===a?a:"input"),y="form-control";v?(y="".concat(y,"-plaintext"),b=x||"input"):g?y="form-range":_?y="form-select":f&&(y=h?null:"form-check-input"),A.size&&/\D/g.test(A.size)&&((0,c.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=A.size,delete A.size);var N=(0,c.qO)(i()(t,p&&"is-invalid",d&&"is-valid",!!o&&(_?"form-select-".concat(o):"form-control-".concat(o)),y),s);return("input"===b||x&&"function"===typeof x)&&(A.type="switch"===a?"checkbox":a),A.children&&!v&&"select"!==a&&"string"===typeof b&&"select"!==b&&((0,c.mc)('Input with a type of "'.concat(a,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete A.children),r.createElement(b,u({},A,{ref:j,className:N,"aria-invalid":p}))}}])&&p(t.prototype,s),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component);f.propTypes=A;const _=f}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[521],{958:(e,s,a)=>{a.r(s),a.d(s,{default:()=>D});var t=a(9950),r=a(7176),i=a(6114),n=a(6713),l=a(135),o=a(1345),c=a(5553),d=a(3452),u=a(4084),m=a(8156),h=a(7348),g=a(4343),x=a(4414);const p={tableData:!1,dataTableColumns:[],filtered:[],sorted:[{id:"email",desc:!1}],page:0,loading:!1,totalPages:1,pageSize:20,autoRefresh:!1,showFilter:!1,lastUpdate:!1};const j=function(){var e,s;const{customer_id:a}=(0,o.g)(),l=(0,h.MW)(),j=(0,o.Zp)(),[A,b]=(0,t.useState)(p),f=null===(e=A.sorted[0])||void 0===e?void 0:e.id,v=null===(s=A.sorted[0])||void 0===s?void 0:s.desc,_=(0,n.O$)(c.A,(e=>e.auth)),N=(0,n.O$)(c.A,(e=>e.users)),y=[{Header:"email address",accessor:"email"},{Header:"status",accessor:"orgs[0].status"}],C=(0,t.useCallback)((e=>{_.user_id===e?l.error("Edit your own profile by clicking the user icon in the top nav"):j(`/o/${a}/users/${e}`)}),[_.user_id,a]);return(0,t.useEffect)((()=>{if(A.tableData.length&&f){const e=[...[...A.tableData]].sort(((e,s)=>e[f]>s[f]&&v?-1:e[f]>s[f]||v?1:-1));b({...A,tableData:e})}}),[f,v]),(0,t.useEffect)((()=>{N&&y&&b({...A,tableData:N,dataTableColumns:y,totalPages:Math.ceil((N.length||A.pageSize)/A.pageSize)})}),[N,b,A.pageSize]),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(r.A,{className:"floating-card-header",children:[(0,x.jsx)(i.A,{children:"existing org users"}),(0,x.jsx)(i.A,{className:"text-end",children:(0,x.jsx)(d.A,{color:"link",tabIndex:"0",title:"Filter Users",className:"me-3",onClick:()=>b({...A,filtered:A.showFilter?[]:A.filtered,showFilter:!A.showFilter}),children:(0,x.jsx)("i",{className:"fa fa-search"})})})]}),(0,x.jsx)(u.A,{className:"my-3",children:(0,x.jsx)(m.A,{className:"react-table-holder",children:(0,x.jsx)(g.A,{columns:A.dataTableColumns,data:A.tableData,currentPage:A.page,pageSize:A.pageSize,totalPages:A.totalPages,showFilter:A.showFilter,sorted:A.sorted,loading:!N||A.loading&&!A.autoRefresh,onFilteredChange:e=>b({...A,filtered:e}),onSortedChange:e=>b({...A,sorted:e}),onPageChange:e=>b({...A,pageSize:e}),onPageSizeChange:e=>b({...A,page:0,pageSize:e}),onRowClick:e=>C(e.user_id)})})})]})};var A=a(9163),b=a.n(A),f=a(9435),v=a(1110),_=a(2714);const N=async e=>{let{auth:s,customer_id:a,user_id:t,user_id_owner:r,status:i}=e;return(0,_.A)({endpoint:"updateOrgUser",method:"POST",payload:{customer_id:a,user_id:t,user_id_owner:r,status:i},auth:s})};var y=a(3628),C=a(5996);const w=async e=>{let{auth:s,customer_id:a}=e,t=null;try{t=await(0,_.A)({endpoint:"getUsers",method:"POST",payload:{customer_id:a},auth:s});let e=[];return Array.isArray(t)&&(e=[...t].sort(((e,s)=>e.email>s.email?1:-1))),c.A.update((s=>{s.users=e}))}catch(r){return(0,y.A)({type:"lms data",status:"error",url:C.A.lms_api_url,operation:"getUsers",request:{customer_id:a},error:{catch:r.toString()},customer_id:a})}};var S=a(3150);const P=function(){const{user_id:e}=(0,o.g)(),{customer_id:s}=(0,o.g)(),a=(0,h.MW)(),l=(0,n.O$)(c.A,(e=>e.auth)),u=(0,n.O$)(c.A,(s=>s.users&&s.users.find((s=>s.user_id===e))),[e]),[m,g]=(0,t.useState)(!1),[p,j]=(0,t.useState)({});return b()((()=>{var e,a;g(u&&(null===(e=u.orgs)||void 0===e||null===(a=e.find((e=>{var a;return(null===(a=e.customer_id)||void 0===a?void 0:a.toString())===s})))||void 0===a?void 0:a.status))}),[u,s]),b()((async()=>{const{submitted:t,processing:r}=p;if(t&&!r){const t="declined"===m?"invited":"accepted"===m?"owner":"owner"===m?"accepted":"invited";g(t);const r=await N({auth:l,user_id:e,user_id_owner:l.user_id,customer_id:s,status:t});r.error?(a.error(r.message),j({})):(a.success(`User role updated to ${"accepted"===t?"user":t}`),j({}),w({auth:l,customer_id:s}))}}),[p]),(0,x.jsx)(f.tH,{onError:(e,a)=>(0,y.A)({error:{message:e.message,componentStack:a},customer_id:s}),FallbackComponent:S.A,children:["invited","declined"].includes(m)?"declined"===m?(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["User declined invitation to join",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"reinvite them by clicking this button"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"reinviteOrganizationUser",block:!0,color:"success",onClick:()=>j({submitted:!0}),disabled:p.submitted,children:p.submitted?(0,x.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,x.jsx)("span",{children:"Reinvite User"})})})]}):(0,x.jsx)(r.A,{children:(0,x.jsxs)(i.A,{className:"py-1",children:["User has not yet accepted invitation",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"You must wait for them to accept before modifying them"})]})}):(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["Is Owner",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"can invite other users, add instances"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)("div",{className:"role-toggle-holder",children:(0,x.jsx)(v.A,{checked:"owner"===m,onChange:()=>j({submitted:!0})})})})]})})};var k=a(5488),E=a(5269);const O=function(){const{user_id:e,customer_id:s}=(0,o.g)(),{pathname:a}=(0,o.zy)(),l=(0,o.Zp)(),u=(0,h.MW)(),[m,g]=(0,t.useState)({}),[p,j]=(0,t.useState)({}),A=(0,n.O$)(c.A,(e=>e.auth));return(0,x.jsx)(f.tH,{onError:(e,a)=>(0,y.A)({error:{message:e.message,componentStack:a},customer_id:s}),FallbackComponent:S.A,children:(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"4",className:"py-1",children:["Delete Org User",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"user will be removed from this organization"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(k.A,{id:"delete_username",onChange:e=>g({delete_username:e.target.value}),type:"text",className:"text-center",title:"confirm username to delete",placeholder:'Enter "DELETE" here to enable deletion.',value:m.delete_username||""})}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"deleteUser",block:!0,color:"danger",onClick:async()=>{if("DELETE"!==m.delete_username)u.error("Please type DELETE to delete this user");else{j({submitted:!0});const t=await N({auth:A,user_id:e,user_id_owner:A.user_id,customer_id:s,status:"removed"});-1!==t.message.indexOf("successfully")?(u.success(t.message),E.A.update((e=>{e.lastUpdate=Date.now()})),j({}),setTimeout((()=>l(a.replace(`/${e}`,""))),100)):(u.error(t.message),j({}))}},disabled:"DELETE"!==m.delete_username||p.submitted,children:p.submitted?(0,x.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,x.jsx)("span",{children:"Delete User"})})})]})})};const z=function(e){let{userEmail:s}=e;const{user_id:a}=(0,o.g)(),{pathname:t}=(0,o.zy)(),n=(0,o.Zp)();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"floating-card-header",children:["existing org users > edit > ",(0,x.jsx)("b",{children:s})]}),(0,x.jsx)(u.A,{className:"my-3",children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)(P,{}),(0,x.jsx)("hr",{className:"my-3"}),(0,x.jsx)(O,{}),(0,x.jsx)("hr",{className:"my-3"}),(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["Return to User List",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"make no further changes to this user"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"returnToOrganizationUserList",block:!0,color:"grey",onClick:()=>n(t.replace(`/${a}`,"")),children:"Return to User List"})})]})]})})]})};var F=a(1440),U=a(8188);const T=function(e){let{refreshUsers:s,userEmails:a}=e;const r=(0,o.Zp)(),{customer_id:i}=(0,o.g)(),l=(0,n.O$)(c.A,(e=>e.auth)),[h,g]=(0,t.useState)({}),[p,j]=(0,t.useState)({}),A="132px";return b()((async()=>{const{email:e}=p,{submitted:t}=h;if(t){if((0,F.A)(e))if(a&&a.includes(e))g({error:"This user has already been invited"});else if(e===l.email)g({error:"You cannot invite yourself"});else{g({processing:!0});const a=await(async e=>{let{auth:s,email:a,customer_id:t,login_domain:r=window.location.host}=e;return(0,_.A)({endpoint:"addUser",method:"POST",payload:{email:a,customer_id:t,login_domain:r,user_id:s.user_id},auth:s})})({auth:l,email:e,customer_id:i});a.error?g({error:a.message}):(window._kmq&&window._kmq.push(["record","added org user"]),s(),g({success:a.message}))}else g({error:"Please enter a valid email"});setTimeout((()=>j({})),2e3)}}),[h]),b()((()=>g({})),[p]),(0,x.jsx)(f.tH,{onError:(e,s)=>(0,y.A)({error:{message:e.message,componentStack:s},customer_id:i}),FallbackComponent:S.A,children:(0,x.jsx)("div",{className:"mt-3 mb-4",children:l.email_bounced?(0,x.jsx)(u.A,{children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)("b",{children:"Unable to Add New Org User"}),(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),"Your email address seems to be unreachable. Please update it to ensure billing, upgrade, and other critical system announcements reach you.",(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),(0,x.jsx)(d.A,{id:"updateEmail",onClick:()=>r("/profile"),title:"Update My Email",block:!0,className:"mt-3",color:"danger",children:"Update My Email"})]})}):h.processing?(0,x.jsx)(U.A,{height:A,status:"processing",header:"Adding User",subhead:"The Account Airedale Is A Good Boy"}):h.success?(0,x.jsx)(U.A,{height:A,status:"success",header:"Success!",subhead:h.success}):h.error?(0,x.jsx)(U.A,{height:A,status:"error",header:h.error,subhead:"Please try again"}):(0,x.jsx)(u.A,{children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)(k.A,{id:"email",type:"text",className:"mb-3 text-center",name:"email",placeholder:"email address",onChange:e=>j({...p,email:e.target.value.toLowerCase()}),disabled:h.submitted}),(0,x.jsx)(d.A,{id:"addOrganizationUser",color:"success",block:!0,onClick:()=>g({submitted:!0}),disabled:h.submitted,children:"Add Org User"})]})})})})};var $=a(9519);const D=function(){const{user_id:e,customer_id:s}=(0,o.g)(),a=(0,n.O$)(c.A,(e=>e.auth)),d=(0,n.O$)(c.A,(e=>e.users)),u=e&&d&&d.find((s=>s.user_id===e)),m=(0,t.useCallback)((()=>{a&&s&&w({auth:a,customer_id:s})}),[a,s]);return(0,t.useEffect)((()=>{m(),(0,$.A)({auth:a,customer_id:s})}),[]),(0,l.A)((()=>m()),C.A.refresh_content_interval),(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xl:"3",lg:"4",md:"5",xs:"12",children:[(0,x.jsx)("span",{className:"floating-card-header",children:"add org user"}),(0,x.jsx)(T,{refreshUsers:m,userEmails:d&&d.map((e=>"declined"!==e.orgs[0].status&&e))})]}),(0,x.jsx)(i.A,{xl:"9",lg:"8",md:"7",xs:"12",className:"pb-5",children:u?(0,x.jsx)(z,{userEmail:u.email}):(0,x.jsx)(j,{refreshUsers:m})})]})}},4343:(e,s,a)=>{a.d(s,{A:()=>f});var t=a(9950),r=a(2043),i=a(5488),n=a(9435),l=a(7176),o=a(6114),c=a(4414);const d=e=>{let{headerGroups:s,onSortedChange:a,sorted:t,showFilter:r,dynamicAttributesFromDataTable:i,tableDescriptionAttributes:n}=e;const d=e=>{let s=!1;return n.forEach((a=>{a.attribute===e&&(a.is_primary_key||a.indexed)&&(s=!0)})),s};return s.map((e=>{const{key:s,...n}=e.getHeaderGroupProps();return(0,c.jsxs)("div",{...n,children:[(0,c.jsx)(l.A,{className:"header g-0",children:e.headers.map((e=>{var s,r;return(0,c.jsx)(o.A,{onClick:()=>{var s,r;i&&!i.includes(e.id)&&d(e.id)&&a([{id:e.id,desc:(null===(s=t[0])||void 0===s?void 0:s.id)===e.id&&!(null!==(r=t[0])&&void 0!==r&&r.desc)}])},className:`${(null===(s=t[0])||void 0===s?void 0:s.id)===e.id?"sorted":""} ${null!==(r=t[0])&&void 0!==r&&r.desc?"desc":"asc"} ${-1!==e.id.indexOf("hdb-narrow")?"action":""} px-1 ${i&&!i.includes(e.id)&&d(e.id)?"":"disabled-column"}`,children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),r&&(0,c.jsx)(l.A,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(o.A,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]},s)}))};var u=a(3452);const m=function(e){let{page:s,pageSize:a,totalPages:t,onPageChange:r,onPageSizeChange:n,loading:d}=e;return(0,c.jsxs)(l.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(u.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>r(s-1),disabled:!t||0===s,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(i.A,{className:"mb-2",type:"number",value:s+1,min:1,max:t,onChange:e=>r(e.target.value-1)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",d?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):t]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(i.A,{className:"mb-2",type:"select",value:a,onChange:e=>n(e.target.value),children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(u.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>r(s+1),disabled:!t||s+1===t,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const h=function(e){let{previousPage:s,canPreviousPage:a,pageIndex:t,gotoPage:r,setPageSize:n,pageCount:d,nextPage:m,canNextPage:h,loading:g}=e;return(0,c.jsxs)(l.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(u.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:s,disabled:!d||!a,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(i.A,{className:"mb-2",type:"number",value:t+1||1,min:1,max:d,onChange:e=>r(e.target.value?Number(e.target.value)-1:0)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",g?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):d]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(i.A,{className:"mb-2",type:"select",onChange:e=>{r(0),setTimeout((()=>n(e.target.value)),1e3)},children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(u.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:m,disabled:!d||!h,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const g=function(e){let{prepareRow:s,row:a,onRowClick:t=!1}=e;return s(a),(0,c.jsx)(l.A,{onClick:()=>t&&t(a.original),className:"g-0",children:a.cells.map((e=>(0,c.jsx)(o.A,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},`${e.row.id}-${e.column.id}`)))})};var x=a(3628),p=a(3150);function j(e){let{value:s}=e;return(0,c.jsx)("div",{className:"text-renderer",children:s})}function A(e){let{src:s}=e;const[a,r]=(0,t.useState)(!1),[i,n]=(0,t.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[(0,c.jsx)("i",{className:"fa fa-image"}),a&&i?(0,c.jsxs)("div",{className:"preview-image no-image",children:[(0,c.jsx)("i",{className:"fa fa-ban text-danger"}),(0,c.jsx)("div",{className:"mt-2",children:"image failed to load"})]}):a?(0,c.jsx)("img",{onError:n,alt:s,src:s,className:"preview-image"}):null]})}const b={Filter:e=>{let{column:{filterValue:s,setFilter:a}}=e;return(0,c.jsx)(i.A,{type:"text",value:s||"",onChange:e=>a(e.target.value||void 0)})},Cell:e=>{let{value:s}=e;return(e=>{switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return(0,c.jsx)(j,{value:JSON.stringify(e)});case"[object Boolean]":return(0,c.jsx)(j,{value:e?"true":"false"});case"[object String]":return(s=e)&&(s.match(/^https?.*\.(jpeg|jpg|gif|png)$/)||-1!==s.indexOf("data:image"))?(0,c.jsx)(A,{src:e}):(0,c.jsx)(j,{value:e});default:return(0,c.jsx)(j,{value:e})}var s})(s)}};const f=function(e){let{columns:s,data:a,error:i,currentPage:l,pageSize:o,totalPages:u,onFilteredChange:j,onSortedChange:A,onPageChange:f,onPageSizeChange:v,showFilter:_,onRowClick:N,sorted:y,loading:C,dynamicAttributesFromDataTable:w,tableDescriptionAttributes:S,manual:P=!1}=e;const{headerGroups:k,page:E,rows:O,prepareRow:z,state:F,setAllFilters:U,canPreviousPage:T,canNextPage:$,pageOptions:D,pageCount:R,gotoPage:L,nextPage:H,previousPage:M,setPageSize:I}=(0,r.useTable)({columns:s,data:a,defaultColumn:b,onFilteredChange:j,onSortedChange:A,onPageChange:f,onPageSizeChange:v,onRowClick:N,manualPagination:P,manualFilters:P,initialState:{pageIndex:l,pageSize:o}},r.useFilters,r.usePagination),[G,q]=(0,t.useState)(!0),Z=P||!E.length?O:E;return(0,t.useEffect)((()=>{!_&&F.filters.length?U([]):j(F.filters)}),[F.filters,_]),(0,t.useEffect)((()=>{setTimeout((()=>q(!1)),100)}),[null===Z||void 0===Z?void 0:Z.length]),(0,c.jsxs)(n.tH,{onError:(e,s)=>(0,x.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:p.A,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(d,{headerGroups:k,tableDescriptionAttributes:S,dynamicAttributesFromDataTable:w,onSortedChange:A,sorted:y,showFilter:_}),C||G?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):Z.length?Z.map((e=>(0,c.jsx)(g,{row:e,prepareRow:z,onRowClick:N},e.id))):(0,c.jsxs)("div",{className:"centered text-center",children:[(0,c.jsx)("i",{className:"fa fa-exclamation-triangle text-danger"}),(0,c.jsx)("div",{className:"mt-2 text-darkgrey",children:i?`Error loading data: ${i}`:"no records"})]})]}),P?(0,c.jsx)(m,{page:l,pageSize:o,totalPages:u,onPageChange:f,onPageSizeChange:v,loading:C}):(0,c.jsx)(h,{previousPage:M,pageSize:o,canPreviousPage:T,pageIndex:F.pageIndex,pageOptions:D,gotoPage:L,setPageSize:I,pageCount:R,nextPage:H,canNextPage:$,loading:C})]})}},8188:(e,s,a)=>{a.d(s,{A:()=>n});a(9950);var t=a(4084),r=a(8156),i=a(4414);const n=function(e){let{header:s,subhead:a=" ",height:n,status:l,className:o}=e;return(0,i.jsx)(t.A,{className:`form-status ${o}`,children:(0,i.jsxs)(r.A,{className:"text-center",style:{height:n},children:[(0,i.jsx)("div",{className:"text-bold",children:s}),(0,i.jsx)("div",{className:"py-4",children:(0,i.jsx)("i",{className:"fa fa-lg "+("processing"===l?"fa-spinner fa-spin text-purple":"success"===l?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,i.jsx)("div",{className:"text-grey",children:a})]})})}},9519:(e,s,a)=>{a.d(s,{A:()=>o});var t=a(2714),r=a(5553),i=a(3628),n=a(5996),l=a(7596);const o=async e=>{let{auth:s,customer_id:a}=e,o=null;try{var c;return o=await(0,t.A)({endpoint:"getCustomer",method:"POST",payload:{customer_id:a},auth:s}),(0,l.A)({auth:s,customer_id:a,stripe_id:null===(c=o)||void 0===c?void 0:c.stripe_id}),o.error||r.A.update((e=>{var s;e.customer={...o,customer_id:a},e.hasCard=null===(s=o.stripe_payment_methods)||void 0===s?void 0:s[0]})),o}catch(d){return(0,i.A)({type:"lms data",status:"error",url:n.A.lms_api_url,operation:"getCustomer",request:{customer_id:a},error:{catch:d.toString()},customer_id:a})}}},7596:(e,s,a)=>{a.d(s,{A:()=>c});var t=a(2714),r=a(5553),i=a(3628),n=a(2434),l=a(2696),o=a(5996);const c=async e=>{let{auth:s,customer_id:a,stripe_id:c}=e;try{const e=await(0,t.A)({endpoint:"getPrepaidSubscriptions",method:"POST",payload:{customer_id:a,stripe_id:c},auth:s});return!e.error&&r.A.update((s=>{s.subscriptions={cloud_storage:(0,l.A)(e.cloud_storage||[]),cloud_compute:(0,n.A)(e.cloud_compute||[]),wavelength_compute:(0,n.A)(e.wavelength_compute||[]),local_compute:(0,n.A)(e.local_compute||[])}}))}catch(d){return(0,i.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"getPrepaidSubscriptions",error:{catch:d.toString()}})}}},5269:(e,s,a)=>{a.d(s,{A:()=>t});const t=new(a(6713).il)({})},1440:(e,s,a)=>{a.d(s,{A:()=>t});const t=e=>/^\S+@\S+\.\S+$/.test(String(e).toLowerCase())}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[521],{958:(e,s,a)=>{a.r(s),a.d(s,{default:()=>D});var t=a(9950),r=a(7176),i=a(6114),n=a(6713),l=a(135),o=a(5201),c=a(5553),d=a(3452),u=a(4084),m=a(8156),h=a(7348),g=a(4343),x=a(4414);const p={tableData:!1,dataTableColumns:[],filtered:[],sorted:[{id:"email",desc:!1}],page:0,loading:!1,totalPages:1,pageSize:20,autoRefresh:!1,showFilter:!1,lastUpdate:!1};const j=function(){var e,s;const{customer_id:a}=(0,o.g)(),l=(0,h.MW)(),j=(0,o.Zp)(),[A,b]=(0,t.useState)(p),f=null===(e=A.sorted[0])||void 0===e?void 0:e.id,v=null===(s=A.sorted[0])||void 0===s?void 0:s.desc,_=(0,n.O$)(c.A,(e=>e.auth)),N=(0,n.O$)(c.A,(e=>e.users)),y=[{Header:"email address",accessor:"email"},{Header:"status",accessor:"orgs[0].status"}],C=(0,t.useCallback)((e=>{_.user_id===e?l.error("Edit your own profile by clicking the user icon in the top nav"):j(`/o/${a}/users/${e}`)}),[_.user_id,a]);return(0,t.useEffect)((()=>{if(A.tableData.length&&f){const e=[...[...A.tableData]].sort(((e,s)=>e[f]>s[f]&&v?-1:e[f]>s[f]||v?1:-1));b({...A,tableData:e})}}),[f,v]),(0,t.useEffect)((()=>{N&&y&&b({...A,tableData:N,dataTableColumns:y,totalPages:Math.ceil((N.length||A.pageSize)/A.pageSize)})}),[N,b,A.pageSize]),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(r.A,{className:"floating-card-header",children:[(0,x.jsx)(i.A,{children:"existing org users"}),(0,x.jsx)(i.A,{className:"text-end",children:(0,x.jsx)(d.A,{color:"link",tabIndex:"0",title:"Filter Users",className:"me-3",onClick:()=>b({...A,filtered:A.showFilter?[]:A.filtered,showFilter:!A.showFilter}),children:(0,x.jsx)("i",{className:"fa fa-search"})})})]}),(0,x.jsx)(u.A,{className:"my-3",children:(0,x.jsx)(m.A,{className:"react-table-holder",children:(0,x.jsx)(g.A,{columns:A.dataTableColumns,data:A.tableData,currentPage:A.page,pageSize:A.pageSize,totalPages:A.totalPages,showFilter:A.showFilter,sorted:A.sorted,loading:!N||A.loading&&!A.autoRefresh,onFilteredChange:e=>b({...A,filtered:e}),onSortedChange:e=>b({...A,sorted:e}),onPageChange:e=>b({...A,pageSize:e}),onPageSizeChange:e=>b({...A,page:0,pageSize:e}),onRowClick:e=>C(e.user_id)})})})]})};var A=a(9163),b=a.n(A),f=a(9435),v=a(1110),_=a(2714);const N=async e=>{let{auth:s,customer_id:a,user_id:t,user_id_owner:r,status:i}=e;return(0,_.A)({endpoint:"updateOrgUser",method:"POST",payload:{customer_id:a,user_id:t,user_id_owner:r,status:i},auth:s})};var y=a(3628),C=a(5996);const w=async e=>{let{auth:s,customer_id:a}=e,t=null;try{t=await(0,_.A)({endpoint:"getUsers",method:"POST",payload:{customer_id:a},auth:s});let e=[];return Array.isArray(t)&&(e=[...t].sort(((e,s)=>e.email>s.email?1:-1))),c.A.update((s=>{s.users=e}))}catch(r){return(0,y.A)({type:"lms data",status:"error",url:C.A.lms_api_url,operation:"getUsers",request:{customer_id:a},error:{catch:r.toString()},customer_id:a})}};var S=a(3150);const P=function(){const{user_id:e}=(0,o.g)(),{customer_id:s}=(0,o.g)(),a=(0,h.MW)(),l=(0,n.O$)(c.A,(e=>e.auth)),u=(0,n.O$)(c.A,(s=>s.users&&s.users.find((s=>s.user_id===e))),[e]),[m,g]=(0,t.useState)(!1),[p,j]=(0,t.useState)({});return b()((()=>{var e,a;g(u&&(null===(e=u.orgs)||void 0===e||null===(a=e.find((e=>{var a;return(null===(a=e.customer_id)||void 0===a?void 0:a.toString())===s})))||void 0===a?void 0:a.status))}),[u,s]),b()((async()=>{const{submitted:t,processing:r}=p;if(t&&!r){const t="declined"===m?"invited":"accepted"===m?"owner":"owner"===m?"accepted":"invited";g(t);const r=await N({auth:l,user_id:e,user_id_owner:l.user_id,customer_id:s,status:t});r.error?(a.error(r.message),j({})):(a.success(`User role updated to ${"accepted"===t?"user":t}`),j({}),w({auth:l,customer_id:s}))}}),[p]),(0,x.jsx)(f.tH,{onError:(e,a)=>(0,y.A)({error:{message:e.message,componentStack:a},customer_id:s}),FallbackComponent:S.A,children:["invited","declined"].includes(m)?"declined"===m?(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["User declined invitation to join",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"reinvite them by clicking this button"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"reinviteOrganizationUser",block:!0,color:"success",onClick:()=>j({submitted:!0}),disabled:p.submitted,children:p.submitted?(0,x.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,x.jsx)("span",{children:"Reinvite User"})})})]}):(0,x.jsx)(r.A,{children:(0,x.jsxs)(i.A,{className:"py-1",children:["User has not yet accepted invitation",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"You must wait for them to accept before modifying them"})]})}):(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["Is Owner",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"can invite other users, add instances"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)("div",{className:"role-toggle-holder",children:(0,x.jsx)(v.A,{checked:"owner"===m,onChange:()=>j({submitted:!0})})})})]})})};var k=a(5488),E=a(5269);const O=function(){const{user_id:e,customer_id:s}=(0,o.g)(),{pathname:a}=(0,o.zy)(),l=(0,o.Zp)(),u=(0,h.MW)(),[m,g]=(0,t.useState)({}),[p,j]=(0,t.useState)({}),A=(0,n.O$)(c.A,(e=>e.auth));return(0,x.jsx)(f.tH,{onError:(e,a)=>(0,y.A)({error:{message:e.message,componentStack:a},customer_id:s}),FallbackComponent:S.A,children:(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"4",className:"py-1",children:["Delete Org User",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"user will be removed from this organization"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(k.A,{id:"delete_username",onChange:e=>g({delete_username:e.target.value}),type:"text",className:"text-center",title:"confirm username to delete",placeholder:'Enter "DELETE" here to enable deletion.',value:m.delete_username||""})}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"deleteUser",block:!0,color:"danger",onClick:async()=>{if("DELETE"!==m.delete_username)u.error("Please type DELETE to delete this user");else{j({submitted:!0});const t=await N({auth:A,user_id:e,user_id_owner:A.user_id,customer_id:s,status:"removed"});-1!==t.message.indexOf("successfully")?(u.success(t.message),E.A.update((e=>{e.lastUpdate=Date.now()})),j({}),setTimeout((()=>l(a.replace(`/${e}`,""))),100)):(u.error(t.message),j({}))}},disabled:"DELETE"!==m.delete_username||p.submitted,children:p.submitted?(0,x.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,x.jsx)("span",{children:"Delete User"})})})]})})};const z=function(e){let{userEmail:s}=e;const{user_id:a}=(0,o.g)(),{pathname:t}=(0,o.zy)(),n=(0,o.Zp)();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"floating-card-header",children:["existing org users > edit > ",(0,x.jsx)("b",{children:s})]}),(0,x.jsx)(u.A,{className:"my-3",children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)(P,{}),(0,x.jsx)("hr",{className:"my-3"}),(0,x.jsx)(O,{}),(0,x.jsx)("hr",{className:"my-3"}),(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xs:"8",className:"py-1",children:["Return to User List",(0,x.jsx)("br",{}),(0,x.jsx)("span",{className:"text-small",children:"make no further changes to this user"})]}),(0,x.jsx)(i.A,{xs:"4",children:(0,x.jsx)(d.A,{id:"returnToOrganizationUserList",block:!0,color:"grey",onClick:()=>n(t.replace(`/${a}`,"")),children:"Return to User List"})})]})]})})]})};var F=a(1440),U=a(8188);const T=function(e){let{refreshUsers:s,userEmails:a}=e;const r=(0,o.Zp)(),{customer_id:i}=(0,o.g)(),l=(0,n.O$)(c.A,(e=>e.auth)),[h,g]=(0,t.useState)({}),[p,j]=(0,t.useState)({}),A="132px";return b()((async()=>{const{email:e}=p,{submitted:t}=h;if(t){if((0,F.A)(e))if(a&&a.includes(e))g({error:"This user has already been invited"});else if(e===l.email)g({error:"You cannot invite yourself"});else{g({processing:!0});const a=await(async e=>{let{auth:s,email:a,customer_id:t,login_domain:r=window.location.host}=e;return(0,_.A)({endpoint:"addUser",method:"POST",payload:{email:a,customer_id:t,login_domain:r,user_id:s.user_id},auth:s})})({auth:l,email:e,customer_id:i});a.error?g({error:a.message}):(window._kmq&&window._kmq.push(["record","added org user"]),s(),g({success:a.message}))}else g({error:"Please enter a valid email"});setTimeout((()=>j({})),2e3)}}),[h]),b()((()=>g({})),[p]),(0,x.jsx)(f.tH,{onError:(e,s)=>(0,y.A)({error:{message:e.message,componentStack:s},customer_id:i}),FallbackComponent:S.A,children:(0,x.jsx)("div",{className:"mt-3 mb-4",children:l.email_bounced?(0,x.jsx)(u.A,{children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)("b",{children:"Unable to Add New Org User"}),(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),"Your email address seems to be unreachable. Please update it to ensure billing, upgrade, and other critical system announcements reach you.",(0,x.jsx)("br",{}),(0,x.jsx)("br",{}),(0,x.jsx)(d.A,{id:"updateEmail",onClick:()=>r("/profile"),title:"Update My Email",block:!0,className:"mt-3",color:"danger",children:"Update My Email"})]})}):h.processing?(0,x.jsx)(U.A,{height:A,status:"processing",header:"Adding User",subhead:"The Account Airedale Is A Good Boy"}):h.success?(0,x.jsx)(U.A,{height:A,status:"success",header:"Success!",subhead:h.success}):h.error?(0,x.jsx)(U.A,{height:A,status:"error",header:h.error,subhead:"Please try again"}):(0,x.jsx)(u.A,{children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)(k.A,{id:"email",type:"text",className:"mb-3 text-center",name:"email",placeholder:"email address",onChange:e=>j({...p,email:e.target.value.toLowerCase()}),disabled:h.submitted}),(0,x.jsx)(d.A,{id:"addOrganizationUser",color:"success",block:!0,onClick:()=>g({submitted:!0}),disabled:h.submitted,children:"Add Org User"})]})})})})};var $=a(9519);const D=function(){const{user_id:e,customer_id:s}=(0,o.g)(),a=(0,n.O$)(c.A,(e=>e.auth)),d=(0,n.O$)(c.A,(e=>e.users)),u=e&&d&&d.find((s=>s.user_id===e)),m=(0,t.useCallback)((()=>{a&&s&&w({auth:a,customer_id:s})}),[a,s]);return(0,t.useEffect)((()=>{m(),(0,$.A)({auth:a,customer_id:s})}),[]),(0,l.A)((()=>m()),C.A.refresh_content_interval),(0,x.jsxs)(r.A,{children:[(0,x.jsxs)(i.A,{xl:"3",lg:"4",md:"5",xs:"12",children:[(0,x.jsx)("span",{className:"floating-card-header",children:"add org user"}),(0,x.jsx)(T,{refreshUsers:m,userEmails:d&&d.map((e=>"declined"!==e.orgs[0].status&&e))})]}),(0,x.jsx)(i.A,{xl:"9",lg:"8",md:"7",xs:"12",className:"pb-5",children:u?(0,x.jsx)(z,{userEmail:u.email}):(0,x.jsx)(j,{refreshUsers:m})})]})}},4343:(e,s,a)=>{a.d(s,{A:()=>f});var t=a(9950),r=a(2043),i=a(5488),n=a(9435),l=a(7176),o=a(6114),c=a(4414);const d=e=>{let{headerGroups:s,onSortedChange:a,sorted:t,showFilter:r,dynamicAttributesFromDataTable:i,tableDescriptionAttributes:n}=e;const d=e=>{let s=!1;return n.forEach((a=>{a.attribute===e&&(a.is_primary_key||a.indexed)&&(s=!0)})),s};return s.map((e=>{const{key:s,...n}=e.getHeaderGroupProps();return(0,c.jsxs)("div",{...n,children:[(0,c.jsx)(l.A,{className:"header g-0",children:e.headers.map((e=>{var s,r;return(0,c.jsx)(o.A,{onClick:()=>{var s,r;i&&!i.includes(e.id)&&d(e.id)&&a([{id:e.id,desc:(null===(s=t[0])||void 0===s?void 0:s.id)===e.id&&!(null!==(r=t[0])&&void 0!==r&&r.desc)}])},className:`${(null===(s=t[0])||void 0===s?void 0:s.id)===e.id?"sorted":""} ${null!==(r=t[0])&&void 0!==r&&r.desc?"desc":"asc"} ${-1!==e.id.indexOf("hdb-narrow")?"action":""} px-1 ${i&&!i.includes(e.id)&&d(e.id)?"":"disabled-column"}`,children:(0,c.jsx)("div",{className:"text-renderer",children:e.render("Header")})},e.id)}))}),r&&(0,c.jsx)(l.A,{className:"filter g-0",children:e.headers.map((e=>(0,c.jsx)(o.A,{className:-1!==e.id.indexOf("hdb-narrow")?"action":"",children:e.render("Filter")},e.id)))})]},s)}))};var u=a(3452);const m=function(e){let{page:s,pageSize:a,totalPages:t,onPageChange:r,onPageSizeChange:n,loading:d}=e;return(0,c.jsxs)(l.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(u.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:()=>r(s-1),disabled:!t||0===s,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(i.A,{className:"mb-2",type:"number",value:s+1,min:1,max:t,onChange:e=>r(e.target.value-1)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",d?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):t]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(i.A,{className:"mb-2",type:"select",value:a,onChange:e=>n(e.target.value),children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(u.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:()=>r(s+1),disabled:!t||s+1===t,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const h=function(e){let{previousPage:s,canPreviousPage:a,pageIndex:t,gotoPage:r,setPageSize:n,pageCount:d,nextPage:m,canNextPage:h,loading:g}=e;return(0,c.jsxs)(l.A,{className:"pagination",children:[(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"previous",children:(0,c.jsx)(u.A,{className:"mb-2 btn-pagination",color:"purple",block:!0,onClick:s,disabled:!d||!a,children:(0,c.jsx)("i",{className:"fa fa-chevron-left"})})}),(0,c.jsxs)(o.A,{xs:"12",sm:"4",className:"paginator",children:[(0,c.jsx)("i",{className:"fa fa-book me-2"}),(0,c.jsx)(i.A,{className:"mb-2",type:"number",value:t+1||1,min:1,max:d,onChange:e=>r(e.target.value?Number(e.target.value)-1:0)}),(0,c.jsxs)("div",{className:"page-count",children:["\xa0/\xa0",g?(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"}):d]})]}),(0,c.jsx)(o.A,{xs:"12",sm:"4",className:"page-size",children:(0,c.jsx)(i.A,{className:"mb-2",type:"select",onChange:e=>{r(0),setTimeout((()=>n(e.target.value)),1e3)},children:[20,50,100,250].map((e=>(0,c.jsxs)("option",{value:e,children:[e," rows"]},e)))})}),(0,c.jsx)(o.A,{xs:"12",sm:"2",className:"next",children:(0,c.jsx)(u.A,{className:"mb-2 pull-right btn-pagination",block:!0,color:"purple",onClick:m,disabled:!d||!h,children:(0,c.jsx)("i",{className:"fa fa-chevron-right"})})})]})};const g=function(e){let{prepareRow:s,row:a,onRowClick:t=!1}=e;return s(a),(0,c.jsx)(l.A,{onClick:()=>t&&t(a.original),className:"g-0",children:a.cells.map((e=>(0,c.jsx)(o.A,{className:-1!==e.column.id.indexOf("hdb-narrow")?"action":"",children:e.render("Cell")},`${e.row.id}-${e.column.id}`)))})};var x=a(3628),p=a(3150);function j(e){let{value:s}=e;return(0,c.jsx)("div",{className:"text-renderer",children:s})}function A(e){let{src:s}=e;const[a,r]=(0,t.useState)(!1),[i,n]=(0,t.useState)(!1);return(0,c.jsxs)("div",{className:"image-renderer",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:[(0,c.jsx)("i",{className:"fa fa-image"}),a&&i?(0,c.jsxs)("div",{className:"preview-image no-image",children:[(0,c.jsx)("i",{className:"fa fa-ban text-danger"}),(0,c.jsx)("div",{className:"mt-2",children:"image failed to load"})]}):a?(0,c.jsx)("img",{onError:n,alt:s,src:s,className:"preview-image"}):null]})}const b={Filter:e=>{let{column:{filterValue:s,setFilter:a}}=e;return(0,c.jsx)(i.A,{type:"text",value:s||"",onChange:e=>a(e.target.value||void 0)})},Cell:e=>{let{value:s}=e;return(e=>{switch(Object.prototype.toString.call(e)){case"[object Array]":case"[object Object]":return(0,c.jsx)(j,{value:JSON.stringify(e)});case"[object Boolean]":return(0,c.jsx)(j,{value:e?"true":"false"});case"[object String]":return(s=e)&&(s.match(/^https?.*\.(jpeg|jpg|gif|png)$/)||-1!==s.indexOf("data:image"))?(0,c.jsx)(A,{src:e}):(0,c.jsx)(j,{value:e});default:return(0,c.jsx)(j,{value:e})}var s})(s)}};const f=function(e){let{columns:s,data:a,error:i,currentPage:l,pageSize:o,totalPages:u,onFilteredChange:j,onSortedChange:A,onPageChange:f,onPageSizeChange:v,showFilter:_,onRowClick:N,sorted:y,loading:C,dynamicAttributesFromDataTable:w,tableDescriptionAttributes:S,manual:P=!1}=e;const{headerGroups:k,page:E,rows:O,prepareRow:z,state:F,setAllFilters:U,canPreviousPage:T,canNextPage:$,pageOptions:D,pageCount:R,gotoPage:L,nextPage:H,previousPage:M,setPageSize:I}=(0,r.useTable)({columns:s,data:a,defaultColumn:b,onFilteredChange:j,onSortedChange:A,onPageChange:f,onPageSizeChange:v,onRowClick:N,manualPagination:P,manualFilters:P,initialState:{pageIndex:l,pageSize:o}},r.useFilters,r.usePagination),[G,q]=(0,t.useState)(!0),Z=P||!E.length?O:E;return(0,t.useEffect)((()=>{!_&&F.filters.length?U([]):j(F.filters)}),[F.filters,_]),(0,t.useEffect)((()=>{setTimeout((()=>q(!1)),100)}),[null===Z||void 0===Z?void 0:Z.length]),(0,c.jsxs)(n.tH,{onError:(e,s)=>(0,x.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:p.A,children:[(0,c.jsxs)("div",{className:"react-table-scroller",children:[(0,c.jsx)(d,{headerGroups:k,tableDescriptionAttributes:S,dynamicAttributesFromDataTable:w,onSortedChange:A,sorted:y,showFilter:_}),C||G?(0,c.jsx)("div",{className:"centered text-center",children:(0,c.jsx)("i",{className:"fa fa-spinner fa-spin"})}):Z.length?Z.map((e=>(0,c.jsx)(g,{row:e,prepareRow:z,onRowClick:N},e.id))):(0,c.jsxs)("div",{className:"centered text-center",children:[(0,c.jsx)("i",{className:"fa fa-exclamation-triangle text-danger"}),(0,c.jsx)("div",{className:"mt-2 text-darkgrey",children:i?`Error loading data: ${i}`:"no records"})]})]}),P?(0,c.jsx)(m,{page:l,pageSize:o,totalPages:u,onPageChange:f,onPageSizeChange:v,loading:C}):(0,c.jsx)(h,{previousPage:M,pageSize:o,canPreviousPage:T,pageIndex:F.pageIndex,pageOptions:D,gotoPage:L,setPageSize:I,pageCount:R,nextPage:H,canNextPage:$,loading:C})]})}},8188:(e,s,a)=>{a.d(s,{A:()=>n});a(9950);var t=a(4084),r=a(8156),i=a(4414);const n=function(e){let{header:s,subhead:a=" ",height:n,status:l,className:o}=e;return(0,i.jsx)(t.A,{className:`form-status ${o}`,children:(0,i.jsxs)(r.A,{className:"text-center",style:{height:n},children:[(0,i.jsx)("div",{className:"text-bold",children:s}),(0,i.jsx)("div",{className:"py-4",children:(0,i.jsx)("i",{className:"fa fa-lg "+("processing"===l?"fa-spinner fa-spin text-purple":"success"===l?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,i.jsx)("div",{className:"text-grey",children:a})]})})}},9519:(e,s,a)=>{a.d(s,{A:()=>o});var t=a(2714),r=a(5553),i=a(3628),n=a(5996),l=a(7596);const o=async e=>{let{auth:s,customer_id:a}=e,o=null;try{var c;return o=await(0,t.A)({endpoint:"getCustomer",method:"POST",payload:{customer_id:a},auth:s}),(0,l.A)({auth:s,customer_id:a,stripe_id:null===(c=o)||void 0===c?void 0:c.stripe_id}),o.error||r.A.update((e=>{var s;e.customer={...o,customer_id:a},e.hasCard=null===(s=o.stripe_payment_methods)||void 0===s?void 0:s[0]})),o}catch(d){return(0,i.A)({type:"lms data",status:"error",url:n.A.lms_api_url,operation:"getCustomer",request:{customer_id:a},error:{catch:d.toString()},customer_id:a})}}},7596:(e,s,a)=>{a.d(s,{A:()=>c});var t=a(2714),r=a(5553),i=a(3628),n=a(2434),l=a(2696),o=a(5996);const c=async e=>{let{auth:s,customer_id:a,stripe_id:c}=e;try{const e=await(0,t.A)({endpoint:"getPrepaidSubscriptions",method:"POST",payload:{customer_id:a,stripe_id:c},auth:s});return!e.error&&r.A.update((s=>{s.subscriptions={cloud_storage:(0,l.A)(e.cloud_storage||[]),cloud_compute:(0,n.A)(e.cloud_compute||[]),wavelength_compute:(0,n.A)(e.wavelength_compute||[]),local_compute:(0,n.A)(e.local_compute||[])}}))}catch(d){return(0,i.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"getPrepaidSubscriptions",error:{catch:d.toString()}})}}},5269:(e,s,a)=>{a.d(s,{A:()=>t});const t=new(a(6713).il)({})},1440:(e,s,a)=>{a.d(s,{A:()=>t});const t=e=>/^\S+@\S+\.\S+$/.test(String(e).toLowerCase())}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[478],{52:(e,n,l)=>{l.r(n),l.d(n,{default:()=>m});var a=l(9950),s=l(1345),i=l(6713),r=l(4414);const t=(0,a.lazy)((()=>Promise.all([l.e(43),l.e(805),l.e(521)]).then(l.bind(l,958)))),o=(0,a.lazy)((()=>Promise.all([l.e(279),l.e(588)]).then(l.bind(l,1192)))),c=()=>[{element:(0,r.jsx)(t,{}),path:"users/:user_id?",link:"users",label:"users",icon:"users",iconCode:"f0c0"},{element:(0,r.jsx)(o,{}),path:"billing",link:"billing",label:"billing",icon:"credit-card-alt",iconCode:"f283"}];var d=l(8651),h=l(5553),u=l(4979);const m=function(){const e=(0,s.zy)(),{customer_id:n}=(0,s.g)(),l=c(),t=(0,i.O$)(h.A,(e=>{var l,a;return null===(l=e.auth)||void 0===l||null===(a=l.orgs)||void 0===a?void 0:a.find((e=>{var l;return(null===(l=e.customer_id)||void 0===l?void 0:l.toString())===n}))}),[n]),o="owner"===(null===t||void 0===t?void 0:t.status),m=(0,i.O$)(h.A,(e=>{var n;return e.auth&&(null===(n=e.auth)||void 0===n?void 0:n.orgs[0].customer_id)})),p="primary"===n&&`/o/${m}${e.pathname.split("primary")[1]}${e.search}`;return o?(0,r.jsxs)("main",{id:"organization",children:[(0,r.jsx)(d.A,{}),(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)(u.A,{header:" ",spinner:!0}),children:(0,r.jsxs)(s.BV,{children:[l.map((e=>(0,r.jsx)(s.qh,{path:e.path,element:e.element},e.path))),(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:"users",replace:!0})})]})})]}):t?(0,r.jsx)(s.BV,{children:(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:"instances",replace:!0})})}):p?(0,r.jsx)(s.BV,{children:(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:p,replace:!0})})}):null}},8651:(e,n,l)=>{l.d(n,{A:()=>u});l(9950);var a=l(2072),s=l(8125),i=l(5746),r=l(6359),t=l(1345),o=l(9435),c=l(3150),d=l(3628),h=l(4414);const u=function(e){let{routes:n=[]}=e;const l=(0,t.Zp)(),u=(0,t.zy)(),m=(null===n||void 0===n?void 0:n.find((e=>e.link===u.pathname)))||n[0];return(0,h.jsx)(o.tH,{onError:(e,n)=>(0,d.A)({error:{message:e.message,componentStack:n}}),FallbackComponent:c.A,children:(0,h.jsx)(a.A,{className:"app-subnav",children:m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.A,{navbar:!0,className:"instance-nav d-none d-md-flex",children:n.map((e=>e.external?(0,h.jsx)("li",{className:"nav-item",children:(0,h.jsxs)("a",{className:"nav-link",href:e.url,target:"_blank",rel:"noreferrer",children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path):(0,h.jsx)(i.A,{children:(0,h.jsxs)(t.k2,{title:e.link,className:"nav-link",to:e.link||e.path,children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path)))}),(0,h.jsx)(s.A,{navbar:!0,className:"d-flex d-md-none",children:(0,h.jsx)(r.Ay,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:n}=e;return l(n)},options:n.filter((e=>e.link!==m.link)).map((e=>({label:(0,h.jsxs)("span",{children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]}),value:e.link,iconCode:e.iconCode}))),value:{...m,value:null===m||void 0===m?void 0:m.link},defaultValue:null===m||void 0===m?void 0:m.link,isSearchable:!1,isClearable:!1})})]})})})}}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[478],{52:(e,n,l)=>{l.r(n),l.d(n,{default:()=>m});var a=l(9950),s=l(5201),i=l(6713),r=l(4414);const t=(0,a.lazy)((()=>Promise.all([l.e(43),l.e(805),l.e(521)]).then(l.bind(l,958)))),o=(0,a.lazy)((()=>Promise.all([l.e(279),l.e(588)]).then(l.bind(l,1192)))),c=()=>[{element:(0,r.jsx)(t,{}),path:"users/:user_id?",link:"users",label:"users",icon:"users",iconCode:"f0c0"},{element:(0,r.jsx)(o,{}),path:"billing",link:"billing",label:"billing",icon:"credit-card-alt",iconCode:"f283"}];var d=l(8651),h=l(5553),u=l(4979);const m=function(){const e=(0,s.zy)(),{customer_id:n}=(0,s.g)(),l=c(),t=(0,i.O$)(h.A,(e=>{var l,a;return null===(l=e.auth)||void 0===l||null===(a=l.orgs)||void 0===a?void 0:a.find((e=>{var l;return(null===(l=e.customer_id)||void 0===l?void 0:l.toString())===n}))}),[n]),o="owner"===(null===t||void 0===t?void 0:t.status),m=(0,i.O$)(h.A,(e=>{var n;return e.auth&&(null===(n=e.auth)||void 0===n?void 0:n.orgs[0].customer_id)})),p="primary"===n&&`/o/${m}${e.pathname.split("primary")[1]}${e.search}`;return o?(0,r.jsxs)("main",{id:"organization",children:[(0,r.jsx)(d.A,{}),(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)(u.A,{header:" ",spinner:!0}),children:(0,r.jsxs)(s.BV,{children:[l.map((e=>(0,r.jsx)(s.qh,{path:e.path,element:e.element},e.path))),(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:"users",replace:!0})})]})})]}):t?(0,r.jsx)(s.BV,{children:(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:"instances",replace:!0})})}):p?(0,r.jsx)(s.BV,{children:(0,r.jsx)(s.qh,{path:"*",element:(0,r.jsx)(s.C5,{to:p,replace:!0})})}):null}},8651:(e,n,l)=>{l.d(n,{A:()=>u});l(9950);var a=l(2072),s=l(8125),i=l(5746),r=l(6359),t=l(5201),o=l(9435),c=l(3150),d=l(3628),h=l(4414);const u=function(e){let{routes:n=[]}=e;const l=(0,t.Zp)(),u=(0,t.zy)(),m=(null===n||void 0===n?void 0:n.find((e=>e.link===u.pathname)))||n[0];return(0,h.jsx)(o.tH,{onError:(e,n)=>(0,d.A)({error:{message:e.message,componentStack:n}}),FallbackComponent:c.A,children:(0,h.jsx)(a.A,{className:"app-subnav",children:m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.A,{navbar:!0,className:"instance-nav d-none d-md-flex",children:n.map((e=>e.external?(0,h.jsx)("li",{className:"nav-item",children:(0,h.jsxs)("a",{className:"nav-link",href:e.url,target:"_blank",rel:"noreferrer",children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path):(0,h.jsx)(i.A,{children:(0,h.jsxs)(t.k2,{title:e.link,className:"nav-link",to:e.link||e.path,children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path)))}),(0,h.jsx)(s.A,{navbar:!0,className:"d-flex d-md-none",children:(0,h.jsx)(r.Ay,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:n}=e;return l(n)},options:n.filter((e=>e.link!==m.link)).map((e=>({label:(0,h.jsxs)("span",{children:[(0,h.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]}),value:e.link,iconCode:e.iconCode}))),value:{...m,value:null===m||void 0===m?void 0:m.link},defaultValue:null===m||void 0===m?void 0:m.link,isSearchable:!1,isClearable:!1})})]})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[678],{5203:(e,t,s)=>{s.r(t),s.d(t,{default:()=>G});var r=s(9950),a=s(7176),n=s(1345),i=s(6713),c=s(9435),o=s(5553),l=s(2072),d=s(8125),u=s(5488),m=s(3452);const x=e=>{o.A.update((t=>{t.orgSearch=e.target.value}))},h=()=>{o.A.update((e=>{e.orgSearch=""}))};var p=s(4414);const g=function(){const e=(0,i.O$)(o.A,(e=>e.orgSearch));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u.A,{id:"filter_orgs",type:"text",className:"text-center",onChange:x,placeholder:"filter your organizations",value:e||""}),e&&(0,p.jsx)(m.A,{className:"clear-filter",onClick:h,children:(0,p.jsx)("i",{className:"fa fa-times"})})]})};const j=function(){const e=(0,i.O$)(o.A,(e=>e.auth.orgs)),[t,s]=r.useState(!0);return(0,p.jsx)(m.A,{color:"link",className:"btn btn-purple px-4 mx-2",onClick:()=>{o.A.update((r=>{r.auth.orgs=function(e,t){const s=[...e];return t?s.sort(((e,t)=>e.customer_name.localeCompare(t.customer_name))):s.sort(((e,t)=>t.customer_name.localeCompare(e.customer_name))),s}(e,t),s(!t)}))},children:t?(0,p.jsxs)("span",{children:[(0,p.jsx)("i",{className:"fa fa-sort-alpha-up"})," Sort by Name: Ascending"]}):(0,p.jsxs)("span",{children:[(0,p.jsx)("i",{className:"fa fa-sort-alpha-down"})," Sort by Name: Descending"]})})};var f=s(3150),b=s(3628);const A=function(){return(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:(0,p.jsx)(l.A,{className:"app-subnav",children:(0,p.jsxs)(d.A,{navbar:!0,children:[(0,p.jsx)("div",{className:"filter-holder",children:(0,p.jsx)(g,{})}),(0,p.jsx)(j,{})]})})})};var v=s(6114),N=s(4084),y=s(8156),O=s(7348),_=s(2714);const k=async e=>{let{auth:t,customer_id:s,user_id:r,status:a}=e;return(0,_.A)({endpoint:"updateUserOrgs",method:"POST",payload:{customer_id:s,user_id:r,status:a},auth:t})};var C=s(5429),S=s(3304);const w=function(e){let{loading:t,status:s,customer_name:a,setFlipState:n,total_instance_count:i}=e;const c=(0,O.MW)(),o=(0,r.useCallback)((e=>{e.stopPropagation();const t=e.currentTarget.getAttribute("data-action");"delete"===t&&i?c.error("You must remove all instances from an Organization before deleting it."):n(t)}),[i,c,n]);return t?(0,p.jsx)("i",{className:"status-icon fa fa-spinner fa-spin text-purple"}):"accepted"===s?(0,p.jsx)(m.A,{"data-action":"leave",className:"status-icon",color:"link",title:`Leave ${a} organization`,onClick:o,children:(0,p.jsx)("i",{className:"fa fa-times-circle text-purple"})}):"owner"===s?(0,p.jsx)(m.A,{"data-action":"delete",className:"status-icon",color:"link",title:`Delete ${a} organization`,onClick:o,children:(0,p.jsx)("i",{className:"fa fa-trash delete text-purple "+(i?"disabled":"")})}):null};const E=function(e){let{customer_name:t,customer_id:s,total_instance_count:l,status:d,setFlipState:u}=e;const x=(0,i.O$)(o.A,(e=>e.auth)),[h,g]=(0,r.useState)(!1),j=(0,n.Zp)(),A=(0,O.MW)(),_=!h&&["owner","accepted"].includes(d),E=async e=>{const t=e.currentTarget.getAttribute("data-status");g(t);const r=await k({auth:x,customer_id:s,user_id:x.user_id,status:t});r.error?(A.error(r.message),g(!1)):(await(0,S.A)(x),"declined"!==t&&g(!1),A.success(`Organization ${t} successfully`))};return(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance "+(_?"clickable":""),onClick:async()=>_&&j(`/o/${s}/instances`),children:(0,p.jsxs)(y.A,{children:[(0,p.jsxs)(a.A,{className:"g-0",children:[(0,p.jsx)(v.A,{xs:"10",className:"org-name",children:t}),(0,p.jsx)(v.A,{xs:"2",className:"status-icons text-end",children:(0,p.jsx)(w,{status:d,loading:h,customer_name:t,setFlipState:u,total_instance_count:l})})]}),(0,p.jsxs)("div",{className:"org-status",children:["ORG ID: ",s]}),(0,p.jsx)(C.A,{textClass:"text-bold",label:"ROLE",isReady:!0,value:"accepted"===d?"USER":d.toUpperCase(),bottomDivider:!0}),(0,p.jsx)(C.A,{label:"INSTANCES",isReady:!0,value:l||"..."}),(0,p.jsx)("div",{className:"action-buttons",children:"invited"===d&&(0,p.jsxs)(a.A,{className:"g-0",children:[(0,p.jsx)(v.A,{xs:"6",className:"pe-1",children:(0,p.jsx)(m.A,{title:`Decline invitation to ${t} organization`,disabled:!!h,color:"danger",block:!0,"data-status":"declined",onClick:E,children:"declined"===h?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,p.jsx)("span",{children:"Decline"})})}),(0,p.jsx)(v.A,{xs:"6",className:"ps-1",children:(0,p.jsx)(m.A,{title:`Accept invitation to ${t} organization`,disabled:!!h,color:"success",block:!0,"data-status":"accepted",onClick:E,children:"accepted"===h?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,p.jsx)("span",{children:"Join"})})})]})})]})})})};var z=s(9163),F=s.n(z);const $=function(e){var t;let{customer_id:s,customer_name:n,setFlipState:l,flipState:d}=e;const x=(0,O.MW)(),h=(0,i.O$)(o.A,(e=>e.auth)),[g,j]=(0,r.useState)({}),[A,_]=(0,r.useState)({});return F()((async()=>{const{submitted:e}=g;if(e){const{delete_customer_name:e}=A;if(n.toString()!==(null===e||void 0===e?void 0:e.toString()))j({error:"organization name is not correct"});else{const e=await k({auth:h,customer_id:s,user_id:h.user_id,status:"removed"});e.error?x.error(e.message):(await(0,S.A)(h),x.success("Organization removed from your profile successfully"))}}}),[g]),(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance",children:d&&(0,p.jsxs)(y.A,{children:[(0,p.jsxs)("ul",{className:"text-small my-0 text-nowrap",children:[(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"YOU"})," will be removed from the org."]}),(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"THE ORG"})," will not be removed."]})]}),(0,p.jsx)(u.A,{id:"customer_name",onChange:e=>_({delete_customer_name:e.target.value}),type:"text",title:"customer name",className:"my-3",placeholder:`Enter "${n}" here to confirm.`,value:A.customer_name}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>j({submitted:!0}),title:"Confirm Organization Details",block:!0,disabled:g.submitted||(null===n||void 0===n?void 0:n.toString())!==(null===(t=A.delete_customer_name)||void 0===t?void 0:t.toString()),color:"danger",children:g.submitted?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin"}):(0,p.jsx)("span",{children:"Do It"})})})]})]})})})};const T=function(e){var t;let{customer_id:s,customer_name:n,setFlipState:l,flipState:d}=e;const x=(0,O.MW)(),h=(0,i.O$)(o.A,(e=>e.auth)),[g,j]=(0,r.useState)({}),[A,k]=(0,r.useState)({});return F()((async()=>{const{submitted:e}=g;if(e){const{delete_customer_name:e}=A;if(n.toString()!==(null===e||void 0===e?void 0:e.toString()))j({error:"organization name is not correct"});else{const e=await(async e=>{let{auth:t,user_id:s,customer_id:r}=e;return(0,_.A)({endpoint:"removeOrg",method:"POST",payload:{user_id:s,customer_id:r},auth:t})})({auth:h,customer_id:s.toString(),user_id:h.user_id});e.error?j({error:e.message}):(await(0,S.A)(h),x.success("Organization removed successfully"))}}}),[g]),(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance",children:d&&(0,p.jsx)(y.A,{children:g.error?(0,p.jsxs)(p.Fragment,{children:["There was an error processing your request:",(0,p.jsx)("hr",{className:"mt-3 mb-2"}),(0,p.jsx)("div",{className:"text-danger text-small",children:g.error}),(0,p.jsx)("hr",{className:"mt-2 mb-3"}),(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("ul",{className:"text-small text-nowrap my-0",children:[(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"INSTANCES"})," must first be removed."]}),(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"USERS"})," will no longer see this org."]})]}),(0,p.jsx)(u.A,{id:"customer_name",onChange:e=>k({delete_customer_name:e.target.value}),type:"text",title:"customer name",className:"my-3",placeholder:`Enter "${n}" here to confirm.`,value:A.customer_name}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{id:"deleteOrganization",onClick:()=>j({submitted:!0}),title:"Confirm Organization Details",block:!0,disabled:g.submitted||(null===n||void 0===n?void 0:n.toString())!==(null===(t=A.delete_customer_name)||void 0===t?void 0:t.toString()),color:"danger",children:g.submitted?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin"}):(0,p.jsx)("span",{children:"Do It"})})})]})]})})})})};const M=function(e){return"leave"===e.flipState?(0,p.jsx)($,{...e}):(0,p.jsx)(T,{...e})};var D=s(1852);const H=function(e){let{flippedCard:t,setFlippedCard:s,customer_id:a,...n}=e;const[i,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{t!==a&&o(!1)}),[t]),(0,r.useEffect)((()=>{i&&s(a)}),[i]),(0,p.jsx)(v.A,{xs:"12",md:"6",lg:"4",xl:"3",className:"mb-4",children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:a}),FallbackComponent:D.A,children:i?(0,p.jsx)(M,{setFlipState:o,flipState:i,customer_id:a,...n}):(0,p.jsx)(E,{setFlipState:o,flipState:i,customer_id:a,...n})})})},I=()=>{const[e,t]=(0,r.useState)(!1);return(0,i.O$)(o.A,(e=>(e=>{let{orgSearch:t,orgs:s}=e;if(!s)return[];const r=((e,t)=>{const s={};return e.filter((e=>!s[e[t]]&&(s[e[t]]=!0,!0)))})(s,"customer_id");return t&&""!==t?r.filter((e=>e.customer_name&&-1!==e.customer_name.toLowerCase().indexOf(t.toLowerCase()))):r})({orgSearch:e.orgSearch,orgs:e.auth.orgs}))).map((s=>(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:D.A,children:(0,p.jsx)(H,{...s,flippedCard:e,setFlippedCard:t})},s.customer_id)))};const P=function(){const e=(0,n.Zp)(),t=()=>{window._kmq&&window._kmq.push(["record","clicked new org card"]),e("/organizations/new")};return(0,p.jsx)(v.A,{xs:"12",md:"6",lg:"4",xl:"3",className:"mb-4",children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{tabIndex:"0",id:"newOrgCard",title:"Add New Organization",className:"instance new",onKeyDown:e=>13!==e.keyCode||t(),onClick:t,children:(0,p.jsxs)(y.A,{className:"d-flex flex-column align-items-center justify-content-center",children:[(0,p.jsx)("span",{children:"Create A New Organization"}),(0,p.jsx)("div",{className:"my-4",children:(0,p.jsx)("i",{className:"fa fa-2x fa-plus-circle new-org-plus"})}),(0,p.jsx)("span",{children:"With Its Own Instances And Billing"})]})})})})};var U=s(6685),R=s(877),q=s(1340),L=s(1652);var W=s(4701);const Y=async e=>{let{formData:t,auth:s}=e;const{org:r,subdomain:a}=t;if(!r||!a)return{error:"All fields must be filled out"};if(!(0,W.A)(a))return{error:"subdomain: alphanumeric characters only"};if(a.length>16)return{error:"subdomain: max 16 characters"};const n=await(async e=>{let{auth:t,org:s,subdomain:r}=e;return(0,_.A)({endpoint:"addOrg",method:"POST",auth:t,payload:{org:s,subdomain:r,user_id:t.user_id}})})({auth:s,org:r,subdomain:a});return n.error?{error:n.message.replace("Bad request: ","").replace(/['"]+/g,"")}:{success:!0}};const Z=function(){const e=(0,i.O$)(o.A,(e=>e.auth)),t=(0,i.O$)(o.A,(e=>e.theme)),s=(0,n.Zp)(),[l,d]=(0,r.useState)({}),[x,h]=(0,r.useState)({}),[g,j]=(0,r.useState)(!1),A=()=>s("/organizations");return F()((async()=>{if(x.submitted){j(!1);const t=await Y({formData:l,auth:e});h(t),t.error||(await(0,S.A)(e),A())}}),[x]),(0,r.useEffect)((()=>{x.submitted||h({})}),[l]),(0,p.jsx)(U.A,{id:"new-org-modal",isOpen:!0,className:t,centered:!0,fade:!1,children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:e.email_bounced?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsxs)(y.A,{children:[(0,p.jsxs)("div",{className:"p-4 pb-0 text-center",children:[(0,p.jsx)("b",{children:"Unable to Create New Organization"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"Your email address seems to be unreachable. Please update it to ensure billing, upgrade, and other critical system announcements reach you."]}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{sm:"6",children:(0,p.jsx)(m.A,{id:"cancelNewOrg",onClick:()=>s("/organizations"),title:"Cancel New Org",block:!0,className:"mt-3",color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{sm:"6",children:(0,p.jsx)(m.A,{id:"updateEmail",onClick:()=>s("/profile"),title:"Update My Email",block:!0,className:"mt-3",color:"danger",children:"Update My Email"})})]})]})})}):x.submitted?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsx)(y.A,{children:(0,p.jsxs)("div",{className:"p-4 text-center",children:[(0,p.jsx)("b",{children:"Creating Your Organization"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("i",{className:"fa fa-lg fa-spinner fa-spin text-purple mb-4"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"The Organization Otterhound is fetching your stuff."]})})})}):x.success?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsx)(y.A,{children:(0,p.jsxs)("div",{className:"p-4 text-center",children:[(0,p.jsx)("b",{children:"Success"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("i",{className:"fa fa-lg fa-thumbs-up text-purple mb-4"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"Your organization was created successfully."]})})})}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(q.A,{toggle:A,children:"Add New Organization"}),(0,p.jsxs)(R.A,{children:[(0,p.jsx)(N.A,{className:"mb-3",children:(0,p.jsxs)(y.A,{children:[(0,p.jsx)(L.A,{header:"Name",children:(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{sm:"4",className:"pt-2 text-nowrap text-grey",children:'Ex: "My Org"'}),(0,p.jsx)(v.A,{sm:"8",children:(0,p.jsx)(u.A,{id:"org_name",className:"text-center",onChange:e=>d({...l,org:e.target.value}),type:"text",title:"name",value:l.org||""})})]})}),(0,p.jsxs)(L.A,{header:"Subdomain",subheader:"alphanumeric only. 16 char max.",children:[(0,p.jsxs)(a.A,{children:[(0,p.jsxs)(v.A,{sm:"4",className:"pt-2 text-nowrap text-grey",children:['Ex: "myorg"\xa0',(0,p.jsx)(m.A,{color:"link",title:"Learn more",onClick:()=>j(!g),children:(0,p.jsx)("i",{className:"fa fa-question-circle text-purple"})})]}),(0,p.jsx)(v.A,{sm:"8",children:(0,p.jsx)(u.A,{id:"subdomain",className:"text-center",type:"text",title:"subdomain",value:l.subdomain||"",disabled:x.submitted,onChange:e=>d({...l,subdomain:e.target.value.substring(0,15).toLowerCase()})})})]}),g&&(0,p.jsx)("div",{className:"text-center pt-2 pb-1 text-lightpurple text-small",children:(0,p.jsx)("i",{children:"Part of the URL of your Harper Cloud Instances- see below."})}),(0,p.jsx)("hr",{className:"my-2 d-none d-sm-block"}),(0,p.jsx)(a.A,{children:(0,p.jsx)(v.A,{xs:"12",className:"pt-2 text-center text-nowrap overflow-hidden text-truncate",children:l.subdomain?(0,p.jsxs)("i",{className:"text-grey",children:["INSTANCE_NAME-",l.subdomain,".harperdbcloud.com"]}):(0,p.jsx)("span",{className:"text-lightgrey",children:"INSTANCE_NAME-SUBDOMAIN.harperdbcloud.com"})})})]})]})}),(0,p.jsx)(m.A,{id:"createOrganization",onClick:()=>h({submitted:!0}),title:"Create Organization",block:!0,className:"mt-3",color:"success",children:"Create Organization"}),x.error&&(0,p.jsx)(N.A,{className:"mt-3 error",children:(0,p.jsx)(y.A,{children:x.error})})]})]})})})};var B=s(4979);const G=function(){const{list:e,action:t}=(0,n.g)(),s=(0,n.Zp)(),l=(0,i.O$)(o.A,(e=>e.auth));return(0,r.useEffect)((()=>o.A.update((e=>{e.users=!1,e.instances=!1,e.hasCard=!1,e.lastUpdate=!1})))),(0,r.useEffect)((()=>{1!==(null===l||void 0===l?void 0:l.orgs.filter((e=>["accepted","owner"].includes(e.status)))).length||e&&"sign-up"!==e||s(`/o/${l.orgs[0].customer_id}/instances`)}),[l,e]),(0,p.jsxs)("div",{id:"organizations",children:[(0,p.jsx)(A,{}),null!==l&&void 0!==l&&l.orgs?(0,p.jsxs)(a.A,{children:[(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:D.A,children:(0,p.jsx)(P,{})}),(0,p.jsx)(I,{})]}):(0,p.jsx)(B.A,{header:"loading organizations",spinner:!0}),"new"===t&&(0,p.jsx)(Z,{})]})}},5429:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var r=s(7176),a=s(6114),n=s(4414);const i=function(e){let{label:t,value:s,textClass:i="",isReady:c,bottomDivider:o=!1}=e;return(0,n.jsxs)(r.A,{className:"card-front-status-row text-darkgrey",children:[(0,n.jsx)(a.A,{xs:"4",children:t}),(0,n.jsx)(a.A,{xs:"8",className:i,children:c?s:""}),o&&(0,n.jsx)(a.A,{xs:"12",children:(0,n.jsx)("hr",{})})]})}},1652:(e,t,s)=>{s.d(t,{A:()=>a});s(9950);var r=s(4414);const a=function(e){let{children:t,header:s,subheader:a,maxHeight:n="auto",minHeight:i="auto",className:c}=e;return(0,r.jsxs)("div",{className:`content-container ${c}`,children:[(0,r.jsxs)("div",{className:"header-container",children:[(0,r.jsx)("span",{className:"header",children:s}),(0,r.jsx)("span",{className:"subheader",children:a})]}),(0,r.jsx)("div",{className:"auto"!==n?"scrollable":"",style:{maxHeight:n,minHeight:i},children:t})]})}},1852:(e,t,s)=>{s.d(t,{A:()=>n});s(9950);var r=s(3150),a=s(4414);const n=function(e){return(0,a.jsx)(r.A,{...e,extraClass:"entity-card"})}},4701:(e,t,s)=>{s.d(t,{A:()=>r});const r=e=>e.match(/^[a-z0-9]+$/i)},8125:(e,t,s)=>{s.d(t,{A:()=>h});var r=s(9950),a=s(1942),n=s.n(a),i=s(8738),c=s.n(i),o=s(1497),l=["className","cssModule","tabs","pills","vertical","horizontal","justified","fill","navbar","card","tag"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},d.apply(this,arguments)}function u(e,t){if(null==e)return{};var s,r,a=function(e,t){if(null==e)return{};var s,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}var m={card:n().bool,className:n().string,cssModule:n().object,fill:n().bool,horizontal:n().oneOf(["center","end"]),justified:n().bool,navbar:n().bool,pills:n().bool,tabs:n().bool,tag:o.Wx,vertical:n().oneOfType([n().bool,n().string])};function x(e){var t=e.className,s=e.cssModule,a=e.tabs,n=e.pills,i=e.vertical,m=void 0!==i&&i,x=e.horizontal,h=e.justified,p=e.fill,g=e.navbar,j=e.card,f=e.tag,b=void 0===f?"ul":f,A=u(e,l),v=(0,o.qO)(c()(t,g?"navbar-nav":"nav",!!x&&"justify-content-".concat(x),function(e){return!1!==e&&(!0===e||"xs"===e?"flex-column":"flex-".concat(e,"-column"))}(m),{"nav-tabs":a,"card-header-tabs":j&&a,"nav-pills":n,"card-header-pills":j&&n,"nav-justified":h,"nav-fill":p}),s);return r.createElement(b,d({},A,{className:v}))}x.propTypes=m;const h=x},2072:(e,t,s)=>{s.d(t,{A:()=>p});var r=s(9950),a=s(1942),n=s.n(a),i=s(8738),c=s.n(i),o=s(1497),l=["expand","className","cssModule","light","dark","fixed","sticky","color","container","tag","children"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},d.apply(this,arguments)}function u(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function m(e,t){if(null==e)return{};var s,r,a=function(e,t){if(null==e)return{};var s,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}var x={children:n().node,className:n().string,color:n().string,container:n().oneOfType([n().bool,n().string]),cssModule:n().object,dark:n().bool,expand:n().oneOfType([n().bool,n().string]),fixed:n().string,light:n().bool,role:n().string,sticky:n().string,tag:o.Wx};function h(e){var t,s=e.expand,a=void 0!==s&&s,n=e.className,i=e.cssModule,x=e.light,h=e.dark,p=e.fixed,g=e.sticky,j=e.color,f=e.container,b=void 0===f?"fluid":f,A=e.tag,v=void 0===A?"nav":A,N=e.children,y=m(e,l),O=(0,o.qO)(c()(n,"navbar",function(e){return!1!==e&&(!0===e||"xs"===e?"navbar-expand":"navbar-expand-".concat(e))}(a),(u(t={"navbar-light":x,"navbar-dark":h},"bg-".concat(j),j),u(t,"fixed-".concat(p),p),u(t,"sticky-".concat(g),g),t)),i),_=b&&!0===b?"container":"container-".concat(b);return r.createElement(v,d({},y,{className:O}),b?r.createElement("div",{className:_},N):N)}h.propTypes=x;const p=h},9163:(e,t,s)=>{var r=s(9950);function a(e,t,s){var a="function"===typeof t;r.useEffect((function(){var s,r=!0,n=e((function(){return r}));return Promise.resolve(n).then((function(e){s=e})),function(){r=!1,a&&t(s)}}),a?s:t)}e.exports=a,e.exports.useAsyncEffect=a}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[678],{5203:(e,t,s)=>{s.r(t),s.d(t,{default:()=>G});var r=s(9950),a=s(7176),n=s(5201),i=s(6713),c=s(9435),o=s(5553),l=s(2072),d=s(8125),u=s(5488),m=s(3452);const x=e=>{o.A.update((t=>{t.orgSearch=e.target.value}))},h=()=>{o.A.update((e=>{e.orgSearch=""}))};var p=s(4414);const g=function(){const e=(0,i.O$)(o.A,(e=>e.orgSearch));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u.A,{id:"filter_orgs",type:"text",className:"text-center",onChange:x,placeholder:"filter your organizations",value:e||""}),e&&(0,p.jsx)(m.A,{className:"clear-filter",onClick:h,children:(0,p.jsx)("i",{className:"fa fa-times"})})]})};const j=function(){const e=(0,i.O$)(o.A,(e=>e.auth.orgs)),[t,s]=r.useState(!0);return(0,p.jsx)(m.A,{color:"link",className:"btn btn-purple px-4 mx-2",onClick:()=>{o.A.update((r=>{r.auth.orgs=function(e,t){const s=[...e];return t?s.sort(((e,t)=>e.customer_name.localeCompare(t.customer_name))):s.sort(((e,t)=>t.customer_name.localeCompare(e.customer_name))),s}(e,t),s(!t)}))},children:t?(0,p.jsxs)("span",{children:[(0,p.jsx)("i",{className:"fa fa-sort-alpha-up"})," Sort by Name: Ascending"]}):(0,p.jsxs)("span",{children:[(0,p.jsx)("i",{className:"fa fa-sort-alpha-down"})," Sort by Name: Descending"]})})};var f=s(3150),b=s(3628);const A=function(){return(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:(0,p.jsx)(l.A,{className:"app-subnav",children:(0,p.jsxs)(d.A,{navbar:!0,children:[(0,p.jsx)("div",{className:"filter-holder",children:(0,p.jsx)(g,{})}),(0,p.jsx)(j,{})]})})})};var v=s(6114),N=s(4084),y=s(8156),O=s(7348),_=s(2714);const k=async e=>{let{auth:t,customer_id:s,user_id:r,status:a}=e;return(0,_.A)({endpoint:"updateUserOrgs",method:"POST",payload:{customer_id:s,user_id:r,status:a},auth:t})};var C=s(5429),S=s(3304);const w=function(e){let{loading:t,status:s,customer_name:a,setFlipState:n,total_instance_count:i}=e;const c=(0,O.MW)(),o=(0,r.useCallback)((e=>{e.stopPropagation();const t=e.currentTarget.getAttribute("data-action");"delete"===t&&i?c.error("You must remove all instances from an Organization before deleting it."):n(t)}),[i,c,n]);return t?(0,p.jsx)("i",{className:"status-icon fa fa-spinner fa-spin text-purple"}):"accepted"===s?(0,p.jsx)(m.A,{"data-action":"leave",className:"status-icon",color:"link",title:`Leave ${a} organization`,onClick:o,children:(0,p.jsx)("i",{className:"fa fa-times-circle text-purple"})}):"owner"===s?(0,p.jsx)(m.A,{"data-action":"delete",className:"status-icon",color:"link",title:`Delete ${a} organization`,onClick:o,children:(0,p.jsx)("i",{className:"fa fa-trash delete text-purple "+(i?"disabled":"")})}):null};const E=function(e){let{customer_name:t,customer_id:s,total_instance_count:l,status:d,setFlipState:u}=e;const x=(0,i.O$)(o.A,(e=>e.auth)),[h,g]=(0,r.useState)(!1),j=(0,n.Zp)(),A=(0,O.MW)(),_=!h&&["owner","accepted"].includes(d),E=async e=>{const t=e.currentTarget.getAttribute("data-status");g(t);const r=await k({auth:x,customer_id:s,user_id:x.user_id,status:t});r.error?(A.error(r.message),g(!1)):(await(0,S.A)(x),"declined"!==t&&g(!1),A.success(`Organization ${t} successfully`))};return(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance "+(_?"clickable":""),onClick:async()=>_&&j(`/o/${s}/instances`),children:(0,p.jsxs)(y.A,{children:[(0,p.jsxs)(a.A,{className:"g-0",children:[(0,p.jsx)(v.A,{xs:"10",className:"org-name",children:t}),(0,p.jsx)(v.A,{xs:"2",className:"status-icons text-end",children:(0,p.jsx)(w,{status:d,loading:h,customer_name:t,setFlipState:u,total_instance_count:l})})]}),(0,p.jsxs)("div",{className:"org-status",children:["ORG ID: ",s]}),(0,p.jsx)(C.A,{textClass:"text-bold",label:"ROLE",isReady:!0,value:"accepted"===d?"USER":d.toUpperCase(),bottomDivider:!0}),(0,p.jsx)(C.A,{label:"INSTANCES",isReady:!0,value:l||"..."}),(0,p.jsx)("div",{className:"action-buttons",children:"invited"===d&&(0,p.jsxs)(a.A,{className:"g-0",children:[(0,p.jsx)(v.A,{xs:"6",className:"pe-1",children:(0,p.jsx)(m.A,{title:`Decline invitation to ${t} organization`,disabled:!!h,color:"danger",block:!0,"data-status":"declined",onClick:E,children:"declined"===h?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,p.jsx)("span",{children:"Decline"})})}),(0,p.jsx)(v.A,{xs:"6",className:"ps-1",children:(0,p.jsx)(m.A,{title:`Accept invitation to ${t} organization`,disabled:!!h,color:"success",block:!0,"data-status":"accepted",onClick:E,children:"accepted"===h?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin text-white"}):(0,p.jsx)("span",{children:"Join"})})})]})})]})})})};var z=s(9163),F=s.n(z);const $=function(e){var t;let{customer_id:s,customer_name:n,setFlipState:l,flipState:d}=e;const x=(0,O.MW)(),h=(0,i.O$)(o.A,(e=>e.auth)),[g,j]=(0,r.useState)({}),[A,_]=(0,r.useState)({});return F()((async()=>{const{submitted:e}=g;if(e){const{delete_customer_name:e}=A;if(n.toString()!==(null===e||void 0===e?void 0:e.toString()))j({error:"organization name is not correct"});else{const e=await k({auth:h,customer_id:s,user_id:h.user_id,status:"removed"});e.error?x.error(e.message):(await(0,S.A)(h),x.success("Organization removed from your profile successfully"))}}}),[g]),(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance",children:d&&(0,p.jsxs)(y.A,{children:[(0,p.jsxs)("ul",{className:"text-small my-0 text-nowrap",children:[(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"YOU"})," will be removed from the org."]}),(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"THE ORG"})," will not be removed."]})]}),(0,p.jsx)(u.A,{id:"customer_name",onChange:e=>_({delete_customer_name:e.target.value}),type:"text",title:"customer name",className:"my-3",placeholder:`Enter "${n}" here to confirm.`,value:A.customer_name}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>j({submitted:!0}),title:"Confirm Organization Details",block:!0,disabled:g.submitted||(null===n||void 0===n?void 0:n.toString())!==(null===(t=A.delete_customer_name)||void 0===t?void 0:t.toString()),color:"danger",children:g.submitted?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin"}):(0,p.jsx)("span",{children:"Do It"})})})]})]})})})};const T=function(e){var t;let{customer_id:s,customer_name:n,setFlipState:l,flipState:d}=e;const x=(0,O.MW)(),h=(0,i.O$)(o.A,(e=>e.auth)),[g,j]=(0,r.useState)({}),[A,k]=(0,r.useState)({});return F()((async()=>{const{submitted:e}=g;if(e){const{delete_customer_name:e}=A;if(n.toString()!==(null===e||void 0===e?void 0:e.toString()))j({error:"organization name is not correct"});else{const e=await(async e=>{let{auth:t,user_id:s,customer_id:r}=e;return(0,_.A)({endpoint:"removeOrg",method:"POST",payload:{user_id:s,customer_id:r},auth:t})})({auth:h,customer_id:s.toString(),user_id:h.user_id});e.error?j({error:e.message}):(await(0,S.A)(h),x.success("Organization removed successfully"))}}}),[g]),(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:s}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{className:"instance",children:d&&(0,p.jsx)(y.A,{children:g.error?(0,p.jsxs)(p.Fragment,{children:["There was an error processing your request:",(0,p.jsx)("hr",{className:"mt-3 mb-2"}),(0,p.jsx)("div",{className:"text-danger text-small",children:g.error}),(0,p.jsx)("hr",{className:"mt-2 mb-3"}),(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("ul",{className:"text-small text-nowrap my-0",children:[(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"INSTANCES"})," must first be removed."]}),(0,p.jsxs)("li",{children:[(0,p.jsx)("b",{children:"USERS"})," will no longer see this org."]})]}),(0,p.jsx)(u.A,{id:"customer_name",onChange:e=>k({delete_customer_name:e.target.value}),type:"text",title:"customer name",className:"my-3",placeholder:`Enter "${n}" here to confirm.`,value:A.customer_name}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{onClick:()=>l(!1),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{children:(0,p.jsx)(m.A,{id:"deleteOrganization",onClick:()=>j({submitted:!0}),title:"Confirm Organization Details",block:!0,disabled:g.submitted||(null===n||void 0===n?void 0:n.toString())!==(null===(t=A.delete_customer_name)||void 0===t?void 0:t.toString()),color:"danger",children:g.submitted?(0,p.jsx)("i",{className:"fa fa-spinner fa-spin"}):(0,p.jsx)("span",{children:"Do It"})})})]})]})})})})};const M=function(e){return"leave"===e.flipState?(0,p.jsx)($,{...e}):(0,p.jsx)(T,{...e})};var D=s(1852);const H=function(e){let{flippedCard:t,setFlippedCard:s,customer_id:a,...n}=e;const[i,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{t!==a&&o(!1)}),[t]),(0,r.useEffect)((()=>{i&&s(a)}),[i]),(0,p.jsx)(v.A,{xs:"12",md:"6",lg:"4",xl:"3",className:"mb-4",children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t},customer_id:a}),FallbackComponent:D.A,children:i?(0,p.jsx)(M,{setFlipState:o,flipState:i,customer_id:a,...n}):(0,p.jsx)(E,{setFlipState:o,flipState:i,customer_id:a,...n})})})},I=()=>{const[e,t]=(0,r.useState)(!1);return(0,i.O$)(o.A,(e=>(e=>{let{orgSearch:t,orgs:s}=e;if(!s)return[];const r=((e,t)=>{const s={};return e.filter((e=>!s[e[t]]&&(s[e[t]]=!0,!0)))})(s,"customer_id");return t&&""!==t?r.filter((e=>e.customer_name&&-1!==e.customer_name.toLowerCase().indexOf(t.toLowerCase()))):r})({orgSearch:e.orgSearch,orgs:e.auth.orgs}))).map((s=>(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:D.A,children:(0,p.jsx)(H,{...s,flippedCard:e,setFlippedCard:t})},s.customer_id)))};const P=function(){const e=(0,n.Zp)(),t=()=>{window._kmq&&window._kmq.push(["record","clicked new org card"]),e("/organizations/new")};return(0,p.jsx)(v.A,{xs:"12",md:"6",lg:"4",xl:"3",className:"mb-4",children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:(0,p.jsx)(N.A,{tabIndex:"0",id:"newOrgCard",title:"Add New Organization",className:"instance new",onKeyDown:e=>13!==e.keyCode||t(),onClick:t,children:(0,p.jsxs)(y.A,{className:"d-flex flex-column align-items-center justify-content-center",children:[(0,p.jsx)("span",{children:"Create A New Organization"}),(0,p.jsx)("div",{className:"my-4",children:(0,p.jsx)("i",{className:"fa fa-2x fa-plus-circle new-org-plus"})}),(0,p.jsx)("span",{children:"With Its Own Instances And Billing"})]})})})})};var U=s(6685),R=s(877),q=s(1340),L=s(1652);var W=s(4701);const Y=async e=>{let{formData:t,auth:s}=e;const{org:r,subdomain:a}=t;if(!r||!a)return{error:"All fields must be filled out"};if(!(0,W.A)(a))return{error:"subdomain: alphanumeric characters only"};if(a.length>16)return{error:"subdomain: max 16 characters"};const n=await(async e=>{let{auth:t,org:s,subdomain:r}=e;return(0,_.A)({endpoint:"addOrg",method:"POST",auth:t,payload:{org:s,subdomain:r,user_id:t.user_id}})})({auth:s,org:r,subdomain:a});return n.error?{error:n.message.replace("Bad request: ","").replace(/['"]+/g,"")}:{success:!0}};const Z=function(){const e=(0,i.O$)(o.A,(e=>e.auth)),t=(0,i.O$)(o.A,(e=>e.theme)),s=(0,n.Zp)(),[l,d]=(0,r.useState)({}),[x,h]=(0,r.useState)({}),[g,j]=(0,r.useState)(!1),A=()=>s("/organizations");return F()((async()=>{if(x.submitted){j(!1);const t=await Y({formData:l,auth:e});h(t),t.error||(await(0,S.A)(e),A())}}),[x]),(0,r.useEffect)((()=>{x.submitted||h({})}),[l]),(0,p.jsx)(U.A,{id:"new-org-modal",isOpen:!0,className:t,centered:!0,fade:!1,children:(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:f.A,children:e.email_bounced?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsxs)(y.A,{children:[(0,p.jsxs)("div",{className:"p-4 pb-0 text-center",children:[(0,p.jsx)("b",{children:"Unable to Create New Organization"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"Your email address seems to be unreachable. Please update it to ensure billing, upgrade, and other critical system announcements reach you."]}),(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{sm:"6",children:(0,p.jsx)(m.A,{id:"cancelNewOrg",onClick:()=>s("/organizations"),title:"Cancel New Org",block:!0,className:"mt-3",color:"grey",children:"Cancel"})}),(0,p.jsx)(v.A,{sm:"6",children:(0,p.jsx)(m.A,{id:"updateEmail",onClick:()=>s("/profile"),title:"Update My Email",block:!0,className:"mt-3",color:"danger",children:"Update My Email"})})]})]})})}):x.submitted?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsx)(y.A,{children:(0,p.jsxs)("div",{className:"p-4 text-center",children:[(0,p.jsx)("b",{children:"Creating Your Organization"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("i",{className:"fa fa-lg fa-spinner fa-spin text-purple mb-4"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"The Organization Otterhound is fetching your stuff."]})})})}):x.success?(0,p.jsx)(R.A,{children:(0,p.jsx)(N.A,{children:(0,p.jsx)(y.A,{children:(0,p.jsxs)("div",{className:"p-4 text-center",children:[(0,p.jsx)("b",{children:"Success"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),(0,p.jsx)("i",{className:"fa fa-lg fa-thumbs-up text-purple mb-4"}),(0,p.jsx)("br",{}),(0,p.jsx)("br",{}),"Your organization was created successfully."]})})})}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(q.A,{toggle:A,children:"Add New Organization"}),(0,p.jsxs)(R.A,{children:[(0,p.jsx)(N.A,{className:"mb-3",children:(0,p.jsxs)(y.A,{children:[(0,p.jsx)(L.A,{header:"Name",children:(0,p.jsxs)(a.A,{children:[(0,p.jsx)(v.A,{sm:"4",className:"pt-2 text-nowrap text-grey",children:'Ex: "My Org"'}),(0,p.jsx)(v.A,{sm:"8",children:(0,p.jsx)(u.A,{id:"org_name",className:"text-center",onChange:e=>d({...l,org:e.target.value}),type:"text",title:"name",value:l.org||""})})]})}),(0,p.jsxs)(L.A,{header:"Subdomain",subheader:"alphanumeric only. 16 char max.",children:[(0,p.jsxs)(a.A,{children:[(0,p.jsxs)(v.A,{sm:"4",className:"pt-2 text-nowrap text-grey",children:['Ex: "myorg"\xa0',(0,p.jsx)(m.A,{color:"link",title:"Learn more",onClick:()=>j(!g),children:(0,p.jsx)("i",{className:"fa fa-question-circle text-purple"})})]}),(0,p.jsx)(v.A,{sm:"8",children:(0,p.jsx)(u.A,{id:"subdomain",className:"text-center",type:"text",title:"subdomain",value:l.subdomain||"",disabled:x.submitted,onChange:e=>d({...l,subdomain:e.target.value.substring(0,15).toLowerCase()})})})]}),g&&(0,p.jsx)("div",{className:"text-center pt-2 pb-1 text-lightpurple text-small",children:(0,p.jsx)("i",{children:"Part of the URL of your Harper Cloud Instances- see below."})}),(0,p.jsx)("hr",{className:"my-2 d-none d-sm-block"}),(0,p.jsx)(a.A,{children:(0,p.jsx)(v.A,{xs:"12",className:"pt-2 text-center text-nowrap overflow-hidden text-truncate",children:l.subdomain?(0,p.jsxs)("i",{className:"text-grey",children:["INSTANCE_NAME-",l.subdomain,".harperdbcloud.com"]}):(0,p.jsx)("span",{className:"text-lightgrey",children:"INSTANCE_NAME-SUBDOMAIN.harperdbcloud.com"})})})]})]})}),(0,p.jsx)(m.A,{id:"createOrganization",onClick:()=>h({submitted:!0}),title:"Create Organization",block:!0,className:"mt-3",color:"success",children:"Create Organization"}),x.error&&(0,p.jsx)(N.A,{className:"mt-3 error",children:(0,p.jsx)(y.A,{children:x.error})})]})]})})})};var B=s(4979);const G=function(){const{list:e,action:t}=(0,n.g)(),s=(0,n.Zp)(),l=(0,i.O$)(o.A,(e=>e.auth));return(0,r.useEffect)((()=>o.A.update((e=>{e.users=!1,e.instances=!1,e.hasCard=!1,e.lastUpdate=!1})))),(0,r.useEffect)((()=>{1!==(null===l||void 0===l?void 0:l.orgs.filter((e=>["accepted","owner"].includes(e.status)))).length||e&&"sign-up"!==e||s(`/o/${l.orgs[0].customer_id}/instances`)}),[l,e]),(0,p.jsxs)("div",{id:"organizations",children:[(0,p.jsx)(A,{}),null!==l&&void 0!==l&&l.orgs?(0,p.jsxs)(a.A,{children:[(0,p.jsx)(c.tH,{onError:(e,t)=>(0,b.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:D.A,children:(0,p.jsx)(P,{})}),(0,p.jsx)(I,{})]}):(0,p.jsx)(B.A,{header:"loading organizations",spinner:!0}),"new"===t&&(0,p.jsx)(Z,{})]})}},5429:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var r=s(7176),a=s(6114),n=s(4414);const i=function(e){let{label:t,value:s,textClass:i="",isReady:c,bottomDivider:o=!1}=e;return(0,n.jsxs)(r.A,{className:"card-front-status-row text-darkgrey",children:[(0,n.jsx)(a.A,{xs:"4",children:t}),(0,n.jsx)(a.A,{xs:"8",className:i,children:c?s:""}),o&&(0,n.jsx)(a.A,{xs:"12",children:(0,n.jsx)("hr",{})})]})}},1652:(e,t,s)=>{s.d(t,{A:()=>a});s(9950);var r=s(4414);const a=function(e){let{children:t,header:s,subheader:a,maxHeight:n="auto",minHeight:i="auto",className:c}=e;return(0,r.jsxs)("div",{className:`content-container ${c}`,children:[(0,r.jsxs)("div",{className:"header-container",children:[(0,r.jsx)("span",{className:"header",children:s}),(0,r.jsx)("span",{className:"subheader",children:a})]}),(0,r.jsx)("div",{className:"auto"!==n?"scrollable":"",style:{maxHeight:n,minHeight:i},children:t})]})}},1852:(e,t,s)=>{s.d(t,{A:()=>n});s(9950);var r=s(3150),a=s(4414);const n=function(e){return(0,a.jsx)(r.A,{...e,extraClass:"entity-card"})}},4701:(e,t,s)=>{s.d(t,{A:()=>r});const r=e=>e.match(/^[a-z0-9]+$/i)},8125:(e,t,s)=>{s.d(t,{A:()=>h});var r=s(9950),a=s(1942),n=s.n(a),i=s(8738),c=s.n(i),o=s(1497),l=["className","cssModule","tabs","pills","vertical","horizontal","justified","fill","navbar","card","tag"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},d.apply(this,arguments)}function u(e,t){if(null==e)return{};var s,r,a=function(e,t){if(null==e)return{};var s,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}var m={card:n().bool,className:n().string,cssModule:n().object,fill:n().bool,horizontal:n().oneOf(["center","end"]),justified:n().bool,navbar:n().bool,pills:n().bool,tabs:n().bool,tag:o.Wx,vertical:n().oneOfType([n().bool,n().string])};function x(e){var t=e.className,s=e.cssModule,a=e.tabs,n=e.pills,i=e.vertical,m=void 0!==i&&i,x=e.horizontal,h=e.justified,p=e.fill,g=e.navbar,j=e.card,f=e.tag,b=void 0===f?"ul":f,A=u(e,l),v=(0,o.qO)(c()(t,g?"navbar-nav":"nav",!!x&&"justify-content-".concat(x),function(e){return!1!==e&&(!0===e||"xs"===e?"flex-column":"flex-".concat(e,"-column"))}(m),{"nav-tabs":a,"card-header-tabs":j&&a,"nav-pills":n,"card-header-pills":j&&n,"nav-justified":h,"nav-fill":p}),s);return r.createElement(b,d({},A,{className:v}))}x.propTypes=m;const h=x},2072:(e,t,s)=>{s.d(t,{A:()=>p});var r=s(9950),a=s(1942),n=s.n(a),i=s(8738),c=s.n(i),o=s(1497),l=["expand","className","cssModule","light","dark","fixed","sticky","color","container","tag","children"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e},d.apply(this,arguments)}function u(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function m(e,t){if(null==e)return{};var s,r,a=function(e,t){if(null==e)return{};var s,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||(a[s]=e[s]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)s=n[r],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(a[s]=e[s])}return a}var x={children:n().node,className:n().string,color:n().string,container:n().oneOfType([n().bool,n().string]),cssModule:n().object,dark:n().bool,expand:n().oneOfType([n().bool,n().string]),fixed:n().string,light:n().bool,role:n().string,sticky:n().string,tag:o.Wx};function h(e){var t,s=e.expand,a=void 0!==s&&s,n=e.className,i=e.cssModule,x=e.light,h=e.dark,p=e.fixed,g=e.sticky,j=e.color,f=e.container,b=void 0===f?"fluid":f,A=e.tag,v=void 0===A?"nav":A,N=e.children,y=m(e,l),O=(0,o.qO)(c()(n,"navbar",function(e){return!1!==e&&(!0===e||"xs"===e?"navbar-expand":"navbar-expand-".concat(e))}(a),(u(t={"navbar-light":x,"navbar-dark":h},"bg-".concat(j),j),u(t,"fixed-".concat(p),p),u(t,"sticky-".concat(g),g),t)),i),_=b&&!0===b?"container":"container-".concat(b);return r.createElement(v,d({},y,{className:O}),b?r.createElement("div",{className:_},N):N)}h.propTypes=x;const p=h},9163:(e,t,s)=>{var r=s(9950);function a(e,t,s){var a="function"===typeof t;r.useEffect((function(){var s,r=!0,n=e((function(){return r}));return Promise.resolve(n).then((function(e){s=e})),function(){r=!1,a&&t(s)}}),a?s:t)}e.exports=a,e.exports.useAsyncEffect=a}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[138],{4244:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var r=t(9950),a=t(1345),n=t(4414);const o=(0,r.lazy)((()=>Promise.all([t.e(759),t.e(138)]).then(t.bind(t,2670)))),i=[{element:(0,n.jsx)(o,{}),path:"",link:"profile",label:"profile",icon:"user",iconCode:"f007"}];var l=t(8651),c=t(4979);const d=function(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{}),(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(c.A,{header:" ",spinner:!0}),children:(0,n.jsxs)(a.BV,{children:[i.map((e=>(0,n.jsx)(a.qh,{path:e.path,element:e.element},e.path))),(0,n.jsx)(a.qh,{path:"*",element:(0,n.jsx)(a.C5,{to:"/profile",replace:!0})},"*")]})})]})}},2670:(e,s,t)=>{t.r(s),t.d(s,{default:()=>k});var r=t(9950),a=t(7176),n=t(6114),o=t(4084),i=t(8156),l=t(5488),c=t(3452),d=t(6713),u=t(9435),p=t(5553),m=t(2714),h=t(3628),f=t(5996),x=t(3304);var b=t(8188),g=t(3150),j=t(2773),v=t(4414);const y=function(){const e=(0,d.O$)(p.A,(e=>e.auth)),[s,t]=(0,r.useState)({}),[y,w]=(0,r.useState)(e),A="314px";return(0,r.useEffect)((()=>{let s=!0;return s&&null!==e&&void 0!==e&&e.profileError?t({error:e.message}):s&&null!==e&&void 0!==e&&e.profileSuccess&&t({success:e.message}),()=>{s=!1}}),[e.profileError,e.profileSuccess]),(0,r.useEffect)((()=>{let e=!0;return(s.error||s.success)&&setTimeout((()=>{e&&t({})}),2e3),()=>{e=!1}}),[s.error,s.success]),(0,v.jsx)(u.tH,{onError:(e,s)=>(0,h.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:g.A,children:(0,v.jsx)("div",{className:"my-3",children:s.processing?(0,v.jsx)(b.A,{height:A,status:"processing",header:"Updating Profile",subhead:"The Profile Poodle is doing his thing."}):s.success?(0,v.jsx)(b.A,{height:A,status:"success",header:"Success!",subhead:s.success}):s.error?(0,v.jsx)(b.A,{height:A,status:"error",header:s.error,subhead:"Please try again"}):(0,v.jsx)(o.A,{className:"mb-3",children:(0,v.jsxs)(i.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?(0,v.jsx)("span",{children:e.email}):(0,v.jsx)("span",{className:"text-danger",children:"please provide a valid email address"})}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"email",type:"text",className:"mb-0 text-center "+(null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?"":"error"),name:"email",placeholder:"email address",onChange:e=>w({...y,email:e.target.value}),value:y.email||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"first name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"firstname",type:"text",className:"mb-0 text-center",name:"fname",placeholder:"first name",onChange:e=>w({...y,firstname:e.target.value}),value:y.firstname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"last name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"lastname",type:"text",className:"mb-0 text-center",name:"lname",placeholder:"last name",onChange:e=>w({...y,lastname:e.target.value}),value:y.lastname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"github repo"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"github_repo",type:"text",className:"mb-0 text-center",name:"github_repo",placeholder:"github repo",onChange:e=>w({...y,github_repo:e.target.value}),value:y.github_repo||"",disabled:s.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(c.A,{id:"saveProfile",color:"purple",block:!0,onClick:()=>{t({submitted:!0});const{firstname:s,lastname:r,github_repo:a,email:n}=y;s&&r&&n?a&&!(0,j.A)(a)?t({error:"github repo must be a valid URL"}):e.firstname===s&&e.lastname===r&&e.github_repo===a&&e.email===n?t({error:"Nothing seems to have changed"}):(t({processing:!0}),(async e=>{let{auth:s,firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o,email:i}=e,l=null;try{return l=await(0,m.A)({endpoint:"updateUser",method:"POST",payload:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o,email:i},auth:s}),l.error?p.A.update((e=>{e.auth={...s,...l,profileError:Date.now()}})):(p.A.update((e=>{e.auth={...s,profileSuccess:Date.now(),...l}})),(0,x.A)({email:i,pass:s.pass,loggingIn:!0}))}catch(c){return(0,h.A)({type:"lms data",status:"error",url:f.A.lms_api_url,operation:"updateUser",request:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o},error:{catch:c.toString()},customer_id:a})}})({auth:e,firstname:s,lastname:r,user_id:e.user_id,github_repo:a,email:n})):t({error:"All fields are required"})},disabled:s.submitted,children:"Save Profile"})]})})})})};var w=t(4127),A=t(5283);const N=function(){const e=(0,d.O$)(p.A,(e=>e.auth)),[s,t]=(0,A.A)({}),[m,f]=(0,r.useState)({}),[x,j]=(0,r.useState)({}),y="259px";return(0,r.useEffect)((()=>{let e=!0;return(m.error||m.success)&&setTimeout((()=>{e&&f({})}),2e3),()=>{e=!1}}),[m.error,m.success]),(0,v.jsx)(u.tH,{onError:(e,s)=>(0,h.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:g.A,children:(0,v.jsx)("div",{className:"my-3",children:m.processing?(0,v.jsx)(b.A,{height:y,status:"processing",header:"Updating Password",subhead:"The Security Shepherd is mad-hashing."}):m.success?(0,v.jsx)(b.A,{height:y,status:"success",header:"Success!",subhead:m.success}):m.error?(0,v.jsx)(b.A,{height:y,status:"error",header:m.error,subhead:"Please try again"}):(0,v.jsx)(o.A,{children:(0,v.jsxs)(i.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"current password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"oldpassword",type:"password",className:"mb-0 text-center",name:"current password",placeholder:"current password",onChange:e=>j({...x,oldpassword:e.target.value}),value:x.oldpassword||"",disabled:m.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"new password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"newpassword1",type:"password",className:"mb-0 text-center",name:"new password",placeholder:"new password",onChange:e=>j({...x,newpassword:e.target.value}),value:x.newpassword||"",disabled:m.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"verify password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"newpassword2",type:"password",className:"mb-0 text-center",name:"verify password",placeholder:"verify password",onChange:e=>j({...x,newpassword2:e.target.value}),value:x.newpassword2||"",disabled:m.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(c.A,{id:"updatePassword",color:"purple",block:!0,onClick:async()=>{f({submitted:!0});const{oldpassword:r,newpassword:a,newpassword2:n}=x;if(r!==e.pass)f({error:"old password is incorrect"}),j({});else if(a!==n)f({error:"new passwords do not match"}),j({});else if(r&&a&&n){f({processing:!0});const r=await(0,w.A)({auth:e,user_id:e.user_id,password:a});!r||r.passwordError?f({error:e.message}):(t({...s,pass:a}),f({success:e.message}),j({}))}else f({error:"all fields are required"}),j({})},disabled:m.submitted,children:"Update Password"})]})})})})};const k=function(){return(0,v.jsxs)(a.A,{children:[(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"profile"}),(0,v.jsx)(y,{})]}),(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"password"}),(0,v.jsx)(N,{})]})]})}},8188:(e,s,t)=>{t.d(s,{A:()=>o});t(9950);var r=t(4084),a=t(8156),n=t(4414);const o=function(e){let{header:s,subhead:t=" ",height:o,status:i,className:l}=e;return(0,n.jsx)(r.A,{className:`form-status ${l}`,children:(0,n.jsxs)(a.A,{className:"text-center",style:{height:o},children:[(0,n.jsx)("div",{className:"text-bold",children:s}),(0,n.jsx)("div",{className:"py-4",children:(0,n.jsx)("i",{className:"fa fa-lg "+("processing"===i?"fa-spinner fa-spin text-purple":"success"===i?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,n.jsx)("div",{className:"text-grey",children:t})]})})}},8651:(e,s,t)=>{t.d(s,{A:()=>p});t(9950);var r=t(2072),a=t(8125),n=t(5746),o=t(6359),i=t(1345),l=t(9435),c=t(3150),d=t(3628),u=t(4414);const p=function(e){let{routes:s=[]}=e;const t=(0,i.Zp)(),p=(0,i.zy)(),m=(null===s||void 0===s?void 0:s.find((e=>e.link===p.pathname)))||s[0];return(0,u.jsx)(l.tH,{onError:(e,s)=>(0,d.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:c.A,children:(0,u.jsx)(r.A,{className:"app-subnav",children:m&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.A,{navbar:!0,className:"instance-nav d-none d-md-flex",children:s.map((e=>e.external?(0,u.jsx)("li",{className:"nav-item",children:(0,u.jsxs)("a",{className:"nav-link",href:e.url,target:"_blank",rel:"noreferrer",children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path):(0,u.jsx)(n.A,{children:(0,u.jsxs)(i.k2,{title:e.link,className:"nav-link",to:e.link||e.path,children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path)))}),(0,u.jsx)(a.A,{navbar:!0,className:"d-flex d-md-none",children:(0,u.jsx)(o.Ay,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:s}=e;return t(s)},options:s.filter((e=>e.link!==m.link)).map((e=>({label:(0,u.jsxs)("span",{children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]}),value:e.link,iconCode:e.iconCode}))),value:{...m,value:null===m||void 0===m?void 0:m.link},defaultValue:null===m||void 0===m?void 0:m.link,isSearchable:!1,isClearable:!1})})]})})})}},4127:(e,s,t)=>{t.d(s,{A:()=>i});var r=t(2714),a=t(5553),n=t(3628),o=t(5996);const i=async e=>{let{auth:s,user_id:t,password:i}=e,l=null;try{if(l=await(0,r.A)({endpoint:"updatePassword",method:"POST",payload:{user_id:t,password:i,loggingIn:!0},auth:s}),l.error){const e={...s,...l,passwordError:Date.now()};return a.A.update((s=>{s.auth=e})),e}const e={...s,passwordSuccess:Date.now(),update_password:!1,...l,pass:i};return a.A.update((s=>{s.auth=e})),e}catch(c){return(0,n.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"updatePassword",request:{user_id:t},error:{catch:c.toString()}})}}},2773:(e,s,t)=>{t.d(s,{A:()=>r});const r=e=>!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)},5488:(e,s,t)=>{t.d(s,{A:()=>v});var r=t(9950),a=t(1942),n=t.n(a),o=t(8738),i=t.n(o),l=t(1497);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var d=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u.apply(this,arguments)}function p(e,s){if(null==e)return{};var t,r,a=function(e,s){if(null==e)return{};var t,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||(a[t]=e[t]);return a}(e,s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function m(e,s){for(var t=0;t<s.length;t++){var r=s[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,s){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,s){return e.__proto__=s,e},h(e,s)}function f(e){var s=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,r=b(e);if(s){var a=b(this).constructor;t=Reflect.construct(r,arguments,a)}else t=r.apply(this,arguments);return function(e,s){if(s&&("object"===c(s)||"function"===typeof s))return s;if(void 0!==s)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,t)}}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var g={children:n().node,type:n().string,size:n().oneOfType([n().number,n().string]),bsSize:n().string,valid:n().bool,invalid:n().bool,tag:l.Wx,innerRef:n().oneOfType([n().object,n().func,n().string]),plaintext:n().bool,addon:n().bool,className:n().string,cssModule:n().object},j=function(e){!function(e,s){if("function"!==typeof s&&null!==s)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(s&&s.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),s&&h(e,s)}(o,e);var s,t,a,n=f(o);function o(e){var s;return function(e,s){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")}(this,o),(s=n.call(this,e)).getRef=s.getRef.bind(x(s)),s.focus=s.focus.bind(x(s)),s}return s=o,(t=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,s=e.className,t=e.cssModule,a=e.type,n=void 0===a?"text":a,o=e.bsSize,c=e.valid,m=e.invalid,h=e.tag,f=e.addon,x=e.plaintext,b=e.innerRef,g=p(e,d),j=["switch","radio","checkbox"].indexOf(n)>-1,v="select"===n,y="range"===n,w=h||(v||"textarea"===n?n:"input"),A="form-control";x?(A="".concat(A,"-plaintext"),w=h||"input"):y?A="form-range":v?A="form-select":j&&(A=f?null:"form-check-input"),g.size&&/\D/g.test(g.size)&&((0,l.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=g.size,delete g.size);var N=(0,l.qO)(i()(s,m&&"is-invalid",c&&"is-valid",!!o&&(v?"form-select-".concat(o):"form-control-".concat(o)),A),t);return("input"===w||h&&"function"===typeof h)&&(g.type="switch"===n?"checkbox":n),g.children&&!x&&"select"!==n&&"string"===typeof w&&"select"!==w&&((0,l.mc)('Input with a type of "'.concat(n,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete g.children),r.createElement(w,u({},g,{ref:b,className:N,"aria-invalid":m}))}}])&&m(s.prototype,t),a&&m(s,a),Object.defineProperty(s,"prototype",{writable:!1}),o}(r.Component);j.propTypes=g;const v=j}}]);
1
+ "use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[138],{4244:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var r=t(9950),a=t(5201),n=t(4414);const o=(0,r.lazy)((()=>Promise.all([t.e(759),t.e(138)]).then(t.bind(t,2670)))),i=[{element:(0,n.jsx)(o,{}),path:"",link:"profile",label:"profile",icon:"user",iconCode:"f007"}];var l=t(8651),c=t(4979);const d=function(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{}),(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)(c.A,{header:" ",spinner:!0}),children:(0,n.jsxs)(a.BV,{children:[i.map((e=>(0,n.jsx)(a.qh,{path:e.path,element:e.element},e.path))),(0,n.jsx)(a.qh,{path:"*",element:(0,n.jsx)(a.C5,{to:"/profile",replace:!0})},"*")]})})]})}},2670:(e,s,t)=>{t.r(s),t.d(s,{default:()=>k});var r=t(9950),a=t(7176),n=t(6114),o=t(4084),i=t(8156),l=t(5488),c=t(3452),d=t(6713),u=t(9435),p=t(5553),m=t(2714),h=t(3628),f=t(5996),x=t(3304);var b=t(8188),g=t(3150),j=t(2773),v=t(4414);const y=function(){const e=(0,d.O$)(p.A,(e=>e.auth)),[s,t]=(0,r.useState)({}),[y,w]=(0,r.useState)(e),A="314px";return(0,r.useEffect)((()=>{let s=!0;return s&&null!==e&&void 0!==e&&e.profileError?t({error:e.message}):s&&null!==e&&void 0!==e&&e.profileSuccess&&t({success:e.message}),()=>{s=!1}}),[e.profileError,e.profileSuccess]),(0,r.useEffect)((()=>{let e=!0;return(s.error||s.success)&&setTimeout((()=>{e&&t({})}),2e3),()=>{e=!1}}),[s.error,s.success]),(0,v.jsx)(u.tH,{onError:(e,s)=>(0,h.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:g.A,children:(0,v.jsx)("div",{className:"my-3",children:s.processing?(0,v.jsx)(b.A,{height:A,status:"processing",header:"Updating Profile",subhead:"The Profile Poodle is doing his thing."}):s.success?(0,v.jsx)(b.A,{height:A,status:"success",header:"Success!",subhead:s.success}):s.error?(0,v.jsx)(b.A,{height:A,status:"error",header:s.error,subhead:"Please try again"}):(0,v.jsx)(o.A,{className:"mb-3",children:(0,v.jsxs)(i.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?(0,v.jsx)("span",{children:e.email}):(0,v.jsx)("span",{className:"text-danger",children:"please provide a valid email address"})}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"email",type:"text",className:"mb-0 text-center "+(null===e||void 0===e||!e.email_bounced||null!==e&&void 0!==e&&e.profileSuccess?"":"error"),name:"email",placeholder:"email address",onChange:e=>w({...y,email:e.target.value}),value:y.email||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"first name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"firstname",type:"text",className:"mb-0 text-center",name:"fname",placeholder:"first name",onChange:e=>w({...y,firstname:e.target.value}),value:y.firstname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"last name"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"lastname",type:"text",className:"mb-0 text-center",name:"lname",placeholder:"last name",onChange:e=>w({...y,lastname:e.target.value}),value:y.lastname||"",disabled:s.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"github repo"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"github_repo",type:"text",className:"mb-0 text-center",name:"github_repo",placeholder:"github repo",onChange:e=>w({...y,github_repo:e.target.value}),value:y.github_repo||"",disabled:s.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(c.A,{id:"saveProfile",color:"purple",block:!0,onClick:()=>{t({submitted:!0});const{firstname:s,lastname:r,github_repo:a,email:n}=y;s&&r&&n?a&&!(0,j.A)(a)?t({error:"github repo must be a valid URL"}):e.firstname===s&&e.lastname===r&&e.github_repo===a&&e.email===n?t({error:"Nothing seems to have changed"}):(t({processing:!0}),(async e=>{let{auth:s,firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o,email:i}=e,l=null;try{return l=await(0,m.A)({endpoint:"updateUser",method:"POST",payload:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o,email:i},auth:s}),l.error?p.A.update((e=>{e.auth={...s,...l,profileError:Date.now()}})):(p.A.update((e=>{e.auth={...s,profileSuccess:Date.now(),...l}})),(0,x.A)({email:i,pass:s.pass,loggingIn:!0}))}catch(c){return(0,h.A)({type:"lms data",status:"error",url:f.A.lms_api_url,operation:"updateUser",request:{firstname:t,lastname:r,customer_id:a,user_id:n,github_repo:o},error:{catch:c.toString()},customer_id:a})}})({auth:e,firstname:s,lastname:r,user_id:e.user_id,github_repo:a,email:n})):t({error:"All fields are required"})},disabled:s.submitted,children:"Save Profile"})]})})})})};var w=t(4127),A=t(5283);const N=function(){const e=(0,d.O$)(p.A,(e=>e.auth)),[s,t]=(0,A.A)({}),[m,f]=(0,r.useState)({}),[x,j]=(0,r.useState)({}),y="259px";return(0,r.useEffect)((()=>{let e=!0;return(m.error||m.success)&&setTimeout((()=>{e&&f({})}),2e3),()=>{e=!1}}),[m.error,m.success]),(0,v.jsx)(u.tH,{onError:(e,s)=>(0,h.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:g.A,children:(0,v.jsx)("div",{className:"my-3",children:m.processing?(0,v.jsx)(b.A,{height:y,status:"processing",header:"Updating Password",subhead:"The Security Shepherd is mad-hashing."}):m.success?(0,v.jsx)(b.A,{height:y,status:"success",header:"Success!",subhead:m.success}):m.error?(0,v.jsx)(b.A,{height:y,status:"error",header:m.error,subhead:"Please try again"}):(0,v.jsx)(o.A,{children:(0,v.jsxs)(i.A,{children:[(0,v.jsxs)(a.A,{children:[(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"current password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"oldpassword",type:"password",className:"mb-0 text-center",name:"current password",placeholder:"current password",onChange:e=>j({...x,oldpassword:e.target.value}),value:x.oldpassword||"",disabled:m.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"new password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"newpassword1",type:"password",className:"mb-0 text-center",name:"new password",placeholder:"new password",onChange:e=>j({...x,newpassword:e.target.value}),value:x.newpassword||"",disabled:m.submitted})}),(0,v.jsx)(n.A,{xs:"12",children:(0,v.jsx)("hr",{className:"my-2"})}),(0,v.jsx)(n.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"verify password"}),(0,v.jsx)(n.A,{md:"6",xs:"12",children:(0,v.jsx)(l.A,{id:"newpassword2",type:"password",className:"mb-0 text-center",name:"verify password",placeholder:"verify password",onChange:e=>j({...x,newpassword2:e.target.value}),value:x.newpassword2||"",disabled:m.submitted})})]}),(0,v.jsx)("hr",{className:"mt-2 mb-4"}),(0,v.jsx)(c.A,{id:"updatePassword",color:"purple",block:!0,onClick:async()=>{f({submitted:!0});const{oldpassword:r,newpassword:a,newpassword2:n}=x;if(r!==e.pass)f({error:"old password is incorrect"}),j({});else if(a!==n)f({error:"new passwords do not match"}),j({});else if(r&&a&&n){f({processing:!0});const r=await(0,w.A)({auth:e,user_id:e.user_id,password:a});!r||r.passwordError?f({error:e.message}):(t({...s,pass:a}),f({success:e.message}),j({}))}else f({error:"all fields are required"}),j({})},disabled:m.submitted,children:"Update Password"})]})})})})};const k=function(){return(0,v.jsxs)(a.A,{children:[(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"profile"}),(0,v.jsx)(y,{})]}),(0,v.jsxs)(n.A,{md:"6",className:"mb-4",children:[(0,v.jsx)("span",{className:"floating-card-header",children:"password"}),(0,v.jsx)(N,{})]})]})}},8188:(e,s,t)=>{t.d(s,{A:()=>o});t(9950);var r=t(4084),a=t(8156),n=t(4414);const o=function(e){let{header:s,subhead:t=" ",height:o,status:i,className:l}=e;return(0,n.jsx)(r.A,{className:`form-status ${l}`,children:(0,n.jsxs)(a.A,{className:"text-center",style:{height:o},children:[(0,n.jsx)("div",{className:"text-bold",children:s}),(0,n.jsx)("div",{className:"py-4",children:(0,n.jsx)("i",{className:"fa fa-lg "+("processing"===i?"fa-spinner fa-spin text-purple":"success"===i?"fa-check-circle text-purple":"fa-exclamation-triangle text-danger")})}),(0,n.jsx)("div",{className:"text-grey",children:t})]})})}},8651:(e,s,t)=>{t.d(s,{A:()=>p});t(9950);var r=t(2072),a=t(8125),n=t(5746),o=t(6359),i=t(5201),l=t(9435),c=t(3150),d=t(3628),u=t(4414);const p=function(e){let{routes:s=[]}=e;const t=(0,i.Zp)(),p=(0,i.zy)(),m=(null===s||void 0===s?void 0:s.find((e=>e.link===p.pathname)))||s[0];return(0,u.jsx)(l.tH,{onError:(e,s)=>(0,d.A)({error:{message:e.message,componentStack:s}}),FallbackComponent:c.A,children:(0,u.jsx)(r.A,{className:"app-subnav",children:m&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(a.A,{navbar:!0,className:"instance-nav d-none d-md-flex",children:s.map((e=>e.external?(0,u.jsx)("li",{className:"nav-item",children:(0,u.jsxs)("a",{className:"nav-link",href:e.url,target:"_blank",rel:"noreferrer",children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path):(0,u.jsx)(n.A,{children:(0,u.jsxs)(i.k2,{title:e.link,className:"nav-link",to:e.link||e.path,children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]})},e.path)))}),(0,u.jsx)(a.A,{navbar:!0,className:"d-flex d-md-none",children:(0,u.jsx)(o.Ay,{className:"react-select-container",classNamePrefix:"react-select",width:"200px",onChange:e=>{let{value:s}=e;return t(s)},options:s.filter((e=>e.link!==m.link)).map((e=>({label:(0,u.jsxs)("span",{children:[(0,u.jsx)("i",{className:`d-none d-sm-inline-block fa me-1 fa-${e.icon}`}),e.label]}),value:e.link,iconCode:e.iconCode}))),value:{...m,value:null===m||void 0===m?void 0:m.link},defaultValue:null===m||void 0===m?void 0:m.link,isSearchable:!1,isClearable:!1})})]})})})}},4127:(e,s,t)=>{t.d(s,{A:()=>i});var r=t(2714),a=t(5553),n=t(3628),o=t(5996);const i=async e=>{let{auth:s,user_id:t,password:i}=e,l=null;try{if(l=await(0,r.A)({endpoint:"updatePassword",method:"POST",payload:{user_id:t,password:i,loggingIn:!0},auth:s}),l.error){const e={...s,...l,passwordError:Date.now()};return a.A.update((s=>{s.auth=e})),e}const e={...s,passwordSuccess:Date.now(),update_password:!1,...l,pass:i};return a.A.update((s=>{s.auth=e})),e}catch(c){return(0,n.A)({type:"lms data",status:"error",url:o.A.lms_api_url,operation:"updatePassword",request:{user_id:t},error:{catch:c.toString()}})}}},2773:(e,s,t)=>{t.d(s,{A:()=>r});const r=e=>!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)},5488:(e,s,t)=>{t.d(s,{A:()=>v});var r=t(9950),a=t(1942),n=t.n(a),o=t(8738),i=t.n(o),l=t(1497);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var d=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},u.apply(this,arguments)}function p(e,s){if(null==e)return{};var t,r,a=function(e,s){if(null==e)return{};var t,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||(a[t]=e[t]);return a}(e,s);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function m(e,s){for(var t=0;t<s.length;t++){var r=s[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,s){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,s){return e.__proto__=s,e},h(e,s)}function f(e){var s=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,r=b(e);if(s){var a=b(this).constructor;t=Reflect.construct(r,arguments,a)}else t=r.apply(this,arguments);return function(e,s){if(s&&("object"===c(s)||"function"===typeof s))return s;if(void 0!==s)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,t)}}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var g={children:n().node,type:n().string,size:n().oneOfType([n().number,n().string]),bsSize:n().string,valid:n().bool,invalid:n().bool,tag:l.Wx,innerRef:n().oneOfType([n().object,n().func,n().string]),plaintext:n().bool,addon:n().bool,className:n().string,cssModule:n().object},j=function(e){!function(e,s){if("function"!==typeof s&&null!==s)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(s&&s.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),s&&h(e,s)}(o,e);var s,t,a,n=f(o);function o(e){var s;return function(e,s){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")}(this,o),(s=n.call(this,e)).getRef=s.getRef.bind(x(s)),s.focus=s.focus.bind(x(s)),s}return s=o,(t=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,s=e.className,t=e.cssModule,a=e.type,n=void 0===a?"text":a,o=e.bsSize,c=e.valid,m=e.invalid,h=e.tag,f=e.addon,x=e.plaintext,b=e.innerRef,g=p(e,d),j=["switch","radio","checkbox"].indexOf(n)>-1,v="select"===n,y="range"===n,w=h||(v||"textarea"===n?n:"input"),A="form-control";x?(A="".concat(A,"-plaintext"),w=h||"input"):y?A="form-range":v?A="form-select":j&&(A=f?null:"form-check-input"),g.size&&/\D/g.test(g.size)&&((0,l.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=g.size,delete g.size);var N=(0,l.qO)(i()(s,m&&"is-invalid",c&&"is-valid",!!o&&(v?"form-select-".concat(o):"form-control-".concat(o)),A),t);return("input"===w||h&&"function"===typeof h)&&(g.type="switch"===n?"checkbox":n),g.children&&!x&&"select"!==n&&"string"===typeof w&&"select"!==w&&((0,l.mc)('Input with a type of "'.concat(n,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete g.children),r.createElement(w,u({},g,{ref:b,className:N,"aria-invalid":m}))}}])&&m(s.prototype,t),a&&m(s,a),Object.defineProperty(s,"prototype",{writable:!1}),o}(r.Component);j.propTypes=g;const v=j}}]);