@aemforms/af-core 0.22.88 → 0.22.89
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 +25 -2
- package/esm/types/src/Captcha.d.ts +13 -2
- package/esm/types/src/types/Json.d.ts +6 -0
- package/esm/types/src/types/Model.d.ts +9 -0
- package/lib/Captcha.d.ts +13 -2
- package/lib/Captcha.js +15 -0
- package/lib/rules/FunctionRuntime.js +5 -4
- package/lib/types/Json.d.ts +6 -0
- package/lib/types/Model.d.ts +9 -0
- package/lib/types/Model.js +6 -1
- package/package.json +2 -2
package/esm/afb-runtime.js
CHANGED
|
@@ -81,6 +81,11 @@ var FocusOption;
|
|
|
81
81
|
FocusOption["NEXT_ITEM"] = "nextItem";
|
|
82
82
|
FocusOption["PREVIOUS_ITEM"] = "previousItem";
|
|
83
83
|
})(FocusOption || (FocusOption = {}));
|
|
84
|
+
var CaptchaDisplayMode;
|
|
85
|
+
(function (CaptchaDisplayMode) {
|
|
86
|
+
CaptchaDisplayMode["INVISIBLE"] = "invisible";
|
|
87
|
+
CaptchaDisplayMode["VISIBLE"] = "visible";
|
|
88
|
+
})(CaptchaDisplayMode || (CaptchaDisplayMode = {}));
|
|
84
89
|
|
|
85
90
|
const objToMap = (o) => new Map(Object.entries(o));
|
|
86
91
|
const stringViewTypes = objToMap({ 'date': 'date-input', 'data-url': 'file-input', 'binary': 'file-input' });
|
|
@@ -2837,8 +2842,8 @@ class FunctionRuntimeImpl {
|
|
|
2837
2842
|
validate_form = args.length > 4 ? valueOf(args[4]) : true;
|
|
2838
2843
|
}
|
|
2839
2844
|
const form = interpreter.globals.form;
|
|
2840
|
-
if (form.captcha && form.captcha.
|
|
2841
|
-
&& form.captcha.properties['fd:captcha']
|
|
2845
|
+
if (form.captcha && (form.captcha.captchaDisplayMode === CaptchaDisplayMode.INVISIBLE ||
|
|
2846
|
+
(form.captcha.properties['fd:captcha']?.config?.version === 'enterprise' && form.captcha.properties['fd:captcha']?.config?.keyType === 'score'))) {
|
|
2842
2847
|
if (typeof interpreter.runtime.functionTable.fetchCaptchaToken?._func !== 'function') {
|
|
2843
2848
|
interpreter.globals.form.logger.error('fetchCaptchaToken is not defined');
|
|
2844
2849
|
interpreter.globals.form.dispatch(new SubmitError({ type: 'FetchCaptchaTokenNotDefined' }));
|
|
@@ -4492,12 +4497,30 @@ class EmailInput extends Field {
|
|
|
4492
4497
|
}
|
|
4493
4498
|
|
|
4494
4499
|
class Captcha extends Field {
|
|
4500
|
+
_captchaDisplayMode;
|
|
4501
|
+
_captchaProvider;
|
|
4502
|
+
_captchaSiteKey;
|
|
4503
|
+
constructor(params, _options) {
|
|
4504
|
+
super(params, _options);
|
|
4505
|
+
this._captchaDisplayMode = params.captchaDisplayMode;
|
|
4506
|
+
this._captchaProvider = params.captchaProvider;
|
|
4507
|
+
this._captchaSiteKey = params.siteKey;
|
|
4508
|
+
}
|
|
4495
4509
|
getDataNode() {
|
|
4496
4510
|
return undefined;
|
|
4497
4511
|
}
|
|
4498
4512
|
custom_setProperty(action) {
|
|
4499
4513
|
this.applyUpdates(action.payload);
|
|
4500
4514
|
}
|
|
4515
|
+
get captchaDisplayMode() {
|
|
4516
|
+
return this._captchaDisplayMode;
|
|
4517
|
+
}
|
|
4518
|
+
get captchaProvider() {
|
|
4519
|
+
return this._captchaProvider;
|
|
4520
|
+
}
|
|
4521
|
+
get captchaSiteKey() {
|
|
4522
|
+
return this._captchaSiteKey;
|
|
4523
|
+
}
|
|
4501
4524
|
}
|
|
4502
4525
|
|
|
4503
4526
|
class Button extends Field {
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import Field from './Field';
|
|
2
|
-
import { Action } from './types';
|
|
3
|
-
declare class Captcha extends Field {
|
|
2
|
+
import { Action, CaptchaDisplayMode, CaptchaJson, CaptchaModel, ContainerModel, FormModel } from './types';
|
|
3
|
+
declare class Captcha extends Field implements CaptchaModel {
|
|
4
|
+
private _captchaDisplayMode;
|
|
5
|
+
private _captchaProvider;
|
|
6
|
+
private _captchaSiteKey;
|
|
7
|
+
constructor(params: CaptchaJson, _options: {
|
|
8
|
+
form: FormModel;
|
|
9
|
+
parent: ContainerModel;
|
|
10
|
+
mode?: 'create' | 'restore';
|
|
11
|
+
});
|
|
4
12
|
getDataNode(): undefined;
|
|
5
13
|
custom_setProperty(action: Action): void;
|
|
14
|
+
get captchaDisplayMode(): CaptchaDisplayMode | undefined;
|
|
15
|
+
get captchaProvider(): string | undefined;
|
|
16
|
+
get captchaSiteKey(): string | undefined;
|
|
6
17
|
}
|
|
7
18
|
export default Captcha;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CaptchaDisplayMode } from './Model';
|
|
1
2
|
export type Items<T> = {
|
|
2
3
|
[key: string]: T;
|
|
3
4
|
};
|
|
@@ -100,6 +101,11 @@ export type FieldJson = BaseJson & TranslationFieldJson & {
|
|
|
100
101
|
emptyValue?: 'null' | 'undefined' | '';
|
|
101
102
|
checked?: boolean;
|
|
102
103
|
};
|
|
104
|
+
export type CaptchaJson = FieldJson & {
|
|
105
|
+
captchaDisplayMode?: CaptchaDisplayMode | undefined;
|
|
106
|
+
captchaProvider?: string | undefined;
|
|
107
|
+
siteKey?: string | undefined;
|
|
108
|
+
};
|
|
103
109
|
export type ContainerJson = BaseJson & {
|
|
104
110
|
items: Array<FieldJson | ContainerJson>;
|
|
105
111
|
initialItems?: number;
|
|
@@ -83,6 +83,11 @@ export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJ
|
|
|
83
83
|
readonly displayValueExpression?: string;
|
|
84
84
|
readonly editValue?: string;
|
|
85
85
|
}
|
|
86
|
+
export interface CaptchaModel extends FieldModel {
|
|
87
|
+
captchaDisplayMode: CaptchaDisplayMode | undefined;
|
|
88
|
+
captchaProvider: string | undefined;
|
|
89
|
+
captchaSiteKey: string | undefined;
|
|
90
|
+
}
|
|
86
91
|
export interface FormMetaDataModel {
|
|
87
92
|
readonly version?: string;
|
|
88
93
|
readonly grammar: string;
|
|
@@ -144,4 +149,8 @@ export declare enum FocusOption {
|
|
|
144
149
|
NEXT_ITEM = "nextItem",
|
|
145
150
|
PREVIOUS_ITEM = "previousItem"
|
|
146
151
|
}
|
|
152
|
+
export declare enum CaptchaDisplayMode {
|
|
153
|
+
INVISIBLE = "invisible",
|
|
154
|
+
VISIBLE = "visible"
|
|
155
|
+
}
|
|
147
156
|
export {};
|
package/lib/Captcha.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import Field from './Field';
|
|
2
|
-
import { Action } from './types';
|
|
3
|
-
declare class Captcha extends Field {
|
|
2
|
+
import { Action, CaptchaDisplayMode, CaptchaJson, CaptchaModel, ContainerModel, FormModel } from './types';
|
|
3
|
+
declare class Captcha extends Field implements CaptchaModel {
|
|
4
|
+
private _captchaDisplayMode;
|
|
5
|
+
private _captchaProvider;
|
|
6
|
+
private _captchaSiteKey;
|
|
7
|
+
constructor(params: CaptchaJson, _options: {
|
|
8
|
+
form: FormModel;
|
|
9
|
+
parent: ContainerModel;
|
|
10
|
+
mode?: 'create' | 'restore';
|
|
11
|
+
});
|
|
4
12
|
getDataNode(): undefined;
|
|
5
13
|
custom_setProperty(action: Action): void;
|
|
14
|
+
get captchaDisplayMode(): CaptchaDisplayMode | undefined;
|
|
15
|
+
get captchaProvider(): string | undefined;
|
|
16
|
+
get captchaSiteKey(): string | undefined;
|
|
6
17
|
}
|
|
7
18
|
export default Captcha;
|
package/lib/Captcha.js
CHANGED
|
@@ -5,11 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Field_1 = __importDefault(require("./Field"));
|
|
7
7
|
class Captcha extends Field_1.default {
|
|
8
|
+
constructor(params, _options) {
|
|
9
|
+
super(params, _options);
|
|
10
|
+
this._captchaDisplayMode = params.captchaDisplayMode;
|
|
11
|
+
this._captchaProvider = params.captchaProvider;
|
|
12
|
+
this._captchaSiteKey = params.siteKey;
|
|
13
|
+
}
|
|
8
14
|
getDataNode() {
|
|
9
15
|
return undefined;
|
|
10
16
|
}
|
|
11
17
|
custom_setProperty(action) {
|
|
12
18
|
this.applyUpdates(action.payload);
|
|
13
19
|
}
|
|
20
|
+
get captchaDisplayMode() {
|
|
21
|
+
return this._captchaDisplayMode;
|
|
22
|
+
}
|
|
23
|
+
get captchaProvider() {
|
|
24
|
+
return this._captchaProvider;
|
|
25
|
+
}
|
|
26
|
+
get captchaSiteKey() {
|
|
27
|
+
return this._captchaSiteKey;
|
|
28
|
+
}
|
|
14
29
|
}
|
|
15
30
|
exports.default = Captcha;
|
|
@@ -15,6 +15,7 @@ const Fetch_1 = require("../utils/Fetch");
|
|
|
15
15
|
const FileObject_1 = require("../FileObject");
|
|
16
16
|
const FormUtils_1 = require("../utils/FormUtils");
|
|
17
17
|
const JsonUtils_1 = require("../utils/JsonUtils");
|
|
18
|
+
const types_1 = require("../types");
|
|
18
19
|
const getCustomEventName = (name) => {
|
|
19
20
|
const eName = name;
|
|
20
21
|
if (eName.length > 0 && eName.startsWith('custom:')) {
|
|
@@ -354,7 +355,7 @@ class FunctionRuntimeImpl {
|
|
|
354
355
|
},
|
|
355
356
|
submitForm: {
|
|
356
357
|
_func: (args, data, interpreter) => __awaiter(this, void 0, void 0, function* () {
|
|
357
|
-
var _a;
|
|
358
|
+
var _a, _b, _c, _d, _e;
|
|
358
359
|
let success = null;
|
|
359
360
|
let error = null;
|
|
360
361
|
let submit_data;
|
|
@@ -374,9 +375,9 @@ class FunctionRuntimeImpl {
|
|
|
374
375
|
validate_form = args.length > 4 ? valueOf(args[4]) : true;
|
|
375
376
|
}
|
|
376
377
|
const form = interpreter.globals.form;
|
|
377
|
-
if (form.captcha && form.captcha.
|
|
378
|
-
&& form.captcha.properties['fd:captcha'].config.keyType === 'score') {
|
|
379
|
-
if (typeof ((
|
|
378
|
+
if (form.captcha && (form.captcha.captchaDisplayMode === types_1.CaptchaDisplayMode.INVISIBLE ||
|
|
379
|
+
(((_b = (_a = form.captcha.properties['fd:captcha']) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.version) === 'enterprise' && ((_d = (_c = form.captcha.properties['fd:captcha']) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.keyType) === 'score'))) {
|
|
380
|
+
if (typeof ((_e = interpreter.runtime.functionTable.fetchCaptchaToken) === null || _e === void 0 ? void 0 : _e._func) !== 'function') {
|
|
380
381
|
interpreter.globals.form.logger.error('fetchCaptchaToken is not defined');
|
|
381
382
|
interpreter.globals.form.dispatch(new Events_1.SubmitError({ type: 'FetchCaptchaTokenNotDefined' }));
|
|
382
383
|
return {};
|
package/lib/types/Json.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CaptchaDisplayMode } from './Model';
|
|
1
2
|
export declare type Items<T> = {
|
|
2
3
|
[key: string]: T;
|
|
3
4
|
};
|
|
@@ -100,6 +101,11 @@ export declare type FieldJson = BaseJson & TranslationFieldJson & {
|
|
|
100
101
|
emptyValue?: 'null' | 'undefined' | '';
|
|
101
102
|
checked?: boolean;
|
|
102
103
|
};
|
|
104
|
+
export declare type CaptchaJson = FieldJson & {
|
|
105
|
+
captchaDisplayMode?: CaptchaDisplayMode | undefined;
|
|
106
|
+
captchaProvider?: string | undefined;
|
|
107
|
+
siteKey?: string | undefined;
|
|
108
|
+
};
|
|
103
109
|
export declare type ContainerJson = BaseJson & {
|
|
104
110
|
items: Array<FieldJson | ContainerJson>;
|
|
105
111
|
initialItems?: number;
|
package/lib/types/Model.d.ts
CHANGED
|
@@ -83,6 +83,11 @@ export interface FieldModel extends BaseModel, ScriptableField, WithState<FieldJ
|
|
|
83
83
|
readonly displayValueExpression?: string;
|
|
84
84
|
readonly editValue?: string;
|
|
85
85
|
}
|
|
86
|
+
export interface CaptchaModel extends FieldModel {
|
|
87
|
+
captchaDisplayMode: CaptchaDisplayMode | undefined;
|
|
88
|
+
captchaProvider: string | undefined;
|
|
89
|
+
captchaSiteKey: string | undefined;
|
|
90
|
+
}
|
|
86
91
|
export interface FormMetaDataModel {
|
|
87
92
|
readonly version?: string;
|
|
88
93
|
readonly grammar: string;
|
|
@@ -144,4 +149,8 @@ export declare enum FocusOption {
|
|
|
144
149
|
NEXT_ITEM = "nextItem",
|
|
145
150
|
PREVIOUS_ITEM = "previousItem"
|
|
146
151
|
}
|
|
152
|
+
export declare enum CaptchaDisplayMode {
|
|
153
|
+
INVISIBLE = "invisible",
|
|
154
|
+
VISIBLE = "visible"
|
|
155
|
+
}
|
|
147
156
|
export {};
|
package/lib/types/Model.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FocusOption = exports.ValidationError = void 0;
|
|
3
|
+
exports.CaptchaDisplayMode = exports.FocusOption = exports.ValidationError = void 0;
|
|
4
4
|
class ValidationError {
|
|
5
5
|
constructor(fieldName = '', errorMessages = []) {
|
|
6
6
|
this.errorMessages = errorMessages;
|
|
@@ -13,3 +13,8 @@ var FocusOption;
|
|
|
13
13
|
FocusOption["NEXT_ITEM"] = "nextItem";
|
|
14
14
|
FocusOption["PREVIOUS_ITEM"] = "previousItem";
|
|
15
15
|
})(FocusOption = exports.FocusOption || (exports.FocusOption = {}));
|
|
16
|
+
var CaptchaDisplayMode;
|
|
17
|
+
(function (CaptchaDisplayMode) {
|
|
18
|
+
CaptchaDisplayMode["INVISIBLE"] = "invisible";
|
|
19
|
+
CaptchaDisplayMode["VISIBLE"] = "visible";
|
|
20
|
+
})(CaptchaDisplayMode = exports.CaptchaDisplayMode || (exports.CaptchaDisplayMode = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.89",
|
|
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.89"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/preset-env": "^7.20.2",
|