@wix/crm 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/build/cjs/index.d.ts +4 -1
  2. package/build/cjs/index.js +5 -2
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/src/contacts-v4-contact.http.d.ts +192 -0
  5. package/build/cjs/src/contacts-v4-contact.http.js +522 -0
  6. package/build/cjs/src/contacts-v4-contact.http.js.map +1 -0
  7. package/build/cjs/src/contacts-v4-contact.public.d.ts +14 -0
  8. package/build/cjs/src/contacts-v4-contact.public.js +64 -0
  9. package/build/cjs/src/contacts-v4-contact.public.js.map +1 -0
  10. package/build/cjs/src/contacts-v4-contact.types.d.ts +1310 -0
  11. package/build/cjs/src/contacts-v4-contact.types.js +202 -0
  12. package/build/cjs/src/contacts-v4-contact.types.js.map +1 -0
  13. package/build/cjs/src/contacts-v4-contact.universal.d.ts +1663 -0
  14. package/build/cjs/src/contacts-v4-contact.universal.js +903 -0
  15. package/build/cjs/src/contacts-v4-contact.universal.js.map +1 -0
  16. package/build/cjs/src/contacts-v4-extended-field.http.d.ts +31 -0
  17. package/build/cjs/src/contacts-v4-extended-field.http.js +215 -0
  18. package/build/cjs/src/contacts-v4-extended-field.http.js.map +1 -0
  19. package/build/cjs/src/contacts-v4-extended-field.public.d.ts +12 -0
  20. package/build/cjs/src/contacts-v4-extended-field.public.js +40 -0
  21. package/build/cjs/src/contacts-v4-extended-field.public.js.map +1 -0
  22. package/build/cjs/src/contacts-v4-extended-field.types.d.ts +257 -0
  23. package/build/cjs/src/contacts-v4-extended-field.types.js +23 -0
  24. package/build/cjs/src/contacts-v4-extended-field.types.js.map +1 -0
  25. package/build/cjs/src/contacts-v4-extended-field.universal.d.ts +476 -0
  26. package/build/cjs/src/contacts-v4-extended-field.universal.js +393 -0
  27. package/build/cjs/src/contacts-v4-extended-field.universal.js.map +1 -0
  28. package/build/cjs/src/contacts-v4-label.http.d.ts +31 -0
  29. package/build/cjs/src/contacts-v4-label.http.js +191 -0
  30. package/build/cjs/src/contacts-v4-label.http.js.map +1 -0
  31. package/build/cjs/src/contacts-v4-label.public.d.ts +11 -0
  32. package/build/cjs/src/contacts-v4-label.public.js +33 -0
  33. package/build/cjs/src/contacts-v4-label.public.js.map +1 -0
  34. package/build/cjs/src/contacts-v4-label.types.d.ts +253 -0
  35. package/build/cjs/src/contacts-v4-label.types.js +17 -0
  36. package/build/cjs/src/contacts-v4-label.types.js.map +1 -0
  37. package/build/cjs/src/contacts-v4-label.universal.d.ts +442 -0
  38. package/build/cjs/src/contacts-v4-label.universal.js +326 -0
  39. package/build/cjs/src/contacts-v4-label.universal.js.map +1 -0
  40. package/build/es/index.d.ts +4 -1
  41. package/build/es/index.js +4 -1
  42. package/build/es/index.js.map +1 -1
  43. package/build/es/src/contacts-v4-contact.http.d.ts +192 -0
  44. package/build/es/src/contacts-v4-contact.http.js +512 -0
  45. package/build/es/src/contacts-v4-contact.http.js.map +1 -0
  46. package/build/es/src/contacts-v4-contact.public.d.ts +14 -0
  47. package/build/es/src/contacts-v4-contact.public.js +39 -0
  48. package/build/es/src/contacts-v4-contact.public.js.map +1 -0
  49. package/build/es/src/contacts-v4-contact.types.d.ts +1310 -0
  50. package/build/es/src/contacts-v4-contact.types.js +199 -0
  51. package/build/es/src/contacts-v4-contact.types.js.map +1 -0
  52. package/build/es/src/contacts-v4-contact.universal.d.ts +1663 -0
  53. package/build/es/src/contacts-v4-contact.universal.js +874 -0
  54. package/build/es/src/contacts-v4-contact.universal.js.map +1 -0
  55. package/build/es/src/contacts-v4-extended-field.http.d.ts +31 -0
  56. package/build/es/src/contacts-v4-extended-field.http.js +207 -0
  57. package/build/es/src/contacts-v4-extended-field.http.js.map +1 -0
  58. package/build/es/src/contacts-v4-extended-field.public.d.ts +12 -0
  59. package/build/es/src/contacts-v4-extended-field.public.js +29 -0
  60. package/build/es/src/contacts-v4-extended-field.public.js.map +1 -0
  61. package/build/es/src/contacts-v4-extended-field.types.d.ts +257 -0
  62. package/build/es/src/contacts-v4-extended-field.types.js +20 -0
  63. package/build/es/src/contacts-v4-extended-field.types.js.map +1 -0
  64. package/build/es/src/contacts-v4-extended-field.universal.d.ts +476 -0
  65. package/build/es/src/contacts-v4-extended-field.universal.js +366 -0
  66. package/build/es/src/contacts-v4-extended-field.universal.js.map +1 -0
  67. package/build/es/src/contacts-v4-label.http.d.ts +31 -0
  68. package/build/es/src/contacts-v4-label.http.js +184 -0
  69. package/build/es/src/contacts-v4-label.http.js.map +1 -0
  70. package/build/es/src/contacts-v4-label.public.d.ts +11 -0
  71. package/build/es/src/contacts-v4-label.public.js +24 -0
  72. package/build/es/src/contacts-v4-label.public.js.map +1 -0
  73. package/build/es/src/contacts-v4-label.types.d.ts +253 -0
  74. package/build/es/src/contacts-v4-label.types.js +14 -0
  75. package/build/es/src/contacts-v4-label.types.js.map +1 -0
  76. package/build/es/src/contacts-v4-label.universal.d.ts +442 -0
  77. package/build/es/src/contacts-v4-label.universal.js +300 -0
  78. package/build/es/src/contacts-v4-label.universal.js.map +1 -0
  79. package/package.json +2 -2
