powr-sdk-web 4.1.16 → 4.2.1

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.
@@ -53,7 +53,7 @@ function PowrBaseActivities(_ref) {
53
53
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
54
54
  var _yield$apiCall, data, ok, _t;
55
55
  return _regenerator().w(function (_context) {
56
- while (1) switch (_context.n) {
56
+ while (1) switch (_context.p = _context.n) {
57
57
  case 0:
58
58
  setLoading(true);
59
59
  setError(null);
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _auth = require("../utils/auth");
9
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
9
+ var _firebase = require("../utils/firebase");
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
12
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
11
13
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
12
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
13
14
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
14
15
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
15
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -95,6 +96,18 @@ var PowrLogin = function PowrLogin(_ref) {
95
96
  _useState22 = _slicedToArray(_useState21, 2),
96
97
  otpLoading = _useState22[0],
97
98
  setOtpLoading = _useState22[1];
99
+ var _useState23 = (0, _react.useState)(''),
100
+ _useState24 = _slicedToArray(_useState23, 2),
101
+ otp = _useState24[0],
102
+ setOtp = _useState24[1];
103
+ var _useState25 = (0, _react.useState)(false),
104
+ _useState26 = _slicedToArray(_useState25, 2),
105
+ firebaseOtpSent = _useState26[0],
106
+ setFirebaseOtpSent = _useState26[1];
107
+ var _useState27 = (0, _react.useState)(null),
108
+ _useState28 = _slicedToArray(_useState27, 2),
109
+ firebaseConfirm = _useState28[0],
110
+ setFirebaseConfirm = _useState28[1];
98
111
  var shouldShowToggle = mode === 'toggle';
99
112
  var handleInputChange = function handleInputChange(e) {
100
113
  var _e$target = e.target,
@@ -110,6 +123,89 @@ var PowrLogin = function PowrLogin(_ref) {
110
123
  });
111
124
  }
112
125
  };
126
+ var sendFirebaseOtp = /*#__PURE__*/function () {
127
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(phone) {
128
+ var appVerifier, confirmationResult, _t;
129
+ return _regenerator().w(function (_context) {
130
+ while (1) switch (_context.p = _context.n) {
131
+ case 0:
132
+ setOtpLoading(true);
133
+ setError('');
134
+ _context.p = 1;
135
+ if (!window.recaptchaVerifier) {
136
+ window.recaptchaVerifier = new _firebase.RecaptchaVerifier('recaptcha-container', {
137
+ size: 'invisible'
138
+ }, _firebase.auth);
139
+ }
140
+ appVerifier = window.recaptchaVerifier;
141
+ _context.n = 2;
142
+ return (0, _firebase.signInWithPhoneNumber)(_firebase.auth, phone, appVerifier);
143
+ case 2:
144
+ confirmationResult = _context.v;
145
+ setFirebaseConfirm(confirmationResult);
146
+ setFirebaseOtpSent(true);
147
+ setSuccess('OTP sent to your phone!');
148
+ _context.n = 4;
149
+ break;
150
+ case 3:
151
+ _context.p = 3;
152
+ _t = _context.v;
153
+ setError('Failed to send OTP: ' + (_t.message || ''));
154
+ case 4:
155
+ _context.p = 4;
156
+ setOtpLoading(false);
157
+ return _context.f(4);
158
+ case 5:
159
+ return _context.a(2);
160
+ }
161
+ }, _callee, null, [[1, 3, 4, 5]]);
162
+ }));
163
+ return function sendFirebaseOtp(_x) {
164
+ return _ref2.apply(this, arguments);
165
+ };
166
+ }();
167
+ var verifyFirebaseOtp = /*#__PURE__*/function () {
168
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
169
+ var result, _t2;
170
+ return _regenerator().w(function (_context2) {
171
+ while (1) switch (_context2.p = _context2.n) {
172
+ case 0:
173
+ setLoading(true);
174
+ setError('');
175
+ _context2.p = 1;
176
+ if (firebaseConfirm) {
177
+ _context2.n = 2;
178
+ break;
179
+ }
180
+ setError('OTP not sent yet.');
181
+ return _context2.a(2);
182
+ case 2:
183
+ _context2.n = 3;
184
+ return firebaseConfirm.confirm(otp);
185
+ case 3:
186
+ result = _context2.v;
187
+ _context2.n = 4;
188
+ return handleSubmit(null, true);
189
+ case 4:
190
+ _context2.n = 6;
191
+ break;
192
+ case 5:
193
+ _context2.p = 5;
194
+ _t2 = _context2.v;
195
+ setError('Invalid OTP. Please try again.');
196
+ case 6:
197
+ _context2.p = 6;
198
+ setLoading(false);
199
+ return _context2.f(6);
200
+ case 7:
201
+ return _context2.a(2);
202
+ }
203
+ }, _callee2, null, [[1, 5, 6, 7]]);
204
+ }));
205
+ return function verifyFirebaseOtp() {
206
+ return _ref3.apply(this, arguments);
207
+ };
208
+ }();
113
209
 
