@wix/crm 1.0.117 → 1.0.119

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,194 +1,8 @@
1
- interface ContactAttachment extends ContactAttachmentMediaOneOf {
2
- /** The attachment's image (if the attachment is of type IMAGE) */
3
- image?: string;
4
- /** The attachment's document (if the attachment is of type OTHER) */
5
- document?: string;
6
- /**
7
- * The id of the attachment.
8
- * @readonly
9
- */
10
- _id?: string;
11
- /**
12
- * Image preview (reduced image size) of the attachment (if the attachment is of type IMAGE).
13
- * @readonly
14
- */
15
- previewImage?: string;
16
- /**
17
- * The file name of the attachment.
18
- * @readonly
19
- */
20
- fileName?: string;
21
- /**
22
- * The mime type of the attachment.
23
- * @readonly
24
- */
25
- mimeType?: string;
26
- /**
27
- * The type of the attachment
28
- * @readonly
29
- */
30
- attachmentType?: AttachmentType;
31
- }
32
- /** @oneof */
33
- interface ContactAttachmentMediaOneOf {
34
- /** The attachment's image (if the attachment is of type IMAGE) */
35
- image?: string;
36
- /** The attachment's document (if the attachment is of type OTHER) */
37
- document?: string;
38
- }
39
- declare enum AttachmentType {
40
- UNKNOWN = "UNKNOWN",
41
- IMAGE = "IMAGE",
42
- OTHER = "OTHER"
43
- }
44
- interface GenerateAttachmentUploadUrlResponse {
45
- /** The URL for uploading a file as an attachment to the contact. */
46
- uploadUrl?: string;
47
- }
48
- interface Paging {
49
- /** Number of items to return (default 100, max 100). */
50
- limit?: number | null;
51
- /** number of items to skip in the current sort order */
52
- offset?: number | null;
53
- }
54
- interface ListAttachmentsResponse {
55
- /** The requested attachments */
56
- attachments?: ContactAttachment[];
57
- /** Metadata for the page of results. */
58
- metadata?: PagingMetadata;
59
- }
60
- interface PagingMetadata {
61
- /** The number of items returned in this response */
62
- count?: number | null;
63
- /** The offset which was requested */
64
- offset?: number | null;
65
- /** The total number of items that match the query */
66
- total?: number | null;
67
- /** A flag that indicates the server failed to calculate 'total' field */
68
- tooManyToCount?: boolean | null;
69
- }
70
- interface IdentificationData$4 extends IdentificationDataIdOneOf$4 {
71
- /** ID of a site visitor that has not logged in to the site. */
72
- anonymousVisitorId?: string;
73
- /** ID of a site visitor that has logged in to the site. */
74
- memberId?: string;
75
- /** ID of a Wix user (site owner, contributor, etc.). */
76
- wixUserId?: string;
77
- /** ID of an app. */
78
- appId?: string;
79
- /** @readonly */
80
- identityType?: WebhookIdentityType$4;
81
- }
82
- /** @oneof */
83
- interface IdentificationDataIdOneOf$4 {
84
- /** ID of a site visitor that has not logged in to the site. */
85
- anonymousVisitorId?: string;
86
- /** ID of a site visitor that has logged in to the site. */
87
- memberId?: string;
88
- /** ID of a Wix user (site owner, contributor, etc.). */
89
- wixUserId?: string;
90
- /** ID of an app. */
91
- appId?: string;
92
- }
93
- declare enum WebhookIdentityType$4 {
94
- UNKNOWN = "UNKNOWN",
95
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
96
- MEMBER = "MEMBER",
97
- WIX_USER = "WIX_USER",
98
- APP = "APP"
99
- }
100
- interface GenerateAttachmentUploadUrlResponseNonNullableFields {
101
- uploadUrl: string;
102
- }
103
- interface ListAttachmentsResponseNonNullableFields {
104
- attachments: {
105
- image: string;
106
- document: string;
107
- _id: string;
108
- previewImage: string;
109
- fileName: string;
110
- mimeType: string;
111
- attachmentType: AttachmentType;
112
- }[];
113
- }
114
- interface BaseEventMetadata$4 {
115
- /** App instance ID. */
116
- instanceId?: string | null;
117
- /** Event type. */
118
- eventType?: string;
119
- /** The identification type and identity data. */
120
- identity?: IdentificationData$4;
121
- }
122
- interface EventMetadata$4 extends BaseEventMetadata$4 {
123
- /**
124
- * Unique event ID.
125
- * Allows clients to ignore duplicate webhooks.
126
- */
127
- _id?: string;
128
- /**
129
- * Assumes actions are also always typed to an entity_type
130
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
131
- */
132
- entityFqdn?: string;
133
- /**
134
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
135
- * This is although the created/updated/deleted notion is duplication of the oneof types
136
- * Example: created/updated/deleted/started/completed/email_opened
137
- */
138
- slug?: string;
139
- /** ID of the entity associated with the event. */
140
- entityId?: string;
141
- /** Event timestamp. */
142
- eventTime?: Date;
143
- /**
144
- * Whether the event was triggered as a result of a privacy regulation application
145
- * (for example, GDPR).
146
- */
147
- triggeredByAnonymizeRequest?: boolean | null;
148
- /** If present, indicates the action that triggered the event. */
149
- originatedFrom?: string | null;
150
- /**
151
- * A sequence number defining the order of updates to the underlying entity.
152
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
153
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
154
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
155
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
156
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
157
- */
158
- entityEventSequence?: string | null;
159
- }
160
- interface AttachmentCreatedEnvelope {
161
- entity: ContactAttachment;
162
- metadata: EventMetadata$4;
163
- }
164
- interface AttachmentDeletedEnvelope {
165
- metadata: EventMetadata$4;
166
- }
167
- interface GenerateAttachmentUploadUrlOptions {
168
- /** Mime type e.g: `application/pdf` */
169
- mimeType: string;
170
- }
171
- interface ListAttachmentsOptions {
172
- /** Allow paginating, default: limit = 100 and offset = 0 */
173
- paging?: Paging;
174
- }
175
- interface DeleteAttachmentIdentifiers {
176
- /** Contact ID */
177
- contactId: string;
178
- /** Attachment ID. */
179
- attachmentId: string;
180
- }
181
- interface GetAttachmentIdentifiers {
182
- /** Contact ID */
183
- contactId: string;
184
- /** Attachment ID. */
185
- attachmentId: string;
186
- }
187
-
188
1
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
189
2
  interface HttpClient {
190
3
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
191
- fetchWithAuth: (url: string | URL, init?: RequestInit) => Promise<Response>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
192
6
  }
193
7
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
194
8
  type HttpResponse<T = any> = {
@@ -228,27 +42,16 @@ declare global {
228
42
  }
229
43
  }
230
44
 
231
- declare function generateAttachmentUploadUrl$1(httpClient: HttpClient): (contactId: string, fileName: string, options: GenerateAttachmentUploadUrlOptions) => Promise<GenerateAttachmentUploadUrlResponse & GenerateAttachmentUploadUrlResponseNonNullableFields>;
232
- declare function listAttachments$1(httpClient: HttpClient): (contactId: string, options?: ListAttachmentsOptions) => Promise<ListAttachmentsResponse & ListAttachmentsResponseNonNullableFields>;
233
- declare function deleteAttachment$1(httpClient: HttpClient): (identifiers: DeleteAttachmentIdentifiers) => Promise<void>;
234
- declare function getAttachment$1(httpClient: HttpClient): (identifiers: GetAttachmentIdentifiers) => Promise<ContactAttachment & {
235
- image: string;
236
- document: string;
237
- _id: string;
238
- previewImage: string;
239
- fileName: string;
240
- mimeType: string;
241
- attachmentType: AttachmentType;
242
- }>;
243
- declare const onAttachmentCreated$1: EventDefinition<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
244
- declare const onAttachmentDeleted$1: EventDefinition<AttachmentDeletedEnvelope, "wix.contacts.v4.attachment_deleted">;
45
+ declare function createRESTModule$5<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
46
+
47
+ declare function createEventModule$4<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
245
48
 
246
- declare const generateAttachmentUploadUrl: BuildRESTFunction<typeof generateAttachmentUploadUrl$1>;
247
- declare const listAttachments: BuildRESTFunction<typeof listAttachments$1>;
248
- declare const deleteAttachment: BuildRESTFunction<typeof deleteAttachment$1>;
249
- declare const getAttachment: BuildRESTFunction<typeof getAttachment$1>;
250
- declare const onAttachmentCreated: BuildEventDefinition<typeof onAttachmentCreated$1>;
251
- declare const onAttachmentDeleted: BuildEventDefinition<typeof onAttachmentDeleted$1>;
49
+ declare const generateAttachmentUploadUrl: ReturnType<typeof createRESTModule$5<typeof publicGenerateAttachmentUploadUrl>>;
50
+ declare const listAttachments: ReturnType<typeof createRESTModule$5<typeof publicListAttachments>>;
51
+ declare const deleteAttachment: ReturnType<typeof createRESTModule$5<typeof publicDeleteAttachment>>;
52
+ declare const getAttachment: ReturnType<typeof createRESTModule$5<typeof publicGetAttachment>>;
53
+ declare const onAttachmentCreated: ReturnType<typeof createEventModule$4<typeof publicOnAttachmentCreated>>;
54
+ declare const onAttachmentDeleted: ReturnType<typeof createEventModule$4<typeof publicOnAttachmentDeleted>>;
252
55
 
253
56
  declare const context$5_deleteAttachment: typeof deleteAttachment;
254
57
  declare const context$5_generateAttachmentUploadUrl: typeof generateAttachmentUploadUrl;
@@ -260,934 +63,22 @@ declare namespace context$5 {
260
63
  export { context$5_deleteAttachment as deleteAttachment, context$5_generateAttachmentUploadUrl as generateAttachmentUploadUrl, context$5_getAttachment as getAttachment, context$5_listAttachments as listAttachments, context$5_onAttachmentCreated as onAttachmentCreated, context$5_onAttachmentDeleted as onAttachmentDeleted };
261
64
  }
262
65
 
