@easyquery/enterprise 7.2.3 → 7.2.4-beta03

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 (39) hide show
  1. package/dist/browser/eq.enterprise.js +31879 -33488
  2. package/dist/browser/eq.enterprise.js.map +1 -1
  3. package/dist/browser/eq.enterprise.min.js +1 -10
  4. package/dist/browser/eq.enterprise.min.js.map +1 -1
  5. package/dist/bundles/easyquery.enterprise.js +8069 -8062
  6. package/dist/bundles/easyquery.enterprise.js.map +1 -1
  7. package/dist/bundles/easyquery.enterprise.min.js +1 -1
  8. package/dist/bundles/easyquery.enterprise.min.js.map +1 -1
  9. package/dist/lib/data/data_table_aggr_calculator.d.ts +47 -47
  10. package/dist/lib/data/data_table_aggr_calculator.js +163 -163
  11. package/dist/lib/data/eqs_aggr_calculator.d.ts +14 -14
  12. package/dist/lib/data/eqs_aggr_calculator.js +172 -172
  13. package/dist/lib/data/eqs_aggr_calculator.js.map +1 -1
  14. package/dist/lib/dm/model_ex.d.ts +9 -9
  15. package/dist/lib/dm/model_ex.js +151 -149
  16. package/dist/lib/dm/model_ex.js.map +1 -1
  17. package/dist/lib/extensions.d.ts +26 -26
  18. package/dist/lib/extensions.js +120 -120
  19. package/dist/lib/license/lc-dialog.d.ts +19 -19
  20. package/dist/lib/license/lc-dialog.js +310 -310
  21. package/dist/lib/license/lc-dialog.js.map +1 -1
  22. package/dist/lib/main/eqs_query_storage.d.ts +11 -11
  23. package/dist/lib/main/eqs_query_storage.js +105 -105
  24. package/dist/lib/public_api.d.ts +7 -7
  25. package/dist/lib/public_api.js +7 -7
  26. package/dist/lib/query/condition_ex.d.ts +14 -14
  27. package/dist/lib/query/condition_ex.js +97 -95
  28. package/dist/lib/query/condition_ex.js.map +1 -1
  29. package/dist/lib/query/query_column_ex.d.ts +13 -13
  30. package/dist/lib/query/query_column_ex.js +57 -55
  31. package/dist/lib/query/query_column_ex.js.map +1 -1
  32. package/dist/lib/query/query_ex.d.ts +15 -15
  33. package/dist/lib/query/query_ex.js +75 -73
  34. package/dist/lib/query/query_ex.js.map +1 -1
  35. package/dist/lib/utils/lcv.d.ts +4 -4
  36. package/dist/lib/utils/lcv.js +101 -101
  37. package/dist/lib/utils/lcv.js.map +1 -1
  38. package/package.json +16 -16
  39. package/webpack.config.js +8 -7
