@wix/auto_sdk_crm_contacts 1.0.961 → 1.0.963

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,5 +1,5 @@
1
1
  import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { ContactInfo, CreateContactOptions, CreateContactResponse, CreateContactApplicationErrors, UpdateContactOptions, UpdateContactResponse, UpdateContactApplicationErrors, MergeContactsOptions, MergeContactsResponse, MergeContactsApplicationErrors, PreviewMergeContactsOptions, PreviewMergeContactsResponse, PreviewMergeContactsApplicationErrors, DeleteContactApplicationErrors, LabelContactResponse, LabelContactApplicationErrors, UnlabelContactResponse, UnlabelContactApplicationErrors, ListContactsOptions, ListContactsResponse, ListContactsApplicationErrors, Query, QueryContactsOptions, ContactsQueryBuilder, ListFacetsOptions, ListFacetsResponse, QueryFacetsOptions, QueryFacetsResponse, BulkDeleteContactsOptions, BulkDeleteContactsResponse, BulkDeleteContactsApplicationErrors, BulkUpdateContactsOptions, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsOptions, BulkLabelAndUnlabelContactsResponse, BulkLabelAndUnlabelContactsApplicationErrors, GetContactOptions, Contact, GetContactApplicationErrors, ContactCreatedEnvelope, ContactDeletedEnvelope, ContactMergedEnvelope, ContactUpdatedEnvelope } from './index.typings.mjs';
2
+ import { ContactInfo, CreateContactOptions, CreateContactResponse, CreateContactApplicationErrors, UpdateContactOptions, UpdateContactResponse, UpdateContactApplicationErrors, MergeContactsOptions, MergeContactsResponse, MergeContactsApplicationErrors, PreviewMergeContactsOptions, PreviewMergeContactsResponse, PreviewMergeContactsApplicationErrors, DeleteContactApplicationErrors, LabelContactResponse, LabelContactApplicationErrors, UnlabelContactResponse, UnlabelContactApplicationErrors, ListContactsOptions, ListContactsResponse, ListContactsApplicationErrors, ListFacetsOptions, ListFacetsResponse, QueryFacetsOptions, QueryFacetsResponse, BulkDeleteContactsOptions, BulkDeleteContactsResponse, BulkDeleteContactsApplicationErrors, BulkUpdateContactsOptions, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsOptions, BulkLabelAndUnlabelContactsResponse, BulkLabelAndUnlabelContactsApplicationErrors, GetContactOptions, Contact, GetContactApplicationErrors, ContactCreatedEnvelope, ContactDeletedEnvelope, ContactMergedEnvelope, ContactUpdatedEnvelope, Query, typedQueryContacts, QueryContactsOptions, ContactsQueryBuilder } from './index.typings.mjs';
3
3
  export { Action, ActionEvent, ActionWithLiterals, ActivityIcon, Address, AddressLocation, AddressStreetOneOf, AddressTag, AddressTagWithLiterals, ApplicationError, AssigneesWrapper, BaseEventMetadata, BulkActionMetadata, BulkAddSegmentToContactsRequest, BulkAddSegmentToContactsResponse, BulkDeleteContactsRequest, BulkLabelAndUnlabelContactsRequest, BulkRemoveSegmentFromContactsRequest, BulkRemoveSegmentFromContactsResponse, BulkUpdateContactsRequest, BulkUpsertContactsRequest, BulkUpsertContactsResponse, BulkUpsertContactsResponseMetadata, ContactActivity, ContactActivityType, ContactActivityTypeWithLiterals, ContactAddedToSegment, ContactAddress, ContactAddressesWrapper, ContactChanged, ContactEmail, ContactEmailSubscriptionUpdated, ContactEmailsWrapper, ContactFieldSet, ContactFieldSetWithLiterals, ContactMerged, ContactName, ContactPhone, ContactPhoneSubscriptionUpdated, ContactPhonesWrapper, ContactPicture, ContactPrimaryInfoUpdated, ContactRemovedFromSegment, ContactSource, ContactSourceType, ContactSourceTypeWithLiterals, ContactSubmitted, ContactsFacet, ContactsFacetType, ContactsFacetTypeWithLiterals, ContactsQueryResult, CountContactsRequest, CountContactsResponse, CreateContactRequest, CursorPaging, CursorPagingMetadata, Cursors, DeleteContactRequest, DeleteContactResponse, DomainEvent, DomainEventBodyOneOf, DuplicateContactExists, EmailDeliverabilityStatus, EmailDeliverabilityStatusWithLiterals, EmailTag, EmailTagWithLiterals, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, Error, EventMetadata, ExtendedFieldsWrapper, GeneratePictureUploadUrlRequest, GeneratePictureUploadUrlResponse, GetContactRequest, GetContactResponse, GetContactResponseType, GetContactResponseTypeWithLiterals, GroupInfo, IdentificationData, IdentificationDataIdOneOf, ImageProvider, ImageProviderWithLiterals, Item, ItemMetadata, LabelAndUnlabelContactRequest, LabelAndUnlabelContactResponse, LabelContactRequest, LabelsWrapper, LastActivityUpdate, ListContactIdsBySegmentRequest, ListContactIdsBySegmentResponse, ListContactsRequest, ListFacetsRequest, LocationsWrapper, MemberInfo, MemberStatus, MemberStatusWithLiterals, MergeContactsRequest, MessageEnvelope, Metadata, Mode, ModeWithLiterals, Paging, PagingMetadata, PhoneDeliverabilityStatus, PhoneDeliverabilityStatusWithLiterals, PhoneTag, PhoneTagWithLiterals, PreviewMergeContactsRequest, PrimaryContactInfo, PrimaryEmail, PrimaryPhone, PrimarySubscriptionStatus, PrivacyStatus, PrivacyStatusWithLiterals, ProfileInfo, QueryContactsApplicationErrors, QueryContactsRequest, QueryContactsResponse, QueryFacetsRequest, RestoreInfo, Role, RoleWithLiterals, Search, SearchContactsRequest, SearchContactsResponse, SearchDetails, SearchPagingMethodOneOf, SegmentsWrapper, SessionInfo, SortOrder, SortOrderWithLiterals, Sorting, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals, SubmitOperation, SubmitOperationWithLiterals, SubscriptionStatus, SubscriptionStatusWithLiterals, SyncSubmitContactRequest, SyncSubmitContactResponse, UnlabelContactRequest, UpdateContactRequest, UpsertContactRequest, UpsertContactResponse, UpsertContactResponseAction, UpsertContactResponseActionWithLiterals, UserInfo, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.mjs';
4
4
 
5
5
  declare function createContact$1(httpClient: HttpClient): CreateContactSignature;
@@ -177,29 +177,6 @@ interface ListContactsSignature {
177
177
  __applicationErrorsType?: ListContactsApplicationErrors;
178
178
  }>;
179
179
  }
