PageSourceSearch

https://www.pocketclass.ca/_next/static/chunks/pages/mindbody-success-f5879d0ffc1c0670.js

js pocketclass.ca collected 2026-10-04 09:05:19 UTC 11,436 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8978],{87938:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return g}});var n=r(59499),s=r(90116),a=r(50029),i=r(17674),o=r(87794),c=r.n(o),l=r(67294),d=r(11163),u=r(3349),p=r(59116),x=r(36100);r(41664);var h=r(85893);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach(function(t){(0,n.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(o)throw a}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function g(){var e=(0,d.useRouter)(),t=(0,u.F_)(p.I),r=(0,i.Z)(t,1)[0],o=(0,l.useState)(""),m=o[0],y=o[1],g=(0,l.useState)(null),v=g[0],w=g[1],j=(0,l.useState)([]),N=j[0],k=j[1],S=(0,l.useState)(!1),I=S[0],O=S[1],C=(0,l.useState)({}),D=C[0],E=C[1];(0,l.useEffect)(function(){var t;(t=(0,a.Z)(c().mark(function t(){var n,a,i,o,l,d,u,h,m,f;return c().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(!r||!e.query.access_token)){t.next=2;break}return t.abrupt("return");case 2:return t.prev=2,y("Storing Mindbody credentials..."),n=(0,x.JU)(p.db,"Users",r.uid),t.next=7,(0,x.r7)(n,{mindbody:{accessToken:e.query.access_token,refreshToken:e.query.refresh_token,expiresIn:parseInt(e.query.expires_in)||3600,tokenType:e.query.token_type||"Bearer",updatedAt:new Date().toISOString()}});case 7:return t.next=9,(0,x.QT)(n);case 9:if((a=t.sent).exists()){t.next=12;break}throw Error("User profile not found");case 12:return i=a.data().mindbodySite,console.log("Mindbody site ID:",i),y("Fetching classes from Mindbody..."),t.next=17,fetch("/api/mindbody/classes",{method:"GET",headers:{Authorization:"Bearer ".concat(e.query.access_token),refreshtoken:e.query.refresh_token||"",SiteId:i||"-9",userid:r.uid}});case 17:if((o=t.sent).ok){t.next=23;break}return t.next=21,o.json();case 21:throw l=t.sent,Error("Failed to fetch Mindbody classes: ".concat(l.message||o.statusText));case 23:return t.next=25,o.json();case 25:d=t.sent,y("Organizing classes..."),console.log("Fetched Mindbody classes:",d),u=new Map,d.forEach(function(e){var t,r=null===(t=e.ClassDescription)||void 0===t?void 0:t.Id;r&&!u.has(r)&&u.set(r,e)}),h=b(u.values()),t.prev=31,f=c().mark(function e(){var t,n,a,i,o,l,d,u,h,f,b,y,g,v,w,j,N;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w={mindbodyId:null===(t=(v=m.value).ClassDescription)||void 0===t?void 0:t.Id,mindbodySessionTypeId:(null===(n=v.SessionType)||void 0===n?void 0:n.Id)||null,Name:(null===(a=v.ClassDescription)||void 0===a?void 0:a.Name)||"Unnamed Class",Description:(null===(i=v.ClassDescription)||void 0===i?void 0:i.Description)||"",Category:(null===(o=v.ClassDescription)||void 0===o?void 0:o.Category)||"",SubCategory:(null===(l=v.ClassDescription)||void 0===l?void 0:l.Subcategory)||"",Address:(null===(d=v.Location)||void 0===d?void 0:d.Address)+", "+(null===(u=v.Location)||void 0===u?void 0:u.Address2)||"",latitude:(null===(h=v.Location)||void 0===h?void 0:h.Latitude)||0,longitude:(null===(f=v.Location)||void 0===f?void 0:f.Longitude)||0,Mode:v.VirtualStreamLink?"Online":"Offline",groupSize:v.MaxCapacity,status:"pending",classCreator:r.uid,Images:[null===(b=v.ClassDescription)||void 0===b?void 0:b.ImageURL],updatedAt:new Date().toISOString(),About:(null===(y=v.
1Staff)||void 0===y?void 0:y.Bio)||""},j=(0,x.IO)((0,x.hJ)(p.db,"classes"),(0,x.ar)("mindbodyId","==",null===(g=v.ClassDescription)||void 0===g?void 0:g.Id)),e.next=5,(0,x.PL)(j);case 5:e.sent.empty&&k(function(e){return[].concat((0,s.Z)(e),[w])});case 7:case"end":return e.stop()}},e)}),h.s();case 34:if((m=h.n()).done){t.next=38;break}return t.delegateYield(f(),"t0",36);case 36:t.next=34;break;case 38:t.next=43;break;case 40:t.prev=40,t.t1=t.catch(31),h.e(t.t1);case 43:return t.prev=43,h.f(),t.finish(43);case 46:O(!0),t.next=61;break;case 49:return t.prev=49,t.t2=t.catch(2),console.error("Error during Mindbody integration:",t.t2),w(t.t2.message||"Unknown error occurred during Mindbody integration"),t.prev=53,t.next=56,(0,x.r7)((0,x.JU)(p.db,"Users",r.uid),{mindbodyIntegrationError:t.t2.message,mindbodyIntegrationErrorTime:new Date().toISOString()});case 56:t.next=61;break;case 58:t.prev=58,t.t3=t.catch(53),console.error("Failed to update user with integration error:",t.t3);case 61:case"end":return t.stop()}},t,null,[[2,49],[31,40,43,46],[53,58]])})),function(){return t.apply(this,arguments)})()},[r,e.query]);var _,M=function(e){E(function(t){return f(f({},t),{},(0,n.Z)({},e,!t[e]))})},A=(_=(0,a.Z)(c().mark(function t(){var n,s,a,i;return c().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,y("Importing selected classes to PocketClass..."),0!==(n=N.filter(function(e,t){return D[t]})).length){t.next=6;break}return w("Please select at least one class to import"),t.abrupt("return");case 6:s=b(n),t.prev=7,s.s();case 9:if((a=s.n()).done){t.next=15;break}return i=a.value,t.next=13,(0,x.ET)((0,x.hJ)(p.db,"classes"),f(f({},i),{},{createdAt:new Date().toISOString()}));case 13:t.next=9;break;case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(7),s.e(t.t0);case 20:return t.prev=20,s.f(),t.finish(20);case 23:e.push("/myClass/".concat(r.uid)),t.next=30;break;case 26:t.prev=26,t.t1=t.catch(0),console.error("Error importing classes:",t.t1),w(t.t1.message||"Failed to import classes");case 30:case"end":return t.stop()}},t,null,[[0,26],[7,17,20,23]])})),function(){return _.apply(this,arguments)});return(0,h.jsx)("div",{className:"min-h-screen flex flex-col items-center bg-gray-100 p-4",children:(0,h.jsxs)("div",{className:"w-full max-w-4xl bg-white rounded-lg shadow-lg p-6",children:[(0,h.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Mindbody Integration"}),v?(0,h.jsxs)("div",{className:"text-red-600 mb-4 p-4 bg-red-50 rounded",children:[(0,h.jsx)("p",{className:"font-semibold",children:"Error:"}),(0,h.jsx)("p",{children:v}),(0,h.jsx)("button",{className:"mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",onClick:function(){return e.push("/schedule")},children:"Return to Schedule"})]}):I?(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6",children:(0,h.jsxs)("p",{className:"text-yellow-700",children:[(0,h.jsx)("strong",{children:"Note:"})," Imported classes might have missing data, please go to My Classes to fill out any missing data of Imported classes."]})}),(0,h.jsxs)("p",{className:"mb-4 text-gray-700",children:["We found ",N.length," classes from your Mindbody account. Please select the classes you wish to import:"]}),(0,h.jsxs)("div",{className:"mb-4",children:[(0,h.jsx)("button",{className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 mr-2",onClick:function(){return E(Object.fromEntries(N.map(function(e,t){return[t,!0]})))},children:"Select All"}),(0,h.jsx)("button",{className:"px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600",onClick:function(){return E({})},children:"Deselect All"})]}),(0,h.jsx)("div",{className:"mb-6 max-h-96 overflow-y-auto border rounded",children:N.length>0?(0,h.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,h.jsx)("thead",{className:"bg-gray-50",children:(0,h.jsxs)("tr",{children:[(0,h.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Import"}),(0,h.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Class Name"}),(0,h.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Category"}),(0,h.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Mode"}),(0,h.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"})]})}),(0,h.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:N.map(function(e,t){return(0,h.jsxs)("tr",{className:t%2==0?"bg-white":"bg-gray-50",children:[(0,h.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,h.jsx)("input",{type:"checkbox",checked:!!D[t],onChange:function(){return M(t)},className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"})}),(0,h.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,h.jsx)("div",{className:"text-sm font-medium text-gray-900",children:e.Name||"Unnamed Class"})}),(0,h.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,h.jsx)("div",{className:"text-sm text-gray-500",children:e.Category||"Uncategorized"})}),(0,h.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,h.jsx)("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full ".concat("Online"===e.Mode?"bg-green-100 text-green-800":"bg-blue-100 text-blue-800"),children:e.Mode})}),(0,h.jsx)("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:e.status})]},e.mindbodyId||t)})})]}):(0,h.jsx)("div",{className:"p-6 text-center text-gray-500",children:"No classes found in your Mindbody account"})}),(0,h.jsxs)("div",{className:"flex justify-between",children:[(0,h.jsx)("button",{className:"px-6 py-2 bg-gray-500 text-white rounded hover:bg-gray-600",onClick:function(){return e.push("/schedule")},children:"Skip Import"}),(0,h.jsx)("button",{className:"px-6 py-2 bg-green-600 text-white rounded hover:bg-green-700",onClick:A,disabled:0===Object.values(D).filter(
1Boolean).length,children:"Import Selected Classes"})]})]}):(0,h.jsxs)("div",{className:"text-center",children:[(0,h.jsx)("p",{className:"text-gray-600 mb-4",children:m||"Initializing connection..."}),(0,h.jsx)("div",{className:"animate-pulse flex justify-center mb-4",children:(0,h.jsx)("div",{className:"h-2 w-24 bg-blue-200 rounded"})}),(0,h.jsx)("div",{className:"text-sm text-gray-500 italic",children:"Please do not close this page"})]})]})})}},31650:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/mindbody-success",function(){return r(87938)}])}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=31650)}),_N_E=e.O()}]);

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.