@contentchef/contentchef-types 11.0.0-alpha.3 → 11.0.0-alpha.5

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.
@@ -20,7 +20,7 @@ export declare enum SchemaTypeIds {
20
20
  ARRAY = "array",
21
21
  SLUG = "slug",
22
22
  MEDIA = "media",
23
- SEGMENTED = "segmented"
23
+ PERSONALIZED = "personalized"
24
24
  }
25
25
  /**
26
26
  * This enum represent al possible long text sub types
@@ -49,13 +49,13 @@ export type ContentDefinitionSchema = {
49
49
  */
50
50
  fragments: FragmentsTable;
51
51
  /**
52
- * The segments this definition depends on, chosen by the author. Every one has to exist in the
53
- * space and not be archived, and a segmented field may only vary by segments named here, so this
52
+ * The audiences this definition depends on, chosen by the author. Every one has to exist in the
53
+ * space and not be archived, and a personalized field may only vary by audiences named here, so this
54
54
  * is what scopes a definition and gives the field editor a short list to offer
55
55
  *
56
- * Optional: a definition that declares none simply cannot hold a segmented field
56
+ * Optional: a definition that declares none simply cannot hold a personalized field
57
57
  */
58
- segments?: string[];
58
+ audiences?: string[];
59
59
  };
60
60
  /**
61
61
  * This type represent the model of the attribute fragments in a content definition schema
@@ -303,13 +303,13 @@ export type OneLinkedContentOfConstraints = {
303
303
  linkType?: LinkType;
304
304
  };
305
305
  /**
306
- * This type represent what every value of a segmented field holds: one descriptor for the whole field,
306
+ * This type represent what every value of a personalized field holds: one descriptor for the whole field,
307
307
  * so the rules and the fallback cannot differ in type
308
308
  *
309
309
  * Only the two `one...Of` forms are admitted: `fragment` and `linked-content` are each the
310
310
  * single-target special case of one of them, carrying an identical payload value
311
311
  */
