@frontegg/rest-api 3.0.1 → 3.0.2

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.
Files changed (68) hide show
  1. package/ContextHolder.js +64 -100
  2. package/account-settings/index.js +4 -43
  3. package/audits/index.js +16 -69
  4. package/auth/enums.js +2 -2
  5. package/auth/index.js +352 -2045
  6. package/auth/interfaces.js +1 -1
  7. package/auth/secutiry-poilicy/index.js +45 -254
  8. package/connectivity/index.js +79 -73
  9. package/constants.js +1 -1
  10. package/error.js +9 -33
  11. package/fetch.js +159 -519
  12. package/index.js +26 -26
  13. package/jwt.js +19 -45
  14. package/metadata/index.js +18 -160
  15. package/node/ContextHolder.js +68 -104
  16. package/node/account-settings/index.js +4 -46
  17. package/node/audits/index.js +15 -68
  18. package/node/auth/enums.js +2 -2
  19. package/node/auth/index.js +481 -2099
  20. package/node/auth/interfaces.js +2 -2
  21. package/node/auth/secutiry-poilicy/index.js +36 -240
  22. package/node/connectivity/index.js +78 -71
  23. package/node/constants.js +1 -1
  24. package/node/error.js +9 -38
  25. package/node/fetch.js +166 -521
  26. package/node/index.js +47 -49
  27. package/node/jwt.js +19 -51
  28. package/node/metadata/index.js +19 -163
  29. package/node/notifications/index.js +18 -94
  30. package/node/reports/index.js +62 -171
  31. package/node/roles/index.js +34 -172
  32. package/node/routers.js +2 -2
  33. package/node/sub-tenants/index.js +12 -126
  34. package/node/subscriptions/enums.js +4 -4
  35. package/node/subscriptions/index.js +10 -10
  36. package/node/subscriptions/interfaces.js +1 -1
  37. package/node/subscriptions/invoices.js +10 -70
  38. package/node/subscriptions/managedSubscriptions.js +16 -111
  39. package/node/subscriptions/paymentMethods.js +15 -69
  40. package/node/subscriptions/paymentProviders.js +2 -26
  41. package/node/subscriptions/plans.js +4 -46
  42. package/node/subscriptions/providers/index.js +1 -1
  43. package/node/subscriptions/providers/stripe/index.js +10 -106
  44. package/node/subscriptions/subscriptions.js +16 -111
  45. package/node/subscriptions/summaries.js +2 -26
  46. package/node/subscriptions/tenantConfiguration.js +4 -46
  47. package/node/teams/index.js +57 -406
  48. package/node/tenants/index.js +8 -86
  49. package/node/vendor/index.js +2 -26
  50. package/notifications/index.js +18 -93
  51. package/package.json +1 -1
  52. package/reports/index.js +65 -175
  53. package/roles/index.js +34 -175
  54. package/routers.js +2 -2
  55. package/sub-tenants/index.js +12 -127
  56. package/subscriptions/enums.js +4 -4
  57. package/subscriptions/invoices.js +12 -70
  58. package/subscriptions/managedSubscriptions.js +20 -115
  59. package/subscriptions/paymentMethods.js +16 -70
  60. package/subscriptions/paymentProviders.js +2 -22
  61. package/subscriptions/plans.js +4 -43
  62. package/subscriptions/providers/stripe/index.js +10 -106
  63. package/subscriptions/subscriptions.js +20 -115
  64. package/subscriptions/summaries.js +2 -22
  65. package/subscriptions/tenantConfiguration.js +4 -43
  66. package/teams/index.js +55 -421
  67. package/tenants/index.js +8 -85
  68. package/vendor/index.js +2 -23
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.1
1
+ /** @license Frontegg v3.0.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -36,32 +36,32 @@ export * from './sub-tenants/interfaces';
36
36
  export * from './routers';
37
37
  import { AuthStrategyEnum, SocialLoginProviders } from './auth';
38
38
  import { ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType } from './subscriptions';
39
- var api = {
40
- auth: auth,
41
- teams: teams,
42
- metadata: metadata,
43
- reports: reports,
44
- connectivity: connectivity,
45
- notifications: notifications,
46
- audits: audits,
47
- tenants: tenants,
48
- accountSettings: accountSettings,
49
- roles: roles,
50
- subscriptions: subscriptions,
51
- vendor: vendor,
52
- subTenants: subTenants
39
+ const api = {
40
+ auth,
41
+ teams,
42
+ metadata,
43
+ reports,
44
+ connectivity,
45
+ notifications,
46
+ audits,
47
+ tenants,
48
+ accountSettings,
49
+ roles,
50
+ subscriptions,
51
+ vendor,
52
+ subTenants
53
53
  };
54
54
  export { fetch, ContextHolder, FronteggContext, api, FronteggApiError, AuthStrategyEnum, SocialLoginProviders, ISubscriptionCancellationPolicy, ISubscriptionStatus, PaymentMethodType, ProviderType };
55
55
  export default {
56
- fetch: fetch,
57
- ContextHolder: ContextHolder,
58
- FronteggContext: FronteggContext,
59
- api: api,
60
- FronteggApiError: FronteggApiError,
61
- AuthStrategyEnum: AuthStrategyEnum,
62
- SocialLoginProviders: SocialLoginProviders,
63
- ISubscriptionCancellationPolicy: ISubscriptionCancellationPolicy,
64
- ISubscriptionStatus: ISubscriptionStatus,
65
- PaymentMethodType: PaymentMethodType,
66
- ProviderType: ProviderType
56
+ fetch,
57
+ ContextHolder,
58
+ FronteggContext,
59
+ api,
60
+ FronteggApiError,
61
+ AuthStrategyEnum,
62
+ SocialLoginProviders,
63
+ ISubscriptionCancellationPolicy,
64
+ ISubscriptionStatus,
65
+ PaymentMethodType,
66
+ ProviderType
67
67
  };
package/jwt.js CHANGED
@@ -1,50 +1,32 @@
1
- import _createClass from "@babel/runtime/helpers/esm/createClass";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper";
7
-
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
-
10
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
13
- export var InvalidCharacterError = function (_Error) {
14
- _inherits(InvalidCharacterError, _Error);
15
-
16
- var _super = _createSuper(InvalidCharacterError);
17
-
18
- function InvalidCharacterError(message) {
19
- _classCallCheck(this, InvalidCharacterError);
20
-
21
- return _super.call(this, message);
1
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
2
+ export class InvalidCharacterError extends Error {
3
+ constructor(message) {
4
+ super(message);
22
5
  }
23
6
 
24
- return _createClass(InvalidCharacterError);
25
- }(_wrapNativeSuper(Error));
7
+ }
26
8
 
27
9
  function polyfill(input) {
28
- var str = String(input).replace(/=+$/, '');
10
+ const str = String(input).replace(/=+$/, '');
29
11
 
30
12
  if (str.length % 4 === 1) {
31
13
  throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
32
14
  }
33
15
 
34
- var output = '';
16
+ let output = '';
35
17
 
36
- for (var bc = 0, bs, buffer, idx = 0; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
18
+ for (let bc = 0, bs, buffer, idx = 0; buffer = str.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
37
19
  buffer = chars.indexOf(buffer);
38
20
  }
39
21
 
40
22
  return output;
41
23
  }
42
24
 
43
- var atob = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
25
+ const atob = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
44
26
 
45
27
  function b64DecodeUnicode(str) {
46
- return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
47
- var code = p.charCodeAt(0).toString(16).toUpperCase();
28
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
29
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
48
30
 
49
31
  if (code.length < 2) {
50
32
  code = '0' + code;
@@ -54,8 +36,8 @@ function b64DecodeUnicode(str) {
54
36
  }));
55
37
  }
56
38
 
57
- var base64UrlDecode = function base64UrlDecode(str) {
58
- var output = str.replace(/-/g, '+').replace(/_/g, '/');
39
+ const base64UrlDecode = str => {
40
+ let output = str.replace(/-/g, '+').replace(/_/g, '/');
59
41
 
60
42
  switch (output.length % 4) {
61
43
  case 0:
@@ -80,22 +62,14 @@ var base64UrlDecode = function base64UrlDecode(str) {
80
62
  }
81
63
  };
82
64
 
83
- export var InvalidTokenError = function (_Error2) {
84
- _inherits(InvalidTokenError, _Error2);
85
-
86
- var _super2 = _createSuper(InvalidTokenError);
87
-
88
- function InvalidTokenError(message) {
89
- _classCallCheck(this, InvalidTokenError);
90
-
91
- return _super2.call(this, message);
65
+ export class InvalidTokenError extends Error {
66
+ constructor(message) {
67
+ super(message);
92
68
  }
93
69
 
94
- return _createClass(InvalidTokenError);
95
- }(_wrapNativeSuper(Error));
96
- export var jwtDecode = function jwtDecode(token) {
97
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
98
- var pos = !!options.header ? 0 : 1;
70
+ }
71
+ export const jwtDecode = (token, options = {}) => {
72
+ const pos = !!options.header ? 0 : 1;
99
73
 
100
74
  try {
101
75
  return JSON.parse(base64UrlDecode(token.split('.')[pos]));
package/metadata/index.js CHANGED
@@ -1,166 +1,24 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get } from '../fetch';
4
2
 
5
- function getMetadata(_x) {
6
- return _getMetadata.apply(this, arguments);
3
+ async function getMetadata(body) {
4
+ const data = await Get('/metadata', body);
5
+ if (data?.rows?.[0]) return data?.rows?.[0];
6
+ throw new Error(`metadata not found: ${body.entityName}`);
7
7
  }
8
8
 
9
- function _getMetadata() {
10
- _getMetadata = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(body) {
11
- var _data$rows, _data$rows2;
12
-
13
- var data;
14
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
15
- while (1) {
16
- switch (_context5.prev = _context5.next) {
17
- case 0:
18
- _context5.next = 2;
19
- return Get('/metadata', body);
20
-
21
- case 2:
22
- data = _context5.sent;
23
-
24
- if (!(data != null && (_data$rows = data.rows) != null && _data$rows[0])) {
25
- _context5.next = 5;
26
- break;
27
- }
28
-
29
- return _context5.abrupt("return", data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0]);
30
-
31
- case 5:
32
- throw new Error("metadata not found: ".concat(body.entityName));
33
-
34
- case 6:
35
- case "end":
36
- return _context5.stop();
37
- }
38
- }
39
- }, _callee5);
40
- }));
41
- return _getMetadata.apply(this, arguments);
9
+ async function getIpMetadata(ip) {
10
+ const data = await Get(`/metadata/ip/${ip}`);
11
+ if (data) return data;
12
+ throw new Error(`ip metadata not found`);
42
13
  }
43
14
 
44
- function getIpMetadata(_x2) {
45
- return _getIpMetadata.apply(this, arguments);
46
- }
47
-
48
- function _getIpMetadata() {
49
- _getIpMetadata = _asyncToGenerator(_regeneratorRuntime.mark(function _callee6(ip) {
50
- var data;
51
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
52
- while (1) {
53
- switch (_context6.prev = _context6.next) {
54
- case 0:
55
- _context6.next = 2;
56
- return Get("/metadata/ip/".concat(ip));
57
-
58
- case 2:
59
- data = _context6.sent;
60
-
61
- if (!data) {
62
- _context6.next = 5;
63
- break;
64
- }
65
-
66
- return _context6.abrupt("return", data);
67
-
68
- case 5:
69
- throw new Error("ip metadata not found");
70
-
71
- case 6:
72
- case "end":
73
- return _context6.stop();
74
- }
75
- }
76
- }, _callee6);
77
- }));
78
- return _getIpMetadata.apply(this, arguments);
79
- }
80
-
81
- export var getNotificationsMetadata = function () {
82
- var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
83
- return _regeneratorRuntime.wrap(function _callee$(_context) {
84
- while (1) {
85
- switch (_context.prev = _context.next) {
86
- case 0:
87
- return _context.abrupt("return", getMetadata({
88
- entityName: 'notifications'
89
- }));
90
-
91
- case 1:
92
- case "end":
93
- return _context.stop();
94
- }
95
- }
96
- }, _callee);
97
- }));
98
-
99
- return function getNotificationsMetadata() {
100
- return _ref.apply(this, arguments);
101
- };
102
- }();
103
- export var getSamlMetadata = function () {
104
- var _ref2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
105
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
106
- while (1) {
107
- switch (_context2.prev = _context2.next) {
108
- case 0:
109
- return _context2.abrupt("return", getMetadata({
110
- entityName: 'saml'
111
- }));
112
-
113
- case 1:
114
- case "end":
115
- return _context2.stop();
116
- }
117
- }
118
- }, _callee2);
119
- }));
120
-
121
- return function getSamlMetadata() {
122
- return _ref2.apply(this, arguments);
123
- };
124
- }();
125
- export var getAuditsMetadata = function () {
126
- var _ref3 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3() {
127
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
128
- while (1) {
129
- switch (_context3.prev = _context3.next) {
130
- case 0:
131
- return _context3.abrupt("return", getMetadata({
132
- entityName: 'audits'
133
- }));
134
-
135
- case 1:
136
- case "end":
137
- return _context3.stop();
138
- }
139
- }
140
- }, _callee3);
141
- }));
142
-
143
- return function getAuditsMetadata() {
144
- return _ref3.apply(this, arguments);
145
- };
146
- }();
147
- export var getIpAdressMetadata = function () {
148
- var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(ip) {
149
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
150
- while (1) {
151
- switch (_context4.prev = _context4.next) {
152
- case 0:
153
- return _context4.abrupt("return", getIpMetadata(ip));
154
-
155
- case 1:
156
- case "end":
157
- return _context4.stop();
158
- }
159
- }
160
- }, _callee4);
161
- }));
162
-
163
- return function getIpAdressMetadata(_x3) {
164
- return _ref4.apply(this, arguments);
165
- };
166
- }();
15
+ export const getNotificationsMetadata = async () => getMetadata({
16
+ entityName: 'notifications'
17
+ });
18
+ export const getSamlMetadata = async () => getMetadata({
19
+ entityName: 'saml'
20
+ });
21
+ export const getAuditsMetadata = async () => getMetadata({
22
+ entityName: 'audits'
23
+ });
24
+ export const getIpAdressMetadata = async ip => getIpMetadata(ip);
@@ -1,126 +1,90 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.FronteggContext = exports.ContextHolder = void 0;
9
7
 
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var ContextHolder = function () {
15
- function ContextHolder() {
16
- (0, _classCallCheck2["default"])(this, ContextHolder);
8
+ class ContextHolder {
9
+ constructor() {
17
10
  this.context = null;
18
11
  this.accessToken = null;
19
12
  this.user = null;
20
13
 
21
- this.onRedirectTo = function (path) {
22
- return window.location.href = path;
14
+ this.onRedirectTo = path => window.location.href = path;
15
+
16
+ this.logout = () => window.location.href = '/account/logout';
17
+ }
18
+
19
+ static getInstance() {
20
+ if (!ContextHolder.instance) {
21
+ ContextHolder.instance = new ContextHolder();
22
+ }
23
+
24
+ return ContextHolder.instance;
25
+ }
26
+
27
+ static setContext(context) {
28
+ ContextHolder.getInstance().context = context;
29
+ }
30
+
31
+ static setAccessToken(accessToken) {
32
+ ContextHolder.getInstance().accessToken = accessToken;
33
+ }
34
+
35
+ static setUser(user) {
36
+ ContextHolder.getInstance().user = user;
37
+ }
38
+
39
+ static setOnRedirectTo(onRedirectTo) {
40
+ ContextHolder.getInstance().onRedirectTo = onRedirectTo;
41
+ }
42
+
43
+ static setLogout(logout, logoutUrl) {
44
+ ContextHolder.getInstance().logout = callback => {
45
+ if (!callback) {
46
+ ContextHolder.onRedirectTo(logoutUrl);
47
+ } else {
48
+ logout(callback);
49
+ }
23
50
  };
51
+ }
52
+
53
+ static getContext() {
54
+ var _ContextHolder$getIns;
24
55
 
25
- this.logout = function () {
26
- return window.location.href = '/account/logout';
56
+ return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
57
+ baseUrl: window.location.href,
58
+ tokenResolver: () => 'my-authentication-token',
59
+ logLevel: 'error'
27
60
  };
28
61
  }
29
62
 
30
- (0, _createClass2["default"])(ContextHolder, null, [{
31
- key: "getInstance",
32
- value: function getInstance() {
33
- if (!ContextHolder.instance) {
34
- ContextHolder.instance = new ContextHolder();
35
- }
63
+ static getAccessToken() {
64
+ return ContextHolder.getInstance().accessToken;
65
+ }
36
66
 
37
- return ContextHolder.instance;
38
- }
39
- }, {
40
- key: "setContext",
41
- value: function setContext(context) {
42
- ContextHolder.getInstance().context = context;
43
- }
44
- }, {
45
- key: "setAccessToken",
46
- value: function setAccessToken(accessToken) {
47
- ContextHolder.getInstance().accessToken = accessToken;
48
- }
49
- }, {
50
- key: "setUser",
51
- value: function setUser(user) {
52
- ContextHolder.getInstance().user = user;
53
- }
54
- }, {
55
- key: "setOnRedirectTo",
56
- value: function setOnRedirectTo(onRedirectTo) {
57
- ContextHolder.getInstance().onRedirectTo = onRedirectTo;
58
- }
59
- }, {
60
- key: "setLogout",
61
- value: function setLogout(logout, logoutUrl) {
62
- ContextHolder.getInstance().logout = function (callback) {
63
- if (!callback) {
64
- ContextHolder.onRedirectTo(logoutUrl);
65
- } else {
66
- logout(callback);
67
- }
68
- };
69
- }
70
- }, {
71
- key: "getContext",
72
- value: function getContext() {
73
- var _ContextHolder$getIns;
74
-
75
- return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
76
- baseUrl: window.location.href,
77
- tokenResolver: function tokenResolver() {
78
- return 'my-authentication-token';
79
- },
80
- logLevel: 'error'
81
- };
82
- }
83
- }, {
84
- key: "getAccessToken",
85
- value: function getAccessToken() {
86
- return ContextHolder.getInstance().accessToken;
87
- }
88
- }, {
89
- key: "getUser",
90
- value: function getUser() {
91
- return ContextHolder.getInstance().user;
92
- }
93
- }, {
94
- key: "onRedirectTo",
95
- value: function onRedirectTo(path, opts) {
96
- return ContextHolder.getInstance().onRedirectTo(path, opts);
97
- }
98
- }, {
99
- key: "logout",
100
- value: function logout(callback) {
101
- return ContextHolder.getInstance().logout(callback);
102
- }
103
- }]);
104
- return ContextHolder;
105
- }();
67
+ static getUser() {
68
+ return ContextHolder.getInstance().user;
69
+ }
70
+
71
+ static onRedirectTo(path, opts) {
72
+ return ContextHolder.getInstance().onRedirectTo(path, opts);
73
+ }
74
+
75
+ static logout(callback) {
76
+ return ContextHolder.getInstance().logout(callback);
77
+ }
78
+
79
+ }
106
80
 
107
81
  exports.ContextHolder = ContextHolder;
108
82
  ContextHolder.instance = void 0;
109
- var FronteggContext = {
110
- getContext: function getContext() {
111
- return ContextHolder.getContext();
112
- },
113
- getAccessToken: function getAccessToken() {
114
- return ContextHolder.getAccessToken();
115
- },
116
- getUser: function getUser() {
117
- return ContextHolder.getUser();
118
- },
119
- onRedirectTo: function onRedirectTo(path, opts) {
120
- return ContextHolder.onRedirectTo(path, opts);
121
- },
122
- logout: function logout(callback) {
123
- return ContextHolder.logout(callback);
124
- }
83
+ const FronteggContext = {
84
+ getContext: () => ContextHolder.getContext(),
85
+ getAccessToken: () => ContextHolder.getAccessToken(),
86
+ getUser: () => ContextHolder.getUser(),
87
+ onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts),
88
+ logout: callback => ContextHolder.logout(callback)
125
89
  };
126
90
  exports.FronteggContext = FronteggContext;
@@ -1,61 +1,19 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.getSettings = getSettings;
9
7
  exports.updateSettings = updateSettings;
10
8
 
11
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
-
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
-
15
9
  var _constants = require("../constants");
16
10
 
17
11
  var _fetch = require("../fetch");
18
12
 
19
- function updateSettings(_x) {
20
- return _updateSettings.apply(this, arguments);
13
+ async function updateSettings(body) {
14
+ return (0, _fetch.Put)(_constants.urls.tenants.accountSettings.v1, body);
21
15
  }
22
16
 
23
- function _updateSettings() {
24
- _updateSettings = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(body) {
25
- return _regenerator["default"].wrap(function _callee$(_context) {
26
- while (1) {
27
- switch (_context.prev = _context.next) {
28
- case 0:
29
- return _context.abrupt("return", (0, _fetch.Put)(_constants.urls.tenants.accountSettings.v1, body));
30
-
31
- case 1:
32
- case "end":
33
- return _context.stop();
34
- }
35
- }
36
- }, _callee);
37
- }));
38
- return _updateSettings.apply(this, arguments);
39
- }
40
-
41
- function getSettings() {
42
- return _getSettings.apply(this, arguments);
43
- }
44
-
45
- function _getSettings() {
46
- _getSettings = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2() {
47
- return _regenerator["default"].wrap(function _callee2$(_context2) {
48
- while (1) {
49
- switch (_context2.prev = _context2.next) {
50
- case 0:
51
- return _context2.abrupt("return", (0, _fetch.Get)(_constants.urls.tenants.accountSettings.v1));
52
-
53
- case 1:
54
- case "end":
55
- return _context2.stop();
56
- }
57
- }
58
- }, _callee2);
59
- }));
60
- return _getSettings.apply(this, arguments);
17
+ async function getSettings() {
18
+ return (0, _fetch.Get)(_constants.urls.tenants.accountSettings.v1);
61
19
  }