@easyquery/enterprise 7.2.1-rc02 → 7.2.1-rc03

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * EasyQuery.JS Enterprise 7.2.1-rc02 (https://korzh.com/easyquery/javascript)
2
+ * EasyQuery.JS Enterprise 7.2.1-rc03 (https://korzh.com/easyquery/javascript)
3
3
  * Copyright 2022 Korzh.com. All rights reserved.
4
4
  *
5
5
  * EasyQuery.JS commercial licenses may be obtained at
@@ -2729,6 +2729,10 @@ var context_EqContext = /** @class */ (function () {
2729
2729
  this.loadQueryOnStart = false;
2730
2730
  this.useStoredQueryOnFetch = false;
2731
2731
  this.debugMode = false;
2732
+ this._backendInfo = {
2733
+ type: 'EQN-ANC',
2734
+ subType: 'asp-net-core-razor'
2735
+ };
2732
2736
  //----------- endpoint processing functions --------------
2733
2737
  this.endpointVarsRegex = /\{.*?\}/g;
2734
2738
  this.elasticPaging = false;
@@ -3032,6 +3036,13 @@ var context_EqContext = /** @class */ (function () {
3032
3036
  this.fireEvent('ready');
3033
3037
  }
3034
3038
  };
3039
+ Object.defineProperty(EqContext.prototype, "backendInfo", {
3040
+ get: function () {
3041
+ return this._backendInfo;
3042
+ },
3043
+ enumerable: true,
3044
+ configurable: true
3045
+ });
3035
3046
  /**
3036
3047
  * Sets endpoint for all EasyQuery actions. Should be called before `init` and
3037
3048
  * `useEnterprise` methods
@@ -3049,6 +3060,34 @@ var context_EqContext = /** @class */ (function () {
3049
3060
  this.baseEndpoint = endpoint;
3050
3061
  return this;
3051
3062
  };
3063
+ /**
3064
+ * Allows to specify the type of backend service.
3065
+ *
3066
+ * @param backendInfo - the structure that contains information about the app used on the backend
3067
+ * Possible values for `ptag` property: 'EQN-ANC' - ASP.NET Core or 'EQN-ASP' - for ASP.NET 4 backend
3068
+ */
3069
+ EqContext.prototype.useBackend = function (backendInfo) {
3070
+ if (backendInfo.type) {
3071
+ this._backendInfo.type = backendInfo.type;
3072
+ }
3073
+ if (backendInfo.subType) {
3074
+ this._backendInfo.subType = backendInfo.subType;
3075
+ }
3076
+ else {
3077
+ switch (this._backendInfo.type) {
3078
+ case 'EQN-ANC':
3079
+ this._backendInfo.subType = 'asp-net-core-razor';
3080
+ break;
3081
+ case 'EQN-ASP':
3082
+ this._backendInfo.subType = 'asp-net-4-mvc';
3083
+ break;
3084
+ default:
3085
+ this._backendInfo.subType = 'other';
3086
+ break;
3087
+ }
3088
+ }
3089
+ return this;
3090
+ };
3052
3091
  /**
3053
3092
  * Add a new widget to the context.
3054
3093
  * After that the widget will start to receive messages from other context components.
@@ -37967,8 +38006,8 @@ function strIsEmpty(str) {
37967
38006
  else
37968
38007
  return true;
37969
38008
  }
37970
- //const baseLicApiUrl = 'https://korzh.com/api/license';
37971
- var baseLicApiUrl = 'https://localhost:44301/api/license';
38009
+ var baseLicApiUrl = 'https://korzh.com/api/license';
38010
+ //const baseLicApiUrl = 'https://localhost:44301/api/license';
37972
38011
  var eqVersion = '7.2';
37973
38012
  var lc_dialog_LCDialog = /** @class */ (function () {
37974
38013
  function LCDialog(context) {
@@ -38149,8 +38188,8 @@ var lc_dialog_LCDialog = /** @class */ (function () {
38149
38188
  email: authEmail,
38150
38189
  name: authName,
38151
38190
  data: {
38152
- ptag: "EQN-ANC",
38153
- apptype: "aspnetcore-spa"
38191
+ ptag: this.context.backendInfo.type,
38192
+ apptype: this.context.backendInfo.subType,
38154
38193
  }
38155
38194
  }, { dataType: 'json' })
38156
38195
  .then(function (result) {
@@ -38179,7 +38218,7 @@ var lc_dialog_LCDialog = /** @class */ (function () {
38179
38218
  dlg.disableButtons();
38180
38219
  this.http.post(public_api["equtils"].combinePath(baseLicApiUrl, 'get-key'), {
38181
38220
  token: authCode,
38182
- ptag: "eqn-anc",
38221
+ ptag: this.context.backendInfo.type,
38183
38222
  version: eqVersion
38184
38223
  }, { dataType: 'json' })
38185
38224
  .then(function (result) {
@@ -38260,14 +38299,29 @@ public_api["EqContext"].prototype.useEnterprise = function (keyOrInitCallback) {
38260
38299
  func(keyOrInitCallback);
38261
38300
  }
38262
38301
  else if (typeof (keyOrInitCallback) === "function") {
38263
- var http = this.getServices().getHttpClient();
38264
- var url = public_api["equtils"].combinePath(this.getBaseEndpoint(), 'lck');
38265
- http.get(url)
38266
- .then(function (result) { func(result.split("").reverse().join("")); keyOrInitCallback(); })
38267
- .catch(function (error) { return _this.throwError({
38268
- action: "LCK",
38269
- sourceError: error
38270
- }); });
38302
+ var http_1 = this.getServices().getHttpClient();
38303
+ var url_1 = public_api["equtils"].combinePath(this.getBaseEndpoint(), 'lck2');
38304
+ http_1.get(url_1)
38305
+ .then(function (result) {
38306
+ func(result.key.split("").reverse().join(""));
38307
+ _this.useBackend({
38308
+ type: result.backendType,
38309
+ subType: result.appType
38310
+ });
38311
+ keyOrInitCallback();
38312
+ })
38313
+ .catch(function (error) {
38314
+ url_1 = public_api["equtils"].combinePath(_this.getBaseEndpoint(), 'lck');
38315
+ http_1.get(url_1)
38316
+ .then(function (result) {
38317
+ func(result.split("").reverse().join(""));
38318
+ keyOrInitCallback();
38319
+ })
38320
+ .catch(function (error) { return _this.throwError({
38321
+ action: "LCK",
38322
+ sourceError: error
38323
+ }); });
38324
+ });
38271
38325
  }
38272
38326
  else {
38273
38327
  throw new Error("Wrong type of 'keyOrInitCallback' parameter. It must be a string with a license key or a callback function.");