@wix/seatings 1.0.6 → 1.0.8

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,681 +1,39 @@
1
- interface SeatingPlan$1 {
2
- /**
3
- * Auto generated unique plan id
4
- * @readonly
5
- */
6
- _id?: string | null;
7
- /**
8
- * A client defined external id for cross referencing.
9
- * Can reference external entities.
10
- * Format: "{fqdn}:{entity guid}"
11
- */
12
- externalId?: string | null;
13
- /** Human friendly plan title */
14
- title?: string | null;
15
- /** Sections of the plan. Seating plan is divided in high level sections. */
16
- sections?: Section$1[];
17
- /** Categories for plan element grouping. */
18
- categories?: Category$1[];
19
- /**
20
- * Seating plan created timestamp.
21
- * @readonly
22
- */
23
- _createdDate?: Date;
24
- /**
25
- * Seating plan updated timestamp.
26
- * @readonly
27
- */
28
- _updatedDate?: Date;
29
- /**
30
- * Total capacity
31
- * @readonly
32
- */
33
- totalCapacity?: number | null;
34
- /**
35
- * Total categories
36
- * @readonly
37
- */
38
- totalCategories?: number | null;
39
- /**
40
- * Places not assigned to categories
41
- * @readonly
42
- */
43
- uncategorizedPlaces?: Place$1[];
44
- /**
45
- * A version of the seating plan
46
- * @readonly
47
- */
48
- version?: string | null;
49
- /** Data extensions */
50
- extendedFields?: ExtendedFields$1;
51
- /** Seating Plan UI settings */
52
- uiProperties?: SeatingPlanUiProperties$1;
53
- }
54
- interface Section$1 {
55
- /** Unique section id */
56
- _id?: number;
57
- /** Human readable section title */
58
- title?: string | null;
59
- /**
60
- * Client configuration object
61
- * @readonly
62
- */
63
- config?: Record<string, any> | null;
64
- /** Elements of the section. */
65
- elements?: Element$1[];
66
- /**
67
- * Total capacity
68
- * @readonly
69
- */
70
- totalCapacity?: number | null;
71
- /**
72
- * Is default section
73
- * @readonly
74
- */
75
- default?: boolean;
76
- }
77
- interface Element$1 {
78
- /** Unique element id */
79
- _id?: number;
80
- /** User friendly title/label of the element. */
81
- title?: string | null;
82
- /** Element type */
83
- type?: Type$1;
84
- /** Capacity. None for Shape type Element. */
85
- capacity?: number | null;
86
- /** Assigned to a category */
87
- categoryId?: number | null;
88
- /** A place numbering meta data */
89
- sequencing?: Sequencing$1;
90
- /**
91
- * Place override (by seq_id)
92
- * @deprecated
93
- */
94
- overrides?: Place$1[];
95
- /**
96
- * Final place sequence with overrides
97
- * @readonly
98
- */
99
- places?: Place$1[];
100
- /** Element reservation options */
101
- reservationOptions?: ReservationOptions$1;
102
- /** Element UI settings */
103
- uiProperties?: ElementUiProperties$1;
104
- }
105
- declare enum Type$1 {
106
- AREA = "AREA",
107
- ROW = "ROW",
108
- MULTI_ROW = "MULTI_ROW",
109
- TABLE = "TABLE",
110
- ROUND_TABLE = "ROUND_TABLE",
111
- SHAPE = "SHAPE"
112
- }
113
- interface Sequencing$1 {
114
- /** First seq element */
115
- startAt?: string;
116
- /** Finite generated seq of labels */
117
- labels?: string[];
118
- /** If true - direction right to left. Otherwise left to right. */
119
- reverseOrder?: boolean | null;
120
- }
121
- interface Place$1 {
122
- /**
123
- * Local id of the place in the sequence
124
- * @deprecated
125
- * @removalDate 2024-07-01
126
- */
127
- index?: number;
128
- /**
129
- * Generated composite unique id in the seating plan.
130
- * @readonly
131
- */
132
- _id?: string | null;
133
- /** Unique label of the place */
134
- label?: string;
135
- /**
136
- * Max capacity per place
137
- * @readonly
138
- */
139
- capacity?: number | null;
140
- /**
141
- * Type of the parent element
142
- * @readonly
143
- */
144
- elementType?: Type$1;
145
- /**
146
- * Assigned category id
147
- * @readonly
148
- */
149
- categoryId?: number | null;
150
- }
151
- interface ReservationOptions$1 {
152
- /** Indicates whether the entire element must be reserved */
153
- reserveWholeElement?: boolean;
154
- }
155
- interface ElementUiProperties$1 {
156
- x?: number | null;
157
- y?: number | null;
158
- zIndex?: number | null;
159
- width?: number | null;
160
- height?: number | null;
161
- rotationAngle?: number | null;
162
- shapeType?: ShapeTypeEnumType$1;
163
- fontSize?: number | null;
164
- cornerRadius?: number | null;
165
- seatSpacing?: number | null;
166
- hideLabel?: boolean | null;
167
- labelPosition?: Position$1;
168
- seatLayout?: number[];
169
- emptyTopSeatSpaces?: number | null;
170
- /** needs research */
171
- text?: string | null;
172
- /** #F0F0F0 */
173
- color?: string | null;
174
- /** #F0F0F0 */
175
- fillColor?: string | null;
176
- /** #F0F0F0 */
177
- strokeColor?: string | null;
178
- /** px */
179
- strokeWidth?: number | null;
180
- opacity?: number | null;
181
- icon?: Icon$1;
182
- image?: Image$1;
183
- seatNumbering?: Numbering$1;
184
- }
185
- declare enum ShapeTypeEnumType$1 {
186
- UNKNOWN_TYPE = "UNKNOWN_TYPE",
187
- TEXT = "TEXT",
188
- RECTANGLE = "RECTANGLE",
189
- ELLIPSE = "ELLIPSE",
190
- LINE = "LINE",
191
- ICON = "ICON",
192
- IMAGE = "IMAGE"
193
- }
194
- declare enum Position$1 {
195
- UNKNOWN_POSITION = "UNKNOWN_POSITION",
196
- LEFT = "LEFT",
197
- RIGHT = "RIGHT",
198
- BOTH = "BOTH",
199
- NONE = "NONE"
200
- }
201
- declare enum Icon$1 {
202
- UNKNOWN_ICON = "UNKNOWN_ICON",
203
- ENTER = "ENTER",
204
- EXIT = "EXIT",
205
- DRINKS = "DRINKS",
206
- WC = "WC",
207
- WC_MEN = "WC_MEN",
208
- WC_WOMEN = "WC_WOMEN",
209
- FOOD = "FOOD",
210
- STAIRS = "STAIRS",
211
- ELEVATOR = "ELEVATOR",
212
- SMOKING = "SMOKING",
213
- CHECKROOM = "CHECKROOM",
214
- STAGE = "STAGE"
215
- }
216
- interface Image$1 {
217
- /** WixMedia image ID. */
218
- _id?: string;
219
- /**
220
- * Original image height.
221
- * @readonly
222
- */
223
- height?: number;
224
- /**
225
- * Original image width.
226
- * @readonly
227
- */
228
- width?: number;
229
- /**
230
- * WixMedia image URI.
231
- * @deprecated
232
- */
233
- uri?: string | null;
234
- }
235
- declare enum Numbering$1 {
236
- UNKNOWN_NUMBERING = "UNKNOWN_NUMBERING",
237
- NUMERIC = "NUMERIC",
238
- ODD_EVEN = "ODD_EVEN",
239
- ALPHABETICAL = "ALPHABETICAL"
240
- }
241
- interface Category$1 {
242
- /** Local category id within the seating plan */
243
- _id?: number;
244
- /**
245
- * A client defined external id for cross referencing.
246
- * Can reference external entities.
247
- * Format: "{entity_fqdn}:{entity_id}"
248
- */
249
- externalId?: string | null;
250
- /** Category label */
251
- title?: string;
252
- /**
253
- * Client configuration object
254
- * @readonly
255
- */
256
- config?: Record<string, any> | null;
257
- /**
258
- * Total capacity
259
- * @readonly
260
- */
261
- totalCapacity?: number | null;
262
- /**
263
- * Possible places
264
- * @readonly
265
- */
266
- places?: Place$1[];
267
- }
268
- interface ExtendedFields$1 {
269
- /**
270
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
271
- * The value of each key is structured according to the schema defined when the extended fields were configured.
272
- *
273
- * You can only access fields for which you have the appropriate permissions.
274
- *
275
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
276
- */
277
- namespaces?: Record<string, Record<string, any>>;
278
- }
279
- interface SeatingPlanUiProperties$1 {
280
- /** #F0F0F0 */
281
- backgroundColor?: string | null;
282
- backgroundOpacity?: number | null;
283
- }
284
- interface CopySeatingPlanResponse {
285
- /** The copied plan */
286
- plan?: SeatingPlan$1;
287
- }
288
- declare enum Fieldset {
289
- ELEMENTS = "ELEMENTS",
290
- CATEGORIES = "CATEGORIES",
291
- PLACES = "PLACES",
292
- CONFIG = "CONFIG",
293
- ELEMENT_GROUPS = "ELEMENT_GROUPS"
294
- }
295
- interface SeatingPlanMask {
296
- /** Filter seating plan by place ids */
297
- placeId?: string[];
298
- }
299
- interface FindSeatingPlanResponse {
300
- /** The plan */
301
- plan?: SeatingPlan$1;
302
- }
303
- interface DeleteSeatingPlanResponse {
304
- /** Deleted plan */
305
- plan?: SeatingPlan$1;
306
- }
307
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
308
- /** ID of a site visitor that has not logged in to the site. */
309
- anonymousVisitorId?: string;
310
- /** ID of a site visitor that has logged in to the site. */
311
- memberId?: string;
312
- /** ID of a Wix user (site owner, contributor, etc.). */
313
- wixUserId?: string;
314
- /** ID of an app. */
315
- appId?: string;
316
- /** @readonly */
317
- identityType?: WebhookIdentityType$1;
318
- }
319
- /** @oneof */
320
- interface IdentificationDataIdOneOf$1 {
321
- /** ID of a site visitor that has not logged in to the site. */
322
- anonymousVisitorId?: string;
323
- /** ID of a site visitor that has logged in to the site. */
324
- memberId?: string;
325
- /** ID of a Wix user (site owner, contributor, etc.). */
326
- wixUserId?: string;
327
- /** ID of an app. */
328
- appId?: string;
329
- }
330
- declare enum WebhookIdentityType$1 {
331
- UNKNOWN = "UNKNOWN",
332
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
333
- MEMBER = "MEMBER",
334
- WIX_USER = "WIX_USER",
335
- APP = "APP"
336
- }
337
- interface SeatingPlanThumbnail {
338
- /** @readonly */
339
- _id?: string | null;
340
- img?: string | null;
341
- }
342
- interface UpdateSeatingPlanThumbnailResponse {
343
- thumbnail?: SeatingPlanThumbnail;
344
- }
345
- interface GetSeatingPlanThumbnailResponse {
346
- thumbnail?: SeatingPlanThumbnail;
347
- }
348
- interface Cursors$1 {
349
- /** Cursor string pointing to the next page in the list of results. */
350
- next?: string | null;
351
- /** Cursor pointing to the previous page in the list of results. */
352
- prev?: string | null;
353
- }
354
- interface CopySeatingPlanResponseNonNullableFields {
355
- plan?: {
356
- sections: {
357
- _id: number;
358
- elements: {
359
- _id: number;
360
- type: Type$1;
361
- sequencing?: {
362
- startAt: string;
363
- labels: string[];
364
- };
365
- overrides: {
366
- index: number;
367
- label: string;
368
- elementType: Type$1;
369
- }[];
370
- places: {
371
- index: number;
372
- label: string;
373
- elementType: Type$1;
374
- }[];
375
- reservationOptions?: {
376
- reserveWholeElement: boolean;
377
- };
378
- uiProperties?: {
379
- shapeType: ShapeTypeEnumType$1;
380
- labelPosition: Position$1;
381
- seatLayout: number[];
382
- icon: Icon$1;
383
- image?: {
384
- _id: string;
385
- height: number;
386
- width: number;
387
- };
388
- seatNumbering: Numbering$1;
389
- };
390
- }[];
391
- default: boolean;
392
- }[];
393
- categories: {
394
- _id: number;
395
- title: string;
396
- places: {
397
- index: number;
398
- label: string;
399
- elementType: Type$1;
400
- }[];
401
- }[];
402
- uncategorizedPlaces: {
403
- index: number;
404
- label: string;
405
- elementType: Type$1;
406
- }[];
407
- };
408
- }
409
- interface FindSeatingPlanResponseNonNullableFields {
410
- plan?: {
411
- sections: {
412
- _id: number;
413
- elements: {
414
- _id: number;
415
- type: Type$1;
416
- sequencing?: {
417
- startAt: string;
418
- labels: string[];
419
- };
420
- overrides: {
421
- index: number;
422
- label: string;
423
- elementType: Type$1;
424
- }[];
425
- places: {
426
- index: number;
427
- label: string;
428
- elementType: Type$1;
429
- }[];
430
- reservationOptions?: {
431
- reserveWholeElement: boolean;
432
- };
433
- uiProperties?: {
434
- shapeType: ShapeTypeEnumType$1;
435
- labelPosition: Position$1;
436
- seatLayout: number[];
437
- icon: Icon$1;
438
- image?: {
439
- _id: string;
440
- height: number;
441
- width: number;
442
- };
443
- seatNumbering: Numbering$1;
444
- };
445
- }[];
446
- default: boolean;
447
- }[];
448
- categories: {
449
- _id: number;
450
- title: string;
451
- places: {
452
- index: number;
453
- label: string;
454
- elementType: Type$1;
455
- }[];
456
- }[];
457
- uncategorizedPlaces: {
458
- index: number;
459
- label: string;
460
- elementType: Type$1;
461
- }[];
462
- };
463
- }
464
- interface DeleteSeatingPlanResponseNonNullableFields {
465
- plan?: {
466
- sections: {
467
- _id: number;
468
- elements: {
469
- _id: number;
470
- type: Type$1;
471
- sequencing?: {
472
- startAt: string;
473
- labels: string[];
474
- };
475
- overrides: {
476
- index: number;
477
- label: string;
478
- elementType: Type$1;
479
- }[];
480
- places: {
481
- index: number;
482
- label: string;
483
- elementType: Type$1;
484
- }[];
485
- reservationOptions?: {
486
- reserveWholeElement: boolean;
487
- };
488
- uiProperties?: {
489
- shapeType: ShapeTypeEnumType$1;
490
- labelPosition: Position$1;
491
- seatLayout: number[];
492
- icon: Icon$1;
493
- image?: {
494
- _id: string;
495
- height: number;
496
- width: number;
497
- };
498
- seatNumbering: Numbering$1;
499
- };
500
- }[];
501
- default: boolean;
502
- }[];
503
- categories: {
504
- _id: number;
505
- title: string;
506
- places: {
507
- index: number;
508
- label: string;
509
- elementType: Type$1;
510
- }[];
511
- }[];
512
- uncategorizedPlaces: {
513
- index: number;
514
- label: string;
515
- elementType: Type$1;
516
- }[];
517
- };
518
- }
519
- interface BaseEventMetadata$1 {
520
- /** App instance ID. */
521
- instanceId?: string | null;
522
- /** Event type. */
523
- eventType?: string;
524
- /** The identification type and identity data. */
525
- identity?: IdentificationData$1;
526
- }
527
- interface EventMetadata$1 extends BaseEventMetadata$1 {
528
- /**
529
- * Unique event ID.
530
- * Allows clients to ignore duplicate webhooks.
531
- */
532
- _id?: string;
533
- /**
534
- * Assumes actions are also always typed to an entity_type
535
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
536
- */
537
- entityFqdn?: string;
538
- /**
539
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
540
- * This is although the created/updated/deleted notion is duplication of the oneof types
541
- * Example: created/updated/deleted/started/completed/email_opened
542
- */
543
- slug?: string;
544
- /** ID of the entity associated with the event. */
545
- entityId?: string;
546
- /** Event timestamp. */
547
- eventTime?: Date;
548
- /**
549
- * Whether the event was triggered as a result of a privacy regulation application
550
- * (for example, GDPR).
551
- */
552
- triggeredByAnonymizeRequest?: boolean | null;
553
- /** If present, indicates the action that triggered the event. */
554
- originatedFrom?: string | null;
555
- /**
556
- * A sequence number defining the order of updates to the underlying entity.
557
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
558
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
559
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
560
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
561
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
562
- */
563
- entityEventSequence?: string | null;
564
- }
565
- interface SeatingPlanCreatedEnvelope {
566
- entity: SeatingPlan$1;
567
- metadata: EventMetadata$1;
568
- }
569
- interface SeatingPlanUpdatedEnvelope {
570
- entity: SeatingPlan$1;
571
- metadata: EventMetadata$1;
572
- }
573
- interface SeatingPlanDeletedEnvelope {
574
- metadata: EventMetadata$1;
575
- }
576
- interface UpdateSeatingPlanOptions {
577
- /** The plan updates */
578
- plan?: SeatingPlan$1;
579
- }
580
- interface CopySeatingPlanOptions {
581
- /** New plan title */
582
- title: string | null;
583
- /** Format: "{fqdn}:{entity guid}" */
584
- externalId: string | null;
585
- }
586
- interface QuerySeatingPlanOptions {
587
- /** A fieldset for the response */
588
- fieldset?: Fieldset[] | undefined;
589
- }
590
- interface QueryCursorResult$1 {
591
- cursors: Cursors$1;
592
- hasNext: () => boolean;
593
- hasPrev: () => boolean;
594
- length: number;
595
- pageSize: number;
596
- }
597
- interface PlansQueryResult extends QueryCursorResult$1 {
598
- items: SeatingPlan$1[];
599
- query: PlansQueryBuilder;
600
- next: () => Promise<PlansQueryResult>;
601
- prev: () => Promise<PlansQueryResult>;
602
- }
603
- interface PlansQueryBuilder {
604
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
605
- * @documentationMaturity preview
606
- */
607
- limit: (limit: number) => PlansQueryBuilder;
608
- /** @param cursor - A pointer to specific record
609
- * @documentationMaturity preview
610
- */
611
- skipTo: (cursor: string) => PlansQueryBuilder;
612
- /** @documentationMaturity preview */
613
- find: () => Promise<PlansQueryResult>;
614
- }
615
- interface GetSeatingPlanOptions {
616
- /**
617
- * A fieldset for the response
618
- * @deprecated
619
- */
620
- fieldset?: Fieldset[];
621
- /**
622
- * Projection on the result object - list of named projections.
623
- * Possible values: "elements", "categories", "places", "config".
624
- */
625
- fieldsets?: string[];
626
- /** Seating Plan Mask */
627
- seatingPlanMask?: SeatingPlanMask;
628
- }
629
- interface FindSeatingPlanOptions {
630
- /**
631
- * A fieldset for the response
632
- * @deprecated
633
- */
634
- fieldset?: Fieldset[];
635
- /**
636
- * Projection on the result object - list of named projections.
637
- * Possible values: "elements", "categories", "places", "config".
638
- */
639
- fieldsets?: string[];
640
- /** Seating Plan Mask */
641
- seatingPlanMask?: SeatingPlanMask;
642
- }
643
-
644
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
645
- interface HttpClient$1 {
646
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
647
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
+ interface HttpClient {
3
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
648
6
  }
649
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
650
- type HttpResponse$1<T = any> = {
7
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
+ type HttpResponse<T = any> = {
651
9
  data: T;
652
10
  status: number;
653
11
  statusText: string;
654
12
  headers: any;
655
13
  request?: any;
656
14
  };
657
- type RequestOptions$1<_TResponse = any, Data = any> = {
15
+ type RequestOptions<_TResponse = any, Data = any> = {
658
16
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
659
17
  url: string;
660
18
  data?: Data;
661
19
  params?: URLSearchParams;
662
- } & APIMetadata$1;
663
- type APIMetadata$1 = {
20
+ } & APIMetadata;
21
+ type APIMetadata = {
664
22
  methodFqn?: string;
665
23
  entityFqdn?: string;
666
24
  packageName?: string;
667
25
  };
668
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
669
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
26
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
27
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
670
28
  __type: 'event-definition';
671
29
  type: Type;
672
30
  isDomainEvent?: boolean;
673
31
  transformations?: (envelope: unknown) => Payload;
674
32
  __payload: Payload;
675
33
  };
676
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
677
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
678
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
34
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
35
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
36
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
679
37
 
680
38
  declare global {
681
39
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -684,187 +42,22 @@ declare global {
684
42
  }
685
43
  }
686
44
 
687
- declare function createSeatingPlan$1(httpClient: HttpClient$1): (plan: SeatingPlan$1) => Promise<SeatingPlan$1 & {
688
- sections: {
689
- _id: number;
690
- elements: {
691
- _id: number;
692
- type: Type$1;
693
- sequencing?: {
694
- startAt: string;
695
- labels: string[];
696
- } | undefined;
697
- overrides: {
698
- index: number;
699
- label: string;
700
- elementType: Type$1;
701
- }[];
702
- places: {
703
- index: number;
704
- label: string;
705
- elementType: Type$1;
706
- }[];
707
- reservationOptions?: {
708
- reserveWholeElement: boolean;
709
- } | undefined;
710
- uiProperties?: {
711
- shapeType: ShapeTypeEnumType$1;
712
- labelPosition: Position$1;
713
- seatLayout: number[];
714
- icon: Icon$1;
715
- image?: {
716
- _id: string;
717
- height: number;
718
- width: number;
719
- } | undefined;
720
- seatNumbering: Numbering$1;
721
- } | undefined;
722
- }[];
723
- default: boolean;
724
- }[];
725
- categories: {
726
- _id: number;
727
- title: string;
728
- places: {
729
- index: number;
730
- label: string;
731
- elementType: Type$1;
732
- }[];
733
- }[];
734
- uncategorizedPlaces: {
735
- index: number;
736
- label: string;
737
- elementType: Type$1;
738
- }[];
739
- }>;
740
- declare function updateSeatingPlan$1(httpClient: HttpClient$1): (options?: UpdateSeatingPlanOptions) => Promise<SeatingPlan$1 & {
741
- sections: {
742
- _id: number;
743
- elements: {
744
- _id: number;
745
- type: Type$1;
746
- sequencing?: {
747
- startAt: string;
748
- labels: string[];
749
- } | undefined;
750
- overrides: {
751
- index: number;
752
- label: string;
753
- elementType: Type$1;
754
- }[];
755
- places: {
756
- index: number;
757
- label: string;
758
- elementType: Type$1;
759
- }[];
760
- reservationOptions?: {
761
- reserveWholeElement: boolean;
762
- } | undefined;
763
- uiProperties?: {
764
- shapeType: ShapeTypeEnumType$1;
765
- labelPosition: Position$1;
766
- seatLayout: number[];
767
- icon: Icon$1;
768
- image?: {
769
- _id: string;
770
- height: number;
771
- width: number;
772
- } | undefined;
773
- seatNumbering: Numbering$1;
774
- } | undefined;
775
- }[];
776
- default: boolean;
777
- }[];
778
- categories: {
779
- _id: number;
780
- title: string;
781
- places: {
782
- index: number;
783
- label: string;
784
- elementType: Type$1;
785
- }[];
786
- }[];
787
- uncategorizedPlaces: {
788
- index: number;
789
- label: string;
790
- elementType: Type$1;
791
- }[];
792
- }>;
793
- declare function copySeatingPlan$1(httpClient: HttpClient$1): (_id: string | null, options: CopySeatingPlanOptions) => Promise<CopySeatingPlanResponse & CopySeatingPlanResponseNonNullableFields>;
794
- declare function querySeatingPlan$1(httpClient: HttpClient$1): (options?: QuerySeatingPlanOptions) => PlansQueryBuilder;
795
- declare function getSeatingPlan$1(httpClient: HttpClient$1): (_id: string | null, options?: GetSeatingPlanOptions) => Promise<SeatingPlan$1 & {
796
- sections: {
797
- _id: number;
798
- elements: {
799
- _id: number;
800
- type: Type$1;
801
- sequencing?: {
802
- startAt: string;
803
- labels: string[];
804
- } | undefined;
805
- overrides: {
806
- index: number;
807
- label: string;
808
- elementType: Type$1;
809
- }[];
810
- places: {
811
- index: number;
812
- label: string;
813
- elementType: Type$1;
814
- }[];
815
- reservationOptions?: {
816
- reserveWholeElement: boolean;
817
- } | undefined;
818
- uiProperties?: {
819
- shapeType: ShapeTypeEnumType$1;
820
- labelPosition: Position$1;
821
- seatLayout: number[];
822
- icon: Icon$1;
823
- image?: {
824
- _id: string;
825
- height: number;
826
- width: number;
827
- } | undefined;
828
- seatNumbering: Numbering$1;
829
- } | undefined;
830
- }[];
831
- default: boolean;
832
- }[];
833
- categories: {
834
- _id: number;
835
- title: string;
836
- places: {
837
- index: number;
838
- label: string;
839
- elementType: Type$1;
840
- }[];
841
- }[];
842
- uncategorizedPlaces: {
843
- index: number;
844
- label: string;
845
- elementType: Type$1;
846
- }[];
847
- }>;
848
- declare function findSeatingPlan$1(httpClient: HttpClient$1): (filter: Record<string, any> | null, options?: FindSeatingPlanOptions) => Promise<FindSeatingPlanResponse & FindSeatingPlanResponseNonNullableFields>;
849
- declare function deleteSeatingPlan$1(httpClient: HttpClient$1): (_id: string | null) => Promise<DeleteSeatingPlanResponse & DeleteSeatingPlanResponseNonNullableFields>;
850
- declare function updateSeatingPlanThumbnail$1(httpClient: HttpClient$1): (thumbnail: SeatingPlanThumbnail) => Promise<UpdateSeatingPlanThumbnailResponse>;
851
- declare function getSeatingPlanThumbnail$1(httpClient: HttpClient$1): (_id: string | null) => Promise<GetSeatingPlanThumbnailResponse>;
852
- declare const onSeatingPlanCreated$1: EventDefinition$1<SeatingPlanCreatedEnvelope, "wix.seating.v1.seating_plan_created">;
853
- declare const onSeatingPlanUpdated$1: EventDefinition$1<SeatingPlanUpdatedEnvelope, "wix.seating.v1.seating_plan_updated">;
854
- declare const onSeatingPlanDeleted$1: EventDefinition$1<SeatingPlanDeletedEnvelope, "wix.seating.v1.seating_plan_deleted">;
45
+ declare function createRESTModule$1<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
855
46
 
856
- declare const createSeatingPlan: BuildRESTFunction$1<typeof createSeatingPlan$1>;
857
- declare const updateSeatingPlan: BuildRESTFunction$1<typeof updateSeatingPlan$1>;
858
- declare const copySeatingPlan: BuildRESTFunction$1<typeof copySeatingPlan$1>;
859
- declare const querySeatingPlan: BuildRESTFunction$1<typeof querySeatingPlan$1>;
860
- declare const getSeatingPlan: BuildRESTFunction$1<typeof getSeatingPlan$1>;
861
- declare const findSeatingPlan: BuildRESTFunction$1<typeof findSeatingPlan$1>;
862
- declare const deleteSeatingPlan: BuildRESTFunction$1<typeof deleteSeatingPlan$1>;
863
- declare const updateSeatingPlanThumbnail: BuildRESTFunction$1<typeof updateSeatingPlanThumbnail$1>;
864
- declare const getSeatingPlanThumbnail: BuildRESTFunction$1<typeof getSeatingPlanThumbnail$1>;
865
- declare const onSeatingPlanCreated: BuildEventDefinition$1<typeof onSeatingPlanCreated$1>;
866
- declare const onSeatingPlanUpdated: BuildEventDefinition$1<typeof onSeatingPlanUpdated$1>;
867
- declare const onSeatingPlanDeleted: BuildEventDefinition$1<typeof onSeatingPlanDeleted$1>;
47
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
48
+
49
+ declare const createSeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicCreateSeatingPlan>>;
50
+ declare const updateSeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicUpdateSeatingPlan>>;
51
+ declare const copySeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicCopySeatingPlan>>;
52
+ declare const querySeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicQuerySeatingPlan>>;
53
+ declare const getSeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicGetSeatingPlan>>;
54
+ declare const findSeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicFindSeatingPlan>>;
55
+ declare const deleteSeatingPlan: ReturnType<typeof createRESTModule$1<typeof publicDeleteSeatingPlan>>;
56
+ declare const updateSeatingPlanThumbnail: ReturnType<typeof createRESTModule$1<typeof publicUpdateSeatingPlanThumbnail>>;
57
+ declare const getSeatingPlanThumbnail: ReturnType<typeof createRESTModule$1<typeof publicGetSeatingPlanThumbnail>>;
58
+ declare const onSeatingPlanCreated: ReturnType<typeof createEventModule$1<typeof publicOnSeatingPlanCreated>>;
59
+ declare const onSeatingPlanUpdated: ReturnType<typeof createEventModule$1<typeof publicOnSeatingPlanUpdated>>;
60
+ declare const onSeatingPlanDeleted: ReturnType<typeof createEventModule$1<typeof publicOnSeatingPlanDeleted>>;
868
61
 
869
62
  declare const context$1_copySeatingPlan: typeof copySeatingPlan;
870
63
  declare const context$1_createSeatingPlan: typeof createSeatingPlan;
@@ -882,656 +75,18 @@ declare namespace context$1 {
882
75
  export { context$1_copySeatingPlan as copySeatingPlan, context$1_createSeatingPlan as createSeatingPlan, context$1_deleteSeatingPlan as deleteSeatingPlan, context$1_findSeatingPlan as findSeatingPlan, context$1_getSeatingPlan as getSeatingPlan, context$1_getSeatingPlanThumbnail as getSeatingPlanThumbnail, context$1_onSeatingPlanCreated as onSeatingPlanCreated, context$1_onSeatingPlanDeleted as onSeatingPlanDeleted, context$1_onSeatingPlanUpdated as onSeatingPlanUpdated, context$1_querySeatingPlan as querySeatingPlan, context$1_updateSeatingPlan as updateSeatingPlan, context$1_updateSeatingPlanThumbnail as updateSeatingPlanThumbnail };
883
76
  }
884
77
 
885
- interface SeatingReservation {
886
- /**
887
- * The id of the reservation
888
- * @readonly
889
- */
890
- _id?: string | null;
891
- /**
892
- * The seating plan id
893
- * @readonly
894
- */
895
- seatingPlanId?: string | null;
896
- /**
897
- * The external seating plan id
898
- * @readonly
899
- */
900
- externalSeatingPlanId?: string | null;
901
- /** Reserved places */
902
- reservedPlaces?: PlaceReservation[];
903
- /**
904
- * A client defined external id for cross referencing.
905
- * Can reference external entities.
906
- * Format: "{fqdn}:{entity guid}"
907
- */
908
- externalId?: string | null;
909
- }
910
- interface PlaceReservation {
911
- /** The place id. */
912
- _id?: string;
913
- /**
914
- * Number of places in the spot. If not provided - defaults to 1.
915
- * Used to reserve for more that one place in areas.
916
- */
917
- capacity?: number | null;
918
- /**
919
- * Optional section label.
920
- * @readonly
921
- */
922
- sectionLabel?: string | null;
923
- /**
924
- * Area label.
925
- * @readonly
926
- */
927
- areaLabel?: string | null;
928
- /**
929
- * Table label.
930
- * @readonly
931
- */
932
- tableLabel?: string | null;
933
- /**
934
- * Row label.
935
- * @readonly
936
- */
937
- rowLabel?: string | null;
938
- /**
939
- * Seat label in a row or table.
940
- * @readonly
941
- */
942
- seatLabel?: string | null;
943
- }
944
- interface CategoryDetails {
945
- /**
946
- * Seating plan id
947
- * @readonly
948
- */
949
- seatingPlanId?: string | null;
950
- /**
951
- * External seating plan id
952
- * @readonly
953
- */
954
- externalSeatingPlanId?: string | null;
955
- /**
956
- * External category id
957
- * @readonly
958
- */
959
- externalCategoryId?: string | null;
960
- /**
961
- * Total capacity in the category
962
- * @readonly
963
- */
964
- totalCapacity?: number | null;
965
- /**
966
- * Already reserved capacity
967
- * @readonly
968
- */
969
- reserved?: number | null;
970
- }
971
- interface Cursors {
972
- /** Cursor string pointing to the next page in the list of results. */
973
- next?: string | null;
974
- /** Cursor pointing to the previous page in the list of results. */
975
- prev?: string | null;
976
- }
977
- interface DeleteSeatingReservationResponse {
978
- /** The deleted reservation */
979
- reservation?: SeatingReservation;
980
- }
981
- interface GetSeatingCategoriesSummaryResponse {
982
- /** Ticket counts by category */
983
- categories?: CategoryDetails[];
984
- }
985
- interface GetSeatingReservationsSummaryResponse {
986
- plan?: SeatingPlan;
987
- seatingReservationsSummary?: SeatingReservationsSummary;
988
- }
989
- interface SeatingPlan {
990
- /**
991
- * Auto generated unique plan id
992
- * @readonly
993
- */
994
- _id?: string | null;
995
- /**
996
- * A client defined external id for cross referencing.
997
- * Can reference external entities.
998
- * Format: "{fqdn}:{entity guid}"
999
- */
1000
- externalId?: string | null;
1001
- /** Human friendly plan title */
1002
- title?: string | null;
1003
- /** Sections of the plan. Seating plan is divided in high level sections. */
1004
- sections?: Section[];
1005
- /** Categories for plan element grouping. */
1006
- categories?: Category[];
1007
- /**
1008
- * Seating plan created timestamp.
1009
- * @readonly
1010
- */
1011
- _createdDate?: Date;
1012
- /**
1013
- * Seating plan updated timestamp.
1014
- * @readonly
1015
- */
1016
- _updatedDate?: Date;
1017
- /**
1018
- * Total capacity
1019
- * @readonly
1020
- */
1021
- totalCapacity?: number | null;
1022
- /**
1023
- * Total categories
1024
- * @readonly
1025
- */
1026
- totalCategories?: number | null;
1027
- /**
1028
- * Places not assigned to categories
1029
- * @readonly
1030
- */
1031
- uncategorizedPlaces?: Place[];
1032
- /**
1033
- * A version of the seating plan
1034
- * @readonly
1035
- */
1036
- version?: string | null;
1037
- /** Data extensions */
1038
- extendedFields?: ExtendedFields;
1039
- /** Seating Plan UI settings */
1040
- uiProperties?: SeatingPlanUiProperties;
1041
- }
1042
- interface Section {
1043
- /** Unique section id */
1044
- _id?: number;
1045
- /** Human readable section title */
1046
- title?: string | null;
1047
- /**
1048
- * Client configuration object
1049
- * @readonly
1050
- */
1051
- config?: Record<string, any> | null;
1052
- /** Elements of the section. */
1053
- elements?: Element[];
1054
- /**
1055
- * Total capacity
1056
- * @readonly
1057
- */
1058
- totalCapacity?: number | null;
1059
- /**
1060
- * Is default section
1061
- * @readonly
1062
- */
1063
- default?: boolean;
1064
- }
1065
- interface Element {
1066
- /** Unique element id */
1067
- _id?: number;
1068
- /** User friendly title/label of the element. */
1069
- title?: string | null;
1070
- /** Element type */
1071
- type?: Type;
1072
- /** Capacity. None for Shape type Element. */
1073
- capacity?: number | null;
1074
- /** Assigned to a category */
1075
- categoryId?: number | null;
1076
- /** A place numbering meta data */
1077
- sequencing?: Sequencing;
1078
- /**
1079
- * Place override (by seq_id)
1080
- * @deprecated
1081
- */
1082
- overrides?: Place[];
1083
- /**
1084
- * Final place sequence with overrides
1085
- * @readonly
1086
- */
1087
- places?: Place[];
1088
- /** Element reservation options */
1089
- reservationOptions?: ReservationOptions;
1090
- /** Element UI settings */
1091
- uiProperties?: ElementUiProperties;
1092
- }
1093
- declare enum Type {
1094
- AREA = "AREA",
1095
- ROW = "ROW",
1096
- MULTI_ROW = "MULTI_ROW",
1097
- TABLE = "TABLE",
1098
- ROUND_TABLE = "ROUND_TABLE",
1099
- SHAPE = "SHAPE"
1100
- }
1101
- interface Sequencing {
1102
- /** First seq element */
1103
- startAt?: string;
1104
- /** Finite generated seq of labels */
1105
- labels?: string[];
1106
- /** If true - direction right to left. Otherwise left to right. */
1107
- reverseOrder?: boolean | null;
1108
- }
1109
- interface Place {
1110
- /**
1111
- * Local id of the place in the sequence
1112
- * @deprecated
1113
- * @removalDate 2024-07-01
1114
- */
1115
- index?: number;
1116
- /**
1117
- * Generated composite unique id in the seating plan.
1118
- * @readonly
1119
- */
1120
- _id?: string | null;
1121
- /** Unique label of the place */
1122
- label?: string;
1123
- /**
1124
- * Max capacity per place
1125
- * @readonly
1126
- */
1127
- capacity?: number | null;
1128
- /**
1129
- * Type of the parent element
1130
- * @readonly
1131
- */
1132
- elementType?: Type;
1133
- /**
1134
- * Assigned category id
1135
- * @readonly
1136
- */
1137
- categoryId?: number | null;
1138
- }
1139
- interface ReservationOptions {
1140
- /** Indicates whether the entire element must be reserved */
1141
- reserveWholeElement?: boolean;
1142
- }
1143
- interface ElementUiProperties {
1144
- x?: number | null;
1145
- y?: number | null;
1146
- zIndex?: number | null;
1147
- width?: number | null;
1148
- height?: number | null;
1149
- rotationAngle?: number | null;
1150
- shapeType?: ShapeTypeEnumType;
1151
- fontSize?: number | null;
1152
- cornerRadius?: number | null;
1153
- seatSpacing?: number | null;
1154
- hideLabel?: boolean | null;
1155
- labelPosition?: Position;
1156
- seatLayout?: number[];
1157
- emptyTopSeatSpaces?: number | null;
1158
- /** needs research */
1159
- text?: string | null;
1160
- /** #F0F0F0 */
1161
- color?: string | null;
1162
- /** #F0F0F0 */
1163
- fillColor?: string | null;
1164
- /** #F0F0F0 */
1165
- strokeColor?: string | null;
1166
- /** px */
1167
- strokeWidth?: number | null;
1168
- opacity?: number | null;
1169
- icon?: Icon;
1170
- image?: Image;
1171
- seatNumbering?: Numbering;
1172
- }
1173
- declare enum ShapeTypeEnumType {
1174
- UNKNOWN_TYPE = "UNKNOWN_TYPE",
1175
- TEXT = "TEXT",
1176
- RECTANGLE = "RECTANGLE",
1177
- ELLIPSE = "ELLIPSE",
1178
- LINE = "LINE",
1179
- ICON = "ICON",
1180
- IMAGE = "IMAGE"
1181
- }
1182
- declare enum Position {
1183
- UNKNOWN_POSITION = "UNKNOWN_POSITION",
1184
- LEFT = "LEFT",
1185
- RIGHT = "RIGHT",
1186
- BOTH = "BOTH",
1187
- NONE = "NONE"
1188
- }
1189
- declare enum Icon {
1190
- UNKNOWN_ICON = "UNKNOWN_ICON",
1191
- ENTER = "ENTER",
1192
- EXIT = "EXIT",
1193
- DRINKS = "DRINKS",
1194
- WC = "WC",
1195
- WC_MEN = "WC_MEN",
1196
- WC_WOMEN = "WC_WOMEN",
1197
- FOOD = "FOOD",
1198
- STAIRS = "STAIRS",
1199
- ELEVATOR = "ELEVATOR",
1200
- SMOKING = "SMOKING",
1201
- CHECKROOM = "CHECKROOM",
1202
- STAGE = "STAGE"
1203
- }
1204
- interface Image {
1205
- /** WixMedia image ID. */
1206
- _id?: string;
1207
- /**
1208
- * Original image height.
1209
- * @readonly
1210
- */
1211
- height?: number;
1212
- /**
1213
- * Original image width.
1214
- * @readonly
1215
- */
1216
- width?: number;
1217
- /**
1218
- * WixMedia image URI.
1219
- * @deprecated
1220
- */
1221
- uri?: string | null;
1222
- }
1223
- declare enum Numbering {
1224
- UNKNOWN_NUMBERING = "UNKNOWN_NUMBERING",
1225
- NUMERIC = "NUMERIC",
1226
- ODD_EVEN = "ODD_EVEN",
1227
- ALPHABETICAL = "ALPHABETICAL"
1228
- }
1229
- interface Category {
1230
- /** Local category id within the seating plan */
1231
- _id?: number;
1232
- /**
1233
- * A client defined external id for cross referencing.
1234
- * Can reference external entities.
1235
- * Format: "{entity_fqdn}:{entity_id}"
1236
- */
1237
- externalId?: string | null;
1238
- /** Category label */
1239
- title?: string;
1240
- /**
1241
- * Client configuration object
1242
- * @readonly
1243
- */
1244
- config?: Record<string, any> | null;
1245
- /**
1246
- * Total capacity
1247
- * @readonly
1248
- */
1249
- totalCapacity?: number | null;
1250
- /**
1251
- * Possible places
1252
- * @readonly
1253
- */
1254
- places?: Place[];
1255
- }
1256
- interface ExtendedFields {
1257
- /**
1258
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
1259
- * The value of each key is structured according to the schema defined when the extended fields were configured.
1260
- *
1261
- * You can only access fields for which you have the appropriate permissions.
1262
- *
1263
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
1264
- */
1265
- namespaces?: Record<string, Record<string, any>>;
1266
- }
1267
- interface SeatingPlanUiProperties {
1268
- /** #F0F0F0 */
1269
- backgroundColor?: string | null;
1270
- backgroundOpacity?: number | null;
1271
- }
1272
- interface SeatingReservationsSummary {
1273
- places?: PlaceReservationDetails[];
1274
- }
1275
- interface PlaceReservationDetails {
1276
- placeId?: string;
1277
- occupied?: number;
1278
- }
1279
- interface IdentificationData extends IdentificationDataIdOneOf {
1280
- /** ID of a site visitor that has not logged in to the site. */
1281
- anonymousVisitorId?: string;
1282
- /** ID of a site visitor that has logged in to the site. */
1283
- memberId?: string;
1284
- /** ID of a Wix user (site owner, contributor, etc.). */
1285
- wixUserId?: string;
1286
- /** ID of an app. */
1287
- appId?: string;
1288
- /** @readonly */
1289
- identityType?: WebhookIdentityType;
1290
- }
1291
- /** @oneof */
1292
- interface IdentificationDataIdOneOf {
1293
- /** ID of a site visitor that has not logged in to the site. */
1294
- anonymousVisitorId?: string;
1295
- /** ID of a site visitor that has logged in to the site. */
1296
- memberId?: string;
1297
- /** ID of a Wix user (site owner, contributor, etc.). */
1298
- wixUserId?: string;
1299
- /** ID of an app. */
1300
- appId?: string;
1301
- }
1302
- declare enum WebhookIdentityType {
1303
- UNKNOWN = "UNKNOWN",
1304
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1305
- MEMBER = "MEMBER",
1306
- WIX_USER = "WIX_USER",
1307
- APP = "APP"
1308
- }
1309
- interface DeleteSeatingReservationResponseNonNullableFields {
1310
- reservation?: {
1311
- reservedPlaces: {
1312
- _id: string;
1313
- }[];
1314
- };
1315
- }
1316
- interface GetSeatingCategoriesSummaryResponseNonNullableFields {
1317
- categories: CategoryDetails[];
1318
- }
1319
- interface GetSeatingReservationsSummaryResponseNonNullableFields {
1320
- plan?: {
1321
- sections: {
1322
- _id: number;
1323
- elements: {
1324
- _id: number;
1325
- type: Type;
1326
- sequencing?: {
1327
- startAt: string;
1328
- labels: string[];
1329
- };
1330
- overrides: {
1331
- index: number;
1332
- label: string;
1333
- elementType: Type;
1334
- }[];
1335
- places: {
1336
- index: number;
1337
- label: string;
1338
- elementType: Type;
1339
- }[];
1340
- reservationOptions?: {
1341
- reserveWholeElement: boolean;
1342
- };
1343
- uiProperties?: {
1344
- shapeType: ShapeTypeEnumType;
1345
- labelPosition: Position;
1346
- seatLayout: number[];
1347
- icon: Icon;
1348
- image?: {
1349
- _id: string;
1350
- height: number;
1351
- width: number;
1352
- };
1353
- seatNumbering: Numbering;
1354
- };
1355
- }[];
1356
- default: boolean;
1357
- }[];
1358
- categories: {
1359
- _id: number;
1360
- title: string;
1361
- places: {
1362
- index: number;
1363
- label: string;
1364
- elementType: Type;
1365
- }[];
1366
- }[];
1367
- uncategorizedPlaces: {
1368
- index: number;
1369
- label: string;
1370
- elementType: Type;
1371
- }[];
1372
- };
1373
- seatingReservationsSummary?: {
1374
- places: {
1375
- placeId: string;
1376
- occupied: number;
1377
- }[];
1378
- };
1379
- }
1380
- interface BaseEventMetadata {
1381
- /** App instance ID. */
1382
- instanceId?: string | null;
1383
- /** Event type. */
1384
- eventType?: string;
1385
- /** The identification type and identity data. */
1386
- identity?: IdentificationData;
1387
- }
1388
- interface EventMetadata extends BaseEventMetadata {
1389
- /**
1390
- * Unique event ID.
1391
- * Allows clients to ignore duplicate webhooks.
1392
- */
1393
- _id?: string;
1394
- /**
1395
- * Assumes actions are also always typed to an entity_type
1396
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1397
- */
1398
- entityFqdn?: string;
1399
- /**
1400
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1401
- * This is although the created/updated/deleted notion is duplication of the oneof types
1402
- * Example: created/updated/deleted/started/completed/email_opened
1403
- */
1404
- slug?: string;
1405
- /** ID of the entity associated with the event. */
1406
- entityId?: string;
1407
- /** Event timestamp. */
1408
- eventTime?: Date;
1409
- /**
1410
- * Whether the event was triggered as a result of a privacy regulation application
1411
- * (for example, GDPR).
1412
- */
1413
- triggeredByAnonymizeRequest?: boolean | null;
1414
- /** If present, indicates the action that triggered the event. */
1415
- originatedFrom?: string | null;
1416
- /**
1417
- * A sequence number defining the order of updates to the underlying entity.
1418
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1419
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1420
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1421
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1422
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1423
- */
1424
- entityEventSequence?: string | null;
1425
- }
1426
- interface SeatingReservationCreatedEnvelope {
1427
- entity: SeatingReservation;
1428
- metadata: EventMetadata;
1429
- }
1430
- interface SeatingReservationDeletedEnvelope {
1431
- metadata: EventMetadata;
1432
- }
1433
- interface CreateSeatingReservationOptions {
1434
- /** A reservation to create */
1435
- reservation?: SeatingReservation;
1436
- }
1437
- interface QueryCursorResult {
1438
- cursors: Cursors;
1439
- hasNext: () => boolean;
1440
- hasPrev: () => boolean;
1441
- length: number;
1442
- pageSize: number;
1443
- }
1444
- interface ReservationsQueryResult extends QueryCursorResult {
1445
- items: SeatingReservation[];
1446
- query: ReservationsQueryBuilder;
1447
- next: () => Promise<ReservationsQueryResult>;
1448
- prev: () => Promise<ReservationsQueryResult>;
1449
- }
1450
- interface ReservationsQueryBuilder {
1451
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1452
- * @documentationMaturity preview
1453
- */
1454
- limit: (limit: number) => ReservationsQueryBuilder;
1455
- /** @param cursor - A pointer to specific record
1456
- * @documentationMaturity preview
1457
- */
1458
- skipTo: (cursor: string) => ReservationsQueryBuilder;
1459
- /** @documentationMaturity preview */
1460
- find: () => Promise<ReservationsQueryResult>;
1461
- }
1462
- interface GetSeatingCategoriesSummaryOptions {
1463
- /** Seating plan external id */
1464
- externalId?: string[];
1465
- }
1466
-
1467
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
1468
- interface HttpClient {
1469
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1470
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
1471
- }
1472
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
1473
- type HttpResponse<T = any> = {
1474
- data: T;
1475
- status: number;
1476
- statusText: string;
1477
- headers: any;
1478
- request?: any;
1479
- };
1480
- type RequestOptions<_TResponse = any, Data = any> = {
1481
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1482
- url: string;
1483
- data?: Data;
1484
- params?: URLSearchParams;
1485
- } & APIMetadata;
1486
- type APIMetadata = {
1487
- methodFqn?: string;
1488
- entityFqdn?: string;
1489
- packageName?: string;
1490
- };
1491
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
1492
- type EventDefinition<Payload = unknown, Type extends string = string> = {
1493
- __type: 'event-definition';
1494
- type: Type;
1495
- isDomainEvent?: boolean;
1496
- transformations?: (envelope: unknown) => Payload;
1497
- __payload: Payload;
1498
- };
1499
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
1500
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
1501
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
1502
-
1503
- declare global {
1504
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1505
- interface SymbolConstructor {
1506
- readonly observable: symbol;
1507
- }
1508
- }
78
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
1509
79
 
1510
- declare function createSeatingReservation$1(httpClient: HttpClient): (options?: CreateSeatingReservationOptions) => Promise<SeatingReservation & {
1511
- reservedPlaces: {
1512
- _id: string;
1513
- }[];
1514
- }>;
1515
- declare function getReservation$1(httpClient: HttpClient): (_id: string | null) => Promise<SeatingReservation & {
1516
- reservedPlaces: {
1517
- _id: string;
1518
- }[];
1519
- }>;
1520
- declare function querySeatingReservation$1(httpClient: HttpClient): () => ReservationsQueryBuilder;
1521
- declare function deleteSeatingReservation$1(httpClient: HttpClient): (_id: string | null) => Promise<DeleteSeatingReservationResponse & DeleteSeatingReservationResponseNonNullableFields>;
1522
- declare function getSeatingCategoriesSummary$1(httpClient: HttpClient): (options?: GetSeatingCategoriesSummaryOptions) => Promise<GetSeatingCategoriesSummaryResponse & GetSeatingCategoriesSummaryResponseNonNullableFields>;
1523
- declare function getSeatingReservationsSummary$1(httpClient: HttpClient): (filter: Record<string, any> | null) => Promise<GetSeatingReservationsSummaryResponse & GetSeatingReservationsSummaryResponseNonNullableFields>;
1524
- declare const onSeatingReservationCreated$1: EventDefinition<SeatingReservationCreatedEnvelope, "wix.seating.v1.seating_reservation_created">;
1525
- declare const onSeatingReservationDeleted$1: EventDefinition<SeatingReservationDeletedEnvelope, "wix.seating.v1.seating_reservation_deleted">;
80
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1526
81
 
1527
- declare const createSeatingReservation: BuildRESTFunction<typeof createSeatingReservation$1>;
1528
- declare const getReservation: BuildRESTFunction<typeof getReservation$1>;
1529
- declare const querySeatingReservation: BuildRESTFunction<typeof querySeatingReservation$1>;
1530
- declare const deleteSeatingReservation: BuildRESTFunction<typeof deleteSeatingReservation$1>;
1531
- declare const getSeatingCategoriesSummary: BuildRESTFunction<typeof getSeatingCategoriesSummary$1>;
1532
- declare const getSeatingReservationsSummary: BuildRESTFunction<typeof getSeatingReservationsSummary$1>;
1533
- declare const onSeatingReservationCreated: BuildEventDefinition<typeof onSeatingReservationCreated$1>;
1534
- declare const onSeatingReservationDeleted: BuildEventDefinition<typeof onSeatingReservationDeleted$1>;
82
+ declare const createSeatingReservation: ReturnType<typeof createRESTModule<typeof publicCreateSeatingReservation>>;
83
+ declare const getReservation: ReturnType<typeof createRESTModule<typeof publicGetReservation>>;
84
+ declare const querySeatingReservation: ReturnType<typeof createRESTModule<typeof publicQuerySeatingReservation>>;
85
+ declare const deleteSeatingReservation: ReturnType<typeof createRESTModule<typeof publicDeleteSeatingReservation>>;
86
+ declare const getSeatingCategoriesSummary: ReturnType<typeof createRESTModule<typeof publicGetSeatingCategoriesSummary>>;
87
+ declare const getSeatingReservationsSummary: ReturnType<typeof createRESTModule<typeof publicGetSeatingReservationsSummary>>;
88
+ declare const onSeatingReservationCreated: ReturnType<typeof createEventModule<typeof publicOnSeatingReservationCreated>>;
89
+ declare const onSeatingReservationDeleted: ReturnType<typeof createEventModule<typeof publicOnSeatingReservationDeleted>>;
1535
90
 
1536
91
  declare const context_createSeatingReservation: typeof createSeatingReservation;
1537
92
  declare const context_deleteSeatingReservation: typeof deleteSeatingReservation;