@ninetailed/experience.js-utils-contentful 2.0.0-beta.9 → 2.0.2

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.
@@ -0,0 +1,182 @@
1
+ export declare const isExperienceEntry: (entry?: {
2
+ sys: {
3
+ revision?: number | undefined;
4
+ space?: {
5
+ sys: {
6
+ type: "Link";
7
+ id: string;
8
+ linkType: "Space";
9
+ };
10
+ } | undefined;
11
+ environment?: {
12
+ sys: {
13
+ type: "Link";
14
+ id: string;
15
+ linkType: "Environment";
16
+ };
17
+ } | undefined;
18
+ type: string;
19
+ id: string;
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ locale: string;
23
+ contentType: {
24
+ sys: {
25
+ type: "Link";
26
+ id: string;
27
+ linkType: "ContentType";
28
+ };
29
+ };
30
+ };
31
+ fields: {};
32
+ metadata: {
33
+ tags: {
34
+ sys: {
35
+ type: "Link";
36
+ id: string;
37
+ linkType: "Tag";
38
+ };
39
+ }[];
40
+ };
41
+ } | undefined) => entry is {
42
+ sys: {
43
+ revision?: number | undefined;
44
+ space?: {
45
+ sys: {
46
+ type: "Link";
47
+ id: string;
48
+ linkType: "Space";
49
+ };
50
+ } | undefined;
51
+ environment?: {
52
+ sys: {
53
+ type: "Link";
54
+ id: string;
55
+ linkType: "Environment";
56
+ };
57
+ } | undefined;
58
+ type: string;
59
+ id: string;
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ locale: string;
63
+ contentType: {
64
+ sys: {
65
+ type: "Link";
66
+ id: string;
67
+ linkType: "ContentType";
68
+ };
69
+ };
70
+ };
71
+ fields: {
72
+ nt_config?: {
73
+ distribution: number[];
74
+ traffic: number;
75
+ components: {
76
+ baseline: {
77
+ id: string;
78
+ };
79
+ variants: {
80
+ id: string;
81
+ hidden: boolean;
82
+ }[];
83
+ }[];
84
+ } | null | undefined;
85
+ nt_audience?: {
86
+ sys: {
87
+ revision?: number | undefined;
88
+ space?: {
89
+ sys: {
90
+ type: "Link";
91
+ id: string;
92
+ linkType: "Space";
93
+ };
94
+ } | undefined;
95
+ environment?: {
96
+ sys: {
97
+ type: "Link";
98
+ id: string;
99
+ linkType: "Environment";
100
+ };
101
+ } | undefined;
102
+ type: string;
103
+ id: string;
104
+ createdAt: string;
105
+ updatedAt: string;
106
+ locale: string;
107
+ contentType: {
108
+ sys: {
109
+ type: "Link";
110
+ id: string;
111
+ linkType: "ContentType";
112
+ };
113
+ };
114
+ };
115
+ fields: {
116
+ nt_name: string;
117
+ nt_audience_id: string;
118
+ };
119
+ metadata: {
120
+ tags: {
121
+ sys: {
122
+ type: "Link";
123
+ id: string;
124
+ linkType: "Tag";
125
+ };
126
+ }[];
127
+ };
128
+ } | null | undefined;
129
+ nt_name: string;
130
+ nt_type: "nt_experiment" | "nt_personalization";
131
+ nt_variants: {
132
+ sys: {
133
+ revision?: number | undefined;
134
+ space?: {
135
+ sys: {
136
+ type: "Link";
137
+ id: string;
138
+ linkType: "Space";
139
+ };
140
+ } | undefined;
141
+ environment?: {
142
+ sys: {
143
+ type: "Link";
144
+ id: string;
145
+ linkType: "Environment";
146
+ };
147
+ } | undefined;
148
+ type: string;
149
+ id: string;
150
+ createdAt: string;
151
+ updatedAt: string;
152
+ locale: string;
153
+ contentType: {
154
+ sys: {
155
+ type: "Link";
156
+ id: string;
157
+ linkType: "ContentType";
158
+ };
159
+ };
160
+ };
161
+ fields: {};
162
+ metadata: {
163
+ tags: {
164
+ sys: {
165
+ type: "Link";
166
+ id: string;
167
+ linkType: "Tag";
168
+ };
169
+ }[];
170
+ };
171
+ }[];
172
+ };
173
+ metadata: {
174
+ tags: {
175
+ sys: {
176
+ type: "Link";
177
+ id: string;
178
+ linkType: "Tag";
179
+ };
180
+ }[];
181
+ };
182
+ };
package/package.json CHANGED
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-utils-contentful",
3
- "version": "2.0.0-beta.9",
4
- "type": "commonjs",
5
- "main": "./src/index.js",
6
- "typings": "./src/index.d.ts"
3
+ "version": "2.0.2",
4
+ "peerDependencies": {
5
+ "contentful": "^9.1.32"
6
+ },
7
+ "main": "./index.umd.js",
8
+ "module": "./index.esm.js",
9
+ "typings": "./index.d.ts",
10
+ "dependencies": {
11
+ "@ninetailed/experience.js": "2.0.2",
12
+ "analytics": "^0.8.0",
13
+ "@ninetailed/experience.js-shared": "2.0.2",
14
+ "uuid": "^8.3.2",
15
+ "ts-toolbelt": "^9.6.0",
16
+ "locale-enum": "^1.1.1",
17
+ "i18n-iso-countries": "^7.3.0",
18
+ "lodash": "^4.17.21",
19
+ "loglevel": "^1.8.0",
20
+ "murmurhash-js": "^1.0.0",
21
+ "zod": "^3.18.0"
22
+ }
7
23
  }
