@explorins/pers-sdk 2.1.42 → 2.2.0-alpha.1
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/chunks/{pers-sdk-DxYmXQcW.js → pers-sdk-CBRtrG03.js} +458 -4
- package/dist/chunks/pers-sdk-CBRtrG03.js.map +1 -0
- package/dist/chunks/{pers-sdk-DeFxjuRB.cjs → pers-sdk-DcNDMx1Y.cjs} +457 -2
- package/dist/chunks/pers-sdk-DcNDMx1Y.cjs.map +1 -0
- package/dist/core/events/event-types.d.ts +5 -1
- package/dist/core/events/event-types.d.ts.map +1 -1
- package/dist/core.cjs +2 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/custom-field/api/custom-field-api.d.ts +58 -0
- package/dist/custom-field/api/custom-field-api.d.ts.map +1 -0
- package/dist/custom-field/index.d.ts +2 -0
- package/dist/custom-field/index.d.ts.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/managers/custom-field-definition-manager.d.ts +317 -0
- package/dist/managers/custom-field-definition-manager.d.ts.map +1 -0
- package/dist/managers/index.d.ts +1 -0
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/dist/package.json +2 -2
- package/dist/pers-sdk.d.ts +28 -1
- package/dist/pers-sdk.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/pers-sdk-DeFxjuRB.cjs.map +0 -1
- package/dist/chunks/pers-sdk-DxYmXQcW.js.map +0 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { PersApiClient } from '../core/pers-api-client';
|
|
2
|
+
import { PersEventEmitter } from '../core/events';
|
|
3
|
+
import { CustomFieldDefinitionDTO, CreateCustomFieldDefinitionDTO, UpdateCustomFieldDefinitionDTO, CustomFieldEntityType, CustomFieldSelectOption, type FieldDefinition, type ValidationErrorDetail } from '@explorins/pers-shared';
|
|
4
|
+
export type { CustomFieldDefinitionDTO, CreateCustomFieldDefinitionDTO, UpdateCustomFieldDefinitionDTO, CustomFieldEntityType, CustomFieldSelectOption, FieldDefinition, ValidationErrorDetail, };
|
|
5
|
+
/**
|
|
6
|
+
* Options for querying custom field definitions
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomFieldQueryOptions {
|
|
9
|
+
/** Filter by entity type (default: 'user') */
|
|
10
|
+
entityType?: CustomFieldEntityType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Custom Field Definition Manager - Manage tenant-specific custom fields
|
|
14
|
+
*
|
|
15
|
+
* Provides CRUD operations for custom field definitions that extend the built-in
|
|
16
|
+
* user profile fields. Custom fields are defined per-tenant and can be used for
|
|
17
|
+
* additional user data collection, redemption requirements, and form validation.
|
|
18
|
+
*
|
|
19
|
+
* @group Managers
|
|
20
|
+
* @category Custom Fields
|
|
21
|
+
*
|
|
22
|
+
* @example Basic Operations
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // List all user custom fields
|
|
25
|
+
* const fields = await sdk.customFields.getDefinitions();
|
|
26
|
+
*
|
|
27
|
+
* // Create a new custom field
|
|
28
|
+
* const field = await sdk.customFields.createDefinition({
|
|
29
|
+
* key: 'employee_id',
|
|
30
|
+
* label: 'Employee ID',
|
|
31
|
+
* fieldType: 'text',
|
|
32
|
+
* validation: { required: true, pattern: '^E[0-9]{5}$' }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Update a field
|
|
36
|
+
* await sdk.customFields.updateDefinition(field.id, {
|
|
37
|
+
* label: 'Company Employee ID'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Delete a field
|
|
41
|
+
* await sdk.customFields.deleteDefinition(field.id);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Validation
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // Validate user custom data against definitions
|
|
47
|
+
* const definitions = await sdk.customFields.getDefinitions();
|
|
48
|
+
* const errors = sdk.customFields.validateUserData(
|
|
49
|
+
* { employee_id: 'INVALID' },
|
|
50
|
+
* definitions
|
|
51
|
+
* );
|
|
52
|
+
* if (errors.length > 0) {
|
|
53
|
+
* console.log('Validation errors:', errors);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class CustomFieldDefinitionManager {
|
|
58
|
+
private events?;
|
|
59
|
+
private readonly api;
|
|
60
|
+
constructor(apiClient: PersApiClient, events?: PersEventEmitter | undefined);
|
|
61
|
+
/**
|
|
62
|
+
* List all custom field definitions for the tenant
|
|
63
|
+
*
|
|
64
|
+
* Retrieves all custom field definitions, optionally filtered by entity type.
|
|
65
|
+
* Results are sorted by sortOrder (ascending).
|
|
66
|
+
*
|
|
67
|
+
* @param options - Query options including entity type filter
|
|
68
|
+
* @returns Array of custom field definitions
|
|
69
|
+
*
|
|
70
|
+
* @example List All User Fields
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const fields = await sdk.customFields.getDefinitions();
|
|
73
|
+
* console.log(`Found ${fields.length} custom fields`);
|
|
74
|
+
*
|
|
75
|
+
* fields.forEach(field => {
|
|
76
|
+
* console.log(`${field.key}: ${field.label} (${field.fieldType})`);
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @example Filter by Entity Type
|
|
81
|
+
* ```typescript
|
|
82
|
+
* // Get only business custom fields
|
|
83
|
+
* const businessFields = await sdk.customFields.getDefinitions({
|
|
84
|
+
* entityType: 'business'
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
getDefinitions(options?: CustomFieldQueryOptions): Promise<CustomFieldDefinitionDTO[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Get a single custom field definition by ID
|
|
91
|
+
*
|
|
92
|
+
* @param id - The UUID of the custom field definition
|
|
93
|
+
* @returns The custom field definition
|
|
94
|
+
* @throws {PersApiError} When definition not found (404)
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* try {
|
|
99
|
+
* const field = await sdk.customFields.getDefinition('uuid-here');
|
|
100
|
+
* console.log('Field:', field.label);
|
|
101
|
+
* } catch (error) {
|
|
102
|
+
* if (error.statusCode === 404) {
|
|
103
|
+
* console.log('Field not found');
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
getDefinition(id: string): Promise<CustomFieldDefinitionDTO>;
|
|
109
|
+
/**
|
|
110
|
+
* Create a new custom field definition
|
|
111
|
+
*
|
|
112
|
+
* Creates a new custom field for the tenant. The field key must be unique
|
|
113
|
+
* within the tenant and entity type combination.
|
|
114
|
+
*
|
|
115
|
+
* @param data - The field definition data
|
|
116
|
+
* @returns The created custom field definition
|
|
117
|
+
* @throws {PersApiError} When key already exists (409) or validation fails (400)
|
|
118
|
+
*
|
|
119
|
+
* @example Text Field with Pattern
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const employeeIdField = await sdk.customFields.createDefinition({
|
|
122
|
+
* key: 'employee_id',
|
|
123
|
+
* label: 'Employee ID',
|
|
124
|
+
* description: 'Your company employee ID (E + 5 digits)',
|
|
125
|
+
* fieldType: 'text',
|
|
126
|
+
* validation: {
|
|
127
|
+
* required: true,
|
|
128
|
+
* pattern: '^E[0-9]{5}$',
|
|
129
|
+
* patternMessage: 'Must be E followed by 5 digits'
|
|
130
|
+
* },
|
|
131
|
+
* sortOrder: 1
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example Date Field with Comparison
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const checkOutField = await sdk.customFields.createDefinition({
|
|
138
|
+
* key: 'check_out',
|
|
139
|
+
* label: 'Check-out Date',
|
|
140
|
+
* fieldType: 'date',
|
|
141
|
+
* validation: {
|
|
142
|
+
* required: true,
|
|
143
|
+
* comparisons: [
|
|
144
|
+
* { field: 'check_in', operator: '>', message: 'Must be after check-in' }
|
|
145
|
+
* ]
|
|
146
|
+
* },
|
|
147
|
+
* sortOrder: 2
|
|
148
|
+
* });
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example Select Field with Static Options
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const departmentField = await sdk.customFields.createDefinition({
|
|
154
|
+
* key: 'department',
|
|
155
|
+
* label: 'Department',
|
|
156
|
+
* fieldType: 'select',
|
|
157
|
+
* selectOptions: [
|
|
158
|
+
* { value: 'engineering', label: 'Engineering' },
|
|
159
|
+
* { value: 'sales', label: 'Sales' },
|
|
160
|
+
* { value: 'hr', label: 'Human Resources' }
|
|
161
|
+
* ],
|
|
162
|
+
* validation: { required: true }
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @example Select Field with Dynamic Options
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const hotelField = await sdk.customFields.createDefinition({
|
|
169
|
+
* key: 'preferred_hotel',
|
|
170
|
+
* label: 'Preferred Hotel',
|
|
171
|
+
* fieldType: 'select',
|
|
172
|
+
* selectOptionsSource: {
|
|
173
|
+
* entity: 'business',
|
|
174
|
+
* valueField: 'id',
|
|
175
|
+
* labelField: 'name',
|
|
176
|
+
* filter: { tags: ['hotel'], isActive: true }
|
|
177
|
+
* },
|
|
178
|
+
* validation: { required: true }
|
|
179
|
+
* });
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
createDefinition(data: CreateCustomFieldDefinitionDTO): Promise<CustomFieldDefinitionDTO>;
|
|
183
|
+
/**
|
|
184
|
+
* Update an existing custom field definition
|
|
185
|
+
*
|
|
186
|
+
* Updates a custom field definition. Note that key and entityType cannot
|
|
187
|
+
* be changed after creation.
|
|
188
|
+
*
|
|
189
|
+
* @param id - The UUID of the custom field definition to update
|
|
190
|
+
* @param data - The fields to update (partial update supported)
|
|
191
|
+
* @returns The updated custom field definition
|
|
192
|
+
* @throws {PersApiError} When definition not found (404) or validation fails (400)
|
|
193
|
+
*
|
|
194
|
+
* @example Update Label and Validation
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const updated = await sdk.customFields.updateDefinition('uuid-here', {
|
|
197
|
+
* label: 'Employee ID (Required)',
|
|
198
|
+
* validation: {
|
|
199
|
+
* required: true,
|
|
200
|
+
* minLength: 6,
|
|
201
|
+
* maxLength: 6
|
|
202
|
+
* }
|
|
203
|
+
* });
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example Update Sort Order
|
|
207
|
+
* ```typescript
|
|
208
|
+
* await sdk.customFields.updateDefinition('uuid-here', {
|
|
209
|
+
* sortOrder: 5
|
|
210
|
+
* });
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
updateDefinition(id: string, data: UpdateCustomFieldDefinitionDTO): Promise<CustomFieldDefinitionDTO>;
|
|
214
|
+
/**
|
|
215
|
+
* Delete a custom field definition (soft delete)
|
|
216
|
+
*
|
|
217
|
+
* Soft deletes a custom field definition. Existing user data in customData
|
|
218
|
+
* is preserved, but the field will no longer appear in forms or validation.
|
|
219
|
+
*
|
|
220
|
+
* ⚠️ Consider the impact on existing user data before deleting.
|
|
221
|
+
*
|
|
222
|
+
* @param id - The UUID of the custom field definition to delete
|
|
223
|
+
* @throws {PersApiError} When definition not found (404)
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* try {
|
|
228
|
+
* await sdk.customFields.deleteDefinition('uuid-here');
|
|
229
|
+
* console.log('Field deleted');
|
|
230
|
+
* } catch (error) {
|
|
231
|
+
* console.log('Failed to delete:', error.message);
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
deleteDefinition(id: string): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Resolve dynamic select options for a field
|
|
238
|
+
*
|
|
239
|
+
* For fields with selectOptionsSource (dynamic options from entities),
|
|
240
|
+
* this resolves the actual options by querying the source entity.
|
|
241
|
+
*
|
|
242
|
+
* @param id - The UUID of the custom field definition
|
|
243
|
+
* @returns Array of select options
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* const field = await sdk.customFields.getDefinition('hotel-field-id');
|
|
248
|
+
*
|
|
249
|
+
* if (field.selectOptionsSource) {
|
|
250
|
+
* // Options come from entity - need to resolve
|
|
251
|
+
* const options = await sdk.customFields.resolveSelectOptions(field.id);
|
|
252
|
+
* console.log('Available hotels:', options);
|
|
253
|
+
* } else {
|
|
254
|
+
* // Static options
|
|
255
|
+
* console.log('Options:', field.selectOptions);
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
resolveSelectOptions(id: string): Promise<CustomFieldSelectOption[]>;
|
|
260
|
+
/**
|
|
261
|
+
* Validate user custom data against field definitions
|
|
262
|
+
*
|
|
263
|
+
* Client-side validation using the same rules as the backend. Use this
|
|
264
|
+
* to validate form data before submission.
|
|
265
|
+
*
|
|
266
|
+
* @param data - User's custom data (key-value pairs)
|
|
267
|
+
* @param definitions - Custom field definitions to validate against
|
|
268
|
+
* @returns Array of validation errors (empty if valid)
|
|
269
|
+
*
|
|
270
|
+
* @example Form Validation
|
|
271
|
+
* ```typescript
|
|
272
|
+
* const definitions = await sdk.customFields.getDefinitions();
|
|
273
|
+
* const formData = {
|
|
274
|
+
* employee_id: 'E123', // Missing a digit
|
|
275
|
+
* department: 'engineering'
|
|
276
|
+
* };
|
|
277
|
+
*
|
|
278
|
+
* const errors = sdk.customFields.validateUserData(formData, definitions);
|
|
279
|
+
* if (errors.length > 0) {
|
|
280
|
+
* errors.forEach(err => {
|
|
281
|
+
* console.log(`${err.field}: ${err.message}`);
|
|
282
|
+
* });
|
|
283
|
+
* return; // Don't submit
|
|
284
|
+
* }
|
|
285
|
+
*
|
|
286
|
+
* // No errors, safe to submit
|
|
287
|
+
* await sdk.users.updateCurrentUser({ customData: formData });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
validateUserData(data: Record<string, unknown>, definitions: CustomFieldDefinitionDTO[]): ValidationErrorDetail[];
|
|
291
|
+
/**
|
|
292
|
+
* Validate a single field value
|
|
293
|
+
*
|
|
294
|
+
* Validates a single value against a field's rules. Useful for
|
|
295
|
+
* real-time validation as the user types.
|
|
296
|
+
*
|
|
297
|
+
* @param value - The value to validate
|
|
298
|
+
* @param definition - The field definition
|
|
299
|
+
* @returns Validation error or null if valid
|
|
300
|
+
*
|
|
301
|
+
* @example Real-time Validation
|
|
302
|
+
* ```typescript
|
|
303
|
+
* const employeeIdField = definitions.find(d => d.key === 'employee_id');
|
|
304
|
+
*
|
|
305
|
+
* const handleBlur = (value: string) => {
|
|
306
|
+
* const error = sdk.customFields.validateFieldValue(value, employeeIdField);
|
|
307
|
+
* if (error) {
|
|
308
|
+
* setFieldError('employee_id', error.message);
|
|
309
|
+
* } else {
|
|
310
|
+
* clearFieldError('employee_id');
|
|
311
|
+
* }
|
|
312
|
+
* };
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
validateFieldValue(value: unknown, definition: CustomFieldDefinitionDTO): ValidationErrorDetail | null;
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=custom-field-definition-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-field-definition-manager.d.ts","sourceRoot":"","sources":["../../src/managers/custom-field-definition-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,uBAAuB,EAGvB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,wBAAwB,EACxB,8BAA8B,EAC9B,8BA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CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,EAAE,wBAAwB,EAAE,GACtC,qBAAqB,EAAE;IAY1B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,kBAAkB,CAChB,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,wBAAwB,GACnC,qBAAqB,GAAG,IAAI;CAchC"}
|
package/dist/managers/index.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ export { DonationManager } from './donation-manager';
|
|
|
22
22
|
export { TriggerSourceManager } from './trigger-source-manager';
|
|
23
23
|
export { WebhookManager } from './webhook-manager';
|
|
24
24
|
export { WalletEventsManager, type WalletEventsConfig } from './events-manager';
|
|
25
|
+
export { CustomFieldDefinitionManager, type CustomFieldQueryOptions } from './custom-field-definition-manager';
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/managers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OA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,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persSdk = require('./chunks/pers-sdk-
|
|
3
|
+
var persSdk = require('./chunks/pers-sdk-DcNDMx1Y.cjs');
|
|
4
4
|
var persShared = require('@explorins/pers-shared');
|
|
5
5
|
var nodeHttpClient = require('./chunks/node-http-client-D_avaa5F.cjs');
|
|
6
6
|
require('./chunks/index-C4K-jkRO.cjs');
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as StaticJwtAuthProvider, P as PersSDK } from './chunks/pers-sdk-
|
|
1
|
+
import { j as StaticJwtAuthProvider, P as PersSDK } from './chunks/pers-sdk-CBRtrG03.js';
|
|
2
2
|
import { AccountOwnerType } from '@explorins/pers-shared';
|
|
3
3
|
export { AccountOwnerType } from '@explorins/pers-shared';
|
|
4
4
|
import { N as NodeHttpClientAdapter } from './chunks/node-http-client-DloDLfm9.js';
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorins/pers-sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"description": "Platform-agnostic SDK for PERS (Phygital Experience Rewards System) - Core business logic and API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
135
|
"@explorins/pers-sdk": "^2.1.32",
|
|
136
|
-
"@explorins/pers-shared": "^2.1.
|
|
136
|
+
"@explorins/pers-shared": "^2.1.167",
|
|
137
137
|
"@explorins/web3-ts": "^0.3.88",
|
|
138
138
|
"@explorins/web3-types": "^1.2.0",
|
|
139
139
|
"ethers": "^6.15.0"
|
package/dist/pers-sdk.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ import { PersConfig } from './core/pers-config';
|
|
|
170
170
|
import { PersApiClient } from './core/pers-api-client';
|
|
171
171
|
import { PersEventEmitter } from './core/events';
|
|
172
172
|
import { UserDTO } from '@explorins/pers-shared';
|
|
173
|
-
import { AuthManager, UserManager, UserStatusManager, TokenManager, BusinessManager, CampaignManager, RedemptionManager, TransactionManager, PurchaseManager, FileManager, TenantManager, ApiKeyManager, AnalyticsManager, DonationManager, TriggerSourceManager, WebhookManager, WalletEventsManager } from './managers';
|
|
173
|
+
import { AuthManager, UserManager, UserStatusManager, TokenManager, BusinessManager, CampaignManager, RedemptionManager, TransactionManager, PurchaseManager, FileManager, TenantManager, ApiKeyManager, AnalyticsManager, DonationManager, TriggerSourceManager, WebhookManager, WalletEventsManager, CustomFieldDefinitionManager } from './managers';
|
|
174
174
|
import type { WalletEventsConfig } from './managers';
|
|
175
175
|
/**
|
|
176
176
|
* PERS SDK - Main SDK class with domain managers
|
|
@@ -249,6 +249,7 @@ export declare class PersSDK {
|
|
|
249
249
|
private _triggerSources?;
|
|
250
250
|
private _webhooks?;
|
|
251
251
|
private _walletEvents?;
|
|
252
|
+
private _customFields?;
|
|
252
253
|
private walletEventsConfig?;
|
|
253
254
|
/**
|
|
254
255
|
* Creates a new PERS SDK instance
|
|
@@ -645,6 +646,32 @@ export declare class PersSDK {
|
|
|
645
646
|
* @see {@link WebhookManager} for detailed documentation
|
|
646
647
|
*/
|
|
647
648
|
get webhooks(): WebhookManager;
|
|
649
|
+
/**
|
|
650
|
+
* Custom Field Definition Manager - Manage tenant-specific custom fields
|
|
651
|
+
*
|
|
652
|
+
* Provides CRUD operations for custom field definitions that extend the built-in
|
|
653
|
+
* user profile fields. Custom fields are tenant-specific and support validation.
|
|
654
|
+
*
|
|
655
|
+
* @returns CustomFieldDefinitionManager instance
|
|
656
|
+
*
|
|
657
|
+
* @example Basic Operations
|
|
658
|
+
* ```typescript
|
|
659
|
+
* // List all custom fields
|
|
660
|
+
* const fields = await sdk.customFields.getDefinitions();
|
|
661
|
+
*
|
|
662
|
+
* // Create a new field
|
|
663
|
+
* const field = await sdk.customFields.createDefinition({
|
|
664
|
+
* key: 'employee_id',
|
|
665
|
+
* label: 'Employee ID',
|
|
666
|
+
* fieldType: 'text',
|
|
667
|
+
* validation: { required: true }
|
|
668
|
+
* });
|
|
669
|
+
*
|
|
670
|
+
* // Validate user data
|
|
671
|
+
* const errors = sdk.customFields.validateUserData(formData, fields.data);
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
get customFields(): CustomFieldDefinitionManager;
|
|
648
675
|
/**
|
|
649
676
|
* Wallet Events Manager - Real-time blockchain events for user's wallets
|
|
650
677
|
*
|
package/dist/pers-sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pers-sdk.d.ts","sourceRoot":"","sources":["../src/pers-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8JG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO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mBAAmB,CAKtC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAMvD;;;;;;;;;;;;;;OAcG;IACH,GAAG,IAAI,aAAa;IAIpB;;;;OAIG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;;;;OAOG;IACH,aAAa,IAAI,OAAO;CAGzB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACjB,OAAO,CAET;AAGD,cAAc,wBAAwB,CAAC;AAGvC,YAAY,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorins/pers-sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.0-alpha.1",
|
|
4
4
|
"description": "Platform-agnostic SDK for PERS (Phygital Experience Rewards System) - Core business logic and API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
135
|
"@explorins/pers-sdk": "^2.1.32",
|
|
136
|
-
"@explorins/pers-shared": "^2.1.
|
|
136
|
+
"@explorins/pers-shared": "^2.1.167",
|
|
137
137
|
"@explorins/web3-ts": "^0.3.88",
|
|
138
138
|
"@explorins/web3-types": "^1.2.0",
|
|
139
139
|
"ethers": "^6.15.0"
|