@wix/crm_contacts
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -1,2 +0,2 @@ | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, getContact as publicGetContact } from './contacts-v4-contact-contacts.public'; | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, queryContacts as publicQueryContacts, getContact as publicGetContact } from './contacts-v4-contact-contacts.public'; | ||
import { BuildRESTFunction } from '@wix/sdk-types'; | ||
@@ -9,2 +9,3 @@ export declare const createContact: BuildRESTFunction<typeof publicCreateContact>; | ||
export declare const unlabelContact: BuildRESTFunction<typeof publicUnlabelContact>; | ||
export declare const queryContacts: BuildRESTFunction<typeof publicQueryContacts>; | ||
export declare const getContact: BuildRESTFunction<typeof publicGetContact>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContact = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
const contacts_v4_contact_contacts_public_1 = require("./contacts-v4-contact-contacts.public"); | ||
@@ -107,2 +107,19 @@ const createContact = (...args) => { | ||
exports.unlabelContact = unlabelContact; | ||
const queryContacts = (...args) => { | ||
var _a; | ||
const context = | ||
// @ts-expect-error | ||
typeof $wixContext !== 'undefined' | ||
? // @ts-expect-error | ||
$wixContext | ||
: // @ts-expect-error | ||
globalThis.__wix_context__; | ||
if (!context) { | ||
throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules'); | ||
} | ||
return context | ||
.initWixModules(contacts_v4_contact_contacts_public_1.queryContacts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
exports.queryContacts = queryContacts; | ||
const getContact = (...args) => { | ||
@@ -109,0 +126,0 @@ var _a; |
@@ -81,2 +81,45 @@ import { RequestOptionsFactory } from '@wix/sdk-types'; | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
*/ | ||
export declare function queryContacts(payload: object): RequestOptionsFactory<any>; | ||
/** | ||
* Retrieves a contact. | ||
@@ -83,0 +126,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContact = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
const metro_runtime_1 = require("@wix/metro-runtime"); | ||
@@ -420,2 +420,92 @@ const float_1 = require("@wix/sdk-runtime/transformations/float"); | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
*/ | ||
function queryContacts(payload) { | ||
function __queryContacts({ host }) { | ||
const metadata = { | ||
entityFqdn: 'wix.contacts.v4.contact', | ||
method: 'POST', | ||
methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.QueryContacts', | ||
url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({ | ||
protoPath: '/v4/contacts/query', | ||
data: payload, | ||
host, | ||
}), | ||
data: payload, | ||
transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [ | ||
{ | ||
transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp, | ||
paths: [ | ||
{ path: 'contacts.createdDate' }, | ||
{ path: 'contacts.updatedDate' }, | ||
{ path: 'contacts.lastActivity.activityDate' }, | ||
{ path: 'contacts.lastActivity.date' }, | ||
{ path: 'contacts.picture.urlExpirationDate' }, | ||
{ path: 'contacts.info.picture.image.urlExpirationDate' }, | ||
{ path: 'contacts.memberInfo.signupDate' }, | ||
{ | ||
path: 'contacts.memberInfo.profileInfo.photo.urlExpirationDate', | ||
}, | ||
{ path: 'contacts.memberInfo.sessionInfo.lastWebLogin' }, | ||
{ path: 'contacts.memberInfo.sessionInfo.lastMobileLogin' }, | ||
], | ||
}, | ||
{ | ||
transformFn: float_2.transformRESTFloatToSDKFloat, | ||
paths: [ | ||
{ | ||
path: 'contacts.info.addresses.items.address.geocode.latitude', | ||
}, | ||
{ | ||
path: 'contacts.info.addresses.items.address.geocode.longitude', | ||
}, | ||
], | ||
}, | ||
]), | ||
}; | ||
return metadata; | ||
} | ||
return __queryContacts; | ||
} | ||
exports.queryContacts = queryContacts; | ||
/** | ||
* Retrieves a contact. | ||
@@ -422,0 +512,0 @@ * |
@@ -29,4 +29,5 @@ import * as ambassadorWixContactsV4ContactTypes from './contacts-v4-contact-contacts.types'; | ||
}, ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactRequest, ambassadorWixContactsV4ContactTypes.UnlabelContactRequest, ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactResponse & ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.UnlabelContactResponse & ambassadorWixContactsV4ContactTypes.UnlabelContactResponseNonNullableFields>; | ||
export declare function queryContacts(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixContactsV4ContactUniversalTypes.QueryContactsRequest, ambassadorWixContactsV4ContactTypes.QueryContactsRequest, ambassadorWixContactsV4ContactUniversalTypes.QueryContactsResponse & ambassadorWixContactsV4ContactUniversalTypes.QueryContactsResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.QueryContactsResponse & ambassadorWixContactsV4ContactTypes.QueryContactsResponseNonNullableFields>; | ||
export declare function getContact(): __PublicMethodMetaInfo<'GET', { | ||
id: string; | ||
}, ambassadorWixContactsV4ContactUniversalTypes.GetContactRequest, ambassadorWixContactsV4ContactTypes.GetContactRequest, ambassadorWixContactsV4ContactUniversalTypes.GetContactResponse & ambassadorWixContactsV4ContactUniversalTypes.GetContactResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.GetContactResponse & ambassadorWixContactsV4ContactTypes.GetContactResponseNonNullableFields>; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContact = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = void 0; | ||
const ambassadorWixContactsV4Contact = __importStar(require("./contacts-v4-contact-contacts.http")); | ||
@@ -143,2 +143,21 @@ function createContact() { | ||
exports.unlabelContact = unlabelContact; | ||
function queryContacts() { | ||
const payload = {}; | ||
const getRequestOptions = ambassadorWixContactsV4Contact.queryContacts(payload); | ||
const getUrl = (context) => { | ||
const { url } = getRequestOptions(context); | ||
return url; | ||
}; | ||
return { | ||
getUrl, | ||
httpMethod: 'POST', | ||
path: '/v4/contacts/query', | ||
pathParams: {}, | ||
__requestType: null, | ||
__originalRequestType: null, | ||
__responseType: null, | ||
__originalResponseType: null, | ||
}; | ||
} | ||
exports.queryContacts = queryContacts; | ||
function getContact() { | ||
@@ -145,0 +164,0 @@ const payload = { id: ':id' }; |
import { HttpClient } from '@wix/sdk-types'; | ||
import { ContactInfo, CreateContactOptions, GetContactOptions, MergeContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
import { ContactInfo, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
export declare const __metadata: { | ||
@@ -12,2 +12,3 @@ PACKAGE_NAME: string; | ||
export declare function unlabelContact(httpClient: HttpClient): (contactId: string, labelKeys: string[]) => Promise<import("./contacts-v4-contact-contacts.universal").UnlabelContactResponse & import("./contacts-v4-contact-contacts.universal").UnlabelContactResponseNonNullableFields>; | ||
export declare function queryContacts(httpClient: HttpClient): (options?: QueryContactsOptions) => import("./contacts-v4-contact-contacts.universal").ContactsQueryBuilder; | ||
export declare function getContact(httpClient: HttpClient): (_id: string, options?: GetContactOptions) => Promise<import("./contacts-v4-contact-contacts.universal").Contact & { | ||
@@ -49,3 +50,3 @@ _id: string; | ||
export { ContactSourceType, ContactActivityType, EmailTag, PhoneTag, AddressTag, SubdivisionType, ImageProvider, SubscriptionStatus, EmailDeliverabilityStatus, PhoneDeliverabilityStatus, MemberStatus, PrivacyStatus, Role, SortOrder, ContactFieldSet, ContactsFacetType, Action, UpsertContactResponseAction, GetContactResponseType, SubmitOperation, Mode, } from './contacts-v4-contact-contacts.universal'; | ||
export { Contact, ContactSource, ContactActivity, ActivityIcon, PrimaryContactInfo, ContactInfo, ContactName, ContactEmailsWrapper, ContactEmail, ContactPhonesWrapper, ContactPhone, ContactAddressesWrapper, ContactAddress, Address, AddressStreetOneOf, StreetAddress, AddressLocation, Subdivision, AssigneesWrapper, LabelsWrapper, ExtendedFieldsWrapper, LocationsWrapper, ContactPicture, SegmentsWrapper, PrimaryEmail, PrimaryPhone, MemberInfo, ProfileInfo, UserInfo, SessionInfo, GroupInfo, ContactSubmitted, ContactChanged, ContactEmailSubscriptionUpdated, ContactPhoneSubscriptionUpdated, ContactPrimaryInfoUpdated, PrimarySubscriptionStatus, LastActivityUpdate, CreateContactRequest, CreateContactResponse, DuplicateContactExists, UpdateContactRequest, UpdateContactResponse, MergeContactsRequest, MergeContactsResponse, ContactMerged, PreviewMergeContactsRequest, PreviewMergeContactsResponse, DeleteContactRequest, DeleteContactResponse, LabelContactRequest, LabelContactResponse, UnlabelContactRequest, UnlabelContactResponse, LabelAndUnlabelContactRequest, LabelAndUnlabelContactResponse, ListContactsRequest, Sorting, Paging, ListContactsResponse, PagingMetadata, QueryContactsRequest, Query, QueryContactsResponse, ListFacetsRequest, ListFacetsResponse, ContactsFacet, QueryFacetsRequest, QueryFacetsResponse, BulkDeleteContactsRequest, BulkDeleteContactsResponse, BulkUpdateContactsRequest, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsRequest, BulkLabelAndUnlabelContactsResponse, BulkUpsertContactsRequest, BulkUpsertContactsResponse, Error, Metadata, Item, BulkUpsertContactsResponseMetadata, UpsertContactRequest, UpsertContactResponse, GeneratePictureUploadUrlRequest, GeneratePictureUploadUrlResponse, GetContactRequest, GetContactResponse, SyncSubmitContactRequest, SyncSubmitContactResponse, CountContactsRequest, CountContactsResponse, SearchContactsRequest, Search, SearchPagingMethodOneOf, SearchDetails, CursorPaging, SearchContactsResponse, PagingMetadataV2, Cursors, BulkAddSegmentToContactsRequest, BulkAddSegmentToContactsResponse, ItemMetadata, ApplicationError, BulkActionMetadata, ContactAddedToSegment, BulkRemoveSegmentFromContactsRequest, BulkRemoveSegmentFromContactsResponse, ContactRemovedFromSegment, DomainEvent, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, DomainActionEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, GetContactResponseNonNullableFields, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; | ||
export { Contact, ContactSource, ContactActivity, ActivityIcon, PrimaryContactInfo, ContactInfo, ContactName, ContactEmailsWrapper, ContactEmail, ContactPhonesWrapper, ContactPhone, ContactAddressesWrapper, ContactAddress, Address, AddressStreetOneOf, StreetAddress, AddressLocation, Subdivision, AssigneesWrapper, LabelsWrapper, ExtendedFieldsWrapper, LocationsWrapper, ContactPicture, SegmentsWrapper, PrimaryEmail, PrimaryPhone, MemberInfo, ProfileInfo, UserInfo, SessionInfo, GroupInfo, ContactSubmitted, ContactChanged, ContactEmailSubscriptionUpdated, ContactPhoneSubscriptionUpdated, ContactPrimaryInfoUpdated, PrimarySubscriptionStatus, LastActivityUpdate, CreateContactRequest, CreateContactResponse, DuplicateContactExists, UpdateContactRequest, UpdateContactResponse, MergeContactsRequest, MergeContactsResponse, ContactMerged, PreviewMergeContactsRequest, PreviewMergeContactsResponse, DeleteContactRequest, DeleteContactResponse, LabelContactRequest, LabelContactResponse, UnlabelContactRequest, UnlabelContactResponse, LabelAndUnlabelContactRequest, LabelAndUnlabelContactResponse, ListContactsRequest, Sorting, Paging, ListContactsResponse, PagingMetadata, QueryContactsRequest, Query, QueryContactsResponse, ListFacetsRequest, ListFacetsResponse, ContactsFacet, QueryFacetsRequest, QueryFacetsResponse, BulkDeleteContactsRequest, BulkDeleteContactsResponse, BulkUpdateContactsRequest, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsRequest, BulkLabelAndUnlabelContactsResponse, BulkUpsertContactsRequest, BulkUpsertContactsResponse, Error, Metadata, Item, BulkUpsertContactsResponseMetadata, UpsertContactRequest, UpsertContactResponse, GeneratePictureUploadUrlRequest, GeneratePictureUploadUrlResponse, GetContactRequest, GetContactResponse, SyncSubmitContactRequest, SyncSubmitContactResponse, CountContactsRequest, CountContactsResponse, SearchContactsRequest, Search, SearchPagingMethodOneOf, SearchDetails, CursorPaging, SearchContactsResponse, PagingMetadataV2, Cursors, BulkAddSegmentToContactsRequest, BulkAddSegmentToContactsResponse, ItemMetadata, ApplicationError, BulkActionMetadata, ContactAddedToSegment, BulkRemoveSegmentFromContactsRequest, BulkRemoveSegmentFromContactsResponse, ContactRemovedFromSegment, DomainEvent, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, DomainActionEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; | ||
export { onContactCreated, onContactUpdated, onContactMerged, onContactDeleted, } from './contacts-v4-contact-contacts.universal'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.onContactDeleted = exports.onContactMerged = exports.onContactUpdated = exports.onContactCreated = exports.Mode = exports.SubmitOperation = exports.GetContactResponseType = exports.UpsertContactResponseAction = exports.Action = exports.ContactsFacetType = exports.ContactFieldSet = exports.SortOrder = exports.Role = exports.PrivacyStatus = exports.MemberStatus = exports.PhoneDeliverabilityStatus = exports.EmailDeliverabilityStatus = exports.SubscriptionStatus = exports.ImageProvider = exports.SubdivisionType = exports.AddressTag = exports.PhoneTag = exports.EmailTag = exports.ContactActivityType = exports.ContactSourceType = exports.getContact = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = exports.__metadata = void 0; | ||
exports.onContactDeleted = exports.onContactMerged = exports.onContactUpdated = exports.onContactCreated = exports.Mode = exports.SubmitOperation = exports.GetContactResponseType = exports.UpsertContactResponseAction = exports.Action = exports.ContactsFacetType = exports.ContactFieldSet = exports.SortOrder = exports.Role = exports.PrivacyStatus = exports.MemberStatus = exports.PhoneDeliverabilityStatus = exports.EmailDeliverabilityStatus = exports.SubscriptionStatus = exports.ImageProvider = exports.SubdivisionType = exports.AddressTag = exports.PhoneTag = exports.EmailTag = exports.ContactActivityType = exports.ContactSourceType = exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = exports.__metadata = void 0; | ||
const contacts_v4_contact_contacts_universal_1 = require("./contacts-v4-contact-contacts.universal"); | ||
@@ -42,2 +42,8 @@ exports.__metadata = { PACKAGE_NAME: '@wix/crm' }; | ||
exports.unlabelContact = unlabelContact; | ||
function queryContacts(httpClient) { | ||
return (options) => (0, contacts_v4_contact_contacts_universal_1.queryContacts)(options, | ||
// @ts-ignore | ||
{ httpClient }); | ||
} | ||
exports.queryContacts = queryContacts; | ||
function getContact(httpClient) { | ||
@@ -44,0 +50,0 @@ return (_id, options) => (0, contacts_v4_contact_contacts_universal_1.getContact)(_id, options, |
@@ -35,3 +35,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getContact = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = exports.onContactDeleted = exports.onContactMerged = exports.onContactUpdated = exports.onContactCreated = exports.Mode = exports.SubmitOperation = exports.GetContactResponseType = exports.UpsertContactResponseAction = exports.Action = exports.ContactsFacetType = exports.ContactFieldSet = exports.SortOrder = exports.Role = exports.PrivacyStatus = exports.MemberStatus = exports.PhoneDeliverabilityStatus = exports.EmailDeliverabilityStatus = exports.SubscriptionStatus = exports.ImageProvider = exports.SubdivisionType = exports.AddressTag = exports.PhoneTag = exports.EmailTag = exports.ContactActivityType = exports.ContactSourceType = void 0; | ||
exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = exports.onContactDeleted = exports.onContactMerged = exports.onContactUpdated = exports.onContactCreated = exports.Mode = exports.SubmitOperation = exports.GetContactResponseType = exports.UpsertContactResponseAction = exports.Action = exports.ContactsFacetType = exports.ContactFieldSet = exports.SortOrder = exports.Role = exports.PrivacyStatus = exports.MemberStatus = exports.PhoneDeliverabilityStatus = exports.EmailDeliverabilityStatus = exports.SubscriptionStatus = exports.ImageProvider = exports.SubdivisionType = exports.AddressTag = exports.PhoneTag = exports.EmailTag = exports.ContactActivityType = exports.ContactSourceType = void 0; | ||
const velo_1 = require("@wix/metro-runtime/velo"); | ||
const transform_error_1 = require("@wix/sdk-runtime/transform-error"); | ||
@@ -42,2 +43,3 @@ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys"); | ||
// @ts-ignore | ||
const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper"); | ||
const address_1 = require("@wix/sdk-runtime/transformations/address"); | ||
@@ -48,2 +50,4 @@ const address_2 = require("@wix/sdk-runtime/transformations/address"); | ||
const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths"); | ||
const _toVeloEntity = '$'; | ||
const _fromVeloEntity = '$'; | ||
var ContactSourceType; | ||
@@ -321,2 +325,4 @@ (function (ContactSourceType) { | ||
const _profileInfo = { photo: 'wix.common.Image' }; | ||
const _queryContactsRequest = {}; | ||
const _queryContactsResponse = { contacts: '_contact' }; | ||
const _contactActivity = { | ||
@@ -796,2 +802,115 @@ activityDate: 'google.protobuf.Timestamp', | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
* @public | ||
* @documentationMaturity preview | ||
* @param options - Query contact options. | ||
* @permissionScope Read Contacts | ||
* @permissionScopeId SCOPE.DC-CONTACTS.READ-CONTACTS | ||
* @permissionScope Read Members and Contacts - all read permissions | ||
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS | ||
* @permissionScope Manage Contacts | ||
* @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-CONTACTS | ||
* @permissionScope Manage Members and Contacts - all permissions | ||
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS | ||
*/ | ||
function queryContacts(options) { | ||
const requestTransformation = { '*': '$[1]', query: '$[0]' }; | ||
const responseTransformation = { | ||
items: '$.contacts', | ||
pagingMetadata: '$.pagingMetadata', | ||
}; | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[1]; | ||
const { toAmbassadorRequest } = (0, velo_1.serializer)({ | ||
rootSchema: _queryContactsRequest, | ||
depSchemas: {}, | ||
fqdnTransformation: { | ||
paths: [], | ||
transformation: _fromVeloEntity, | ||
}, | ||
customTransformation: requestTransformation, | ||
}); | ||
const { fromJSON } = (0, velo_1.serializer)({ | ||
rootSchema: _queryContactsResponse, | ||
depSchemas: { | ||
_contact, | ||
_contactAddress, | ||
_contactAddressesWrapper, | ||
_contactInfo, | ||
_contactPicture, | ||
_memberInfo, | ||
_profileInfo, | ||
}, | ||
fqdnTransformation: { | ||
paths: [...['Array#contacts']], | ||
transformation: _toVeloEntity, | ||
}, | ||
customTransformation: responseTransformation, | ||
}); | ||
return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({ | ||
func: (payload) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b, _c; | ||
const reqOpts = ambassadorWixContactsV4Contact.queryContacts(Object.assign(Object.assign({}, payload), (options !== null && options !== void 0 ? options : {}))); | ||
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects); | ||
try { | ||
const result = yield httpClient.request(reqOpts); | ||
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result); | ||
return result; | ||
} | ||
catch (err) { | ||
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err); | ||
throw err; | ||
} | ||
}), | ||
requestTransformer: (...args) => toAmbassadorRequest(args), | ||
responseTransformer: ({ data }) => fromJSON(data), | ||
errorTransformer: (err) => { | ||
const transformedError = (0, velo_1.transformError)(err, requestTransformation); | ||
throw transformedError; | ||
}, | ||
pagingMethod: 'OFFSET', | ||
transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity), | ||
})({ cursorWithEmptyFilterAndSort: true }); | ||
} | ||
exports.queryContacts = queryContacts; | ||
/** | ||
* Retrieves a contact. | ||
@@ -798,0 +917,0 @@ * |
@@ -1,2 +0,2 @@ | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, getContact as publicGetContact } from './contacts-v4-contact-contacts.public'; | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, queryContacts as publicQueryContacts, getContact as publicGetContact } from './contacts-v4-contact-contacts.public'; | ||
import { BuildRESTFunction } from '@wix/sdk-types'; | ||
@@ -9,2 +9,3 @@ export declare const createContact: BuildRESTFunction<typeof publicCreateContact>; | ||
export declare const unlabelContact: BuildRESTFunction<typeof publicUnlabelContact>; | ||
export declare const queryContacts: BuildRESTFunction<typeof publicQueryContacts>; | ||
export declare const getContact: BuildRESTFunction<typeof publicGetContact>; |
@@ -1,2 +0,2 @@ | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, getContact as publicGetContact, } from './contacts-v4-contact-contacts.public'; | ||
import { createContact as publicCreateContact, updateContact as publicUpdateContact, mergeContacts as publicMergeContacts, deleteContact as publicDeleteContact, labelContact as publicLabelContact, unlabelContact as publicUnlabelContact, queryContacts as publicQueryContacts, getContact as publicGetContact, } from './contacts-v4-contact-contacts.public'; | ||
export const createContact = (...args) => { | ||
@@ -98,2 +98,18 @@ var _a; | ||
}; | ||
export const queryContacts = (...args) => { | ||
var _a; | ||
const context = | ||
// @ts-expect-error | ||
typeof $wixContext !== 'undefined' | ||
? // @ts-expect-error | ||
$wixContext | ||
: // @ts-expect-error | ||
globalThis.__wix_context__; | ||
if (!context) { | ||
throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules'); | ||
} | ||
return context | ||
.initWixModules(publicQueryContacts, ((_a = args[1]) === null || _a === void 0 ? void 0 : _a.supressAuth) ? true : false) | ||
.apply(undefined, args); | ||
}; | ||
export const getContact = (...args) => { | ||
@@ -100,0 +116,0 @@ var _a; |
@@ -81,2 +81,45 @@ import { RequestOptionsFactory } from '@wix/sdk-types'; | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
*/ | ||
export declare function queryContacts(payload: object): RequestOptionsFactory<any>; | ||
/** | ||
* Retrieves a contact. | ||
@@ -83,0 +126,0 @@ * |
@@ -411,2 +411,91 @@ import { toURLSearchParams } from '@wix/metro-runtime'; | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
*/ | ||
export function queryContacts(payload) { | ||
function __queryContacts({ host }) { | ||
const metadata = { | ||
entityFqdn: 'wix.contacts.v4.contact', | ||
method: 'POST', | ||
methodFqn: 'com.wixpress.contacts.core.api.v4.ContactsServiceV4.QueryContacts', | ||
url: resolveComWixpressContactsCoreApiV4ContactsServiceV4Url({ | ||
protoPath: '/v4/contacts/query', | ||
data: payload, | ||
host, | ||
}), | ||
data: payload, | ||
transformResponse: (payload) => transformPaths(payload, [ | ||
{ | ||
transformFn: transformRESTTimestampToSDKTimestamp, | ||
paths: [ | ||
{ path: 'contacts.createdDate' }, | ||
{ path: 'contacts.updatedDate' }, | ||
{ path: 'contacts.lastActivity.activityDate' }, | ||
{ path: 'contacts.lastActivity.date' }, | ||
{ path: 'contacts.picture.urlExpirationDate' }, | ||
{ path: 'contacts.info.picture.image.urlExpirationDate' }, | ||
{ path: 'contacts.memberInfo.signupDate' }, | ||
{ | ||
path: 'contacts.memberInfo.profileInfo.photo.urlExpirationDate', | ||
}, | ||
{ path: 'contacts.memberInfo.sessionInfo.lastWebLogin' }, | ||
{ path: 'contacts.memberInfo.sessionInfo.lastMobileLogin' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTFloatToSDKFloat, | ||
paths: [ | ||
{ | ||
path: 'contacts.info.addresses.items.address.geocode.latitude', | ||
}, | ||
{ | ||
path: 'contacts.info.addresses.items.address.geocode.longitude', | ||
}, | ||
], | ||
}, | ||
]), | ||
}; | ||
return metadata; | ||
} | ||
return __queryContacts; | ||
} | ||
/** | ||
* Retrieves a contact. | ||
@@ -413,0 +502,0 @@ * |
@@ -29,4 +29,5 @@ import * as ambassadorWixContactsV4ContactTypes from './contacts-v4-contact-contacts.types'; | ||
}, ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactRequest, ambassadorWixContactsV4ContactTypes.UnlabelContactRequest, ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactResponse & ambassadorWixContactsV4ContactUniversalTypes.UnlabelContactResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.UnlabelContactResponse & ambassadorWixContactsV4ContactTypes.UnlabelContactResponseNonNullableFields>; | ||
export declare function queryContacts(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixContactsV4ContactUniversalTypes.QueryContactsRequest, ambassadorWixContactsV4ContactTypes.QueryContactsRequest, ambassadorWixContactsV4ContactUniversalTypes.QueryContactsResponse & ambassadorWixContactsV4ContactUniversalTypes.QueryContactsResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.QueryContactsResponse & ambassadorWixContactsV4ContactTypes.QueryContactsResponseNonNullableFields>; | ||
export declare function getContact(): __PublicMethodMetaInfo<'GET', { | ||
id: string; | ||
}, ambassadorWixContactsV4ContactUniversalTypes.GetContactRequest, ambassadorWixContactsV4ContactTypes.GetContactRequest, ambassadorWixContactsV4ContactUniversalTypes.GetContactResponse & ambassadorWixContactsV4ContactUniversalTypes.GetContactResponseNonNullableFields, ambassadorWixContactsV4ContactTypes.GetContactResponse & ambassadorWixContactsV4ContactTypes.GetContactResponseNonNullableFields>; |
@@ -110,2 +110,20 @@ import * as ambassadorWixContactsV4Contact from './contacts-v4-contact-contacts.http'; | ||
} | ||
export function queryContacts() { | ||
const payload = {}; | ||
const getRequestOptions = ambassadorWixContactsV4Contact.queryContacts(payload); | ||
const getUrl = (context) => { | ||
const { url } = getRequestOptions(context); | ||
return url; | ||
}; | ||
return { | ||
getUrl, | ||
httpMethod: 'POST', | ||
path: '/v4/contacts/query', | ||
pathParams: {}, | ||
__requestType: null, | ||
__originalRequestType: null, | ||
__responseType: null, | ||
__originalResponseType: null, | ||
}; | ||
} | ||
export function getContact() { | ||
@@ -112,0 +130,0 @@ const payload = { id: ':id' }; |
import { HttpClient } from '@wix/sdk-types'; | ||
import { ContactInfo, CreateContactOptions, GetContactOptions, MergeContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
import { ContactInfo, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
export declare const __metadata: { | ||
@@ -12,2 +12,3 @@ PACKAGE_NAME: string; | ||
export declare function unlabelContact(httpClient: HttpClient): (contactId: string, labelKeys: string[]) => Promise<import("./contacts-v4-contact-contacts.universal").UnlabelContactResponse & import("./contacts-v4-contact-contacts.universal").UnlabelContactResponseNonNullableFields>; | ||
export declare function queryContacts(httpClient: HttpClient): (options?: QueryContactsOptions) => import("./contacts-v4-contact-contacts.universal").ContactsQueryBuilder; | ||
export declare function getContact(httpClient: HttpClient): (_id: string, options?: GetContactOptions) => Promise<import("./contacts-v4-contact-contacts.universal").Contact & { | ||
@@ -49,3 +50,3 @@ _id: string; | ||
export { ContactSourceType, ContactActivityType, EmailTag, PhoneTag, AddressTag, SubdivisionType, ImageProvider, SubscriptionStatus, EmailDeliverabilityStatus, PhoneDeliverabilityStatus, MemberStatus, PrivacyStatus, Role, SortOrder, ContactFieldSet, ContactsFacetType, Action, UpsertContactResponseAction, GetContactResponseType, SubmitOperation, Mode, } from './contacts-v4-contact-contacts.universal'; | ||
export { Contact, ContactSource, ContactActivity, ActivityIcon, PrimaryContactInfo, ContactInfo, ContactName, ContactEmailsWrapper, ContactEmail, ContactPhonesWrapper, ContactPhone, ContactAddressesWrapper, ContactAddress, Address, AddressStreetOneOf, StreetAddress, AddressLocation, Subdivision, AssigneesWrapper, LabelsWrapper, ExtendedFieldsWrapper, LocationsWrapper, ContactPicture, SegmentsWrapper, PrimaryEmail, PrimaryPhone, MemberInfo, ProfileInfo, UserInfo, SessionInfo, GroupInfo, ContactSubmitted, ContactChanged, ContactEmailSubscriptionUpdated, ContactPhoneSubscriptionUpdated, ContactPrimaryInfoUpdated, PrimarySubscriptionStatus, LastActivityUpdate, CreateContactRequest, CreateContactResponse, DuplicateContactExists, UpdateContactRequest, UpdateContactResponse, MergeContactsRequest, MergeContactsResponse, ContactMerged, PreviewMergeContactsRequest, PreviewMergeContactsResponse, DeleteContactRequest, DeleteContactResponse, LabelContactRequest, LabelContactResponse, UnlabelContactRequest, UnlabelContactResponse, LabelAndUnlabelContactRequest, LabelAndUnlabelContactResponse, ListContactsRequest, Sorting, Paging, ListContactsResponse, PagingMetadata, QueryContactsRequest, Query, QueryContactsResponse, ListFacetsRequest, ListFacetsResponse, ContactsFacet, QueryFacetsRequest, QueryFacetsResponse, BulkDeleteContactsRequest, BulkDeleteContactsResponse, BulkUpdateContactsRequest, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsRequest, BulkLabelAndUnlabelContactsResponse, BulkUpsertContactsRequest, BulkUpsertContactsResponse, Error, Metadata, Item, BulkUpsertContactsResponseMetadata, UpsertContactRequest, UpsertContactResponse, GeneratePictureUploadUrlRequest, GeneratePictureUploadUrlResponse, GetContactRequest, GetContactResponse, SyncSubmitContactRequest, SyncSubmitContactResponse, CountContactsRequest, CountContactsResponse, SearchContactsRequest, Search, SearchPagingMethodOneOf, SearchDetails, CursorPaging, SearchContactsResponse, PagingMetadataV2, Cursors, BulkAddSegmentToContactsRequest, BulkAddSegmentToContactsResponse, ItemMetadata, ApplicationError, BulkActionMetadata, ContactAddedToSegment, BulkRemoveSegmentFromContactsRequest, BulkRemoveSegmentFromContactsResponse, ContactRemovedFromSegment, DomainEvent, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, DomainActionEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, GetContactResponseNonNullableFields, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; | ||
export { Contact, ContactSource, ContactActivity, ActivityIcon, PrimaryContactInfo, ContactInfo, ContactName, ContactEmailsWrapper, ContactEmail, ContactPhonesWrapper, ContactPhone, ContactAddressesWrapper, ContactAddress, Address, AddressStreetOneOf, StreetAddress, AddressLocation, Subdivision, AssigneesWrapper, LabelsWrapper, ExtendedFieldsWrapper, LocationsWrapper, ContactPicture, SegmentsWrapper, PrimaryEmail, PrimaryPhone, MemberInfo, ProfileInfo, UserInfo, SessionInfo, GroupInfo, ContactSubmitted, ContactChanged, ContactEmailSubscriptionUpdated, ContactPhoneSubscriptionUpdated, ContactPrimaryInfoUpdated, PrimarySubscriptionStatus, LastActivityUpdate, CreateContactRequest, CreateContactResponse, DuplicateContactExists, UpdateContactRequest, UpdateContactResponse, MergeContactsRequest, MergeContactsResponse, ContactMerged, PreviewMergeContactsRequest, PreviewMergeContactsResponse, DeleteContactRequest, DeleteContactResponse, LabelContactRequest, LabelContactResponse, UnlabelContactRequest, UnlabelContactResponse, LabelAndUnlabelContactRequest, LabelAndUnlabelContactResponse, ListContactsRequest, Sorting, Paging, ListContactsResponse, PagingMetadata, QueryContactsRequest, Query, QueryContactsResponse, ListFacetsRequest, ListFacetsResponse, ContactsFacet, QueryFacetsRequest, QueryFacetsResponse, BulkDeleteContactsRequest, BulkDeleteContactsResponse, BulkUpdateContactsRequest, BulkUpdateContactsResponse, BulkLabelAndUnlabelContactsRequest, BulkLabelAndUnlabelContactsResponse, BulkUpsertContactsRequest, BulkUpsertContactsResponse, Error, Metadata, Item, BulkUpsertContactsResponseMetadata, UpsertContactRequest, UpsertContactResponse, GeneratePictureUploadUrlRequest, GeneratePictureUploadUrlResponse, GetContactRequest, GetContactResponse, SyncSubmitContactRequest, SyncSubmitContactResponse, CountContactsRequest, CountContactsResponse, SearchContactsRequest, Search, SearchPagingMethodOneOf, SearchDetails, CursorPaging, SearchContactsResponse, PagingMetadataV2, Cursors, BulkAddSegmentToContactsRequest, BulkAddSegmentToContactsResponse, ItemMetadata, ApplicationError, BulkActionMetadata, ContactAddedToSegment, BulkRemoveSegmentFromContactsRequest, BulkRemoveSegmentFromContactsResponse, ContactRemovedFromSegment, DomainEvent, DomainCreatedEvent, DomainDeletedEvent, DomainUpdatedEvent, DomainActionEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; | ||
export { onContactCreated, onContactUpdated, onContactMerged, onContactDeleted, } from './contacts-v4-contact-contacts.universal'; |
@@ -1,2 +0,2 @@ | ||
import { createContact as universalCreateContact, updateContact as universalUpdateContact, mergeContacts as universalMergeContacts, deleteContact as universalDeleteContact, labelContact as universalLabelContact, unlabelContact as universalUnlabelContact, getContact as universalGetContact, } from './contacts-v4-contact-contacts.universal'; | ||
import { createContact as universalCreateContact, updateContact as universalUpdateContact, mergeContacts as universalMergeContacts, deleteContact as universalDeleteContact, labelContact as universalLabelContact, unlabelContact as universalUnlabelContact, queryContacts as universalQueryContacts, getContact as universalGetContact, } from './contacts-v4-contact-contacts.universal'; | ||
export const __metadata = { PACKAGE_NAME: '@wix/crm' }; | ||
@@ -33,2 +33,7 @@ export function createContact(httpClient) { | ||
} | ||
export function queryContacts(httpClient) { | ||
return (options) => universalQueryContacts(options, | ||
// @ts-ignore | ||
{ httpClient }); | ||
} | ||
export function getContact(httpClient) { | ||
@@ -35,0 +40,0 @@ return (_id, options) => universalGetContact(_id, options, |
@@ -10,2 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo'; | ||
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error'; | ||
@@ -16,2 +17,3 @@ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys'; | ||
// @ts-ignore | ||
import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper'; | ||
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address'; | ||
@@ -22,2 +24,4 @@ import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address'; | ||
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths'; | ||
const _toVeloEntity = '$'; | ||
const _fromVeloEntity = '$'; | ||
export var ContactSourceType; | ||
@@ -295,2 +299,4 @@ (function (ContactSourceType) { | ||
const _profileInfo = { photo: 'wix.common.Image' }; | ||
const _queryContactsRequest = {}; | ||
const _queryContactsResponse = { contacts: '_contact' }; | ||
const _contactActivity = { | ||
@@ -764,2 +770,114 @@ activityDate: 'google.protobuf.Timestamp', | ||
/** | ||
* Creates a query to retrieve a list of contacts. | ||
* | ||
* The `queryContacts()` function builds a query to retrieve a list of contacts | ||
* and returns a | ||
* [`ContactsQueryBuilder`](#contactsquerybuilder) | ||
* object. | ||
* | ||
* The returned object contains the query definition, | ||
* which is typically used to run the query using the | ||
* [`find()`](#contactsquerybuilder/find) | ||
* function. | ||
* | ||
* 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. | ||
* | ||
* `queryContacts()` runs with these `ContactsQueryBuilder` defaults, | ||
* which you can override: | ||
* | ||
* - [`skip(0)`](#contactsquerybuilder/skip) | ||
* - [`limit(50)`](#contactsquerybuilder/limit) | ||
* - [`descending("_createdDate")`](#contactsquerybuilder/descending) | ||
* | ||
* 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. | ||
* | ||
* <!-- | ||
* > **Note:** | ||
* > Only visitors with | ||
* > **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) | ||
* > can query contacts. | ||
* > You can override the permissions by setting the `suppressAuth` option to `true` | ||
* > in the [`find()`](wix-crm-v2/contacts/contactsquerybuilder/find) function. | ||
* --> | ||
* @public | ||
* @documentationMaturity preview | ||
* @param options - Query contact options. | ||
* @permissionScope Read Contacts | ||
* @permissionScopeId SCOPE.DC-CONTACTS.READ-CONTACTS | ||
* @permissionScope Read Members and Contacts - all read permissions | ||
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS | ||
* @permissionScope Manage Contacts | ||
* @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-CONTACTS | ||
* @permissionScope Manage Members and Contacts - all permissions | ||
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS | ||
*/ | ||
export function queryContacts(options) { | ||
const requestTransformation = { '*': '$[1]', query: '$[0]' }; | ||
const responseTransformation = { | ||
items: '$.contacts', | ||
pagingMetadata: '$.pagingMetadata', | ||
}; | ||
// @ts-ignore | ||
const { httpClient, sideEffects } = arguments[1]; | ||
const { toAmbassadorRequest } = serializer({ | ||
rootSchema: _queryContactsRequest, | ||
depSchemas: {}, | ||
fqdnTransformation: { | ||
paths: [], | ||
transformation: _fromVeloEntity, | ||
}, | ||
customTransformation: requestTransformation, | ||
}); | ||
const { fromJSON } = serializer({ | ||
rootSchema: _queryContactsResponse, | ||
depSchemas: { | ||
_contact, | ||
_contactAddress, | ||
_contactAddressesWrapper, | ||
_contactInfo, | ||
_contactPicture, | ||
_memberInfo, | ||
_profileInfo, | ||
}, | ||
fqdnTransformation: { | ||
paths: [...['Array#contacts']], | ||
transformation: _toVeloEntity, | ||
}, | ||
customTransformation: responseTransformation, | ||
}); | ||
return wrapWithQueryBuilder({ | ||
func: (payload) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b, _c; | ||
const reqOpts = ambassadorWixContactsV4Contact.queryContacts(Object.assign(Object.assign({}, payload), (options !== null && options !== void 0 ? options : {}))); | ||
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects); | ||
try { | ||
const result = yield httpClient.request(reqOpts); | ||
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result); | ||
return result; | ||
} | ||
catch (err) { | ||
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err); | ||
throw err; | ||
} | ||
}), | ||
requestTransformer: (...args) => toAmbassadorRequest(args), | ||
responseTransformer: ({ data }) => fromJSON(data), | ||
errorTransformer: (err) => { | ||
const transformedError = transformError(err, requestTransformation); | ||
throw transformedError; | ||
}, | ||
pagingMethod: 'OFFSET', | ||
transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity), | ||
})({ cursorWithEmptyFilterAndSort: true }); | ||
} | ||
/** | ||
* Retrieves a contact. | ||
@@ -766,0 +884,0 @@ * |
{ | ||
"name": "@wix/crm_contacts", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"publishConfig": { | ||
@@ -42,3 +42,3 @@ "registry": "https://registry.npmjs.org/", | ||
}, | ||
"falconPackageHash": "45ad797a33272d6ab3cbcc707f72c0e91953fea24f6158118aee343b" | ||
"falconPackageHash": "8bba768d0af0a09a37188080d9dda3bb53b8d00e70d7a41f260322af" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
634260
13843