@@ -1,311 +1,311 @@
1
- import { HttpClient } from '@easydata/core';
2
- import { domel, DefaultDialogService } from '@easydata/ui';
3
- import { equtils } from '@easyquery/core';
4
- function strIsEmpty(str) {
5
- if (str) {
6
- return str.trim() === '';
7
- }
8
- else
9
- return true;
10
- }
11
- var baseLicApiUrl = 'https://korzh.com/api/license';
12
- //const baseLicApiUrl = 'https://localhost:44301/api/license';
13
- var eqVersion = '7.2';
14
- var LCDialog = /** @class */ (function () {
15
- function LCDialog(context) {
16
- this.http = new HttpClient();
17
- this.context = context;
18
- }
19
- LCDialog.prototype.show = function () {
20
- var _this = this;
21
- var dialogService = new DefaultDialogService();
22
- this.dialogSet = dialogService.createSet([
23
- {
24
- closable: false,
25
- cancelable: false,
26
- submitOnEnter: true,
27
- title: 'No license key for EasyQuery',
28
- body: this.buildStartPage(),
29
- submitButtonText: 'Submit',
30
- onInput: this.validateForm.bind(this),
31
- onSubmit: this.startPageOnSubmit.bind(this)
32
- },
33
- {
34
- closable: false,
35
- cancelable: false,
36
- submitOnEnter: true,
37
- title: 'Please check your inbox',
38
- body: this.buildCodePage(),
39
- submitButtonText: 'Get License Key',
40
- onInput: this.validateForm.bind(this),
41
- onSubmit: this.codePageOnSubmit.bind(this)
42
- },
43
- {
44
- closable: false,
45
- cancelable: false,
46
- submitable: false,
47
- title: 'Success',
48
- body: this.buildSuccessPage()
49
- },
50
- {
51
- closable: false,
52
- cancelable: false,
53
- submitable: false,
54
- title: 'Failure',
55
- body: this.buildFailurePage()
56
- },
57
- ]);
58
- var dialog1 = this.dialogSet.open(0);
59
- //dialog1.getRootElement();
60
- setTimeout(function () {
61
- _this.validateForm(dialog1);
62
- var emailInput = document.getElementById('eqAuthEmail');
63
- if (emailInput) {
64
- emailInput.focus();
65
- }
66
- }, 200);
67
- };
68
- LCDialog.prototype.isValidForm = function (form) {
69
- var emailInput = form.querySelector('#eqAuthEmail'); //form.querySelector('[name="email"]') as HTMLInputElement;
70
- if (emailInput) {
71
- return !strIsEmpty(emailInput.value) &&
72
- emailInput.value
73
- .toLowerCase()
74
- .match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
75
- }
76
- var codeInput = form.querySelector('#eqAuthCode'); //form.querySelector('[name="code"]') as HTMLInputElement;
77
- if (codeInput) {
78
- return !strIsEmpty(codeInput.value) &&
79
- !isNaN(+codeInput.value) &&
80
- codeInput.value == codeInput.value.trim() &&
81
- codeInput.value.length === 6;
82
- }
83
- return true;
84
- };
85
- LCDialog.prototype.validateForm = function (dialog) {
86
- var submitButton = dialog.getSubmitButtonElement();
87
- submitButton.disabled = !this.isValidForm(dialog.getRootElement());
88
- };
89
- LCDialog.prototype.addInputField = function (parentBuilder, inputOptions) {
90
- parentBuilder
91
- .addChild('label', function (b) { return b
92
- .attr('for', inputOptions.id)
93
- .addHtml(inputOptions.label + " " + (inputOptions.required ? '<sup style="color: red">*</sup>' : '') + ": "); })
94
- .addChild('input', function (b) {
95
- b.id(inputOptions.id);
96
- b.name(inputOptions.name || inputOptions.id);
97
- b.type(inputOptions.type || 'text');
98
- if (typeof (inputOptions.value) !== 'undefined') {
99
- b.value(inputOptions.value);
100
- }
101
- if (inputOptions.onInput) {
102
- b.on('input', inputOptions.onInput);
103
- }
104
- });
105
- };
106
- LCDialog.prototype.buildStartPage = function () {
107
- var form;
108
- var controlsPanelBuilder;
109
- var formBuilder = domel('div');
110
- formBuilder.addChild('div', function (b) { return b
111
- .html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div>' +
112
- '<div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>'); });
113
- formBuilder
114
- .addClass('kfrm-form')
115
- .addChild('div', function (b) {
116
- controlsPanelBuilder = b;
117
- b.addClass('kfrm-fields label-above');
118
- b.addClass('kfrm-break-20');
119
- });
120
- this.addInputField(controlsPanelBuilder, {
121
- id: 'eqAuthEmail',
122
- name: 'email',
123
- label: 'Email',
124
- required: true
125
- });
126
- this.addInputField(controlsPanelBuilder, {
127
- id: 'eqAuthName',
128
- name: 'contactName',
129
- label: 'Name (optional)',
130
- required: false
131
- });
132
- formBuilder.addChild('div', function (b) { return b
133
- .html('<div style="margin-top:20px;font-size:0.9em">* By clicking Submit, you agree with Korzh.com <a href="https://korzh.com/terms-of-use">Terms of use</a>' +
134
- ' and <a href="https://korzh.com/privacy">Privacy policy</a>.</div>' +
135
- '<div style="font-size:0.9em">You also agree to receive email messages from Korzh.com. This consent may be revoked at any time.</div>'); });
136
- form = formBuilder.toDOM();
137
- return form;
138
- };
139
- LCDialog.prototype.buildCodePage = function () {
140
- var form;
141
- var controlsPanelBuilder;
142
- var formBuilder = domel('div');
143
- formBuilder.addChild('div', function (b) { return b
144
- .html('<div style="font-size:1.2em">We sent a confirmation code to <strong>{{email}}</strong>.</div>' +
145
- '<div style="font-size:1.2em">Please find it in the email and enter to the text box below</div>'); });
146
- formBuilder
147
- .addClass('kfrm-form')
148
- .addChild('div', function (b) {
149
- controlsPanelBuilder = b;
150
- b.addClass('kfrm-fields label-above');
151
- b.addClass('kfrm-break-20');
152
- });
153
- this.addInputField(controlsPanelBuilder, {
154
- id: 'eqAuthCode',
155
- name: 'code',
156
- label: 'Confirmation code',
157
- required: true
158
- });
159
- formBuilder.addChild('div', function (b) { return b
160
- .html('<div style="margin-top:20px;font-size:0.9em">NB: Don\'t forget to check your SPAM folder ' +
161
- 'if the message does not arrive within the next 5 minutes, and mark it as "Not Spam" if it\'s found there.</div>'); });
162
- form = formBuilder.toDOM();
163
- return form.outerHTML;
164
- };
165
- LCDialog.prototype.buildSuccessPage = function () {
166
- var form;
167
- var formBuilder = domel('div');
168
- formBuilder.addChild('div', function (b) { return b
169
- .html('<div style="font-size:1.2em">You have successfully completed the registration process.</div>' +
170
- '<div style="font-size:1.2em">Please restart your web application to get the key applied.</div>'); });
171
- form = formBuilder.toDOM();
172
- return form;
173
- };
174
- LCDialog.prototype.buildFailurePage = function () {
175
- var form;
176
- var formBuilder = domel('div');
177
- formBuilder.addChild('div', function (b) { return b
178
- .html('{{message}}'); });
179
- form = formBuilder.toDOM();
180
- return form.outerHTML;
181
- };
182
- LCDialog.prototype.startPageOnSubmit = function (dlg) {
183
- var _this = this;
184
- var emailInput = document.getElementById('eqAuthEmail');
185
- var nameInput = document.getElementById('eqAuthName');
186
- var authEmail = emailInput.value;
187
- var authName = nameInput.value;
188
- dlg.disableButtons();
189
- this.http.post(equtils.combinePath(baseLicApiUrl, 'get-code'), {
190
- email: authEmail,
191
- name: authName,
192
- data: {
193
- ptag: this.context.backendInfo.type,
194
- apptype: this.context.backendInfo.subType,
195
- }
196
- }, { dataType: 'json' })
197
- .then(function (result) {
198
- if (result.status !== 0) {
199
- throw new Error(result.message);
200
- }
201
- var dlg = _this.dialogSet.openNext({ email: authEmail });
202
- setTimeout(function () {
203
- _this.validateForm(dlg);
204
- var codeInput = document.getElementById('eqAuthCode');
205
- if (codeInput) {
206
- codeInput.focus();
207
- }
208
- }, 200);
209
- })
210
- .catch(function (error) {
211
- dlg.showAlert(error.message, "error", true);
212
- dlg.enableButtons();
213
- });
214
- return false;
215
- };
216
- LCDialog.prototype.codePageOnSubmit = function (dlg) {
217
- var _this = this;
218
- var codeInput = document.getElementById('eqAuthCode');
219
- var authCode = codeInput.value;
220
- dlg.disableButtons();
221
- this.http.post(equtils.combinePath(baseLicApiUrl, 'get-key'), {
222
- token: authCode,
223
- ptag: this.context.backendInfo.type,
224
- version: eqVersion
225
- }, { dataType: 'json' })
226
- .then(function (result) {
227
- switch (result.status) {
228
- case 0:
229
- var url = equtils.combinePath(_this.context.getBaseEndpoint(), 'lck');
230
- _this.http.post(url, {
231
- version: eqVersion,
232
- key: result.key
233
- }, { dataType: 'json' })
234
- .then(function (_) { return _this.dialogSet.openNext(); });
235
- break;
236
- case 2:
237
- _this.dialogSet.open(3, {
238
- message: '<div style="font-size:1.2em">Your trial license for EasyQuery has expired.</div>' +
239
- '<div style="font-size:1.2em">Please <a href="https://korzh.com/support">contact us</a> if you want to extend the trial period.</div>'
240
- });
241
- break;
242
- case 3:
243
- _this.dialogSet.open(3, {
244
- message: '<div style="font-size:1.2em">Your purchased license for EasyQuery has expired.</div>' +
245
- '<div style="font-size:1.2em">You need to <a href="https://korzh.com/account">renew the subscription</a> to get a valid license.</div>'
246
- });
247
- break;
248
- default:
249
- throw new Error(result.message);
250
- }
251
- })
252
- .catch(function (error) {
253
- dlg.showAlert(error.message, "error", true);
254
- dlg.enableButtons();
255
- });
256
- return false;
257
- };
258
- return LCDialog;
259
- }());
260
- export { LCDialog };
261
- export function showNoLicenseAlert(lcv) {
262
- var title, body, buttonTitle, buttonUrl;
263
- switch (lcv.__kt) {
264
- case 1:
265
- title = 'EasyQuery trial has expired';
266
- body = "Your trial period for EasyQuery has expired. \n\tYou can send a request to <a href=\"https://korzh.com/account\">extend your trial</a> or <a href=\"https://korzh.com/easyquery/licensing\">buy a license</a> to get rid of all limitations.";
267
- buttonTitle = 'Buy a license';
268
- buttonUrl = 'https://korzh.com/easyquery/licensing';
269
- break;
270
- case -3:
271
- title = 'No license key for EasyQuery';
272
- body = "Please <a href=\"https://korzh.com/easyquery#get-started\">register for a trial</a> \n\tor <a href=\"https://korzh.com/easyquery/licensing\">purchase a license</a> to get a proper product key. <br />\n\tIf you already have a key, please follow <a href=\"https://korzh.com/easyquery/docs/getting-started/product-key\">this guide</a> to apply it.";
273
- buttonTitle = 'Register trial';
274
- buttonUrl = 'https://korzh.com/easyquery#get-started';
275
- break;
276
- default:
277
- title = "Invalid key for EasyQuery!";
278
- body = "The EasyQuery product key is either invalid or was issued for a different version of the library.\n The version you are using now is 7.2,\n\tso please <a href=\"https://korzh.com/account\">login to your account</a> to get a proper key for version 7.2.";
279
- buttonTitle = 'Get key';
280
- buttonUrl = 'https://korzh.com/account';
281
- break;
282
- }
283
- var ds = new DefaultDialogService();
284
- var dlg = ds.open({
285
- closable: false,
286
- cancelable: false,
287
- submitable: false,
288
- title: title,
289
- body: body
290
- });
291
- var footer = dlg.getRootElement().querySelector('footer');
292
- domel(footer)
293
- .removeClass('align-right')
294
- .setStyle('justify-content', 'center')
295
- .addChild('button', function (b) { return b
296
- .addClass('kfrm-button', 'is-info')
297
- .addText(buttonTitle)
298
- .on('click', function (e) {
299
- window.location.href = buttonUrl;
300
- }); });
301
- if (lcv.__kt == 1) {
302
- domel(footer)
303
- .addChild('button', function (b) { return b
304
- .addClass('kfrm-button')
305
- .addText('Extend trial')
306
- .on('click', function (e) {
307
- window.location.href = 'https://korzh.com/account';
308
- }); });
309
- }
310
- }
1
+ import { HttpClient } from '@easydata/core';
2
+ import { domel, DefaultDialogService } from '@easydata/ui';
3
+ import { equtils } from '@easyquery/core';
4
+ function strIsEmpty(str) {
5
+ if (str) {
6
+ return str.trim() === '';
7
+ }
8
+ else
9
+ return true;
10
+ }
11
+ var baseLicApiUrl = 'https://korzh.com/api/license';
12
+ //const baseLicApiUrl = 'https://localhost:44301/api/license';
13
+ var eqVersion = '7.2';
14
+ var LCDialog = /** @class */ (function () {
15
+ function LCDialog(context) {
16
+ this.http = new HttpClient();
17
+ this.context = context;
18
+ }
19
+ LCDialog.prototype.show = function () {
20
+ var _this = this;
21
+ var dialogService = new DefaultDialogService();
22
+ this.dialogSet = dialogService.createSet([
23
+ {
24
+ closable: false,
25
+ cancelable: false,
26
+ submitOnEnter: true,
27
+ title: 'No license key for EasyQuery',
28
+ body: this.buildStartPage(),
29
+ submitButtonText: 'Submit',
30
+ onInput: this.validateForm.bind(this),
31
+ onSubmit: this.startPageOnSubmit.bind(this)
32
+ },
33
+ {
34
+ closable: false,
35
+ cancelable: false,
36
+ submitOnEnter: true,
37
+ title: 'Please check your inbox',
38
+ body: this.buildCodePage(),
39
+ submitButtonText: 'Get License Key',
40
+ onInput: this.validateForm.bind(this),
41
+ onSubmit: this.codePageOnSubmit.bind(this)
42
+ },
43
+ {
44
+ closable: false,
45
+ cancelable: false,
46
+ submitable: false,
47
+ title: 'Success',
48
+ body: this.buildSuccessPage()
49
+ },
50
+ {
51
+ closable: false,
52
+ cancelable: false,
53
+ submitable: false,
54
+ title: 'Failure',
55
+ body: this.buildFailurePage()
56
+ },
57
+ ]);
58
+ var dialog1 = this.dialogSet.open(0);
59
+ //dialog1.getRootElement();
60
+ setTimeout(function () {
61
+ _this.validateForm(dialog1);
62
+ var emailInput = document.getElementById('eqAuthEmail');
63
+ if (emailInput) {
64
+ emailInput.focus();
65
+ }
66
+ }, 200);
67
+ };
68
+ LCDialog.prototype.isValidForm = function (form) {
69
+ var emailInput = form.querySelector('#eqAuthEmail'); //form.querySelector('[name="email"]') as HTMLInputElement;
70
+ if (emailInput) {
71
+ return !strIsEmpty(emailInput.value) &&
72
+ emailInput.value
73
+ .toLowerCase()
74
+ .match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
75
+ }
76
+ var codeInput = form.querySelector('#eqAuthCode'); //form.querySelector('[name="code"]') as HTMLInputElement;
77
+ if (codeInput) {
78
+ return !strIsEmpty(codeInput.value) &&
79
+ !isNaN(+codeInput.value) &&
80
+ codeInput.value == codeInput.value.trim() &&
81
+ codeInput.value.length === 6;
82
+ }
83
+ return true;
84
+ };
85
+ LCDialog.prototype.validateForm = function (dialog) {
86
+ var submitButton = dialog.getSubmitButtonElement();
87
+ submitButton.disabled = !this.isValidForm(dialog.getRootElement());
88
+ };
89
+ LCDialog.prototype.addInputField = function (parentBuilder, inputOptions) {
90
+ parentBuilder
91
+ .addChild('label', function (b) { return b
92
+ .attr('for', inputOptions.id)
93
+ .addHtml("".concat(inputOptions.label, " ").concat(inputOptions.required ? '<sup style="color: red">*</sup>' : '', ": ")); })
94
+ .addChild('input', function (b) {
95
+ b.id(inputOptions.id);
96
+ b.name(inputOptions.name || inputOptions.id);
97
+ b.type(inputOptions.type || 'text');
98
+ if (typeof (inputOptions.value) !== 'undefined') {
99
+ b.value(inputOptions.value);
100
+ }
101
+ if (inputOptions.onInput) {
102
+ b.on('input', inputOptions.onInput);
103
+ }
104
+ });
105
+ };
106
+ LCDialog.prototype.buildStartPage = function () {
107
+ var form;
108
+ var controlsPanelBuilder;
109
+ var formBuilder = domel('div');
110
+ formBuilder.addChild('div', function (b) { return b
111
+ .html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div>' +
112
+ '<div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>'); });
113
+ formBuilder
114
+ .addClass('kfrm-form')
115
+ .addChild('div', function (b) {
116
+ controlsPanelBuilder = b;
117
+ b.addClass('kfrm-fields label-above');
118
+ b.addClass('kfrm-break-20');
119
+ });
120
+ this.addInputField(controlsPanelBuilder, {
121
+ id: 'eqAuthEmail',
122
+ name: 'email',
123
+ label: 'Email',
124
+ required: true
125
+ });
126
+ this.addInputField(controlsPanelBuilder, {
127
+ id: 'eqAuthName',
128
+ name: 'contactName',
129
+ label: 'Name (optional)',
130
+ required: false
131
+ });
132
+ formBuilder.addChild('div', function (b) { return b
133
+ .html('<div style="margin-top:20px;font-size:0.9em">* By clicking Submit, you agree with Korzh.com <a href="https://korzh.com/terms-of-use">Terms of use</a>' +
134
+ ' and <a href="https://korzh.com/privacy">Privacy policy</a>.</div>' +
135
+ '<div style="font-size:0.9em">You also agree to receive email messages from Korzh.com. This consent may be revoked at any time.</div>'); });
136
+ form = formBuilder.toDOM();
137
+ return form;
138
+ };
139
+ LCDialog.prototype.buildCodePage = function () {
140
+ var form;
141
+ var controlsPanelBuilder;
142
+ var formBuilder = domel('div');
143
+ formBuilder.addChild('div', function (b) { return b
144
+ .html('<div style="font-size:1.2em">We sent a confirmation code to <strong>{{email}}</strong>.</div>' +
145
+ '<div style="font-size:1.2em">Please find it in the email and enter to the text box below</div>'); });
146
+ formBuilder
147
+ .addClass('kfrm-form')
148
+ .addChild('div', function (b) {
149
+ controlsPanelBuilder = b;
150
+ b.addClass('kfrm-fields label-above');
151
+ b.addClass('kfrm-break-20');
152
+ });
153
+ this.addInputField(controlsPanelBuilder, {
154
+ id: 'eqAuthCode',
155
+ name: 'code',
156
+ label: 'Confirmation code',
157
+ required: true
158
+ });
159
+ formBuilder.addChild('div', function (b) { return b
160
+ .html('<div style="margin-top:20px;font-size:0.9em">NB: Don\'t forget to check your SPAM folder ' +
161
+ 'if the message does not arrive within the next 5 minutes, and mark it as "Not Spam" if it\'s found there.</div>'); });
162
+ form = formBuilder.toDOM();
163
+ return form.outerHTML;
164
+ };
165
+ LCDialog.prototype.buildSuccessPage = function () {
166
+ var form;
167
+ var formBuilder = domel('div');
168
+ formBuilder.addChild('div', function (b) { return b
169
+ .html('<div style="font-size:1.2em">You have successfully completed the registration process.</div>' +
170
+ '<div style="font-size:1.2em">Please restart your web application to get the key applied.</div>'); });
171
+ form = formBuilder.toDOM();
172
+ return form;
173
+ };
174
+ LCDialog.prototype.buildFailurePage = function () {
175
+ var form;
176
+ var formBuilder = domel('div');
177
+ formBuilder.addChild('div', function (b) { return b
178
+ .html('{{message}}'); });
179
+ form = formBuilder.toDOM();
180
+ return form.outerHTML;
181
+ };
182
+ LCDialog.prototype.startPageOnSubmit = function (dlg) {
183
+ var _this = this;
184
+ var emailInput = document.getElementById('eqAuthEmail');
185
+ var nameInput = document.getElementById('eqAuthName');
186
+ var authEmail = emailInput.value;
187
+ var authName = nameInput.value;
188
+ dlg.disableButtons();
189
+ this.http.post(equtils.combinePath(baseLicApiUrl, 'get-code'), {
190
+ email: authEmail,
191
+ name: authName,
192
+ data: {
193
+ ptag: this.context.backendInfo.type,
194
+ apptype: this.context.backendInfo.subType,
195
+ }
196
+ }, { dataType: 'json' })
197
+ .then(function (result) {
198
+ if (result.status !== 0) {
199
+ throw new Error(result.message);
200
+ }
201
+ var dlg = _this.dialogSet.openNext({ email: authEmail });
202
+ setTimeout(function () {
203
+ _this.validateForm(dlg);
204
+ var codeInput = document.getElementById('eqAuthCode');
205
+ if (codeInput) {
206
+ codeInput.focus();
207
+ }
208
+ }, 200);
209
+ })
210
+ .catch(function (error) {
211
+ dlg.showAlert(error.message, "error", true);
212
+ dlg.enableButtons();
213
+ });
214
+ return false;
215
+ };
216
+ LCDialog.prototype.codePageOnSubmit = function (dlg) {
217
+ var _this = this;
218
+ var codeInput = document.getElementById('eqAuthCode');
219
+ var authCode = codeInput.value;
220
+ dlg.disableButtons();
221
+ this.http.post(equtils.combinePath(baseLicApiUrl, 'get-key'), {
222
+ token: authCode,
223
+ ptag: this.context.backendInfo.type,
224
+ version: eqVersion
225
+ }, { dataType: 'json' })
226
+ .then(function (result) {
227
+ switch (result.status) {
228
+ case 0:
229
+ var url = equtils.combinePath(_this.context.getBaseEndpoint(), 'lck');
230
+ _this.http.post(url, {
231
+ version: eqVersion,
232
+ key: result.key
233
+ }, { dataType: 'json' })
234
+ .then(function (_) { return _this.dialogSet.openNext(); });
235
+ break;
236
+ case 2:
237
+ _this.dialogSet.open(3, {
238
+ message: '<div style="font-size:1.2em">Your trial license for EasyQuery has expired.</div>' +
239
+ '<div style="font-size:1.2em">Please <a href="https://korzh.com/support">contact us</a> if you want to extend the trial period.</div>'
240
+ });
241
+ break;
242
+ case 3:
243
+ _this.dialogSet.open(3, {
244
+ message: '<div style="font-size:1.2em">Your purchased license for EasyQuery has expired.</div>' +
245
+ '<div style="font-size:1.2em">You need to <a href="https://korzh.com/account">renew the subscription</a> to get a valid license.</div>'
246
+ });
247
+ break;
248
+ default:
249
+ throw new Error(result.message);
250
+ }
251
+ })
252
+ .catch(function (error) {
253
+ dlg.showAlert(error.message, "error", true);
254
+ dlg.enableButtons();
255
+ });
256
+ return false;
257
+ };
258
+ return LCDialog;
259
+ }());
260
+ export { LCDialog };
261
+ export function showNoLicenseAlert(lcv) {
262
+ var title, body, buttonTitle, buttonUrl;
263
+ switch (lcv.__kt) {
264
+ case 1:
265
+ title = 'EasyQuery trial has expired';
266
+ body = "Your trial period for EasyQuery has expired. \n\tYou can send a request to <a href=\"https://korzh.com/account\">extend your trial</a> or <a href=\"https://korzh.com/easyquery/licensing\">buy a license</a> to get rid of all limitations.";
267
+ buttonTitle = 'Buy a license';
268
+ buttonUrl = 'https://korzh.com/easyquery/licensing';
269
+ break;
270
+ case -3:
271
+ title = 'No license key for EasyQuery';
272
+ body = "Please <a href=\"https://korzh.com/easyquery#get-started\">register for a trial</a> \n\tor <a href=\"https://korzh.com/easyquery/licensing\">purchase a license</a> to get a proper product key. <br />\n\tIf you already have a key, please follow <a href=\"https://korzh.com/easyquery/docs/getting-started/product-key\">this guide</a> to apply it.";
273
+ buttonTitle = 'Register trial';
274
+ buttonUrl = 'https://korzh.com/easyquery#get-started';
275
+ break;
276
+ default:
277
+ title = "Invalid key for EasyQuery!";
278
+ body = "The EasyQuery product key is either invalid or was issued for a different version of the library.\n The version you are using now is 7.2,\n\tso please <a href=\"https://korzh.com/account\">login to your account</a> to get a proper key for version 7.2.";
279
+ buttonTitle = 'Get key';
280
+ buttonUrl = 'https://korzh.com/account';
281
+ break;
282
+ }
283
+ var ds = new DefaultDialogService();
284
+ var dlg = ds.open({
285
+ closable: false,
286
+ cancelable: false,
287
+ submitable: false,
288
+ title: title,
289
+ body: body
290
+ });
291
+ var footer = dlg.getRootElement().querySelector('footer');
292
+ domel(footer)
293
+ .removeClass('align-right')
294
+ .setStyle('justify-content', 'center')
295
+ .addChild('button', function (b) { return b
296
+ .addClass('kfrm-button', 'is-info')
297
+ .addText(buttonTitle)
298
+ .on('click', function (e) {
299
+ window.location.href = buttonUrl;
300
+ }); });
301
+ if (lcv.__kt == 1) {
302
+ domel(footer)
303
+ .addChild('button', function (b) { return b
304
+ .addClass('kfrm-button')
305
+ .addText('Extend trial')
306
+ .on('click', function (e) {
307
+ window.location.href = 'https://korzh.com/account';
308
+ }); });
309
+ }
310
+ }
311
311
  //# sourceMappingURL=lc-dialog.js.map