UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

1 lines 28.3 kB
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[588],{1192:(e,t,s)=>{s.r(t),s.d(t,{default:()=>H});var r=s(9950),n=s(7176),a=s(6114),o=s(5077),c=s(6713),i=s(9163),d=s.n(i),l=s(5553),u=s(4084),m=s(8156),p=s(3452),x=s(9435),h=s(2714);var A=s(8188),v=s(5887),j=s(9519),f=s(3150),_=s(3628),g=s(4414);const b=function(e){var t,s,i,b,y,N,C,w,k,S,O,P,E,T,R;let{setEditingCard:$,customerCard:z,formStateHeight:F,badCard:H}=e;const{customer_id:I}=(0,o.g)(),q=(0,c.O$)(l.A,(e=>e.auth)),M=(0,c.O$)(l.A,(e=>e.instances)),D=(0,c.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,j.A)({auth:q,customer_id:I}),L({}),setTimeout((()=>$(!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)(A.A,{height:F,status:"processing",header:"Removing Card From Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):B.success?(0,g.jsx)(A.A,{height:F,status:"success",header:"Card Removed Successfully",subhead:"Your account is now limited to free products."}):B.error?(0,g.jsx)(A.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)(v.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:"".concat(null===z||void 0===z||null===(s=z.card)||void 0===s?void 0:s.exp_month," / ").concat(null===z||void 0===z||null===(i=z.card)||void 0===i?void 0:i.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===(R=T.address)||void 0===R?void 0:R.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:()=>$(!0),children:"Update Card"})})]})]})})})};var y=s(9379),N=s(5604),C=s(4283),w=s(1701),k=s(414);const S=function(e){let{setEditingCard:t,customerCard:s,formStateHeight:i,badCard:h}=e;const{customer_id:b}=(0,o.g)(),S=(0,c.O$)(l.A,(e=>e.auth)),O=(0,c.O$)(l.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),[P,E]=(0,r.useState)({postal_code:!1,card:!1,expire:!1,cvc:!1}),[T,R]=(0,r.useState)({}),$=(0,N.useStripe)(),z=(0,N.useElements)(),F=(0,o.Zp)(),{search:H}=(0,o.zy)(),{returnURL:I}=C.A.parse(H);return d()((async()=>{const{submitted:e,processing:s}=T;if(e&&!s){const{card:e,expire:s,cvc:r,postal_code:n,line1:a,line2:o,state:c,city:i,country:d}=P;if(e&&s&&r&&n&&a&&c&&i&&d){const e=await $.createPaymentMethod({type:"card",card:z.getElement(N.CardNumberElement),billing_details:{address:{postal_code:n,line1:a,line2:o,state:c,city:i,country:d}}});if(R({processing:!0}),e.error)R((0,y.A)((0,y.A)({},T),{},{error:e.error.message})),setTimeout((()=>R((0,y.A)((0,y.A)({},T),{},{error:!1}))),2e3);else{const s=await(0,w.A)({auth:S,payment_method_id:e.paymentMethod.id,stripe_id:O,customer_id:b});s.error?(R((0,y.A)((0,y.A)({},T),{},{error:s.message})),setTimeout((()=>R((0,y.A)((0,y.A)({},T),{},{error:!1}))),2e3)):(window._kmq&&window._kmq.push(["record","added credit card - billing page"]),R({success:s.message}),await(0,j.A)({auth:S,customer_id:b}),I?F(I):t(!1))}}else R({error:"All fields are required"})}}),[T]),(0,g.jsx)(x.tH,{onError:(e,t)=>(0,_.A)({error:{message:e.message,componentStack:t},customer_id:b}),FallbackComponent:f.A,children:T.processing?(0,g.jsx)(A.A,{height:i,status:"processing",header:"Adding Card To Your Account",subhead:"The Credit Schnauzer is securely contacting Stripe."}):T.success?(0,g.jsx)(A.A,{height:i,status:"success",header:"Success!",subhead:"Credit Card was successfully added to your account."}):T.error?(0,g.jsx)(A.A,{height:i,status:"error",header:T.error,subhead:"Please try again"}):(0,g.jsx)(u.A,{children:(0,g.jsxs)(m.A,{children:[h&&(0,g.jsx)(v.A,{}),(0,g.jsx)(k.A,{setFormData:E,formData:P}),(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:T.submitted||!P.card||!P.expire||!P.cvc||!P.postal_code||!$||!z,onClick:()=>R({submitted:!0}),block:!0,className:"mt-3",color:"success",children:s?"Save New Card":"Add Card To Account"})})]})]})})})};const O=function(){const[e,t]=(0,r.useState)(!1),s=(0,c.O$)(l.A,(e=>e.hasCard),[e]),n=(0,c.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)(S,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n}):(0,g.jsx)(b,{formStateHeight:a,setEditingCard:t,customerCard:s,badCard:n})})};var P=s(5996);let E;const T=function(){const{customer_id:e}=(0,o.g)(),t=(0,c.O$)(l.A,(e=>e.auth)),s=(0,c.O$)(l.A,(e=>e.invoices));return d()((()=>{E=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:P.A.lms_api_url,operation:"getInvoices",request:{customer_id:r},error:{catch:a.toString()},customer_id:r})}})({auth:t,signal:E.signal,customer_id:e})}),(()=>{var e;return null===(e=E)||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 R=s(2257);const $=function(){const{customer_id:e}=(0,o.g)(),t=(0,c.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)(R.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 z=s(5345),F=s(3906);const H=function(){const{customer_id:e}=(0,o.g)(),t=(0,c.O$)(l.A,(e=>e.auth)),s=(0,c.O$)(l.A,(e=>e.products)),i=(0,c.O$)(l.A,(e=>e.regions)),u=(0,c.O$)(l.A,(e=>e.subscriptions)),m=(0,c.O$)(l.A,(e=>e.instances)),p=(0,c.O$)(l.A,(e=>e.customer.is_unpaid));return(0,r.useEffect)((()=>{(0,j.A)({auth:t,customer_id:e})}),[]),d()((()=>{t&&s&&i&&u&&e&&(null===m||void 0===m||!m.length)&&(0,F.A)({auth:t,customer_id:e,products:s,regions:i,subscriptions:u,instanceCount:null===m||void 0===m?void 0:m.length})}),[t,s,i,e,u,m]),(0,g.jsxs)(n.A,{children:[p&&(0,g.jsx)(a.A,{xs:"12",children:(0,g.jsx)(z.A,{})}),(0,g.jsxs)(a.A,{md:"6",children:[(0,g.jsx)("span",{className:"floating-card-header",children:"card"}),(0,g.jsx)(O,{})]}),(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)(T,{})]})]})}},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),c=s(3452),i=s(9163),d=s.n(i),l=s(6713),u=s(9435),m=s(5077),p=s(4283),x=s(5553),h=s(2714);var A=s(9519),v=s(3150),j=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),i=(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:i,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,A.A)({auth:i,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,j.A)({error:{message:t.message,componentStack:s},customer_id:e}),FallbackComponent:v.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)(c.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(9379),n=s(9950),a=s(7176),o=s(6114),c=s(5488),i=s(5604),d=s(5285),l=s(6713),u=s(5077),m=s(9435);var p=s(5553),x=s(3150),h=s(3628),A=s(4414);const v=function(e){let{setFormData:t,formData:s}=e;const{customer_id:v}=(0,u.g)(),[j,f]=(0,n.useState)({}),_=(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,l.O$)(p.A,(e=>e.theme))});return(0,A.jsx)(m.tH,{onError:(e,t)=>(0,h.A)({error:{message:e.message,componentStack:t},customer_id:v}),FallbackComponent:x.A,children:(0,A.jsxs)(a.A,{children:[(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"card number"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)("div",{className:"fake-input ".concat(j.cardError?"error":""),children:(0,A.jsx)(i.CardNumberElement,{options:_,id:"ccCardNumber",onChange:e=>{var n;f((0,r.A)((0,r.A)({},j),{},{cardError:null===(n=e.error)||void 0===n?void 0:n.message})),t((0,r.A)((0,r.A)({},s),{},{card:e.complete}))}})})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"expiration"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)("div",{className:"fake-input ".concat(j.expError?"error":""),children:(0,A.jsx)(i.CardExpiryElement,{options:_,id:"ccExpire",onChange:e=>{var n;f((0,r.A)((0,r.A)({},j),{},{expError:null===(n=e.error)||void 0===n?void 0:n.message})),t((0,r.A)((0,r.A)({},s),{},{expire:e.complete}))}})})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"cvcc"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)("div",{className:"fake-input ".concat(j.cvcError?"error":""),children:(0,A.jsx)(i.CardCvcElement,{id:"ccCVC",options:_,onChange:e=>{var n;f((0,r.A)((0,r.A)({},j),{},{cvcError:null===(n=e.error)||void 0===n?void 0:n.message})),t((0,r.A)((0,r.A)({},s),{},{cvc:e.complete}))}})})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"country"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(d.wP,{id:"ccCountry",valueType:"short",value:s.country,priorityOptions:["CA","US","GB"],defaultOptionLabel:"select your country",onChange:e=>t((0,r.A)((0,r.A)({},s),{},{country:e}))})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"state/province"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(d.mM,{id:"ccRegion",blankOptionLabel:"select country first",defaultOptionLabel:"select state / province",valueType:"short",countryValueType:"short",country:s.country,value:s.state,onChange:e=>t((0,r.A)((0,r.A)({},s),{},{state:e}))})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"address"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(c.A,{id:"ccLine1",onChange:e=>t((0,r.A)((0,r.A)({},s),{},{line1:e.target.value}))})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"apt/unit"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(c.A,{id:"ccApt",onChange:e=>t((0,r.A)((0,r.A)({},s),{},{line2:e.target.value}))})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"city"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(c.A,{id:"ccCity",onChange:e=>t((0,r.A)((0,r.A)({},s),{},{city:e.target.value}))})}),(0,A.jsx)(o.A,{xs:"12",children:(0,A.jsx)("hr",{className:"my-2"})}),(0,A.jsx)(o.A,{xs:"6",className:"text text-nowrap d-none d-md-block pt-2",children:"billing postal code"}),(0,A.jsx)(o.A,{md:"6",xs:"12",className:"text-md-end text-center",children:(0,A.jsx)(c.A,{id:"ccPostalCode",onChange:e=>t((0,r.A)((0,r.A)({},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:c,className:i}=e;return(0,a.jsx)(r.A,{className:"form-status ".concat(i),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 ".concat("processing"===c?"fa-spinner fa-spin text-purple":"success"===c?"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:()=>d});var r=s(9379),n=s(2714),a=s(5553),o=s(3628),c=s(5996),i=s(7596);const d=async e=>{let{auth:t,customer_id:s}=e,d=null;try{var l;return d=await(0,n.A)({endpoint:"getCustomer",method:"POST",payload:{customer_id:s},auth:t}),(0,i.A)({auth:t,customer_id:s,stripe_id:null===(l=d)||void 0===l?void 0:l.stripe_id}),d.error||a.A.update((e=>{var t;e.customer=(0,r.A)((0,r.A)({},d),{},{customer_id:s}),e.hasCard=null===(t=d.stripe_payment_methods)||void 0===t?void 0:t[0]})),d}catch(u){return(0,o.A)({type:"lms data",status:"error",url:c.A.lms_api_url,operation:"getCustomer",request:{customer_id:s},error:{catch:u.toString()},customer_id:s})}}},3906:(e,t,s)=>{s.d(t,{A:()=>l});var r=s(9379),n=s(2714),a=s(5553),o=s(4549);const c=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),d=s(5996);const l=async e=>{let{auth:t,customer_id:s,products:l,regions:u,subscriptions:m,instanceCount:p=0}=e,x=null;try{if(x=await(0,n.A)({endpoint:"getInstances",method:"POST",payload:{customer_id:s,user_id:t.user_id},auth:t}),Array.isArray(x)){const e=x.map((e=>{const t=(e=>{let{instance:t,products:s,regions:r,subscriptions:n}=e;try{var a,i;const e=t.compute_subscription_id?n[c(t)]:s[c(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===(a=d.value)||void 0===a?void 0:a.compute_price)||0)+parseFloat((null===u||void 0===u||null===(i=u.value)||void 0===i?void 0:i.storage_price)||0),p=m?"$".concat((0,o.A)(m.toFixed(2))):"FREE",x=t.compute_subscription_id&&t.storage_subscription_id?"PREPAID":m?"".concat(p,"/").concat(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:l,regions:u,subscriptions:m});return(0,r.A)((0,r.A)({},e),t)})),t=e.sort(((e,t)=>e.instance_name>t.instance_name?1:-1));return a.A.update((e=>{e.instances=t})),t}return!p&&a.A.update((e=>{e.instances=[]}))}catch(h){return(0,i.A)({type:"lms data",status:"error",url:d.A.lms_api_url,operation:"getInstances",request:{customer_id:s},error:{catch:h.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),c=s(2696),i=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,c.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:i.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),c=s.n(o),i=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=v(e);if(t){var n=v(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 A(e)}(this,s)}}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}var j={children:a().node,type:a().string,size:a().oneOfType([a().number,a().string]),bsSize:a().string,valid:a().bool,invalid:a().bool,tag:i.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(A(t)),t.focus=t.focus.bind(A(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,A=e.plaintext,v=e.innerRef,j=m(e,l),f=["switch","radio","checkbox"].indexOf(a)>-1,_="select"===a,g="range"===a,b=x||(_||"textarea"===a?a:"input"),y="form-control";A?(y="".concat(y,"-plaintext"),b=x||"input"):g?y="form-range":_?y="form-select":f&&(y=h?null:"form-check-input"),j.size&&/\D/g.test(j.size)&&((0,i.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),o=j.size,delete j.size);var N=(0,i.qO)(c()(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)&&(j.type="switch"===a?"checkbox":a),j.children&&!A&&"select"!==a&&"string"===typeof b&&"select"!==b&&((0,i.mc)('Input with a type of "'.concat(a,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete j.children),r.createElement(b,u({},j,{ref:v,className:N,"aria-invalid":p}))}}])&&p(t.prototype,s),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component);f.propTypes=j;const _=f}}]);