@plusscommunities/pluss-core-web 1.4.31-auth0.2 → 1.4.32-auth.0
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.
- package/dist/index.cjs.js +11 -13
- package/dist/index.esm.js +11 -13
- package/dist/index.umd.js +14 -16
- package/package.json +4 -1
- package/src/session.js +3 -5
package/dist/index.cjs.js
CHANGED
|
@@ -6,12 +6,12 @@ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
|
6
6
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
7
7
|
var _ = require('lodash');
|
|
8
8
|
var axios = require('axios');
|
|
9
|
-
var awsAmplify = require('aws-amplify');
|
|
10
9
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
10
|
var moment = require('moment');
|
|
12
11
|
var React = require('react');
|
|
13
12
|
var $ = require('jquery');
|
|
14
13
|
var Cookies = require('js-cookie');
|
|
14
|
+
var awsAmplify = require('aws-amplify');
|
|
15
15
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
16
16
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
17
17
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
@@ -237,30 +237,28 @@ var unauthedFunction = function unauthedFunction(request) {
|
|
|
237
237
|
};
|
|
238
238
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
239
239
|
var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
240
|
-
var user;
|
|
241
240
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
242
241
|
while (1) {
|
|
243
242
|
switch (_context3.prev = _context3.next) {
|
|
244
243
|
case 0:
|
|
245
244
|
_context3.prev = 0;
|
|
246
245
|
_context3.next = 3;
|
|
247
|
-
return
|
|
246
|
+
return CoreConfig.env.AuthStrategy.getCurrentUserId();
|
|
248
247
|
|
|
249
248
|
case 3:
|
|
250
|
-
|
|
251
|
-
return _context3.abrupt("return", user.id);
|
|
249
|
+
return _context3.abrupt("return", _context3.sent);
|
|
252
250
|
|
|
253
|
-
case
|
|
254
|
-
_context3.prev =
|
|
251
|
+
case 6:
|
|
252
|
+
_context3.prev = 6;
|
|
255
253
|
_context3.t0 = _context3["catch"](0);
|
|
256
254
|
return _context3.abrupt("return", null);
|
|
257
255
|
|
|
258
|
-
case
|
|
256
|
+
case 9:
|
|
259
257
|
case "end":
|
|
260
258
|
return _context3.stop();
|
|
261
259
|
}
|
|
262
260
|
}
|
|
263
|
-
}, _callee3, null, [[0,
|
|
261
|
+
}, _callee3, null, [[0, 6]]);
|
|
264
262
|
}));
|
|
265
263
|
|
|
266
264
|
return function getCurrentUserSub() {
|
|
@@ -269,19 +267,19 @@ var getCurrentUserSub = /*#__PURE__*/function () {
|
|
|
269
267
|
}();
|
|
270
268
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
271
269
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(self) {
|
|
272
|
-
var
|
|
270
|
+
var isLoggedIn;
|
|
273
271
|
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
274
272
|
while (1) {
|
|
275
273
|
switch (_context4.prev = _context4.next) {
|
|
276
274
|
case 0:
|
|
277
275
|
_context4.prev = 0;
|
|
278
276
|
_context4.next = 3;
|
|
279
|
-
return
|
|
277
|
+
return CoreConfig.env.AuthStrategy.hasActiveSession();
|
|
280
278
|
|
|
281
279
|
case 3:
|
|
282
|
-
|
|
280
|
+
isLoggedIn = _context4.sent;
|
|
283
281
|
|
|
284
|
-
if (
|
|
282
|
+
if (!isLoggedIn) {
|
|
285
283
|
console.log('redirecting to login');
|
|
286
284
|
self.props.history.push('/login');
|
|
287
285
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -2,12 +2,12 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
2
2
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import axios from 'axios';
|
|
5
|
-
import { Auth, Storage } from 'aws-amplify';
|
|
6
5
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
7
6
|
import moment from 'moment';
|
|
8
7
|
import React, { Component, PureComponent } from 'react';
|
|
9
8
|
import $ from 'jquery';
|
|
10
9
|
import Cookies from 'js-cookie';
|
|
10
|
+
import { Storage } from 'aws-amplify';
|
|
11
11
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
12
12
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
13
13
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
@@ -207,30 +207,28 @@ var unauthedFunction = function unauthedFunction(request) {
|
|
|
207
207
|
};
|
|
208
208
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
209
209
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
210
|
-
var user;
|
|
211
210
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
212
211
|
while (1) {
|
|
213
212
|
switch (_context3.prev = _context3.next) {
|
|
214
213
|
case 0:
|
|
215
214
|
_context3.prev = 0;
|
|
216
215
|
_context3.next = 3;
|
|
217
|
-
return
|
|
216
|
+
return CoreConfig.env.AuthStrategy.getCurrentUserId();
|
|
218
217
|
|
|
219
218
|
case 3:
|
|
220
|
-
|
|
221
|
-
return _context3.abrupt("return", user.id);
|
|
219
|
+
return _context3.abrupt("return", _context3.sent);
|
|
222
220
|
|
|
223
|
-
case
|
|
224
|
-
_context3.prev =
|
|
221
|
+
case 6:
|
|
222
|
+
_context3.prev = 6;
|
|
225
223
|
_context3.t0 = _context3["catch"](0);
|
|
226
224
|
return _context3.abrupt("return", null);
|
|
227
225
|
|
|
228
|
-
case
|
|
226
|
+
case 9:
|
|
229
227
|
case "end":
|
|
230
228
|
return _context3.stop();
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
|
-
}, _callee3, null, [[0,
|
|
231
|
+
}, _callee3, null, [[0, 6]]);
|
|
234
232
|
}));
|
|
235
233
|
|
|
236
234
|
return function getCurrentUserSub() {
|
|
@@ -239,19 +237,19 @@ var getCurrentUserSub = /*#__PURE__*/function () {
|
|
|
239
237
|
}();
|
|
240
238
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
241
239
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(self) {
|
|
242
|
-
var
|
|
240
|
+
var isLoggedIn;
|
|
243
241
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
244
242
|
while (1) {
|
|
245
243
|
switch (_context4.prev = _context4.next) {
|
|
246
244
|
case 0:
|
|
247
245
|
_context4.prev = 0;
|
|
248
246
|
_context4.next = 3;
|
|
249
|
-
return
|
|
247
|
+
return CoreConfig.env.AuthStrategy.hasActiveSession();
|
|
250
248
|
|
|
251
249
|
case 3:
|
|
252
|
-
|
|
250
|
+
isLoggedIn = _context4.sent;
|
|
253
251
|
|
|
254
|
-
if (
|
|
252
|
+
if (!isLoggedIn) {
|
|
255
253
|
console.log('redirecting to login');
|
|
256
254
|
self.props.history.push('/login');
|
|
257
255
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global.
|
|
5
|
-
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('@babel/runtime/helpers/defineProperty'), require('moment'), require('react'), require('jquery'), require('js-cookie'), require('aws-amplify'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('react-fontawesome'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('react-redux'), require('react-textarea-autosize'), require('@babel/runtime/helpers/toConsumableArray'), require('@babel/runtime/helpers/typeof'), require('react-dropzone'), require('react-router'), require('react-bootstrap'), require('@fortawesome/react-fontawesome'), require('@crello/react-lottie'), require('react-csv'), require('@babel/runtime/helpers/objectWithoutProperties'), require('react-color'), require('tinycolor2'), require('react-router-dom'), require('@fortawesome/free-solid-svg-icons')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', '@babel/runtime/helpers/defineProperty', 'moment', 'react', 'jquery', 'js-cookie', 'aws-amplify', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', 'react-fontawesome', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', 'react-redux', 'react-textarea-autosize', '@babel/runtime/helpers/toConsumableArray', '@babel/runtime/helpers/typeof', 'react-dropzone', 'react-router', 'react-bootstrap', '@fortawesome/react-fontawesome', '@crello/react-lottie', 'react-csv', '@babel/runtime/helpers/objectWithoutProperties', 'react-color', 'tinycolor2', 'react-router-dom', '@fortawesome/free-solid-svg-icons'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global._defineProperty, global.moment, global.React, global.$, global.Cookies, global.awsAmplify, global._classCallCheck, global._createClass, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global.FontAwesome, global._extends, global._assertThisInitialized, global.reactRedux, global.Textarea, global._toConsumableArray, global._typeof, global.Dropzone, global.reactRouter, global.reactBootstrap, global.reactFontawesome, global.reactLottie, global.reactCsv, global._objectWithoutProperties, global.reactColor, global.tinycolor, global.reactRouterDom, global.freeSolidSvgIcons));
|
|
5
|
+
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios, _defineProperty, moment, React, $, Cookies, awsAmplify, _classCallCheck, _createClass, _inherits, _possibleConstructorReturn, _getPrototypeOf, FontAwesome, _extends, _assertThisInitialized, reactRedux, Textarea, _toConsumableArray, _typeof, Dropzone, reactRouter, reactBootstrap, reactFontawesome, reactLottie, reactCsv, _objectWithoutProperties, reactColor, tinycolor, reactRouterDom, freeSolidSvgIcons) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -205,30 +205,28 @@
|
|
|
205
205
|
};
|
|
206
206
|
var getCurrentUserSub = /*#__PURE__*/function () {
|
|
207
207
|
var _ref3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
|
208
|
-
var user;
|
|
209
208
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
210
209
|
while (1) {
|
|
211
210
|
switch (_context3.prev = _context3.next) {
|
|
212
211
|
case 0:
|
|
213
212
|
_context3.prev = 0;
|
|
214
213
|
_context3.next = 3;
|
|
215
|
-
return
|
|
214
|
+
return CoreConfig.env.AuthStrategy.getCurrentUserId();
|
|
216
215
|
|
|
217
216
|
case 3:
|
|
218
|
-
|
|
219
|
-
return _context3.abrupt("return", user.id);
|
|
217
|
+
return _context3.abrupt("return", _context3.sent);
|
|
220
218
|
|
|
221
|
-
case
|
|
222
|
-
_context3.prev =
|
|
219
|
+
case 6:
|
|
220
|
+
_context3.prev = 6;
|
|
223
221
|
_context3.t0 = _context3["catch"](0);
|
|
224
222
|
return _context3.abrupt("return", null);
|
|
225
223
|
|
|
226
|
-
case
|
|
224
|
+
case 9:
|
|
227
225
|
case "end":
|
|
228
226
|
return _context3.stop();
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
|
-
}, _callee3, null, [[0,
|
|
229
|
+
}, _callee3, null, [[0, 6]]);
|
|
232
230
|
}));
|
|
233
231
|
|
|
234
232
|
return function getCurrentUserSub() {
|
|
@@ -237,19 +235,19 @@
|
|
|
237
235
|
}();
|
|
238
236
|
var checkLoggedIn = /*#__PURE__*/function () {
|
|
239
237
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(self) {
|
|
240
|
-
var
|
|
238
|
+
var isLoggedIn;
|
|
241
239
|
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
242
240
|
while (1) {
|
|
243
241
|
switch (_context4.prev = _context4.next) {
|
|
244
242
|
case 0:
|
|
245
243
|
_context4.prev = 0;
|
|
246
244
|
_context4.next = 3;
|
|
247
|
-
return
|
|
245
|
+
return CoreConfig.env.AuthStrategy.hasActiveSession();
|
|
248
246
|
|
|
249
247
|
case 3:
|
|
250
|
-
|
|
248
|
+
isLoggedIn = _context4.sent;
|
|
251
249
|
|
|
252
|
-
if (
|
|
250
|
+
if (!isLoggedIn) {
|
|
253
251
|
console.log('redirecting to login');
|
|
254
252
|
self.props.history.push('/login');
|
|
255
253
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-core-web",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.32-auth.0",
|
|
4
4
|
"description": "Core extension package for Pluss Communities platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"patch": "npm version patch",
|
|
10
10
|
"betaupload": "npm run build && npm publish --access public --tag beta && rm -rf node_modules",
|
|
11
11
|
"betaupload:p": "npm run betapatch && npm run betaupload",
|
|
12
|
+
"authpatch": "npm version prepatch --preid=auth",
|
|
13
|
+
"authupload": "npm run build && npm publish --access public --tag auth && rm -rf node_modules",
|
|
14
|
+
"authupload:p": "npm run authpatch && npm run authupload",
|
|
12
15
|
"upload": "npm run build && npm publish --access public && rm -rf node_modules",
|
|
13
16
|
"upload:p": "npm run patch && npm run upload"
|
|
14
17
|
},
|
package/src/session.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import { Auth } from 'aws-amplify';
|
|
4
3
|
import Config from './config';
|
|
5
4
|
|
|
6
5
|
export const getSessionTokenAWS = async (prefix) => {
|
|
@@ -33,8 +32,7 @@ export const unauthedFunction = (request) => {
|
|
|
33
32
|
|
|
34
33
|
export const getCurrentUserSub = async () => {
|
|
35
34
|
try {
|
|
36
|
-
|
|
37
|
-
return user.id;
|
|
35
|
+
return await Config.env.AuthStrategy.getCurrentUserId();
|
|
38
36
|
} catch (error) {
|
|
39
37
|
return null;
|
|
40
38
|
}
|
|
@@ -42,8 +40,8 @@ export const getCurrentUserSub = async () => {
|
|
|
42
40
|
|
|
43
41
|
export const checkLoggedIn = async (self) => {
|
|
44
42
|
try {
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
43
|
+
const isLoggedIn = await Config.env.AuthStrategy.hasActiveSession();
|
|
44
|
+
if (!isLoggedIn) {
|
|
47
45
|
console.log('redirecting to login');
|
|
48
46
|
self.props.history.push('/login');
|
|
49
47
|
}
|