@frontegg/angular 6.34.0 → 7.0.0-alpha.10251233112

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.
@@ -357,7 +357,7 @@
357
357
  }]
358
358
  }] });
359
359
 
360
- var sdkVersion = { version: '6.34.0' };
360
+ var sdkVersion = { version: '7.0.0' };
361
361
 
362
362
  var FronteggAppOptionsClass = /** @class */ (function () {
363
363
  function FronteggAppOptionsClass() {
@@ -370,7 +370,7 @@
370
370
  var FronteggAppService = /** @class */ (function () {
371
371
  function FronteggAppService(config, router, ngZone) {
372
372
  var _this = this;
373
- var _a;
373
+ var _a, _b;
374
374
  this.config = config;
375
375
  this.router = router;
376
376
  this.ngZone = ngZone;
@@ -421,9 +421,10 @@
421
421
  // @ts-ignore
422
422
  framework: restApi.FronteggFrameworks.Angular + "@" + angularCoreVersion__default["default"].version,
423
423
  };
424
+ var appName = (_a = this.config.appName) !== null && _a !== void 0 ? _a : 'default';
424
425
  // prepare config default values
425
- this.config = Object.assign(Object.assign({}, this.config), { contextOptions: Object.assign(Object.assign({}, this.config.contextOptions), { metadataHeaders: metadataHeaders }), authOptions: Object.assign(Object.assign({}, this.config.authOptions), { hostedLoginOptions: Object.assign({ loadUserOnFirstLoad: true }, (_a = this.config.authOptions) === null || _a === void 0 ? void 0 : _a.hostedLoginOptions), onRedirectTo: onRedirectTo }) });
426
- restApi.ContextHolder.setOnRedirectTo(onRedirectTo);
426
+ this.config = Object.assign(Object.assign({}, this.config), { appName: appName, contextOptions: Object.assign(Object.assign({}, this.config.contextOptions), { metadataHeaders: metadataHeaders }), authOptions: Object.assign(Object.assign({}, this.config.authOptions), { hostedLoginOptions: Object.assign({ loadUserOnFirstLoad: true }, (_b = this.config.authOptions) === null || _b === void 0 ? void 0 : _b.hostedLoginOptions), onRedirectTo: onRedirectTo }) });
427
+ restApi.ContextHolder.for(appName).setOnRedirectTo(onRedirectTo);
427
428
  this.fronteggApp = js.initialize(Object.assign({ onRedirectTo: onRedirectTo }, this.config));
428
429
  // Add all login box routes to Angular router config
429
430
  this.router.resetConfig(__spreadArray(__spreadArray([], __read(this.mapAuthComponents)), [
@@ -651,7 +652,7 @@
651
652
  /**
652
653
  * Trigger user subject change event if the user reference changes
653
654
  * No need for deep equal because we already check it internally
654
- * @param authState
655
+ * @param authState AuthState object
655
656
  */
656
657
  FronteggUserSubscriptionService.prototype.updateUserStateIfNeeded = function (authState) {
657
658
  var userState = authState.user;
@@ -703,7 +704,7 @@
703
704
  this.authStateSubject = new rxjs.BehaviorSubject({ isAuthenticated: false, isLoading: true });
704
705
  this.acceptInvitationStateSubject = new rxjs.BehaviorSubject({});
705
706
  this.accountSettingsStateSubject = new rxjs.BehaviorSubject({});
706
- this.activateStateSubject = new rxjs.BehaviorSubject({});
707
+ this.activateAccountStateSubject = new rxjs.BehaviorSubject({});
707
708
  this.apiTokensStateSubject = new rxjs.BehaviorSubject({});
708
709
  this.forgotPasswordStateSubject = new rxjs.BehaviorSubject({});
709
710
  this.loginStateSubject = new rxjs.BehaviorSubject({});
@@ -722,6 +723,30 @@
722
723
  this.isLoadingSubject = new rxjs.BehaviorSubject(true);
723
724
  this.isSSOAuthSubject = new rxjs.BehaviorSubject(false);
724
725
  this.ssoACSSubject = new rxjs.BehaviorSubject('');
726
+ this.customLoginStateSubject = new rxjs.BehaviorSubject({});
727
+ this.groupsStateSubject = new rxjs.BehaviorSubject({});
728
+ this.groupsDialogsStateSubject = new rxjs.BehaviorSubject({});
729
+ this.impersonateStateSubject = new rxjs.BehaviorSubject({});
730
+ this.allAccountsStateSubject = new rxjs.BehaviorSubject({});
731
+ this.allAccountsDialogsStateSubject = new rxjs.BehaviorSubject({});
732
+ this.passkeysStateSubject = new rxjs.BehaviorSubject({});
733
+ this.provisioningStateSubject = new rxjs.BehaviorSubject({});
734
+ this.resetPhoneNumberStateSubject = new rxjs.BehaviorSubject({});
735
+ this.restrictionsStateSubject = new rxjs.BehaviorSubject({});
736
+ this.securityCenterStateSubject = new rxjs.BehaviorSubject({});
737
+ this.sessionsPolicyStateSubject = new rxjs.BehaviorSubject({});
738
+ this.sessionsStateSubject = new rxjs.BehaviorSubject({});
739
+ this.smsStateSubject = new rxjs.BehaviorSubject({});
740
+ this.stepUpStateSubject = new rxjs.BehaviorSubject({});
741
+ this.applicationsStateSubject = new rxjs.BehaviorSubject({});
742
+ this.userIpSubject = new rxjs.BehaviorSubject(undefined);
743
+ this.keepSessionAliveSubject = new rxjs.BehaviorSubject(undefined);
744
+ this.socialLoginOptionsSubject = new rxjs.BehaviorSubject(undefined);
745
+ this.includeQueryParamSubject = new rxjs.BehaviorSubject(undefined);
746
+ this.hostedLoginBoxSubject = new rxjs.BehaviorSubject(undefined);
747
+ this.disableSilentRefreshSubject = new rxjs.BehaviorSubject(undefined);
748
+ this.enforceRedirectToSameSiteSubject = new rxjs.BehaviorSubject(undefined);
749
+ this.allowedRedirectOriginsSubject = new rxjs.BehaviorSubject(undefined);
725
750
  /**
726
751
  * Triggers step up flow
727
752
  * @param options.maxAge optional max age
@@ -878,7 +903,7 @@
878
903
  var authSubStates = [
879
904
  { field: 'acceptInvitationState', subject: this.acceptInvitationStateSubject },
880
905
  { field: 'accountSettingsState', subject: this.accountSettingsStateSubject },
881
- { field: 'activateState', subject: this.activateStateSubject },
906
+ { field: 'activateAccountState', subject: this.activateAccountStateSubject },
882
907
  { field: 'apiTokensState', subject: this.apiTokensStateSubject },
883
908
  { field: 'forgotPasswordState', subject: this.forgotPasswordStateSubject },
884
909
  { field: 'tenantsState', subject: this.tenantsStateSubject },
@@ -895,14 +920,39 @@
895
920
  { field: 'user', subject: this.userSubject },
896
921
  { field: 'isSSOAuth', subject: this.isSSOAuthSubject },
897
922
  { field: 'ssoACS', subject: this.ssoACSSubject },
923
+ { field: 'customLoginState', subject: this.customLoginStateSubject },
924
+ { field: 'groupsState', subject: this.groupsStateSubject },
925
+ { field: 'groupsDialogsState', subject: this.groupsDialogsStateSubject },
926
+ { field: 'impersonateState', subject: this.impersonateStateSubject },
927
+ { field: 'allAccountsState', subject: this.allAccountsStateSubject },
928
+ { field: 'allAccountsDialogsState', subject: this.allAccountsDialogsStateSubject },
929
+ { field: 'passkeysState', subject: this.passkeysStateSubject },
930
+ { field: 'provisioningState', subject: this.provisioningStateSubject },
931
+ { field: 'resetPhoneNumberState', subject: this.resetPhoneNumberStateSubject },
932
+ { field: 'restrictionsState', subject: this.restrictionsStateSubject },
933
+ { field: 'securityCenterState', subject: this.securityCenterStateSubject },
934
+ { field: 'sessionsPolicyState', subject: this.sessionsPolicyStateSubject },
935
+ { field: 'sessionsState', subject: this.sessionsStateSubject },
936
+ { field: 'smsState', subject: this.smsStateSubject },
937
+ { field: 'stepUpState', subject: this.stepUpStateSubject },
938
+ { field: 'applicationsState', subject: this.applicationsStateSubject },
939
+ { field: 'userIp', subject: this.userIpSubject },
940
+ { field: 'keepSessionAlive', subject: this.keepSessionAliveSubject },
941
+ { field: 'socialLoginOptions', subject: this.socialLoginOptionsSubject },
942
+ { field: 'includeQueryParam', subject: this.includeQueryParamSubject },
943
+ { field: 'hostedLoginBox', subject: this.hostedLoginBoxSubject },
944
+ { field: 'disableSilentRefresh', subject: this.disableSilentRefreshSubject },
945
+ { field: 'enforceRedirectToSameSite', subject: this.enforceRedirectToSameSiteSubject },
946
+ { field: 'allowedRedirectOrigins', subject: this.allowedRedirectOriginsSubject },
898
947
  ];
899
948
  var state = this.fronteggAppService.fronteggApp.store.getState();
900
949
  this.updateState(state.auth, authSubStates);
901
- // Memoized Auth State
902
- this.fronteggAppService.fronteggApp.store.subscribe(function () {
950
+ var callback = function (op) {
903
951
  var newState = _this.fronteggAppService.fronteggApp.store.getState();
904
952
  _this.updateState(newState.auth, authSubStates);
905
- });
953
+ // this.updateDeepState(op);
954
+ };
955
+ this.fronteggAppService.fronteggApp.store.subscribe(callback);
906
956
  }
907
957
  FronteggAuthService.prototype.getAuthState = function () {
908
958
  return this.fronteggAppService.fronteggApp.store.getState().auth;
@@ -930,7 +980,7 @@
930
980
  });
931
981
  Object.defineProperty(FronteggAuthService.prototype, "activateState$", {
932
982
  get: function () {
933
- return this.activateStateSubject.asObservable();
983
+ return this.activateAccountStateSubject.asObservable();
934
984
  },
935
985
  enumerable: false,
936
986
  configurable: true
@@ -1075,6 +1125,189 @@
1075
1125
  enumerable: false,
1076
1126
  configurable: true
1077
1127
  });
1128
+ Object.defineProperty(FronteggAuthService.prototype, "customLoginStateSubject$", {
1129
+ get: function () {
1130
+ return this.customLoginStateSubject.asObservable();
1131
+ },
1132
+ enumerable: false,
1133
+ configurable: true
1134
+ });
1135
+ Object.defineProperty(FronteggAuthService.prototype, "groupsStateSubject$", {
1136
+ get: function () {
1137
+ return this.groupsStateSubject.asObservable();
1138
+ },
1139
+ enumerable: false,
1140
+ configurable: true
1141
+ });
1142
+ Object.defineProperty(FronteggAuthService.prototype, "groupsDialogsStateSubject$", {
1143
+ get: function () {
1144
+ return this.groupsDialogsStateSubject.asObservable();
1145
+ },
1146
+ enumerable: false,
1147
+ configurable: true
1148
+ });
1149
+ Object.defineProperty(FronteggAuthService.prototype, "impersonateStateSubject$", {
1150
+ get: function () {
1151
+ return this.impersonateStateSubject.asObservable();
1152
+ },
1153
+ enumerable: false,
1154
+ configurable: true
1155
+ });
1156
+ Object.defineProperty(FronteggAuthService.prototype, "allAccountsStateSubject$", {
1157
+ get: function () {
1158
+ return this.allAccountsStateSubject.asObservable();
1159
+ },
1160
+ enumerable: false,
1161
+ configurable: true
1162
+ });
1163
+ Object.defineProperty(FronteggAuthService.prototype, "allAccountsDialogsStateSubject$", {
1164
+ get: function () {
1165
+ return this.allAccountsDialogsStateSubject.asObservable();
1166
+ },
1167
+ enumerable: false,
1168
+ configurable: true
1169
+ });
1170
+ Object.defineProperty(FronteggAuthService.prototype, "passkeysStateSubject$", {
1171
+ get: function () {
1172
+ return this.passkeysStateSubject.asObservable();
1173
+ },
1174
+ enumerable: false,
1175
+ configurable: true
1176
+ });
1177
+ Object.defineProperty(FronteggAuthService.prototype, "provisioningStateSubject$", {
1178
+ get: function () {
1179
+ return this.provisioningStateSubject.asObservable();
1180
+ },
1181
+ enumerable: false,
1182
+ configurable: true
1183
+ });
1184
+ Object.defineProperty(FronteggAuthService.prototype, "resetPhoneNumberStateSubject$", {
1185
+ get: function () {
1186
+ return this.resetPhoneNumberStateSubject.asObservable();
1187
+ },
1188
+ enumerable: false,
1189
+ configurable: true
1190
+ });
1191
+ Object.defineProperty(FronteggAuthService.prototype, "restrictionsStateSubject$", {
1192
+ get: function () {
1193
+ return this.restrictionsStateSubject.asObservable();
1194
+ },
1195
+ enumerable: false,
1196
+ configurable: true
1197
+ });
1198
+ Object.defineProperty(FronteggAuthService.prototype, "securityCenterStateSubject$", {
1199
+ get: function () {
1200
+ return this.securityCenterStateSubject.asObservable();
1201
+ },
1202
+ enumerable: false,
1203
+ configurable: true
1204
+ });
1205
+ Object.defineProperty(FronteggAuthService.prototype, "sessionsPolicyStateSubject$", {
1206
+ get: function () {
1207
+ return this.sessionsPolicyStateSubject.asObservable();
1208
+ },
1209
+ enumerable: false,
1210
+ configurable: true
1211
+ });
1212
+ Object.defineProperty(FronteggAuthService.prototype, "sessionsStateSubject$", {
1213
+ get: function () {
1214
+ return this.sessionsStateSubject.asObservable();
1215
+ },
1216
+ enumerable: false,
1217
+ configurable: true
1218
+ });
1219
+ Object.defineProperty(FronteggAuthService.prototype, "smsStateSubject$", {
1220
+ get: function () {
1221
+ return this.smsStateSubject.asObservable();
1222
+ },
1223
+ enumerable: false,
1224
+ configurable: true
1225
+ });
1226
+ Object.defineProperty(FronteggAuthService.prototype, "stepUpStateSubject$", {
1227
+ get: function () {
1228
+ return this.stepUpStateSubject.asObservable();
1229
+ },
1230
+ enumerable: false,
1231
+ configurable: true
1232
+ });
1233
+ Object.defineProperty(FronteggAuthService.prototype, "applicationsStateSubject$", {
1234
+ get: function () {
1235
+ return this.applicationsStateSubject.asObservable();
1236
+ },
1237
+ enumerable: false,
1238
+ configurable: true
1239
+ });
1240
+ Object.defineProperty(FronteggAuthService.prototype, "userIpSubject$", {
1241
+ get: function () {
1242
+ return this.userIpSubject.asObservable();
1243
+ },
1244
+ enumerable: false,
1245
+ configurable: true
1246
+ });
1247
+ Object.defineProperty(FronteggAuthService.prototype, "keepSessionAliveSubject$", {
1248
+ get: function () {
1249
+ return this.keepSessionAliveSubject.asObservable();
1250
+ },
1251
+ enumerable: false,
1252
+ configurable: true
1253
+ });
1254
+ Object.defineProperty(FronteggAuthService.prototype, "socialLoginOptionsSubject$", {
1255
+ get: function () {
1256
+ return this.socialLoginOptionsSubject.asObservable();
1257
+ },
1258
+ enumerable: false,
1259
+ configurable: true
1260
+ });
1261
+ Object.defineProperty(FronteggAuthService.prototype, "includeQueryParamSubject$", {
1262
+ get: function () {
1263
+ return this.includeQueryParamSubject.asObservable();
1264
+ },
1265
+ enumerable: false,
1266
+ configurable: true
1267
+ });
1268
+ Object.defineProperty(FronteggAuthService.prototype, "hostedLoginBoxSubject$", {
1269
+ get: function () {
1270
+ return this.hostedLoginBoxSubject.asObservable();
1271
+ },
1272
+ enumerable: false,
1273
+ configurable: true
1274
+ });
1275
+ Object.defineProperty(FronteggAuthService.prototype, "disableSilentRefreshSubject$", {
1276
+ get: function () {
1277
+ return this.disableSilentRefreshSubject.asObservable();
1278
+ },
1279
+ enumerable: false,
1280
+ configurable: true
1281
+ });
1282
+ Object.defineProperty(FronteggAuthService.prototype, "enforceRedirectToSameSiteSubject$", {
1283
+ get: function () {
1284
+ return this.enforceRedirectToSameSiteSubject.asObservable();
1285
+ },
1286
+ enumerable: false,
1287
+ configurable: true
1288
+ });
1289
+ Object.defineProperty(FronteggAuthService.prototype, "allowedRedirectOriginsSubject$", {
1290
+ get: function () {
1291
+ return this.allowedRedirectOriginsSubject.asObservable();
1292
+ },
1293
+ enumerable: false,
1294
+ configurable: true
1295
+ });
1296
+ // // tslint:disable-next-line:typedef
1297
+ // private updateDeepState(ops: Op[]) {
1298
+ // ops.filter(op => op[0] === 'set').forEach((op) => {
1299
+ // const [ action, path, value ] = op;
1300
+ // const state = path[0];
1301
+ // const subState = path[1];
1302
+ // const deepPath = path.slice(2);
1303
+ // console.log(state, subState, deepPath, value);
1304
+ // switch (state) {
1305
+ // case 'auth':
1306
+ // if(this.authStateSubject.value )
1307
+ // break;
1308
+ // }
1309
+ // });
1310
+ // }
1078
1311
  FronteggAuthService.prototype.updateState = function (authState, authSubStates) {
1079
1312
  var e_1, _a;
1080
1313
  if (this.authStateSubject.value !== authState) {
@@ -1105,7 +1338,7 @@
1105
1338
  FronteggAuthService.prototype.dispatchAction = function (type, payload) {
1106
1339
  var store = this.fronteggAppService.fronteggApp.store;
1107
1340
  // @ts-ignore
1108
- store.dispatch({ type: reduxStore.authStoreName + "/" + type, payload: payload });
1341
+ store.dispatch({ type: authStoreName + "/" + type, payload: payload });
1109
1342
  };
1110
1343
  FronteggAuthService.prototype.isHostedLoginCallbackRoute = function () {
1111
1344
  var path = this.fronteggAppService.router.url;
@@ -1217,11 +1450,11 @@
1217
1450
  this.templateRef = templateRef;
1218
1451
  this.viewContainer = viewContainer;
1219
1452
  this.fronteggAuthService = fronteggAuthService;
1220
- this._roles = [];
1453
+ this.roles = [];
1221
1454
  }
1222
1455
  Object.defineProperty(AuthorizedContentDirective.prototype, "authorizedContent", {
1223
1456
  set: function (roles) {
1224
- this._roles = roles;
1457
+ this.roles = roles;
1225
1458
  },
1226
1459
  enumerable: false,
1227
1460
  configurable: true
@@ -1230,7 +1463,7 @@
1230
1463
  var _this = this;
1231
1464
  this.fronteggAuthService.user$.subscribe(function (user) {
1232
1465
  var _a;
1233
- if ((_a = user === null || user === void 0 ? void 0 : user.roles) === null || _a === void 0 ? void 0 : _a.some(function (role) { return _this._roles.includes(role.name); })) {
1466
+ if ((_a = user === null || user === void 0 ? void 0 : user.roles) === null || _a === void 0 ? void 0 : _a.some(function (role) { return _this.roles.includes(role.name); })) {
1234
1467
  _this.viewContainer.createEmbeddedView(_this.templateRef);
1235
1468
  }
1236
1469
  else {
@@ -1324,7 +1557,7 @@
1324
1557
  FronteggSubscriptionService.prototype.dispatchAction = function (type, payload) {
1325
1558
  var store = this.fronteggAppService.fronteggApp.store;
1326
1559
  // @ts-ignore
1327
- store.dispatch({ type: reduxStore.subscriptionsStoreName + "/" + type, payload: payload });
1560
+ store.dispatch({ type: subscriptionsStoreName + "/" + type, payload: payload });
1328
1561
  };
1329
1562
  return FronteggSubscriptionService;
1330
1563
  }());
@@ -1349,7 +1582,7 @@
1349
1582
  this.fronteggUserSubscriptionService = fronteggUserSubscriptionService;
1350
1583
  }
1351
1584
  /**
1352
- * @param feature
1585
+ * @param feature featureKey
1353
1586
  * @param observer For receiving the feature entitlements result including if the user is entitled to the given feature.
1354
1587
  * Attaching the justification if not entitled
1355
1588
  * @param customAttributes consumer attributes
@@ -1359,7 +1592,7 @@
1359
1592
  FronteggEntitlementsService.prototype.featureEntitlements$ = function (feature, observer, customAttributes) {
1360
1593
  var _this = this;
1361
1594
  return this.fronteggUserSubscriptionService.getUserManipulatorSubscription(function (user) {
1362
- // the entitlemenets-common npm doesn't know to overcome the case of signed out user, then we get console errors
1595
+ // the entitlemenets-common npm doesn't know to overcome the case of signed out user, then we get console errors
1363
1596
  if (user) {
1364
1597
  return _this.fronteggAppService.fronteggApp.getFeatureEntitlements(feature, customAttributes);
1365
1598
  }
@@ -1367,7 +1600,7 @@
1367
1600
  }, observer);
1368
1601
  };
1369
1602
  /**
1370
- * @param permission
1603
+ * @param permission permission key
1371
1604
  * @param observer For receiving the permission entitlements result including if the user is entitled to the given permission.
1372
1605
  * Attaching the justification if not entitled
1373
1606
  * @param customAttributes consumer attributes
@@ -1395,7 +1628,8 @@
1395
1628
  if (user) {
1396
1629
  return _this.fronteggAppService.fronteggApp.getEntitlements(options, customAttributes);
1397
1630
  }
1398
- var justification = 'featureKey' in options ? restApi.NotEntitledJustification.MISSING_FEATURE : restApi.NotEntitledJustification.MISSING_PERMISSION;
1631
+ var justification = 'featureKey' in options ?
1632
+ restApi.NotEntitledJustification.MISSING_FEATURE : restApi.NotEntitledJustification.MISSING_PERMISSION;
1399
1633
  return { isEntitled: false, justification: justification };
1400
1634
  }, observer);
1401
1635
  };