@@ -0,0 +1,326 @@
1
+ import { z } from 'zod';
2
+ export declare const AudienceFields: z.ZodObject<{
3
+ /**
4
+ * The name of the audience (Short Text)
5
+ */
6
+ nt_name: z.ZodString;
7
+ /**
8
+ * The internal id of the audience (Short Text)
9
+ */
10
+ nt_audience_id: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ nt_name: string;
13
+ nt_audience_id: string;
14
+ }, {
15
+ nt_name: string;
16
+ nt_audience_id: string;
17
+ }>;
18
+ export declare type AudienceFields = z.infer<typeof AudienceFields>;
19
+ export declare const AudienceEntry: z.ZodObject<z.extendShape<{
20
+ sys: z.ZodObject<{
21
+ /**
22
+ * The internal id of the audience (Short Text)
23
+ */
24
+ type: z.ZodString;
25
+ id: z.ZodString;
26
+ createdAt: z.ZodString;
27
+ updatedAt: z.ZodString;
28
+ locale: z.ZodString;
29
+ revision: z.ZodOptional<z.ZodNumber>;
30
+ space: z.ZodOptional<z.ZodObject<{
31
+ sys: z.ZodObject<z.extendShape<{
32
+ type: z.ZodLiteral<"Link">;
33
+ linkType: z.ZodString;
34
+ id: z.ZodString;
35
+ }, {
36
+ linkType: z.ZodLiteral<"Space">;
37
+ }>, "strip", z.ZodTypeAny, {
38
+ type: "Link";
39
+ id: string;
40
+ linkType: "Space";
41
+ }, {
42
+ type: "Link";
43
+ id: string;
44
+ linkType: "Space";
45
+ }>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ sys: {
48
+ type: "Link";
49
+ id: string;
50
+ linkType: "Space";
51
+ };
52
+ }, {
53
+ sys: {
54
+ type: "Link";
55
+ id: string;
56
+ linkType: "Space";
57
+ };
58
+ }>>;
59
+ environment: z.ZodOptional<z.ZodObject<{
60
+ sys: z.ZodObject<z.extendShape<{
61
+ type: z.ZodLiteral<"Link">;
62
+ linkType: z.ZodString;
63
+ id: z.ZodString;
64
+ }, {
65
+ linkType: z.ZodLiteral<"Environment">;
66
+ }>, "strip", z.ZodTypeAny, {
67
+ type: "Link";
68
+ id: string;
69
+ linkType: "Environment";
70
+ }, {
71
+ type: "Link";
72
+ id: string;
73
+ linkType: "Environment";
74
+ }>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ sys: {
77
+ type: "Link";
78
+ id: string;
79
+ linkType: "Environment";
80
+ };
81
+ }, {
82
+ sys: {
83
+ type: "Link";
84
+ id: string;
85
+ linkType: "Environment";
86
+ };
87
+ }>>;
88
+ contentType: z.ZodObject<{
89
+ sys: z.ZodObject<z.extendShape<{
90
+ type: z.ZodLiteral<"Link">;
91
+ linkType: z.ZodString;
92
+ id: z.ZodString;
93
+ }, {
94
+ linkType: z.ZodLiteral<"ContentType">;
95
+ }>, "strip", z.ZodTypeAny, {
96
+ type: "Link";
97
+ id: string;
98
+ linkType: "ContentType";
99
+ }, {
100
+ type: "Link";
101
+ id: string;
102
+ linkType: "ContentType";
103
+ }>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ sys: {
106
+ type: "Link";
107
+ id: string;
108
+ linkType: "ContentType";
109
+ };
110
+ }, {
111
+ sys: {
112
+ type: "Link";
113
+ id: string;
114
+ linkType: "ContentType";
115
+ };
116
+ }>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ revision?: number | undefined;
119
+ space?: {
120
+ sys: {
121
+ type: "Link";
122
+ id: string;
123
+ linkType: "Space";
124
+ };
125
+ } | undefined;
126
+ environment?: {
127
+ sys: {
128
+ type: "Link";
129
+ id: string;
130
+ linkType: "Environment";
131
+ };
132
+ } | undefined;
133
+ type: string;
134
+ id: string;
135
+ createdAt: string;
136
+ updatedAt: string;
137
+ locale: string;
138
+ contentType: {
139
+ sys: {
140
+ type: "Link";
141
+ id: string;
142
+ linkType: "ContentType";
143
+ };
144
+ };
145
+ }, {
146
+ revision?: number | undefined;
147
+ space?: {
148
+ sys: {
149
+ type: "Link";
150
+ id: string;
151
+ linkType: "Space";
152
+ };
153
+ } | undefined;
154
+ environment?: {
155
+ sys: {
156
+ type: "Link";
157
+ id: string;
158
+ linkType: "Environment";
159
+ };
160
+ } | undefined;
161
+ type: string;
162
+ id: string;
163
+ createdAt: string;
164
+ updatedAt: string;
165
+ locale: string;
166
+ contentType: {
167
+ sys: {
168
+ type: "Link";
169
+ id: string;
170
+ linkType: "ContentType";
171
+ };
172
+ };
173
+ }>;
174
+ fields: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
175
+ metadata: z.ZodObject<{
176
+ tags: z.ZodArray<z.ZodObject<{
177
+ sys: z.ZodObject<z.extendShape<{
178
+ type: z.ZodLiteral<"Link">;
179
+ linkType: z.ZodString;
180
+ id: z.ZodString;
181
+ }, {
182
+ linkType: z.ZodLiteral<"Tag">;
183
+ }>, "strip", z.ZodTypeAny, {
184
+ type: "Link";
185
+ id: string;
186
+ linkType: "Tag";
187
+ }, {
188
+ type: "Link";
189
+ id: string;
190
+ linkType: "Tag";
191
+ }>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ sys: {
194
+ type: "Link";
195
+ id: string;
196
+ linkType: "Tag";
197
+ };
198
+ }, {
199
+ sys: {
200
+ type: "Link";
201
+ id: string;
202
+ linkType: "Tag";
203
+ };
204
+ }>, "many">;
205
+ }, "strip", z.ZodTypeAny, {
206
+ tags: {
207
+ sys: {
208
+ type: "Link";
209
+ id: string;
210
+ linkType: "Tag";
211
+ };
212
+ }[];
213
+ }, {
214
+ tags: {
215
+ sys: {
216
+ type: "Link";
217
+ id: string;
218
+ linkType: "Tag";
219
+ };
220
+ }[];
221
+ }>;
222
+ }, {
223
+ fields: z.ZodObject<{
224
+ /**
225
+ * The name of the audience (Short Text)
226
+ */
227
+ nt_name: z.ZodString;
228
+ /**
229
+ * The internal id of the audience (Short Text)
230
+ */
231
+ nt_audience_id: z.ZodString;
232
+ }, "strip", z.ZodTypeAny, {
233
+ nt_name: string;
234
+ nt_audience_id: string;
235
+ }, {
236
+ nt_name: string;
237
+ nt_audience_id: string;
238
+ }>;
239
+ }>, "strip", z.ZodTypeAny, {
240
+ sys: {
241
+ revision?: number | undefined;
242
+ space?: {
243
+ sys: {
244
+ type: "Link";
245
+ id: string;
246
+ linkType: "Space";
247
+ };
248
+ } | undefined;
249
+ environment?: {
250
+ sys: {
251
+ type: "Link";
252
+ id: string;
253
+ linkType: "Environment";
254
+ };
255
+ } | undefined;
256
+ type: string;
257
+ id: string;
258
+ createdAt: string;
259
+ updatedAt: string;
260
+ locale: string;
261
+ contentType: {
262
+ sys: {
263
+ type: "Link";
264
+ id: string;
265
+ linkType: "ContentType";
266
+ };
267
+ };
268
+ };
269
+ fields: {
270
+ nt_name: string;
271
+ nt_audience_id: string;
272
+ };
273
+ metadata: {
274
+ tags: {
275
+ sys: {
276
+ type: "Link";
277
+ id: string;
278
+ linkType: "Tag";
279
+ };
280
+ }[];
281
+ };
282
+ }, {
283
+ sys: {
284
+ revision?: number | undefined;
285
+ space?: {
286
+ sys: {
287
+ type: "Link";
288
+ id: string;
289
+ linkType: "Space";
290
+ };
291
+ } | undefined;
292
+ environment?: {
293
+ sys: {
294
+ type: "Link";
295
+ id: string;
296
+ linkType: "Environment";
297
+ };
298
+ } | undefined;
299
+ type: string;
300
+ id: string;
301
+ createdAt: string;
302
+ updatedAt: string;
303
+ locale: string;
304
+ contentType: {
305
+ sys: {
306
+ type: "Link";
307
+ id: string;
308
+ linkType: "ContentType";
309
+ };
310
+ };
311
+ };
312
+ fields: {
313
+ nt_name: string;
314
+ nt_audience_id: string;
315
+ };
316
+ metadata: {
317
+ tags: {
318
+ sys: {
319
+ type: "Link";
320
+ id: string;
321
+ linkType: "Tag";
322
+ };
323
+ }[];
324
+ };
325
+ }>;
326
+ export declare type AudienceEntry = z.infer<typeof AudienceEntry>;
@@ -1,7 +1,7 @@
1
- import { Entry } from 'contentful';
2
- import { ExperienceEntry } from './ExperienceEntry';
3
- declare type BaselineWithExperiencesFields<T> = T & {
4
- nt_experiences: ExperienceEntry[];
5
- };
6
- export declare type BaselineWithExperiencesEntry<T = unknown> = Entry<BaselineWithExperiencesFields<T>>;
7
- export {};
1
+ import { Entry } from 'contentful';
2
+ import { ExperienceEntry } from './ExperienceEntry';
3
+ declare type BaselineWithExperiencesFields<T> = T & {
4
+ nt_experiences: ExperienceEntry[];
5
+ };
6
+ export declare type BaselineWithExperiencesEntry<T = unknown> = Entry<BaselineWithExperiencesFields<T>>;
7
+ export {};