@wix/viewer 1.0.0 → 1.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.
@@ -1,801 +0,0 @@
1
- type HostModule<T, H extends Host> = {
2
- __type: 'host';
3
- create(host: H): T;
4
- };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
7
- channel: {
8
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
- disconnect: () => void;
10
- } | Promise<{
11
- disconnect: () => void;
12
- }>;
13
- };
14
- environment?: Environment;
15
- /**
16
- * Optional name of the environment, use for logging
17
- */
18
- name?: string;
19
- /**
20
- * Optional bast url to use for API requests, for example `www.wixapis.com`
21
- */
22
- apiBaseUrl?: string;
23
- /**
24
- * Possible data to be provided by every host, for cross cutting concerns
25
- * like internationalization, billing, etc.
26
- */
27
- essentials?: {
28
- /**
29
- * The language of the currently viewed session
30
- */
31
- language?: string;
32
- /**
33
- * The locale of the currently viewed session
34
- */
35
- locale?: string;
36
- /**
37
- * Any headers that should be passed through to the API requests
38
- */
39
- passThroughHeaders?: Record<string, string>;
40
- };
41
- };
42
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
- interface HttpClient {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
- type HttpResponse<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata;
64
- type APIMetadata = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
77
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
-
81
- type ServicePluginMethodInput = {
82
- request: any;
83
- metadata: any;
84
- };
85
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata = {
87
- name: string;
88
- primaryHttpMappingPath: string;
89
- transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
- toREST: (...args: unknown[]) => unknown;
92
- };
93
- };
94
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
- __type: 'service-plugin-definition';
96
- componentType: string;
97
- methods: ServicePluginMethodMetadata[];
98
- __contract: Contract;
99
- };
100
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
-
104
- type RequestContext = {
105
- isSSR: boolean;
106
- host: string;
107
- protocol?: string;
108
- };
109
- type ResponseTransformer = (data: any, headers?: any) => any;
110
- /**
111
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
- */
115
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions<T = any> = {
117
- _?: T;
118
- url?: string;
119
- method?: Method;
120
- params?: any;
121
- data?: any;
122
- transformResponse?: ResponseTransformer | ResponseTransformer[];
123
- };
124
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
- __isAmbassador: boolean;
126
- };
127
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
129
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
137
- declare const emptyObjectSymbol: unique symbol;
138
-
139
- /**
140
- Represents a strictly empty plain object, the `{}` value.
141
-
142
- When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
143
-
144
- @example
145
- ```
146
- import type {EmptyObject} from 'type-fest';
147
-
148
- // The following illustrates the problem with `{}`.
149
- const foo1: {} = {}; // Pass
150
- const foo2: {} = []; // Pass
151
- const foo3: {} = 42; // Pass
152
- const foo4: {} = {a: 1}; // Pass
153
-
154
- // With `EmptyObject` only the first case is valid.
155
- const bar1: EmptyObject = {}; // Pass
156
- const bar2: EmptyObject = 42; // Fail
157
- const bar3: EmptyObject = []; // Fail
158
- const bar4: EmptyObject = {a: 1}; // Fail
159
- ```
160
-
161
- Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
162
-
163
- @category Object
164
- */
165
- type EmptyObject = {[emptyObjectSymbol]?: never};
166
-
167
- /**
168
- Returns a boolean for whether the two given types are equal.
169
-
170
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
-
173
- Use-cases:
174
- - If you want to make a conditional branch based on the result of a comparison of two types.
175
-
176
- @example
177
- ```
178
- import type {IsEqual} from 'type-fest';
179
-
180
- // This type returns a boolean for whether the given array includes the given item.
181
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
- type Includes<Value extends readonly any[], Item> =
183
- Value extends readonly [Value[0], ...infer rest]
184
- ? IsEqual<Value[0], Item> extends true
185
- ? true
186
- : Includes<rest, Item>
187
- : false;
188
- ```
189
-
190
- @category Type Guard
191
- @category Utilities
192
- */
193
- type IsEqual<A, B> =
194
- (<G>() => G extends A ? 1 : 2) extends
195
- (<G>() => G extends B ? 1 : 2)
196
- ? true
197
- : false;
198
-
199
- /**
200
- Filter out keys from an object.
201
-
202
- Returns `never` if `Exclude` is strictly equal to `Key`.
203
- Returns `never` if `Key` extends `Exclude`.
204
- Returns `Key` otherwise.
205
-
206
- @example
207
- ```
208
- type Filtered = Filter<'foo', 'foo'>;
209
- //=> never
210
- ```
211
-
212
- @example
213
- ```
214
- type Filtered = Filter<'bar', string>;
215
- //=> never
216
- ```
217
-
218
- @example
219
- ```
220
- type Filtered = Filter<'bar', 'foo'>;
221
- //=> 'bar'
222
- ```
223
-
224
- @see {Except}
225
- */
226
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
-
228
- type ExceptOptions = {
229
- /**
230
- Disallow assigning non-specified properties.
231
-
232
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
-
234
- @default false
235
- */
236
- requireExactProps?: boolean;
237
- };
238
-
239
- /**
240
- Create a type from an object type without certain keys.
241
-
242
- We recommend setting the `requireExactProps` option to `true`.
243
-
244
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
245
-
246
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
247
-
248
- @example
249
- ```
250
- import type {Except} from 'type-fest';
251
-
252
- type Foo = {
253
- a: number;
254
- b: string;
255
- };
256
-
257
- type FooWithoutA = Except<Foo, 'a'>;
258
- //=> {b: string}
259
-
260
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
- //=> errors: 'a' does not exist in type '{ b: string; }'
262
-
263
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
- //=> {a: number} & Partial<Record<"b", never>>
265
-
266
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
- ```
269
-
270
- @category Object
271
- */
272
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
- } & (Options['requireExactProps'] extends true
275
- ? Partial<Record<KeysType, never>>
276
- : {});
277
-
278
- /**
279
- Returns a boolean for whether the given type is `never`.
280
-
281
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
- @link https://stackoverflow.com/a/53984913/10292952
283
- @link https://www.zhenghao.io/posts/ts-never
284
-
285
- Useful in type utilities, such as checking if something does not occur.
286
-
287
- @example
288
- ```
289
- import type {IsNever, And} from 'type-fest';
290
-
291
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
- type AreStringsEqual<A extends string, B extends string> =
293
- And<
294
- IsNever<Exclude<A, B>> extends true ? true : false,
295
- IsNever<Exclude<B, A>> extends true ? true : false
296
- >;
297
-
298
- type EndIfEqual<I extends string, O extends string> =
299
- AreStringsEqual<I, O> extends true
300
- ? never
301
- : void;
302
-
303
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
- if (input === output) {
305
- process.exit(0);
306
- }
307
- }
308
-
309
- endIfEqual('abc', 'abc');
310
- //=> never
311
-
312
- endIfEqual('abc', '123');
313
- //=> void
314
- ```
315
-
316
- @category Type Guard
317
- @category Utilities
318
- */
319
- type IsNever<T> = [T] extends [never] ? true : false;
320
-
321
- /**
322
- An if-else-like type that resolves depending on whether the given type is `never`.
323
-
324
- @see {@link IsNever}
325
-
326
- @example
327
- ```
328
- import type {IfNever} from 'type-fest';
329
-
330
- type ShouldBeTrue = IfNever<never>;
331
- //=> true
332
-
333
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
- //=> 'bar'
335
- ```
336
-
337
- @category Type Guard
338
- @category Utilities
339
- */
340
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
- );
343
-
344
- /**
345
- Extract the keys from a type where the value type of the key extends the given `Condition`.
346
-
347
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
-
349
- @example
350
- ```
351
- import type {ConditionalKeys} from 'type-fest';
352
-
353
- interface Example {
354
- a: string;
355
- b: string | number;
356
- c?: string;
357
- d: {};
358
- }
359
-
360
- type StringKeysOnly = ConditionalKeys<Example, string>;
361
- //=> 'a'
362
- ```
363
-
364
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
-
366
- @example
367
- ```
368
- import type {ConditionalKeys} from 'type-fest';
369
-
370
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
- //=> 'a' | 'c'
372
- ```
373
-
374
- @category Object
375
- */
376
- type ConditionalKeys<Base, Condition> =
377
- {
378
- // Map through all the keys of the given base type.
379
- [Key in keyof Base]-?:
380
- // Pick only keys with types extending the given `Condition` type.
381
- Base[Key] extends Condition
382
- // Retain this key
383
- // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
- // Discard this key since the condition fails.
386
- : never;
387
- // Convert the produced object into a union type of the keys which passed the conditional test.
388
- }[keyof Base];
389
-
390
- /**
391
- Exclude keys from a shape that matches the given `Condition`.
392
-
393
- This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
394
-
395
- @example
396
- ```
397
- import type {Primitive, ConditionalExcept} from 'type-fest';
398
-
399
- class Awesome {
400
- name: string;
401
- successes: number;
402
- failures: bigint;
403
-
404
- run() {}
405
- }
406
-
407
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
- //=> {run: () => void}
409
- ```
410
-
411
- @example
412
- ```
413
- import type {ConditionalExcept} from 'type-fest';
414
-
415
- interface Example {
416
- a: string;
417
- b: string | number;
418
- c: () => void;
419
- d: {};
420
- }
421
-
422
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
- //=> {b: string | number; c: () => void; d: {}}
424
- ```
425
-
426
- @category Object
427
- */
428
- type ConditionalExcept<Base, Condition> = Except<
429
- Base,
430
- ConditionalKeys<Base, Condition>
431
- >;
432
-
433
- /**
434
- * Descriptors are objects that describe the API of a module, and the module
435
- * can either be a REST module or a host module.
436
- * This type is recursive, so it can describe nested modules.
437
- */
438
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
- [key: string]: Descriptors | PublicMetadata | any;
440
- };
441
- /**
442
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
- * and returns an object with the same structure, but with all descriptors replaced with their API.
444
- * Any non-descriptor properties are removed from the returned object, including descriptors that
445
- * do not match the given host (as they will not work with the given host).
446
- */
447
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
- done: T;
449
- recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
- -1,
454
- 0,
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ][Depth]> : never;
461
- }, EmptyObject>;
462
- }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata = {
464
- PACKAGE_NAME?: string;
465
- };
466
-
467
- declare global {
468
- interface ContextualClient {
469
- }
470
- }
471
- /**
472
- * A type used to create concerete types from SDK descriptors in
473
- * case a contextual client is available.
474
- */
475
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
- host: Host;
477
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
-
479
- interface SiteStructureItem {
480
- /**
481
- * The end goal: this field should contain a unique identifier for this site-structure item.\
482
- * Currently it contains:
483
- * - For site-structure integrated TPAs - the unique identifier provided by the TPA.
484
- * - For all other item types - empty string.
485
- */
486
- itemId?: string;
487
- /**
488
- * An identifier for the type of the item. One of:
489
- * - For the site's static pages - "static_page".
490
- * - For legacy integration TPAs - the TPA's app-def-id.
491
- * - For TPAs with new site-structure integration - the item type identifier provided by the TPA. Commonly one of that TPA's supported sub-pages.
492
- * - For items that are the result of a dynamic router - "dynamic-page".
493
- */
494
- itemTypeIdentifier?: string;
495
- /**
496
- * An identifier for the source of the item. One of:
497
- * - For the site's static pages - "editor".
498
- * - For legacy integration TPAs - the TPA's app-def-id.
499
- * - For TPAs with new site-structure integration - the TPA's app-def-id.
500
- * - For items that are the result of a dynamic router - Wix-Code's app-def-id: '675bbcef-18d8-41f5-800e-131ec9e08762'.
501
- */
502
- sourceId?: string;
503
- /**
504
- * An identifier for the configuration of the item. Used currently as some sort of a placeholder for further filtering.
505
- * - For items of type "dynamic-page" - The 'prefix' field that is part of the router-config object of the router that is related to this item (see WixCodeDynamicRouterResolver).
506
- * - For all other items types - empty string.
507
- */
508
- configId?: string;
509
- /**
510
- * A human readable name string associated with the item.\
511
- * Currently exists only for new TPA site-structure integration items, and contains the 'name' field provided by the TPA for that item.\
512
- * This field is not guaranteed to be unique across the item list.
513
- */
514
- name?: string | null;
515
- /**
516
- * Deprecated. Previously used for media content that is associated with an item.\
517
- * See 'image' and 'video' fields of this message.
518
- * @deprecated
519
- */
520
- media?: MediaItem[];
521
- /** A relative url path that can be used, with the site's base-url, to reach the page represented by this item. */
522
- path?: string | null;
523
- /**
524
- * A timestamp representing the moment that this item was last changed.
525
- * - For static pages - the site's last publish time.
526
- * - For all kinds of TPAs - the last-modified field in the respective response item from the TPA.
527
- * - For items that are the result of a dynamic router - the content of the 'lastModified' optional field in the response item from Wix-Code's RPC endpoint, or, if missing, the site's last publish time. (see WixCodeDynamicRouterResolver).
528
- */
529
- _updatedDate?: Date | null;
530
- /**
531
- * A value indicating whether the item is inactive or not. E.g. hidden product/finished event etc.\
532
- * Currently exists only for new TPA site-structure integration items, and contains the 'inactive' field provided by the TPA for that item.
533
- */
534
- inactive?: boolean | null;
535
- /**
536
- * A general free schema field to include further metadata related to this item.\
537
- * Currently exists only for:\
538
- * Static pages - a JSON that is the merge of:
539
- * 1. The advancedSeoData JSON string that exists for the page in the master-page.
540
- * 2. A JSON of the form:
541
- * ```javascript
542
- * {
543
- * "seo_legacy": {
544
- * "hidden_from_seo": true / false
545
- * },
546
- * "password_protected": true / false
547
- * }
548
- * ```
549
- * New TPA site-structure integration items - the 'metadata' field provided by the TPA for that item.
550
- */
551
- metadata?: Record<string, any> | null;
552
- /**
553
- * An image media metadata the is related to this item.\
554
- * Currently exists only for new TPA site-structure integration items, and contains the 'image' field provided by the TPA for that item.
555
- */
556
- image?: string[];
557
- /**
558
- * A video media metadata the is related to this item.\
559
- * Currently exists only for new TPA site-structure integration items, and contains the 'video' field provided by the TPA for that item.
560
- */
561
- video?: string[];
562
- /** A value indicating whether the item is protected or not, by password or login. */
563
- protected?: boolean | null;
564
- /**
565
- * ID of the translations of the item. As same item can have multiple instances, one for each language, we can match them by this ID.\
566
- * For example:
567
- * Blog has one post, translated to 2 languages (EN, FR):
568
- * - EN item path is `/amazing-post`
569
- * - FR item path is `/poste-incroyable
570
- * Both of them might have different `item_id`, but will share the same `translation_id`, to be easily match together
571
- * Currently only relevant for Blog
572
- */
573
- translationId?: string;
574
- /** A value indicating whether the item is a custom error page or not. */
575
- isCustomErrorPage?: boolean | null;
576
- }
577
- /** Deprecated - Copy this message into your service, do not reference it */
578
- interface MediaItem extends MediaItemMediaOneOf {
579
- /** WixMedia image */
580
- image?: string;
581
- /** WixMedia video */
582
- video?: string;
583
- /** WixMedia document */
584
- document?: string;
585
- }
586
- /** @oneof */
587
- interface MediaItemMediaOneOf {
588
- /** WixMedia image */
589
- image?: string;
590
- /** WixMedia video */
591
- video?: string;
592
- /** WixMedia document */
593
- document?: string;
594
- }
595
- interface FocalPoint {
596
- /** X-coordinate of the focal point. */
597
- x?: number;
598
- /** Y-coordinate of the focal point. */
599
- y?: number;
600
- /** crop by height */
601
- height?: number | null;
602
- /** crop by width */
603
- width?: number | null;
604
- }
605
- interface VideoResolution {
606
- /** Video URL. */
607
- url?: string;
608
- /** Video height. */
609
- height?: number;
610
- /** Video width. */
611
- width?: number;
612
- /** Video format for example, mp4, hls. */
613
- format?: string;
614
- }
615
- interface SiteStructureRequest {
616
- /** An enum indicating whether the request is for the latest published version (0) or the latest saved version (1) of the site */
617
- pageVersion?: PageSegment;
618
- /**
619
- * Pagination request metadata, currently applicable for:\
620
- * - Queries filtered for items from a TPA that is part of the new-integration (TpaSiteStructureService)
621
- * - Queries filtered for dynamic router items from the new dynamic-pages-router integration (DynamicSiteStructureService)
622
- */
623
- paging?: CursorPaging;
624
- /** Filtering metadata. Only items allowed by the filter will be returned. */
625
- filter?: SiteStructureRequestFilter;
626
- /** General sorting metadata. Currently not supported. */
627
- sorting?: Sorting;
628
- /** General field mask metadata. Currently not supported. */
629
- fieldSet?: string[];
630
- /** Language metadata. Contains 2 chars language code and/or 4 chars language tag. */
631
- languageMetadata?: LanguageMetadata;
632
- }
633
- declare enum PageSegment {
634
- PUBLISHED = "PUBLISHED",
635
- SAVED = "SAVED"
636
- }
637
- interface CursorPaging {
638
- /** Maximum number of items to return in the results. */
639
- limit?: number | null;
640
- /**
641
- * Pointer to the next or previous page in the list of results.
642
- *
643
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
644
- * Not relevant for the first request.
645
- */
646
- cursor?: string | null;
647
- }
648
- /** A filter metadata type. The filter forces an 'and' logic between all of its comprising parts. */
649
- interface SiteStructureRequestFilter {
650
- /** In accordance to SiteStructureItem.item_type_identifier */
651
- itemTypeIdentifier?: string;
652
- /** In accordance to SiteStructureItem.source_id */
653
- sourceId?: string;
654
- /** In accordance to SiteStructureItem.config_id */
655
- configId?: string;
656
- }
657
- interface Sorting {
658
- /** Name of the field to sort by. */
659
- fieldName?: string;
660
- /** Sort order. */
661
- order?: SortOrder;
662
- }
663
- declare enum SortOrder {
664
- ASC = "ASC",
665
- DESC = "DESC"
666
- }
667
- interface LanguageMetadata {
668
- /** 2 chars language code (e.g. 'en') */
669
- code?: string;
670
- /** 4 chars language tag (e.g. 'en-us') */
671
- tag?: string | null;
672
- }
673
- interface SiteStructureResponse {
674
- /** The total number of items to be returned, combining all paginated responses. */
675
- totalResults?: number;
676
- /** A cursor based paging response metadata, including the item count in the current page and a cursor string to be used for querying of the next page. */
677
- pageData?: CursorPagingMetaData;
678
- /** A list of all the result items. */
679
- results?: SiteStructureItem[];
680
- }
681
- interface CursorPagingMetaData {
682
- /** The item count in the current page */
683
- count?: number | null;
684
- /** The cursor which will be used to query the next page */
685
- cursor?: string | null;
686
- }
687
- interface GetSiteStructureMetadataRequest {
688
- /** Page's version */
689
- pageVersion?: PageSegment;
690
- }
691
- interface GetSiteStructureMetadataResponse {
692
- /** A list of pages types */
693
- pageTypes?: SitePageType[];
694
- }
695
- interface SitePageType {
696
- /** Type identifier */
697
- itemTypeIdentifier?: string;
698
- /** Site's page-type sourceId */
699
- sourceId?: string;
700
- /** Site's page-type configId */
701
- configId?: string;
702
- }
703
- interface MediaItemNonNullableFields {
704
- image: string;
705
- video: string;
706
- document: string;
707
- }
708
- interface SiteStructureItemNonNullableFields {
709
- itemId: string;
710
- itemTypeIdentifier: string;
711
- sourceId: string;
712
- configId: string;
713
- media: MediaItemNonNullableFields[];
714
- image: string[];
715
- video: string[];
716
- translationId: string;
717
- }
718
- interface SiteStructureResponseNonNullableFields {
719
- totalResults: number;
720
- results: SiteStructureItemNonNullableFields[];
721
- }
722
- interface SitePageTypeNonNullableFields {
723
- itemTypeIdentifier: string;
724
- sourceId: string;
725
- configId: string;
726
- pageIdentifiers: string[];
727
- }
728
- interface GetSiteStructureMetadataResponseNonNullableFields {
729
- pageTypes: SitePageTypeNonNullableFields[];
730
- }
731
- interface GetSiteStructureOptions {
732
- /** An enum indicating whether the request is for the latest published version (0) or the latest saved version (1) of the site */
733
- pageVersion?: PageSegment;
734
- /**
735
- * Pagination request metadata, currently applicable for:\
736
- * - Queries filtered for items from a TPA that is part of the new-integration (TpaSiteStructureService)
737
- * - Queries filtered for dynamic router items from the new dynamic-pages-router integration (DynamicSiteStructureService)
738
- */
739
- paging?: CursorPaging;
740
- /** Filtering metadata. Only items allowed by the filter will be returned. */
741
- filter?: SiteStructureRequestFilter;
742
- /** General sorting metadata. Currently not supported. */
743
- sorting?: Sorting;
744
- /** General field mask metadata. Currently not supported. */
745
- fieldSet?: string[];
746
- /** Language metadata. Contains 2 chars language code and/or 4 chars language tag. */
747
- languageMetadata?: LanguageMetadata;
748
- }
749
- interface GetSiteStructureMetadataOptions {
750
- /** Page's version */
751
- pageVersion?: PageSegment;
752
- }
753
-
754
- declare function getSiteStructure$1(httpClient: HttpClient): GetSiteStructureSignature;
755
- interface GetSiteStructureSignature {
756
- /**
757
- * Get Site's structure
758
- */
759
- (options?: GetSiteStructureOptions | undefined): Promise<SiteStructureResponse & SiteStructureResponseNonNullableFields>;
760
- }
761
- declare function getSiteStructureMetadata$1(httpClient: HttpClient): GetSiteStructureMetadataSignature;
762
- interface GetSiteStructureMetadataSignature {
763
- /**
764
- * Get Site's structure meta-data
765
- */
766
- (options?: GetSiteStructureMetadataOptions | undefined): Promise<GetSiteStructureMetadataResponse & GetSiteStructureMetadataResponseNonNullableFields>;
767
- }
768
-
769
- declare const getSiteStructure: MaybeContext<BuildRESTFunction<typeof getSiteStructure$1> & typeof getSiteStructure$1>;
770
- declare const getSiteStructureMetadata: MaybeContext<BuildRESTFunction<typeof getSiteStructureMetadata$1> & typeof getSiteStructureMetadata$1>;
771
-
772
- type context_CursorPaging = CursorPaging;
773
- type context_CursorPagingMetaData = CursorPagingMetaData;
774
- type context_FocalPoint = FocalPoint;
775
- type context_GetSiteStructureMetadataOptions = GetSiteStructureMetadataOptions;
776
- type context_GetSiteStructureMetadataRequest = GetSiteStructureMetadataRequest;
777
- type context_GetSiteStructureMetadataResponse = GetSiteStructureMetadataResponse;
778
- type context_GetSiteStructureMetadataResponseNonNullableFields = GetSiteStructureMetadataResponseNonNullableFields;
779
- type context_GetSiteStructureOptions = GetSiteStructureOptions;
780
- type context_LanguageMetadata = LanguageMetadata;
781
- type context_MediaItem = MediaItem;
782
- type context_MediaItemMediaOneOf = MediaItemMediaOneOf;
783
- type context_PageSegment = PageSegment;
784
- declare const context_PageSegment: typeof PageSegment;
785
- type context_SitePageType = SitePageType;
786
- type context_SiteStructureItem = SiteStructureItem;
787
- type context_SiteStructureRequest = SiteStructureRequest;
788
- type context_SiteStructureRequestFilter = SiteStructureRequestFilter;
789
- type context_SiteStructureResponse = SiteStructureResponse;
790
- type context_SiteStructureResponseNonNullableFields = SiteStructureResponseNonNullableFields;
791
- type context_SortOrder = SortOrder;
792
- declare const context_SortOrder: typeof SortOrder;
793
- type context_Sorting = Sorting;
794
- type context_VideoResolution = VideoResolution;
795
- declare const context_getSiteStructure: typeof getSiteStructure;
796
- declare const context_getSiteStructureMetadata: typeof getSiteStructureMetadata;
797
- declare namespace context {
798
- export { type context_CursorPaging as CursorPaging, type context_CursorPagingMetaData as CursorPagingMetaData, type context_FocalPoint as FocalPoint, type context_GetSiteStructureMetadataOptions as GetSiteStructureMetadataOptions, type context_GetSiteStructureMetadataRequest as GetSiteStructureMetadataRequest, type context_GetSiteStructureMetadataResponse as GetSiteStructureMetadataResponse, type context_GetSiteStructureMetadataResponseNonNullableFields as GetSiteStructureMetadataResponseNonNullableFields, type context_GetSiteStructureOptions as GetSiteStructureOptions, type context_LanguageMetadata as LanguageMetadata, type context_MediaItem as MediaItem, type context_MediaItemMediaOneOf as MediaItemMediaOneOf, context_PageSegment as PageSegment, type context_SitePageType as SitePageType, type context_SiteStructureItem as SiteStructureItem, type context_SiteStructureRequest as SiteStructureRequest, type context_SiteStructureRequestFilter as SiteStructureRequestFilter, type context_SiteStructureResponse as SiteStructureResponse, type context_SiteStructureResponseNonNullableFields as SiteStructureResponseNonNullableFields, context_SortOrder as SortOrder, type context_Sorting as Sorting, type context_VideoResolution as VideoResolution, context_getSiteStructure as getSiteStructure, context_getSiteStructureMetadata as getSiteStructureMetadata };
799
- }
800
-
801
- export { context as siteStructureService };