180
- declare function queryContacts$1(httpClient: HttpClient): QueryContactsSignature;
181
- interface QueryContactsSignature {
182
- /**
183
- * Creates a query to retrieve a list of contacts.
184
- *
185
- * The `queryContacts()` function builds a query to retrieve a list of contacts and returns a `ContactsQueryBuilder` object.
186
- *
187
- * The returned object contains the query definition, which is typically used to run the query using the `find()` function.
188
- *
189
- * You can refine the query by chaining `ContactsQueryBuilder` functions onto the query. `ContactsQueryBuilder` functions enable you to sort, filter, and control the results `queryContacts()` returns.
190
- *
191
- * `queryContacts()` runs with these `ContactsQueryBuilder` defaults, which you can override:
192
- *
193
- * - `skip(0)`
194
- * - `limit(50)`
195
- * - `descending("_createdDate")`
196
- *
197
- * The functions that are chained to `queryContacts()` are applied in the order they are called. For example, if you apply `ascending('info.company')` and then `descending('info.name.last')`, the results are sorted first by the company name, and then, if there are multiple results with the same company, the items are sorted by last name.
198
- * @param - Query contact options.
199
- * @param - Query options.
200
- */
201
- (query: Query, options?: QueryContactsOptions): ContactsQueryBuilder;
202
- }
203
180
  declare function listFacets$1(httpClient: HttpClient): ListFacetsSignature;
