PageSourceSearch

https://mentorfindsupport.web.app/_expo/static/js/web/recurring-status-124c422468905f5e0b5648d9a987e979.js

js mentorfindsupport.web.app collected 2026-10-03 12:30:14 UTC 9,682 bytes, 2 lines download raw bytes

1__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});var t=r(d[0]),n=r(d[1]),a=r(d[2]),s=r(d[3]),l=r(d[4]),o=e(r(d[5])),c=r(d[6]),u=r(d[7]),f=r(d[8]),y=r(d[9]),x=r(d[10]),h=e(r(d[11]));e(r(d[12]));r(d[13]);var p=e(r(d[14])),b=e(r(d[15])),j=e(r(d[16])),C=e(r(d[17])),S=e(r(d[18])),D=r(d[19]);const E={active:{bg:"#DCFCE7",text:"#16A34A"},paused:{bg:"#FEF3C7",text:"#D97706"},pending_cancellation:{bg:"#FEF3C7",text:"#D97706"},cancelled:{bg:"#FEE2E2",text:"#DC2626"},completed:{bg:"#DBEAFE",text:"#2563EB"},payment_failed:{bg:"#FEE2E2",text:"#DC2626"},draft:{bg:"#F3F4F6",text:"#6B7280"}},z={VISA:"credit-card",MASTERCARD:"credit-card",AMEX:"credit-card"};function w(){const{colors:e,spacing:w,radius:F,typography:R}=(0,n.useMGTheme)(),{t:B,locale:v}=(0,a.useT)("payments"),A=(0,y.useRouter)(),[T,W]=(0,x.useState)([]),[k,I]=(0,x.useState)(!0),[_,P]=(0,x.useState)(!1),[M,V]=(0,x.useState)(null),[L,O]=(0,x.useState)(null),{user:H,coach:N,setCoach:U}=(0,u.useAuthStore)(),$=(0,x.useCallback)(async()=>{if(H?.uid)try{const e=await(0,c.getCoach)(H.uid);e&&U(e)}catch{}},[H,U]),q=(0,x.useCallback)(async()=>{try{V(null);const[e]=await Promise.all([(0,l.getRecurringStatus)(),$()]);W(e)}catch(e){V(e instanceof Error?e.message:B("recurring.status.loadError"))}finally{I(!1),P(!1)}},[B,$]);(0,x.useEffect)(()=>{q()},[q]);const G=e=>{const t=B("recurring.status.cancelMessage",{planName:e.planName});window.confirm(t)&&X(e.id)},X=async e=>{O(e);try{await(0,l.cancelRecurring)(e,"Cancelled by user from app"),W(t=>t.map(t=>t.id===e?{...t,status:"pending_cancellation"}:t))}catch(e){const t=e instanceof Error?e.message:B("recurring.status.cancelError");window.alert(t)}finally{O(null)}},J=e=>{switch(e){case"weekly":return B("recurring.consent.weekly");case"monthly":return B("recurring.consent.monthly");case"yearly":return B("recurring.consent.yearly");default:return e}},K=e=>e?(0,s.formatDate)(e,v):"\u2014",Q=e=>{switch(e){case"active":return B("recurring.status.active");case"paused":return B("recurring.status.paused");case"cancelled":return B("recurring.status.cancelled");case"completed":return B("recurring.status.completed");case"payment_failed":return B("recurring.status.paymentFailed");case"pending_cancellation":return B("recurring.status.pendingCancellation");case"draft":return B("recurring.status.pending");default:return e}},Y=e=>{const{maskedCard:t}=e;if(!t?.last4)return B("recurring.status.cardOnFile");const n=t.brand||"Card";return(0,s.isolateLTR)(`${n} \u2022\u2022\u2022\u2022 ${t.last4}`)};if(k)return(0,D.jsx)(t.Screen,{topBarTitle:B("recurring.status.title"),children:(0,D.jsxs)(S.default,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:[(0,D.jsx)(h.default,{size:"large",color:e.primary}),(0,D.jsx)(j.default,{style:[R.body,{color:e.textSecondary,marginTop:w.md}],children:B("recurring.status.loading")})]})});const Z=(0,f.hasActiveAccountPaymentEntitlement)(N),ee=T.find(e=>"active"===e.status),te=N?.subscriptionEnd,re="string"==typeof te?new Date(te).toLocaleDateString(v):te instanceof Date?te.toLocaleDateString(v):"function"==typeof te?.toDate?te.toDate().toLocaleDateString(v):"";return(0,D.jsx)(t.Screen,{topBarTitle:B("recurring.status.title"),children:(0,D.jsxs)(b.default,{contentContainerStyle:{padding:w.lg,paddingBottom:40},refreshControl:(0,D.jsx)(p.default,{refreshing:_,onRefresh:()=>{P(!0),q()}}),children:[M&&(0,D.jsxs)(S.default,{style:{backgroundColor:"#FEE2E2",borderRadius:F.sm,padding:w.md,marginBottom:w.lg},children:[(0,D.jsx)(j.default,{style:{color:"#DC2626",fontSize:14},children:M}),(0,D.jsx)(C.default,{onPress:q,style:{marginTop:w.sm},children:(0,D.jsx)(j.default,{style:{color:"#DC2626",fontWeight:"600",fontSize:14},children:B("recurring.status.tapToRetry")})})]}),!M&&Z&&(0,D.jsxs)(S.default,{style:{backgroundColor:e.card,borderRadius:F.md,borderWidth:1,borderColor:e.border,padding:w.lg,marginBottom:w.md},children:[(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"center",gap:w.sm,marginBottom:w.xs},children:[(0,D.jsx)(o.default,{name:"check-circle",size:20,color:e.success}),(0,D.jsx)(j.default,{style:[R.body,{color:e.text,fontWeight:"700"}],children:B("recurring.status.accountActive")}
1)]}),(0,D.jsx)(j.default,{style:[R.bodySecondary,{color:e.textSecondary}],children:B(ee?"recurring.status.accountRenews":"recurring.status.accountExpires",{date:re})}),!ee&&(0,D.jsx)(C.default,{onPress:()=>A.push("/provider/payment/methods"),accessibilityRole:"button",style:{marginTop:w.md,borderWidth:1,borderColor:e.primary,borderRadius:F.sm,paddingVertical:10,alignItems:"center"},children:(0,D.jsx)(j.default,{style:{color:e.primary,fontWeight:"700",fontSize:14},children:B("recurring.status.setUpAutoRenew")})})]}),!M&&0===T.length&&!Z&&(0,D.jsxs)(S.default,{style:{alignItems:"center",justifyContent:"center",paddingVertical:2*w.xxl},children:[(0,D.jsx)(o.default,{name:"credit-card-off",size:48,color:e.muted}),(0,D.jsx)(j.default,{style:[R.body,{color:e.textSecondary,marginTop:w.md,textAlign:"center"}],children:B("recurring.status.noSubscriptions")}),(0,D.jsx)(C.default,{onPress:()=>A.push("/provider/payment/methods"),accessibilityRole:"button",style:{marginTop:w.lg,backgroundColor:e.primary,borderRadius:F.sm,paddingVertical:12,paddingHorizontal:w.xl},children:(0,D.jsx)(j.default,{style:{color:e.primaryText,fontWeight:"700",fontSize:15},children:B("recurring.status.choosePlan")})})]}),T.map(t=>{const n=E[t.status]||E.draft,a=L===t.id,l=z[t.maskedCard?.brand||""]||"credit-card";return(0,D.jsxs)(S.default,{style:{backgroundColor:e.card,borderRadius:F.md,borderWidth:1,borderColor:e.border,padding:w.lg,marginBottom:w.md},children:[(0,D.jsxs)(S.default,{style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:w.md},children:[(0,D.jsx)(j.default,{style:[R.subtitle,{color:e.text,flex:1}],numberOfLines:1,children:t.planName}),(0,D.jsx)(S.default,{style:{backgroundColor:n.bg,paddingHorizontal:10,paddingVertical:4,borderRadius:12,marginStart:w.sm},children:(0,D.jsx)(j.default,{style:{color:n.text,fontSize:12,fontWeight:"600"},children:Q(t.status)})})]}),(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"baseline",marginBottom:w.sm},children:[(0,D.jsx)(j.default,{style:{color:e.text,fontSize:24,fontWeight:"700"},children:(0,s.formatCurrency)(t.amount,t.currency,v)}),(0,D.jsxs)(j.default,{style:{color:e.textSecondary,fontSize:14,marginStart:4},children:["/ ",J(t.frequency).toLowerCase()]})]}),"active"===t.status&&t.nextChargeDate&&(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"center",marginBottom:w.sm},children:[(0,D.jsx)(o.default,{name:"event",size:16,color:e.textSecondary,style:{marginEnd:6}}),(0,D.jsx)(j.default,{style:[R.body,{color:e.textSecondary,fontSize:13}],children:B("recurring.status.nextCharge",{date:K(t.nextChargeDate)})})]}),"pending_cancellation"===t.status&&t.nextChargeDate&&(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"center",marginBottom:w.sm},children:[(0,D.jsx)(o.default,{name:"event-busy",size:16,color:"#D97706",style:{marginEnd:6}}),(0,D.jsx)(j.default,{style:[R.body,{color:"#D97706",fontSize:13,fontWeight:"600"}],children:B("recurring.status.accessUntil",{date:K(t.nextChargeDate)})})]}),(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"center",marginBottom:w.md},children:[(0,D.jsx)(o.default,{name:l,size:16,color:e.textSecondary,style:{marginEnd:6}}),(0,D.jsx)(j.default,{style:[R.body,{color:e.textSecondary,fontSize:13}],children:Y(t)})]}),"payment_failed"===t.status&&(0,D.jsxs)(S.default,{style:{backgroundColor:"#FEF2F2",borderWidth:1,borderColor:"#FECACA",borderRadius:F.sm,padding:w.md,marginBottom:w.sm},children:[(0,D.jsxs)(S.default,{style:{flexDirection:"row",alignItems:"flex-start",marginBottom:w.sm},children:[(0,D.jsx)(o.default,{name:"error-outline",size:18,color:"#DC2626",style:{marginEnd:6,marginTop:1}}),(0,D.jsx)(j.default,{style:{color:"#991B1B",fontSize:13,fontWeight:"600",flex:1},children:B("recurring.status.paymentFailed")})]}),(0,D.jsx)(j.default,{style:{color:"#7F1D1D",fontSize:13,lineHeight:19,marginBottom:w.md},children:B("recurring.status.paymentFailedMessage")}),(0,D.jsx)(C.default,{onPress:()=>A.push("/provider/payment/methods"),style:{backgroundColor:"#DC2626",borderRadius:F.sm,paddingVertical:10,alignItems:"center"},children:(0,D.jsx)(j.default,{style:{color:e.dangerText,fontWeight:"700",fontSize:14},children:B("recurring.status.resubscribe")})})]}),(c=t.status,("active"===c||"paused"===c)&&(0,D.jsx)(C.default,{onPress:()=>G(t),disabled:a,style:{borderWidth:1,borderColor:"#DC2626",borderRadius:F.sm,paddingVertical:10,alignItems:"center",opacity:a?.6:1},children:a?(0,D.jsx)(h.default,{size:"small",color:"#DC2626"}):(0,D.jsx)(j.default,{style:{color:"#DC2626",fontWeight:"600",fontSize:14},children:B("recurring.status.cancelSubscription")})}
1)),(0,D.jsx)(j.default,{style:{color:e.muted,fontSize:11,marginTop:w.sm},children:B("recurring.status.enrolled",{date:K(t.createdAt)})})]},t.id);var c})]})})}},1640,[1299,704,457,1536,1636,706,1450,552,1641,722,21,402,303,114,316,317,123,404,310,2]);
2__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hasActiveAccountPaymentEntitlement=function(t,n=new Date){if(!t?.activeOrderId||!t.subscriptionEnd)return!1;const o=t.subscriptionEnd,c="string"==typeof o?new Date(`${o.slice(0,10)}T23:59:59.999Z`):o instanceof Date?o:"function"==typeof o?.toDate?o.toDate():null;return Boolean(c&&!Number.isNaN(c.getTime())&&c.getTime()>=n.getTime())}},1641,[]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.