@wix/crm 1.0.80 → 1.0.81

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 (186) hide show
  1. package/build/cjs/context.d.ts +5 -0
  2. package/build/cjs/context.js +32 -0
  3. package/build/cjs/context.js.map +1 -0
  4. package/build/cjs/index.d.ts +1 -0
  5. package/build/cjs/index.js +7 -2
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/index.typings.d.ts +1 -0
  8. package/build/cjs/index.typings.js +7 -2
  9. package/build/cjs/index.typings.js.map +1 -1
  10. package/build/cjs/meta.d.ts +1 -0
  11. package/build/cjs/meta.js +7 -2
  12. package/build/cjs/meta.js.map +1 -1
  13. package/build/cjs/src/contacts-v4-contact.context.d.ts +9 -0
  14. package/build/cjs/src/contacts-v4-contact.context.js +82 -0
  15. package/build/cjs/src/contacts-v4-contact.context.js.map +1 -0
  16. package/build/cjs/src/contacts-v4-contact.http.d.ts +20 -94
  17. package/build/cjs/src/contacts-v4-contact.http.js +211 -249
  18. package/build/cjs/src/contacts-v4-contact.http.js.map +1 -1
  19. package/build/cjs/src/contacts-v4-contact.meta.d.ts +1 -1
  20. package/build/cjs/src/contacts-v4-contact.meta.js +5 -1
  21. package/build/cjs/src/contacts-v4-contact.meta.js.map +1 -1
  22. package/build/cjs/src/contacts-v4-contact.public.d.ts +6 -6
  23. package/build/cjs/src/contacts-v4-contact.public.js +5 -2
  24. package/build/cjs/src/contacts-v4-contact.public.js.map +1 -1
  25. package/build/cjs/src/contacts-v4-contact.types.d.ts +265 -5
  26. package/build/cjs/src/contacts-v4-contact.types.js +40 -19
  27. package/build/cjs/src/contacts-v4-contact.types.js.map +1 -1
  28. package/build/cjs/src/contacts-v4-contact.universal.d.ts +221 -155
  29. package/build/cjs/src/contacts-v4-contact.universal.js +140 -168
  30. package/build/cjs/src/contacts-v4-contact.universal.js.map +1 -1
  31. package/build/cjs/src/contacts-v4-extended-field.context.d.ts +7 -0
  32. package/build/cjs/src/contacts-v4-extended-field.context.js +60 -0
  33. package/build/cjs/src/contacts-v4-extended-field.context.js.map +1 -0
  34. package/build/cjs/src/contacts-v4-extended-field.http.d.ts +7 -14
  35. package/build/cjs/src/contacts-v4-extended-field.http.js +60 -70
  36. package/build/cjs/src/contacts-v4-extended-field.http.js.map +1 -1
  37. package/build/cjs/src/contacts-v4-extended-field.meta.d.ts +1 -1
  38. package/build/cjs/src/contacts-v4-extended-field.meta.js +5 -1
  39. package/build/cjs/src/contacts-v4-extended-field.meta.js.map +1 -1
  40. package/build/cjs/src/contacts-v4-extended-field.public.d.ts +1 -1
  41. package/build/cjs/src/contacts-v4-extended-field.types.d.ts +68 -1
  42. package/build/cjs/src/contacts-v4-extended-field.types.js +3 -3
  43. package/build/cjs/src/contacts-v4-extended-field.types.js.map +1 -1
  44. package/build/cjs/src/contacts-v4-extended-field.universal.d.ts +104 -30
  45. package/build/cjs/src/contacts-v4-extended-field.universal.js +58 -51
  46. package/build/cjs/src/contacts-v4-extended-field.universal.js.map +1 -1
  47. package/build/cjs/src/contacts-v4-label.context.d.ts +7 -0
  48. package/build/cjs/src/contacts-v4-label.context.js +60 -0
  49. package/build/cjs/src/contacts-v4-label.context.js.map +1 -0
  50. package/build/cjs/src/contacts-v4-label.http.d.ts +13 -14
  51. package/build/cjs/src/contacts-v4-label.http.js +66 -72
  52. package/build/cjs/src/contacts-v4-label.http.js.map +1 -1
  53. package/build/cjs/src/contacts-v4-label.meta.d.ts +1 -1
  54. package/build/cjs/src/contacts-v4-label.meta.js +5 -1
  55. package/build/cjs/src/contacts-v4-label.meta.js.map +1 -1
  56. package/build/cjs/src/contacts-v4-label.public.d.ts +5 -5
  57. package/build/cjs/src/contacts-v4-label.types.d.ts +76 -9
  58. package/build/cjs/src/contacts-v4-label.types.js +2 -2
  59. package/build/cjs/src/contacts-v4-label.types.js.map +1 -1
  60. package/build/cjs/src/contacts-v4-label.universal.d.ts +113 -40
  61. package/build/cjs/src/contacts-v4-label.universal.js +72 -62
  62. package/build/cjs/src/contacts-v4-label.universal.js.map +1 -1
  63. package/build/cjs/src/contacts-v4-submit-contact.context.d.ts +3 -0
  64. package/build/cjs/src/contacts-v4-submit-contact.context.js +16 -0
  65. package/build/cjs/src/contacts-v4-submit-contact.context.js.map +1 -0
  66. package/build/cjs/src/contacts-v4-submit-contact.http.js +20 -34
  67. package/build/cjs/src/contacts-v4-submit-contact.http.js.map +1 -1
  68. package/build/cjs/src/contacts-v4-submit-contact.meta.d.ts +1 -1
  69. package/build/cjs/src/contacts-v4-submit-contact.meta.js +5 -1
  70. package/build/cjs/src/contacts-v4-submit-contact.meta.js.map +1 -1
  71. package/build/cjs/src/contacts-v4-submit-contact.public.d.ts +2 -2
  72. package/build/cjs/src/contacts-v4-submit-contact.types.d.ts +8 -3
  73. package/build/cjs/src/contacts-v4-submit-contact.types.js +9 -9
  74. package/build/cjs/src/contacts-v4-submit-contact.types.js.map +1 -1
  75. package/build/cjs/src/contacts-v4-submit-contact.universal.d.ts +8 -9
  76. package/build/cjs/src/contacts-v4-submit-contact.universal.js +25 -28
  77. package/build/cjs/src/contacts-v4-submit-contact.universal.js.map +1 -1
  78. package/build/cjs/src/crm-tasks-v2-task.context.d.ts +9 -0
  79. package/build/cjs/src/crm-tasks-v2-task.context.js +82 -0
  80. package/build/cjs/src/crm-tasks-v2-task.context.js.map +1 -0
  81. package/build/cjs/src/crm-tasks-v2-task.http.d.ts +60 -0
  82. package/build/cjs/src/crm-tasks-v2-task.http.js +268 -0
  83. package/build/cjs/src/crm-tasks-v2-task.http.js.map +1 -0
  84. package/build/cjs/src/crm-tasks-v2-task.meta.d.ts +27 -0
  85. package/build/cjs/src/crm-tasks-v2-task.meta.js +161 -0
  86. package/build/cjs/src/crm-tasks-v2-task.meta.js.map +1 -0
  87. package/build/cjs/src/crm-tasks-v2-task.public.d.ts +29 -0
  88. package/build/cjs/src/crm-tasks-v2-task.public.js +53 -0
  89. package/build/cjs/src/crm-tasks-v2-task.public.js.map +1 -0
  90. package/build/cjs/src/crm-tasks-v2-task.types.d.ts +430 -0
  91. package/build/cjs/src/crm-tasks-v2-task.types.js +29 -0
  92. package/build/cjs/src/crm-tasks-v2-task.types.js.map +1 -0
  93. package/build/cjs/src/crm-tasks-v2-task.universal.d.ts +665 -0
  94. package/build/cjs/src/crm-tasks-v2-task.universal.js +515 -0
  95. package/build/cjs/src/crm-tasks-v2-task.universal.js.map +1 -0
  96. package/build/cjs/src/ping-notifications-v3-notification.public.d.ts +1 -1
  97. package/build/cjs/src/ping-notifications-v3-notification.types.js +1 -1
  98. package/build/cjs/src/ping-notifications-v3-notification.types.js.map +1 -1
  99. package/build/cjs/src/ping-notifications-v3-notification.universal.js +6 -2
  100. package/build/cjs/src/ping-notifications-v3-notification.universal.js.map +1 -1
  101. package/build/es/context.d.ts +5 -0
  102. package/build/es/context.js +6 -0
  103. package/build/es/context.js.map +1 -0
  104. package/build/es/index.d.ts +1 -0
  105. package/build/es/index.js +1 -0
  106. package/build/es/index.js.map +1 -1
  107. package/build/es/index.typings.d.ts +1 -0
  108. package/build/es/index.typings.js +1 -0
  109. package/build/es/index.typings.js.map +1 -1
  110. package/build/es/meta.d.ts +1 -0
  111. package/build/es/meta.js +1 -0
  112. package/build/es/meta.js.map +1 -1
  113. package/build/es/src/contacts-v4-contact.context.d.ts +9 -0
  114. package/build/es/src/contacts-v4-contact.context.js +72 -0
  115. package/build/es/src/contacts-v4-contact.context.js.map +1 -0
  116. package/build/es/src/contacts-v4-contact.http.d.ts +20 -94
  117. package/build/es/src/contacts-v4-contact.http.js +211 -249
  118. package/build/es/src/contacts-v4-contact.http.js.map +1 -1
  119. package/build/es/src/contacts-v4-contact.meta.d.ts +1 -1
  120. package/build/es/src/contacts-v4-contact.public.d.ts +6 -6
  121. package/build/es/src/contacts-v4-contact.public.js +2 -2
  122. package/build/es/src/contacts-v4-contact.public.js.map +1 -1
  123. package/build/es/src/contacts-v4-contact.types.d.ts +265 -5
  124. package/build/es/src/contacts-v4-contact.types.js +21 -0
  125. package/build/es/src/contacts-v4-contact.types.js.map +1 -1
  126. package/build/es/src/contacts-v4-contact.universal.d.ts +221 -155
  127. package/build/es/src/contacts-v4-contact.universal.js +117 -149
  128. package/build/es/src/contacts-v4-contact.universal.js.map +1 -1
  129. package/build/es/src/contacts-v4-extended-field.context.d.ts +7 -0
  130. package/build/es/src/contacts-v4-extended-field.context.js +52 -0
  131. package/build/es/src/contacts-v4-extended-field.context.js.map +1 -0
  132. package/build/es/src/contacts-v4-extended-field.http.d.ts +7 -14
  133. package/build/es/src/contacts-v4-extended-field.http.js +60 -70
  134. package/build/es/src/contacts-v4-extended-field.http.js.map +1 -1
  135. package/build/es/src/contacts-v4-extended-field.meta.d.ts +1 -1
  136. package/build/es/src/contacts-v4-extended-field.public.d.ts +1 -1
  137. package/build/es/src/contacts-v4-extended-field.types.d.ts +68 -1
  138. package/build/es/src/contacts-v4-extended-field.universal.d.ts +104 -30
  139. package/build/es/src/contacts-v4-extended-field.universal.js +49 -46
  140. package/build/es/src/contacts-v4-extended-field.universal.js.map +1 -1
  141. package/build/es/src/contacts-v4-label.context.d.ts +7 -0
  142. package/build/es/src/contacts-v4-label.context.js +52 -0
  143. package/build/es/src/contacts-v4-label.context.js.map +1 -0
  144. package/build/es/src/contacts-v4-label.http.d.ts +13 -14
  145. package/build/es/src/contacts-v4-label.http.js +66 -72
  146. package/build/es/src/contacts-v4-label.http.js.map +1 -1
  147. package/build/es/src/contacts-v4-label.meta.d.ts +1 -1
  148. package/build/es/src/contacts-v4-label.public.d.ts +5 -5
  149. package/build/es/src/contacts-v4-label.types.d.ts +76 -9
  150. package/build/es/src/contacts-v4-label.universal.d.ts +113 -40
  151. package/build/es/src/contacts-v4-label.universal.js +64 -58
  152. package/build/es/src/contacts-v4-label.universal.js.map +1 -1
  153. package/build/es/src/contacts-v4-submit-contact.context.d.ts +3 -0
  154. package/build/es/src/contacts-v4-submit-contact.context.js +12 -0
  155. package/build/es/src/contacts-v4-submit-contact.context.js.map +1 -0
  156. package/build/es/src/contacts-v4-submit-contact.http.js +20 -34
  157. package/build/es/src/contacts-v4-submit-contact.http.js.map +1 -1
  158. package/build/es/src/contacts-v4-submit-contact.meta.d.ts +1 -1
  159. package/build/es/src/contacts-v4-submit-contact.public.d.ts +2 -2
  160. package/build/es/src/contacts-v4-submit-contact.types.d.ts +8 -3
  161. package/build/es/src/contacts-v4-submit-contact.types.js.map +1 -1
  162. package/build/es/src/contacts-v4-submit-contact.universal.d.ts +8 -9
  163. package/build/es/src/contacts-v4-submit-contact.universal.js +11 -18
  164. package/build/es/src/contacts-v4-submit-contact.universal.js.map +1 -1
  165. package/build/es/src/crm-tasks-v2-task.context.d.ts +9 -0
  166. package/build/es/src/crm-tasks-v2-task.context.js +72 -0
  167. package/build/es/src/crm-tasks-v2-task.context.js.map +1 -0
  168. package/build/es/src/crm-tasks-v2-task.http.d.ts +60 -0
  169. package/build/es/src/crm-tasks-v2-task.http.js +258 -0
  170. package/build/es/src/crm-tasks-v2-task.http.js.map +1 -0
  171. package/build/es/src/crm-tasks-v2-task.meta.d.ts +27 -0
  172. package/build/es/src/crm-tasks-v2-task.meta.js +128 -0
  173. package/build/es/src/crm-tasks-v2-task.meta.js.map +1 -0
  174. package/build/es/src/crm-tasks-v2-task.public.d.ts +29 -0
  175. package/build/es/src/crm-tasks-v2-task.public.js +39 -0
  176. package/build/es/src/crm-tasks-v2-task.public.js.map +1 -0
  177. package/build/es/src/crm-tasks-v2-task.types.d.ts +430 -0
  178. package/build/es/src/crm-tasks-v2-task.types.js +26 -0
  179. package/build/es/src/crm-tasks-v2-task.types.js.map +1 -0
  180. package/build/es/src/crm-tasks-v2-task.universal.d.ts +665 -0
  181. package/build/es/src/crm-tasks-v2-task.universal.js +482 -0
  182. package/build/es/src/crm-tasks-v2-task.universal.js.map +1 -0
  183. package/build/es/src/ping-notifications-v3-notification.public.d.ts +1 -1
  184. package/build/es/src/ping-notifications-v3-notification.universal.js.map +1 -1
  185. package/context/package.json +6 -0
  186. package/package.json +12 -6