@@ -0,0 +1,874 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { serializer, transformError } from '@wix/metro-runtime/velo';
11
+ import * as ambassadorWixContactsV4Contact from './contacts-v4-contact.http';
12
+ let __verbose = false;
13
+ function __log(...args) {
14
+ __verbose && console.log(...args);
15
+ }
16
+ function __inspect(obj) {
17
+ return obj;
18
+ }
19
+ export const __debug = {
20
+ verboseLogging: {
21
+ on: () => (__verbose = true),
22
+ off: () => (__verbose = false),
23
+ },
24
+ };
25
+ const _toVeloEntity = '$';
26
+ const _fromVeloEntity = '$';
27
+ export var ContactSourceType;
28
+ (function (ContactSourceType) {
29
+ ContactSourceType["OTHER"] = "OTHER";
30
+ ContactSourceType["ADMIN"] = "ADMIN";
31
+ ContactSourceType["WIX_APP"] = "WIX_APP";
32
+ ContactSourceType["IMPORT"] = "IMPORT";
33
+ ContactSourceType["THIRD_PARTY"] = "THIRD_PARTY";
34
+ ContactSourceType["WIX_BOOKINGS"] = "WIX_BOOKINGS";
35
+ ContactSourceType["WIX_CHAT"] = "WIX_CHAT";
36
+ ContactSourceType["WIX_EMAIL_MARKETING"] = "WIX_EMAIL_MARKETING";
37
+ ContactSourceType["WIX_EVENTS"] = "WIX_EVENTS";
38
+ ContactSourceType["WIX_FORMS"] = "WIX_FORMS";
39
+ ContactSourceType["WIX_GROUPS"] = "WIX_GROUPS";
40
+ ContactSourceType["WIX_HOTELS"] = "WIX_HOTELS";
41
+ ContactSourceType["WIX_MARKET_PLACE"] = "WIX_MARKET_PLACE";
42
+ ContactSourceType["WIX_MUSIC"] = "WIX_MUSIC";
43
+ ContactSourceType["WIX_RESTAURANTS"] = "WIX_RESTAURANTS";
44
+ ContactSourceType["WIX_SITE_MEMBERS"] = "WIX_SITE_MEMBERS";
45
+ ContactSourceType["WIX_STORES"] = "WIX_STORES";
46
+ ContactSourceType["WIX_CODE"] = "WIX_CODE";
47
+ })(ContactSourceType || (ContactSourceType = {}));
48
+ export var ContactActivityType;
49
+ (function (ContactActivityType) {
50
+ /** Last visit to your site (any unknown activity) */
51
+ ContactActivityType["GENERAL"] = "GENERAL";
52
+ /** This cannot be reported, used when contact created, will throw exception */
53
+ ContactActivityType["CONTACT_CREATED"] = "CONTACT_CREATED";
54
+ /** "auth/login" */
55
+ ContactActivityType["MEMBER_LOGIN"] = "MEMBER_LOGIN";
56
+ /** "auth/register" */
57
+ ContactActivityType["MEMBER_REGISTER"] = "MEMBER_REGISTER";
58
+ /** "auth/status-change" */
59
+ ContactActivityType["MEMBER_STATUS_CHANGED"] = "MEMBER_STATUS_CHANGED";
60
+ /** "contact/contact-form", (but also "form/contact-form", "form/form") */
61
+ ContactActivityType["FORM_SUBMITTED"] = "FORM_SUBMITTED";
62
+ /** "form/lead-capture-form" */
63
+ ContactActivityType["INBOX_FORM_SUBMITTED"] = "INBOX_FORM_SUBMITTED";
64
+ /** "chat/payment-request-paid" */
65
+ ContactActivityType["INBOX_PAYMENT_REQUEST_PAID"] = "INBOX_PAYMENT_REQUEST_PAID";
66
+ /** "messaging/email" - Direction BUSINESS_TO_CUSTOMER */
67
+ ContactActivityType["INBOX_MESSAGE_TO_CUSTOMER"] = "INBOX_MESSAGE_TO_CUSTOMER";
68
+ /** "messaging/email" - Direction CUSTOMER_TO_BUSINESS */
69
+ ContactActivityType["INBOX_MESSAGE_FROM_CUSTOMER"] = "INBOX_MESSAGE_FROM_CUSTOMER";
70
+ /** "contact/subscription-form" (but also "form/subscription-form") */
71
+ ContactActivityType["NEWSLETTER_SUBSCRIPTION_FORM_SUBMITTED"] = "NEWSLETTER_SUBSCRIPTION_FORM_SUBMITTED";
72
+ /** "contact/unsubscribe" */
73
+ ContactActivityType["NEWSLETTER_SUBSCRIPTION_UNSUBSCRIBE"] = "NEWSLETTER_SUBSCRIPTION_UNSUBSCRIBE";
74
+ /** "e_commerce/purchase" */
75
+ ContactActivityType["ECOM_PURCHASE"] = "ECOM_PURCHASE";
76
+ /** "e_commerce/cart-abandon" */
77
+ ContactActivityType["ECOM_CART_ABANDON"] = "ECOM_CART_ABANDON";
78
+ /** "e_commerce/checkout-buyer" */
79
+ ContactActivityType["ECOM_CHECKOUT_BUYER"] = "ECOM_CHECKOUT_BUYER";
80
+ /** "scheduler/appointment" */
81
+ ContactActivityType["BOOKINGS_APPOINTMENT"] = "BOOKINGS_APPOINTMENT";
82
+ /** "hotels/reservation" */
83
+ ContactActivityType["HOTELS_RESERVATION"] = "HOTELS_RESERVATION";
84
+ /** "hotels/purchase" */
85
+ ContactActivityType["HOTELS_PURCHASE"] = "HOTELS_PURCHASE";
86
+ /** "hotels/confirmation" */
87
+ ContactActivityType["HOTELS_CONFIRMATION"] = "HOTELS_CONFIRMATION";
88
+ /** "hotels/cancel" */
89
+ ContactActivityType["HOTELS_CANCEL"] = "HOTELS_CANCEL";
90
+ /** "video/purchase" */
91
+ ContactActivityType["VIDEO_PURCHASE"] = "VIDEO_PURCHASE";
92
+ /** "video/rent" */
93
+ ContactActivityType["VIDEO_RENT"] = "VIDEO_RENT";
94
+ /** "cashier/button_purchase" */
95
+ ContactActivityType["CASHIER_BUTTON_PURCHASE"] = "CASHIER_BUTTON_PURCHASE";
96
+ /** "arena/new-lead" */
97
+ ContactActivityType["ARENA_NEW_LEAD"] = "ARENA_NEW_LEAD";
98
+ /** "events/rsvp" */
99
+ ContactActivityType["EVENTS_RSVP"] = "EVENTS_RSVP";
100
+ /** "invoice/pay" */
101
+ ContactActivityType["INVOICE_PAY"] = "INVOICE_PAY";
102
+ /** "invoice/overdue" */
103
+ ContactActivityType["INVOICE_OVERDUE"] = "INVOICE_OVERDUE";
104
+ /** "price-quote/accept" */
105
+ ContactActivityType["PRICE_QUOTE_ACCEPT"] = "PRICE_QUOTE_ACCEPT";
106
+ /** "price-quote/expire" */
107
+ ContactActivityType["PRICE_QUOTE_EXPIRE"] = "PRICE_QUOTE_EXPIRE";
108
+ /** "restaurants/order" */
109
+ ContactActivityType["RESTAURANTS_ORDER"] = "RESTAURANTS_ORDER";
110
+ /** "restaurants/reservation" */
111
+ ContactActivityType["RESTAURANTS_RESERVATION"] = "RESTAURANTS_RESERVATION";
112
+ /** "shoutout/open" */
113
+ ContactActivityType["SHOUTOUT_OPEN"] = "SHOUTOUT_OPEN";
114
+ /** "shoutout/click" */
115
+ ContactActivityType["SHOUTOUT_CLICK"] = "SHOUTOUT_CLICK";
116
+ ContactActivityType["CONTACT_MERGED"] = "CONTACT_MERGED";
117
+ })(ContactActivityType || (ContactActivityType = {}));
118
+ export var EmailTag;
119
+ (function (EmailTag) {
120
+ EmailTag["UNTAGGED"] = "UNTAGGED";
121
+ EmailTag["MAIN"] = "MAIN";
122
+ EmailTag["HOME"] = "HOME";
123
+ EmailTag["WORK"] = "WORK";
124
+ })(EmailTag || (EmailTag = {}));
125
+ export var PhoneTag;
126
+ (function (PhoneTag) {
127
+ PhoneTag["UNTAGGED"] = "UNTAGGED";
128
+ PhoneTag["MAIN"] = "MAIN";
129
+ PhoneTag["HOME"] = "HOME";
130
+ PhoneTag["MOBILE"] = "MOBILE";
131
+ PhoneTag["WORK"] = "WORK";
132
+ PhoneTag["FAX"] = "FAX";
133
+ })(PhoneTag || (PhoneTag = {}));
134
+ export var AddressTag;
135
+ (function (AddressTag) {
136
+ AddressTag["UNTAGGED"] = "UNTAGGED";
137
+ AddressTag["HOME"] = "HOME";
138
+ AddressTag["WORK"] = "WORK";
139
+ AddressTag["BILLING"] = "BILLING";
140
+ AddressTag["SHIPPING"] = "SHIPPING";
141
+ })(AddressTag || (AddressTag = {}));
142
+ export var SubdivisionType;
143
+ (function (SubdivisionType) {
144
+ SubdivisionType["UNKNOWN_SUBDIVISION_TYPE"] = "UNKNOWN_SUBDIVISION_TYPE";
145
+ /** state */
146
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_1"] = "ADMINISTRATIVE_AREA_LEVEL_1";
147
+ /** county */
148
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_2"] = "ADMINISTRATIVE_AREA_LEVEL_2";
149
+ /** cities/towns */
150
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_3"] = "ADMINISTRATIVE_AREA_LEVEL_3";
151
+ /** neighborhood/quarter */
152
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_4"] = "ADMINISTRATIVE_AREA_LEVEL_4";
153
+ /** street/block */
154
+ SubdivisionType["ADMINISTRATIVE_AREA_LEVEL_5"] = "ADMINISTRATIVE_AREA_LEVEL_5";
155
+ /** (ADMINISTRATIVE_AREA_LEVEL_0) indicates the national political entity, and is typically the highest order type returned by the Geocoder. */
156
+ SubdivisionType["COUNTRY"] = "COUNTRY";
157
+ })(SubdivisionType || (SubdivisionType = {}));
158
+ export var ImageProvider;
159
+ (function (ImageProvider) {
160
+ ImageProvider["UNKNOWN"] = "UNKNOWN";
161
+ /** Image stored outside Wix */
162
+ ImageProvider["EXTERNAL"] = "EXTERNAL";
163
+ /** Stored in wix media platform, Must be uploaded by using `GeneratePictureUploadUrl` */
164
+ ImageProvider["WIX_MEDIA"] = "WIX_MEDIA";
165
+ })(ImageProvider || (ImageProvider = {}));
166
+ export var SortOrder;
167
+ (function (SortOrder) {
168
+ SortOrder["ASC"] = "ASC";
169
+ SortOrder["DESC"] = "DESC";
170
+ })(SortOrder || (SortOrder = {}));
171
+ export var ContactFieldSet;
172
+ (function (ContactFieldSet) {
173
+ /** name, primaryEmail, primaryPhone */
174
+ ContactFieldSet["BASIC"] = "BASIC";
175
+ /** name, phones, emails, addressses */
176
+ ContactFieldSet["COMMUNICATION_DETAILS"] = "COMMUNICATION_DETAILS";
177
+ /** name, primaryInfo(email, phone), extendedFields */
178
+ ContactFieldSet["EXTENDED"] = "EXTENDED";
179
+ /** Full contact object */
180
+ ContactFieldSet["FULL"] = "FULL";
181
+ })(ContactFieldSet || (ContactFieldSet = {}));
182
+ export var ContactsFacetType;
183
+ (function (ContactsFacetType) {
184
+ ContactsFacetType["UNKNOWN"] = "UNKNOWN";
185
+ ContactsFacetType["ALL_CONTACTS"] = "ALL_CONTACTS";
186
+ ContactsFacetType["NOT_LABELED"] = "NOT_LABELED";
187
+ ContactsFacetType["LABEL"] = "LABEL";
188
+ ContactsFacetType["SUBSCRIPTION_STATUS"] = "SUBSCRIPTION_STATUS";
189
+ ContactsFacetType["MEMBERSHIP_STATUS"] = "MEMBERSHIP_STATUS";
190
+ })(ContactsFacetType || (ContactsFacetType = {}));
191
+ export var Action;
192
+ (function (Action) {
193
+ Action["UNKNOWN"] = "UNKNOWN";
194
+ Action["UPDATED"] = "UPDATED";
195
+ Action["CREATED"] = "CREATED";
196
+ })(Action || (Action = {}));
197
+ export var UpsertContactResponseAction;
198
+ (function (UpsertContactResponseAction) {
199
+ UpsertContactResponseAction["UNKNOWN"] = "UNKNOWN";
200
+ UpsertContactResponseAction["UPDATED"] = "UPDATED";
201
+ UpsertContactResponseAction["CREATED"] = "CREATED";
202
+ })(UpsertContactResponseAction || (UpsertContactResponseAction = {}));
203
+ export var GetContactResponseType;
204
+ (function (GetContactResponseType) {
205
+ /** Normal contact */
206
+ GetContactResponseType["REGULAR"] = "REGULAR";
207
+ /** Contact that id was already allocated for it, but the contact not yet created. */
208
+ GetContactResponseType["IMPLICIT"] = "IMPLICIT";
209
+ /** Contact was merged into another contact */
210
+ GetContactResponseType["MERGED"] = "MERGED";
211
+ })(GetContactResponseType || (GetContactResponseType = {}));
212
+ export var SubmitOperation;
213
+ (function (SubmitOperation) {
214
+ SubmitOperation["UNKNOWN"] = "UNKNOWN";
215
+ SubmitOperation["CREATE"] = "CREATE";
216
+ SubmitOperation["UPDATE"] = "UPDATE";
217
+ })(SubmitOperation || (SubmitOperation = {}));
218
+ export var Mode;
219
+ (function (Mode) {
220
+ /** any */
221
+ Mode["OR"] = "OR";
222
+ /** all */
223
+ Mode["AND"] = "AND";
224
+ })(Mode || (Mode = {}));
225
+ const _contact = { picture: 'wix.common.Image', info: '_contactInfo' };
226
+ const _contactAddress = { address: 'wix.common.Address' };
227
+ const _contactAddressesWrapper = { items: '_contactAddress' };
228
+ const _contactInfo = {
229
+ addresses: '_contactAddressesWrapper',
230
+ picture: '_contactPicture',
231
+ };
232
+ const _contactPicture = { image: 'wix.common.Image' };
233
+ const _createContactRequest = { info: '_contactInfo' };
234
+ const _createContactResponse = { contact: '_contact' };
235
+ const _deleteContactRequest = {};
236
+ const _deleteContactResponse = {};
237
+ const _getContactRequest = {};
238
+ const _getContactResponse = { contact: '_contact' };
239
+ const _labelContactRequest = {};
240
+ const _labelContactResponse = { contact: '_contact' };
241
+ const _mergeContactsRequest = {};
242
+ const _mergeContactsResponse = { contact: '_contact' };
243
+ const _unlabelContactRequest = {};
244
+ const _unlabelContactResponse = { contact: '_contact' };
245
+ const _updateContactRequest = { info: '_contactInfo' };
246
+ const _updateContactResponse = { contact: '_contact' };
247
+ /**
248
+ * Creates a new contact.
249
+ *
250
+ *
251
+ * The `createContact()` function returns a Promise
252
+ * that resolves to the new contact when it is created.
253
+ * > **Note:**
254
+ * > This function replaces the deprecated
255
+ * > `wixCrmBackend.createContact()`.
256
+ * > The deprecated function will continue to work, but it will not receive updates.
257
+ * > To keep any existing code compatible with future changes, see the
258
+ * > [migration instructions](wix-crm-backend/createcontact#migration-instructions).
259
+ *
260
+ * The `contactInfo` parameter object must include a name, phone number, or email address.
261
+ * If all 3 of these parameters are missing,
262
+ * the contact won't be created.
263
+ *
264
+ * <!--
265
+ * > **Note:**
266
+ * > Only visitors with
267
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
268
+ * > can create contacts.
269
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
270
+ * -->
271
+ * By default,
272
+ * if the call contains an email already in use by another contact,
273
+ * the new contact won't be created.
274
+ * To override this behavior,
275
+ * set `allowDuplicates` in the `options` object to `true`.
276
+ *
277
+ * This function is not a universal function and runs only on the backend.
278
+ * @param info - Contact info.
279
+ * @public
280
+ * @documentationMaturity preview
281
+ * @requiredField info
282
+ * @param options - Create contact options.
283
+ * @returns Contact.
284
+ */
285
+ export function createContact(info, options) {
286
+ var _a, _b, _c;
287
+ return __awaiter(this, arguments, void 0, function* () {
288
+ const requestTransformation = {
289
+ info: '$[0]',
290
+ allowDuplicates: '$[1].allowDuplicates',
291
+ };
292
+ const responseTransformation = '$';
293
+ // @ts-ignore
294
+ const { httpClient, sideEffects } = arguments[2];
295
+ const { toAmbassadorRequest } = serializer({
296
+ rootSchema: _createContactRequest,
297
+ depSchemas: {
298
+ _contactAddress,
299
+ _contactAddressesWrapper,
300
+ _contactInfo,
301
+ _contactPicture,
302
+ },
303
+ fqdnTransformation: {
304
+ paths: [],
305
+ transformation: _fromVeloEntity,
306
+ },
307
+ customTransformation: requestTransformation,
308
+ });
309
+ const { fromJSON } = serializer({
310
+ rootSchema: _createContactResponse,
311
+ depSchemas: {
312
+ _contact,
313
+ _contactAddress,
314
+ _contactAddressesWrapper,
315
+ _contactInfo,
316
+ _contactPicture,
317
+ },
318
+ fqdnTransformation: {
319
+ paths: [...['contact']],
320
+ transformation: _toVeloEntity,
321
+ },
322
+ customTransformation: responseTransformation,
323
+ });
324
+ const payload = toAmbassadorRequest([info, options]);
325
+ const reqOpts = ambassadorWixContactsV4Contact.createContact(payload);
326
+ __log(`"CreateContact" sending request with: ${__inspect(reqOpts)}`);
327
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
328
+ try {
329
+ const result = yield httpClient.request(reqOpts);
330
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
331
+ return fromJSON(result.data);
332
+ }
333
+ catch (err) {
334
+ const transformedError = transformError(err, requestTransformation, [
335
+ 'info',
336
+ 'options',
337
+ ]);
338
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
339
+ throw transformedError;
340
+ }
341
+ });
342
+ }
343
+ /**
344
+ * Updates a contact's properties.
345
+ *
346
+ * The `updateContact()` function returns a Promise that resolves
347
+ * when the specified contact's information is updated.
348
+ *
349
+ * > **Note:**
350
+ * > This function replaces the deprecated
351
+ * > `wixCrmBackend.updateContact()`.
352
+ * > The deprecated function will continue to work, but it will not receive updates.
353
+ * > To keep any existing code compatible with future changes, see the
354
+ * > [migration instructions](wix-crm-backend/updatecontact#migration-instructions).
355
+ *
356
+ * Each time the contact is updated,
357
+ * `revision` increments by 1.
358
+ * The existing `revision` must be included when updating the contact.
359
+ * This ensures you're working with the latest contact information,
360
+ * and it prevents unintended overwrites.
361
+ *
362
+ * <!--
363
+ * > **Note:**
364
+ * > Only visitors with
365
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
366
+ * > can update contacts.
367
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
368
+ * -->
369
+ *
370
+ * This function is not a universal function and runs only on the backend.
371
+ * @param contactId - ID of the contact to update.
372
+ * @param info - Contact info.
373
+ * @public
374
+ * @documentationMaturity preview
375
+ * @requiredField contactId
376
+ * @requiredField info
377
+ * @requiredField options
378
+ * @requiredField options.revision
379
+ * @param options - Contact update options.
380
+ * @returns Updated contact.
381
+ */
382
+ export function updateContact(contactId, info, options) {
383
+ var _a, _b, _c;
384
+ return __awaiter(this, arguments, void 0, function* () {
385
+ const requestTransformation = {
386
+ contactId: '$[0]',
387
+ info: '$[1]',
388
+ revision: '$[2].revision',
389
+ allowDuplicates: '$[2].allowDuplicates',
390
+ };
391
+ const responseTransformation = '$';
392
+ // @ts-ignore
393
+ const { httpClient, sideEffects } = arguments[3];
394
+ const { toAmbassadorRequest } = serializer({
395
+ rootSchema: _updateContactRequest,
396
+ depSchemas: {
397
+ _contactAddress,
398
+ _contactAddressesWrapper,
399
+ _contactInfo,
400
+ _contactPicture,
401
+ },
402
+ fqdnTransformation: {
403
+ paths: [],
404
+ transformation: _fromVeloEntity,
405
+ },
406
+ customTransformation: requestTransformation,
407
+ });
408
+ const { fromJSON } = serializer({
409
+ rootSchema: _updateContactResponse,
410
+ depSchemas: {
411
+ _contact,
412
+ _contactAddress,
413
+ _contactAddressesWrapper,
414
+ _contactInfo,
415
+ _contactPicture,
416
+ },
417
+ fqdnTransformation: {
418
+ paths: [...['contact']],
419
+ transformation: _toVeloEntity,
420
+ },
421
+ customTransformation: responseTransformation,
422
+ });
423
+ const payload = toAmbassadorRequest([contactId, info, options]);
424
+ const reqOpts = ambassadorWixContactsV4Contact.updateContact(payload);
425
+ __log(`"UpdateContact" sending request with: ${__inspect(reqOpts)}`);
426
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
427
+ try {
428
+ const result = yield httpClient.request(reqOpts);
429
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
430
+ return fromJSON(result.data);
431
+ }
432
+ catch (err) {
433
+ const transformedError = transformError(err, requestTransformation, [
434
+ 'contactId',
435
+ 'info',
436
+ 'options',
437
+ ]);
438
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
439
+ throw transformedError;
440
+ }
441
+ });
442
+ }
443
+ /**
444
+ * Merges source contacts into a target contact.
445
+ *
446
+ * Merging contacts has these effects on the target contact:
447
+ *
448
+ * - No target contact data is overwritten or deleted.
449
+ * - Arrays (emails, phones, addresses, and labels) are merged from the source contacts.
450
+ * - If merging more than one source contact, the 1st source is given precedence, then the 2nd, and so on.
451
+ *
452
+ * <blockquote class="important">
453
+ *
454
+ * __Important:__
455
+ * Merges cannot be undone.
456
+ * Use [Preview Merge Contacts](#preview-merge-contacts)
457
+ * to test before merging.
458
+ *
459
+ * </blockquote>
460
+ *
461
+ * Source contacts are deleted when merging.
462
+ * However, if a source contact is a site member or contributor,
463
+ * the merge fails because site contributors and members can't be deleted.
464
+ * Site members and contributors can be target contacts only.
465
+ *
466
+ * After merging,
467
+ * if you call [Get Contact](#get-contact) with a deleted source contact ID,
468
+ * the target contact ID is returned.
469
+ * This is supported when calling Get Contact only.
470
+ * Deleted source contact IDs are not supported on any other endpoint.
471
+ *
472
+ * Merging contacts triggers these webhooks:
473
+ *
474
+ * - [Contact Merged](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/contact-merged-webhook) is triggered.
475
+ * - [Contact Updated](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/contact-updated-webhook) is triggered for the target contact. `originatedFrom` is set to `merge`.
476
+ * - [Contact Deleted](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/contact-deleted-webhook) is triggered for each source contact. `originatedFrom` is set to `merge`.
477
+ *
478
+ * This function is not a universal function and runs only on the backend.
479
+ * @param targetContactId - Target contact ID.
480
+ * @param targetContactRevision - Target contact revision number, which increments by 1 each time the contact is updated.
481
+ * To prevent conflicting changes,
482
+ * the target contact's current revision must be passed.
483
+ * @public
484
+ * @documentationMaturity preview
485
+ * @requiredField targetContactId
486
+ * @requiredField targetContactRevision
487
+ * @param options - Merge contacts options.
488
+ */
489
+ export function mergeContacts(targetContactId, targetContactRevision, options) {
490
+ var _a, _b, _c;
491
+ return __awaiter(this, arguments, void 0, function* () {
492
+ const requestTransformation = {
493
+ targetContactId: '$[0]',
494
+ targetContactRevision: '$[1]',
495
+ sourceContactIds: '$[2].sourceContactIds',
496
+ };
497
+ const responseTransformation = '$';
498
+ // @ts-ignore
499
+ const { httpClient, sideEffects } = arguments[3];
500
+ const { toAmbassadorRequest } = serializer({
501
+ rootSchema: _mergeContactsRequest,
502
+ depSchemas: {},
503
+ fqdnTransformation: {
504
+ paths: [],
505
+ transformation: _fromVeloEntity,
506
+ },
507
+ customTransformation: requestTransformation,
508
+ });
509
+ const { fromJSON } = serializer({
510
+ rootSchema: _mergeContactsResponse,
511
+ depSchemas: {
512
+ _contact,
513
+ _contactAddress,
514
+ _contactAddressesWrapper,
515
+ _contactInfo,
516
+ _contactPicture,
517
+ },
518
+ fqdnTransformation: {
519
+ paths: [...['contact']],
520
+ transformation: _toVeloEntity,
521
+ },
522
+ customTransformation: responseTransformation,
523
+ });
524
+ const payload = toAmbassadorRequest([
525
+ targetContactId,
526
+ targetContactRevision,
527
+ options,
528
+ ]);
529
+ const reqOpts = ambassadorWixContactsV4Contact.mergeContacts(payload);
530
+ __log(`"MergeContacts" sending request with: ${__inspect(reqOpts)}`);
531
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
532
+ try {
533
+ const result = yield httpClient.request(reqOpts);
534
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
535
+ return fromJSON(result.data);
536
+ }
537
+ catch (err) {
538
+ const transformedError = transformError(err, requestTransformation, [
539
+ 'targetContactId',
540
+ 'targetContactRevision',
541
+ 'options',
542
+ ]);
543
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
544
+ throw transformedError;
545
+ }
546
+ });
547
+ }
548
+ /**
549
+ * Deletes a contact who is not a site member or contributor.
550
+ *
551
+ * The `deleteContact()` function returns a Promise
552
+ * that resolves when the specified contact is deleted.
553
+ * > **Note:**
554
+ * > This function replaces the deprecated
555
+ * > `wixCrmBackend.deleteContact()`.
556
+ * > The deprecated function will continue to work, but it will not receive updates.
557
+ * > To keep any existing code compatible with future changes, see the
558
+ * > [migration instructions](wix-crm-backend/deletecontact#migration-instructions).
559
+ *
560
+ * Deleting a contact permanently removes them from your Contact List.
561
+ *
562
+ * If the contact is also a site member,
563
+ * the member must be deleted first,
564
+ * and then the contact can be deleted.
565
+ *
566
+ * <!--
567
+ * > **Note:**
568
+ * > Only visitors with
569
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
570
+ * > can delete contacts.
571
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
572
+ * -->
573
+ *
574
+ * This function is not a universal function and runs only on the backend.
575
+ * @param contactId - ID of the contact to delete.
576
+ * @public
577
+ * @documentationMaturity preview
578
+ * @requiredField contactId
579
+ */
580
+ export function deleteContact(contactId) {
581
+ var _a, _b, _c;
582
+ return __awaiter(this, arguments, void 0, function* () {
583
+ const requestTransformation = { contactId: '$[0]' };
584
+ const responseTransformation = '$';
585
+ // @ts-ignore
586
+ const { httpClient, sideEffects } = arguments[1];
587
+ const { toAmbassadorRequest } = serializer({
588
+ rootSchema: _deleteContactRequest,
589
+ depSchemas: {},
590
+ fqdnTransformation: {
591
+ paths: [],
592
+ transformation: _fromVeloEntity,
593
+ },
594
+ customTransformation: requestTransformation,
595
+ });
596
+ const { fromJSON } = serializer({
597
+ rootSchema: _deleteContactResponse,
598
+ depSchemas: {},
599
+ fqdnTransformation: {
600
+ paths: [],
601
+ transformation: _toVeloEntity,
602
+ },
603
+ customTransformation: responseTransformation,
604
+ });
605
+ const payload = toAmbassadorRequest([contactId]);
606
+ const reqOpts = ambassadorWixContactsV4Contact.deleteContact(payload);
607
+ __log(`"DeleteContact" sending request with: ${__inspect(reqOpts)}`);
608
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
609
+ try {
610
+ const result = yield httpClient.request(reqOpts);
611
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
612
+ return fromJSON(result.data);
613
+ }
614
+ catch (err) {
615
+ const transformedError = transformError(err, requestTransformation, [
616
+ 'contactId',
617
+ ]);
618
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
619
+ throw transformedError;
620
+ }
621
+ });
622
+ }
623
+ /**
624
+ * Adds labels to a contact.
625
+ *
626
+ *
627
+ * The `labelContact()` function returns a Promise
628
+ * that resolves when the specified labels are added to the contact.
629
+ * - **To create new labels:** Use [`findOrCreateLabel()`](wix-crm-backend/contacts/findorcreatelabel).
630
+ * - **To find labels:** Use [`findOrCreateLabel()`](wix-crm-backend/contacts/findorcreatelabel), [`getLabel()`](wix-crm-backend/contacts/getlabel), or [`queryLabels()`](wix-crm-backend/contacts/queryLabels).
631
+ *
632
+ * <!--
633
+ * > **Note:**
634
+ * > Only visitors with
635
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
636
+ * > can label contacts.
637
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
638
+ * -->
639
+ *
640
+ * This function is not a universal function and runs only on the backend.
641
+ * @param contactId - ID of the contact to add labels to.
642
+ * @param labelKeys - List of label keys to add to the contact.
643
+ *
644
+ * Label keys must exist to be added to the contact.
645
+ * Contact labels can be created or retrieved with
646
+ * [`findOrCreateLabel()`](wix-crm-backend/contacts/findorcreatelabel)
647
+ * or
648
+ * [`queryLabels()`](wix-crm-backend/contacts/queryLabels).
649
+ * @public
650
+ * @documentationMaturity preview
651
+ * @requiredField contactId
652
+ * @requiredField labelKeys
653
+ * @returns Updated contact.
654
+ */
655
+ export function labelContact(contactId, labelKeys) {
656
+ var _a, _b, _c;
657
+ return __awaiter(this, arguments, void 0, function* () {
658
+ const requestTransformation = { contactId: '$[0]', labelKeys: '$[1]' };
659
+ const responseTransformation = '$';
660
+ // @ts-ignore
661
+ const { httpClient, sideEffects } = arguments[2];
662
+ const { toAmbassadorRequest } = serializer({
663
+ rootSchema: _labelContactRequest,
664
+ depSchemas: {},
665
+ fqdnTransformation: {
666
+ paths: [],
667
+ transformation: _fromVeloEntity,
668
+ },
669
+ customTransformation: requestTransformation,
670
+ });
671
+ const { fromJSON } = serializer({
672
+ rootSchema: _labelContactResponse,
673
+ depSchemas: {
674
+ _contact,
675
+ _contactAddress,
676
+ _contactAddressesWrapper,
677
+ _contactInfo,
678
+ _contactPicture,
679
+ },
680
+ fqdnTransformation: {
681
+ paths: [...['contact']],
682
+ transformation: _toVeloEntity,
683
+ },
684
+ customTransformation: responseTransformation,
685
+ });
686
+ const payload = toAmbassadorRequest([contactId, labelKeys]);
687
+ const reqOpts = ambassadorWixContactsV4Contact.labelContact(payload);
688
+ __log(`"LabelContact" sending request with: ${__inspect(reqOpts)}`);
689
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
690
+ try {
691
+ const result = yield httpClient.request(reqOpts);
692
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
693
+ return fromJSON(result.data);
694
+ }
695
+ catch (err) {
696
+ const transformedError = transformError(err, requestTransformation, [
697
+ 'contactId',
698
+ 'labelKeys',
699
+ ]);
700
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
701
+ throw transformedError;
702
+ }
703
+ });
704
+ }
705
+ /**
706
+ * Removes labels from a contact.
707
+ *
708
+ * The `unlabelContact()` function returns a Promise
709
+ * that resolves when the specified labels are removed from the contact.
710
+ *
711
+ * If a label is no longer needed
712
+ * and you want to remove it from all contacts,
713
+ * you can delete it with
714
+ * [`deleteLabel()`](wix-crm-backend/contacts/deletelabel).
715
+ *
716
+ * <!--
717
+ * > **Note:**
718
+ * > Only visitors with
719
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
720
+ * > can unlabel contacts.
721
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
722
+ * -->
723
+ *
724
+ * This function is not a universal function and runs only on the backend.
725
+ * @param contactId - ID of the contact to remove labels from.
726
+ * @param labelKeys - List of label keys to remove from the contact.
727
+ * @public
728
+ * @documentationMaturity preview
729
+ * @requiredField contactId
730
+ * @requiredField labelKeys
731
+ * @returns Updated contact.
732
+ */
733
+ export function unlabelContact(contactId, labelKeys) {
734
+ var _a, _b, _c;
735
+ return __awaiter(this, arguments, void 0, function* () {
736
+ const requestTransformation = { contactId: '$[0]', labelKeys: '$[1]' };
737
+ const responseTransformation = '$';
738
+ // @ts-ignore
739
+ const { httpClient, sideEffects } = arguments[2];
740
+ const { toAmbassadorRequest } = serializer({
741
+ rootSchema: _unlabelContactRequest,
742
+ depSchemas: {},
743
+ fqdnTransformation: {
744
+ paths: [],
745
+ transformation: _fromVeloEntity,
746
+ },
747
+ customTransformation: requestTransformation,
748
+ });
749
+ const { fromJSON } = serializer({
750
+ rootSchema: _unlabelContactResponse,
751
+ depSchemas: {
752
+ _contact,
753
+ _contactAddress,
754
+ _contactAddressesWrapper,
755
+ _contactInfo,
756
+ _contactPicture,
757
+ },
758
+ fqdnTransformation: {
759
+ paths: [...['contact']],
760
+ transformation: _toVeloEntity,
761
+ },
762
+ customTransformation: responseTransformation,
763
+ });
764
+ const payload = toAmbassadorRequest([contactId, labelKeys]);
765
+ const reqOpts = ambassadorWixContactsV4Contact.unlabelContact(payload);
766
+ __log(`"UnlabelContact" sending request with: ${__inspect(reqOpts)}`);
767
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
768
+ try {
769
+ const result = yield httpClient.request(reqOpts);
770
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
771
+ return fromJSON(result.data);
772
+ }
773
+ catch (err) {
774
+ const transformedError = transformError(err, requestTransformation, [
775
+ 'contactId',
776
+ 'labelKeys',
777
+ ]);
778
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
779
+ throw transformedError;
780
+ }
781
+ });
782
+ }
783
+ /**
784
+ * Retrieves a contact.
785
+ *
786
+ *
787
+ * The `getContact()` function returns a Promise
788
+ * that resolves when the contact is found.
789
+ * #### Getting Merged Contacts
790
+ * When a source contact is merged
791
+ * with a target contact, the source contact is deleted.
792
+ * When calling `getContact()` for a merged contact,
793
+ * you can use the source or target contact ID.
794
+ * In both cases, the target contact is returned.
795
+ *
796
+ * This is supported only when calling `getContact()`,
797
+ * and only for merged contacts.
798
+ * Deleted source contact IDs are not supported on any other function.
799
+ * > **Notes:**
800
+ * >
801
+ * > - This function replaces the deprecated
802
+ * > `wixCrmBackend.getContactById()`.
803
+ * > The deprecated function will continue to work, but it will not receive updates.
804
+ * > To keep any existing code compatible with future changes, see the
805
+ * > [migration instructions](wix-crm-backend/getcontactbyid#migration-instructions).
806
+ * <!-- > - Only visitors with
807
+ * > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions)
808
+ * > can retrieve contacts.
809
+ * > You can override the permissions by setting the `suppressAuth` option to `true`.
810
+ * -->
811
+ *
812
+ * This function is not a universal function and runs only on the backend.
813
+ * @param _id - ID of the contact to retrieve.
814
+ * @public
815
+ * @documentationMaturity preview
816
+ * @requiredField _id
817
+ * @param options - Get contact options.
818
+ * @returns The requested contact.
819
+ */
820
+ export function getContact(_id, options) {
821
+ var _a, _b, _c;
822
+ return __awaiter(this, arguments, void 0, function* () {
823
+ const requestTransformation = {
824
+ id: '$[0]',
825
+ fields: '$[1].fields',
826
+ fieldsets: '$[1].fieldsets',
827
+ };
828
+ const responseTransformation = '$.contact';
829
+ // @ts-ignore
830
+ const { httpClient, sideEffects } = arguments[2];
831
+ const { toAmbassadorRequest } = serializer({
832
+ rootSchema: _getContactRequest,
833
+ depSchemas: {},
834
+ fqdnTransformation: {
835
+ paths: [],
836
+ transformation: _fromVeloEntity,
837
+ },
838
+ customTransformation: requestTransformation,
839
+ });
840
+ const { fromJSON } = serializer({
841
+ rootSchema: _getContactResponse,
842
+ depSchemas: {
843
+ _contact,
844
+ _contactAddress,
845
+ _contactAddressesWrapper,
846
+ _contactInfo,
847
+ _contactPicture,
848
+ },
849
+ fqdnTransformation: {
850
+ paths: [...['contact']],
851
+ transformation: _toVeloEntity,
852
+ },
853
+ customTransformation: responseTransformation,
854
+ });
855
+ const payload = toAmbassadorRequest([_id, options]);
856
+ const reqOpts = ambassadorWixContactsV4Contact.getContact(payload);
857
+ __log(`"GetContact" sending request with: ${__inspect(reqOpts)}`);
858
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
859
+ try {
860
+ const result = yield httpClient.request(reqOpts);
861
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
862
+ return fromJSON(result.data);
863
+ }
864
+ catch (err) {
865
+ const transformedError = transformError(err, requestTransformation, [
866
+ '_id',
867
+ 'options',
868
+ ]);
869
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
870
+ throw transformedError;
871
+ }
872
+ });
873
+ }
874
+ //# sourceMappingURL=contacts-v4-contact.universal.js.map