312
- export type SegmentVariantType = {
312
+ export type PersonalizedVariantType = {
313
313
  type: SchemaTypeIds.ONE_FRAGMENT_OF;
314
314
  constraints: OneFragmentOfConstraints;
315
315
  } | {
@@ -317,28 +317,28 @@ export type SegmentVariantType = {
317
317
  constraints: OneLinkedContentOfConstraints;
318
318
  };
319
319
  /**
320
- * This type represent the model of a segmented field constraints
320
+ * This type represent the model of a personalized field constraints
321
321
  *
322
- * A segmented field declares only *what varies* and *what shape the values have*. Which conditions
322
+ * A personalized field declares only *what varies* and *what shape the values have*. Which conditions
323
323
  * exist and what each of them serves is authored per content, as an ordered list of rules plus a
324
- * fallback - see [[SegmentedFieldPayload]] - so no combination has to be pre-declared here and two
324
+ * fallback - see [[PersonalizedFieldPayload]] - so no combination has to be pre-declared here and two
325
325
  * contents of the same definition may carry entirely different rule sets
326
326
  */
327
- export type SegmentedFieldConstraints = {
327
+ export type PersonalizedFieldConstraints = {
328
328
  /**
329
- * The mnemonic ids of the segments this field varies by, which must be among the ones the
330
- * definition declares in [[ContentDefinitionSchema.segments]]. Only the declaration is checked
331
- * against the space, so a segment that does not exist is one error on the definition rather than
329
+ * The mnemonic ids of the audiences this field varies by, which must be among the ones the
330
+ * definition declares in [[ContentDefinitionSchema.audiences]]. Only the declaration is checked
331
+ * against the space, so an audience that does not exist is one error on the definition rather than
332
332
  * one on every field that reached for it
333
333
  *
334
334
  * Declaration order carries no meaning: a rule wins by being first in the content, not by which
335
- * segment it constrains
335
+ * audience it constrains
336
336
  */
337
- segments: string[];
337
+ audiences: string[];
338
338
  /**
339
339
  * The shape every rule value and the fallback conform to
340
340
  */
341
- variantType: SegmentVariantType;
341
+ variantType: PersonalizedVariantType;
342
342
  };
343
343
  /**
344
344
  * This type represent the model of an array field constraints
@@ -492,9 +492,9 @@ export type OneFragmentOfSchemaType = SchemaType<SchemaTypeIds.ONE_FRAGMENT_OF,
492
492
  */
493
493
  export type OneLinkedContentOfSchemaType = IndexableSchemaType<SchemaTypeIds.ONE_LINKED_CONTENT_OF, OneLinkedContentOfConstraints>;
494
494
  /**
495
- * This type represent a segmented field schema type
495
+ * This type represent a personalized field schema type
496
496
  */
497
- export type SegmentedSchemaType = SchemaType<SchemaTypeIds.SEGMENTED, SegmentedFieldConstraints>;
497
+ export type PersonalizedSchemaType = SchemaType<SchemaTypeIds.PERSONALIZED, PersonalizedFieldConstraints>;
498
498
  /**
499
499
  * Slug schema type
500
500
  * This type is indexable and translatable by default
@@ -520,7 +520,7 @@ export type TranslatableSchemaTypes = NumberSchemaType | TextSchemaType | LongTe
520
520
  /**
521
521
  * This type group all the schema types of a content definition that are not indexable
522
522
  */
523
- export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | SegmentedSchemaType;
523
+ export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | PersonalizedSchemaType;
524
524
  /**
525
525
  * This type group all schema types of a content definition
526
526
  */
@@ -23,7 +23,7 @@ var SchemaTypeIds;
23
23
  SchemaTypeIds["ARRAY"] = "array";
24
24
  SchemaTypeIds["SLUG"] = "slug";
25
25
  SchemaTypeIds["MEDIA"] = "media";
26
- SchemaTypeIds["SEGMENTED"] = "segmented";
26
+ SchemaTypeIds["PERSONALIZED"] = "personalized";
27
27
  })(SchemaTypeIds || (exports.SchemaTypeIds = SchemaTypeIds = {}));
28
28
  /**
29
29
  * This enum represent al possible long text sub types
@@ -12,7 +12,7 @@ export * from './Invites';
12
12
  export * from './MediaGallery';
13
13
  export * from './PublishedContent';
14
14
  export * from './PublishingRequest';
15
- export * from './Segment';
15
+ export * from './Audience';
16
16
  export * from './Space';
17
17
  export * from './Subscription';
18
18
  export * from './UnpublishRequest';
package/dist/api/index.js CHANGED
@@ -28,7 +28,7 @@ __exportStar(require("./Invites"), exports);
28
28
  __exportStar(require("./MediaGallery"), exports);
29
29
  __exportStar(require("./PublishedContent"), exports);
30
30
  __exportStar(require("./PublishingRequest"), exports);
31
- __exportStar(require("./Segment"), exports);
31
+ __exportStar(require("./Audience"), exports);
32
32
  __exportStar(require("./Space"), exports);
33
33
  __exportStar(require("./Subscription"), exports);
34
34
  __exportStar(require("./UnpublishRequest"), exports);
@@ -0,0 +1,466 @@
1
+ import { AuthorResponse } from './Author';
2
+ import { PagedListResponse } from './common';
3
+ import { ContentDefinitionId } from './ContentDefinition';
4
+
5
+ /**
6
+ * The audience unique id
7
+ */
8
+ export type AudienceId = number;
9
+
10
+ /**
11
+ * An audience's mnemonicId and every one of its keys must match this pattern: lowercase, digits,
12
+ * underscore and hyphen. Stricter than the other authoring mnemonicIds on purpose, because both halves
13
+ * travel in the delivery `audiences` query param and are compared against strings a client supplies
14
+ */
15
+ export const AUDIENCE_NAME_PATTERN = /^[a-z0-9_-]+$/;
16
+
17
+ /**
18
+ * This type represent one key of an audience, that is one of the values a visitor can have for it
19
+ */
20
+ export type AudienceKey = {
21
+ /**
22
+ * The key, matching [[AUDIENCE_NAME_PATTERN]]
23
+ */
24
+ key: string;
25
+ /**
26
+ * A deprecated key cannot be referenced by new content rules, while every rule already written
27
+ * keeps resolving. The flag toggles both ways
28
+ */
29
+ deprecated?: boolean;
30
+ };
31
+
32
+ /**
33
+ * This type represent the model of an audience, that is a dimension a content can vary by - `gender`,
34
+ * `loyalty`, `auth_status` - holding the fixed set of keys a visitor can have for it
35
+ *
36
+ * Contents reference an audience by mnemonicId and key inside their rules, and definitions by
37
+ * mnemonicId, so audiences are archived and never deleted, and a key can only be removed or renamed
38
+ * while no content references it
39
+ */
40
+ export type AudienceResponse = {
41
+ /**
42
+ * The audience unique id
43
+ */
44
+ id: AudienceId;
45
+ /**
46
+ * The audience name
47
+ */
48
+ name: string;
49
+ /**
50
+ * The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
51
+ */
52
+ mnemonicId: string;
53
+ /**
54
+ * The keys a visitor can hold for this audience, each carrying its own deprecation state
55
+ */
56
+ keys: AudienceKey[];
57
+ /**
58
+ * The archived status of the audience
59
+ */
60
+ archived: boolean;
61
+ /**
62
+ * The archive date of the audience
63
+ */
64
+ archivedDate: Date | null;
65
+ /**
66
+ * The audience creation date
67
+ */
68
+ createdDate: Date;
69
+ /**
70
+ * The audience last modified date
71
+ */
72
+ lastModifiedDate: Date;
73
+ /**
74
+ * The audience author, resolved by `list` only
75
+ */
76
+ author?: AuthorResponse;
77
+ /**
78
+ * The audience last modified author, resolved by every endpoint but `get`
79
+ */
80
+ latestContributor?: AuthorResponse;
81
+ };
82
+
83
+ /**
84
+ * This type represent all possible filters used to retrieve a list of audience
85
+ */
86
+ export type ListAudiencesFilters = {
87
+ /**
88
+ * This filter is used to retrieve archived or not archived audiences. Defaults to not archived
89
+ */
90
+ archived?: boolean;
91
+ };
92
+
93
+ /**
94
+ * This type represent the data needed to make a list audiences API request
95
+ */
96
+ export type ListAudiencesRequest = {
97
+ /**
98
+ * The number of audiences to skip (this value is used for pagination)
99
+ */
100
+ skip?: number;
101
+ /**
102
+ * The number of audiences to take (this value is used for pagination), at most 100
103
+ */
104
+ take?: number;
105
+ /**
106
+ * The data used to filter the list of audiences
107
+ */
108
+ filters?: ListAudiencesFilters;
109
+ };
110
+
111
+ /**
112
+ * This type represent the item of a list audiences API request
113
+ */
114
+ export type ListAudiencesItem = AudienceResponse;
115
+
116
+ /**
117
+ * This type represent the response of a list audiences API request
118
+ */
119
+ export type ListAudiencesResponse = PagedListResponse<ListAudiencesItem>;
120
+
121
+ /**
122
+ * This type represent the usage of one key of an audience. A key with no entry is used by no content,
123
+ * and is therefore the only kind of key that can be removed or renamed
124
+ */
125
+ export type AudienceKeyUsage = {
126
+ /**
127
+ * The key, or null for the rules that constrain the audience without naming any key - that is the
128
+ * ones that only fire when the audience is unknown
129
+ */
130
+ key: string | null;
131
+ /**
132
+ * How many contents reference this key
133
+ */
134
+ contents: number;
135
+ };
136
+
137
+ /**
138
+ * This type represent a content definition that declares an audience
139
+ */
140
+ export type DefinitionUsingAudience = {
141
+ /**
142
+ * The content definition unique id
143
+ */
144
+ id: ContentDefinitionId;
145
+ /**
146
+ * The content definition mnemonic id
147
+ */
148
+ mnemonicId: string;
149
+ /**
150
+ * The content definition name
151
+ */
152
+ name: string;
153
+ };
154
+
155
+ /**
156
+ * This type represent the data needed to make a get audience API request
157
+ */
158
+ export type GetAudienceRequest = {
159
+ /**
160
+ * The unique audience id to retrieve
161
+ */
162
+ id: AudienceId;
163
+ };
164
+
165
+ /**
166
+ * This type represent the response of a get audience API request: the audience, plus the two things the
167
+ * editor cannot decide without, which keys are in use and which definitions vary by this audience
168
+ */
169
+ export type GetAudienceResponse = AudienceResponse & {
170
+ /**
171
+ * One entry per key at least one content references. A key absent from this list is unused
172
+ */
173
+ keyUsage: AudienceKeyUsage[];
174
+ /**
175
+ * The content definitions declaring this audience
176
+ */
177
+ definitions: DefinitionUsingAudience[];
178
+ };
179
+
180
+ /**
181
+ * This type represent the data needed to make a create audience API request
182
+ */
183
+ export type CreateAudienceRequest = {
184
+ /**
185
+ * The audience name
186
+ */
187
+ name: string;
188
+ /**
189
+ * The audience mnemonic id, matching [[AUDIENCE_NAME_PATTERN]]
190
+ */
191
+ mnemonicId: string;
192
+ /**
193
+ * The keys a visitor can hold for this audience, at least one, each key unique
194
+ */
195
+ keys: AudienceKey[];
196
+ };
197
+
198
+ /**
199
+ * This type represent the response of a create audience API request
200
+ */
201
+ export type CreateAudienceResponse = AudienceResponse;
202
+
203
+ /**
204
+ * This type represent the data needed to make an update audience API request
205
+ *
206
+ * `keys` replaces the whole stored list, deprecation flags included. Adding keys and toggling
207
+ * deprecation are always allowed, while removing or renaming a key is refused while a content still
208
+ * references it. `mnemonicId` cannot be changed
209
+ */
210
+ export type UpdateAudienceRequest = {
211
+ /**
212
+ * The audience unique id
213
+ */
214
+ id: AudienceId;
215
+ /**
216
+ * The audience name to update
217
+ */
218
+ name: string;
219
+ /**
220
+ * The audience mnemonic id, which must be the stored one
221
+ */
222
+ mnemonicId: string;
223
+ /**
224
+ * The whole key list, replacing what is stored
225
+ */
226
+ keys: AudienceKey[];
227
+ };
228
+
229
+ /**
230
+ * This type represent the response of an update audience API request
231
+ */
232
+ export type UpdateAudienceResponse = AudienceResponse;
233
+
234
+ /**
235
+ * This type represent the data needed to make a toggle archived audience API request
236
+ */
237
+ export type ToggleArchivedAudienceRequest = {
238
+ /**
239
+ * The audience unique id
240
+ */
241
+ id: AudienceId;
242
+ /**
243
+ * This value represent the archive status to set in the specified audience
244
+ */
245
+ archived: boolean;
246
+ };
247
+
248
+ /**
249
+ * This type represent the response of a toggle archived audience API request
250
+ */
251
+ export type ToggleArchivedAudienceResponse = AudienceResponse;
252
+
253
+ /**
254
+ * This type represent the condition of one rule on a single audience: the visitor's value for
255
+ * [[audience]] has to be one of [[in]]
256
+ */
257
+ export type AudiencePredicate = {
258
+ /**
259
+ * The mnemonic id of the audience this predicate constrains, which the field must declare
260
+ */
261
+ audience: string;
262
+ /**
263
+ * The keys of the audience that satisfy this predicate
264
+ */
265
+ in: string[];
266
+ /**
267
+ * Set this value to also satisfy the predicate when the audience was not provided at all
268
+ *
269
+ * Not-provided is not a key, so no list of keys can express it, and an enumeration would silently
270
+ * narrow the moment a key is added to the audience. A key that was provided but is not listed does
271
+ * not satisfy this flag: it falls through to the field's fallback
272
+ */
273
+ orUnset?: boolean;
274
+ };
275
+
276
+ /**
277
+ * This type represent a condition satisfied when every child condition is satisfied
278
+ */
279
+ export type AllAudiencePredicate = {
280
+ all: AudienceRuleCondition[];
281
+ };
282
+
283
+ /**
284
+ * This type represent a condition satisfied when at least one child condition is satisfied
285
+ */
286
+ export type AnyAudiencePredicate = {
287
+ any: AudienceRuleCondition[];
288
+ };
289
+
290
+ /**
291
+ * This type represent the condition of a rule
292
+ *
293
+ * The stored form is a tree so that new kinds of condition stay additive, but an editor only needs to
294
+ * build an [[AllAudiencePredicate]] of one [[AudiencePredicate]] per audience: or within an audience, and
295
+ * between audiences. An audience the condition does not mention is unconstrained, which is a different
296
+ * thing from one listed with [[AudiencePredicate.orUnset]]
297
+ */
298
+ export type AudienceRuleCondition = AudiencePredicate | AllAudiencePredicate | AnyAudiencePredicate;
299
+
300
+ /**
301
+ * This type represent one rule of a personalized field: the condition, and the value to serve when it wins
302
+ * @template T The type of the value served by the rule, which conforms to the field's `variantType`
303
+ */
304
+ export type PersonalizedRule<T = any> = {
305
+ /**
306
+ * The rule id, unique in the field. Used for diagnostics only, matching never reads it
307
+ */
308
+ id?: string;
309
+ /**
310
+ * The condition under which this rule wins
311
+ */
312
+ when: AudienceRuleCondition;
313
+ /**
314
+ * The value served when this rule wins
315
+ */
316
+ value: T;
317
+ };
318
+
319
+ /**
320
+ * This type represent the value a personalized field holds in a content payload: an ordered list of
321
+ * rules, first match wins, and the fallback served when no rule matches
322
+ *
323
+ * The fallback is mandatory exactly when the field is required, which keeps the delivery contract of a
324
+ * personalized field the same as any other field. Zero rules is legal: the field is then just its fallback
325
+ * @template T The type of the served values, which conform to the field's `variantType`
326
+ */
327
+ export type PersonalizedFieldPayload<T = any> = {
328
+ /**
329
+ * The rules, in the order they are evaluated in
330
+ */
331
+ rules?: PersonalizedRule<T>[];
332
+ /**
333
+ * The value served when no rule matches
334
+ */
335
+ fallback?: T;
336
+ };
337
+
338
+ /**
339
+ * This type represent the visitor's value per audience, as the rule engine reads it. An audience missing
340
+ * from the map, or set to `undefined`, means "not provided" - which is what
341
+ * [[AudiencePredicate.orUnset]] answers
342
+ */
343
+ export type AudienceAssignment = {
344
+ [audienceMnemonicId: string]: string | undefined;
345
+ };
346
+
347
+ /**
348
+ * The stand-in a coverage report uses for "a key none of the rules mention"
349
+ *
350
+ * Not a real key - it cannot be one, since keys match [[AUDIENCE_NAME_PATTERN]]. A rule only ever tests
351
+ * membership in its own list, so every unmentioned key behaves identically and one case covers them
352
+ * all, which is what keeps the analysis exact and small. [[CoverageReport.otherKeys]] says which real
353
+ * keys it stood for
354
+ */
355
+ export const OTHER_KEY = '<any other key>';
356
+
357
+ /**
358
+ * This type represent how much of a rule list one rule actually serves
359
+ */
360
+ export type RuleCoverage = {
361
+ /**
362
+ * The position of the rule in the analysed list
363
+ */
364
+ index: number;
365
+ /**
366
+ * The rule id, when it carries one
367
+ */
368
+ id?: string;
369
+ /**
370
+ * The condition in words, so a finding reads without decoding a predicate
371
+ */
372
+ condition: string;
373
+ /**
374
+ * How many of the analysed assignments this rule wins. Zero means it can never serve anyone
375
+ */
376
+ wins: number;
377
+ };
378
+
379
+ /**
380
+ * This type represent what an ordered rule list covers, worked out from the rules and the audiences'
381
+ * keys alone - no request traffic is involved
382
+ *
383
+ * The findings are advisory and never validation violations: a gap is usually deliberate, that being
384
+ * what a fallback is for, while an unreachable rule is almost always a mistake
385
+ */
386
+ export type CoverageReport = {
387
+ /**
388
+ * How many assignments were evaluated, after collapsing the keys no rule mentions
389
+ */
390
+ combinations: number;
391
+ /**
392
+ * One entry per analysed rule, in author order
393
+ */
394
+ rules: RuleCoverage[];
395
+ /**
396
+ * The rules that win nothing: shadowed by an earlier rule, or self-contradictory
397
+ */
398
+ unreachableRules: RuleCoverage[];
399
+ /**
400
+ * The assignments no rule claims, so they reach the fallback. Capped at 25 entries, while
401
+ * [[fallbackCount]] is the real total
402
+ */
403
+ fallbackAssignments: AudienceAssignment[];
404
+ /**
405
+ * How many assignments reach the fallback, of [[combinations]]
406
+ */
407
+ fallbackCount: number;
408
+ /**
409
+ * The audiences declared by the field but constrained by no rule, so they change nothing about what
410
+ * it serves
411
+ */
412
+ unusedAudiences: string[];
413
+ /**
414
+ * What [[OTHER_KEY]] stood for, per audience: the real unmentioned keys, capped at 10, with their
415
+ * total. Only the audiences that needed the stand-in appear
416
+ */
417
+ otherKeys: { [audience: string]: { keys: string[]; total: number } };
418
+ /**
419
+ * Set when the rules and their audiences were too large to enumerate. Everything else is then
420
+ * unpopulated rather than guessed, because a sampled "no gaps" is not a fact
421
+ */
422
+ notAnalysed?: { reason: 'tooManyCombinations'; combinations: number };
423
+ };
424
+
425
+ /**
426
+ * This type represent one rule as the analyse rules API request takes it: the condition, and nothing
427
+ * about what the rule serves. Coverage is decided by conditions only, so the values stay out of the
428
+ * request - and a half written rule with no condition is analysed as one that matches nothing rather
429
+ * than refused
430
+ */
431
+ export type PersonalizedRuleDraft = {
432
+ /**
433
+ * The rule id, when it carries one. Reported back on the finding, so a client can match a finding
434
+ * to the rule on screen without relying on the index
435
+ */
436
+ id?: string;
437
+ /**
438
+ * The condition under which this rule wins
439
+ */
440
+ when?: AudienceRuleCondition;
441
+ };
442
+
443
+ /**
444
+ * This type represent the data needed to make an analyse rules API request, which is what a field's
445
+ * rule editor asks about the rules on screen, before anything is saved
446
+ *
447
+ * The keys of every audience are read from the space rather than taken from the request, so a client
448
+ * never has to hold them or keep them current
449
+ */
450
+ export type AnalyseAudienceRulesRequest = {
451
+ /**
452
+ * The mnemonic ids of the audiences the field varies by, at most 20. The analysis is bounded by
453
+ * these, as the field's rules are
454
+ */
455
+ audiences: string[];
456
+ /**
457
+ * The rules in author order, at most 200. The order is the whole point: first match wins, so a rule
458
+ * being unreachable is a consequence of what precedes it
459
+ */
460
+ rules: PersonalizedRuleDraft[];
461
+ };
462
+
463
+ /**
464
+ * This type represent the response of an analyse rules API request
465
+ */
466
+ export type AnalyseAudienceRulesResponse = CoverageReport;
@@ -14,6 +14,7 @@ import {
14
14
  ContentTranslation,
15
15
  ContentTranslationStatus,
16
16
  } from "./ContentTranslation";
17
+ import { CoverageReport } from "./Audience";
17
18
 
18
19
  /**
19
20
  * This type represent the content unique id type
@@ -403,11 +404,11 @@ export type ListContentsFilters = {
403
404
  translationStatus?: ContentTranslationStatus;
404
405
 
405
406
  /**
406
- * This filter is used to search contents whose segmented fields have rules referencing the segments
407
- * inserted, as `segment` or `segment:key` tokens. A bare `segment` matches whichever key a content
407
+ * This filter is used to search contents whose personalized fields have rules referencing the audiences
408
+ * inserted, as `audience` or `audience:key` tokens. A bare `audience` matches whichever key a content
408
409
  * uses it with, and several tokens narrow the result like `tags` do
409
410
  */
410
- segments?: string[];
411
+ audiences?: string[];
411
412
  };
