@aemforms/af-core 0.22.126 → 0.22.127
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/esm/afb-runtime.js
CHANGED
|
@@ -3318,6 +3318,67 @@ class FunctionRuntimeImpl {
|
|
|
3318
3318
|
return encData;
|
|
3319
3319
|
},
|
|
3320
3320
|
_signature: []
|
|
3321
|
+
},
|
|
3322
|
+
getQueryParameter: {
|
|
3323
|
+
_func: (args, data, interpreter) => {
|
|
3324
|
+
const param = toString(args[0]);
|
|
3325
|
+
if (!param) {
|
|
3326
|
+
interpreter.globals.form.logger.error('Argument is missing in getQueryParameter. A parameter is expected');
|
|
3327
|
+
return '';
|
|
3328
|
+
}
|
|
3329
|
+
if (interpreter.globals.form?.properties?.queryParams?.[param]) {
|
|
3330
|
+
return interpreter.globals.form.properties.queryParams[param];
|
|
3331
|
+
}
|
|
3332
|
+
try {
|
|
3333
|
+
const urlParams = new URLSearchParams(window?.location?.search || '');
|
|
3334
|
+
return urlParams.get(param);
|
|
3335
|
+
}
|
|
3336
|
+
catch (e) {
|
|
3337
|
+
interpreter.globals.form.logger.warn('Error reading URL parameters:', e);
|
|
3338
|
+
}
|
|
3339
|
+
return '';
|
|
3340
|
+
},
|
|
3341
|
+
_signature: []
|
|
3342
|
+
},
|
|
3343
|
+
getBrowserDetail: {
|
|
3344
|
+
_func: (args, data, interpreter) => {
|
|
3345
|
+
const param = toString(args[0]);
|
|
3346
|
+
if (!param) {
|
|
3347
|
+
interpreter.globals.form.logger.error('Argument is missing in getBrowserDetail. A parameter is expected');
|
|
3348
|
+
return '';
|
|
3349
|
+
}
|
|
3350
|
+
if (interpreter.globals.form?.properties?.browserDetails?.[param]) {
|
|
3351
|
+
return interpreter.globals.form.properties.browserDetails[param];
|
|
3352
|
+
}
|
|
3353
|
+
if (typeof navigator !== 'undefined' && param in navigator) {
|
|
3354
|
+
return navigator[param] || '';
|
|
3355
|
+
}
|
|
3356
|
+
else {
|
|
3357
|
+
interpreter.globals.form.logger.warn(`Invalid or unsupported browser detail requested: "${param}"`);
|
|
3358
|
+
return '';
|
|
3359
|
+
}
|
|
3360
|
+
},
|
|
3361
|
+
_signature: []
|
|
3362
|
+
},
|
|
3363
|
+
getURLDetail: {
|
|
3364
|
+
_func: (args, data, interpreter) => {
|
|
3365
|
+
const param = toString(args[0]);
|
|
3366
|
+
if (!param) {
|
|
3367
|
+
interpreter.globals.form.logger.error('Argument is missing in getURLDetail. A parameter is expected');
|
|
3368
|
+
return '';
|
|
3369
|
+
}
|
|
3370
|
+
if (interpreter.globals.form?.properties?.urlDetails?.[param]) {
|
|
3371
|
+
return interpreter.globals.form.properties.urlDetails[param];
|
|
3372
|
+
}
|
|
3373
|
+
if (typeof window !== 'undefined' && typeof window.location !== 'undefined' && param in window.location) {
|
|
3374
|
+
return window.location[param] || '';
|
|
3375
|
+
}
|
|
3376
|
+
else {
|
|
3377
|
+
interpreter.globals.form.logger.warn(`Invalid or unsupported url parameter requested: "${param}"`);
|
|
3378
|
+
return '';
|
|
3379
|
+
}
|
|
3380
|
+
},
|
|
3381
|
+
_signature: []
|
|
3321
3382
|
}
|
|
3322
3383
|
};
|
|
3323
3384
|
return { ...defaultFunctions, ...FunctionRuntimeImpl.getInstance().customFunctions };
|
|
@@ -83,6 +83,18 @@ declare class FunctionRuntimeImpl {
|
|
|
83
83
|
_func: (args: Array<unknown>, data: unknown, interpreter: any) => Promise<any>;
|
|
84
84
|
_signature: never[];
|
|
85
85
|
};
|
|
86
|
+
getQueryParameter: {
|
|
87
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
88
|
+
_signature: never[];
|
|
89
|
+
};
|
|
90
|
+
getBrowserDetail: {
|
|
91
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
92
|
+
_signature: never[];
|
|
93
|
+
};
|
|
94
|
+
getURLDetail: {
|
|
95
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
96
|
+
_signature: never[];
|
|
97
|
+
};
|
|
86
98
|
};
|
|
87
99
|
}
|
|
88
100
|
export declare const FunctionRuntime: FunctionRuntimeImpl;
|
|
@@ -83,6 +83,18 @@ declare class FunctionRuntimeImpl {
|
|
|
83
83
|
_func: (args: Array<unknown>, data: unknown, interpreter: any) => Promise<any>;
|
|
84
84
|
_signature: never[];
|
|
85
85
|
};
|
|
86
|
+
getQueryParameter: {
|
|
87
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
88
|
+
_signature: never[];
|
|
89
|
+
};
|
|
90
|
+
getBrowserDetail: {
|
|
91
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
92
|
+
_signature: never[];
|
|
93
|
+
};
|
|
94
|
+
getURLDetail: {
|
|
95
|
+
_func: (args: Array<unknown>, data: unknown, interpreter: any) => any;
|
|
96
|
+
_signature: never[];
|
|
97
|
+
};
|
|
86
98
|
};
|
|
87
99
|
}
|
|
88
100
|
export declare const FunctionRuntime: FunctionRuntimeImpl;
|
|
@@ -668,6 +668,70 @@ class FunctionRuntimeImpl {
|
|
|
668
668
|
return encData;
|
|
669
669
|
}),
|
|
670
670
|
_signature: []
|
|
671
|
+
},
|
|
672
|
+
getQueryParameter: {
|
|
673
|
+
_func: (args, data, interpreter) => {
|
|
674
|
+
var _a, _b, _c, _d;
|
|
675
|
+
const param = toString(args[0]);
|
|
676
|
+
if (!param) {
|
|
677
|
+
interpreter.globals.form.logger.error('Argument is missing in getQueryParameter. A parameter is expected');
|
|
678
|
+
return '';
|
|
679
|
+
}
|
|
680
|
+
if ((_c = (_b = (_a = interpreter.globals.form) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.queryParams) === null || _c === void 0 ? void 0 : _c[param]) {
|
|
681
|
+
return interpreter.globals.form.properties.queryParams[param];
|
|
682
|
+
}
|
|
683
|
+
try {
|
|
684
|
+
const urlParams = new URLSearchParams(((_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.search) || '');
|
|
685
|
+
return urlParams.get(param);
|
|
686
|
+
}
|
|
687
|
+
catch (e) {
|
|
688
|
+
interpreter.globals.form.logger.warn('Error reading URL parameters:', e);
|
|
689
|
+
}
|
|
690
|
+
return '';
|
|
691
|
+
},
|
|
692
|
+
_signature: []
|
|
693
|
+
},
|
|
694
|
+
getBrowserDetail: {
|
|
695
|
+
_func: (args, data, interpreter) => {
|
|
696
|
+
var _a, _b, _c;
|
|
697
|
+
const param = toString(args[0]);
|
|
698
|
+
if (!param) {
|
|
699
|
+
interpreter.globals.form.logger.error('Argument is missing in getBrowserDetail. A parameter is expected');
|
|
700
|
+
return '';
|
|
701
|
+
}
|
|
702
|
+
if ((_c = (_b = (_a = interpreter.globals.form) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.browserDetails) === null || _c === void 0 ? void 0 : _c[param]) {
|
|
703
|
+
return interpreter.globals.form.properties.browserDetails[param];
|
|
704
|
+
}
|
|
705
|
+
if (typeof navigator !== 'undefined' && param in navigator) {
|
|
706
|
+
return navigator[param] || '';
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
interpreter.globals.form.logger.warn(`Invalid or unsupported browser detail requested: "${param}"`);
|
|
710
|
+
return '';
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
_signature: []
|
|
714
|
+
},
|
|
715
|
+
getURLDetail: {
|
|
716
|
+
_func: (args, data, interpreter) => {
|
|
717
|
+
var _a, _b, _c;
|
|
718
|
+
const param = toString(args[0]);
|
|
719
|
+
if (!param) {
|
|
720
|
+
interpreter.globals.form.logger.error('Argument is missing in getURLDetail. A parameter is expected');
|
|
721
|
+
return '';
|
|
722
|
+
}
|
|
723
|
+
if ((_c = (_b = (_a = interpreter.globals.form) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.urlDetails) === null || _c === void 0 ? void 0 : _c[param]) {
|
|
724
|
+
return interpreter.globals.form.properties.urlDetails[param];
|
|
725
|
+
}
|
|
726
|
+
if (typeof window !== 'undefined' && typeof window.location !== 'undefined' && param in window.location) {
|
|
727
|
+
return window.location[param] || '';
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
interpreter.globals.form.logger.warn(`Invalid or unsupported url parameter requested: "${param}"`);
|
|
731
|
+
return '';
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
_signature: []
|
|
671
735
|
}
|
|
672
736
|
};
|
|
673
737
|
return Object.assign(Object.assign({}, defaultFunctions), FunctionRuntimeImpl.getInstance().customFunctions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.127",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adobe/json-formula": "0.1.50",
|
|
40
|
-
"@aemforms/af-formatters": "^0.22.
|
|
40
|
+
"@aemforms/af-formatters": "^0.22.127"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|