114
210
  // Validation functions
115
211
  var isValidEmail = function isValidEmail(email) {
@@ -123,12 +219,23 @@ var PowrLogin = function PowrLogin(_ref) {
123
219
  return cleanPhone.length >= 7 && cleanPhone.length <= 15;
124
220
  };
125
221
  var handleSubmit = /*#__PURE__*/function () {
126
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e) {
127
- var errors, value, isEmail, endpoint, payload, _yield$apiCall, data, ok, _t;
128
- return _regenerator().w(function (_context) {
129
- while (1) switch (_context.n) {
222
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(e) {
223
+ var skipPhoneValidation,
224
+ errors,
225
+ _value,
226
+ _isEmail,
227
+ endpoint,
228
+ payload,
229
+ _yield$apiCall,
230
+ data,
231
+ ok,
232
+ _args3 = arguments,
233
+ _t3;
234
+ return _regenerator().w(function (_context3) {
235
+ while (1) switch (_context3.p = _context3.n) {
130
236
  case 0:
131
- e.preventDefault();
237
+ skipPhoneValidation = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
238
+ if (e) e.preventDefault();
132
239
  setLoading(true);
133
240
  setError('');
134
241
  setSuccess('');
@@ -137,17 +244,15 @@ var PowrLogin = function PowrLogin(_ref) {
137
244
  if (!formData.phoneOrEmail.trim()) {
138
245
  errors.phoneOrEmail = 'Phone or email is required';
139
246
  } else {
140
- value = formData.phoneOrEmail.trim();
141
- isEmail = value.includes('@');
142
- if (isEmail) {
143
- if (!isValidEmail(value)) {
144
- errors.phoneOrEmail = 'Please enter a valid email address';
145
- }
146
- } else {
147
- if (!isValidPhone(value)) {
148
- errors.phoneOrEmail = 'Please enter a valid phone number';
149
- }
247
+ _value = formData.phoneOrEmail.trim();
248
+ _isEmail = _value.includes('@');
249
+ }
250
+ if (!isEmail && !skipPhoneValidation) {
251
+ if (!isValidPhone(value)) {
252
+ errors.phoneOrEmail = 'Please enter a valid phone number';
150
253
  }
254
+ } else if (isEmail && !isValidEmail(value)) {
255
+ errors.phoneOrEmail = 'Please enter a valid email address';
151
256
  }
152
257
  if (!formData.password.trim()) {
153
258
  errors.password = 'Password is required';
@@ -161,14 +266,14 @@ var PowrLogin = function PowrLogin(_ref) {
161
266
  errors.confirmPassword = 'Passwords do not match';
162
267
  }
163
268
  if (!(Object.keys(errors).length > 0)) {
164
- _context.n = 1;
269
+ _context3.n = 1;
165
270
  break;
166
271
  }
167
272
  setFieldErrors(errors);
168
273
  setLoading(false);
169
- return _context.a(2);
274
+ return _context3.a(2);
170
275
  case 1:
171
- _context.p = 1;
276
+ _context3.p = 1;
172
277
  endpoint = isLogin ? "/auth/login" : "/auth/register";
173
278
  payload = isLogin ? {
174
279
  phoneOrEmail: formData.phoneOrEmail,
@@ -178,13 +283,13 @@ var PowrLogin = function PowrLogin(_ref) {
178
283
  phoneOrEmail: formData.phoneOrEmail,
179
284
  password: formData.password
180
285
  };
181
- _context.n = 2;
286
+ _context3.n = 2;
182
287
  return (0, _auth.apiCall)(apiUrl, endpoint, projectId, {
183
288
  method: 'POST',
184
289
  body: payload
185
290
  });
186
291
  case 2:
187
- _yield$apiCall = _context.v;
292
+ _yield$apiCall = _context3.v;
188
293
  data = _yield$apiCall.data;
189
294
  ok = _yield$apiCall.ok;
190
295
  if (ok) {
@@ -215,23 +320,23 @@ var PowrLogin = function PowrLogin(_ref) {
215
320
  setError("".concat(isLogin ? 'Login' : 'Registration', " failed. Please try again."));
216
321
  }
217
322
  }
218
- _context.n = 4;
323
+ _context3.n = 4;
219
324
  break;
220
325
  case 3:
221
- _context.p = 3;
222
- _t = _context.v;
326
+ _context3.p = 3;
327
+ _t3 = _context3.v;
223
328
  setError('Network error. Please try again.');
224
329
  case 4:
225
- _context.p = 4;
330
+ _context3.p = 4;
226
331
  setLoading(false);
227
- return _context.f(4);
332
+ return _context3.f(4);
228
333
  case 5:
229
- return _context.a(2);
334
+ return _context3.a(2);
230
335
  }
231
- }, _callee, null, [[1, 3, 4, 5]]);
336
+ }, _callee3, null, [[1, 3, 4, 5]]);
232
337
  }));
233
- return function handleSubmit(_x) {
234
- return _ref2.apply(this, arguments);
338
+ return function handleSubmit(_x2) {
339
+ return _ref4.apply(this, arguments);
235
340
  };
236
341
  }();
237
342
  var toggleMode = function toggleMode() {
@@ -249,25 +354,25 @@ var PowrLogin = function PowrLogin(_ref) {
249
354
  });
250
355
  };
251
356
  var handleGetOtp = /*#__PURE__*/function () {
252
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
253
- var _yield$apiCall2, data, ok, _t2;
254
- return _regenerator().w(function (_context2) {
255
- while (1) switch (_context2.n) {
357
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
358
+ var _yield$apiCall2, data, ok, _t4;
359
+ return _regenerator().w(function (_context4) {
360
+ while (1) switch (_context4.p = _context4.n) {
256
361
  case 0:
257
362
  if (formData.phoneOrEmail.trim()) {
258
- _context2.n = 1;
363
+ _context4.n = 1;
259
364
  break;
260
365
  }
261
366
  setFieldErrors({
262
367
  phoneOrEmail: 'Phone or email is required for OTP'
263
368
  });
264
- return _context2.a(2);
369
+ return _context4.a(2);
265
370
  case 1:
266
371
  setOtpLoading(true);
267
372
  setError('');
268
373
  setFieldErrors({});
269
- _context2.p = 2;
270
- _context2.n = 3;
374
+ _context4.p = 2;
375
+ _context4.n = 3;
271
376
  return (0, _auth.apiCall)(apiUrl, "/auth/send-otp", projectId, {
272
377
  method: 'POST',
273
378
  body: {
@@ -275,7 +380,7 @@ var PowrLogin = function PowrLogin(_ref) {
275
380
  }
276
381
  });
277
382
  case 3:
278
- _yield$apiCall2 = _context2.v;
383
+ _yield$apiCall2 = _context4.v;
279
384
  data = _yield$apiCall2.data;
280
385
  ok = _yield$apiCall2.ok;
281
386
  if (ok) {
@@ -285,23 +390,23 @@ var PowrLogin = function PowrLogin(_ref) {
285
390
  } else {
286
391
  setError(data.message || 'Failed to send OTP. Please try again.');
287
392
  }
288
- _context2.n = 5;
393
+ _context4.n = 5;
289
394
  break;
290
395
  case 4:
291
- _context2.p = 4;
292
- _t2 = _context2.v;
396
+ _context4.p = 4;
397
+ _t4 = _context4.v;
293
398
  setError('Network error. Please try again.');
294
399
  case 5:
295
- _context2.p = 5;
400
+ _context4.p = 5;
296
401
  setOtpLoading(false);
297
- return _context2.f(5);
402
+ return _context4.f(5);
298
403
  case 6:
299
- return _context2.a(2);
404
+ return _context4.a(2);
300
405
  }
301
- }, _callee2, null, [[2, 4, 5, 6]]);
406
+ }, _callee4, null, [[2, 4, 5, 6]]);
302
407
  }));
303
408
  return function handleGetOtp() {
304
- return _ref3.apply(this, arguments);
409
+ return _ref5.apply(this, arguments);
305
410
  };
306
411
  }();
307
412
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -351,7 +456,39 @@ var PowrLogin = function PowrLogin(_ref) {
351
456
  required: true
352
457
  }), fieldErrors.fullName && /*#__PURE__*/_react["default"].createElement("div", {
353
458
  style: styles.fieldError
354
- }, fieldErrors.fullName)), /*#__PURE__*/_react["default"].createElement("div", {
459
+ }, fieldErrors.fullName)), !isLogin && !firebaseOtpSent && isValidPhone(formData.phoneOrEmail) && /*#__PURE__*/_react["default"].createElement("div", {
460
+ style: styles.formGroup
461
+ }, /*#__PURE__*/_react["default"].createElement("button", {
462
+ type: "button",
463
+ onClick: function onClick() {
464
+ return sendFirebaseOtp(formData.phoneOrEmail);
465
+ },
466
+ style: styles.otpButton,
467
+ disabled: otpLoading
468
+ }, otpLoading ? 'Sending OTP...' : 'Send OTP to Phone'), /*#__PURE__*/_react["default"].createElement("div", {
469
+ id: "recaptcha-container"
470
+ })), !isLogin && firebaseOtpSent && /*#__PURE__*/_react["default"].createElement("div", {
471
+ style: styles.formGroup
472
+ }, /*#__PURE__*/_react["default"].createElement("label", {
473
+ htmlFor: "otp",
474
+ style: styles.label
475
+ }, "Enter OTP"), /*#__PURE__*/_react["default"].createElement("input", {
476
+ type: "text",
477
+ id: "otp",
478
+ name: "otp",
479
+ value: otp,
480
+ onChange: function onChange(e) {
481
+ return setOtp(e.target.value);
482
+ },
483
+ style: styles.input,
484
+ placeholder: "Enter OTP received",
485
+ required: true
486
+ }), /*#__PURE__*/_react["default"].createElement("button", {
487
+ type: "button",
488
+ onClick: verifyFirebaseOtp,
489
+ style: styles.otpButton,
490
+ disabled: loading || !otp
491
+ }, loading ? 'Verifying...' : 'Verify OTP & Sign Up')), /*#__PURE__*/_react["default"].createElement("div", {
355
492
  style: styles.formGroup
356
493
  }, /*#__PURE__*/_react["default"].createElement("label", {
357
494
  htmlFor: "phoneOrEmail",
@@ -41,7 +41,7 @@ var PowrBaseBlogs = function PowrBaseBlogs(_ref) {
41
41
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
42
42
  var _yield$apiCall, data, ok, _t;
43
43
  return _regenerator().w(function (_context) {
44
- while (1) switch (_context.n) {
44
+ while (1) switch (_context.p = _context.n) {
45
45
  case 0:
46
46
  _context.p = 0;
47
47
  _context.n = 1;
@@ -94,7 +94,7 @@ var PowrBaseChat = function PowrBaseChat(_ref) {
94
94
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
95
95
  var _yield$apiCall, data, ok, _t;
96
96
  return _regenerator().w(function (_context) {
97
- while (1) switch (_context.n) {
97
+ while (1) switch (_context.p = _context.n) {
98
98
  case 0:
99
99
  _context.p = 0;
100
100
  console.log('Fetching conversations...');
@@ -133,7 +133,7 @@ var PowrBaseChat = function PowrBaseChat(_ref) {
133
133
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
134
134
  var _yield$apiCall2, data, ok, _t2;
135
135
  return _regenerator().w(function (_context2) {
136
- while (1) switch (_context2.n) {
136
+ while (1) switch (_context2.p = _context2.n) {
137
137
  case 0:
138
138
  _context2.p = 0;
139
139
  console.log('Fetching users...');
@@ -173,7 +173,7 @@ var PowrBaseChat = function PowrBaseChat(_ref) {
173
173
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(userId) {
174
174
  var _yield$apiCall3, data, ok, _t3;
175
175
  return _regenerator().w(function (_context3) {
176
- while (1) switch (_context3.n) {
176
+ while (1) switch (_context3.p = _context3.n) {
177
177
  case 0:
178
178
  _context3.p = 0;
179
179
  _context3.n = 1;
@@ -215,7 +215,7 @@ var PowrBaseChat = function PowrBaseChat(_ref) {
215
215
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(conversationId) {
216
216
  var _yield$apiCall4, data, ok, _t4;
217
217
  return _regenerator().w(function (_context4) {
218
- while (1) switch (_context4.n) {
218
+ while (1) switch (_context4.p = _context4.n) {
219
219
  case 0:
220
220
  _context4.p = 0;
221
221
  setLoading(true);
@@ -259,7 +259,7 @@ var PowrBaseChat = function PowrBaseChat(_ref) {
259
259
  var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
260
260
  var _yield$apiCall5, data, ok, _t5;
261
261
  return _regenerator().w(function (_context5) {
262
- while (1) switch (_context5.n) {
262
+ while (1) switch (_context5.p = _context5.n) {
263
263
  case 0:
264
264
  if (!(!message.trim() || !selectedChat || sending)) {
265
265
  _context5.n = 1;
@@ -90,7 +90,7 @@ var PowrBaseComments = function PowrBaseComments(_ref) {
90
90
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
91
91
  var _yield$apiCall, data, ok, sortedComments, _t;
92
92
  return _regenerator().w(function (_context) {
93
- while (1) switch (_context.n) {
93
+ while (1) switch (_context.p = _context.n) {
94
94
  case 0:
95
95
  if (contentId) {
96
96
  _context.n = 1;
@@ -141,7 +141,7 @@ var PowrBaseComments = function PowrBaseComments(_ref) {
141
141
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
142
142
  var commentPayload, _yield$apiCall2, data, ok, tempNewComment, _t2;
143
143
  return _regenerator().w(function (_context3) {
144
- while (1) switch (_context3.n) {
144
+ while (1) switch (_context3.p = _context3.n) {
145
145
  case 0:
146
146
  if (!(!contentId || !newComment.trim() && selectedFiles.length === 0)) {
147
147
  _context3.n = 1;
@@ -44,7 +44,7 @@ var PowrBaseFeedsAdmin = function PowrBaseFeedsAdmin(_ref) {
44
44
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
45
45
  var _yield$apiCall, data, ok, _t;
46
46
  return _regenerator().w(function (_context) {
47
- while (1) switch (_context.n) {
47
+ while (1) switch (_context.p = _context.n) {
48
48
  case 0:
49
49
  _context.p = 0;
50
50
  _context.n = 1;
@@ -79,7 +79,7 @@ var PowrBaseFeedsAdmin = function PowrBaseFeedsAdmin(_ref) {
79
79
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
80
80
  var _yield$apiCall2, data, ok, _t2;
81
81
  return _regenerator().w(function (_context2) {
82
- while (1) switch (_context2.n) {
82
+ while (1) switch (_context2.p = _context2.n) {
83
83
  case 0:
84
84
  if (selectedPost) {
85
85
  _context2.n = 1;
@@ -58,7 +58,7 @@ var CreatePost = function CreatePost(_ref) {
58
58
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(e) {
59
59
  var postData, _yield$apiCall, data, ok, _t;
60
60
  return _regenerator().w(function (_context) {
61
- while (1) switch (_context.n) {
61
+ while (1) switch (_context.p = _context.n) {
62
62
  case 0:
63
63
  e.preventDefault();
64
64
 
@@ -131,7 +131,7 @@ var CreatePost = function CreatePost(_ref) {
131
131
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(files) {
132
132
  var uploadedFiles, _iterator, _step, file, formData, _yield$apiCall2, data, ok, _t2, _t3;
133
133
  return _regenerator().w(function (_context2) {
134
- while (1) switch (_context2.n) {
134
+ while (1) switch (_context2.p = _context2.n) {
135
135
  case 0:
136
136
  uploadedFiles = [];
137
137
  _iterator = _createForOfIteratorHelper(files);
@@ -68,7 +68,7 @@ var FeedPost = function FeedPost(_ref) {
68
68
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
69
69
  var _yield$apiCall, data, ok, _t;
70
70
  return _regenerator().w(function (_context) {
71
- while (1) switch (_context.n) {
71
+ while (1) switch (_context.p = _context.n) {
72
72
  case 0:
73
73
  if (editContent.trim()) {
74
74
  _context.n = 1;
@@ -118,7 +118,7 @@ var FeedPost = function FeedPost(_ref) {
118
118
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
119
119
  var _yield$apiCall2, data, ok, _t2;
120
120
  return _regenerator().w(function (_context2) {
121
- while (1) switch (_context2.n) {
121
+ while (1) switch (_context2.p = _context2.n) {
122
122
  case 0:
123
123
  if (confirm('Are you sure you want to delete this post?')) {
124
124
  _context2.n = 1;
@@ -78,7 +78,7 @@ var PowrBaseFeed = function PowrBaseFeed(_ref) {
78
78
  _args = arguments,
79
79
  _t;
80
80
  return _regenerator().w(function (_context) {
81
- while (1) switch (_context.n) {
81
+ while (1) switch (_context.p = _context.n) {
82
82
  case 0:
83
83
  pageNum = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
84
84
  append = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
@@ -75,7 +75,7 @@ var PowrFormsAdmin = function PowrFormsAdmin(_ref) {
75
75
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
76
76
  var _yield$apiCall, data, ok, _t;
77
77
  return _regenerator().w(function (_context) {
78
- while (1) switch (_context.n) {
78
+ while (1) switch (_context.p = _context.n) {
79
79
  case 0:
80
80
  _context.p = 0;
81
81
  setLoading(true);
@@ -129,7 +129,7 @@ var PowrFormsAdmin = function PowrFormsAdmin(_ref) {
129
129
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(formName) {
130
130
  var _yield$apiCall2, data, ok, _t2;
131
131
  return _regenerator().w(function (_context2) {
132
- while (1) switch (_context2.n) {
132
+ while (1) switch (_context2.p = _context2.n) {
133
133
  case 0:
134
134
  setLoadingResponses(true);
135
135
  _context2.p = 1;
@@ -180,7 +180,7 @@ var PowrFormsAdmin = function PowrFormsAdmin(_ref) {
180
180
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
181
181
  var formData, _yield$apiCall3, result, ok, errorMessage, _errorMessage, _t3;
182
182
  return _regenerator().w(function (_context3) {
183
- while (1) switch (_context3.n) {
183
+ while (1) switch (_context3.p = _context3.n) {
184
184
  case 0:
185
185
  if (!(!projectId || !selectedFile)) {
186
186
  _context3.n = 1;
@@ -72,7 +72,7 @@ var PowrForm = function PowrForm(_ref) {
72
72
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
73
73
  var response, apiResponse, formData, _t;
74
74
  return _regenerator().w(function (_context) {
75
- while (1) switch (_context.n) {
75
+ while (1) switch (_context.p = _context.n) {
76
76
  case 0:
77
77
  if (!(!formName || !projectId)) {
78
78
  _context.n = 1;
@@ -121,7 +121,7 @@ var PowrForm = function PowrForm(_ref) {
121
121
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(data) {
122
122
  var finalData, response, resData, errorMsg, _errorMsg, _error$response, _errorMsg2, _t2;
123
123
  return _regenerator().w(function (_context2) {
124
- while (1) switch (_context2.n) {
124
+ while (1) switch (_context2.p = _context2.n) {
125
125
  case 0:
126
126
  setHasSubmitted(true);
127
127
  setSubmitError(null);
@@ -144,7 +144,7 @@ var PowrBaseFunctionsAdmin = function PowrBaseFunctionsAdmin(_ref) {
144
144
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
145
145
  var _yield$apiCall, data, ok, errorMsg, _t;
146
146
  return _regenerator().w(function (_context) {
147
- while (1) switch (_context.n) {
147
+ while (1) switch (_context.p = _context.n) {
148
148
  case 0:
149
149
  _context.p = 0;
150
150
  setLoading(true);
@@ -215,7 +215,7 @@ var PowrBaseFunctionsAdmin = function PowrBaseFunctionsAdmin(_ref) {
215
215
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
216
216
  var errorMsg, _yield$apiCall2, result, ok, successMsg, _errorMsg, _t2;
217
217
  return _regenerator().w(function (_context2) {
218
- while (1) switch (_context2.n) {
218
+ while (1) switch (_context2.p = _context2.n) {
219
219
  case 0:
220
220
  if (!(!formData.name || !formData.path)) {
221
221
  _context2.n = 1;
@@ -303,7 +303,7 @@ var PowrBaseFunctionsAdmin = function PowrBaseFunctionsAdmin(_ref) {
303
303
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
304
304
  var errorMsg, _yield$apiCall3, result, ok, successMsg, _errorMsg2, _t3;
305
305
  return _regenerator().w(function (_context3) {
306
- while (1) switch (_context3.n) {
306
+ while (1) switch (_context3.p = _context3.n) {
307
307
  case 0:
308
308
  if (!(!editingFunction || !editFormData.code)) {
309
309
  _context3.n = 1;
@@ -104,7 +104,7 @@ var PowrBaseInvoicesAdmin = function PowrBaseInvoicesAdmin(_ref) {
104
104
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
105
105
  var _yield$apiCall, data, ok, _t;
106
106
  return _regenerator().w(function (_context) {
107
- while (1) switch (_context.n) {
107
+ while (1) switch (_context.p = _context.n) {
108
108
  case 0:
109
109
  setLoading(true);
110
110
  setError(null);
@@ -153,7 +153,7 @@ var PowrBaseInvoicesAdmin = function PowrBaseInvoicesAdmin(_ref) {
153
153
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
154
154
  var _yield$apiCall2, data, ok, _t2;
155
155
  return _regenerator().w(function (_context2) {
156
- while (1) switch (_context2.n) {
156
+ while (1) switch (_context2.p = _context2.n) {
157
157
  case 0:
158
158
  e.preventDefault();
159
159
  setAddLoading(true);
@@ -318,7 +318,7 @@ var PowrBaseInvoicesAdmin = function PowrBaseInvoicesAdmin(_ref) {
318
318
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(e) {
319
319
  var _yield$apiCall3, data, ok, _t3;
320
320
  return _regenerator().w(function (_context3) {
321
- while (1) switch (_context3.n) {
321
+ while (1) switch (_context3.p = _context3.n) {
322
322
  case 0:
323
323
  e.preventDefault();
324
324
  if (editInvoiceId) {
@@ -36,7 +36,7 @@ var PowrBaseInvoice = function PowrBaseInvoice(_ref) {
36
36
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
37
37
  var _yield$apiCall, data, ok, _t;
38
38
  return _regenerator().w(function (_context) {
39
- while (1) switch (_context.n) {
39
+ while (1) switch (_context.p = _context.n) {
40
40
  case 0:
41
41
  _context.p = 0;
42
42
  _context.n = 1;
@@ -83,7 +83,7 @@ var PowrLike = function PowrLike(_ref2) {
83
83
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
84
84
  var endpoint, _yield$apiCall, data, ok, _t;
85
85
  return _regenerator().w(function (_context) {
86
- while (1) switch (_context.n) {
86
+ while (1) switch (_context.p = _context.n) {
87
87
  case 0:
88
88
  setLoading(true);
89
89
  _context.p = 1;
@@ -124,7 +124,7 @@ var PowrLike = function PowrLike(_ref2) {
124
124
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
125
125
  var endpoint, _yield$apiCall2, data, ok, _t2;
126
126
  return _regenerator().w(function (_context2) {
127
- while (1) switch (_context2.n) {
127
+ while (1) switch (_context2.p = _context2.n) {
128
128
  case 0:
129
129
  if (userId) {
130
130
  _context2.n = 1;
@@ -168,7 +168,7 @@ var PowrLike = function PowrLike(_ref2) {
168
168
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
169
169
  var endpoint, _t3;
170
170
  return _regenerator().w(function (_context3) {
171
- while (1) switch (_context3.n) {
171
+ while (1) switch (_context3.p = _context3.n) {
172
172
  case 0:
173
173
  setSubmitting(true);
174
174
  _context3.p = 1;