@@ -1,44 +1,11 @@
1
1
  import { toURLSearchParams } from '@wix/metro-runtime';
2
- import { serializer } from '@wix/metro-runtime/ambassador';
2
+ import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';
3
+ import { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';
4
+ import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
5
+ import { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
6
+ import { transformSDKFieldMaskToRESTFieldMask } from '@wix/sdk-runtime/transformations/field-mask';
7
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
3
8
  import { resolveUrl } from '@wix/metro-runtime';
4
- const _address = { geocode: '_addressLocation' };
5
- const _addressLocation = {
6
- latitude: 'google.protobuf.DoubleValue',
7
- longitude: 'google.protobuf.DoubleValue',
8
- };
9
- const _contact = {
10
- createdDate: 'google.protobuf.Timestamp',
11
- updatedDate: 'google.protobuf.Timestamp',
12
- lastActivity: '_contactActivity',
13
- picture: '_image',
14
- info: '_contactInfo',
15
- };
16
- const _contactActivity = { activityDate: 'google.protobuf.Timestamp' };
17
- const _contactAddress = { address: '_address' };
18
- const _contactAddressesWrapper = { items: '_contactAddress' };
19
- const _contactInfo = {
20
- addresses: '_contactAddressesWrapper',
21
- picture: '_contactPicture',
22
- };
23
- const _contactPicture = { image: '_image' };
24
- const _createContactRequest = { info: '_contactInfo' };
25
- const _createContactResponse = { contact: '_contact' };
26
- const _deleteContactRequest = {};
27
- const _deleteContactResponse = {};
28
- const _getContactRequest = {};
29
- const _getContactResponse = { contact: '_contact' };
30
- const _image = { urlExpirationDate: 'google.protobuf.Timestamp' };
31
- const _labelContactRequest = {};
32
- const _labelContactResponse = { contact: '_contact' };
33
- const _mergeContactsRequest = {};
34
- const _mergeContactsResponse = { contact: '_contact' };
35
- const _unlabelContactRequest = {};
36
- const _unlabelContactResponse = { contact: '_contact' };
37
- const _updateContactRequest = {
38
- fieldMask: 'google.protobuf.FieldMask',
39
- info: '_contactInfo',
40
- };
41
- const _updateContactResponse = { contact: '_contact' };
42
9
  function resolveComWixpressContactsCoreApiV4ContactsServiceV4Url(opts) {
43
10
  const domainToMappings = {
44
11
  'api._api_base_domain_': [
@@ -107,42 +74,24 @@ function resolveComWixpressContactsCoreApiV4ContactsServiceV4Url(opts) {
107
74
  * If all 3 of these parameters are missing,
108
75
  * the contact won't be created.
109
76
  *
110
- * <!--
111
- * > **Note:**
112
- * > Only visitors with
113
- * > **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)
114
- * > can create contacts.
115
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
116
- * -->
117
- * By default,
118
- * if the call contains an email already in use by another contact,
119
- * the new contact won't be created.
120
- * To override this behavior,
121
- * set `allowDuplicates` in the `options` object to `true`.
77
+ * By default, if the call contains an email already in use by another contact, the new contact won't be created. To override this behavior, set `allowDuplicates` in the `options` object to `true`.
78
+ *
122
79
  */
123
80
  export function createContact(payload) {
124
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_createContactRequest, {
125
- _address,
126
- _addressLocation,
127
- _contactAddress,
128
- _contactAddressesWrapper,
129
- _contactInfo,
130
- _contactPicture,
131
- _image,
132
- });
133
- const { fromJSON: fromRes } = serializer(_createContactResponse, {
134
- _address,
135
- _addressLocation,
136
- _contact,
137
- _contactActivity,
138
- _contactAddress,
139
- _contactAddressesWrapper,
140
- _contactInfo,
141
- _contactPicture,
142
- _image,
143
- });
144
81
  function __createContact({ host }) {
145
- const serializedData = toReq(payload);
82
+ const serializedData = transformPaths(payload, [
83
+ {
84
+ transformFn: transformSDKFloatToRESTFloat,
85
+ paths: [
86
+ { path: 'info.addresses.items.address.geocode.latitude' },
87
+ { path: 'info.addresses.items.address.geocode.longitude' },
88
+ ],
89
+ },
90
+ {
91
+ transformFn: transformSDKTimestampToRESTTimestamp,
92
+ paths: [{ path: 'info.picture.image.urlExpirationDate' }],
93
+ },
94
+ ]);
146
95
  const metadata = {
147
96
  entityFqdn: 'wix.contacts.v4.contact',
148
97
  method: 'POST',
@@ -153,11 +102,34 @@ export function createContact(payload) {
153
102
  host,
154
103
  }),
155
104
  data: serializedData,
156
- transformResponse: fromRes,
105
+ transformResponse: (payload) => transformPaths(payload, [
106
+ {
107
+ transformFn: transformRESTTimestampToSDKTimestamp,
108
+ paths: [
109
+ { path: 'contact.createdDate' },
110
+ { path: 'contact.updatedDate' },
111
+ { path: 'contact.lastActivity.activityDate' },
112
+ { path: 'contact.lastActivity.date' },
113
+ { path: 'contact.picture.urlExpirationDate' },
114
+ { path: 'contact.info.picture.image.urlExpirationDate' },
115
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
116
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
117
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
118
+ ],
119
+ },
120
+ {
121
+ transformFn: transformRESTFloatToSDKFloat,
122
+ paths: [
123
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
124
+ {
125
+ path: 'contact.info.addresses.items.address.geocode.longitude',
126
+ },
127
+ ],
128
+ },
129
+ ]),
157
130
  };
158
131
  return metadata;
159
132
  }
160
- __createContact.fromReq = fromReq;
161
133
  return __createContact;
162
134
  }
163
135
  /**
@@ -166,43 +138,28 @@ export function createContact(payload) {
166
138
  * The `updateContact()` function returns a Promise that resolves
167
139
  * when the specified contact's information is updated.
168
140
  *
169
- * Each time the contact is updated,
170
- * `revision` increments by 1.
171
- * The existing `revision` must be included when updating the contact.
172
- * This ensures you're working with the latest contact information,
173
- * and it prevents unintended overwrites.
141
+ * Each time the contact is updated, `revision` increments by 1. The existing `revision` must be included when updating the contact. This ensures you're working with the latest contact information, and prevents unintended overwrites.
174
142
  *
175
- * <!--
176
- * > **Note:**
177
- * > Only visitors with
178
- * > **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)
179
- * > can update contacts.
180
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
181
- * -->
182
143
  */
183
144
  export function updateContact(payload) {
184
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_updateContactRequest, {
185
- _address,
186
- _addressLocation,
187
- _contactAddress,
188
- _contactAddressesWrapper,
189
- _contactInfo,
190
- _contactPicture,
191
- _image,
192
- });
193
- const { fromJSON: fromRes } = serializer(_updateContactResponse, {
194
- _address,
195
- _addressLocation,
196
- _contact,
197
- _contactActivity,
198
- _contactAddress,
199
- _contactAddressesWrapper,
200
- _contactInfo,
201
- _contactPicture,
202
- _image,
203
- });
204
145
  function __updateContact({ host }) {
205
- const serializedData = toReq(payload);
146
+ const serializedData = transformPaths(payload, [
147
+ {
148
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
149
+ paths: [{ path: 'fieldMask' }],
150
+ },
151
+ {
152
+ transformFn: transformSDKFloatToRESTFloat,
153
+ paths: [
154
+ { path: 'info.addresses.items.address.geocode.latitude' },
155
+ { path: 'info.addresses.items.address.geocode.longitude' },
156
+ ],
157
+ },
158
+ {
159
+ transformFn: transformSDKTimestampToRESTTimestamp,
160
+ paths: [{ path: 'info.picture.image.urlExpirationDate' }],
161
+ },
162
+ ]);
206
163
  const metadata = {
207
164
  entityFqdn: 'wix.contacts.v4.contact',
208
165
  method: 'PATCH',
@@ -213,11 +170,34 @@ export function updateContact(payload) {
213
170
  host,
214
171
  }),
215
172
  data: serializedData,
216
- transformResponse: fromRes,
173
+ transformResponse: (payload) => transformPaths(payload, [
174
+ {
175
+ transformFn: transformRESTTimestampToSDKTimestamp,
176
+ paths: [
177
+ { path: 'contact.createdDate' },
178
+ { path: 'contact.updatedDate' },
179
+ { path: 'contact.lastActivity.activityDate' },
180
+ { path: 'contact.lastActivity.date' },
181
+ { path: 'contact.picture.urlExpirationDate' },
182
+ { path: 'contact.info.picture.image.urlExpirationDate' },
183
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
184
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
185
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
186
+ ],
187
+ },
188
+ {
189
+ transformFn: transformRESTFloatToSDKFloat,
190
+ paths: [
191
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
192
+ {
193
+ path: 'contact.info.addresses.items.address.geocode.longitude',
194
+ },
195
+ ],
196
+ },
197
+ ]),
217
198
  };
218
199
  return metadata;
219
200
  }
220
- __updateContact.fromReq = fromReq;
221
201
  return __updateContact;
222
202
  }
223
203
  /**
@@ -226,67 +206,57 @@ export function updateContact(payload) {
226
206
  * Merging contacts has these effects on the target contact:
227
207
  *
228
208
  * - No target contact data is overwritten or deleted.
229
- * - Arrays (emails, phones, addresses, and labels) are merged from the source contacts.
209
+ * - Arrays (emails, phones, addresses, and labels) are merged from the source contacts into the target contact.
230
210
  * - If merging more than one source contact, the 1st source is given precedence, then the 2nd, and so on.
231
211
  *
232
- * <blockquote class="important">
233
- *
234
- * __Important:__
235
- * Merges cannot be undone.
236
- * Use [Preview Merge Contacts](#preview-merge-contacts)
237
- * to test before merging.
238
- *
239
- * </blockquote>
240
- *
241
212
  * Source contacts are deleted when merging.
242
- * However, if a source contact is a site member or contributor,
243
- * the merge fails because site contributors and members can't be deleted.
244
- * Site members and contributors can be target contacts only.
245
- *
246
- * After merging,
247
- * if you call [Get Contact](#get-contact) with a deleted source contact ID,
248
- * the target contact ID is returned.
249
- * This is supported when calling Get Contact only.
250
- * Deleted source contact IDs are not supported on any other endpoint.
213
+ * However, if a source contact is a site member or collaborator,
214
+ * the `mergeContacts()` function fails because site collaborators and members can't be deleted.
215
+ * Site members and collaborators can only be target contacts.
251
216
  *
252
- * Merging contacts triggers these webhooks:
217
+ * After merging, if you call the `getContact()` function with a deleted source contact ID, the target contact ID is returned. This is only supported when calling `getContact()`. Previously deleted source contact IDs can't be passed in any other function.
253
218
  *
254
- * - Contact Merged is triggered.
255
- * - Contact Updated is triggered for the target contact. `originatedFrom` is set to `merge`.
256
- * - Contact Deleted is triggered for each source contact. `originatedFrom` is set to `merge`.
257
- *
258
- * This function is not a universal function and runs only on the backend.
259
219
  */
260
220
  export function mergeContacts(payload) {
261
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_mergeContactsRequest, {});
262
- const { fromJSON: fromRes } = serializer(_mergeContactsResponse, {
263
- _address,
264
- _addressLocation,
265
- _contact,
266
- _contactActivity,
267
- _contactAddress,
268
- _contactAddressesWrapper,
269
- _contactInfo,
270
- _contactPicture,
271
- _image,
272
- });
273
221
  function __mergeContacts({ host }) {
274
- const serializedData = toReq(payload);
275
222
  const metadata = {
276
223
  entityFqdn: 'wix.contacts.v4.contact',
277
224
  method: 'POST',
278
225
  methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.MergeContacts',
279
226
  url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({
280
227
  protoPath: '/v4/contacts/{targetContactId}/merge',
281
- data: serializedData,
228
+ data: payload,
282
229
  host,
283
230
  }),
284
- data: serializedData,
285
- transformResponse: fromRes,
231
+ data: payload,
232
+ transformResponse: (payload) => transformPaths(payload, [
233
+ {
234
+ transformFn: transformRESTTimestampToSDKTimestamp,
235
+ paths: [
236
+ { path: 'contact.createdDate' },
237
+ { path: 'contact.updatedDate' },
238
+ { path: 'contact.lastActivity.activityDate' },
239
+ { path: 'contact.lastActivity.date' },
240
+ { path: 'contact.picture.urlExpirationDate' },
241
+ { path: 'contact.info.picture.image.urlExpirationDate' },
242
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
243
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
244
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
245
+ ],
246
+ },
247
+ {
248
+ transformFn: transformRESTFloatToSDKFloat,
249
+ paths: [
250
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
251
+ {
252
+ path: 'contact.info.addresses.items.address.geocode.longitude',
253
+ },
254
+ ],
255
+ },
256
+ ]),
286
257
  };
287
258
  return metadata;
288
259
  }
289
- __mergeContacts.fromReq = fromReq;
290
260
  return __mergeContacts;
291
261
  }
