@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.js';
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.js';
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.js';
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
  */
@@ -1342,14 +1342,13 @@ async function listContacts2(options) {
1342
1342
  throw transformedError;
1343
1343
  }
1344
1344
  }
1345
- function queryContacts2(query, options) {
1346
- const { httpClient, sideEffects } = arguments[2];
1345
+ function queryContacts2(options) {
1346
+ const { httpClient, sideEffects } = arguments[1];
1347
1347
  return (0, import_query_builder.queryBuilder)({
1348
1348
  func: async (payload) => {
1349
1349
  const reqOpts = queryContacts({
1350
1350
  ...payload,
1351
- ...options ?? {},
1352
- query
1351
+ ...options ?? {}
1353
1352
  });
1354
1353
  sideEffects?.onSiteCall?.();
1355
1354
  try {
@@ -1361,11 +1360,11 @@ function queryContacts2(query, options) {
1361
1360
  throw err;
1362
1361
  }
1363
1362
  },
1364
- requestTransformer: (query2) => {
1365
- const args = [query2, query2, options];
1363
+ requestTransformer: (query) => {
1364
+ const args = [query, options];
1366
1365
  return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1367
- query: args?.[0],
1368
- ...args?.[2]
1366
+ ...args?.[1],
1367
+ query: args?.[0]
1369
1368
  });
1370
1369
  },
1371
1370
  responseTransformer: ({ data }) => {
@@ -1402,6 +1401,47 @@ function queryContacts2(query, options) {
1402
1401
  transformationPaths: {}
1403
1402
  });
1404
1403
  }
1404
+ async function typedQueryContacts(query, options) {
1405
+ const { httpClient, sideEffects } = arguments[2];
1406
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1407
+ query,
1408
+ ...options
1409
+ });
1410
+ const reqOpts = queryContacts(payload);
1411
+ sideEffects?.onSiteCall?.();
1412
+ try {
1413
+ const result = await httpClient.request(reqOpts);
1414
+ sideEffects?.onSuccess?.(result);
1415
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
1416
+ (0, import_transform_paths2.transformPaths)(result.data, [
1417
+ {
1418
+ transformFn: import_image2.transformRESTImageToSDKImage,
1419
+ paths: [
1420
+ { path: "contacts.picture" },
1421
+ { path: "contacts.info.picture.image" },
1422
+ { path: "contacts.memberInfo.profileInfo.photo" }
1423
+ ]
1424
+ },
1425
+ {
1426
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
1427
+ paths: [{ path: "contacts.info.addresses.items.address" }]
1428
+ }
1429
+ ])
1430
+ );
1431
+ } catch (err) {
1432
+ const transformedError = (0, import_transform_error.transformError)(
1433
+ err,
1434
+ {
1435
+ spreadPathsToArguments: {},
1436
+ explicitPathsToArguments: { query: "$[0]" },
1437
+ singleArgumentUnchanged: false
1438
+ },
1439
+ ["query", "options"]
1440
+ );
1441
+ sideEffects?.onError?.(err);
1442
+ throw transformedError;
1443
+ }
1444
+ }
1405
1445
  async function listFacets2(options) {
1406
1446
  const { httpClient, sideEffects } = arguments[1];
1407
1447
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -1681,7 +1721,14 @@ function listContacts3(httpClient) {
1681
1721
  );
1682
1722
  }
1683
1723
  function queryContacts3(httpClient) {
1684
- return (query, options) => queryContacts2(
1724
+ return (options) => queryContacts2(
1725
+ options,
1726
+ // @ts-ignore
1727
+ { httpClient }
1728
+ );
1729
+ }
1730
+ function typedQueryContacts2(httpClient) {
1731
+ return (query, options) => typedQueryContacts(
1685
1732
  query,
1686
1733
  options,
1687
1734
  // @ts-ignore
@@ -1869,6 +1916,18 @@ var onContactUpdated = (0, import_sdk_types.EventDefinition)(
1869
1916
  // src/contacts-v4-contact-contacts.context.ts
1870
1917
  var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
1871
1918
  var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
1919
+ var import_query_method_router = require("@wix/sdk-runtime/query-method-router");
1920
+ function customQueryContacts(httpClient) {
1921
+ const router = (0, import_query_method_router.createQueryOverloadRouter)({
1922
+ builderQueryFunction: (options) => queryContacts3(httpClient)(options),
1923
+ typedQueryFunction: (query, options) => typedQueryContacts2(httpClient)(query, options),
1924
+ hasOptionsParameter: true
1925
+ });
1926
+ function overloadedQuery(queryOrOptions, options) {
1927
+ return router(...arguments);
1928
+ }
1929
+ return overloadedQuery;
1930
+ }
1872
1931
  var createContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(createContact3);
1873
1932
  var updateContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(updateContact3);
1874
1933
  var mergeContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(mergeContacts3);
@@ -1877,13 +1936,13 @@ var deleteContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(
1877
1936
  var labelContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(labelContact3);
1878
1937
  var unlabelContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(unlabelContact3);
1879
1938
  var listContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(listContacts3);
1880
- var queryContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryContacts3);
1881
1939
  var listFacets4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(listFacets3);
1882
1940
  var queryFacets4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryFacets3);
1883
1941
  var bulkDeleteContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkDeleteContacts3);
1884
1942
  var bulkUpdateContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkUpdateContacts3);
1885
1943
  var bulkLabelAndUnlabelContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkLabelAndUnlabelContacts3);
1886
1944
  var getContact4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getContact3);
1945
+ var queryContacts4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(customQueryContacts);
1887
1946
  var onContactCreated2 = (0, import_event_definition_modules.createEventModule)(onContactCreated);
1888
1947
  var onContactDeleted2 = (0, import_event_definition_modules.createEventModule)(onContactDeleted);
1889
1948
  var onContactMerged2 = (0, import_event_definition_modules.createEventModule)(onContactMerged);