263
- interface Contact {
264
- /**
265
- * Contact ID.
266
- * @readonly
267
- */
268
- _id?: string;
269
- /**
270
- * Revision number, which increments by 1 each time the contact is updated.
271
- * To prevent conflicting changes,
272
- * the existing `revision` must be used when updating a contact.
273
- * @readonly
274
- */
275
- revision?: number;
276
- /**
277
- * Details about the contact's source.
278
- * @readonly
279
- */
280
- source?: ContactSource;
281
- /**
282
- * Date and time the contact was created.
283
- * @readonly
284
- */
285
- _createdDate?: Date;
286
- /**
287
- * Date and time the contact was last updated.
288
- * @readonly
289
- */
290
- _updatedDate?: Date;
291
- /**
292
- * Details about the contact's last action in the site.
293
- * @readonly
294
- */
295
- lastActivity?: ContactActivity;
296
- /**
297
- * Contact's primary phone and email.
298
- *
299
- * This property reflects the email address in `contactInfo.emails` where `primary` is `true`.
300
- * @readonly
301
- */
302
- primaryInfo?: PrimaryContactInfo;
303
- /** Contact's details. */
304
- info?: ContactInfo$2;
305
- }
306
- interface ContactSource {
307
- /**
308
- * Source type.
309
- * @readonly
310
- */
311
- sourceType?: ContactSourceType;
312
- /**
313
- * App ID, if the contact was created by an app.
314
- * @readonly
315
- */
316
- appId?: string | null;
317
- }
318
- declare enum ContactSourceType {
319
- OTHER = "OTHER",
320
- ADMIN = "ADMIN",
321
- WIX_APP = "WIX_APP",
322
- IMPORT = "IMPORT",
323
- THIRD_PARTY = "THIRD_PARTY",
324
- WIX_BOOKINGS = "WIX_BOOKINGS",
325
- WIX_CHAT = "WIX_CHAT",
326
- WIX_EMAIL_MARKETING = "WIX_EMAIL_MARKETING",
327
- WIX_EVENTS = "WIX_EVENTS",
328
- WIX_FORMS = "WIX_FORMS",
329
- WIX_GROUPS = "WIX_GROUPS",
330
- WIX_HOTELS = "WIX_HOTELS",
331
- WIX_MARKET_PLACE = "WIX_MARKET_PLACE",
332
- WIX_MUSIC = "WIX_MUSIC",
333
- WIX_RESTAURANTS = "WIX_RESTAURANTS",
334
- WIX_SITE_MEMBERS = "WIX_SITE_MEMBERS",
335
- WIX_STORES = "WIX_STORES",
336
- WIX_CODE = "WIX_CODE",
337
- HOPP = "HOPP"
338
- }
339
- interface ContactActivity {
340
- /** Date and time of the last action. */
341
- activityDate?: Date;
342
- /** */
343
- activityType?: ContactActivityType;
344
- }
345
- declare enum ContactActivityType {
346
- /** Last visit to your site (any unknown activity) */
347
- GENERAL = "GENERAL",
348
- /** This cannot be reported, used when contact created, will throw exception */
349
- CONTACT_CREATED = "CONTACT_CREATED",
350
- /** "auth/login" */
351
- MEMBER_LOGIN = "MEMBER_LOGIN",
352
- /** "auth/register" */
353
- MEMBER_REGISTER = "MEMBER_REGISTER",
354
- /** "auth/status-change" */
355
- MEMBER_STATUS_CHANGED = "MEMBER_STATUS_CHANGED",
356
- /** "contact/contact-form", (but also "form/contact-form", "form/form") */
357
- FORM_SUBMITTED = "FORM_SUBMITTED",
358
- /** "form/lead-capture-form" */
359
- INBOX_FORM_SUBMITTED = "INBOX_FORM_SUBMITTED",
360
- /** "chat/payment-request-paid" */
361
- INBOX_PAYMENT_REQUEST_PAID = "INBOX_PAYMENT_REQUEST_PAID",
362
- /** "messaging/email" - Direction BUSINESS_TO_CUSTOMER */
363
- INBOX_MESSAGE_TO_CUSTOMER = "INBOX_MESSAGE_TO_CUSTOMER",
364
- /** "messaging/email" - Direction CUSTOMER_TO_BUSINESS */
365
- INBOX_MESSAGE_FROM_CUSTOMER = "INBOX_MESSAGE_FROM_CUSTOMER",
366
- /** "contact/subscription-form" (but also "form/subscription-form") */
367
- NEWSLETTER_SUBSCRIPTION_FORM_SUBMITTED = "NEWSLETTER_SUBSCRIPTION_FORM_SUBMITTED",
368
- /** "contact/unsubscribe" */
369
- NEWSLETTER_SUBSCRIPTION_UNSUBSCRIBE = "NEWSLETTER_SUBSCRIPTION_UNSUBSCRIBE",
370
- /** "e_commerce/purchase" */
371
- ECOM_PURCHASE = "ECOM_PURCHASE",
372
- /** "e_commerce/cart-abandon" */
373
- ECOM_CART_ABANDON = "ECOM_CART_ABANDON",
374
- /** "e_commerce/checkout-buyer" */
375
- ECOM_CHECKOUT_BUYER = "ECOM_CHECKOUT_BUYER",
376
- /** "scheduler/appointment" */
377
- BOOKINGS_APPOINTMENT = "BOOKINGS_APPOINTMENT",
378
- /** "hotels/reservation" */
379
- HOTELS_RESERVATION = "HOTELS_RESERVATION",
380
- /** "hotels/purchase" */
381
- HOTELS_PURCHASE = "HOTELS_PURCHASE",
382
- /** "hotels/confirmation" */
383
- HOTELS_CONFIRMATION = "HOTELS_CONFIRMATION",
384
- /** "hotels/cancel" */
385
- HOTELS_CANCEL = "HOTELS_CANCEL",
386
- /** "video/purchase" */
387
- VIDEO_PURCHASE = "VIDEO_PURCHASE",
388
- /** "video/rent" */
389
- VIDEO_RENT = "VIDEO_RENT",
390
- /** "cashier/button_purchase" */
391
- CASHIER_BUTTON_PURCHASE = "CASHIER_BUTTON_PURCHASE",
392
- /** "arena/new-lead" */
393
- ARENA_NEW_LEAD = "ARENA_NEW_LEAD",
394
- /** "events/rsvp" */
395
- EVENTS_RSVP = "EVENTS_RSVP",
396
- /** "invoice/pay" */
397
- INVOICE_PAY = "INVOICE_PAY",
398
- /** "invoice/overdue" */
399
- INVOICE_OVERDUE = "INVOICE_OVERDUE",
400
- /** "price-quote/accept" */
401
- PRICE_QUOTE_ACCEPT = "PRICE_QUOTE_ACCEPT",
402
- /** "price-quote/expire" */
403
- PRICE_QUOTE_EXPIRE = "PRICE_QUOTE_EXPIRE",
404
- /** "restaurants/order" */
405
- RESTAURANTS_ORDER = "RESTAURANTS_ORDER",
406
- /** "restaurants/reservation" */
407
- RESTAURANTS_RESERVATION = "RESTAURANTS_RESERVATION",
408
- /** "shoutout/open" */
409
- SHOUTOUT_OPEN = "SHOUTOUT_OPEN",
410
- /** "shoutout/click" */
411
- SHOUTOUT_CLICK = "SHOUTOUT_CLICK",
412
- CONTACT_MERGED = "CONTACT_MERGED",
413
- /** "contact/subscribe" */
414
- NEWSLETTER_SUBSCRIPTION_SUBSCRIBE = "NEWSLETTER_SUBSCRIPTION_SUBSCRIBE",
415
- /** "contact/subscription-pending" */
416
- NEWSLETTER_SUBSCRIPTION_PENDING = "NEWSLETTER_SUBSCRIPTION_PENDING",
417
- /** "contact/subscription-not-set" */
418
- NEWSLETTER_SUBSCRIPTION_NOT_SET = "NEWSLETTER_SUBSCRIPTION_NOT_SET",
419
- /** "contact/phone-subscription-subscribe" */
420
- PHONE_SUBSCRIPTION_SUBSCRIBE = "PHONE_SUBSCRIPTION_SUBSCRIBE",
421
- /** "contact/phone-subscription-pending" */
422
- PHONE_SUBSCRIPTION_PENDING = "PHONE_SUBSCRIPTION_PENDING",
423
- /** "contact/phone-subscription-not-set" */
424
- PHONE_SUBSCRIPTION_NOT_SET = "PHONE_SUBSCRIPTION_NOT_SET",
425
- /** "contact/phone-subscription-unsubscribe" */
426
- PHONE_SUBSCRIPTION_UNSUBSCRIBE = "PHONE_SUBSCRIPTION_UNSUBSCRIBE"
427
- }
428
- interface PrimaryContactInfo {
429
- /**
430
- * Primary email address.
431
- *
432
- * This property reflects the email address in `info.emails`
433
- * where `primary` is `true`.
434
- * @readonly
435
- */
436
- email?: string | null;
437
- /**
438
- * Primary phone number.
439
- *
440
- * This property reflects the phone number in `contactInfo.phones` where `primary` is `true`.
441
- * @readonly
442
- */
443
- phone?: string | null;
444
- }
445
- interface ContactInfo$2 {
446
- /** Contact's first and last name. */
447
- name?: ContactName$1;
448
- /** Contact's email addresses. */
449
- emails?: ContactEmailsWrapper$1;
450
- /** Contact's phone numbers. */
451
- phones?: ContactPhonesWrapper$1;
452
- /** Contact's street addresses. */
453
- addresses?: ContactAddressesWrapper$1;
454
- /** Contact's company name. */
455
- company?: string | null;
456
- /**
457
- * Contact's job title.
458
- * Corresponds to the **Position** field in the Dashboard.
459
- */
460
- jobTitle?: string | null;
461
- /** Birth date in `YYYY-MM-DD` format. For example, `2020-03-15`. */
462
- birthdate?: string | null;
463
- /**
464
- * Locale in
465
- * [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
466
- * Typically, this is a lowercase 2-letter language code,
467
- * followed by a hyphen, followed by an uppercase 2-letter country code.
468
- * For example, `en-US` for U.S. English, and `de-DE` for Germany German.
469
- */
470
- locale?: string | null;
471
- /**
472
- * List of label keys applied to the contact.
473
- *
474
- * Label keys must exist to be added to the contact.
475
- * Contact labels can be created with the
476
- * `findOrCreateLabel()` function. You can use the
477
- * `queryLabels()` function to view the currently existing labels.
478
- *
479
- */
480
- labelKeys?: LabelsWrapper$1;
481
- /**
482
- * Additional custom fields.
483
- * This includes fields managed by Wix, by 3rd-party apps, and by the site.
484
- *
485
- * Empty fields are not returned.
486
- */
487
- extendedFields?: ExtendedFieldsWrapper$1;
488
- /** Contact's profile picture. */
489
- picture?: ContactPicture$1;
490
- }
491
- interface ContactName$1 {
492
- /** Contact's first name. */
493
- first?: string | null;
494
- /** Contact's last name. */
495
- last?: string | null;
496
- }
497
- interface ContactEmailsWrapper$1 {
498
- /** List of up to 50 email addresses. */
499
- items?: ContactEmail$1[];
500
- }
501
- interface ContactEmail$1 {
502
- /**
503
- * Email ID.
504
- * @readonly
505
- */
506
- _id?: string | null;
507
- /**
508
- * Email type.
509
- *
510
- * `"UNTAGGED"` is shown as "Other" in the Contact List.
511
- */
512
- tag?: EmailTag$1;
513
- /** Email address. */
514
- email?: string;
515
- /**
516
- * Indicates whether this is the contact's primary email address.
517
- * When changing `primary` to `true` for an email,
518
- * the contact's other emails become `false`.
519
- * It also affects the subscription status to marketing emails that are decided based on the primary email.
520
- */
521
- primary?: boolean | null;
522
- }
523
- declare enum EmailTag$1 {
524
- UNTAGGED = "UNTAGGED",
525
- MAIN = "MAIN",
526
- HOME = "HOME",
527
- WORK = "WORK"
528
- }
529
- interface ContactPhonesWrapper$1 {
530
- /** List of up to 50 phone numbers. */
531
- items?: ContactPhone$1[];
532
- }
533
- interface ContactPhone$1 {
534
- /**
535
- * Phone ID.
536
- * @readonly
537
- */
538
- _id?: string | null;
539
- /**
540
- * Phone type.
541
- *
542
- * `"UNTAGGED"` is shown as "Other" in the Contact List.
543
- */
544
- tag?: PhoneTag$1;
545
- /** [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. */
546
- countryCode?: string | null;
547
- /** Phone number. */
548
- phone?: string;
549
- /**
550
- * [ITU E.164-formatted](https://www.itu.int/rec/T-REC-E.164/)
551
- * phone number.
552
- * Automatically generated using `phone` and `countryCode`, pending both values are valid.
553
- * @readonly
554
- */
555
- e164Phone?: string | null;
556
- /**
557
- * Whether this is the contact's primary phone number.
558
- * When changing `primary` to `true` for a phone,
559
- * the contact's `primary` field for other phones becomes `false`.
560
- * It also affects the subscription status to SMS messages that are decided based on the primary phone.
561
- */
562
- primary?: boolean | null;
563
- }
564
- declare enum PhoneTag$1 {
565
- UNTAGGED = "UNTAGGED",
566
- MAIN = "MAIN",
567
- HOME = "HOME",
568
- MOBILE = "MOBILE",
569
- WORK = "WORK",
570
- FAX = "FAX"
571
- }
572
- interface ContactAddressesWrapper$1 {
573
- /** List of up to 50 addresses. */
574
- items?: ContactAddress$1[];
575
- }
576
- interface ContactAddress$1 {
577
- /**
578
- * Street address ID.
579
- * @readonly
580
- */
581
- _id?: string | null;
582
- /**
583
- * Address type.
584
- *
585
- * `"UNTAGGED"` is shown as "Other" in the Contact List.
586
- *
587
- *
588
- */
589
- tag?: AddressTag$1;
590
- /** Street address. */
591
- address?: Address$1;
592
- }
593
- declare enum AddressTag$1 {
594
- UNTAGGED = "UNTAGGED",
595
- HOME = "HOME",
596
- WORK = "WORK",
597
- BILLING = "BILLING",
598
- SHIPPING = "SHIPPING"
599
- }
600
- /** Physical address */
601
- interface Address$1 extends AddressStreetOneOf$1 {
602
- /** Street address object, with number and name in separate fields. */
603
- streetAddress?: StreetAddress$1;
604
- /** Main address line, usually street and number, as free text. */
605
- addressLine1?: string | null;
606
- /**
607
- * 2-letter country code in an
608
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
609
- */
610
- country?: string | null;
611
- /**
612
- * Code for a subdivision (such as state, prefecture, or province) in an
613
- * [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.
614
- */
615
- subdivision?: string | null;
616
- /** City name. */
617
- city?: string | null;
618
- /** Postal or zip code. */
619
- postalCode?: string | null;
620
- /**
621
- * Free text providing more detailed address information,
622
- * such as apartment, suite, or floor.
623
- */
624
- addressLine2?: string | null;
625
- }
626
- /** @oneof */
627
- interface AddressStreetOneOf$1 {
628
- /** Street address object, with number and name in separate fields. */
629
- streetAddress?: StreetAddress$1;
630
- /** Main address line, usually street and number, as free text. */
631
- addressLine?: string | null;
632
- }
633
- interface StreetAddress$1 {
634
- /** Street number. */
635
- number?: string;
636
- /** Street name. */
637
- name?: string;
638
- }
639
- interface LabelsWrapper$1 {
640
- /**
641
- * List of contact label keys.
642
- * [Contact labels](https://support.wix.com/en/article/adding-labels-to-contacts-in-your-contact-list)
643
- * help categorize contacts.
644
- *
645
- * Label keys must exist to be added to the contact.
646
- * Contact labels can be created or retrieved with
647
- * [Find or Create Label](https://dev.wix.com/api/rest/contacts/labels/find-or-create-label)
648
- * or
649
- * [List Labels](https://dev.wix.com/api/rest/contacts/labels/list-labels)
650
- */
651
- items?: string[];
652
- }
653
- interface ExtendedFieldsWrapper$1 {
654
- /**
655
- * Set of key-value pairs.
656
- *
657
- * Contact's extended fields which allow you to store additional information about your contacts.
658
- *
659
- * To view or create extended fields, use
660
- * `findOrCreateExtendedField()`,
661
- * `getExtendedField()`, or
662
- * `queryExtendedFields()` in the Extended Fields API.
663
- */
664
- items?: Record<string, any>;
665
- }
666
- /** TEST contact picture description */
667
- interface ContactPicture$1 {
668
- /**
669
- * Image.
670
- * This can contain an image URL or a Wix Media image ID.
671
- */
672
- image?: string;
673
- }
674
- /** Contact. */
675
- interface CreateContactResponse {
676
- /** Contact. */
677
- contact?: Contact;
678
- }
679
- /** Updated contact. */
680
- interface UpdateContactResponse {
681
- /** Updated contact. */
682
- contact?: Contact;
683
- }
684
- interface MergeContactsResponse {
685
- /** Updated target contact. */
686
- contact?: Contact;
687
- }
688
- interface ContactMerged {
689
- /** ID of the contact the source contacts were merged into. */
690
- targetContactId?: string;
691
- /** IDs of contacts that were merged into the target contact. */
692
- sourceContactIds?: string[];
693
- /** Updated target contact. */
694
- targetContact?: Contact;
695
- }
696
- /** Updated contact. */
697
- interface LabelContactResponse {
698
- /** Updated contact. */
699
- contact?: Contact;
700
- }
701
- /** Updated contact. */
702
- interface UnlabelContactResponse {
703
- /** Updated contact. */
704
- contact?: Contact;
705
- }
706
- declare enum ContactFieldSet {
707
- /** name, primaryEmail, primaryPhone */
708
- BASIC = "BASIC",
709
- /** name, phones, emails, addresses */
710
- COMMUNICATION_DETAILS = "COMMUNICATION_DETAILS",
711
- /** name, primaryInfo(email, phone), extendedFields */
712
- EXTENDED = "EXTENDED",
713
- /** Full contact object */
714
- FULL = "FULL"
715
- }
716
- interface IdentificationData$3 extends IdentificationDataIdOneOf$3 {
717
- /** ID of a site visitor that has not logged in to the site. */
718
- anonymousVisitorId?: string;
719
- /** ID of a site visitor that has logged in to the site. */
720
- memberId?: string;
721
- /** ID of a Wix user (site owner, contributor, etc.). */
722
- wixUserId?: string;
723
- /** ID of an app. */
724
- appId?: string;
725
- /** @readonly */
726
- identityType?: WebhookIdentityType$3;
727
- }
728
- /** @oneof */
729
- interface IdentificationDataIdOneOf$3 {
730
- /** ID of a site visitor that has not logged in to the site. */
731
- anonymousVisitorId?: string;
732
- /** ID of a site visitor that has logged in to the site. */
733
- memberId?: string;
734
- /** ID of a Wix user (site owner, contributor, etc.). */
735
- wixUserId?: string;
736
- /** ID of an app. */
737
- appId?: string;
738
- }
739
- declare enum WebhookIdentityType$3 {
740
- UNKNOWN = "UNKNOWN",
741
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
742
- MEMBER = "MEMBER",
743
- WIX_USER = "WIX_USER",
744
- APP = "APP"
745
- }
746
- interface CreateContactResponseNonNullableFields {
747
- contact?: {
748
- _id: string;
749
- revision: number;
750
- source?: {
751
- sourceType: ContactSourceType;
752
- };
753
- lastActivity?: {
754
- activityType: ContactActivityType;
755
- };
756
- info?: {
757
- emails?: {
758
- items: {
759
- tag: EmailTag$1;
760
- email: string;
761
- }[];
762
- };
763
- phones?: {
764
- items: {
765
- tag: PhoneTag$1;
766
- phone: string;
767
- }[];
768
- };
769
- addresses?: {
770
- items: {
771
- tag: AddressTag$1;
772
- }[];
773
- };
774
- labelKeys?: {
775
- items: string[];
776
- };
777
- picture?: {
778
- image: string;
779
- };
780
- };
781
- };
782
- }
783
- interface UpdateContactResponseNonNullableFields {
784
- contact?: {
785
- _id: string;
786
- revision: number;
787
- source?: {
788
- sourceType: ContactSourceType;
789
- };
790
- lastActivity?: {
791
- activityType: ContactActivityType;
792
- };
793
- info?: {
794
- emails?: {
795
- items: {
796
- tag: EmailTag$1;
797
- email: string;
798
- }[];
799
- };
800
- phones?: {
801
- items: {
802
- tag: PhoneTag$1;
803
- phone: string;
804
- }[];
805
- };
806
- addresses?: {
807
- items: {
808
- tag: AddressTag$1;
809
- }[];
810
- };
811
- labelKeys?: {
812
- items: string[];
813
- };
814
- picture?: {
815
- image: string;
816
- };
817
- };
818
- };
819
- }
820
- interface MergeContactsResponseNonNullableFields {
821
- contact?: {
822
- _id: string;
823
- revision: number;
824
- source?: {
825
- sourceType: ContactSourceType;
826
- };
827
- lastActivity?: {
828
- activityType: ContactActivityType;
829
- };
830
- info?: {
831
- emails?: {
832
- items: {
833
- tag: EmailTag$1;
834
- email: string;
835
- }[];
836
- };
837
- phones?: {
838
- items: {
839
- tag: PhoneTag$1;
840
- phone: string;
841
- }[];
842
- };
843
- addresses?: {
844
- items: {
845
- tag: AddressTag$1;
846
- }[];
847
- };
848
- labelKeys?: {
849
- items: string[];
850
- };
851
- picture?: {
852
- image: string;
853
- };
854
- };
855
- };
856
- }
857
- interface LabelContactResponseNonNullableFields {
858
- contact?: {
859
- _id: string;
860
- revision: number;
861
- source?: {
862
- sourceType: ContactSourceType;
863
- };
864
- lastActivity?: {
865
- activityType: ContactActivityType;
866
- };
867
- info?: {
868
- emails?: {
869
- items: {
870
- tag: EmailTag$1;
871
- email: string;
872
- }[];
873
- };
874
- phones?: {
875
- items: {
876
- tag: PhoneTag$1;
877
- phone: string;
878
- }[];
879
- };
880
- addresses?: {
881
- items: {
882
- tag: AddressTag$1;
883
- }[];
884
- };
885
- labelKeys?: {
886
- items: string[];
887
- };
888
- picture?: {
889
- image: string;
890
- };
891
- };
892
- };
893
- }
894
- interface UnlabelContactResponseNonNullableFields {
895
- contact?: {
896
- _id: string;
897
- revision: number;
898
- source?: {
899
- sourceType: ContactSourceType;
900
- };
901
- lastActivity?: {
902
- activityType: ContactActivityType;
903
- };
904
- info?: {
905
- emails?: {
906
- items: {
907
- tag: EmailTag$1;
908
- email: string;
909
- }[];
910
- };
911
- phones?: {
912
- items: {
913
- tag: PhoneTag$1;
914
- phone: string;
915
- }[];
916
- };
917
- addresses?: {
918
- items: {
919
- tag: AddressTag$1;
920
- }[];
921
- };
922
- labelKeys?: {
923
- items: string[];
924
- };
925
- picture?: {
926
- image: string;
927
- };
928
- };
929
- };
930
- }
931
- interface BaseEventMetadata$3 {
932
- /** App instance ID. */
933
- instanceId?: string | null;
934
- /** Event type. */
935
- eventType?: string;
936
- /** The identification type and identity data. */
937
- identity?: IdentificationData$3;
938
- }
939
- interface EventMetadata$3 extends BaseEventMetadata$3 {
940
- /**
941
- * Unique event ID.
942
- * Allows clients to ignore duplicate webhooks.
943
- */
944
- _id?: string;
945
- /**
946
- * Assumes actions are also always typed to an entity_type
947
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
948
- */
949
- entityFqdn?: string;
950
- /**
951
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
952
- * This is although the created/updated/deleted notion is duplication of the oneof types
953
- * Example: created/updated/deleted/started/completed/email_opened
954
- */
955
- slug?: string;
956
- /** ID of the entity associated with the event. */
957
- entityId?: string;
958
- /** Event timestamp. */
959
- eventTime?: Date;
960
- /**
961
- * Whether the event was triggered as a result of a privacy regulation application
962
- * (for example, GDPR).
963
- */
964
- triggeredByAnonymizeRequest?: boolean | null;
965
- /** If present, indicates the action that triggered the event. */
966
- originatedFrom?: string | null;
967
- /**
968
- * A sequence number defining the order of updates to the underlying entity.
969
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
970
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
971
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
972
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
973
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
974
- */
975
- entityEventSequence?: string | null;
976
- }
977
- interface ContactCreatedEnvelope {
978
- entity: Contact;
979
- metadata: EventMetadata$3;
980
- }
981
- interface ContactUpdatedEnvelope {
982
- entity: Contact;
983
- metadata: EventMetadata$3;
984
- }
985
- interface ContactMergedEnvelope {
986
- data: ContactMerged;
987
- metadata: EventMetadata$3;
988
- }
989
- interface ContactDeletedEnvelope {
990
- metadata: EventMetadata$3;
991
- }
992
- interface CreateContactOptions {
993
- /**
994
- * Controls whether the call will succeed
995
- * if the new contact information contains an email or a phone number already used by another contact.
996
- *
997
- * If set to `true`,
998
- * the call will succeed even if an email address or phone number is used by another contact.
999
- * If set to `false`,
1000
- * the call will fail if the given email address is used by another contact or,
1001
- * if the email address is not given and the given phone number is used by another contact.
1002
- *
1003
- * Default: `false`
1004
- */
1005
- allowDuplicates?: boolean;
1006
- }
1007
- interface UpdateContactOptions {
1008
- /**
1009
- * Controls whether the call will succeed if the new contact information contains an email already used by another contact.
1010
- *
1011
- * If set to `true`, the call will succeed even if an email address is used by another contact. If set to `false`, the call will fail if an email address is used by another contact.
1012
- *
1013
- * Defaults to `false`.
1014
- */
1015
- allowDuplicates?: boolean;
1016
- }
1017
- interface MergeContactsOptions {
1018
- /**
1019
- * IDs of up to 5 contacts to merge into the target contact.
1020
- * If merging more than one source contact,
1021
- * the first source is given precedence, then the second, and so on.
1022
- */
1023
- sourceContactIds?: string[];
1024
- }
1025
- interface QueryContactsOptions {
1026
- /** @internal */
1027
- search?: string | null | undefined;
1028
- }
1029
- interface QueryOffsetResult$2 {
1030
- currentPage: number | undefined;
1031
- totalPages: number | undefined;
1032
- totalCount: number | undefined;
1033
- hasNext: () => boolean;
1034
- hasPrev: () => boolean;
1035
- length: number;
1036
- pageSize: number;
1037
- }
1038
- interface ContactsQueryResult extends QueryOffsetResult$2 {
1039
- items: Contact[];
1040
- query: ContactsQueryBuilder;
1041
- next: () => Promise<ContactsQueryResult>;
1042
- prev: () => Promise<ContactsQueryResult>;
1043
- }
1044
- interface ContactsQueryBuilder {
1045
- /** @param propertyName - Property whose value is compared with `value`.
1046
- * @param value - Value to compare against.
1047
- * @documentationMaturity preview
1048
- */
1049
- eq: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'lastActivity.activityDate' | 'primaryInfo.email' | 'primaryInfo.phone' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.birthdate' | 'info.locale', value: any) => ContactsQueryBuilder;
1050
- /** @param propertyName - Property whose value is compared with `value`.
1051
- * @param value - Value to compare against.
1052
- * @documentationMaturity preview
1053
- */
1054
- ne: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'lastActivity.activityDate' | 'primaryInfo.email' | 'primaryInfo.phone' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.birthdate' | 'info.locale', value: any) => ContactsQueryBuilder;
1055
- /** @param propertyName - Property whose value is compared with `value`.
1056
- * @param value - Value to compare against.
1057
- * @documentationMaturity preview
1058
- */
1059
- ge: (propertyName: '_createdDate' | '_updatedDate' | 'lastActivity.activityDate', value: any) => ContactsQueryBuilder;
1060
- /** @param propertyName - Property whose value is compared with `value`.
1061
- * @param value - Value to compare against.
1062
- * @documentationMaturity preview
1063
- */
1064
- gt: (propertyName: '_createdDate' | '_updatedDate' | 'lastActivity.activityDate', value: any) => ContactsQueryBuilder;
1065
- /** @param propertyName - Property whose value is compared with `value`.
1066
- * @param value - Value to compare against.
1067
- * @documentationMaturity preview
1068
- */
1069
- le: (propertyName: '_createdDate' | '_updatedDate' | 'lastActivity.activityDate', value: any) => ContactsQueryBuilder;
1070
- /** @param propertyName - Property whose value is compared with `value`.
1071
- * @param value - Value to compare against.
1072
- * @documentationMaturity preview
1073
- */
1074
- lt: (propertyName: '_createdDate' | '_updatedDate' | 'lastActivity.activityDate', value: any) => ContactsQueryBuilder;
1075
- /** @param propertyName - Property whose value is compared with `string`.
1076
- * @param string - String to compare against. Case-insensitive.
1077
- * @documentationMaturity preview
1078
- */
1079
- startsWith: (propertyName: 'primaryInfo.email' | 'primaryInfo.phone' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle', value: string) => ContactsQueryBuilder;
1080
- /** @documentationMaturity preview */
1081
- in: (propertyName: '_id' | 'primaryInfo.email' | 'primaryInfo.phone' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.locale', value: any) => ContactsQueryBuilder;
1082
- /** @documentationMaturity preview */
1083
- exists: (propertyName: '_id' | 'primaryInfo.email' | 'primaryInfo.phone' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.locale', value: boolean) => ContactsQueryBuilder;
1084
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1085
- * @documentationMaturity preview
1086
- */
1087
- ascending: (...propertyNames: Array<'_createdDate' | 'lastActivity.activityDate' | 'primaryInfo.email' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.birthdate'>) => ContactsQueryBuilder;
1088
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1089
- * @documentationMaturity preview
1090
- */
1091
- descending: (...propertyNames: Array<'_createdDate' | 'lastActivity.activityDate' | 'primaryInfo.email' | 'info.name.first' | 'info.name.last' | 'info.company' | 'info.jobTitle' | 'info.birthdate'>) => ContactsQueryBuilder;
1092
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1093
- * @documentationMaturity preview
1094
- */
1095
- limit: (limit: number) => ContactsQueryBuilder;
1096
- /** @param skip - Number of items to skip in the query results before returning the results.
1097
- * @documentationMaturity preview
1098
- */
1099
- skip: (skip: number) => ContactsQueryBuilder;
1100
- /** @documentationMaturity preview */
1101
- find: () => Promise<ContactsQueryResult>;
1102
- }
1103
- interface GetContactOptions {
1104
- /**
1105
- * List of projected fields to return.
1106
- * If both `fields` and `fieldsets` are sent in the request,
1107
- * the union of both lists is returned.
1108
- * `id` and `revision` are always returned.
1109
- *
1110
- * Supported properties:
1111
- * `source`, `createdDate`, `updatedDate`, `lastActivity`, `primaryInfo`,
1112
- * `info.name`, `info.emails`, `info.phones`, `info.addresses`, `info.company`,
1113
- * `info.jobTitle`, `info.picture`, `info.birthdate`, `info.locale`,
1114
- * `info.labelKeys`, `info.locations`, `info.extendedFields`
1115
- */
1116
- fields?: string[];
1117
- /**
1118
- * Predefined sets of fields to return.
1119
- * If both `fields` and `fieldsets` are sent in the request,
1120
- * the union of both lists is returned.
1121
- *
1122
- * - `BASIC`: Returns `id`, `revision`, `primaryInfo`, `info.name`.
1123
- * - `COMMUNICATION_DETAILS`: Returns `id`, `revision`, `primaryInfo`, `info.name`, `info.emails`, `info.phones`, `info.addresses`.
1124
- * - `EXTENDED`: Returns `id`, `revision`, `primaryInfo`, `info.name`, `info.extendedFields`.
1125
- * - `FULL`: Returns all fields.
1126
- *
1127
- * Default: If `fields` is omitted from the request, `FULL`.
1128
- */
1129
- fieldsets?: ContactFieldSet[];
1130
- }
66
+ declare function createRESTModule$4<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
1131
67
 
1132
- declare function createContact$1(httpClient: HttpClient): (info: ContactInfo$2, options?: CreateContactOptions) => Promise<CreateContactResponse & CreateContactResponseNonNullableFields>;
1133
- declare function updateContact$1(httpClient: HttpClient): (contactId: string, info: ContactInfo$2, revision: number | null, options?: UpdateContactOptions) => Promise<UpdateContactResponse & UpdateContactResponseNonNullableFields>;
1134
- declare function mergeContacts$1(httpClient: HttpClient): (targetContactId: string, targetContactRevision: number | null, options?: MergeContactsOptions) => Promise<MergeContactsResponse & MergeContactsResponseNonNullableFields>;
1135
- declare function deleteContact$1(httpClient: HttpClient): (contactId: string) => Promise<void>;
1136
- declare function labelContact$1(httpClient: HttpClient): (contactId: string, labelKeys: string[]) => Promise<LabelContactResponse & LabelContactResponseNonNullableFields>;
1137
- declare function unlabelContact$1(httpClient: HttpClient): (contactId: string, labelKeys: string[]) => Promise<UnlabelContactResponse & UnlabelContactResponseNonNullableFields>;
1138
- declare function queryContacts$1(httpClient: HttpClient): (options?: QueryContactsOptions) => ContactsQueryBuilder;
1139
- declare function getContact$1(httpClient: HttpClient): (_id: string, options?: GetContactOptions) => Promise<Contact & {
1140
- _id: string;
1141
- revision: number;
1142
- source?: {
1143
- sourceType: ContactSourceType;
1144
- } | undefined;
1145
- lastActivity?: {
1146
- activityType: ContactActivityType;
1147
- } | undefined;
1148
- info?: {
1149
- emails?: {
1150
- items: {
1151
- tag: EmailTag$1;
1152
- email: string;
1153
- }[];
1154
- } | undefined;
1155
- phones?: {
1156
- items: {
1157
- tag: PhoneTag$1;
1158
- phone: string;
1159
- }[];
1160
- } | undefined;
1161
- addresses?: {
1162
- items: {
1163
- tag: AddressTag$1;
1164
- }[];
1165
- } | undefined;
1166
- labelKeys?: {
1167
- items: string[];
1168
- } | undefined;
1169
- picture?: {
1170
- image: string;
1171
- } | undefined;
1172
- } | undefined;
1173
- }>;
1174
- declare const onContactCreated$1: EventDefinition<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
1175
- declare const onContactUpdated$1: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
1176
- declare const onContactMerged$1: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
1177
- declare const onContactDeleted$1: EventDefinition<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">;
68
+ declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1178
69
 
1179
- declare const createContact: BuildRESTFunction<typeof createContact$1>;
1180
- declare const updateContact: BuildRESTFunction<typeof updateContact$1>;
1181
- declare const mergeContacts: BuildRESTFunction<typeof mergeContacts$1>;
1182
- declare const deleteContact: BuildRESTFunction<typeof deleteContact$1>;
1183
- declare const labelContact: BuildRESTFunction<typeof labelContact$1>;
1184
- declare const unlabelContact: BuildRESTFunction<typeof unlabelContact$1>;
1185
- declare const queryContacts: BuildRESTFunction<typeof queryContacts$1>;
1186
- declare const getContact: BuildRESTFunction<typeof getContact$1>;
1187
- declare const onContactCreated: BuildEventDefinition<typeof onContactCreated$1>;
1188
- declare const onContactUpdated: BuildEventDefinition<typeof onContactUpdated$1>;
1189
- declare const onContactMerged: BuildEventDefinition<typeof onContactMerged$1>;
1190
- declare const onContactDeleted: BuildEventDefinition<typeof onContactDeleted$1>;
70
+ declare const createContact: ReturnType<typeof createRESTModule$4<typeof publicCreateContact>>;
71
+ declare const updateContact: ReturnType<typeof createRESTModule$4<typeof publicUpdateContact>>;
72
+ declare const mergeContacts: ReturnType<typeof createRESTModule$4<typeof publicMergeContacts>>;
73
+ declare const deleteContact: ReturnType<typeof createRESTModule$4<typeof publicDeleteContact>>;
74
+ declare const labelContact: ReturnType<typeof createRESTModule$4<typeof publicLabelContact>>;
75
+ declare const unlabelContact: ReturnType<typeof createRESTModule$4<typeof publicUnlabelContact>>;
76
+ declare const queryContacts: ReturnType<typeof createRESTModule$4<typeof publicQueryContacts>>;
77
+ declare const getContact: ReturnType<typeof createRESTModule$4<typeof publicGetContact>>;
78
+ declare const onContactCreated: ReturnType<typeof createEventModule$3<typeof publicOnContactCreated>>;
79
+ declare const onContactUpdated: ReturnType<typeof createEventModule$3<typeof publicOnContactUpdated>>;
80
+ declare const onContactMerged: ReturnType<typeof createEventModule$3<typeof publicOnContactMerged>>;
81
+ declare const onContactDeleted: ReturnType<typeof createEventModule$3<typeof publicOnContactDeleted>>;
1191
82
 
1192
83
  declare const context$4_createContact: typeof createContact;
1193
84
  declare const context$4_deleteContact: typeof deleteContact;
@@ -1205,334 +96,18 @@ declare namespace context$4 {
1205
96
  export { context$4_createContact as createContact, context$4_deleteContact as deleteContact, context$4_getContact as getContact, context$4_labelContact as labelContact, context$4_mergeContacts as mergeContacts, context$4_onContactCreated as onContactCreated, context$4_onContactDeleted as onContactDeleted, context$4_onContactMerged as onContactMerged, context$4_onContactUpdated as onContactUpdated, context$4_queryContacts as queryContacts, context$4_unlabelContact as unlabelContact, context$4_updateContact as updateContact };
1206
97
  }
1207
98
 
1208
- /** Extended field that was found or created. */
1209
- interface ExtendedField {
1210
- /**
1211
- * Extended field namespace.
1212
- *
1213
- * Extended fields created by site collaborators or 3rd-party apps
1214
- * are automatically assigned to the `custom` namespace.
1215
- * @readonly
1216
- */
1217
- namespace?: string | null;
1218
- /**
1219
- * Extended field key.
1220
- *
1221
- * When accessing contact data,
1222
- * extended field data is available at `fields[key]`.
1223
- * For example, if the key is "custom.notes",
1224
- * the value can be accessed at `fields["custom.notes"]`.
1225
- *
1226
- * `key` is generated when the extended field is created
1227
- * and cannot be modified, even if `displayName` changes.
1228
- * @readonly
1229
- */
1230
- key?: string;
1231
- /** Display name shown in the Contact List. */
1232
- displayName?: string;
1233
- /**
1234
- * Type of data the field holds.
1235
- *
1236
- * One of:
1237
- * - `"TEXT"`: Accepts strings.
1238
- * - `"NUMBER"`: Accepts floats.
1239
- * - `"DATE"`: Accepts dates formatted as `YYYY-MM-DD`.
1240
- * - `"URL"`: Accepts strings. Prepends `https://` if no protocol is included.
1241
- * @readonly
1242
- */
1243
- dataType?: FieldDataType;
1244
- /**
1245
- * Indicates whether the extended field is a system field or custom field.
1246
- *
1247
- * One of:
1248
- * - `"SYSTEM"`: System field managed by Wix. System fields cannot be modified by 3rd-party apps or site contributors.
1249
- * - `"USER_DEFINED"`: Custom field that can be modified by 3rd-party apps or site admins.
1250
- * @readonly
1251
- */
1252
- fieldType?: FieldType;
1253
- /**
1254
- * Date and time the field was created.
1255
- * @readonly
1256
- */
1257
- _createdDate?: Date;
1258
- /**
1259
- * Date and time the field was last updated.
1260
- * @readonly
1261
- */
1262
- _updatedDate?: Date;
1263
- /**
1264
- * Field description, if the field is a system field.
1265
- * @readonly
1266
- */
1267
- description?: string | null;
1268
- }
1269
- declare enum FieldDataType {
1270
- UNKNOWN_DATA_TYPE = "UNKNOWN_DATA_TYPE",
1271
- TEXT = "TEXT",
1272
- NUMBER = "NUMBER",
1273
- DATE = "DATE",
1274
- URL = "URL"
1275
- }
1276
- declare enum FieldType {
1277
- UNKNOWN = "UNKNOWN",
1278
- SYSTEM = "SYSTEM",
1279
- USER_DEFINED = "USER_DEFINED"
1280
- }
1281
- /** Extended field that was found or created. */
1282
- interface FindOrCreateExtendedFieldResponse {
1283
- /** Extended field that was found or created. */
1284
- field?: ExtendedField;
1285
- /**
1286
- * Indicates whether the extended field was just created or already existed.
1287
- *
1288
- * If the field was just created, returns `true`.
1289
- * If the field already existed, returns `false`.
1290
- */
1291
- newField?: boolean;
1292
- }
1293
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
1294
- /** ID of a site visitor that has not logged in to the site. */
1295
- anonymousVisitorId?: string;
1296
- /** ID of a site visitor that has logged in to the site. */
1297
- memberId?: string;
1298
- /** ID of a Wix user (site owner, contributor, etc.). */
1299
- wixUserId?: string;
1300
- /** ID of an app. */
1301
- appId?: string;
1302
- /** @readonly */
1303
- identityType?: WebhookIdentityType$2;
1304
- }
1305
- /** @oneof */
1306
- interface IdentificationDataIdOneOf$2 {
1307
- /** ID of a site visitor that has not logged in to the site. */
1308
- anonymousVisitorId?: string;
1309
- /** ID of a site visitor that has logged in to the site. */
1310
- memberId?: string;
1311
- /** ID of a Wix user (site owner, contributor, etc.). */
1312
- wixUserId?: string;
1313
- /** ID of an app. */
1314
- appId?: string;
1315
- }
1316
- declare enum WebhookIdentityType$2 {
1317
- UNKNOWN = "UNKNOWN",
1318
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1319
- MEMBER = "MEMBER",
1320
- WIX_USER = "WIX_USER",
1321
- APP = "APP"
1322
- }
1323
- interface FindOrCreateExtendedFieldResponseNonNullableFields {
1324
- field?: {
1325
- key: string;
1326
- displayName: string;
1327
- dataType: FieldDataType;
1328
- fieldType: FieldType;
1329
- };
1330
- newField: boolean;
1331
- }
1332
- interface BaseEventMetadata$2 {
1333
- /** App instance ID. */
1334
- instanceId?: string | null;
1335
- /** Event type. */
1336
- eventType?: string;
1337
- /** The identification type and identity data. */
1338
- identity?: IdentificationData$2;
1339
- }
1340
- interface EventMetadata$2 extends BaseEventMetadata$2 {
1341
- /**
1342
- * Unique event ID.
1343
- * Allows clients to ignore duplicate webhooks.
1344
- */
1345
- _id?: string;
1346
- /**
1347
- * Assumes actions are also always typed to an entity_type
1348
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1349
- */
1350
- entityFqdn?: string;
1351
- /**
1352
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1353
- * This is although the created/updated/deleted notion is duplication of the oneof types
1354
- * Example: created/updated/deleted/started/completed/email_opened
1355
- */
1356
- slug?: string;
1357
- /** ID of the entity associated with the event. */
1358
- entityId?: string;
1359
- /** Event timestamp. */
1360
- eventTime?: Date;
1361
- /**
1362
- * Whether the event was triggered as a result of a privacy regulation application
1363
- * (for example, GDPR).
1364
- */
1365
- triggeredByAnonymizeRequest?: boolean | null;
1366
- /** If present, indicates the action that triggered the event. */
1367
- originatedFrom?: string | null;
1368
- /**
1369
- * A sequence number defining the order of updates to the underlying entity.
1370
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1371
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1372
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1373
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1374
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1375
- */
1376
- entityEventSequence?: string | null;
1377
- }
1378
- interface ExtendedFieldCreatedEnvelope {
1379
- entity: ExtendedField;
1380
- metadata: EventMetadata$2;
1381
- }
1382
- interface ExtendedFieldUpdatedEnvelope {
1383
- entity: ExtendedField;
1384
- metadata: EventMetadata$2;
1385
- }
1386
- interface ExtendedFieldDeletedEnvelope {
1387
- metadata: EventMetadata$2;
1388
- }
1389
- interface RenameExtendedField {
1390
- /**
1391
- * Extended field namespace.
1392
- *
1393
- * Extended fields created by site collaborators or 3rd-party apps
1394
- * are automatically assigned to the `custom` namespace.
1395
- * @readonly
1396
- */
1397
- namespace?: string | null;
1398
- /** Display name shown in the Contact List. */
1399
- displayName?: string;
1400
- /**
1401
- * Type of data the field holds.
1402
- *
1403
- * One of:
1404
- * - `"TEXT"`: Accepts strings.
1405
- * - `"NUMBER"`: Accepts floats.
1406
- * - `"DATE"`: Accepts dates formatted as `YYYY-MM-DD`.
1407
- * - `"URL"`: Accepts strings. Prepends `https://` if no protocol is included.
1408
- * @readonly
1409
- */
1410
- dataType?: FieldDataType;
1411
- /**
1412
- * Indicates whether the extended field is a system field or custom field.
1413
- *
1414
- * One of:
1415
- * - `"SYSTEM"`: System field managed by Wix. System fields cannot be modified by 3rd-party apps or site contributors.
1416
- * - `"USER_DEFINED"`: Custom field that can be modified by 3rd-party apps or site admins.
1417
- * @readonly
1418
- */
1419
- fieldType?: FieldType;
1420
- /**
1421
- * Date and time the field was created.
1422
- * @readonly
1423
- */
1424
- _createdDate?: Date;
1425
- /**
1426
- * Date and time the field was last updated.
1427
- * @readonly
1428
- */
1429
- _updatedDate?: Date;
1430
- /**
1431
- * Field description, if the field is a system field.
1432
- * @readonly
1433
- */
1434
- description?: string | null;
1435
- }
1436
- interface QueryOffsetResult$1 {
1437
- currentPage: number | undefined;
1438
- totalPages: number | undefined;
1439
- totalCount: number | undefined;
1440
- hasNext: () => boolean;
1441
- hasPrev: () => boolean;
1442
- length: number;
1443
- pageSize: number;
1444
- }
1445
- interface FieldsQueryResult extends QueryOffsetResult$1 {
1446
- items: ExtendedField[];
1447
- query: FieldsQueryBuilder;
1448
- next: () => Promise<FieldsQueryResult>;
1449
- prev: () => Promise<FieldsQueryResult>;
1450
- }
1451
- interface FieldsQueryBuilder {
1452
- /** @param propertyName - Property whose value is compared with `value`.
1453
- * @param value - Value to compare against.
1454
- * @documentationMaturity preview
1455
- */
1456
- eq: (propertyName: 'namespace' | 'key' | 'displayName' | 'dataType' | 'fieldType' | '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1457
- /** @param propertyName - Property whose value is compared with `value`.
1458
- * @param value - Value to compare against.
1459
- * @documentationMaturity preview
1460
- */
1461
- ne: (propertyName: 'namespace' | 'key' | 'displayName' | 'dataType' | '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1462
- /** @param propertyName - Property whose value is compared with `value`.
1463
- * @param value - Value to compare against.
1464
- * @documentationMaturity preview
1465
- */
1466
- ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1467
- /** @param propertyName - Property whose value is compared with `value`.
1468
- * @param value - Value to compare against.
1469
- * @documentationMaturity preview
1470
- */
1471
- gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1472
- /** @param propertyName - Property whose value is compared with `value`.
1473
- * @param value - Value to compare against.
1474
- * @documentationMaturity preview
1475
- */
1476
- le: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1477
- /** @param propertyName - Property whose value is compared with `value`.
1478
- * @param value - Value to compare against.
1479
- * @documentationMaturity preview
1480
- */
1481
- lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => FieldsQueryBuilder;
1482
- /** @param propertyName - Property whose value is compared with `string`.
1483
- * @param string - String to compare against. Case-insensitive.
1484
- * @documentationMaturity preview
1485
- */
1486
- startsWith: (propertyName: 'displayName', value: string) => FieldsQueryBuilder;
1487
- /** @documentationMaturity preview */
1488
- in: (propertyName: 'key' | 'displayName', value: any) => FieldsQueryBuilder;
1489
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1490
- * @documentationMaturity preview
1491
- */
1492
- ascending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => FieldsQueryBuilder;
1493
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1494
- * @documentationMaturity preview
1495
- */
1496
- descending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => FieldsQueryBuilder;
1497
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1498
- * @documentationMaturity preview
1499
- */
1500
- limit: (limit: number) => FieldsQueryBuilder;
1501
- /** @param skip - Number of items to skip in the query results before returning the results.
1502
- * @documentationMaturity preview
1503
- */
1504
- skip: (skip: number) => FieldsQueryBuilder;
1505
- /** @documentationMaturity preview */
1506
- find: () => Promise<FieldsQueryResult>;
1507
- }
99
+ declare function createRESTModule$3<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
1508
100
 
1509
- declare function findOrCreateExtendedField$1(httpClient: HttpClient): (displayName: string, dataType: FieldDataType) => Promise<FindOrCreateExtendedFieldResponse & FindOrCreateExtendedFieldResponseNonNullableFields>;
1510
- declare function getExtendedField$1(httpClient: HttpClient): (key: string) => Promise<ExtendedField & {
1511
- key: string;
1512
- displayName: string;
1513
- dataType: FieldDataType;
1514
- fieldType: FieldType;
1515
- }>;
1516
- declare function renameExtendedField$1(httpClient: HttpClient): (key: string, field: RenameExtendedField) => Promise<ExtendedField & {
1517
- key: string;
1518
- displayName: string;
1519
- dataType: FieldDataType;
1520
- fieldType: FieldType;
1521
- }>;
1522
- declare function deleteExtendedField$1(httpClient: HttpClient): (key: string) => Promise<void>;
1523
- declare function queryExtendedFields$1(httpClient: HttpClient): () => FieldsQueryBuilder;
1524
- declare const onExtendedFieldCreated$1: EventDefinition<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
1525
- declare const onExtendedFieldUpdated$1: EventDefinition<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
1526
- declare const onExtendedFieldDeleted$1: EventDefinition<ExtendedFieldDeletedEnvelope, "wix.contacts.v4.extended-field_deleted">;
101
+ declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1527
102
 
1528
- declare const findOrCreateExtendedField: BuildRESTFunction<typeof findOrCreateExtendedField$1>;
1529
- declare const getExtendedField: BuildRESTFunction<typeof getExtendedField$1>;
1530
- declare const renameExtendedField: BuildRESTFunction<typeof renameExtendedField$1>;
1531
- declare const deleteExtendedField: BuildRESTFunction<typeof deleteExtendedField$1>;
1532
- declare const queryExtendedFields: BuildRESTFunction<typeof queryExtendedFields$1>;
1533
- declare const onExtendedFieldCreated: BuildEventDefinition<typeof onExtendedFieldCreated$1>;
1534
- declare const onExtendedFieldUpdated: BuildEventDefinition<typeof onExtendedFieldUpdated$1>;
1535
- declare const onExtendedFieldDeleted: BuildEventDefinition<typeof onExtendedFieldDeleted$1>;
103
+ declare const findOrCreateExtendedField: ReturnType<typeof createRESTModule$3<typeof publicFindOrCreateExtendedField>>;
104
+ declare const getExtendedField: ReturnType<typeof createRESTModule$3<typeof publicGetExtendedField>>;
105
+ declare const renameExtendedField: ReturnType<typeof createRESTModule$3<typeof publicRenameExtendedField>>;
106
+ declare const deleteExtendedField: ReturnType<typeof createRESTModule$3<typeof publicDeleteExtendedField>>;
107
+ declare const queryExtendedFields: ReturnType<typeof createRESTModule$3<typeof publicQueryExtendedFields>>;
108
+ declare const onExtendedFieldCreated: ReturnType<typeof createEventModule$2<typeof publicOnExtendedFieldCreated>>;
109
+ declare const onExtendedFieldUpdated: ReturnType<typeof createEventModule$2<typeof publicOnExtendedFieldUpdated>>;
110
+ declare const onExtendedFieldDeleted: ReturnType<typeof createEventModule$2<typeof publicOnExtendedFieldDeleted>>;
1536
111
 
1537
112
  declare const context$3_deleteExtendedField: typeof deleteExtendedField;
1538
113
  declare const context$3_findOrCreateExtendedField: typeof findOrCreateExtendedField;
@@ -1546,337 +121,18 @@ declare namespace context$3 {
1546
121
  export { context$3_deleteExtendedField as deleteExtendedField, context$3_findOrCreateExtendedField as findOrCreateExtendedField, context$3_getExtendedField as getExtendedField, context$3_onExtendedFieldCreated as onExtendedFieldCreated, context$3_onExtendedFieldDeleted as onExtendedFieldDeleted, context$3_onExtendedFieldUpdated as onExtendedFieldUpdated, context$3_queryExtendedFields as queryExtendedFields, context$3_renameExtendedField as renameExtendedField };
1547
122
  }
1548
123
 
1549
- /** Label that was found or created. */
1550
- interface ContactLabel {
1551
- /**
1552
- * Label namespace.
1553
- *
1554
- * Labels created by site admins or 3rd-party apps
1555
- * are automatically assigned to the `custom` namespace.
1556
- * @readonly
1557
- */
1558
- namespace?: string | null;
1559
- /**
1560
- * Display name for the namespace,
1561
- * used to organize the list of labels in the site Dashboard.
1562
- * @readonly
1563
- */
1564
- namespaceDisplayName?: string | null;
1565
- /**
1566
- * Label key.
1567
- *
1568
- * `key` is generated when the label is created.
1569
- * It cannot be modified, even if `displayName` is updated.
1570
- * @readonly
1571
- */
1572
- key?: string;
1573
- /** Label display name shown in the Dashboard. */
1574
- displayName?: string;
1575
- /**
1576
- * Label type.
1577
- *
1578
- * - `"SYSTEM"`: The label is a default system label for the Contact List.
1579
- * - `"USER_DEFINED"`: The label was created by a site contributor or 3rd-party app.
1580
- * - `"WIX_APP_DEFINED"`: The label was created by a Wix app.
1581
- * @readonly
1582
- */
1583
- labelType?: LabelType;
1584
- /**
1585
- * Date and time the label was created.
1586
- * @readonly
1587
- */
1588
- _createdDate?: Date;
1589
- /**
1590
- * Date and time the label was last updated.
1591
- * @readonly
1592
- */
1593
- _updatedDate?: Date;
1594
- }
1595
- declare enum LabelType {
1596
- /** Need UNKNOWN to be able to fetch all labels */
1597
- UNKNOWN = "UNKNOWN",
1598
- SYSTEM = "SYSTEM",
1599
- USER_DEFINED = "USER_DEFINED",
1600
- WIX_APP_DEFINED = "WIX_APP_DEFINED"
1601
- }
1602
- /** Label that was found or created. */
1603
- interface FindOrCreateLabelResponse {
1604
- /** Label that was found or created. */
1605
- label?: ContactLabel;
1606
- /**
1607
- * Indicates whether the label was just created or already existed.
1608
- *
1609
- * If the label was just created, returns `true`.
1610
- * If it already existed, returns `false`.
1611
- */
1612
- newLabel?: boolean;
1613
- }
1614
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1615
- /** ID of a site visitor that has not logged in to the site. */
1616
- anonymousVisitorId?: string;
1617
- /** ID of a site visitor that has logged in to the site. */
1618
- memberId?: string;
1619
- /** ID of a Wix user (site owner, contributor, etc.). */
1620
- wixUserId?: string;
1621
- /** ID of an app. */
1622
- appId?: string;
1623
- /** @readonly */
1624
- identityType?: WebhookIdentityType$1;
1625
- }
1626
- /** @oneof */
1627
- interface IdentificationDataIdOneOf$1 {
1628
- /** ID of a site visitor that has not logged in to the site. */
1629
- anonymousVisitorId?: string;
1630
- /** ID of a site visitor that has logged in to the site. */
1631
- memberId?: string;
1632
- /** ID of a Wix user (site owner, contributor, etc.). */
1633
- wixUserId?: string;
1634
- /** ID of an app. */
1635
- appId?: string;
1636
- }
1637
- declare enum WebhookIdentityType$1 {
1638
- UNKNOWN = "UNKNOWN",
1639
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1640
- MEMBER = "MEMBER",
1641
- WIX_USER = "WIX_USER",
1642
- APP = "APP"
1643
- }
1644
- interface FindOrCreateLabelResponseNonNullableFields {
1645
- label?: {
1646
- key: string;
1647
- displayName: string;
1648
- labelType: LabelType;
1649
- };
1650
- newLabel: boolean;
1651
- }
1652
- interface BaseEventMetadata$1 {
1653
- /** App instance ID. */
1654
- instanceId?: string | null;
1655
- /** Event type. */
1656
- eventType?: string;
1657
- /** The identification type and identity data. */
1658
- identity?: IdentificationData$1;
1659
- }
1660
- interface EventMetadata$1 extends BaseEventMetadata$1 {
1661
- /**
1662
- * Unique event ID.
1663
- * Allows clients to ignore duplicate webhooks.
1664
- */
1665
- _id?: string;
1666
- /**
1667
- * Assumes actions are also always typed to an entity_type
1668
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1669
- */
1670
- entityFqdn?: string;
1671
- /**
1672
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1673
- * This is although the created/updated/deleted notion is duplication of the oneof types
1674
- * Example: created/updated/deleted/started/completed/email_opened
1675
- */
1676
- slug?: string;
1677
- /** ID of the entity associated with the event. */
1678
- entityId?: string;
1679
- /** Event timestamp. */
1680
- eventTime?: Date;
1681
- /**
1682
- * Whether the event was triggered as a result of a privacy regulation application
1683
- * (for example, GDPR).
1684
- */
1685
- triggeredByAnonymizeRequest?: boolean | null;
1686
- /** If present, indicates the action that triggered the event. */
1687
- originatedFrom?: string | null;
1688
- /**
1689
- * A sequence number defining the order of updates to the underlying entity.
1690
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1691
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1692
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1693
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1694
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1695
- */
1696
- entityEventSequence?: string | null;
1697
- }
1698
- interface LabelCreatedEnvelope {
1699
- entity: ContactLabel;
1700
- metadata: EventMetadata$1;
1701
- }
1702
- interface LabelUpdatedEnvelope {
1703
- entity: ContactLabel;
1704
- metadata: EventMetadata$1;
1705
- }
1706
- interface LabelDeletedEnvelope {
1707
- metadata: EventMetadata$1;
1708
- }
1709
- interface FindOrCreateLabelOptions {
1710
- /**
1711
- * Language for localization.
1712
- *
1713
- * 2-letter language code in
1714
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1715
- */
1716
- language?: string | null;
1717
- }
1718
- interface GetLabelOptions {
1719
- /**
1720
- * Language for localization.
1721
- *
1722
- * 2-letter language code in
1723
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1724
- */
1725
- language?: string | null;
1726
- }
1727
- interface RenameLabel {
1728
- /**
1729
- * Label namespace.
1730
- *
1731
- * Labels created by site admins or 3rd-party apps
1732
- * are automatically assigned to the `custom` namespace.
1733
- * @readonly
1734
- */
1735
- namespace?: string | null;
1736
- /**
1737
- * Display name for the namespace,
1738
- * used to organize the list of labels in the site Dashboard.
1739
- * @readonly
1740
- */
1741
- namespaceDisplayName?: string | null;
1742
- /** Label display name shown in the Dashboard. */
1743
- displayName?: string;
1744
- /**
1745
- * Label type.
1746
- *
1747
- * - `"SYSTEM"`: The label is a default system label for the Contact List.
1748
- * - `"USER_DEFINED"`: The label was created by a site contributor or 3rd-party app.
1749
- * - `"WIX_APP_DEFINED"`: The label was created by a Wix app.
1750
- * @readonly
1751
- */
1752
- labelType?: LabelType;
1753
- /**
1754
- * Date and time the label was created.
1755
- * @readonly
1756
- */
1757
- _createdDate?: Date;
1758
- /**
1759
- * Date and time the label was last updated.
1760
- * @readonly
1761
- */
1762
- _updatedDate?: Date;
1763
- }
1764
- interface RenameLabelOptions {
1765
- /**
1766
- * Language for localization.
1767
- *
1768
- * 2-letter language code in
1769
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1770
- */
1771
- language?: string | null;
1772
- }
1773
- interface QueryLabelsOptions {
1774
- /**
1775
- * Language for localization.
1776
- *
1777
- * 2-letter language code in
1778
- * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format.
1779
- */
1780
- language?: string | null | undefined;
1781
- }
1782
- interface QueryOffsetResult {
1783
- currentPage: number | undefined;
1784
- totalPages: number | undefined;
1785
- totalCount: number | undefined;
1786
- hasNext: () => boolean;
1787
- hasPrev: () => boolean;
1788
- length: number;
1789
- pageSize: number;
1790
- }
1791
- interface LabelsQueryResult extends QueryOffsetResult {
1792
- items: ContactLabel[];
1793
- query: LabelsQueryBuilder;
1794
- next: () => Promise<LabelsQueryResult>;
1795
- prev: () => Promise<LabelsQueryResult>;
1796
- }
1797
- interface LabelsQueryBuilder {
1798
- /** @param propertyName - Property whose value is compared with `value`.
1799
- * @param value - Value to compare against.
1800
- * @documentationMaturity preview
1801
- */
1802
- eq: (propertyName: 'namespace' | 'key' | 'displayName' | 'labelType' | '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1803
- /** @param propertyName - Property whose value is compared with `value`.
1804
- * @param value - Value to compare against.
1805
- * @documentationMaturity preview
1806
- */
1807
- ne: (propertyName: 'namespace' | 'key' | 'displayName' | '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1808
- /** @param propertyName - Property whose value is compared with `value`.
1809
- * @param value - Value to compare against.
1810
- * @documentationMaturity preview
1811
- */
1812
- ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1813
- /** @param propertyName - Property whose value is compared with `value`.
1814
- * @param value - Value to compare against.
1815
- * @documentationMaturity preview
1816
- */
1817
- gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1818
- /** @param propertyName - Property whose value is compared with `value`.
1819
- * @param value - Value to compare against.
1820
- * @documentationMaturity preview
1821
- */
1822
- le: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1823
- /** @param propertyName - Property whose value is compared with `value`.
1824
- * @param value - Value to compare against.
1825
- * @documentationMaturity preview
1826
- */
1827
- lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder;
1828
- /** @param propertyName - Property whose value is compared with `string`.
1829
- * @param string - String to compare against. Case-insensitive.
1830
- * @documentationMaturity preview
1831
- */
1832
- startsWith: (propertyName: 'displayName', value: string) => LabelsQueryBuilder;
1833
- /** @documentationMaturity preview */
1834
- in: (propertyName: 'key' | 'displayName', value: any) => LabelsQueryBuilder;
1835
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1836
- * @documentationMaturity preview
1837
- */
1838
- ascending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => LabelsQueryBuilder;
1839
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1840
- * @documentationMaturity preview
1841
- */
1842
- descending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => LabelsQueryBuilder;
1843
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1844
- * @documentationMaturity preview
1845
- */
1846
- limit: (limit: number) => LabelsQueryBuilder;
1847
- /** @param skip - Number of items to skip in the query results before returning the results.
1848
- * @documentationMaturity preview
1849
- */
1850
- skip: (skip: number) => LabelsQueryBuilder;
1851
- /** @documentationMaturity preview */
1852
- find: () => Promise<LabelsQueryResult>;
1853
- }
124
+ declare function createRESTModule$2<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
1854
125
 
1855
- declare function findOrCreateLabel$1(httpClient: HttpClient): (displayName: string, options?: FindOrCreateLabelOptions) => Promise<FindOrCreateLabelResponse & FindOrCreateLabelResponseNonNullableFields>;
1856
- declare function getLabel$1(httpClient: HttpClient): (key: string, options?: GetLabelOptions) => Promise<ContactLabel & {
1857
- key: string;
1858
- displayName: string;
1859
- labelType: LabelType;
1860
- }>;
1861
- declare function renameLabel$1(httpClient: HttpClient): (key: string, label: RenameLabel, options?: RenameLabelOptions) => Promise<ContactLabel & {
1862
- key: string;
1863
- displayName: string;
1864
- labelType: LabelType;
1865
- }>;
1866
- declare function deleteLabel$1(httpClient: HttpClient): (key: string) => Promise<void>;
1867
- declare function queryLabels$1(httpClient: HttpClient): (options?: QueryLabelsOptions) => LabelsQueryBuilder;
1868
- declare const onLabelCreated$1: EventDefinition<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
1869
- declare const onLabelUpdated$1: EventDefinition<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
1870
- declare const onLabelDeleted$1: EventDefinition<LabelDeletedEnvelope, "wix.contacts.v4.label_deleted">;
126
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1871
127
 
1872
- declare const findOrCreateLabel: BuildRESTFunction<typeof findOrCreateLabel$1>;
1873
- declare const getLabel: BuildRESTFunction<typeof getLabel$1>;
1874
- declare const renameLabel: BuildRESTFunction<typeof renameLabel$1>;
1875
- declare const deleteLabel: BuildRESTFunction<typeof deleteLabel$1>;
1876
- declare const queryLabels: BuildRESTFunction<typeof queryLabels$1>;
1877
- declare const onLabelCreated: BuildEventDefinition<typeof onLabelCreated$1>;
1878
- declare const onLabelUpdated: BuildEventDefinition<typeof onLabelUpdated$1>;
1879
- declare const onLabelDeleted: BuildEventDefinition<typeof onLabelDeleted$1>;
128
+ declare const findOrCreateLabel: ReturnType<typeof createRESTModule$2<typeof publicFindOrCreateLabel>>;
129
+ declare const getLabel: ReturnType<typeof createRESTModule$2<typeof publicGetLabel>>;
130
+ declare const renameLabel: ReturnType<typeof createRESTModule$2<typeof publicRenameLabel>>;
131
+ declare const deleteLabel: ReturnType<typeof createRESTModule$2<typeof publicDeleteLabel>>;
132
+ declare const queryLabels: ReturnType<typeof createRESTModule$2<typeof publicQueryLabels>>;
133
+ declare const onLabelCreated: ReturnType<typeof createEventModule$1<typeof publicOnLabelCreated>>;
134
+ declare const onLabelUpdated: ReturnType<typeof createEventModule$1<typeof publicOnLabelUpdated>>;
135
+ declare const onLabelDeleted: ReturnType<typeof createEventModule$1<typeof publicOnLabelDeleted>>;
1880
136
 
1881
137
  declare const context$2_deleteLabel: typeof deleteLabel;
1882
138
  declare const context$2_findOrCreateLabel: typeof findOrCreateLabel;
@@ -1890,652 +146,30 @@ declare namespace context$2 {
1890
146
  export { context$2_deleteLabel as deleteLabel, context$2_findOrCreateLabel as findOrCreateLabel, context$2_getLabel as getLabel, context$2_onLabelCreated as onLabelCreated, context$2_onLabelDeleted as onLabelDeleted, context$2_onLabelUpdated as onLabelUpdated, context$2_queryLabels as queryLabels, context$2_renameLabel as renameLabel };
1891
147
  }
1892
148
 
1893
- interface ContactInfo$1 {
1894
- /** Contact's first and last name. */
1895
- name?: ContactName;
1896
- /** Contact's email addresses. */
1897
- emails?: ContactEmailsWrapper;
1898
- /** Contact's phone numbers. */
1899
- phones?: ContactPhonesWrapper;
1900
- /** Contact's street addresses. */
1901
- addresses?: ContactAddressesWrapper;
1902
- /** Contact's company name. */
1903
- company?: string | null;
1904
- /**
1905
- * Contact's job title.
1906
- * Corresponds to the **Position** field in the Dashboard.
1907
- */
1908
- jobTitle?: string | null;
1909
- /** Birth date in `YYYY-MM-DD` format. For example, `2020-03-15`. */
1910
- birthdate?: string | null;
1911
- /**
1912
- * Locale in
1913
- * [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1914
- * Typically, this is a lowercase 2-letter language code,
1915
- * followed by a hyphen, followed by an uppercase 2-letter country code.
1916
- * For example, `en-US` for U.S. English, and `de-DE` for Germany German.
1917
- */
1918
- locale?: string | null;
1919
- /**
1920
- * List of contact's labels.
1921
- * Labels are used to organize contacts.
1922
- * When setting the `labelKeys` property,
1923
- * only labels that already exist in the site's Contacts List can be used.
1924
- * Labels can be added and removed using
1925
- * [Label Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/label-contact) and
1926
- * [Unlabel Contact](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/unlabel-contact),
1927
- * respectively.
1928
- *
1929
- * To view or manage site labels, use the
1930
- * [Labels API](https://dev.wix.com/api/rest/contacts/labels).
1931
- */
1932
- labelKeys?: LabelsWrapper;
1933
- /**
1934
- * Additional custom fields.
1935
- * This includes fields managed by Wix, by 3rd-party apps, and by the site.
1936
- *
1937
- * Empty fields are not returned.
1938
- */
1939
- extendedFields?: ExtendedFieldsWrapper;
1940
- /** Contact's profile picture. */
1941
- picture?: ContactPicture;
1942
- }
1943
- interface ContactName {
1944
- /** Contact's first name. */
1945
- first?: string | null;
1946
- /** Contact's last name. */
1947
- last?: string | null;
1948
- }
1949
- interface ContactEmailsWrapper {
1950
- /** List of up to 50 email addresses. */
1951
- items?: ContactEmail[];
1952
- }
1953
- interface ContactEmail {
1954
- /**
1955
- * Email ID.
1956
- * @readonly
1957
- */
1958
- _id?: string | null;
1959
- /**
1960
- * Email type.
1961
- *
1962
- * `UNTAGGED` is shown as "Other" in the Contact List.
1963
- */
1964
- tag?: EmailTag;
1965
- /** Email address. */
1966
- email?: string;
1967
- /**
1968
- * Indicates whether this is the contact's primary email address.
1969
- * When changing `primary` to `true` for an email,
1970
- * the contact's other emails become `false`.
1971
- * It also affects the subscription status to marketing emails that are decided based on the primary email.
1972
- */
1973
- primary?: boolean | null;
1974
- }
1975
- declare enum EmailTag {
1976
- UNTAGGED = "UNTAGGED",
1977
- MAIN = "MAIN",
1978
- HOME = "HOME",
1979
- WORK = "WORK"
1980
- }
1981
- interface ContactPhonesWrapper {
1982
- /** List of up to 50 phone numbers. */
1983
- items?: ContactPhone[];
1984
- }
1985
- interface ContactPhone {
1986
- /**
1987
- * Phone ID.
1988
- * @readonly
1989
- */
1990
- _id?: string | null;
1991
- /**
1992
- * Phone type.
1993
- *
1994
- * `UNTAGGED` is shown as "Other" in the Contact List.
1995
- */
1996
- tag?: PhoneTag;
1997
- /** [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. */
1998
- countryCode?: string | null;
1999
- /** Phone number. */
2000
- phone?: string;
2001
- /**
2002
- * [ITU E.164-formatted](https://www.itu.int/rec/T-REC-E.164/)
2003
- * phone number.
2004
- * Automatically generated using `phone` and `countryCode`, pending both values are valid.
2005
- * @readonly
2006
- */
2007
- e164Phone?: string | null;
2008
- /**
2009
- * Whether this is the contact's primary phone number.
2010
- * When changing `primary` to `true` for a phone,
2011
- * the contact's `primary` field for other phones becomes `false`.
2012
- * It also affects the subscription status to SMS messages that are decided based on the primary phone.
2013
- */
2014
- primary?: boolean | null;
2015
- }
2016
- declare enum PhoneTag {
2017
- UNTAGGED = "UNTAGGED",
2018
- MAIN = "MAIN",
2019
- HOME = "HOME",
2020
- MOBILE = "MOBILE",
2021
- WORK = "WORK",
2022
- FAX = "FAX"
2023
- }
2024
- interface ContactAddressesWrapper {
2025
- /** List of up to 50 addresses. */
2026
- items?: ContactAddress[];
2027
- }
2028
- interface ContactAddress {
2029
- /**
2030
- * Street address ID.
2031
- * @readonly
2032
- */
2033
- _id?: string | null;
2034
- /**
2035
- * Address type.
2036
- * `UNTAGGED` is shown as "Other" in the Contact List.
2037
- */
2038
- tag?: AddressTag;
2039
- /** Street address. */
2040
- address?: Address;
2041
- }
2042
- declare enum AddressTag {
2043
- UNTAGGED = "UNTAGGED",
2044
- HOME = "HOME",
2045
- WORK = "WORK",
2046
- BILLING = "BILLING",
2047
- SHIPPING = "SHIPPING"
2048
- }
2049
- /** Physical address */
2050
- interface Address extends AddressStreetOneOf {
2051
- /** Street address object, with number and name in separate fields. */
2052
- streetAddress?: StreetAddress;
2053
- /** Main address line, usually street and number, as free text. */
2054
- addressLine1?: string | null;
2055
- /**
2056
- * 2-letter country code in an
2057
- * [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
2058
- */
2059
- country?: string | null;
2060
- /**
2061
- * Code for a subdivision (such as state, prefecture, or province) in an
2062
- * [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.
2063
- */
2064
- subdivision?: string | null;
2065
- /** City name. */
2066
- city?: string | null;
2067
- /** Postal or zip code. */
2068
- postalCode?: string | null;
2069
- /**
2070
- * Free text providing more detailed address information,
2071
- * such as apartment, suite, or floor.
2072
- */
2073
- addressLine2?: string | null;
2074
- }
2075
- /** @oneof */
2076
- interface AddressStreetOneOf {
2077
- /** Street address object, with number and name in separate fields. */
2078
- streetAddress?: StreetAddress;
2079
- /** Main address line, usually street and number, as free text. */
2080
- addressLine?: string | null;
2081
- }
2082
- interface StreetAddress {
2083
- /** Street number. */
2084
- number?: string;
2085
- /** Street name. */
2086
- name?: string;
2087
- }
2088
- interface LabelsWrapper {
2089
- /**
2090
- * List of contact label keys.
2091
- * [Contact labels](https://support.wix.com/en/article/adding-labels-to-contacts-in-your-contact-list)
2092
- * help categorize contacts.
2093
- *
2094
- * Label keys must exist to be added to the contact.
2095
- * Contact labels can be created or retrieved with
2096
- * [Find or Create Label](https://dev.wix.com/api/rest/contacts/labels/find-or-create-label)
2097
- * or
2098
- * [List Labels](https://dev.wix.com/api/rest/contacts/labels/list-labels)
2099
- */
2100
- items?: string[];
2101
- }
2102
- interface ExtendedFieldsWrapper {
2103
- /**
2104
- * Contact's extended fields,
2105
- * where each key is the field key,
2106
- * and each value is the field's value for the contact.
2107
- *
2108
- * To view and manage extended fields, use the
2109
- * [Extended Fields API](https://dev.wix.com/api/rest/contacts/extended-fields).
2110
- */
2111
- items?: Record<string, any>;
2112
- }
2113
- /** TEST contact picture description */
2114
- interface ContactPicture {
2115
- /**
2116
- * Image.
2117
- * This can contain an image URL or a Wix Media image ID.
2118
- */
2119
- image?: string;
2120
- }
2121
- interface SubmitContactResponse {
2122
- /** ID of the contact that was found or created. */
2123
- contactId?: string;
2124
- /**
2125
- * Identity type of the returned contact.
2126
- *
2127
- * - `CONTACT`: The returned contact ID belongs to a new or existing contact.
2128
- * - `MEMBER`: The returned contact ID belongs to the currently logged-in site member.
2129
- * - `NOT_AUTHENTICATED_MEMBER`: The returned contact ID belongs to a site member who is not currently logged in.
2130
- */
2131
- identityType?: IdentityType;
2132
- /**
2133
- * Indicates whether the contact was just created or already existed.
2134
- *
2135
- * If the contact was just created, returns `true`.
2136
- * If it already existed, returns `false`.
2137
- */
2138
- newContact?: boolean;
2139
- }
2140
- declare enum IdentityType {
2141
- UNKNOWN = "UNKNOWN",
2142
- /** Existing or new contact */
2143
- CONTACT = "CONTACT",
2144
- /** Member is logged in, matching logic skipped */
2145
- MEMBER = "MEMBER",
2146
- /** Matching contact is a member, Merge logic won't be applied */
2147
- NOT_AUTHENTICATED_MEMBER = "NOT_AUTHENTICATED_MEMBER"
2148
- }
2149
- interface SubmitContactResponseNonNullableFields {
2150
- contactId: string;
2151
- identityType: IdentityType;
2152
- newContact: boolean;
2153
- }
2154
- interface AppendOrCreateContactOptions {
2155
- /**
2156
- * Contact's information.
2157
- * To reconcile with an existing contact,
2158
- * a phone or email must be provided,
2159
- * or the current session identity must be attached to a contact or member.
2160
- *
2161
- * If no existing contact can be found,
2162
- * a new contact is created with the specified information.
2163
- *
2164
- * <!--ONLY:REST-->
2165
- * Required if there's no contextual identity or given `contactId`.
2166
- * <!--END:ONLY:REST-->
2167
- */
2168
- info?: ContactInfo$1;
2169
- /** Pass through data, to be posted on Contact Submitted Domain Event (optional). */
2170
- passThroughData?: string | null;
2171
- /**
2172
- * Existing Contact ID (optional).
2173
- * Requires permission `CONTACTS.SUBMIT_WITH_OVERRIDES`
2174
- */
2175
- contactId?: string | null;
2176
- }
2177
-
2178
- declare function appendOrCreateContact$1(httpClient: HttpClient): (options?: AppendOrCreateContactOptions) => Promise<SubmitContactResponse & SubmitContactResponseNonNullableFields>;
149
+ declare function createRESTModule$1<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
2179
150
 
2180
- declare const appendOrCreateContact: BuildRESTFunction<typeof appendOrCreateContact$1>;
151
+ declare const appendOrCreateContact: ReturnType<typeof createRESTModule$1<typeof publicAppendOrCreateContact>>;
2181
152
 
2182
153
  declare const context$1_appendOrCreateContact: typeof appendOrCreateContact;
2183
154
  declare namespace context$1 {
2184
155
  export { context$1_appendOrCreateContact as appendOrCreateContact };
2185
156
  }
2186
157
 
2187
- interface Task {
2188
- /**
2189
- * Task ID.
2190
- * @readonly
2191
- */
2192
- _id?: string | null;
2193
- /**
2194
- * Revision number, which increments by 1 each time the task is updated. To prevent conflicting changes, the existing `revision` must be used when updating a task.
2195
- * @readonly
2196
- */
2197
- revision?: string | null;
2198
- /** Title of the task. */
2199
- title?: string | null;
2200
- /** Description of the task. */
2201
- description?: string | null;
2202
- /**
2203
- * Date and time the task was created.
2204
- * @readonly
2205
- */
2206
- _createdDate?: Date;
2207
- /**
2208
- * Date and time the task was last updated.
2209
- * @readonly
2210
- */
2211
- _updatedDate?: Date;
2212
- /** Due date for the task. */
2213
- dueDate?: Date;
2214
- /**
2215
- * Status of the task.
2216
- *
2217
- * Default: `ACTION_NEEDED`
2218
- */
2219
- status?: TaskStatus;
2220
- /** Details about the task source. */
2221
- source?: TaskSource;
2222
- /** Information about the contact associated with the task. */
2223
- contact?: ContactInfo;
2224
- }
2225
- /** Possible statuses in which the task may be. */
2226
- declare enum TaskStatus {
2227
- UNKNOWN_STATUS = "UNKNOWN_STATUS",
2228
- ACTION_NEEDED = "ACTION_NEEDED",
2229
- COMPLETED = "COMPLETED"
2230
- }
2231
- interface TaskSource {
2232
- /**
2233
- * How the task was created.
2234
- * @readonly
2235
- */
2236
- sourceType?: SourceType;
2237
- /**
2238
- * App ID, if the task was created by an app.
2239
- * @readonly
2240
- */
2241
- appId?: string | null;
2242
- /**
2243
- * User ID, if the task was created by a user.
2244
- * @readonly
2245
- */
2246
- userId?: string | null;
2247
- }
2248
- /** Possible sources that can create tasks. */
2249
- declare enum SourceType {
2250
- UNKNOWN_SOURCE_TYPE = "UNKNOWN_SOURCE_TYPE",
2251
- APP = "APP",
2252
- USER = "USER"
2253
- }
2254
- interface ContactInfo {
2255
- /** ID of the contact associated with the task. */
2256
- _id?: string | null;
2257
- /**
2258
- * Contact's first name.
2259
- * @readonly
2260
- */
2261
- firstName?: string | null;
2262
- /**
2263
- * Contact's last name.
2264
- * @readonly
2265
- */
2266
- lastName?: string | null;
2267
- /**
2268
- * Contact's image url.
2269
- * @readonly
2270
- */
2271
- imageUrl?: string | null;
2272
- /**
2273
- * Contact's primary email.
2274
- * @readonly
2275
- */
2276
- email?: string | null;
2277
- /**
2278
- * Contact's primary phone.
2279
- * @readonly
2280
- */
2281
- phone?: string | null;
2282
- }
2283
- interface TaskOverdue {
2284
- /** The overdue task. */
2285
- task?: Task;
2286
- }
2287
- interface Cursors {
2288
- /** Cursor pointing to next page in the list of results. */
2289
- next?: string | null;
2290
- /** Cursor pointing to previous page in the list of results. */
2291
- prev?: string | null;
2292
- }
2293
- interface CountTasksResponse {
2294
- /** The number of tasks that match the provided filter. */
2295
- count?: number;
2296
- }
2297
- interface IdentificationData extends IdentificationDataIdOneOf {
2298
- /** ID of a site visitor that has not logged in to the site. */
2299
- anonymousVisitorId?: string;
2300
- /** ID of a site visitor that has logged in to the site. */
2301
- memberId?: string;
2302
- /** ID of a Wix user (site owner, contributor, etc.). */
2303
- wixUserId?: string;
2304
- /** ID of an app. */
2305
- appId?: string;
2306
- /** @readonly */
2307
- identityType?: WebhookIdentityType;
2308
- }
2309
- /** @oneof */
2310
- interface IdentificationDataIdOneOf {
2311
- /** ID of a site visitor that has not logged in to the site. */
2312
- anonymousVisitorId?: string;
2313
- /** ID of a site visitor that has logged in to the site. */
2314
- memberId?: string;
2315
- /** ID of a Wix user (site owner, contributor, etc.). */
2316
- wixUserId?: string;
2317
- /** ID of an app. */
2318
- appId?: string;
2319
- }
2320
- declare enum WebhookIdentityType {
2321
- UNKNOWN = "UNKNOWN",
2322
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2323
- MEMBER = "MEMBER",
2324
- WIX_USER = "WIX_USER",
2325
- APP = "APP"
2326
- }
2327
- interface CountTasksResponseNonNullableFields {
2328
- count: number;
2329
- }
2330
- interface BaseEventMetadata {
2331
- /** App instance ID. */
2332
- instanceId?: string | null;
2333
- /** Event type. */
2334
- eventType?: string;
2335
- /** The identification type and identity data. */
2336
- identity?: IdentificationData;
2337
- }
2338
- interface EventMetadata extends BaseEventMetadata {
2339
- /**
2340
- * Unique event ID.
2341
- * Allows clients to ignore duplicate webhooks.
2342
- */
2343
- _id?: string;
2344
- /**
2345
- * Assumes actions are also always typed to an entity_type
2346
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
2347
- */
2348
- entityFqdn?: string;
2349
- /**
2350
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
2351
- * This is although the created/updated/deleted notion is duplication of the oneof types
2352
- * Example: created/updated/deleted/started/completed/email_opened
2353
- */
2354
- slug?: string;
2355
- /** ID of the entity associated with the event. */
2356
- entityId?: string;
2357
- /** Event timestamp. */
2358
- eventTime?: Date;
2359
- /**
2360
- * Whether the event was triggered as a result of a privacy regulation application
2361
- * (for example, GDPR).
2362
- */
2363
- triggeredByAnonymizeRequest?: boolean | null;
2364
- /** If present, indicates the action that triggered the event. */
2365
- originatedFrom?: string | null;
2366
- /**
2367
- * A sequence number defining the order of updates to the underlying entity.
2368
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
2369
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
2370
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
2371
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
2372
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
2373
- */
2374
- entityEventSequence?: string | null;
2375
- }
2376
- interface TaskOverdueEnvelope {
2377
- data: TaskOverdue;
2378
- metadata: EventMetadata;
2379
- }
2380
- interface TaskCreatedEnvelope {
2381
- entity: Task;
2382
- metadata: EventMetadata;
2383
- }
2384
- interface TaskUpdatedEnvelope {
2385
- entity: Task;
2386
- metadata: EventMetadata;
2387
- }
2388
- interface TaskDeletedEnvelope {
2389
- metadata: EventMetadata;
2390
- }
2391
- interface UpdateTask {
2392
- /**
2393
- * Task ID.
2394
- * @readonly
2395
- */
2396
- _id?: string | null;
2397
- /**
2398
- * Revision number, which increments by 1 each time the task is updated. To prevent conflicting changes, the existing `revision` must be used when updating a task.
2399
- * @readonly
2400
- */
2401
- revision?: string | null;
2402
- /** Title of the task. */
2403
- title?: string | null;
2404
- /** Description of the task. */
2405
- description?: string | null;
2406
- /**
2407
- * Date and time the task was created.
2408
- * @readonly
2409
- */
2410
- _createdDate?: Date;
2411
- /**
2412
- * Date and time the task was last updated.
2413
- * @readonly
2414
- */
2415
- _updatedDate?: Date;
2416
- /** Due date for the task. */
2417
- dueDate?: Date;
2418
- /**
2419
- * Status of the task.
2420
- *
2421
- * Default: `ACTION_NEEDED`
2422
- */
2423
- status?: TaskStatus;
2424
- /** Details about the task source. */
2425
- source?: TaskSource;
2426
- /** Information about the contact associated with the task. */
2427
- contact?: ContactInfo;
2428
- }
2429
- interface QueryCursorResult {
2430
- cursors: Cursors;
2431
- hasNext: () => boolean;
2432
- hasPrev: () => boolean;
2433
- length: number;
2434
- pageSize: number;
2435
- }
2436
- interface TasksQueryResult extends QueryCursorResult {
2437
- items: Task[];
2438
- query: TasksQueryBuilder;
2439
- next: () => Promise<TasksQueryResult>;
2440
- prev: () => Promise<TasksQueryResult>;
2441
- }
2442
- interface TasksQueryBuilder {
2443
- /** @param propertyName - Property whose value is compared with `value`.
2444
- * @param value - Value to compare against.
2445
- */
2446
- eq: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'dueDate' | 'status' | 'contact.id', value: any) => TasksQueryBuilder;
2447
- /** @param propertyName - Property whose value is compared with `value`.
2448
- * @param value - Value to compare against.
2449
- */
2450
- ne: (propertyName: '_id' | '_createdDate' | '_updatedDate' | 'dueDate' | 'status' | 'contact.id', value: any) => TasksQueryBuilder;
2451
- /** @param propertyName - Property whose value is compared with `value`.
2452
- * @param value - Value to compare against.
2453
- */
2454
- ge: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder;
2455
- /** @param propertyName - Property whose value is compared with `value`.
2456
- * @param value - Value to compare against.
2457
- */
2458
- gt: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder;
2459
- /** @param propertyName - Property whose value is compared with `value`.
2460
- * @param value - Value to compare against.
2461
- */
2462
- le: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder;
2463
- /** @param propertyName - Property whose value is compared with `value`.
2464
- * @param value - Value to compare against.
2465
- */
2466
- lt: (propertyName: '_createdDate' | '_updatedDate' | 'dueDate', value: any) => TasksQueryBuilder;
2467
- in: (propertyName: '_id' | 'status' | 'contact.id', value: any) => TasksQueryBuilder;
2468
- exists: (propertyName: 'contact.id', value: boolean) => TasksQueryBuilder;
2469
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
2470
- ascending: (...propertyNames: Array<'_id' | '_createdDate' | '_updatedDate' | 'dueDate'>) => TasksQueryBuilder;
2471
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
2472
- descending: (...propertyNames: Array<'_id' | '_createdDate' | '_updatedDate' | 'dueDate'>) => TasksQueryBuilder;
2473
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
2474
- limit: (limit: number) => TasksQueryBuilder;
2475
- /** @param cursor - A pointer to specific record */
2476
- skipTo: (cursor: string) => TasksQueryBuilder;
2477
- find: () => Promise<TasksQueryResult>;
2478
- }
2479
- interface CountTasksOptions {
2480
- /**
2481
- * Filter which tasks to count. See the list of supported filters in `queryContacts`.
2482
- *
2483
- * Filterable fields include:
2484
- * - `_id`
2485
- * - `_createdDate`
2486
- * - `_updatedDate`
2487
- * - `dueDate`
2488
- * - `status`
2489
- * - `contact.id`
2490
- */
2491
- filter?: Record<string, any> | null;
2492
- }
2493
- interface MoveTaskAfterOptions {
2494
- /**
2495
- * The task ID after which the moved task is positioned in the display.
2496
- * If `beforeTaskId` is not provided, the moved task is positioned first in the display of tasks.
2497
- */
2498
- beforeTaskId?: string | null;
2499
- }
158
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
2500
159
 
2501
- declare function createTask$1(httpClient: HttpClient): (task: Task) => Promise<Task & {
2502
- status: TaskStatus;
2503
- source?: {
2504
- sourceType: SourceType;
2505
- } | undefined;
2506
- }>;
2507
- declare function getTask$1(httpClient: HttpClient): (taskId: string) => Promise<Task & {
2508
- status: TaskStatus;
2509
- source?: {
2510
- sourceType: SourceType;
2511
- } | undefined;
2512
- }>;
2513
- declare function updateTask$1(httpClient: HttpClient): (_id: string | null, task: UpdateTask) => Promise<Task & {
2514
- status: TaskStatus;
2515
- source?: {
2516
- sourceType: SourceType;
2517
- } | undefined;
2518
- }>;
2519
- declare function deleteTask$1(httpClient: HttpClient): (taskId: string) => Promise<void>;
2520
- declare function queryTasks$1(httpClient: HttpClient): () => TasksQueryBuilder;
2521
- declare function countTasks$1(httpClient: HttpClient): (options?: CountTasksOptions) => Promise<CountTasksResponse & CountTasksResponseNonNullableFields>;
2522
- declare function moveTaskAfter$1(httpClient: HttpClient): (taskId: string, options?: MoveTaskAfterOptions) => Promise<void>;
2523
- declare const onTaskOverdue$1: EventDefinition<TaskOverdueEnvelope, "wix.crm.tasks.v2.task_task_overdue">;
2524
- declare const onTaskCreated$1: EventDefinition<TaskCreatedEnvelope, "wix.crm.tasks.v2.task_created">;
2525
- declare const onTaskUpdated$1: EventDefinition<TaskUpdatedEnvelope, "wix.crm.tasks.v2.task_updated">;
2526
- declare const onTaskDeleted$1: EventDefinition<TaskDeletedEnvelope, "wix.crm.tasks.v2.task_deleted">;
160
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
2527
161
 
2528
- declare const createTask: BuildRESTFunction<typeof createTask$1>;
2529
- declare const getTask: BuildRESTFunction<typeof getTask$1>;
2530
- declare const updateTask: BuildRESTFunction<typeof updateTask$1>;
2531
- declare const deleteTask: BuildRESTFunction<typeof deleteTask$1>;
2532
- declare const queryTasks: BuildRESTFunction<typeof queryTasks$1>;
2533
- declare const countTasks: BuildRESTFunction<typeof countTasks$1>;
2534
- declare const moveTaskAfter: BuildRESTFunction<typeof moveTaskAfter$1>;
2535
- declare const onTaskOverdue: BuildEventDefinition<typeof onTaskOverdue$1>;
2536
- declare const onTaskCreated: BuildEventDefinition<typeof onTaskCreated$1>;
2537
- declare const onTaskUpdated: BuildEventDefinition<typeof onTaskUpdated$1>;
2538
- declare const onTaskDeleted: BuildEventDefinition<typeof onTaskDeleted$1>;
162
+ declare const createTask: ReturnType<typeof createRESTModule<typeof publicCreateTask>>;
163
+ declare const getTask: ReturnType<typeof createRESTModule<typeof publicGetTask>>;
164
+ declare const updateTask: ReturnType<typeof createRESTModule<typeof publicUpdateTask>>;
165
+ declare const deleteTask: ReturnType<typeof createRESTModule<typeof publicDeleteTask>>;
166
+ declare const queryTasks: ReturnType<typeof createRESTModule<typeof publicQueryTasks>>;
167
+ declare const countTasks: ReturnType<typeof createRESTModule<typeof publicCountTasks>>;
168
+ declare const moveTaskAfter: ReturnType<typeof createRESTModule<typeof publicMoveTaskAfter>>;
169
+ declare const onTaskOverdue: ReturnType<typeof createEventModule<typeof publicOnTaskOverdue>>;
170
+ declare const onTaskCreated: ReturnType<typeof createEventModule<typeof publicOnTaskCreated>>;
171
+ declare const onTaskUpdated: ReturnType<typeof createEventModule<typeof publicOnTaskUpdated>>;
172
+ declare const onTaskDeleted: ReturnType<typeof createEventModule<typeof publicOnTaskDeleted>>;
2539
173
 
2540
174
  declare const context_countTasks: typeof countTasks;
2541
175
  declare const context_createTask: typeof createTask;