292
262
  /**
@@ -301,34 +271,22 @@ export function mergeContacts(payload) {
301
271
  * the member must be deleted first,
302
272
  * and then the contact can be deleted.
303
273
  *
304
- * <!--
305
- * > **Note:**
306
- * > Only visitors with
307
- * > **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)
308
- * > can delete contacts.
309
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
310
- * -->
311
274
  */
312
275
  export function deleteContact(payload) {
313
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_deleteContactRequest, {});
314
- const { fromJSON: fromRes } = serializer(_deleteContactResponse, {});
315
276
  function __deleteContact({ host }) {
316
- const serializedData = toReq(payload);
317
277
  const metadata = {
318
278
  entityFqdn: 'wix.contacts.v4.contact',
319
279
  method: 'DELETE',
320
280
  methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.DeleteContact',
321
281
  url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({
322
282
  protoPath: '/v4/contacts/{contactId}',
323
- data: serializedData,
283
+ data: payload,
324
284
  host,
325
285
  }),
326
- params: toURLSearchParams(serializedData),
327
- transformResponse: fromRes,
286
+ params: toURLSearchParams(payload),
328
287
  };
329
288
  return metadata;
330
289
  }
331
- __deleteContact.fromReq = fromReq;
332
290
  return __deleteContact;
