@wix/crm_contacts
Advanced tools
Comparing version 1.0.21 to 1.0.22
import { HttpClient, EventDefinition } from '@wix/sdk-types'; | ||
import { ContactInfo, ContactCreatedEvent, ContactDeletedEvent, ContactMergedEvent, ContactUpdatedEvent, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
import { ContactInfo, ContactCreatedEnvelope, ContactDeletedEnvelope, ContactMergedEnvelope, ContactUpdatedEnvelope, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
export declare const __metadata: { | ||
@@ -48,7 +48,7 @@ PACKAGE_NAME: string; | ||
}>; | ||
export declare const onContactCreated: EventDefinition<ContactCreatedEvent, "wix.contacts.v4.contact_created">; | ||
export declare const onContactUpdated: EventDefinition<ContactUpdatedEvent, "wix.contacts.v4.contact_updated">; | ||
export declare const onContactMerged: EventDefinition<ContactMergedEvent, "wix.contacts.v4.contact_merged">; | ||
export declare const onContactDeleted: EventDefinition<ContactDeletedEvent, "wix.contacts.v4.contact_deleted">; | ||
export declare const onContactCreated: EventDefinition<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">; | ||
export declare const onContactUpdated: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">; | ||
export declare const onContactMerged: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">; | ||
export declare const onContactDeleted: EventDefinition<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">; | ||
export { ContactSourceType, ContactActivityType, EmailTag, PhoneTag, AddressTag, SubdivisionType, ImageProvider, SubscriptionStatus, EmailDeliverabilityStatus, PhoneDeliverabilityStatus, MemberStatus, PrivacyStatus, Role, SortOrder, ContactFieldSet, ContactsFacetType, Action, UpsertContactResponseAction, GetContactResponseType, SubmitOperation, Mode, WebhookIdentityType, } 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, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, MessageEnvelope, IdentificationData, IdentificationDataIdOneOf, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, BaseEventMetadata, EventMetadata, ContactCreatedEvent, ContactUpdatedEvent, ContactMergedEvent, ContactDeletedEvent, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, 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, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, MessageEnvelope, IdentificationData, IdentificationDataIdOneOf, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, BaseEventMetadata, EventMetadata, ContactCreatedEnvelope, ContactUpdatedEnvelope, ContactMergedEnvelope, ContactDeletedEnvelope, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; |
@@ -27,8 +27,7 @@ "use strict"; | ||
exports.getContact = exports.queryContacts = exports.unlabelContact = exports.labelContact = exports.deleteContact = exports.mergeContacts = exports.updateContact = exports.createContact = exports.WebhookIdentityType = 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"); | ||
const query_builder_1 = require("@wix/sdk-runtime/query-builder"); | ||
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys"); | ||
const ambassadorWixContactsV4Contact = __importStar(require("./contacts-v4-contact-contacts.http")); | ||
// @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"); | ||
@@ -39,4 +38,2 @@ 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; | ||
@@ -307,18 +304,2 @@ (function (ContactSourceType) { | ||
})(WebhookIdentityType || (exports.WebhookIdentityType = WebhookIdentityType = {})); | ||
const _contact = { | ||
picture: 'wix.common.Image', | ||
info: '_contactInfo', | ||
memberInfo: '_memberInfo', | ||
}; | ||
const _contactAddress = { address: 'wix.common.Address' }; | ||
const _contactAddressesWrapper = { items: '_contactAddress' }; | ||
const _contactInfo = { | ||
addresses: '_contactAddressesWrapper', | ||
picture: '_contactPicture', | ||
}; | ||
const _contactPicture = { image: 'wix.common.Image' }; | ||
const _memberInfo = { profileInfo: '_profileInfo' }; | ||
const _profileInfo = { photo: 'wix.common.Image' }; | ||
const _queryContactsRequest = {}; | ||
const _queryContactsResponse = { contacts: '_contact' }; | ||
/** | ||
@@ -773,36 +754,5 @@ * Creates a new contact. | ||
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)({ | ||
return (0, query_builder_1.queryBuilder)({ | ||
func: async (payload) => { | ||
@@ -824,11 +774,50 @@ const reqOpts = ambassadorWixContactsV4Contact.queryContacts({ | ||
}, | ||
requestTransformer: (...args) => toAmbassadorRequest(args), | ||
responseTransformer: ({ data }) => fromJSON(data), | ||
requestTransformer: (query) => { | ||
const args = [query, options]; | ||
return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ | ||
...args?.[1], | ||
query: args?.[0], | ||
}); | ||
}, | ||
responseTransformer: ({ data }) => ({ | ||
items: (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(data, [ | ||
{ | ||
transformFn: image_2.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'contacts.picture' }, | ||
{ path: 'contacts.info.picture.image' }, | ||
{ path: 'contacts.memberInfo.profileInfo.photo' }, | ||
], | ||
}, | ||
{ | ||
transformFn: address_2.transformRESTAddressToSDKAddress, | ||
paths: [{ path: 'contacts.info.addresses.items.address' }], | ||
}, | ||
]))?.contacts, | ||
pagingMetadata: (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(data, [ | ||
{ | ||
transformFn: image_2.transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'contacts.picture' }, | ||
{ path: 'contacts.info.picture.image' }, | ||
{ path: 'contacts.memberInfo.profileInfo.photo' }, | ||
], | ||
}, | ||
{ | ||
transformFn: address_2.transformRESTAddressToSDKAddress, | ||
paths: [{ path: 'contacts.info.addresses.items.address' }], | ||
}, | ||
]))?.pagingMetadata, | ||
}), | ||
errorTransformer: (err) => { | ||
const transformedError = (0, velo_1.transformError)(err, requestTransformation); | ||
const transformedError = (0, transform_error_1.transformError)(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { query: '$[0]' }, | ||
singleArgumentUnchanged: false, | ||
}); | ||
throw transformedError; | ||
}, | ||
pagingMethod: 'OFFSET', | ||
transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity), | ||
})({ cursorWithEmptyFilterAndSort: true }); | ||
transformationPaths: {}, | ||
}); | ||
} | ||
@@ -835,0 +824,0 @@ exports.queryContacts = queryContacts; |
import { HttpClient, EventDefinition } from '@wix/sdk-types'; | ||
import { ContactInfo, ContactCreatedEvent, ContactDeletedEvent, ContactMergedEvent, ContactUpdatedEvent, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
import { ContactInfo, ContactCreatedEnvelope, ContactDeletedEnvelope, ContactMergedEnvelope, ContactUpdatedEnvelope, CreateContactOptions, GetContactOptions, MergeContactsOptions, QueryContactsOptions, UpdateContactOptions } from './contacts-v4-contact-contacts.universal'; | ||
export declare const __metadata: { | ||
@@ -48,7 +48,7 @@ PACKAGE_NAME: string; | ||
}>; | ||
export declare const onContactCreated: EventDefinition<ContactCreatedEvent, "wix.contacts.v4.contact_created">; | ||
export declare const onContactUpdated: EventDefinition<ContactUpdatedEvent, "wix.contacts.v4.contact_updated">; | ||
export declare const onContactMerged: EventDefinition<ContactMergedEvent, "wix.contacts.v4.contact_merged">; | ||
export declare const onContactDeleted: EventDefinition<ContactDeletedEvent, "wix.contacts.v4.contact_deleted">; | ||
export declare const onContactCreated: EventDefinition<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">; | ||
export declare const onContactUpdated: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">; | ||
export declare const onContactMerged: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">; | ||
export declare const onContactDeleted: EventDefinition<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">; | ||
export { ContactSourceType, ContactActivityType, EmailTag, PhoneTag, AddressTag, SubdivisionType, ImageProvider, SubscriptionStatus, EmailDeliverabilityStatus, PhoneDeliverabilityStatus, MemberStatus, PrivacyStatus, Role, SortOrder, ContactFieldSet, ContactsFacetType, Action, UpsertContactResponseAction, GetContactResponseType, SubmitOperation, Mode, WebhookIdentityType, } 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, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, MessageEnvelope, IdentificationData, IdentificationDataIdOneOf, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, BaseEventMetadata, EventMetadata, ContactCreatedEvent, ContactUpdatedEvent, ContactMergedEvent, ContactDeletedEvent, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, 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, DomainEventBodyOneOf, EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent, ActionEvent, MessageEnvelope, IdentificationData, IdentificationDataIdOneOf, CreateContactResponseNonNullableFields, UpdateContactResponseNonNullableFields, MergeContactsResponseNonNullableFields, LabelContactResponseNonNullableFields, UnlabelContactResponseNonNullableFields, QueryContactsResponseNonNullableFields, GetContactResponseNonNullableFields, BaseEventMetadata, EventMetadata, ContactCreatedEnvelope, ContactUpdatedEnvelope, ContactMergedEnvelope, ContactDeletedEnvelope, CreateContactOptions, UpdateContactOptions, MergeContactsOptions, QueryContactsOptions, ContactsQueryResult, ContactsQueryBuilder, GetContactOptions, } from './contacts-v4-contact-contacts.universal'; |
@@ -1,7 +0,6 @@ | ||
import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo'; | ||
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error'; | ||
import { queryBuilder } from '@wix/sdk-runtime/query-builder'; | ||
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys'; | ||
import * as ambassadorWixContactsV4Contact from './contacts-v4-contact-contacts.http'; | ||
// @ts-ignore | ||
import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper'; | ||
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address'; | ||
@@ -12,4 +11,2 @@ import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address'; | ||
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths'; | ||
const _toVeloEntity = '$'; | ||
const _fromVeloEntity = '$'; | ||
export var ContactSourceType; | ||
@@ -280,18 +277,2 @@ (function (ContactSourceType) { | ||
})(WebhookIdentityType || (WebhookIdentityType = {})); | ||
const _contact = { | ||
picture: 'wix.common.Image', | ||
info: '_contactInfo', | ||
memberInfo: '_memberInfo', | ||
}; | ||
const _contactAddress = { address: 'wix.common.Address' }; | ||
const _contactAddressesWrapper = { items: '_contactAddress' }; | ||
const _contactInfo = { | ||
addresses: '_contactAddressesWrapper', | ||
picture: '_contactPicture', | ||
}; | ||
const _contactPicture = { image: 'wix.common.Image' }; | ||
const _memberInfo = { profileInfo: '_profileInfo' }; | ||
const _profileInfo = { photo: 'wix.common.Image' }; | ||
const _queryContactsRequest = {}; | ||
const _queryContactsResponse = { contacts: '_contact' }; | ||
/** | ||
@@ -740,36 +721,5 @@ * Creates a new contact. | ||
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({ | ||
return queryBuilder({ | ||
func: async (payload) => { | ||
@@ -791,11 +741,50 @@ const reqOpts = ambassadorWixContactsV4Contact.queryContacts({ | ||
}, | ||
requestTransformer: (...args) => toAmbassadorRequest(args), | ||
responseTransformer: ({ data }) => fromJSON(data), | ||
requestTransformer: (query) => { | ||
const args = [query, options]; | ||
return renameKeysFromSDKRequestToRESTRequest({ | ||
...args?.[1], | ||
query: args?.[0], | ||
}); | ||
}, | ||
responseTransformer: ({ data }) => ({ | ||
items: renameKeysFromRESTResponseToSDKResponse(transformPaths(data, [ | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'contacts.picture' }, | ||
{ path: 'contacts.info.picture.image' }, | ||
{ path: 'contacts.memberInfo.profileInfo.photo' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTAddressToSDKAddress, | ||
paths: [{ path: 'contacts.info.addresses.items.address' }], | ||
}, | ||
]))?.contacts, | ||
pagingMetadata: renameKeysFromRESTResponseToSDKResponse(transformPaths(data, [ | ||
{ | ||
transformFn: transformRESTImageToSDKImage, | ||
paths: [ | ||
{ path: 'contacts.picture' }, | ||
{ path: 'contacts.info.picture.image' }, | ||
{ path: 'contacts.memberInfo.profileInfo.photo' }, | ||
], | ||
}, | ||
{ | ||
transformFn: transformRESTAddressToSDKAddress, | ||
paths: [{ path: 'contacts.info.addresses.items.address' }], | ||
}, | ||
]))?.pagingMetadata, | ||
}), | ||
errorTransformer: (err) => { | ||
const transformedError = transformError(err, requestTransformation); | ||
const transformedError = sdkTransformError(err, { | ||
spreadPathsToArguments: {}, | ||
explicitPathsToArguments: { query: '$[0]' }, | ||
singleArgumentUnchanged: false, | ||
}); | ||
throw transformedError; | ||
}, | ||
pagingMethod: 'OFFSET', | ||
transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity), | ||
})({ cursorWithEmptyFilterAndSort: true }); | ||
transformationPaths: {}, | ||
}); | ||
} | ||
@@ -802,0 +791,0 @@ /** |
{ | ||
"name": "@wix/crm_contacts", | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"publishConfig": { | ||
@@ -42,3 +42,3 @@ "registry": "https://registry.npmjs.org/", | ||
}, | ||
"falconPackageHash": "96125eaadbe2092fc4d6b2e069bdeacb61c76e80d484e6b8c7bab6c8" | ||
"falconPackageHash": "64be7fe781e6c8b161db0727088b3e2b895c71c17067ca49f95b8d2f" | ||
} |
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 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 not supported yet
649921
14377