kwikid-forms 0.6.34 → 0.6.36
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.
- package/bundles/kwikid-forms.umd.js +38 -51
- package/bundles/kwikid-forms.umd.js.map +1 -1
- package/esm2015/lib/renderer/config-converter/config-converter.helper.js +11 -7
- package/esm2015/lib/renderer/form-view/definitions/form-view.apis.definition.js +1 -1
- package/esm2015/lib/renderer/form-view/definitions/form-view.fields.definition.js +1 -1
- package/esm2015/lib/renderer/form-view/form-view.api.service.js +1 -19
- package/esm2015/lib/renderer/form-view/form-view.component.js +24 -24
- package/esm2015/lib/renderer/form-view/helpers/form-view.apis.helper.js +1 -1
- package/esm2015/lib/renderer/form-view/helpers/form-view.defaults.helper.js +1 -1
- package/esm2015/lib/renderer/form-view/helpers/form-view.fields.helper.js +2 -2
- package/fesm2015/kwikid-forms.js +34 -47
- package/fesm2015/kwikid-forms.js.map +1 -1
- package/lib/renderer/form-view/definitions/form-view.apis.definition.d.ts +7 -7
- package/lib/renderer/form-view/definitions/form-view.fields.definition.d.ts +2 -2
- package/lib/renderer/form-view/helpers/form-view.apis.helper.d.ts +2 -2
- package/lib/renderer/form-view/helpers/form-view.fields.helper.d.ts +1 -1
- package/package.json +3 -3
package/fesm2015/kwikid-forms.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __awaiter } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { EventEmitter, Component, Input, Output, ChangeDetectionStrategy, Pipe, Inject, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
4
|
-
import { checkObjectKeyExists, setValueToObjectPath, isEmptyValue, getObjectDeepCopy, logMethod, isNotEmptyValue, setMissingKeyValue, isObject, mergeObjects, checkObjectPathExists, getObjectValueFromPath, getObjectFromLocalStorage, encryptWithAES, decryptWithAES, Source, Rule, Condition, Action, PATTERNS, hasWhitespacesOnly,
|
|
4
|
+
import { checkObjectKeyExists, setValueToObjectPath, isEmptyValue, getObjectDeepCopy, logMethod, isNotEmptyValue, setMissingKeyValue, isObject, mergeObjects, checkObjectPathExists, getObjectValueFromPath, getObjectFromLocalStorage, encryptWithAES, decryptWithAES, Source, Rule, Condition, Action, PATTERNS, hasWhitespacesOnly, RuleEngine, mergeObjectsDeep, ESourceKey, replaceString, isUndefined, isNull, isEmptyString } from 'kwikid-toolkit';
|
|
5
5
|
import * as i3 from 'kwikui';
|
|
6
6
|
import { KwikUIModule, KwikUIPipeModule, KwikUIInputEmailModule } from 'kwikui';
|
|
7
7
|
import * as i3$1 from '@angular/forms';
|
|
@@ -539,7 +539,7 @@ const removeFormFieldMessage = (field, message) => {
|
|
|
539
539
|
});
|
|
540
540
|
return field;
|
|
541
541
|
};
|
|
542
|
-
const setApiTimerMessage = (field, timer =
|
|
542
|
+
const setApiTimerMessage = (field, timer = {}) => {
|
|
543
543
|
if (checkObjectKeyExists(field, "api")) {
|
|
544
544
|
field["api"]["timer"] = timer;
|
|
545
545
|
}
|
|
@@ -843,21 +843,26 @@ const setFieldAsFormElement = (field, value) => {
|
|
|
843
843
|
};
|
|
844
844
|
const getMinDate = (field) => {
|
|
845
845
|
if (checkObjectKeyExists(field, "min")) {
|
|
846
|
+
/**
|
|
847
|
+
* This is to handler old version of config.
|
|
848
|
+
* Please don't add "min" at field level, add it insider field.properties only.
|
|
849
|
+
*/
|
|
846
850
|
return convertFormFieldTypeDateToKwikUIFormat(field["min"]);
|
|
847
851
|
}
|
|
848
852
|
else {
|
|
849
|
-
return
|
|
853
|
+
return {};
|
|
850
854
|
}
|
|
851
855
|
};
|
|
852
856
|
const getMaxDate = (field) => {
|
|
853
857
|
if (checkObjectKeyExists(field, "max")) {
|
|
858
|
+
/**
|
|
859
|
+
* This is to handler old version of config.
|
|
860
|
+
* Please don't add "max" at field level, add it insider field.properties only.
|
|
861
|
+
*/
|
|
854
862
|
return convertFormFieldTypeDateToKwikUIFormat(field["max"]);
|
|
855
863
|
}
|
|
856
864
|
else {
|
|
857
|
-
return
|
|
858
|
-
new Date().getMonth(), // Month - 11 (0 Indexing)
|
|
859
|
-
new Date().getDate() // Day - 31
|
|
860
|
-
);
|
|
865
|
+
return {};
|
|
861
866
|
}
|
|
862
867
|
};
|
|
863
868
|
const updateLanguage = (object, language) => {
|
|
@@ -2743,26 +2748,20 @@ class KwikIDFormViewApiService {
|
|
|
2743
2748
|
// Function to verify the signature
|
|
2744
2749
|
verifySignature(data, header, url, isVerifySignature) {
|
|
2745
2750
|
return new Promise((resolve, reject) => {
|
|
2746
|
-
// Log the function call for verification
|
|
2747
|
-
console.log("Verify Signature: Function Called For", url, header);
|
|
2748
2751
|
// Check if the signature is disabled
|
|
2749
2752
|
if (!isVerifySignature) {
|
|
2750
|
-
console.log("Verify Signature: Authentication Disabled");
|
|
2751
2753
|
resolve(true);
|
|
2752
2754
|
}
|
|
2753
2755
|
// Check if data is invalid
|
|
2754
2756
|
else if (!data) {
|
|
2755
|
-
console.log("Verify Signature: Data Not Available");
|
|
2756
2757
|
resolve(true);
|
|
2757
2758
|
}
|
|
2758
2759
|
// Check if the signature is missing in headers when authentication is not skipped
|
|
2759
2760
|
else if (isVerifySignature && header && !(header === null || header === void 0 ? void 0 : header.sig)) {
|
|
2760
|
-
console.log("Verify Signature Failure: Signature Not Present in Headers");
|
|
2761
2761
|
reject(false);
|
|
2762
2762
|
}
|
|
2763
2763
|
// Verify the signature when public key and header with signature are present and authentication is not skipped
|
|
2764
2764
|
else if (isVerifySignature && header && (header === null || header === void 0 ? void 0 : header.sig)) {
|
|
2765
|
-
console.log("Verify Signature: Signature Present in Headers");
|
|
2766
2765
|
// Extract the signature and decode it
|
|
2767
2766
|
let signature = header.sig.split(".")[0];
|
|
2768
2767
|
let rawSignature = atob(signature);
|
|
@@ -2777,30 +2776,22 @@ class KwikIDFormViewApiService {
|
|
|
2777
2776
|
let dateCheck = dateValue < parseInt(exp);
|
|
2778
2777
|
// Check if the signature matches the data
|
|
2779
2778
|
let res = signature === data;
|
|
2780
|
-
console.log("Verify Signature: Matching", signature, data);
|
|
2781
|
-
console.log("Verify Signature: Time", dateValue, parseInt(exp), parseInt(exp) - dateValue);
|
|
2782
|
-
console.log("Verify Signature: Date", new Date(dateValue), new Date(parseInt(exp)));
|
|
2783
|
-
console.log("Verify Signature: Signature Converted to Required Format");
|
|
2784
2779
|
// Resolve the promise if the signature is valid and the date check passes
|
|
2785
2780
|
if (res && dateCheck) {
|
|
2786
|
-
console.log("Verify Signature Success");
|
|
2787
2781
|
resolve(res);
|
|
2788
2782
|
}
|
|
2789
2783
|
else {
|
|
2790
2784
|
// Reject the promise if the signature is invalid or the date check fails
|
|
2791
|
-
console.log("Verify Signature Failure: Signature did not match");
|
|
2792
2785
|
reject(res);
|
|
2793
2786
|
}
|
|
2794
2787
|
}
|
|
2795
2788
|
else {
|
|
2796
2789
|
// Reject the promise if the signature is not in the required format
|
|
2797
|
-
console.log("Verify Signature Failure: Signature Not Converted to Required Format");
|
|
2798
2790
|
reject(false);
|
|
2799
2791
|
}
|
|
2800
2792
|
}
|
|
2801
2793
|
else {
|
|
2802
2794
|
// Resolve the promise if the signature is missing in headers
|
|
2803
|
-
console.log("Verify Signature Failure: Signature Not Present in Headers");
|
|
2804
2795
|
resolve(true);
|
|
2805
2796
|
}
|
|
2806
2797
|
});
|
|
@@ -2827,7 +2818,6 @@ class KwikIDFormViewApiService {
|
|
|
2827
2818
|
const encryptedResponse = data;
|
|
2828
2819
|
const decryptedResponse = yield decryptWithAES(encryptedResponse);
|
|
2829
2820
|
data = JSON.parse(decryptedResponse);
|
|
2830
|
-
console.log("Decrypted Response", data);
|
|
2831
2821
|
res.data = data;
|
|
2832
2822
|
}
|
|
2833
2823
|
// Verify signature and handle response
|
|
@@ -2847,7 +2837,6 @@ class KwikIDFormViewApiService {
|
|
|
2847
2837
|
const encryptedResponse = data;
|
|
2848
2838
|
const decryptedResponse = yield decryptWithAES(encryptedResponse);
|
|
2849
2839
|
data = JSON.parse(decryptedResponse);
|
|
2850
|
-
console.log("Decrypted Response", data);
|
|
2851
2840
|
err.response.data = data;
|
|
2852
2841
|
}
|
|
2853
2842
|
// Verify signature and handle response
|
|
@@ -2879,7 +2868,6 @@ class KwikIDFormViewApiService {
|
|
|
2879
2868
|
const encryptedResponse = data;
|
|
2880
2869
|
const decryptedResponse = yield decryptWithAES(encryptedResponse);
|
|
2881
2870
|
data = JSON.parse(decryptedResponse);
|
|
2882
|
-
console.log("Decrypted Response", data);
|
|
2883
2871
|
res.data = data;
|
|
2884
2872
|
}
|
|
2885
2873
|
// Verify signature and handle response
|
|
@@ -2899,7 +2887,6 @@ class KwikIDFormViewApiService {
|
|
|
2899
2887
|
const encryptedResponse = data;
|
|
2900
2888
|
const decryptedResponse = yield decryptWithAES(encryptedResponse);
|
|
2901
2889
|
data = JSON.parse(decryptedResponse);
|
|
2902
|
-
console.log("Decrypted Response", data);
|
|
2903
2890
|
err.response.data = data;
|
|
2904
2891
|
}
|
|
2905
2892
|
// Verify signature and handle response
|
|
@@ -3850,7 +3837,7 @@ class KwikIDFormViewComponent {
|
|
|
3850
3837
|
if (field.isFormElement &&
|
|
3851
3838
|
checkObjectKeyExists(field, "validation") &&
|
|
3852
3839
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
3853
|
-
const
|
|
3840
|
+
const ruleEngine = new RuleEngine({
|
|
3854
3841
|
FIELD_CONFIG: field,
|
|
3855
3842
|
FORM_FIELDS: this.formFields,
|
|
3856
3843
|
FORM_DATA: this.formData,
|
|
@@ -3859,7 +3846,7 @@ class KwikIDFormViewComponent {
|
|
|
3859
3846
|
ALL_FORMS_DATA: this.allFormsData
|
|
3860
3847
|
}, this.takeAction.bind(this));
|
|
3861
3848
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3862
|
-
yield
|
|
3849
|
+
yield ruleEngine.run(field.validation);
|
|
3863
3850
|
}))();
|
|
3864
3851
|
}
|
|
3865
3852
|
if (field.isFormElement &&
|
|
@@ -3909,7 +3896,7 @@ class KwikIDFormViewComponent {
|
|
|
3909
3896
|
if (field.isFormElement &&
|
|
3910
3897
|
checkObjectKeyExists(field, "validation") &&
|
|
3911
3898
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
3912
|
-
const
|
|
3899
|
+
const ruleEngine = new RuleEngine({
|
|
3913
3900
|
FIELD_CONFIG: field,
|
|
3914
3901
|
FORM_FIELDS: this.formFields,
|
|
3915
3902
|
FORM_DATA: this.formData,
|
|
@@ -3918,7 +3905,7 @@ class KwikIDFormViewComponent {
|
|
|
3918
3905
|
ALL_FORMS_DATA: this.allFormsData
|
|
3919
3906
|
}, this.takeAction.bind(this));
|
|
3920
3907
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3921
|
-
yield
|
|
3908
|
+
yield ruleEngine.run(field.validation);
|
|
3922
3909
|
}))();
|
|
3923
3910
|
}
|
|
3924
3911
|
if (field.isFormElement &&
|
|
@@ -3980,7 +3967,7 @@ class KwikIDFormViewComponent {
|
|
|
3980
3967
|
if (field.isFormElement &&
|
|
3981
3968
|
checkObjectKeyExists(field, "validation") &&
|
|
3982
3969
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
3983
|
-
const
|
|
3970
|
+
const ruleEngine = new RuleEngine({
|
|
3984
3971
|
FIELD_CONFIG: field,
|
|
3985
3972
|
FORM_FIELDS: this.formFields,
|
|
3986
3973
|
FORM_DATA: this.formData,
|
|
@@ -3989,7 +3976,7 @@ class KwikIDFormViewComponent {
|
|
|
3989
3976
|
ALL_FORMS_DATA: this.allFormsData
|
|
3990
3977
|
}, this.takeAction.bind(this));
|
|
3991
3978
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
3992
|
-
yield
|
|
3979
|
+
yield ruleEngine.run(field.validation);
|
|
3993
3980
|
}))();
|
|
3994
3981
|
}
|
|
3995
3982
|
if (field.isFormElement &&
|
|
@@ -4055,7 +4042,7 @@ class KwikIDFormViewComponent {
|
|
|
4055
4042
|
if (checkObjectKeyExists(field, "validation")) {
|
|
4056
4043
|
if (checkObjectKeyExists(field.validation, "triggers") &&
|
|
4057
4044
|
field.validation.triggers.includes("ON_RESPONSE")) {
|
|
4058
|
-
const
|
|
4045
|
+
const ruleEngine = new RuleEngine({
|
|
4059
4046
|
FIELD_CONFIG: field,
|
|
4060
4047
|
FORM_FIELDS: this.formFields,
|
|
4061
4048
|
FORM_DATA: this.formData,
|
|
@@ -4064,7 +4051,7 @@ class KwikIDFormViewComponent {
|
|
|
4064
4051
|
ALL_FORMS_DATA: this.allFormsData
|
|
4065
4052
|
}, this.takeAction.bind(this));
|
|
4066
4053
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
4067
|
-
yield
|
|
4054
|
+
yield ruleEngine.run(field.validation);
|
|
4068
4055
|
}))();
|
|
4069
4056
|
}
|
|
4070
4057
|
}
|
|
@@ -4193,7 +4180,7 @@ class KwikIDFormViewComponent {
|
|
|
4193
4180
|
if (field.isFormElement) {
|
|
4194
4181
|
if (checkObjectKeyExists(field, "validation")) {
|
|
4195
4182
|
if (field.validation.triggers.includes("ON_INIT")) {
|
|
4196
|
-
const
|
|
4183
|
+
const ruleEngine = new RuleEngine({
|
|
4197
4184
|
FIELD_CONFIG: field,
|
|
4198
4185
|
FORM_FIELDS: this.formFields,
|
|
4199
4186
|
FORM_DATA: this.formData,
|
|
@@ -4201,7 +4188,7 @@ class KwikIDFormViewComponent {
|
|
|
4201
4188
|
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
4202
4189
|
ALL_FORMS_DATA: this.allFormsData
|
|
4203
4190
|
}, this.takeAction.bind(this));
|
|
4204
|
-
yield
|
|
4191
|
+
yield ruleEngine.run(field.validation);
|
|
4205
4192
|
}
|
|
4206
4193
|
}
|
|
4207
4194
|
if (checkObjectKeyExists(field, "connectedElements")) {
|
|
@@ -4490,7 +4477,7 @@ class KwikIDFormViewComponent {
|
|
|
4490
4477
|
if (field.isFormElement &&
|
|
4491
4478
|
checkObjectKeyExists(field, "validation") &&
|
|
4492
4479
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
4493
|
-
const
|
|
4480
|
+
const ruleEngine = new RuleEngine({
|
|
4494
4481
|
FIELD_CONFIG: field,
|
|
4495
4482
|
FORM_FIELDS: this.formFields,
|
|
4496
4483
|
FORM_DATA: this.formData,
|
|
@@ -4499,7 +4486,7 @@ class KwikIDFormViewComponent {
|
|
|
4499
4486
|
ALL_FORMS_DATA: this.allFormsData
|
|
4500
4487
|
}, this.takeAction.bind(this));
|
|
4501
4488
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
4502
|
-
yield
|
|
4489
|
+
yield ruleEngine.run(field.validation);
|
|
4503
4490
|
}))();
|
|
4504
4491
|
}
|
|
4505
4492
|
if (field.isFormElement &&
|
|
@@ -4654,7 +4641,7 @@ class KwikIDFormViewComponent {
|
|
|
4654
4641
|
if (field.isFormElement &&
|
|
4655
4642
|
checkObjectKeyExists(field, "validation") &&
|
|
4656
4643
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
4657
|
-
const
|
|
4644
|
+
const ruleEngine = new RuleEngine({
|
|
4658
4645
|
FIELD_CONFIG: field,
|
|
4659
4646
|
FORM_FIELDS: this.formFields,
|
|
4660
4647
|
FORM_DATA: this.formData,
|
|
@@ -4663,7 +4650,7 @@ class KwikIDFormViewComponent {
|
|
|
4663
4650
|
ALL_FORMS_DATA: this.allFormsData
|
|
4664
4651
|
}, this.takeAction.bind(this));
|
|
4665
4652
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
4666
|
-
yield
|
|
4653
|
+
yield ruleEngine.run(field.validation);
|
|
4667
4654
|
}))();
|
|
4668
4655
|
}
|
|
4669
4656
|
if (field.isFormElement &&
|
|
@@ -4872,7 +4859,7 @@ class KwikIDFormViewComponent {
|
|
|
4872
4859
|
if (field.isFormElement &&
|
|
4873
4860
|
checkObjectKeyExists(field, "validation") &&
|
|
4874
4861
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
4875
|
-
const
|
|
4862
|
+
const ruleEngine = new RuleEngine({
|
|
4876
4863
|
FIELD_CONFIG: field,
|
|
4877
4864
|
FORM_FIELDS: this.formFields,
|
|
4878
4865
|
FORM_DATA: this.formData,
|
|
@@ -4881,7 +4868,7 @@ class KwikIDFormViewComponent {
|
|
|
4881
4868
|
ALL_FORMS_DATA: this.allFormsData
|
|
4882
4869
|
}, this.takeAction.bind(this));
|
|
4883
4870
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
4884
|
-
yield
|
|
4871
|
+
yield ruleEngine.run(field.validation);
|
|
4885
4872
|
}))();
|
|
4886
4873
|
}
|
|
4887
4874
|
if (field.isFormElement &&
|
|
@@ -4906,7 +4893,7 @@ class KwikIDFormViewComponent {
|
|
|
4906
4893
|
if (field.isFormElement &&
|
|
4907
4894
|
checkObjectKeyExists(field, "validation") &&
|
|
4908
4895
|
field.validation.triggers.includes("ON_CHANGE")) {
|
|
4909
|
-
const
|
|
4896
|
+
const ruleEngine = new RuleEngine({
|
|
4910
4897
|
FIELD_CONFIG: field,
|
|
4911
4898
|
FORM_FIELDS: this.formFields,
|
|
4912
4899
|
FORM_DATA: this.formData,
|
|
@@ -4915,7 +4902,7 @@ class KwikIDFormViewComponent {
|
|
|
4915
4902
|
ALL_FORMS_DATA: this.allFormsData
|
|
4916
4903
|
}, this.takeAction.bind(this));
|
|
4917
4904
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
4918
|
-
yield
|
|
4905
|
+
yield ruleEngine.run(field.validation);
|
|
4919
4906
|
}))();
|
|
4920
4907
|
}
|
|
4921
4908
|
if (field.isFormElement &&
|
|
@@ -5249,7 +5236,7 @@ class KwikIDFormViewComponent {
|
|
|
5249
5236
|
!field.hidden &&
|
|
5250
5237
|
checkObjectKeyExists(field, "validation") &&
|
|
5251
5238
|
field.validation.triggers.includes("ON_SAVE")) {
|
|
5252
|
-
const
|
|
5239
|
+
const ruleEngine = new RuleEngine({
|
|
5253
5240
|
FIELD_CONFIG: field,
|
|
5254
5241
|
FORM_FIELDS: this.formFields,
|
|
5255
5242
|
FORM_DATA: this.formData,
|
|
@@ -5257,7 +5244,7 @@ class KwikIDFormViewComponent {
|
|
|
5257
5244
|
PREVIOUS_FORM_DATA: this.previousFormData,
|
|
5258
5245
|
ALL_FORMS_DATA: this.allFormsData
|
|
5259
5246
|
}, this.takeAction.bind(this));
|
|
5260
|
-
yield
|
|
5247
|
+
yield ruleEngine.run(field.validation);
|
|
5261
5248
|
if (!field.validation.is_valid) {
|
|
5262
5249
|
this.toggleErrorNotification(true);
|
|
5263
5250
|
setTimeout(() => {
|
|
@@ -5641,7 +5628,7 @@ class KwikIDFormViewComponent {
|
|
|
5641
5628
|
if (field.isFormElement &&
|
|
5642
5629
|
checkObjectKeyExists(field, "validation") &&
|
|
5643
5630
|
field.validation.triggers.includes("ON_API_TIMER_STOP")) {
|
|
5644
|
-
const
|
|
5631
|
+
const ruleEngine = new RuleEngine({
|
|
5645
5632
|
FIELD_CONFIG: field,
|
|
5646
5633
|
FORM_FIELDS: this.formFields,
|
|
5647
5634
|
FORM_DATA: this.formData,
|
|
@@ -5650,7 +5637,7 @@ class KwikIDFormViewComponent {
|
|
|
5650
5637
|
ALL_FORMS_DATA: this.allFormsData
|
|
5651
5638
|
}, this.takeAction.bind(this));
|
|
5652
5639
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5653
|
-
yield
|
|
5640
|
+
yield ruleEngine.run(field.validation);
|
|
5654
5641
|
}))();
|
|
5655
5642
|
}
|
|
5656
5643
|
if (checkObjectKeyExists(field, "connectedElements")) {
|