@stackfactor/client-api 1.9.2 → 1.10.0
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/README.md +1 -0
- package/dist/cjs/lib/constants.d.ts +1 -0
- package/dist/cjs/lib/constants.d.ts.map +1 -1
- package/dist/cjs/lib/constants.js +2 -0
- package/dist/cjs/lib/constants.js.map +1 -1
- package/dist/cjs/lib/control.d.ts +9 -0
- package/dist/cjs/lib/control.d.ts.map +1 -1
- package/dist/cjs/lib/control.js +10 -1
- package/dist/cjs/lib/control.js.map +1 -1
- package/dist/cjs/lib/controlTemplate.d.ts +9 -0
- package/dist/cjs/lib/controlTemplate.d.ts.map +1 -1
- package/dist/cjs/lib/controlTemplate.js +10 -1
- package/dist/cjs/lib/controlTemplate.js.map +1 -1
- package/dist/cjs/lib/index.d.ts +3 -0
- package/dist/cjs/lib/index.d.ts.map +1 -1
- package/dist/cjs/lib/index.js +5 -2
- package/dist/cjs/lib/index.js.map +1 -1
- package/dist/cjs/lib/metric.d.ts +171 -0
- package/dist/cjs/lib/metric.d.ts.map +1 -0
- package/dist/cjs/lib/metric.js +170 -0
- package/dist/cjs/lib/metric.js.map +1 -0
- package/dist/cjs/lib/metricTemplate.d.ts +119 -0
- package/dist/cjs/lib/metricTemplate.d.ts.map +1 -0
- package/dist/cjs/lib/metricTemplate.js +145 -0
- package/dist/cjs/lib/metricTemplate.js.map +1 -0
- package/dist/cjs/lib/userExperiences.d.ts +191 -0
- package/dist/cjs/lib/userExperiences.d.ts.map +1 -0
- package/dist/cjs/lib/userExperiences.js +120 -0
- package/dist/cjs/lib/userExperiences.js.map +1 -0
- package/dist/cjs/lib/users.d.ts +34 -8
- package/dist/cjs/lib/users.d.ts.map +1 -1
- package/dist/cjs/lib/users.js +37 -9
- package/dist/cjs/lib/users.js.map +1 -1
- package/dist/esm/lib/constants.d.ts +1 -0
- package/dist/esm/lib/constants.d.ts.map +1 -1
- package/dist/esm/lib/constants.js +2 -0
- package/dist/esm/lib/constants.js.map +1 -1
- package/dist/esm/lib/control.d.ts +9 -0
- package/dist/esm/lib/control.d.ts.map +1 -1
- package/dist/esm/lib/control.js +8 -0
- package/dist/esm/lib/control.js.map +1 -1
- package/dist/esm/lib/controlTemplate.d.ts +9 -0
- package/dist/esm/lib/controlTemplate.d.ts.map +1 -1
- package/dist/esm/lib/controlTemplate.js +9 -1
- package/dist/esm/lib/controlTemplate.js.map +1 -1
- package/dist/esm/lib/index.d.ts +3 -0
- package/dist/esm/lib/index.d.ts.map +1 -1
- package/dist/esm/lib/index.js +3 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/metric.d.ts +171 -0
- package/dist/esm/lib/metric.d.ts.map +1 -0
- package/dist/esm/lib/metric.js +152 -0
- package/dist/esm/lib/metric.js.map +1 -0
- package/dist/esm/lib/metricTemplate.d.ts +119 -0
- package/dist/esm/lib/metricTemplate.d.ts.map +1 -0
- package/dist/esm/lib/metricTemplate.js +130 -0
- package/dist/esm/lib/metricTemplate.js.map +1 -0
- package/dist/esm/lib/userExperiences.d.ts +191 -0
- package/dist/esm/lib/userExperiences.d.ts.map +1 -0
- package/dist/esm/lib/userExperiences.js +106 -0
- package/dist/esm/lib/userExperiences.js.map +1 -0
- package/dist/esm/lib/users.d.ts +34 -8
- package/dist/esm/lib/users.d.ts.map +1 -1
- package/dist/esm/lib/users.js +35 -8
- package/dist/esm/lib/users.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { client, request } from "./axiosClient.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create metric template and set information
|
|
4
|
+
* @param {Object} data
|
|
5
|
+
* @param {String} token Authorization token
|
|
6
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
7
|
+
*/
|
|
8
|
+
export const createMetricTemplate = (data, token) => request(client.put("/api/v1/admin/metrictemplates", { data }, { headers: { authorization: token } }));
|
|
9
|
+
/**
|
|
10
|
+
* Delete metric template
|
|
11
|
+
* @param {String} id The id of the record to be deleted
|
|
12
|
+
* @param {String} comments The comments included with the deletion
|
|
13
|
+
* @param {String} token Authorization token
|
|
14
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
15
|
+
*/
|
|
16
|
+
export const deleteMetricTemplate = (id, comments, token) => {
|
|
17
|
+
const data = { id };
|
|
18
|
+
if (comments)
|
|
19
|
+
data.comments = comments;
|
|
20
|
+
return request(client.delete("/api/v1/admin/metrictemplates/", { headers: { authorization: token }, data }));
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Discard the metric template draft changes
|
|
24
|
+
* @param {String} id The id of the record to be discarded
|
|
25
|
+
* @param {String} token Authorization token
|
|
26
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
27
|
+
*/
|
|
28
|
+
export const discardMetricTemplateChanges = (id, token) => request(client.get(`/api/v1/admin/metrictemplates/discard/${id}`, { headers: { authorization: token } }));
|
|
29
|
+
/**
|
|
30
|
+
* Get metric template information
|
|
31
|
+
* @param {String} id The id of the record
|
|
32
|
+
* @param {String} version The version of the record
|
|
33
|
+
* @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
|
|
34
|
+
* @param {String} token Authorization token
|
|
35
|
+
* @returns {Promise<MetricTemplateRecord | null>}
|
|
36
|
+
*/
|
|
37
|
+
export const getMetricTemplateInformationById = (id, version, returnNullIfVersionNotFound, token) => request(client.get(`/api/v1/admin/metrictemplates/${id}/${version}/${returnNullIfVersionNotFound}`, {
|
|
38
|
+
headers: { authorization: token },
|
|
39
|
+
}));
|
|
40
|
+
/**
|
|
41
|
+
* Get metric template list
|
|
42
|
+
* @param {Array<String>} filter The filter used to select the records
|
|
43
|
+
* @param {String} version The version to be retrieved
|
|
44
|
+
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
45
|
+
* @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
|
|
46
|
+
* @param {String} token Authorization token
|
|
47
|
+
* @returns {Promise<MetricTemplateRecord[]>}
|
|
48
|
+
*/
|
|
49
|
+
export const getMetricTemplateList = (filter, version, includeDeleted, details, token) => {
|
|
50
|
+
const requestData = { includeDeleted, details, version };
|
|
51
|
+
if (filter)
|
|
52
|
+
requestData.filter = filter;
|
|
53
|
+
return request(client.post("/api/v1/admin/metrictemplates", requestData, { headers: { authorization: token } }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Publish metric template
|
|
57
|
+
* @param {String} id The id of the record to be published
|
|
58
|
+
* @param {String} comments The comments to be include with the request
|
|
59
|
+
* @param {String} token Authorization token
|
|
60
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
61
|
+
*/
|
|
62
|
+
export const publishMetricTemplate = (id, comments, token) => {
|
|
63
|
+
const data = {};
|
|
64
|
+
if (comments)
|
|
65
|
+
data.comments = comments;
|
|
66
|
+
return request(client.post(`/api/v1/admin/metrictemplates/publish/${id}`, data, { headers: { authorization: token } }));
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Set metric template information
|
|
70
|
+
* @param {String} id The id of the record to be updated
|
|
71
|
+
* @param {Object} data Data used to update the record
|
|
72
|
+
* @param {String} token Authorization token
|
|
73
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
74
|
+
*/
|
|
75
|
+
export const setMetricTemplateInformation = (id, data, token) => request(client.post(`/api/v1/admin/metrictemplates/update`, { data, id }, { headers: { authorization: token } }));
|
|
76
|
+
/**
|
|
77
|
+
* Update the metric template tags
|
|
78
|
+
* @param {String} id The id of the template to be updated
|
|
79
|
+
* @param {Object} tags Updated template tags
|
|
80
|
+
* @param {String} token Authorization token
|
|
81
|
+
* @returns {Promise<MetricTemplateRecord>}
|
|
82
|
+
*/
|
|
83
|
+
export const setMetricTemplateTags = (id, tags, token) => request(client.post(`/api/v1/admin/metrictemplates/updatetags`, { tags, id }, {
|
|
84
|
+
headers: { authorization: token },
|
|
85
|
+
}));
|
|
86
|
+
/**
|
|
87
|
+
* Get the metric template related control templates
|
|
88
|
+
* @param {String} id The id of the record
|
|
89
|
+
* @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
|
|
90
|
+
* @param {String} version The version to be retrieved
|
|
91
|
+
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
92
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
93
|
+
* @param {String} token Authorization token
|
|
94
|
+
* @returns {Promise<RelatedRecordOrId[]>}
|
|
95
|
+
*/
|
|
96
|
+
export const getMetricTemplateRelatedControlTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => request(client.post(`/api/v1/admin/metrictemplates/controltemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
|
|
97
|
+
/**
|
|
98
|
+
* Get the metric template related requirement templates
|
|
99
|
+
* @param {String} id The id of the record
|
|
100
|
+
* @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
|
|
101
|
+
* @param {String} version The version to be retrieved
|
|
102
|
+
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
103
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
104
|
+
* @param {String} token Authorization token
|
|
105
|
+
* @returns {Promise<RelatedRecordOrId[]>}
|
|
106
|
+
*/
|
|
107
|
+
export const getMetricTemplateRelatedRequirementTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => request(client.post(`/api/v1/admin/metrictemplates/requirementtemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
|
|
108
|
+
/**
|
|
109
|
+
* Get the metric template related standard templates
|
|
110
|
+
* @param {String} id The id of the record
|
|
111
|
+
* @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
|
|
112
|
+
* @param {String} version The version to be retrieved
|
|
113
|
+
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
114
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
115
|
+
* @param {String} token Authorization token
|
|
116
|
+
* @returns {Promise<RelatedRecordOrId[]>}
|
|
117
|
+
*/
|
|
118
|
+
export const getMetricTemplateRelatedStandardTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => request(client.post(`/api/v1/admin/metrictemplates/standardtemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
|
|
119
|
+
/**
|
|
120
|
+
* Get the metric template related policy templates
|
|
121
|
+
* @param {String} id The id of the record
|
|
122
|
+
* @param {String} details The level of detail to return ("ID", "NAME", "DEFAULT")
|
|
123
|
+
* @param {String} version The version to be retrieved
|
|
124
|
+
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
125
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
126
|
+
* @param {String} token Authorization token
|
|
127
|
+
* @returns {Promise<RelatedRecordOrId[]>}
|
|
128
|
+
*/
|
|
129
|
+
export const getMetricTemplateRelatedPolicyTemplates = (id, details, version, includeDeleted, returnDefaultIfVersionNotAvailable, token) => request(client.post(`/api/v1/admin/metrictemplates/policytemplates/${id}`, { details, version, includeDeleted, returnDefaultIfVersionNotAvailable }, { headers: { authorization: token } }));
|
|
130
|
+
//# sourceMappingURL=metricTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metricTemplate.js","sourceRoot":"","sources":["../../../src/lib/metricTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAYnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAA4B,EAAE,KAAa,EAAiC,EAAE,CACjH,OAAO,CAAuB,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,CAAC,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ences, in display order. */
|
|
2
|
+
export type ExperienceId = "default" | "student" | "teacher" | "channel" | "executive" | "newhire";
|
|
3
|
+
/** A word whose label an experience can rename. */
|
|
4
|
+
export type LabelTerm = "team" | "member" | "manager" | "role" | "skill" | "path" | "plan" | "mentor";
|
|
5
|
+
/** A setting's value: toggles are booleans, text and choice settings strings. */
|
|
6
|
+
export type SettingValue = boolean | string;
|
|
7
|
+
/** One setting an experience exposes. */
|
|
8
|
+
export interface ExperienceSetting {
|
|
9
|
+
key: string;
|
|
10
|
+
area: "onboarding" | "profile" | "app";
|
|
11
|
+
kind: "toggle" | "text" | "choice";
|
|
12
|
+
label: string;
|
|
13
|
+
description: string;
|
|
14
|
+
default: SettingValue;
|
|
15
|
+
options?: string[];
|
|
16
|
+
maxLength?: number;
|
|
17
|
+
}
|
|
18
|
+
/** An experience with its settings and default labels. */
|
|
19
|
+
export interface ExperienceDefinition {
|
|
20
|
+
id: ExperienceId;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
settings: ExperienceSetting[];
|
|
24
|
+
labels: Partial<Record<LabelTerm, string>>;
|
|
25
|
+
}
|
|
26
|
+
/** The settings catalog and the label terms. */
|
|
27
|
+
export interface UserExperienceCatalog {
|
|
28
|
+
experiences: ExperienceDefinition[];
|
|
29
|
+
labelTerms: {
|
|
30
|
+
term: LabelTerm;
|
|
31
|
+
label: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
/** Who a user experience includes or excludes. */
|
|
35
|
+
export interface AudienceRules {
|
|
36
|
+
teams: {
|
|
37
|
+
teamId: string;
|
|
38
|
+
includeSubTeams: boolean;
|
|
39
|
+
}[];
|
|
40
|
+
groups: string[];
|
|
41
|
+
users: string[];
|
|
42
|
+
}
|
|
43
|
+
/** A user experience a person gets. */
|
|
44
|
+
export interface ExperienceSummary {
|
|
45
|
+
userExperienceId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
experience: ExperienceId;
|
|
48
|
+
}
|
|
49
|
+
/** Why a user experience does or does not apply to a person. */
|
|
50
|
+
export type Verdict = "matches" | "excluded" | "notIncluded" | "windowEnded";
|
|
51
|
+
/** The editable content of a user experience, as a draft or published version. */
|
|
52
|
+
export interface UserExperienceVersion {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
experience: ExperienceId;
|
|
56
|
+
newHireDays: number;
|
|
57
|
+
include: AudienceRules;
|
|
58
|
+
exclude: AudienceRules;
|
|
59
|
+
settings: Record<string, SettingValue>;
|
|
60
|
+
labels: Partial<Record<LabelTerm, string>>;
|
|
61
|
+
version: number;
|
|
62
|
+
schemaVersion: number;
|
|
63
|
+
}
|
|
64
|
+
/** A user experience document with its draft and published versions. */
|
|
65
|
+
export interface UserExperienceDocument {
|
|
66
|
+
_id: string;
|
|
67
|
+
builtIn: boolean;
|
|
68
|
+
draft: UserExperienceVersion;
|
|
69
|
+
published?: UserExperienceVersion;
|
|
70
|
+
modified: boolean;
|
|
71
|
+
publishedVersion: number;
|
|
72
|
+
created: string;
|
|
73
|
+
lastUpdated: string;
|
|
74
|
+
lastPublished?: string;
|
|
75
|
+
}
|
|
76
|
+
/** One row of the list of user experiences. */
|
|
77
|
+
export interface UserExperienceListItem {
|
|
78
|
+
_id: string;
|
|
79
|
+
builtIn: boolean;
|
|
80
|
+
name: string;
|
|
81
|
+
experience: ExperienceId;
|
|
82
|
+
status: "draft" | "published" | "modified";
|
|
83
|
+
include: AudienceRules;
|
|
84
|
+
exclude: AudienceRules;
|
|
85
|
+
newHireDays: number;
|
|
86
|
+
/** People the published version reaches; for the built-in, people nothing else reaches. */
|
|
87
|
+
people: number;
|
|
88
|
+
}
|
|
89
|
+
/** Whether one user experience applies to a person, and why. */
|
|
90
|
+
export interface UserExperienceVerdict {
|
|
91
|
+
userExperienceId: string;
|
|
92
|
+
name: string;
|
|
93
|
+
experience: ExperienceId;
|
|
94
|
+
verdict: Verdict | "notPublished";
|
|
95
|
+
reason: string;
|
|
96
|
+
}
|
|
97
|
+
/** Who an unsaved version would reach. */
|
|
98
|
+
export interface UserExperiencePreview {
|
|
99
|
+
reaches: {
|
|
100
|
+
userId: string;
|
|
101
|
+
otherExperiences: ExperienceSummary[];
|
|
102
|
+
}[];
|
|
103
|
+
}
|
|
104
|
+
/** One person's experiences with a verdict per user experience. */
|
|
105
|
+
export interface UserExperienceExplanation {
|
|
106
|
+
experiences: ExperienceSummary[];
|
|
107
|
+
verdicts: UserExperienceVerdict[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get the settings catalog and the label terms.
|
|
111
|
+
* @param {string} authToken Authorization token
|
|
112
|
+
* @returns {Promise<UserExperienceCatalog>}
|
|
113
|
+
*/
|
|
114
|
+
export declare const getUserExperienceCatalog: (authToken: string) => Promise<UserExperienceCatalog>;
|
|
115
|
+
/**
|
|
116
|
+
* List the tenant's user experiences with their status and reach.
|
|
117
|
+
* @param {string} authToken Authorization token
|
|
118
|
+
* @returns {Promise<UserExperienceListItem[]>}
|
|
119
|
+
*/
|
|
120
|
+
export declare const listUserExperiences: (authToken: string) => Promise<UserExperienceListItem[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Create a user experience as a draft.
|
|
123
|
+
* @param {Partial<UserExperienceVersion>} data The draft content
|
|
124
|
+
* @param {string} authToken Authorization token
|
|
125
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
126
|
+
*/
|
|
127
|
+
export declare const createUserExperience: (data: Partial<UserExperienceVersion>, authToken: string) => Promise<UserExperienceDocument>;
|
|
128
|
+
/**
|
|
129
|
+
* Get one user experience with its draft and published versions.
|
|
130
|
+
* @param {string} id The user experience id
|
|
131
|
+
* @param {string} authToken Authorization token
|
|
132
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
133
|
+
*/
|
|
134
|
+
export declare const getUserExperience: (id: string, authToken: string) => Promise<UserExperienceDocument>;
|
|
135
|
+
/**
|
|
136
|
+
* Update the draft of a user experience.
|
|
137
|
+
* @param {string} id The user experience id
|
|
138
|
+
* @param {Partial<UserExperienceVersion>} data The fields to change
|
|
139
|
+
* @param {string} authToken Authorization token
|
|
140
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
141
|
+
*/
|
|
142
|
+
export declare const updateUserExperience: (id: string, data: Partial<UserExperienceVersion>, authToken: string) => Promise<UserExperienceDocument>;
|
|
143
|
+
/**
|
|
144
|
+
* Publish the draft of a user experience.
|
|
145
|
+
* @param {string} id The user experience id
|
|
146
|
+
* @param {string} authToken Authorization token
|
|
147
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
148
|
+
*/
|
|
149
|
+
export declare const publishUserExperience: (id: string, authToken: string) => Promise<UserExperienceDocument>;
|
|
150
|
+
/**
|
|
151
|
+
* Discard the unpublished changes of a user experience.
|
|
152
|
+
* @param {string} id The user experience id
|
|
153
|
+
* @param {string} authToken Authorization token
|
|
154
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
155
|
+
*/
|
|
156
|
+
export declare const discardUserExperienceChanges: (id: string, authToken: string) => Promise<UserExperienceDocument>;
|
|
157
|
+
/**
|
|
158
|
+
* Delete a user experience.
|
|
159
|
+
* @param {string} id The user experience id
|
|
160
|
+
* @param {string} authToken Authorization token
|
|
161
|
+
* @returns {Promise<{ operation: "DONE" }>}
|
|
162
|
+
*/
|
|
163
|
+
export declare const deleteUserExperience: (id: string, authToken: string) => Promise<{
|
|
164
|
+
operation: "DONE";
|
|
165
|
+
}>;
|
|
166
|
+
/**
|
|
167
|
+
* Preview who an unsaved version would reach, and which other published user
|
|
168
|
+
* experiences each of them also gets. Saves nothing.
|
|
169
|
+
* @param {Partial<UserExperienceVersion>} version The version to preview
|
|
170
|
+
* @param {string | undefined} id The user experience being edited, if saved
|
|
171
|
+
* @param {string} authToken Authorization token
|
|
172
|
+
* @returns {Promise<UserExperiencePreview>}
|
|
173
|
+
*/
|
|
174
|
+
export declare const previewUserExperience: (version: Partial<UserExperienceVersion>, id: string | undefined, authToken: string) => Promise<UserExperiencePreview>;
|
|
175
|
+
/**
|
|
176
|
+
* "Check a person": their experiences plus, for each user experience, why it
|
|
177
|
+
* applies or not.
|
|
178
|
+
* @param {string} userId The person to check
|
|
179
|
+
* @param {string} authToken Authorization token
|
|
180
|
+
* @returns {Promise<UserExperienceExplanation>}
|
|
181
|
+
*/
|
|
182
|
+
export declare const explainUserExperiences: (userId: string, authToken: string) => Promise<UserExperienceExplanation>;
|
|
183
|
+
/**
|
|
184
|
+
* Save the signed-in person's choice among their experiences. The server
|
|
185
|
+
* answers 400 unless it is one of theirs.
|
|
186
|
+
* @param {string} userExperienceId The user experience to use
|
|
187
|
+
* @param {string} authToken Authorization token
|
|
188
|
+
* @returns {Promise<void>}
|
|
189
|
+
*/
|
|
190
|
+
export declare const selectUserExperience: (userExperienceId: string, authToken: string) => Promise<void>;
|
|
191
|
+
//# sourceMappingURL=userExperiences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userExperiences.d.ts","sourceRoot":"","sources":["../../../src/lib/userExperiences.ts"],"names":[],"mappings":"AAsBA,sDAAsD;AACtD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd,mDAAmD;AACnD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,CAAC;AAEb,iFAAiF;AACjF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5C,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,KAAK,CAAC;IACvC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,OA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,MAAM,KAChB,OAAO,CAAC,qBAAqB,CAO7B,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,EACd,WAAW,MAAM,KAChB,OAAO,CAAC,yBAAyB,CAKjC,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,MAAM,EACxB,WAAW,MAAM,KAChB,OAAO,CAAC,IAAI,CAOU,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
//
|
|
3
|
+
// User experiences — /api/v1/userexperiences
|
|
4
|
+
//
|
|
5
|
+
// A user experience decides which of the platform's experiences (student,
|
|
6
|
+
// teacher, channel, executive, new hire) a person gets, who it reaches, and
|
|
7
|
+
// how it is labelled. Every call except selectUserExperience requires the
|
|
8
|
+
// Manage user experiences permission; selectUserExperience acts on the signed-in
|
|
9
|
+
// person only. Ids are strings and dates ISO strings over HTTP.
|
|
10
|
+
//
|
|
11
|
+
const BASE = `/api/v1/userexperiences`;
|
|
12
|
+
const call = (request) => new Promise((resolve, reject) => {
|
|
13
|
+
request
|
|
14
|
+
.then((response) => resolve(response.data))
|
|
15
|
+
.catch((error) => reject(error));
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Get the settings catalog and the label terms.
|
|
19
|
+
* @param {string} authToken Authorization token
|
|
20
|
+
* @returns {Promise<UserExperienceCatalog>}
|
|
21
|
+
*/
|
|
22
|
+
export const getUserExperienceCatalog = (authToken) => call(client.get(`${BASE}/catalog`, { headers: { authorization: authToken } }));
|
|
23
|
+
/**
|
|
24
|
+
* List the tenant's user experiences with their status and reach.
|
|
25
|
+
* @param {string} authToken Authorization token
|
|
26
|
+
* @returns {Promise<UserExperienceListItem[]>}
|
|
27
|
+
*/
|
|
28
|
+
export const listUserExperiences = (authToken) => call(client.post(BASE, {}, { headers: { authorization: authToken } }));
|
|
29
|
+
/**
|
|
30
|
+
* Create a user experience as a draft.
|
|
31
|
+
* @param {Partial<UserExperienceVersion>} data The draft content
|
|
32
|
+
* @param {string} authToken Authorization token
|
|
33
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
34
|
+
*/
|
|
35
|
+
export const createUserExperience = (data, authToken) => call(client.put(BASE, { data }, { headers: { authorization: authToken } }));
|
|
36
|
+
/**
|
|
37
|
+
* Get one user experience with its draft and published versions.
|
|
38
|
+
* @param {string} id The user experience id
|
|
39
|
+
* @param {string} authToken Authorization token
|
|
40
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
41
|
+
*/
|
|
42
|
+
export const getUserExperience = (id, authToken) => call(client.get(`${BASE}/${encodeURIComponent(id)}`, {
|
|
43
|
+
headers: { authorization: authToken },
|
|
44
|
+
}));
|
|
45
|
+
/**
|
|
46
|
+
* Update the draft of a user experience.
|
|
47
|
+
* @param {string} id The user experience id
|
|
48
|
+
* @param {Partial<UserExperienceVersion>} data The fields to change
|
|
49
|
+
* @param {string} authToken Authorization token
|
|
50
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
51
|
+
*/
|
|
52
|
+
export const updateUserExperience = (id, data, authToken) => call(client.post(`${BASE}/update`, { id, data }, { headers: { authorization: authToken } }));
|
|
53
|
+
/**
|
|
54
|
+
* Publish the draft of a user experience.
|
|
55
|
+
* @param {string} id The user experience id
|
|
56
|
+
* @param {string} authToken Authorization token
|
|
57
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
58
|
+
*/
|
|
59
|
+
export const publishUserExperience = (id, authToken) => call(client.post(`${BASE}/publish/${encodeURIComponent(id)}`, {}, { headers: { authorization: authToken } }));
|
|
60
|
+
/**
|
|
61
|
+
* Discard the unpublished changes of a user experience.
|
|
62
|
+
* @param {string} id The user experience id
|
|
63
|
+
* @param {string} authToken Authorization token
|
|
64
|
+
* @returns {Promise<UserExperienceDocument>}
|
|
65
|
+
*/
|
|
66
|
+
export const discardUserExperienceChanges = (id, authToken) => call(client.get(`${BASE}/discard/${encodeURIComponent(id)}`, {
|
|
67
|
+
headers: { authorization: authToken },
|
|
68
|
+
}));
|
|
69
|
+
/**
|
|
70
|
+
* Delete a user experience.
|
|
71
|
+
* @param {string} id The user experience id
|
|
72
|
+
* @param {string} authToken Authorization token
|
|
73
|
+
* @returns {Promise<{ operation: "DONE" }>}
|
|
74
|
+
*/
|
|
75
|
+
export const deleteUserExperience = (id, authToken) => call(client.delete(BASE, {
|
|
76
|
+
data: { id },
|
|
77
|
+
headers: { authorization: authToken },
|
|
78
|
+
}));
|
|
79
|
+
/**
|
|
80
|
+
* Preview who an unsaved version would reach, and which other published user
|
|
81
|
+
* experiences each of them also gets. Saves nothing.
|
|
82
|
+
* @param {Partial<UserExperienceVersion>} version The version to preview
|
|
83
|
+
* @param {string | undefined} id The user experience being edited, if saved
|
|
84
|
+
* @param {string} authToken Authorization token
|
|
85
|
+
* @returns {Promise<UserExperiencePreview>}
|
|
86
|
+
*/
|
|
87
|
+
export const previewUserExperience = (version, id, authToken) => call(client.post(`${BASE}/preview`, id === undefined ? { version } : { id, version }, { headers: { authorization: authToken } }));
|
|
88
|
+
/**
|
|
89
|
+
* "Check a person": their experiences plus, for each user experience, why it
|
|
90
|
+
* applies or not.
|
|
91
|
+
* @param {string} userId The person to check
|
|
92
|
+
* @param {string} authToken Authorization token
|
|
93
|
+
* @returns {Promise<UserExperienceExplanation>}
|
|
94
|
+
*/
|
|
95
|
+
export const explainUserExperiences = (userId, authToken) => call(client.get(`${BASE}/explain/${encodeURIComponent(userId)}`, {
|
|
96
|
+
headers: { authorization: authToken },
|
|
97
|
+
}));
|
|
98
|
+
/**
|
|
99
|
+
* Save the signed-in person's choice among their experiences. The server
|
|
100
|
+
* answers 400 unless it is one of theirs.
|
|
101
|
+
* @param {string} userExperienceId The user experience to use
|
|
102
|
+
* @param {string} authToken Authorization token
|
|
103
|
+
* @returns {Promise<void>}
|
|
104
|
+
*/
|
|
105
|
+
export const selectUserExperience = (userExperienceId, authToken) => call(client.post(`${BASE}/select`, { userExperienceId }, { headers: { authorization: authToken } })).then(() => undefined);
|
|
106
|
+
//# sourceMappingURL=userExperiences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userExperiences.js","sourceRoot":"","sources":["../../../src/lib/userExperiences.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAC1E,iFAAiF;AACjF,gEAAgE;AAChE,EAAE;AAEF,MAAM,IAAI,GAAG,yBAAyB,CAAC;AAEvC,MAAM,IAAI,GAAG,CAAI,OAAkC,EAAc,EAAE,CACjE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,OAAO;SACJ,IAAI,CAAC,CAAC,QAA0B,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SAC5D,KAAK,CAAC,CAAC,KAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAkIL;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,SAAiB,EACe,EAAE,CAClC,IAAI,CACF,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,CAAC,CACzE,CAAC;AAEJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,SAAiB,EACkB,EAAE,CACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAoC,E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+1,4 @@
|
|
|
1
|
+
import type { ExperienceSummary } from "./userExperiences.js";
|
|
1
2
|
/**
|
|
2
3
|
* Get the applications the requesting user is entitled to. Returns the
|
|
3
4
|
* intersection of the tenant's licensed applications and the user's group
|
|
@@ -9,6 +10,17 @@
|
|
|
9
10
|
export declare const getUserApplications: (token: string) => Promise<{
|
|
10
11
|
applications: string[];
|
|
11
12
|
}>;
|
|
13
|
+
/** A personal API key as listed: never carries the key itself. */
|
|
14
|
+
export interface APITokenView {
|
|
15
|
+
_id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
expirationDate: string;
|
|
20
|
+
lastUsedAt: string | null;
|
|
21
|
+
scopes: string[];
|
|
22
|
+
tokenHint: string | null;
|
|
23
|
+
}
|
|
12
24
|
/**
|
|
13
25
|
* Add a new API Token
|
|
14
26
|
* @param {string} name Name of the token
|
|
@@ -19,9 +31,13 @@ export declare const getUserApplications: (token: string) => Promise<{
|
|
|
19
31
|
* id must be a permission the caller currently holds; the server answers 400
|
|
20
32
|
* "Invalid token scope" otherwise. An empty list is rejected too — the only
|
|
21
33
|
* way to get full access is to not ask for a scope.
|
|
22
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<APITokenView & { token: string }>} The new key's view plus
|
|
35
|
+
* `token`, the key itself. It is returned this once and never again: the
|
|
36
|
+
* server keeps only a hint, so show or store it now.
|
|
23
37
|
*/
|
|
24
|
-
export declare const addAPIToken: (name: string, expiration: Date, token: string, scopes?: string[] | null) => Promise<
|
|
38
|
+
export declare const addAPIToken: (name: string, expiration: Date, token: string, scopes?: string[] | null) => Promise<APITokenView & {
|
|
39
|
+
token: string;
|
|
40
|
+
}>;
|
|
25
41
|
/**
|
|
26
42
|
* Confirm email address
|
|
27
43
|
* @param {string} validationCode The code was provided to the user in advance by email
|
|
@@ -65,11 +81,11 @@ export declare const createAccount: (email: string, firstName: string, lastName:
|
|
|
65
81
|
export declare const createUserAccount: (email: string, firstName: string, lastName: string, password: string, token: string) => Promise<object>;
|
|
66
82
|
/**
|
|
67
83
|
* Delete an existing API token
|
|
68
|
-
* @param {string}
|
|
84
|
+
* @param {string} id The record id (`_id`) of the API token, as listed by getAPITokens
|
|
69
85
|
* @param {string} authToken Authorization token
|
|
70
|
-
* @returns {Promise<string>}
|
|
86
|
+
* @returns {Promise<string>} The id that was deleted
|
|
71
87
|
*/
|
|
72
|
-
export declare const deleteAPIToken: (
|
|
88
|
+
export declare const deleteAPIToken: (id: string, authToken: string) => Promise<string>;
|
|
73
89
|
/**
|
|
74
90
|
* Delete existing users
|
|
75
91
|
* @param {string[]} userIds The ID of the users to be deleted
|
|
@@ -78,11 +94,11 @@ export declare const deleteAPIToken: (token: string, authToken: string) => Promi
|
|
|
78
94
|
*/
|
|
79
95
|
export declare const deleteUsers: (userIds: string[], token: string) => Promise<object>;
|
|
80
96
|
/**
|
|
81
|
-
* Get all the API tokens
|
|
97
|
+
* Get all the API tokens (views: the key itself is never returned)
|
|
82
98
|
* @param {string} token Authorization token
|
|
83
|
-
* @returns {Promise<
|
|
99
|
+
* @returns {Promise<APITokenView[]>}
|
|
84
100
|
*/
|
|
85
|
-
export declare const getAPITokens: (token: string) => Promise<
|
|
101
|
+
export declare const getAPITokens: (token: string) => Promise<APITokenView[]>;
|
|
86
102
|
/**
|
|
87
103
|
* Get the specified user account by Id. It returns a promise
|
|
88
104
|
* @param {string} id Id of the user for which information is being requested
|
|
@@ -106,6 +122,16 @@ export declare const getUserInformation: (userId: string, category: string, toke
|
|
|
106
122
|
* @returns {Promise<object>}
|
|
107
123
|
*/
|
|
108
124
|
export declare const getUsers: (filter: object, fields: string[], token: string) => Promise<object>;
|
|
125
|
+
/**
|
|
126
|
+
* Get the list of users, each with the user experiences they get. Only callers
|
|
127
|
+
* with Manage users receive `experiences`.
|
|
128
|
+
* @param {object} filter Filter to select the users. Ex: {firstName : "John"}
|
|
129
|
+
* @param {string} token Authorization token
|
|
130
|
+
* @returns {Promise<Array<Record<string, unknown> & { experiences: ExperienceSummary[] }>>}
|
|
131
|
+
*/
|
|
132
|
+
export declare const getUsersWithExperiences: (filter: object, token: string) => Promise<(Record<string, unknown> & {
|
|
133
|
+
experiences: ExperienceSummary[];
|
|
134
|
+
})[]>;
|
|
109
135
|
/**
|
|
110
136
|
* Invite other users to join the same account
|
|
111
137
|
* @param {string[]} invitees List of emails of the invitees
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/lib/users.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/lib/users.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,KACZ,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAapC,CAAC;AAEF,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,YAAY,IAAI,EAChB,OAAO,MAAM,EACb,SAAQ,MAAM,EAAE,GAAG,IAAW,KAC7B,OAAO,CAAC,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA4B1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,MAAM,KAAG,OA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AM,MAAM,EACZ,UAAU,MAAM,KACf,OAAO,CAAC,MAAM,CAgBhB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACpC,OAAO,MAAM,EACb,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAoBhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAiBhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,EACd,UAAU,MAAM,EAChB,MAAM,MAAM,EACZ,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAiBhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,kBAAkB,MAAM,EACxB,UAAU,MAAM,EAChB,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAsBhB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,EACd,QAAQ,MAAM,EAAE,EAChB,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAqBhB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,EAChB,aAAa,MAAM,EACnB,OAAO,MAAM,KACZ,OAAO,CAAC,MAAM,CAqBhB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACpC,OAAO,MAAM,EACb,MAAM,MAAM,KACX,OAAO,CAAC,MAAM,CAkBhB,CAAC"}
|
package/dist/esm/lib/users.js
CHANGED
|
@@ -31,7 +31,9 @@ export const getUserApplications = (token) => {
|
|
|
31
31
|
* id must be a permission the caller currently holds; the server answers 400
|
|
32
32
|
* "Invalid token scope" otherwise. An empty list is rejected too — the only
|
|
33
33
|
* way to get full access is to not ask for a scope.
|
|
34
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<APITokenView & { token: string }>} The new key's view plus
|
|
35
|
+
* `token`, the key itself. It is returned this once and never again: the
|
|
36
|
+
* server keeps only a hint, so show or store it now.
|
|
35
37
|
*/
|
|
36
38
|
export const addAPIToken = (name, expiration, token, scopes = null) => {
|
|
37
39
|
return new Promise((resolve, reject) => {
|
|
@@ -204,21 +206,21 @@ export const createUserAccount = (email, firstName, lastName, password, token) =
|
|
|
204
206
|
};
|
|
205
207
|
/**
|
|
206
208
|
* Delete an existing API token
|
|
207
|
-
* @param {string}
|
|
209
|
+
* @param {string} id The record id (`_id`) of the API token, as listed by getAPITokens
|
|
208
210
|
* @param {string} authToken Authorization token
|
|
209
|
-
* @returns {Promise<string>}
|
|
211
|
+
* @returns {Promise<string>} The id that was deleted
|
|
210
212
|
*/
|
|
211
|
-
export const deleteAPIToken = (
|
|
213
|
+
export const deleteAPIToken = (id, authToken) => {
|
|
212
214
|
return new Promise((resolve, reject) => {
|
|
213
215
|
const deleteTokenRequest = client.delete(`/api/v1/users/user/token`, {
|
|
214
216
|
headers: { authorization: authToken },
|
|
215
217
|
data: {
|
|
216
|
-
|
|
218
|
+
id: id,
|
|
217
219
|
},
|
|
218
220
|
});
|
|
219
221
|
deleteTokenRequest
|
|
220
222
|
.then(() => {
|
|
221
|
-
resolve(
|
|
223
|
+
resolve(id);
|
|
222
224
|
})
|
|
223
225
|
.catch((error) => {
|
|
224
226
|
reject(error);
|
|
@@ -249,9 +251,9 @@ export const deleteUsers = (userIds, token) => {
|
|
|
249
251
|
});
|
|
250
252
|
};
|
|
251
253
|
/**
|
|
252
|
-
* Get all the API tokens
|
|
254
|
+
* Get all the API tokens (views: the key itself is never returned)
|
|
253
255
|
* @param {string} token Authorization token
|
|
254
|
-
* @returns {Promise<
|
|
256
|
+
* @returns {Promise<APITokenView[]>}
|
|
255
257
|
*/
|
|
256
258
|
export const getAPITokens = (token) => {
|
|
257
259
|
return new Promise((resolve, reject) => {
|
|
@@ -338,6 +340,31 @@ export const getUsers = (filter, fields, token) => {
|
|
|
338
340
|
});
|
|
339
341
|
});
|
|
340
342
|
};
|
|
343
|
+
/**
|
|
344
|
+
* Get the list of users, each with the user experiences they get. Only callers
|
|
345
|
+
* with Manage users receive `experiences`.
|
|
346
|
+
* @param {object} filter Filter to select the users. Ex: {firstName : "John"}
|
|
347
|
+
* @param {string} token Authorization token
|
|
348
|
+
* @returns {Promise<Array<Record<string, unknown> & { experiences: ExperienceSummary[] }>>}
|
|
349
|
+
*/
|
|
350
|
+
export const getUsersWithExperiences = (filter, token) => {
|
|
351
|
+
return new Promise((resolve, reject) => {
|
|
352
|
+
const requestData = {
|
|
353
|
+
filter: filter,
|
|
354
|
+
include: ["experiences"],
|
|
355
|
+
};
|
|
356
|
+
const request = client.post(`/api/v1/users/`, requestData, {
|
|
357
|
+
headers: { authorization: token },
|
|
358
|
+
});
|
|
359
|
+
request
|
|
360
|
+
.then((response) => {
|
|
361
|
+
resolve(response.data);
|
|
362
|
+
})
|
|
363
|
+
.catch((error) => {
|
|
364
|
+
reject(error);
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
};
|
|
341
368
|
/**
|
|
342
369
|
* Invite other users to join the same account
|
|
343
370
|
* @param {string[]} invitees List of emails of the invitees
|