333
291
  }
334
292
  /**
@@ -337,47 +295,50 @@ export function deleteContact(payload) {
337
295
  *
338
296
  * The `labelContact()` function returns a Promise
339
297
  * that resolves when the specified labels are added to the contact.
340
- * - **To create new labels:** Use [`findOrCreateLabel()`](#contacts/findorcreatelabel).
341
- * - **To find labels:** Use [`findOrCreateLabel()`](#contacts/findorcreatelabel), [`getLabel()`](#contacts/getlabel), or [`queryLabels()`](#contacts/queryLabels).
298
+ * - **To create new labels:** Use `findOrCreateLabel()`.
299
+ * - **To find labels:** Use `findOrCreateLabel()`, `getLabel()`, or `queryLabels()`.
342
300
  *
343
- * <!--
344
- * > **Note:**
345
- * > Only visitors with
346
- * > **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)
347
- * > can label contacts.
348
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
349
- * -->
350
301
  */
351
302
  export function labelContact(payload) {
352
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_labelContactRequest, {});
353
- const { fromJSON: fromRes } = serializer(_labelContactResponse, {
354
- _address,
355
- _addressLocation,
356
- _contact,
357
- _contactActivity,
358
- _contactAddress,
359
- _contactAddressesWrapper,
360
- _contactInfo,
361
- _contactPicture,
362
- _image,
363
- });
364
303
  function __labelContact({ host }) {
365
- const serializedData = toReq(payload);
366
304
  const metadata = {
367
305
  entityFqdn: 'wix.contacts.v4.contact',
368
306
  method: 'POST',
369
307
  methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.LabelContact',
370
308
  url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({
371
309
  protoPath: '/v4/contacts/{contactId}/labels',
372
- data: serializedData,
310
+ data: payload,
373
311
  host,
374
312
  }),
375
- data: serializedData,
376
- transformResponse: fromRes,
313
+ data: payload,
314
+ transformResponse: (payload) => transformPaths(payload, [
315
+ {
316
+ transformFn: transformRESTTimestampToSDKTimestamp,
317
+ paths: [
318
+ { path: 'contact.createdDate' },
319
+ { path: 'contact.updatedDate' },
320
+ { path: 'contact.lastActivity.activityDate' },
321
+ { path: 'contact.lastActivity.date' },
322
+ { path: 'contact.picture.urlExpirationDate' },
323
+ { path: 'contact.info.picture.image.urlExpirationDate' },
324
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
325
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
326
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
327
+ ],
328
+ },
329
+ {
330
+ transformFn: transformRESTFloatToSDKFloat,
331
+ paths: [
332
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
333
+ {
334
+ path: 'contact.info.addresses.items.address.geocode.longitude',
335
+ },
336
+ ],
337
+ },
338
+ ]),
377
339
  };
378
340
  return metadata;
379
341
  }
