@fairandsmart/consents-ce 1.3.7
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/LICENSE.txt +21 -0
- package/README.md +116 -0
- package/api.d.ts +19 -0
- package/api.js +67 -0
- package/common.d.ts +8 -0
- package/common.js +2 -0
- package/consents/api.d.ts +9 -0
- package/consents/api.js +69 -0
- package/consents/helpers.d.ts +6 -0
- package/consents/helpers.js +24 -0
- package/consents/index.d.ts +3 -0
- package/consents/index.js +35 -0
- package/consents/interfaces.d.ts +74 -0
- package/consents/interfaces.js +32 -0
- package/css-autocomplete.d.ts +14 -0
- package/css-autocomplete.js +809 -0
- package/forms/consent-collector.d.ts +11 -0
- package/forms/consent-collector.js +115 -0
- package/forms/index.d.ts +2 -0
- package/forms/index.js +34 -0
- package/forms/interfaces.d.ts +12 -0
- package/forms/interfaces.js +2 -0
- package/http.d.ts +37 -0
- package/http.js +46 -0
- package/index.d.ts +15 -0
- package/index.js +46 -0
- package/keys/api.d.ts +6 -0
- package/keys/api.js +29 -0
- package/keys/index.d.ts +2 -0
- package/keys/index.js +34 -0
- package/keys/interfaces.d.ts +15 -0
- package/keys/interfaces.js +2 -0
- package/models/api.d.ts +23 -0
- package/models/api.js +228 -0
- package/models/helpers.d.ts +6 -0
- package/models/helpers.js +29 -0
- package/models/index.d.ts +3 -0
- package/models/index.js +35 -0
- package/models/interfaces.d.ts +246 -0
- package/models/interfaces.js +139 -0
- package/package.json +48 -0
- package/receipts/api.d.ts +3 -0
- package/receipts/api.js +16 -0
- package/receipts/index.d.ts +1 -0
- package/receipts/index.js +33 -0
- package/receipts/interfaces.d.ts +0 -0
- package/receipts/interfaces.js +1 -0
- package/records/api.d.ts +6 -0
- package/records/api.js +38 -0
- package/records/index.d.ts +2 -0
- package/records/index.js +34 -0
- package/records/interfaces.d.ts +116 -0
- package/records/interfaces.js +60 -0
- package/statistics/api.d.ts +4 -0
- package/statistics/api.js +12 -0
- package/statistics/index.d.ts +2 -0
- package/statistics/index.js +34 -0
- package/statistics/interfaces.d.ts +20 -0
- package/statistics/interfaces.js +10 -0
- package/subjects/api.d.ts +9 -0
- package/subjects/api.js +58 -0
- package/subjects/index.d.ts +2 -0
- package/subjects/index.js +34 -0
- package/subjects/interfaces.d.ts +7 -0
- package/subjects/interfaces.js +2 -0
- package/system/api.d.ts +5 -0
- package/system/api.js +20 -0
- package/system/index.d.ts +2 -0
- package/system/index.js +34 -0
- package/system/interfaces.d.ts +20 -0
- package/system/interfaces.js +2 -0
- package/tokens/api.d.ts +4 -0
- package/tokens/api.js +14 -0
- package/tokens/index.d.ts +2 -0
- package/tokens/index.js +34 -0
- package/tokens/interfaces.d.ts +5 -0
- package/tokens/interfaces.js +2 -0
- package/users/api.d.ts +9 -0
- package/users/api.js +28 -0
- package/users/index.d.ts +2 -0
- package/users/index.js +34 -0
- package/users/interfaces.d.ts +10 -0
- package/users/interfaces.js +2 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 fairandsmart
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Fair&Smart Right Consents TypeScript support
|
|
2
|
+
|
|
3
|
+
This project implements TypeScript definitions and API helpers for the [Fair&Smart Right Consents API](https://cmback.dev.env.fairandsmart.tech/swagger-ui/). It's meant for use in [Right Consents Front-end](https://github.com/fairandsmart/consent-manager-lib-ce), but should be general enough to use in any project. The code is maintained and based on the [Right Consents Back-end](https://github.com/fairandsmart/consent-manager-back) API resources and models, to be as close as possible to the true representation of the resources.
|
|
4
|
+
|
|
5
|
+
# Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i @fairandsmart/consents-ce
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# Interfaces and Enums
|
|
12
|
+
|
|
13
|
+
All the interface type definitions and enums are for type info only - everything will compile out. Only the API helpers produce real JavaScript output. You can import types from each service defined on [the API](https://cmback.dev.env.fairandsmart.tech/swagger-ui/):
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { ModelVersionDtoLight, ModelsResource } from '@fairandsmart/consents-ce/models';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# API Helpers
|
|
21
|
+
|
|
22
|
+
In addition to the types, there are also simple helper functions for each API endpoint. They define the inputs and outputs to that endpoint, and will call a user-provided function with HTTP request info that you can then use to make an HTTP request. This pattern was used so the API helpers could provide full type information. These helpers are not a full API client - they assist in building one. An example:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { RcHttpClientConfig } from '@fairandsmart/consents-ce';
|
|
26
|
+
|
|
27
|
+
function http(config: RcHttpClientConfig): Observable<ModelEntryDto> {
|
|
28
|
+
// fill in the API key, handle OAuth, etc., then make an HTTP request using the config.
|
|
29
|
+
return fromFetch(config.url, ...);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Use either as an observable
|
|
33
|
+
|
|
34
|
+
ModelsResource.getEntry(entryId).subscribe((modelEntry: ModelEntryDto) => {
|
|
35
|
+
...
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// ... or a promise using the .toPromise method
|
|
39
|
+
|
|
40
|
+
const modelEntry: ModelEntryDto = await ModelsResource.getEntry(entryId).toPromise();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Note that the API Helpers all return Observables and not promises. Feel free to adapt the behavior as you see fit.
|
|
44
|
+
|
|
45
|
+
To setup the helpers properly, see the Initialization section below.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Initialization
|
|
49
|
+
|
|
50
|
+
*Note: this is not required if you only want to use the library for type descriptions*
|
|
51
|
+
|
|
52
|
+
If you wish to use the API helpers, you need to initialize the library in your project:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { RightConsents } from '@fairandsmart/consents-ce';
|
|
56
|
+
|
|
57
|
+
RightConsents.init({
|
|
58
|
+
apiRoot: 'http://localhost:4287',
|
|
59
|
+
httpClient: myCustomHttpClient // see API Helpers for more details
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
You need to provide the endpoint at which the API is available, and a custom HttpClient to handle all the requests.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Imports
|
|
67
|
+
|
|
68
|
+
It is possible to import all services from `@fairandsmart/consent-manager` directly, but it's better to use the direct import:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// good
|
|
72
|
+
import { getEntry } from '@fairandsmart/consents-ce/models';
|
|
73
|
+
getEntry(...);
|
|
74
|
+
|
|
75
|
+
// works, but not as good. Use for disambiguity if needed
|
|
76
|
+
import { ModelsResources } from '@fairandsmart/consents-ce';
|
|
77
|
+
ModelsResources.getEntry(...);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
# Model Helpers
|
|
81
|
+
|
|
82
|
+
Some imports also contains helpers for parsing and interpreting the resources:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { map } from 'rxjs';
|
|
86
|
+
import { ModelEntryDto, ModelEntryHelper, getEntry } from '@fairandsmart/consents-ce/models';
|
|
87
|
+
|
|
88
|
+
getEntry(modelId).pipe(
|
|
89
|
+
map((entry: ModelEntryDto) => ModelEntryHelper.getActiveVersion(entry))
|
|
90
|
+
).subscribe((activeVersion) => {
|
|
91
|
+
// ModelEntryHelper is an object with static methods to help you parse the entry.
|
|
92
|
+
// In this example, you can find the active version of a model
|
|
93
|
+
...
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
# Build
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
# build
|
|
101
|
+
npm run build
|
|
102
|
+
# pack for local import
|
|
103
|
+
npm run pack
|
|
104
|
+
# install local version in a different project
|
|
105
|
+
npm i {lib-repository}/lib/fairandsmart-consents-ce-{VERSION}.tgz
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
# Contribute
|
|
109
|
+
|
|
110
|
+
- Create a branch for your work (PRD-XXX)
|
|
111
|
+
- Upgrade the version in the package-lib.json
|
|
112
|
+
- Add your work
|
|
113
|
+
- Run `.build.sh` and push
|
|
114
|
+
- Create a new merge request
|
|
115
|
+
|
|
116
|
+
|
package/api.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RcHttpClient } from './http';
|
|
2
|
+
export interface RightConsentsApiConfig {
|
|
3
|
+
httpClient: RcHttpClient;
|
|
4
|
+
apiRoot: string;
|
|
5
|
+
}
|
|
6
|
+
declare class RightConsentsApi {
|
|
7
|
+
private _config;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the http client setup in the init function. If none are present, warns the user and returns default handler
|
|
10
|
+
*/
|
|
11
|
+
get http(): RcHttpClient;
|
|
12
|
+
get config(): RightConsentsApiConfig;
|
|
13
|
+
get initialized(): boolean;
|
|
14
|
+
constructor();
|
|
15
|
+
init(config: RightConsentsApiConfig): void;
|
|
16
|
+
reset(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const RightConsents: RightConsentsApi;
|
|
19
|
+
export {};
|
package/api.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.RightConsents = void 0;
|
|
15
|
+
var http_1 = require("./http");
|
|
16
|
+
var RightConsentsApi = /** @class */ (function () {
|
|
17
|
+
function RightConsentsApi() {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
this._config = {
|
|
20
|
+
httpClient: http_1.defaultHttpClient,
|
|
21
|
+
apiRoot: 'no_endpoint',
|
|
22
|
+
default: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(RightConsentsApi.prototype, "http", {
|
|
26
|
+
/**
|
|
27
|
+
* Returns the http client setup in the init function. If none are present, warns the user and returns default handler
|
|
28
|
+
*/
|
|
29
|
+
get: function () {
|
|
30
|
+
if (!this._config || this._config.default) {
|
|
31
|
+
console.warn('No HTTP client was registered in `@fairandsmart/consents-ce`');
|
|
32
|
+
}
|
|
33
|
+
return this._config.httpClient;
|
|
34
|
+
},
|
|
35
|
+
enumerable: false,
|
|
36
|
+
configurable: true
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(RightConsentsApi.prototype, "config", {
|
|
39
|
+
get: function () {
|
|
40
|
+
if (!this._config || this._config.default) {
|
|
41
|
+
console.warn('You must call RightConsents.init before you can use the API features of `@fairandsmart/consents-ce` ');
|
|
42
|
+
}
|
|
43
|
+
return this._config;
|
|
44
|
+
},
|
|
45
|
+
enumerable: false,
|
|
46
|
+
configurable: true
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(RightConsentsApi.prototype, "initialized", {
|
|
49
|
+
get: function () {
|
|
50
|
+
return !this._config.default && !!this._config.httpClient && this._config.apiRoot !== 'no_endpoint';
|
|
51
|
+
},
|
|
52
|
+
enumerable: false,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
55
|
+
RightConsentsApi.prototype.init = function (config) {
|
|
56
|
+
this._config = __assign(__assign(__assign({}, this._config), config), { default: false });
|
|
57
|
+
};
|
|
58
|
+
RightConsentsApi.prototype.reset = function () {
|
|
59
|
+
this._config = {
|
|
60
|
+
httpClient: http_1.defaultHttpClient,
|
|
61
|
+
apiRoot: 'no_endpoint',
|
|
62
|
+
default: true
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
return RightConsentsApi;
|
|
66
|
+
}());
|
|
67
|
+
exports.RightConsents = new RightConsentsApi();
|
package/common.d.ts
ADDED
package/common.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ConsentContext } from './interfaces';
|
|
3
|
+
import { RCApiOptions } from '../http';
|
|
4
|
+
export declare function createTransactionJson(ctx: ConsentContext, lang: string, options?: RCApiOptions): Observable<string>;
|
|
5
|
+
export declare function getTransactionJson(transactionId: string, options?: RCApiOptions): Observable<string>;
|
|
6
|
+
export declare function postSubmissionValuesHtml(txid: string, values: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}, options?: RCApiOptions): Observable<string>;
|
|
9
|
+
export declare function getSubmitFormPreview(ctx: ConsentContext, lang: string, options?: RCApiOptions): Observable<string>;
|
package/consents/api.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSubmitFormPreview =
|
|
4
|
+
exports.postSubmissionValuesHtml =
|
|
5
|
+
exports.getTransactionJson =
|
|
6
|
+
exports.createTransactionJson =
|
|
7
|
+
void 0;
|
|
8
|
+
var api_1 = require("../api");
|
|
9
|
+
function createTransactionJson(ctx, lang, options) {
|
|
10
|
+
return api_1.RightConsents.http({
|
|
11
|
+
method: "POST",
|
|
12
|
+
url: "".concat(api_1.RightConsents.config.apiRoot, "/consents"),
|
|
13
|
+
body: ctx,
|
|
14
|
+
responseType: "text",
|
|
15
|
+
resolveHeaders: true,
|
|
16
|
+
headers: {
|
|
17
|
+
"Content-Type": "application/json",
|
|
18
|
+
"Accept-Language": lang,
|
|
19
|
+
},
|
|
20
|
+
options: options,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.createTransactionJson = createTransactionJson;
|
|
24
|
+
function getTransactionJson(transactionId, options) {
|
|
25
|
+
return api_1.RightConsents.http({
|
|
26
|
+
method: "GET",
|
|
27
|
+
url: ""
|
|
28
|
+
.concat(api_1.RightConsents.config.apiRoot, "/consents/")
|
|
29
|
+
.concat(transactionId),
|
|
30
|
+
headers: {
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
},
|
|
33
|
+
options: options,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.getTransactionJson = getTransactionJson;
|
|
37
|
+
function postSubmissionValuesHtml(txid, values, options) {
|
|
38
|
+
return api_1.RightConsents.http({
|
|
39
|
+
method: "POST",
|
|
40
|
+
url: ""
|
|
41
|
+
.concat(api_1.RightConsents.config.apiRoot, "/consents/")
|
|
42
|
+
.concat(txid, "/submit"),
|
|
43
|
+
body: Object.keys(values)
|
|
44
|
+
.map(function (key) {
|
|
45
|
+
return "".concat(key, "=").concat(encodeURIComponent(values[key]));
|
|
46
|
+
})
|
|
47
|
+
.join("&"),
|
|
48
|
+
responseType: "text",
|
|
49
|
+
headers: {
|
|
50
|
+
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
|
51
|
+
},
|
|
52
|
+
options: options,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.postSubmissionValuesHtml = postSubmissionValuesHtml;
|
|
56
|
+
function getSubmitFormPreview(ctx, lang, options) {
|
|
57
|
+
return api_1.RightConsents.http({
|
|
58
|
+
method: "POST",
|
|
59
|
+
url: "".concat(api_1.RightConsents.config.apiRoot, "/consents/preview"),
|
|
60
|
+
body: ctx,
|
|
61
|
+
responseType: "text",
|
|
62
|
+
headers: {
|
|
63
|
+
"Content-Type": "application/json",
|
|
64
|
+
"Accept-Language": lang,
|
|
65
|
+
},
|
|
66
|
+
options: options,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
exports.getSubmitFormPreview = getSubmitFormPreview;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RecordDto } from '../records';
|
|
2
|
+
import { ConsentContext } from './interfaces';
|
|
3
|
+
import { ModelEntryDto } from '../models';
|
|
4
|
+
export declare class ConsentHelper {
|
|
5
|
+
static generateContextFromRecord(entry: ModelEntryDto, record: RecordDto, lang?: string): ConsentContext;
|
|
6
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsentHelper = void 0;
|
|
4
|
+
var models_1 = require("../models");
|
|
5
|
+
var ConsentHelper = /** @class */ (function () {
|
|
6
|
+
function ConsentHelper() {}
|
|
7
|
+
ConsentHelper.generateContextFromRecord = function (entry, record, lang) {
|
|
8
|
+
if (lang === void 0) {
|
|
9
|
+
lang = entry.defaultLanguage;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
language: lang,
|
|
13
|
+
subject: record.subject,
|
|
14
|
+
origin: models_1.ConsentOrigin.USER,
|
|
15
|
+
layoutData: {
|
|
16
|
+
info: "",
|
|
17
|
+
elements: [entry.key],
|
|
18
|
+
type: "layout",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
return ConsentHelper;
|
|
23
|
+
})();
|
|
24
|
+
exports.ConsentHelper = ConsentHelper;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (
|
|
9
|
+
!desc ||
|
|
10
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
11
|
+
) {
|
|
12
|
+
desc = {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return m[k];
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}
|
|
21
|
+
: function (o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
});
|
|
25
|
+
var __exportStar =
|
|
26
|
+
(this && this.__exportStar) ||
|
|
27
|
+
function (m, exports) {
|
|
28
|
+
for (var p in m)
|
|
29
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
30
|
+
__createBinding(exports, m, p);
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
__exportStar(require("./interfaces"), exports);
|
|
34
|
+
__exportStar(require("./api"), exports);
|
|
35
|
+
__exportStar(require("./helpers"), exports);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ConsentOrigin, FormLayout } from '../models';
|
|
2
|
+
export declare enum Confirmation {
|
|
3
|
+
NONE = "NONE",
|
|
4
|
+
FORM_CODE = "FORM_CODE",
|
|
5
|
+
EMAIL_CODE = "EMAIL_CODE",
|
|
6
|
+
SMS_CODE = "SMS_CODE",
|
|
7
|
+
SIGNATURE = "SIGNATURE",
|
|
8
|
+
AUDIO_RECORD = "AUDIO_RECORD",
|
|
9
|
+
VIDEO_RECORD = "VIDEO_RECORD",
|
|
10
|
+
DIGITAL_SIGNATURE = "DIGITAL_SIGNATURE"
|
|
11
|
+
}
|
|
12
|
+
export declare const CONFIRMATION_TYPES: Confirmation[];
|
|
13
|
+
export declare enum UserInfosKeys {
|
|
14
|
+
EMAIL_KEY = "emailAddress",
|
|
15
|
+
PHONE_KEY = "phoneNumber"
|
|
16
|
+
}
|
|
17
|
+
export declare enum ConfirmationConfigKeys {
|
|
18
|
+
SENDER_EMAIL_KEY = "senderEmail",
|
|
19
|
+
SENDER_PHONE_KEY = "senderPhone"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The ConsentContext is used to generate a token. This token is used:
|
|
23
|
+
* - To generate a form in a browser for the user to fill
|
|
24
|
+
* - To collect the consent of a user through the API
|
|
25
|
+
*/
|
|
26
|
+
export interface ConsentContext {
|
|
27
|
+
/** The identifier of the profile the processing will be linked to */
|
|
28
|
+
subject: string;
|
|
29
|
+
/** If the form is not in iframe mode, the user will be redirected to this callback once the process is over */
|
|
30
|
+
callback?: string;
|
|
31
|
+
/** If the IFrame mode is set, set the allowed origin for the parent window domain */
|
|
32
|
+
iframeOrigin?: string;
|
|
33
|
+
/** The language of the form. All models must have a valid version of this language for the form to display properly */
|
|
34
|
+
language: string;
|
|
35
|
+
/** Specifies the consent origin (what was the collecting support). Either:
|
|
36
|
+
* webform (the user used a form)
|
|
37
|
+
* or operator (a competent authority filled the form)
|
|
38
|
+
*/
|
|
39
|
+
origin?: ConsentOrigin;
|
|
40
|
+
/** (optional) The ISO 8601 duration for the validity of the record. */
|
|
41
|
+
validity?: string;
|
|
42
|
+
/** Specifies whether the consent can be updated afterwards. */
|
|
43
|
+
updatable?: boolean;
|
|
44
|
+
/** Any relevant informations about the user that will be persisted in the receipt */
|
|
45
|
+
userinfos?: {
|
|
46
|
+
[key: string]: string;
|
|
47
|
+
};
|
|
48
|
+
/** Any other relevant informations about the context that will be persisted in the record */
|
|
49
|
+
attributes?: {
|
|
50
|
+
[key: string]: string;
|
|
51
|
+
};
|
|
52
|
+
/** (readonly) A transaction identifier for that consent. */
|
|
53
|
+
transaction?: string;
|
|
54
|
+
/** The identifier of the user who used the form */
|
|
55
|
+
author?: string;
|
|
56
|
+
/** The FormLayout Data to use ; if layout key is provided, layoutData will be ignored.*/
|
|
57
|
+
layoutData?: FormLayout;
|
|
58
|
+
/** The reference to the 'formlayout' model that will be used.*/
|
|
59
|
+
layout?: string;
|
|
60
|
+
/** The type of user confirmation needed, default is NONE */
|
|
61
|
+
confirmation?: Confirmation;
|
|
62
|
+
/** Additional information needed for user confirmation */
|
|
63
|
+
confirmationConfig?: {
|
|
64
|
+
[key: string]: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Used to generate a Receipt from a transaction id */
|
|
68
|
+
export interface ConsentTransaction {
|
|
69
|
+
subject: string;
|
|
70
|
+
transaction: string;
|
|
71
|
+
claims: {
|
|
72
|
+
[key: string]: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfirmationConfigKeys =
|
|
4
|
+
exports.UserInfosKeys =
|
|
5
|
+
exports.CONFIRMATION_TYPES =
|
|
6
|
+
exports.Confirmation =
|
|
7
|
+
void 0;
|
|
8
|
+
var Confirmation;
|
|
9
|
+
(function (Confirmation) {
|
|
10
|
+
Confirmation["NONE"] = "NONE";
|
|
11
|
+
Confirmation["FORM_CODE"] = "FORM_CODE";
|
|
12
|
+
Confirmation["EMAIL_CODE"] = "EMAIL_CODE";
|
|
13
|
+
Confirmation["SMS_CODE"] = "SMS_CODE";
|
|
14
|
+
Confirmation["SIGNATURE"] = "SIGNATURE";
|
|
15
|
+
Confirmation["AUDIO_RECORD"] = "AUDIO_RECORD";
|
|
16
|
+
Confirmation["VIDEO_RECORD"] = "VIDEO_RECORD";
|
|
17
|
+
Confirmation["DIGITAL_SIGNATURE"] = "DIGITAL_SIGNATURE";
|
|
18
|
+
})((Confirmation = exports.Confirmation || (exports.Confirmation = {})));
|
|
19
|
+
exports.CONFIRMATION_TYPES = Object.keys(Confirmation);
|
|
20
|
+
var UserInfosKeys;
|
|
21
|
+
(function (UserInfosKeys) {
|
|
22
|
+
UserInfosKeys["EMAIL_KEY"] = "emailAddress";
|
|
23
|
+
UserInfosKeys["PHONE_KEY"] = "phoneNumber";
|
|
24
|
+
})((UserInfosKeys = exports.UserInfosKeys || (exports.UserInfosKeys = {})));
|
|
25
|
+
var ConfirmationConfigKeys;
|
|
26
|
+
(function (ConfirmationConfigKeys) {
|
|
27
|
+
ConfirmationConfigKeys["SENDER_EMAIL_KEY"] = "senderEmail";
|
|
28
|
+
ConfirmationConfigKeys["SENDER_PHONE_KEY"] = "senderPhone";
|
|
29
|
+
})(
|
|
30
|
+
(ConfirmationConfigKeys =
|
|
31
|
+
exports.ConfirmationConfigKeys || (exports.ConfirmationConfigKeys = {}))
|
|
32
|
+
);
|