412
413
 
413
414
  /**
@@ -845,17 +846,17 @@ export enum ContentFieldViolationCodes {
845
846
  textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
846
847
  textFieldValueIsNotAString = "textField.valueIsNotAString",
847
848
  textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
848
- segmentedFieldValueIsNotSegmented = "segmentedField.valueIsNotSegmented",
849
- segmentedFieldRulesIsNotAnArray = "segmentedField.rulesIsNotAnArray",
850
- segmentedFieldRuleIsNotAnObject = "segmentedField.ruleIsNotAnObject",
851
- segmentedFieldRuleConditionMissing = "segmentedField.ruleConditionMissing",
852
- segmentedFieldDuplicateRuleId = "segmentedField.duplicateRuleId",
853
- segmentedFieldSegmentNotDeclared = "segmentedField.segmentNotDeclared",
854
- segmentedFieldFallbackRequired = "segmentedField.fallbackRequired",
855
- segmentedFieldSegmentNotFound = "segmentedField.segmentNotFound",
856
- segmentedFieldSegmentArchived = "segmentedField.segmentArchived",
857
- segmentedFieldSegmentKeyNotFound = "segmentedField.segmentKeyNotFound",
858
- segmentedFieldSegmentKeyDeprecated = "segmentedField.segmentKeyDeprecated",
849
+ personalizedFieldValueIsNotPersonalized = "personalizedField.valueIsNotPersonalized",
850
+ personalizedFieldRulesIsNotAnArray = "personalizedField.rulesIsNotAnArray",
851
+ personalizedFieldRuleIsNotAnObject = "personalizedField.ruleIsNotAnObject",
852
+ personalizedFieldRuleConditionMissing = "personalizedField.ruleConditionMissing",
853
+ personalizedFieldDuplicateRuleId = "personalizedField.duplicateRuleId",
854
+ personalizedFieldAudienceNotDeclared = "personalizedField.audienceNotDeclared",
855
+ personalizedFieldFallbackRequired = "personalizedField.fallbackRequired",
856
+ personalizedFieldAudienceNotFound = "personalizedField.audienceNotFound",
857
+ personalizedFieldAudienceArchived = "personalizedField.audienceArchived",
858
+ personalizedFieldAudienceKeyNotFound = "personalizedField.audienceKeyNotFound",
859
+ personalizedFieldAudienceKeyDeprecated = "personalizedField.audienceKeyDeprecated",
859
860
  }
860
861
 
861
862
  /**
@@ -900,3 +901,39 @@ export type ToggleContentTranslationsRequest = {
900
901
  };
901
902
 
902
903
  export type ToggleContentTranslationsResponse = ContentResponse;
904
+
905
+ /**
906
+ * This type represent the data needed to make an analyse personalized rules API request
907
+ */
908
+ export type AnalysePersonalizedRulesRequest = {
909
+ /**
910
+ * Id of the content whose personalized fields have to be analysed
911
+ */
912
+ contentId: ContentId;
913
+ };
914
+
915
+ /**
916
+ * This type represent the coverage of one personalized field of a content
917
+ */
918
+ export type PersonalizedFieldCoverage = CoverageReport & {
919
+ /**
920
+ * Where the field sits in the payload
921
+ */
922
+ path: string;
923
+ /**
924
+ * Whether the field carries a fallback. An optional field without one resolves to nothing for the
925
+ * assignments in [[CoverageReport.fallbackAssignments]], which is worth knowing
926
+ */
927
+ hasFallback: boolean;
928
+ };
929
+
930
+ /**
931
+ * This type represent the response of an analyse personalized rules API request: one report per
932
+ * personalized field of the content, empty when it has none
933
+ */
934
+ export type AnalysePersonalizedRulesResponse = {
935
+ /**
936
+ * One entry per personalized field found in the content payload
937
+ */
938
+ fields: PersonalizedFieldCoverage[];
939
+ };