380
- __labelContact.fromReq = fromReq;
381
342
  return __labelContact;
382
343
  }
383
344
  /**
@@ -386,49 +347,49 @@ export function labelContact(payload) {
386
347
  * The `unlabelContact()` function returns a Promise
387
348
  * that resolves when the specified labels are removed from the contact.
388
349
  *
389
- * If a label is no longer needed
390
- * and you want to remove it from all contacts,
391
- * you can delete it with Labels
392
- * `deleteLabel()`.
350
+ * If a label is no longer needed and you want to remove it from all contacts, you can remove it with the Labels `deleteLabel()` function.
393
351
  *
394
- * <!--
395
- * > **Note:**
396
- * > Only visitors with
397
- * > **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)
398
- * > can unlabel contacts.
399
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
400
- * -->
401
352
  */
402
353
  export function unlabelContact(payload) {
403
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_unlabelContactRequest, {});
404
- const { fromJSON: fromRes } = serializer(_unlabelContactResponse, {
405
- _address,
406
- _addressLocation,
407
- _contact,
408
- _contactActivity,
409
- _contactAddress,
410
- _contactAddressesWrapper,
411
- _contactInfo,
412
- _contactPicture,
413
- _image,
414
- });
415
354
  function __unlabelContact({ host }) {
416
- const serializedData = toReq(payload);
417
355
  const metadata = {
418
356
  entityFqdn: 'wix.contacts.v4.contact',
419
357
  method: 'DELETE',
420
358
  methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.UnlabelContact',
421
359
  url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({
422
360
  protoPath: '/v4/contacts/{contactId}/labels',
423
- data: serializedData,
361
+ data: payload,
424
362
  host,
425
363
  }),
426
- params: toURLSearchParams(serializedData),
427
- transformResponse: fromRes,
364
+ params: toURLSearchParams(payload),
365
+ transformResponse: (payload) => transformPaths(payload, [
366
+ {
367
+ transformFn: transformRESTTimestampToSDKTimestamp,
368
+ paths: [
369
+ { path: 'contact.createdDate' },
370
+ { path: 'contact.updatedDate' },
371
+ { path: 'contact.lastActivity.activityDate' },
372
+ { path: 'contact.lastActivity.date' },
373
+ { path: 'contact.picture.urlExpirationDate' },
374
+ { path: 'contact.info.picture.image.urlExpirationDate' },
375
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
376
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
377
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
378
+ ],
379
+ },
380
+ {
381
+ transformFn: transformRESTFloatToSDKFloat,
382
+ paths: [
383
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
384
+ {
385
+ path: 'contact.info.addresses.items.address.geocode.longitude',
386
+ },
387
+ ],
388
+ },
389
+ ]),
428
390
  };
429
391
  return metadata;
430
392
  }