204
181
  interface ListFacetsSignature {
205
182
  /**
@@ -307,6 +284,12 @@ declare const onContactDeleted$1: EventDefinition<ContactDeletedEnvelope, "wix.c
307
284
  declare const onContactMerged$1: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
308
285
  declare const onContactUpdated$1: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
309
286
 
287
+ declare function customQueryContacts(httpClient: HttpClient): {
288
+ (query: Query): ReturnType<typeof typedQueryContacts>;
289
+ (query: Query, options: QueryContactsOptions): ReturnType<typeof typedQueryContacts>;
290
+ (): ContactsQueryBuilder;
291
+ (options: QueryContactsOptions): ContactsQueryBuilder;
292
+ };
310
293
  declare const createContact: MaybeContext<BuildRESTFunction<typeof createContact$1> & typeof createContact$1>;
311
294
  declare const updateContact: MaybeContext<BuildRESTFunction<typeof updateContact$1> & typeof updateContact$1>;
312
295
  declare const mergeContacts: MaybeContext<BuildRESTFunction<typeof mergeContacts$1> & typeof mergeContacts$1>;
@@ -315,13 +298,13 @@ declare const deleteContact: MaybeContext<BuildRESTFunction<typeof deleteContact
315
298
  declare const labelContact: MaybeContext<BuildRESTFunction<typeof labelContact$1> & typeof labelContact$1>;
316
299
  declare const unlabelContact: MaybeContext<BuildRESTFunction<typeof unlabelContact$1> & typeof unlabelContact$1>;
317
300
  declare const listContacts: MaybeContext<BuildRESTFunction<typeof listContacts$1> & typeof listContacts$1>;
318
- declare const queryContacts: MaybeContext<BuildRESTFunction<typeof queryContacts$1> & typeof queryContacts$1>;
319
301
  declare const listFacets: MaybeContext<BuildRESTFunction<typeof listFacets$1> & typeof listFacets$1>;
320
302
  declare const queryFacets: MaybeContext<BuildRESTFunction<typeof queryFacets$1> & typeof queryFacets$1>;
321
303
  declare const bulkDeleteContacts: MaybeContext<BuildRESTFunction<typeof bulkDeleteContacts$1> & typeof bulkDeleteContacts$1>;
322
304
  declare const bulkUpdateContacts: MaybeContext<BuildRESTFunction<typeof bulkUpdateContacts$1> & typeof bulkUpdateContacts$1>;
323
305
  declare const bulkLabelAndUnlabelContacts: MaybeContext<BuildRESTFunction<typeof bulkLabelAndUnlabelContacts$1> & typeof bulkLabelAndUnlabelContacts$1>;
324
306
  declare const getContact: MaybeContext<BuildRESTFunction<typeof getContact$1> & typeof getContact$1>;
307
+ declare const queryContacts: MaybeContext<BuildRESTFunction<typeof customQueryContacts> & typeof customQueryContacts>;
325
308
  /**
326
309
  * Triggered when a contact is created.
327
310
  */
@@ -1279,14 +1279,13 @@ async function listContacts2(options) {
1279
1279
  throw transformedError;
1280
1280
  }
1281
1281
  }
