@23blocks/block-onboarding 1.0.3 → 2.0.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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +413 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/mappers/flow.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/flow.mapper.d.ts.map +1 -0
- package/dist/{lib/mappers/index.js → src/lib/mappers/index.d.ts} +1 -2
- package/dist/src/lib/mappers/index.d.ts.map +1 -0
- package/dist/src/lib/mappers/onboarding.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/onboarding.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/user-identity.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/user-identity.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/user-journey.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/user-journey.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/utils.d.ts +45 -0
- package/dist/src/lib/mappers/utils.d.ts.map +1 -0
- package/dist/src/lib/onboarding.block.d.ts +15 -0
- package/dist/src/lib/onboarding.block.d.ts.map +1 -0
- package/dist/src/lib/services/flows.service.d.ts +14 -0
- package/dist/src/lib/services/flows.service.d.ts.map +1 -0
- package/dist/{lib/services/index.js → src/lib/services/index.d.ts} +1 -2
- package/dist/src/lib/services/index.d.ts.map +1 -0
- package/dist/src/lib/services/onboardings.service.d.ts +13 -0
- package/dist/src/lib/services/onboardings.service.d.ts.map +1 -0
- package/dist/src/lib/services/user-identities.service.d.ts +14 -0
- package/dist/src/lib/services/user-identities.service.d.ts.map +1 -0
- package/dist/src/lib/services/user-journeys.service.d.ts +19 -0
- package/dist/src/lib/services/user-journeys.service.d.ts.map +1 -0
- package/dist/src/lib/types/flow.d.ts +41 -0
- package/dist/src/lib/types/flow.d.ts.map +1 -0
- package/dist/{lib/types/index.js → src/lib/types/index.d.ts} +1 -2
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/onboarding.d.ts +35 -0
- package/dist/src/lib/types/onboarding.d.ts.map +1 -0
- package/dist/src/lib/types/user-identity.d.ts +32 -0
- package/dist/src/lib/types/user-identity.d.ts.map +1 -0
- package/dist/src/lib/types/user-journey.d.ts +35 -0
- package/dist/src/lib/types/user-journey.d.ts.map +1 -0
- package/package.json +10 -8
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/lib/mappers/flow.mapper.js +0 -21
- package/dist/lib/mappers/flow.mapper.js.map +0 -1
- package/dist/lib/mappers/index.js.map +0 -1
- package/dist/lib/mappers/onboarding.mapper.js +0 -19
- package/dist/lib/mappers/onboarding.mapper.js.map +0 -1
- package/dist/lib/mappers/user-identity.mapper.js +0 -20
- package/dist/lib/mappers/user-identity.mapper.js.map +0 -1
- package/dist/lib/mappers/user-journey.mapper.js +0 -22
- package/dist/lib/mappers/user-journey.mapper.js.map +0 -1
- package/dist/lib/mappers/utils.js +0 -117
- package/dist/lib/mappers/utils.js.map +0 -1
- package/dist/lib/onboarding.block.js +0 -22
- package/dist/lib/onboarding.block.js.map +0 -1
- package/dist/lib/services/flows.service.js +0 -67
- package/dist/lib/services/flows.service.js.map +0 -1
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/onboardings.service.js +0 -59
- package/dist/lib/services/onboardings.service.js.map +0 -1
- package/dist/lib/services/user-identities.service.js +0 -59
- package/dist/lib/services/user-identities.service.js.map +0 -1
- package/dist/lib/services/user-journeys.service.js +0 -74
- package/dist/lib/services/user-journeys.service.js.map +0 -1
- package/dist/lib/types/flow.js +0 -3
- package/dist/lib/types/flow.js.map +0 -1
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/onboarding.js +0 -3
- package/dist/lib/types/onboarding.js.map +0 -1
- package/dist/lib/types/user-identity.js +0 -3
- package/dist/lib/types/user-identity.js.map +0 -1
- package/dist/lib/types/user-journey.js +0 -3
- package/dist/lib/types/user-journey.js.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { decodeOne, decodePageResult, decodeMany } from '@23blocks/jsonapi-codec';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse a string value, returning undefined for empty/undefined
|
|
5
|
+
*/ function parseString(value) {
|
|
6
|
+
if (value === null || value === undefined) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const str = String(value);
|
|
10
|
+
return str.length > 0 ? str : undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse a date value
|
|
14
|
+
*/ function parseDate(value) {
|
|
15
|
+
if (value === null || value === undefined) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (value instanceof Date) {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
22
|
+
const date = new Date(value);
|
|
23
|
+
return isNaN(date.getTime()) ? undefined : date;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse a boolean value
|
|
29
|
+
*/ function parseBoolean(value) {
|
|
30
|
+
if (typeof value === 'boolean') {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
if (value === 'true' || value === '1' || value === 1) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse an optional number value
|
|
40
|
+
*/ function parseOptionalNumber(value) {
|
|
41
|
+
if (value === null || value === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const num = Number(value);
|
|
45
|
+
return isNaN(num) ? undefined : num;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Parse entity status
|
|
49
|
+
*/ function parseStatus(value) {
|
|
50
|
+
const status = parseString(value);
|
|
51
|
+
if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {
|
|
52
|
+
return status;
|
|
53
|
+
}
|
|
54
|
+
return 'active';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse user journey status
|
|
58
|
+
*/ function parseJourneyStatus(value) {
|
|
59
|
+
const status = parseString(value);
|
|
60
|
+
if (status === 'active' || status === 'completed' || status === 'abandoned') {
|
|
61
|
+
return status;
|
|
62
|
+
}
|
|
63
|
+
return 'active';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parse array of numbers
|
|
67
|
+
*/ function parseNumberArray(value) {
|
|
68
|
+
if (value === null || value === undefined) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
return value.map(Number).filter((num)=>!isNaN(num));
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse array of objects
|
|
78
|
+
*/ function parseObjectArray(value) {
|
|
79
|
+
if (value === null || value === undefined) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parse object
|
|
89
|
+
*/ function parseObject(value) {
|
|
90
|
+
if (value === null || value === undefined) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const onboardingMapper = {
|
|
100
|
+
type: 'Onboarding',
|
|
101
|
+
map: (resource)=>({
|
|
102
|
+
id: resource.id,
|
|
103
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
104
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
105
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
106
|
+
code: parseString(resource.attributes['code']) || '',
|
|
107
|
+
name: parseString(resource.attributes['name']) || '',
|
|
108
|
+
description: parseString(resource.attributes['description']),
|
|
109
|
+
steps: parseObjectArray(resource.attributes['steps']),
|
|
110
|
+
status: parseStatus(resource.attributes['status']),
|
|
111
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
112
|
+
payload: resource.attributes['payload']
|
|
113
|
+
})
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function createOnboardingsService(transport, _config) {
|
|
117
|
+
return {
|
|
118
|
+
async list (params) {
|
|
119
|
+
const queryParams = {};
|
|
120
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
121
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
122
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
123
|
+
if ((params == null ? void 0 : params.enabled) !== undefined) queryParams['enabled'] = String(params.enabled);
|
|
124
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
125
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
126
|
+
const response = await transport.get('/onboardings', {
|
|
127
|
+
params: queryParams
|
|
128
|
+
});
|
|
129
|
+
return decodePageResult(response, onboardingMapper);
|
|
130
|
+
},
|
|
131
|
+
async get (uniqueId) {
|
|
132
|
+
const response = await transport.get(`/onboardings/${uniqueId}`);
|
|
133
|
+
return decodeOne(response, onboardingMapper);
|
|
134
|
+
},
|
|
135
|
+
async create (data) {
|
|
136
|
+
const response = await transport.post('/onboardings', {
|
|
137
|
+
onboarding: {
|
|
138
|
+
code: data.code,
|
|
139
|
+
name: data.name,
|
|
140
|
+
description: data.description,
|
|
141
|
+
steps: data.steps,
|
|
142
|
+
payload: data.payload
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return decodeOne(response, onboardingMapper);
|
|
146
|
+
},
|
|
147
|
+
async update (uniqueId, data) {
|
|
148
|
+
const response = await transport.put(`/onboardings/${uniqueId}`, {
|
|
149
|
+
onboarding: {
|
|
150
|
+
name: data.name,
|
|
151
|
+
description: data.description,
|
|
152
|
+
steps: data.steps,
|
|
153
|
+
enabled: data.enabled,
|
|
154
|
+
status: data.status,
|
|
155
|
+
payload: data.payload
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return decodeOne(response, onboardingMapper);
|
|
159
|
+
},
|
|
160
|
+
async delete (uniqueId) {
|
|
161
|
+
await transport.delete(`/onboardings/${uniqueId}`);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const flowMapper = {
|
|
167
|
+
type: 'Flow',
|
|
168
|
+
map: (resource)=>({
|
|
169
|
+
id: resource.id,
|
|
170
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
171
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
172
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
173
|
+
onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',
|
|
174
|
+
code: parseString(resource.attributes['code']) || '',
|
|
175
|
+
name: parseString(resource.attributes['name']) || '',
|
|
176
|
+
description: parseString(resource.attributes['description']),
|
|
177
|
+
steps: parseObjectArray(resource.attributes['steps']),
|
|
178
|
+
conditions: parseObject(resource.attributes['conditions']),
|
|
179
|
+
status: parseStatus(resource.attributes['status']),
|
|
180
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
181
|
+
payload: resource.attributes['payload']
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
function createFlowsService(transport, _config) {
|
|
186
|
+
return {
|
|
187
|
+
async list (params) {
|
|
188
|
+
const queryParams = {};
|
|
189
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
190
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
191
|
+
if (params == null ? void 0 : params.onboardingUniqueId) queryParams['onboarding_unique_id'] = params.onboardingUniqueId;
|
|
192
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
193
|
+
if ((params == null ? void 0 : params.enabled) !== undefined) queryParams['enabled'] = String(params.enabled);
|
|
194
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
195
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
196
|
+
const response = await transport.get('/flows', {
|
|
197
|
+
params: queryParams
|
|
198
|
+
});
|
|
199
|
+
return decodePageResult(response, flowMapper);
|
|
200
|
+
},
|
|
201
|
+
async get (uniqueId) {
|
|
202
|
+
const response = await transport.get(`/flows/${uniqueId}`);
|
|
203
|
+
return decodeOne(response, flowMapper);
|
|
204
|
+
},
|
|
205
|
+
async create (data) {
|
|
206
|
+
const response = await transport.post('/flows', {
|
|
207
|
+
flow: {
|
|
208
|
+
onboarding_unique_id: data.onboardingUniqueId,
|
|
209
|
+
code: data.code,
|
|
210
|
+
name: data.name,
|
|
211
|
+
description: data.description,
|
|
212
|
+
steps: data.steps,
|
|
213
|
+
conditions: data.conditions,
|
|
214
|
+
payload: data.payload
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
return decodeOne(response, flowMapper);
|
|
218
|
+
},
|
|
219
|
+
async update (uniqueId, data) {
|
|
220
|
+
const response = await transport.put(`/flows/${uniqueId}`, {
|
|
221
|
+
flow: {
|
|
222
|
+
name: data.name,
|
|
223
|
+
description: data.description,
|
|
224
|
+
steps: data.steps,
|
|
225
|
+
conditions: data.conditions,
|
|
226
|
+
enabled: data.enabled,
|
|
227
|
+
status: data.status,
|
|
228
|
+
payload: data.payload
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return decodeOne(response, flowMapper);
|
|
232
|
+
},
|
|
233
|
+
async delete (uniqueId) {
|
|
234
|
+
await transport.delete(`/flows/${uniqueId}`);
|
|
235
|
+
},
|
|
236
|
+
async listByOnboarding (onboardingUniqueId) {
|
|
237
|
+
const response = await transport.get(`/onboardings/${onboardingUniqueId}/flows`);
|
|
238
|
+
return decodeMany(response, flowMapper);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const userJourneyMapper = {
|
|
244
|
+
type: 'UserJourney',
|
|
245
|
+
map: (resource)=>({
|
|
246
|
+
id: resource.id,
|
|
247
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
248
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
249
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
250
|
+
userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
|
|
251
|
+
onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',
|
|
252
|
+
flowUniqueId: parseString(resource.attributes['flow_unique_id']),
|
|
253
|
+
currentStep: parseOptionalNumber(resource.attributes['current_step']),
|
|
254
|
+
completedSteps: parseNumberArray(resource.attributes['completed_steps']),
|
|
255
|
+
progress: parseOptionalNumber(resource.attributes['progress']),
|
|
256
|
+
startedAt: parseDate(resource.attributes['started_at']) || new Date(),
|
|
257
|
+
completedAt: parseDate(resource.attributes['completed_at']),
|
|
258
|
+
status: parseJourneyStatus(resource.attributes['status']),
|
|
259
|
+
payload: resource.attributes['payload']
|
|
260
|
+
})
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
function createUserJourneysService(transport, _config) {
|
|
264
|
+
return {
|
|
265
|
+
async list (params) {
|
|
266
|
+
const queryParams = {};
|
|
267
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
268
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
269
|
+
if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
|
|
270
|
+
if (params == null ? void 0 : params.onboardingUniqueId) queryParams['onboarding_unique_id'] = params.onboardingUniqueId;
|
|
271
|
+
if (params == null ? void 0 : params.flowUniqueId) queryParams['flow_unique_id'] = params.flowUniqueId;
|
|
272
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
273
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
274
|
+
const response = await transport.get('/user_journeys', {
|
|
275
|
+
params: queryParams
|
|
276
|
+
});
|
|
277
|
+
return decodePageResult(response, userJourneyMapper);
|
|
278
|
+
},
|
|
279
|
+
async get (uniqueId) {
|
|
280
|
+
const response = await transport.get(`/user_journeys/${uniqueId}`);
|
|
281
|
+
return decodeOne(response, userJourneyMapper);
|
|
282
|
+
},
|
|
283
|
+
async start (data) {
|
|
284
|
+
const response = await transport.post('/user_journeys', {
|
|
285
|
+
user_journey: {
|
|
286
|
+
user_unique_id: data.userUniqueId,
|
|
287
|
+
onboarding_unique_id: data.onboardingUniqueId,
|
|
288
|
+
flow_unique_id: data.flowUniqueId,
|
|
289
|
+
payload: data.payload
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return decodeOne(response, userJourneyMapper);
|
|
293
|
+
},
|
|
294
|
+
async completeStep (uniqueId, data) {
|
|
295
|
+
const response = await transport.post(`/user_journeys/${uniqueId}/complete_step`, {
|
|
296
|
+
user_journey: {
|
|
297
|
+
step_number: data.stepNumber,
|
|
298
|
+
step_data: data.stepData
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return decodeOne(response, userJourneyMapper);
|
|
302
|
+
},
|
|
303
|
+
async abandon (uniqueId) {
|
|
304
|
+
const response = await transport.put(`/user_journeys/${uniqueId}/abandon`, {
|
|
305
|
+
user_journey: {}
|
|
306
|
+
});
|
|
307
|
+
return decodeOne(response, userJourneyMapper);
|
|
308
|
+
},
|
|
309
|
+
async getByUser (userUniqueId) {
|
|
310
|
+
const response = await transport.get(`/users/${userUniqueId}/journeys`);
|
|
311
|
+
return decodeMany(response, userJourneyMapper);
|
|
312
|
+
},
|
|
313
|
+
async getProgress (uniqueId) {
|
|
314
|
+
const response = await transport.get(`/user_journeys/${uniqueId}/progress`);
|
|
315
|
+
const data = response;
|
|
316
|
+
return {
|
|
317
|
+
progress: data.data.attributes.progress || 0,
|
|
318
|
+
currentStep: data.data.attributes.current_step,
|
|
319
|
+
completedSteps: data.data.attributes.completed_steps
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const userIdentityMapper = {
|
|
326
|
+
type: 'UserIdentity',
|
|
327
|
+
map: (resource)=>({
|
|
328
|
+
id: resource.id,
|
|
329
|
+
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
330
|
+
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
331
|
+
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
332
|
+
userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
|
|
333
|
+
identityType: parseString(resource.attributes['identity_type']) || '',
|
|
334
|
+
identityValue: parseString(resource.attributes['identity_value']) || '',
|
|
335
|
+
verified: parseBoolean(resource.attributes['verified']),
|
|
336
|
+
verifiedAt: parseDate(resource.attributes['verified_at']),
|
|
337
|
+
status: parseStatus(resource.attributes['status']),
|
|
338
|
+
enabled: parseBoolean(resource.attributes['enabled']),
|
|
339
|
+
payload: resource.attributes['payload']
|
|
340
|
+
})
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
function createUserIdentitiesService(transport, _config) {
|
|
344
|
+
return {
|
|
345
|
+
async list (params) {
|
|
346
|
+
const queryParams = {};
|
|
347
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
348
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
349
|
+
if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
|
|
350
|
+
if (params == null ? void 0 : params.identityType) queryParams['identity_type'] = params.identityType;
|
|
351
|
+
if ((params == null ? void 0 : params.verified) !== undefined) queryParams['verified'] = String(params.verified);
|
|
352
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
353
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
354
|
+
const response = await transport.get('/user_identities', {
|
|
355
|
+
params: queryParams
|
|
356
|
+
});
|
|
357
|
+
return decodePageResult(response, userIdentityMapper);
|
|
358
|
+
},
|
|
359
|
+
async get (uniqueId) {
|
|
360
|
+
const response = await transport.get(`/user_identities/${uniqueId}`);
|
|
361
|
+
return decodeOne(response, userIdentityMapper);
|
|
362
|
+
},
|
|
363
|
+
async create (data) {
|
|
364
|
+
const response = await transport.post('/user_identities', {
|
|
365
|
+
user_identity: {
|
|
366
|
+
user_unique_id: data.userUniqueId,
|
|
367
|
+
identity_type: data.identityType,
|
|
368
|
+
identity_value: data.identityValue,
|
|
369
|
+
payload: data.payload
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return decodeOne(response, userIdentityMapper);
|
|
373
|
+
},
|
|
374
|
+
async verify (uniqueId, data) {
|
|
375
|
+
const response = await transport.post(`/user_identities/${uniqueId}/verify`, {
|
|
376
|
+
user_identity: {
|
|
377
|
+
verification_code: data.verificationCode,
|
|
378
|
+
verification_data: data.verificationData
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
return decodeOne(response, userIdentityMapper);
|
|
382
|
+
},
|
|
383
|
+
async delete (uniqueId) {
|
|
384
|
+
await transport.delete(`/user_identities/${uniqueId}`);
|
|
385
|
+
},
|
|
386
|
+
async listByUser (userUniqueId) {
|
|
387
|
+
const response = await transport.get(`/users/${userUniqueId}/identities`);
|
|
388
|
+
return decodeMany(response, userIdentityMapper);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function createOnboardingBlock(transport, config) {
|
|
394
|
+
return {
|
|
395
|
+
onboardings: createOnboardingsService(transport),
|
|
396
|
+
flows: createFlowsService(transport),
|
|
397
|
+
userJourneys: createUserJourneysService(transport),
|
|
398
|
+
userIdentities: createUserIdentitiesService(transport)
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
const onboardingBlockMetadata = {
|
|
402
|
+
name: 'onboarding',
|
|
403
|
+
version: '0.1.0',
|
|
404
|
+
description: 'User onboarding, flows, journeys, and identity verification',
|
|
405
|
+
resourceTypes: [
|
|
406
|
+
'Onboarding',
|
|
407
|
+
'Flow',
|
|
408
|
+
'UserJourney',
|
|
409
|
+
'UserIdentity'
|
|
410
|
+
]
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export { createFlowsService, createOnboardingBlock, createOnboardingsService, createUserIdentitiesService, createUserJourneysService, flowMapper, onboardingBlockMetadata, onboardingMapper, userIdentityMapper, userJourneyMapper };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createOnboardingBlock, onboardingBlockMetadata } from './lib/onboarding.block';
|
|
2
|
+
export type { OnboardingBlock, OnboardingBlockConfig } from './lib/onboarding.block';
|
|
3
|
+
export type { Onboarding, CreateOnboardingRequest, UpdateOnboardingRequest, ListOnboardingsParams, Flow, CreateFlowRequest, UpdateFlowRequest, ListFlowsParams, UserJourney, UserJourneyStatus, StartJourneyRequest, CompleteStepRequest, ListUserJourneysParams, UserIdentity, CreateUserIdentityRequest, VerifyUserIdentityRequest, ListUserIdentitiesParams, } from './lib/types';
|
|
4
|
+
export type { OnboardingsService, FlowsService, UserJourneysService, UserIdentitiesService, } from './lib/services';
|
|
5
|
+
export { createOnboardingsService, createFlowsService, createUserJourneysService, createUserIdentitiesService, } from './lib/services';
|
|
6
|
+
export { onboardingMapper, flowMapper, userJourneyMapper, userIdentityMapper, } from './lib/mappers';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,YAAY,EAEV,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EAErB,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAEf,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EAEtB,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/flow.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAG1C,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,IAAI,CAkB3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/onboarding.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAgBvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-identity.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/user-identity.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,YAAY,CAiB3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-journey.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/user-journey.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,WAAW,CAmBzD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a string value, returning undefined for empty/undefined
|
|
3
|
+
*/
|
|
4
|
+
export declare function parseString(value: unknown): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Parse a date value
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseDate(value: unknown): Date | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Parse a boolean value
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseBoolean(value: unknown): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parse an array of strings
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseStringArray(value: unknown): string[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a number value
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseNumber(value: unknown): number;
|
|
21
|
+
/**
|
|
22
|
+
* Parse an optional number value
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseOptionalNumber(value: unknown): number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Parse entity status
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseStatus(value: unknown): 'active' | 'inactive' | 'pending' | 'archived' | 'deleted';
|
|
29
|
+
/**
|
|
30
|
+
* Parse user journey status
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseJourneyStatus(value: unknown): 'active' | 'completed' | 'abandoned';
|
|
33
|
+
/**
|
|
34
|
+
* Parse array of numbers
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseNumberArray(value: unknown): number[] | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Parse array of objects
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseObjectArray(value: unknown): Record<string, unknown>[] | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Parse object
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseObject(value: unknown): Record<string, unknown> | undefined;
|
|
45
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAM9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAe1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAQrE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAMtG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAMvF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAQrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,SAAS,CAQtF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAQ/E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
|
|
2
|
+
import { type OnboardingsService, type FlowsService, type UserJourneysService, type UserIdentitiesService } from './services';
|
|
3
|
+
export interface OnboardingBlockConfig extends BlockConfig {
|
|
4
|
+
appId: string;
|
|
5
|
+
tenantId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OnboardingBlock {
|
|
8
|
+
onboardings: OnboardingsService;
|
|
9
|
+
flows: FlowsService;
|
|
10
|
+
userJourneys: UserJourneysService;
|
|
11
|
+
userIdentities: UserIdentitiesService;
|
|
12
|
+
}
|
|
13
|
+
export declare function createOnboardingBlock(transport: Transport, config: OnboardingBlockConfig): OnboardingBlock;
|
|
14
|
+
export declare const onboardingBlockMetadata: BlockMetadata;
|
|
15
|
+
//# sourceMappingURL=onboarding.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.block.d.ts","sourceRoot":"","sources":["../../../src/lib/onboarding.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,kBAAkB,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,EAAE,qBAAqB,CAAC;CACvC;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CAOjB;AAED,eAAO,MAAM,uBAAuB,EAAE,aAUrC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { Flow, CreateFlowRequest, UpdateFlowRequest, ListFlowsParams } from '../types/flow';
|
|
3
|
+
export interface FlowsService {
|
|
4
|
+
list(params?: ListFlowsParams): Promise<PageResult<Flow>>;
|
|
5
|
+
get(uniqueId: string): Promise<Flow>;
|
|
6
|
+
create(data: CreateFlowRequest): Promise<Flow>;
|
|
7
|
+
update(uniqueId: string, data: UpdateFlowRequest): Promise<Flow>;
|
|
8
|
+
delete(uniqueId: string): Promise<void>;
|
|
9
|
+
listByOnboarding(onboardingUniqueId: string): Promise<Flow[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createFlowsService(transport: Transport, _config: {
|
|
12
|
+
appId: string;
|
|
13
|
+
}): FlowsService;
|
|
14
|
+
//# sourceMappingURL=flows.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flows.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/flows.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;CAC/D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CA4DjG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { Onboarding, CreateOnboardingRequest, UpdateOnboardingRequest, ListOnboardingsParams } from '../types/onboarding';
|
|
3
|
+
export interface OnboardingsService {
|
|
4
|
+
list(params?: ListOnboardingsParams): Promise<PageResult<Onboarding>>;
|
|
5
|
+
get(uniqueId: string): Promise<Onboarding>;
|
|
6
|
+
create(data: CreateOnboardingRequest): Promise<Onboarding>;
|
|
7
|
+
update(uniqueId: string, data: UpdateOnboardingRequest): Promise<Onboarding>;
|
|
8
|
+
delete(uniqueId: string): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createOnboardingsService(transport: Transport, _config: {
|
|
11
|
+
appId: string;
|
|
12
|
+
}): OnboardingsService;
|
|
13
|
+
//# sourceMappingURL=onboardings.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboardings.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/onboardings.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7E,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAmD7G"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { UserIdentity, CreateUserIdentityRequest, VerifyUserIdentityRequest, ListUserIdentitiesParams } from '../types/user-identity';
|
|
3
|
+
export interface UserIdentitiesService {
|
|
4
|
+
list(params?: ListUserIdentitiesParams): Promise<PageResult<UserIdentity>>;
|
|
5
|
+
get(uniqueId: string): Promise<UserIdentity>;
|
|
6
|
+
create(data: CreateUserIdentityRequest): Promise<UserIdentity>;
|
|
7
|
+
verify(uniqueId: string, data: VerifyUserIdentityRequest): Promise<UserIdentity>;
|
|
8
|
+
delete(uniqueId: string): Promise<void>;
|
|
9
|
+
listByUser(userUniqueId: string): Promise<UserIdentity[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare function createUserIdentitiesService(transport: Transport, _config: {
|
|
12
|
+
appId: string;
|
|
13
|
+
}): UserIdentitiesService;
|
|
14
|
+
//# sourceMappingURL=user-identities.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-identities.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/user-identities.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3E,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACjF,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAC3D;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,CAoDnH"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Transport, PageResult } from '@23blocks/contracts';
|
|
2
|
+
import type { UserJourney, StartJourneyRequest, CompleteStepRequest, ListUserJourneysParams } from '../types/user-journey';
|
|
3
|
+
export interface UserJourneysService {
|
|
4
|
+
list(params?: ListUserJourneysParams): Promise<PageResult<UserJourney>>;
|
|
5
|
+
get(uniqueId: string): Promise<UserJourney>;
|
|
6
|
+
start(data: StartJourneyRequest): Promise<UserJourney>;
|
|
7
|
+
completeStep(uniqueId: string, data: CompleteStepRequest): Promise<UserJourney>;
|
|
8
|
+
abandon(uniqueId: string): Promise<UserJourney>;
|
|
9
|
+
getByUser(userUniqueId: string): Promise<UserJourney[]>;
|
|
10
|
+
getProgress(uniqueId: string): Promise<{
|
|
11
|
+
progress: number;
|
|
12
|
+
currentStep?: number;
|
|
13
|
+
completedSteps?: number[];
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createUserJourneysService(transport: Transport, _config: {
|
|
17
|
+
appId: string;
|
|
18
|
+
}): UserJourneysService;
|
|
19
|
+
//# sourceMappingURL=user-journeys.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-journeys.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/user-journeys.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACxE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,KAAK,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACvD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChF,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChD,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC/G;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAiE/G"}
|