431
- __unlabelContact.fromReq = fromReq;
432
393
  return __unlabelContact;
433
394
  }
434
395
  /**
@@ -437,53 +398,54 @@ export function unlabelContact(payload) {
437
398
  *
438
399
  * The `getContact()` function returns a Promise
439
400
  * that resolves when the contact is found.
401
+ *
440
402
  * #### Getting Merged Contacts
441
- * When a source contact is merged
442
- * with a target contact, the source contact is deleted.
443
- * When calling `getContact()` for a merged contact,
444
- * you can use the source or target contact ID.
445
- * In both cases, the target contact is returned.
403
+ * When a source contact is merged into a target contact, the source contact is deleted. When calling `getContact()` for a merged contact,
404
+ * you can use the source or target contact ID. In both cases, the target contact is returned.
446
405
  *
447
- * This is supported only when calling `getContact()`,
448
- * and only for merged contacts.
449
- * Deleted source contact IDs are not supported on any other function.
406
+ * This is supported only when calling `getContact()`on merged contacts. Previously deleted source contact IDs can't be passed to any other function.
450
407
  *
451
- * <!-- > - Only visitors with
452
- * > **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)
453
- * > can retrieve contacts.
454
- * > You can override the permissions by setting the `suppressAuth` option to `true`.
455
- * -->
456
408
  */
