@bringg/dashboard-sdk 9.92.0-pre.0 → 9.92.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.
@@ -3433,19 +3433,6 @@ var BringgDashboardSDK = /** @class */ (function () {
3433
3433
  });
3434
3434
  });
3435
3435
  };
3436
- BringgDashboardSDK.prototype.getSamlSignOutUrl = function () {
3437
- return this.session.getSamlSignOutUrl();
3438
- };
3439
- BringgDashboardSDK.prototype.samlSignOut = function () {
3440
- return __awaiter(this, void 0, void 0, function () {
3441
- return __generator(this, function (_a) {
3442
- switch (_a.label) {
3443
- case 0: return [4 /*yield*/, this.session.samlSignOut()];
3444
- case 1: return [2 /*return*/, _a.sent()];
3445
- }
3446
- });
3447
- });
3448
- };
3449
3436
  BringgDashboardSDK.resendConfirmationEmail = function (params) {
3450
3437
  return __awaiter(this, void 0, void 0, function () {
3451
3438
  var authService, email, password, merchant_uuid, recaptchaToken, recaptcha_qa_token;
@@ -22847,7 +22834,24 @@ var ServiceAreaApi = /** @class */ (function () {
22847
22834
  case 0: return [4 /*yield*/, this.serviceAreaService.getAllByFields(request)];
22848
22835
  case 1:
22849
22836
  res = _a.sent();
22850
- return [2 /*return*/, res.success ? res.service_areas : []];
22837
+ return [2 /*return*/, res.service_areas];
22838
+ }
22839
+ });
22840
+ });
22841
+ };
22842
+ /**
22843
+ * Loads every service area the user may see in the merchant, with only the requested fields.
22844
+ * The rows are not written into the data store, so `get` and `getAll` keep holding full areas only.
22845
+ */
22846
+ ServiceAreaApi.prototype.loadAllByFields = function (fields) {
22847
+ return __awaiter(this, void 0, void 0, function () {
22848
+ var res;
22849
+ return __generator(this, function (_a) {
22850
+ switch (_a.label) {
22851
+ case 0: return [4 /*yield*/, this.serviceAreaService.getAllByFields({ fields: fields })];
22852
+ case 1:
22853
+ res = _a.sent();
22854
+ return [2 /*return*/, res.service_areas];
22851
22855
  }
22852
22856
  });
22853
22857
  });
@@ -23021,7 +23025,11 @@ var ServiceAreaService = /** @class */ (function () {
23021
23025
  ServiceAreaService.prototype.getAllByFields = function (request) {
23022
23026
  return __awaiter(this, void 0, void 0, function () {
23023
23027
  return __generator(this, function (_a) {
23024
- return [2 /*return*/, this.service.routeGenerator.post("/".concat(this.service.entityName, "/fields")).withPayload(request).invoke()];
23028
+ return [2 /*return*/, this.service.routeGenerator
23029
+ .post("/".concat(this.service.entityName, "/fields"))
23030
+ .withPayload(request)
23031
+ .setException('Failed to get service areas by fields')
23032
+ .invoke()];
23025
23033
  });
23026
23034
  });
23027
23035
  };
@@ -23376,7 +23384,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23376
23384
  return (mod && mod.__esModule) ? mod : { "default": mod };
23377
23385
  };
23378
23386
  Object.defineProperty(exports, "__esModule", ({ value: true }));
23379
- exports.SAML_SIGN_OUT_ROUTE = exports.SEND_OTP_MAIL_ROUTE = exports.OTP_CREATE_TOKEN_ROUTE = exports.RESEND_CONFIRMATION_EMAIL_ROUTE = exports.UNWIND_ROUTE = exports.IMPERSONATE_BY_TEAM_ROUTE = exports.IMPERSONATE_ROUTE = exports.SWITCH_ROUTE = exports.LOGOUT_ROUTE = exports.GET_USER_ROUTE = exports.CREATE_TOKEN_ONE_TIME_CODE_ROUTE = exports.CREATE_TOKEN_ROUTE = void 0;
23387
+ exports.SEND_OTP_MAIL_ROUTE = exports.OTP_CREATE_TOKEN_ROUTE = exports.RESEND_CONFIRMATION_EMAIL_ROUTE = exports.UNWIND_ROUTE = exports.IMPERSONATE_BY_TEAM_ROUTE = exports.IMPERSONATE_ROUTE = exports.SWITCH_ROUTE = exports.LOGOUT_ROUTE = exports.GET_USER_ROUTE = exports.CREATE_TOKEN_ONE_TIME_CODE_ROUTE = exports.CREATE_TOKEN_ROUTE = void 0;
23380
23388
  var lodash_1 = __webpack_require__(96486);
23381
23389
  var sha1_1 = __importDefault(__webpack_require__(18738));
23382
23390
  var BringgDashboardSDK_1 = __webpack_require__(5655);
@@ -23398,7 +23406,6 @@ exports.UNWIND_ROUTE = new Route_1.Route('/tokens/unwind_impersonate', 1 /* Http
23398
23406
  exports.RESEND_CONFIRMATION_EMAIL_ROUTE = new Route_1.Route('/tokens/resend_confirmation_email', 1 /* HttpMethod.POST */);
23399
23407
  exports.OTP_CREATE_TOKEN_ROUTE = new Route_1.Route('/otp', 1 /* HttpMethod.POST */);
23400
23408
  exports.SEND_OTP_MAIL_ROUTE = new Route_1.Route('/otp/send', 1 /* HttpMethod.POST */);
23401
- exports.SAML_SIGN_OUT_ROUTE = new Route_1.Route('/users/saml/idp_sign_out', 0 /* HttpMethod.GET */);
23402
23409
  var AuthService = /** @class */ (function () {
23403
23410
  function AuthService(clientId, endpoint) {
23404
23411
  this.clientId = clientId;
@@ -23565,32 +23572,6 @@ var AuthService = /** @class */ (function () {
23565
23572
  });
23566
23573
  });
23567
23574
  };
23568
- AuthService.prototype.getSamlSignOutUrl = function (authToken, merchantUuid) {
23569
- var query = new URLSearchParams({ merchant_uuid: merchantUuid, token: authToken });
23570
- return "".concat(this.endpoint.encode()).concat(exports.SAML_SIGN_OUT_ROUTE.uri, "?").concat(query);
23571
- };
23572
- AuthService.prototype.samlSignOut = function (authToken, merchantUuid) {
23573
- return __awaiter(this, void 0, void 0, function () {
23574
- return __generator(this, function (_a) {
23575
- switch (_a.label) {
23576
- case 0: return [4 /*yield*/, new ServiceRequest_1.AnonymousServiceRequest(this.clientId)
23577
- .invoke(this.endpoint, exports.SAML_SIGN_OUT_ROUTE, null, {
23578
- merchant_uuid: merchantUuid,
23579
- token: authToken
23580
- })
23581
- .handle(function (response) {
23582
- var data = response.data, status = response.status;
23583
- if (status !== Enums_1.HttpStatusCode.OK) {
23584
- (0, ServiceRequest_1.logErrorResponse)(response);
23585
- throw new BringgException_1.BringgException(ExceptionReason_1.ExceptionReason.fromHttpStatusCode(status), 'Unable to sign out of SAML');
23586
- }
23587
- return data === null || data === void 0 ? void 0 : data.redirect_url;
23588
- })];
23589
- case 1: return [2 /*return*/, _a.sent()];
23590
- }
23591
- });
23592
- });
23593
- };
23594
23575
  AuthService.prototype.switchAccounts = function (authToken) {
23595
23576
  return __awaiter(this, void 0, void 0, function () {
23596
23577
  return __generator(this, function (_a) {
@@ -24080,47 +24061,6 @@ var Session = /** @class */ (function () {
24080
24061
  });
24081
24062
  });
24082
24063
  };
24083
- /**
24084
- * Whether the user signed in through SAML, read from the `aut` claim of the authentication token.
24085
- * @returns false when the token cannot be read
24086
- */
24087
- Session.prototype.isSamlUser = function () {
24088
- try {
24089
- var payload = this.user.authentication_token.split('.')[1];
24090
- return JSON.parse(atob(payload.replace(/-/g, '+').replace(/_/g, '/'))).aut === 'saml';
24091
- }
24092
- catch (_a) {
24093
- return false;
24094
- }
24095
- };
24096
- /**
24097
- * Url that signs a SAML user out of the identity provider when the browser navigates to it.
24098
- * @returns undefined for users who did not sign in through SAML, or before the merchant is loaded
24099
- */
24100
- Session.prototype.getSamlSignOutUrl = function () {
24101
- var _a;
24102
- if (!this.isSamlUser() || !((_a = this.merchant) === null || _a === void 0 ? void 0 : _a.uuid)) {
24103
- return undefined;
24104
- }
24105
- return AuthService_1.default.init(this.user.region).getSamlSignOutUrl(this.user.authentication_token, this.merchant.uuid);
24106
- };
24107
- /**
24108
- * Signs a SAML user out of the identity provider and returns where to send the browser next.
24109
- * Only for users with `sso_logout_redirect_on_frontend`; without it the server answers with a redirect,
24110
- * so navigate to `getSamlSignOutUrl()` instead.
24111
- * @returns the url to send the browser to, or undefined when the server has none
24112
- * @throws {BringgException} When the server rejects the token
24113
- */
24114
- Session.prototype.samlSignOut = function () {
24115
- return __awaiter(this, void 0, void 0, function () {
24116
- return __generator(this, function (_a) {
24117
- switch (_a.label) {
24118
- case 0: return [4 /*yield*/, AuthService_1.default.init(this.user.region).samlSignOut(this.user.authentication_token, this.merchant.uuid)];
24119
- case 1: return [2 /*return*/, _a.sent()];
24120
- }
24121
- });
24122
- });
24123
- };
24124
24064
  Session.prototype.switchAccounts = function () {
24125
24065
  return __awaiter(this, void 0, void 0, function () {
24126
24066
  var _a, _b;
@@ -24865,7 +24805,7 @@ var BringgException_1 = __webpack_require__(43605);
24865
24805
  var client_page_1 = __webpack_require__(16573);
24866
24806
  var Logger_1 = __importDefault(__webpack_require__(55860));
24867
24807
  var abort_1 = __webpack_require__(34179);
24868
- var version = '9.92.0-pre.0';
24808
+ var version = '9.92.0';
24869
24809
  function logErrorResponse(response) {
24870
24810
  var data = response.data, status = response.status;
24871
24811
  try {