1282
- function queryContacts2(query, options) {
1283
- const { httpClient, sideEffects } = arguments[2];
1282
+ function queryContacts2(options) {
1283
+ const { httpClient, sideEffects } = arguments[1];
1284
1284
  return queryBuilder({
1285
1285
  func: async (payload) => {
1286
1286
  const reqOpts = queryContacts({
1287
1287
  ...payload,
1288
- ...options ?? {},
1289
- query
1288
+ ...options ?? {}
1290
1289
  });
1291
1290
  sideEffects?.onSiteCall?.();
1292
1291
  try {
@@ -1298,11 +1297,11 @@ function queryContacts2(query, options) {
1298
1297
  throw err;
1299
1298
  }
1300
1299
  },
1301
- requestTransformer: (query2) => {
1302
- const args = [query2, query2, options];
1300
+ requestTransformer: (query) => {
1301
+ const args = [query, options];
1303
1302
  return renameKeysFromSDKRequestToRESTRequest({
1304
- query: args?.[0],
1305
- ...args?.[2]
1303
+ ...args?.[1],
1304
+ query: args?.[0]
1306
1305
  });
1307
1306
  },
1308
1307
  responseTransformer: ({ data }) => {
@@ -1339,6 +1338,47 @@ function queryContacts2(query, options) {
1339
1338
  transformationPaths: {}
1340
1339
  });
1341
1340
  }
1341
+ async function typedQueryContacts(query, options) {
1342
+ const { httpClient, sideEffects } = arguments[2];
1343
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1344
+ query,
1345
+ ...options
1346
+ });
1347
+ const reqOpts = queryContacts(payload);
1348
+ sideEffects?.onSiteCall?.();
1349
+ try {
1350
+ const result = await httpClient.request(reqOpts);
1351
+ sideEffects?.onSuccess?.(result);
1352
+ return renameKeysFromRESTResponseToSDKResponse(
1353
+ transformPaths2(result.data, [
1354
+ {
1355
+ transformFn: transformRESTImageToSDKImage,
1356
+ paths: [
1357
+ { path: "contacts.picture" },
1358
+ { path: "contacts.info.picture.image" },
1359
+ { path: "contacts.memberInfo.profileInfo.photo" }
1360
+ ]
1361
+ },
1362
+ {
1363
+ transformFn: transformRESTAddressToSDKAddress,
1364
+ paths: [{ path: "contacts.info.addresses.items.address" }]
1365
+ }
1366
+ ])
1367
+ );
1368
+ } catch (err) {
1369
+ const transformedError = sdkTransformError(
1370
+ err,
1371
+ {
1372
+ spreadPathsToArguments: {},
1373
+ explicitPathsToArguments: { query: "$[0]" },
1374
+ singleArgumentUnchanged: false
1375
+ },
1376
+ ["query", "options"]
1377
+ );
1378
+ sideEffects?.onError?.(err);
1379
+ throw transformedError;
1380
+ }
1381
+ }
1342
1382
  async function listFacets2(options) {
1343
1383
  const { httpClient, sideEffects } = arguments[1];
1344
1384
  const payload = renameKeysFromSDKRequestToRESTRequest({
@@ -1618,7 +1658,14 @@ function listContacts3(httpClient) {
1618
1658
  );
1619
1659
  }
1620
1660
  function queryContacts3(httpClient) {
1621
- return (query, options) => queryContacts2(
1661
+ return (options) => queryContacts2(
1662
+ options,
1663
+ // @ts-ignore
1664
+ { httpClient }
1665
+ );
1666
+ }
1667
+ function typedQueryContacts2(httpClient) {
1668
+ return (query, options) => typedQueryContacts(
1622
1669
  query,
1623
1670
  options,
1624
1671
  // @ts-ignore
@@ -1806,6 +1853,18 @@ var onContactUpdated = EventDefinition(
1806
1853
  // src/contacts-v4-contact-contacts.context.ts
1807
1854
  import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
1808
1855
  import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
1856
+ import { createQueryOverloadRouter } from "@wix/sdk-runtime/query-method-router";
1857
+ function customQueryContacts(httpClient) {
1858
+ const router = createQueryOverloadRouter({
1859
+ builderQueryFunction: (options) => queryContacts3(httpClient)(options),
1860
+ typedQueryFunction: (query, options) => typedQueryContacts2(httpClient)(query, options),
1861
+ hasOptionsParameter: true
1862
+ });
1863
+ function overloadedQuery(queryOrOptions, options) {
1864
+ return router(...arguments);
1865
+ }
1866
+ return overloadedQuery;
1867
+ }
1809
1868
  var createContact4 = /* @__PURE__ */ createRESTModule(createContact3);
1810
1869
  var updateContact4 = /* @__PURE__ */ createRESTModule(updateContact3);
1811
1870
  var mergeContacts4 = /* @__PURE__ */ createRESTModule(mergeContacts3);
@@ -1814,13 +1873,13 @@ var deleteContact4 = /* @__PURE__ */ createRESTModule(deleteContact3);
1814
1873
  var labelContact4 = /* @__PURE__ */ createRESTModule(labelContact3);
1815
1874
  var unlabelContact4 = /* @__PURE__ */ createRESTModule(unlabelContact3);
1816
1875
  var listContacts4 = /* @__PURE__ */ createRESTModule(listContacts3);
1817
- var queryContacts4 = /* @__PURE__ */ createRESTModule(queryContacts3);
1818
1876
  var listFacets4 = /* @__PURE__ */ createRESTModule(listFacets3);
1819
1877
  var queryFacets4 = /* @__PURE__ */ createRESTModule(queryFacets3);
1820
1878
  var bulkDeleteContacts4 = /* @__PURE__ */ createRESTModule(bulkDeleteContacts3);
1821
1879
  var bulkUpdateContacts4 = /* @__PURE__ */ createRESTModule(bulkUpdateContacts3);
1822
1880
  var bulkLabelAndUnlabelContacts4 = /* @__PURE__ */ createRESTModule(bulkLabelAndUnlabelContacts3);
1823
1881
  var getContact4 = /* @__PURE__ */ createRESTModule(getContact3);
1882
+ var queryContacts4 = /* @__PURE__ */ createRESTModule(customQueryContacts);
1824
1883
  var onContactCreated2 = createEventModule(onContactCreated);
1825
1884
  var onContactDeleted2 = createEventModule(onContactDeleted);
1826
1885
  var onContactMerged2 = createEventModule(onContactMerged);