457
409
  export function getContact(payload) {
458
- const { toJSON: toReq, fromJSON: fromReq } = serializer(_getContactRequest, {});
459
- const { fromJSON: fromRes } = serializer(_getContactResponse, {
460
- _address,
461
- _addressLocation,
462
- _contact,
463
- _contactActivity,
464
- _contactAddress,
465
- _contactAddressesWrapper,
466
- _contactInfo,
467
- _contactPicture,
468
- _image,
469
- });
470
410
  function __getContact({ host }) {
471
- const serializedData = toReq(payload);
472
411
  const metadata = {
473
412
  entityFqdn: 'wix.contacts.v4.contact',
474
413
  method: 'GET',
475
414
  methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.GetContact',
476
415
  url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({
477
416
  protoPath: '/v4/contacts/{id}',
478
- data: serializedData,
417
+ data: payload,
479
418
  host,
480
419
  }),
481
- params: toURLSearchParams(serializedData),
482
- transformResponse: fromRes,
420
+ params: toURLSearchParams(payload),
421
+ transformResponse: (payload) => transformPaths(payload, [
422
+ {
423
+ transformFn: transformRESTTimestampToSDKTimestamp,
424
+ paths: [
425
+ { path: 'contact.createdDate' },
426
+ { path: 'contact.updatedDate' },
427
+ { path: 'contact.lastActivity.activityDate' },
428
+ { path: 'contact.lastActivity.date' },
429
+ { path: 'contact.picture.urlExpirationDate' },
430
+ { path: 'contact.info.picture.image.urlExpirationDate' },
431
+ { path: 'contact.memberInfo.identityInfo.signupDate' },
432
+ { path: 'contact.memberInfo.sessionInfo.lastWebLogin' },
433
+ { path: 'contact.memberInfo.sessionInfo.lastMobileLogin' },
434
+ ],
435
+ },
436
+ {
437
+ transformFn: transformRESTFloatToSDKFloat,
438
+ paths: [
439
+ { path: 'contact.info.addresses.items.address.geocode.latitude' },
440
+ {
441
+ path: 'contact.info.addresses.items.address.geocode.longitude',
442
+ },
443
+ ],
444
+ },
445
+ ]),
483
446
  };
484
447
  return metadata;
485
448
  }
486
- __getContact.fromReq = fromReq;
487
449
  return __getContact;
488
450
  }
489
451
  //# sourceMappingURL=contacts-v4-contact.http.js.map