{ "version": 3, "sources": ["apps/partner-center-client/src/app/invoice/interface.ts", "apps/partner-center-client/src/app/invoice/recipients/recipient-provider.service.ts"], "sourcesContent": ["import { User } from '../core/user';\nimport { Recipient } from '@galaxy/partner-center-client/billing/static/core/recipients';\n\nexport interface InvoiceRecipients {\n invoiceRecipient: Recipient;\n additionalRecipients: Recipient[];\n}\n\nexport function convertUserToRecipient(user: User): Recipient {\n if (!user) {\n return undefined;\n }\n\n return {\n id: user.userId,\n userID: user.unifiedUserId,\n email: user.email,\n firstName: user.firstName,\n lastName: user.lastName,\n };\n}\n\nexport function convertRecipientToUser(recipient: Recipient): User {\n if (!recipient) {\n return undefined;\n }\n\n return {\n userId: recipient.id,\n unifiedUserId: recipient.userID,\n email: recipient.email,\n firstName: recipient.firstName,\n lastName: recipient.lastName,\n };\n}\n\nexport function getRecipientFullName(recipient: Recipient): string {\n const fullName = `${recipient.firstName || ''} ${recipient.lastName || ''}`;\n return fullName.trim();\n}\n", "import { Injectable, Injector } from '@angular/core';\nimport { AccountService } from '../../core/account.service';\nimport { convertRecipientToUser, convertUserToRecipient } from '../interface';\nimport { distinctUntilChanged, EMPTY, firstValueFrom, iif, Observable, of, ReplaySubject, retry, Subject } from 'rxjs';\nimport { catchError, map, switchMap, take } from 'rxjs/operators';\nimport { User } from '../../core/user';\nimport {\n Association,\n CRMApiService,\n CRMAssociationApiService,\n CrmObject,\n FilterGroupOperator,\n FilterOperator,\n GetMultiCrmObjectResponse,\n ListAssociationsRequestInterface,\n} from '@vendasta/crm';\nimport {\n CrmCreateModalContactComponent,\n CrmFieldService,\n CrmPlatformApiService,\n ListObjectTypeDialogData,\n ListObjectTypeDialogResult,\n PageAnalyticsInjectionToken,\n PlatformExtensionFieldIds,\n SelectObjectTypeModalComponent,\n StandardExternalIds,\n tableFiltersInjectionTokenGenerator,\n} from '@galaxy/crm/static';\nimport { AccountGroupService, ProjectionFilter, ReadFilter } from '@galaxy/account-group';\nimport { AddContactAsIamUserForCompanyStatus } from '@vendasta/crm-integrations';\nimport { GalaxyFilterChipInjectionToken, GalaxyFilterOperator } from '@vendasta/galaxy/filter/chips';\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\nimport { TranslateService } from '@ngx-translate/core';\nimport { AddUserDialogComponent } from '../../accounts/add-user-dialog.component';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { Recipient, RecipientProvider } from '@galaxy/partner-center-client/billing/static/core/recipients';\n\ninterface AddRecipientToAccountRequest {\n accountGroupId: string;\n partnerId: string;\n // To filter out existing recipients on account when making a selection\n existingRecipientsOnAccount?: Recipient[];\n}\n\ninterface AssociatedContact {\n contactId: string;\n namespace: string;\n}\n\nenum RecipientStrategy {\n CRMContact = 0,\n VBCUser = 1,\n}\n\nconst RECIPIENT_STRATEGY: RecipientStrategy = RecipientStrategy.CRMContact;\n\n@Injectable()\nexport class RecipientProviderService implements RecipientProvider {\n private readonly addRecipientInterfaceRequested$$ = new ReplaySubject(1);\n\n private readonly contactAssociated$$ = new ReplaySubject(1);\n private readonly contactAssociated$ = this.contactAssociated$$.pipe(distinctUntilChanged());\n\n private readonly selectionResult$$ = new Subject();\n\n constructor(\n private readonly accountService: AccountService,\n private readonly crmAssociationApiService: CRMAssociationApiService,\n private readonly crmAPIService: CRMApiService,\n private readonly accountGroupService: AccountGroupService,\n private readonly platformService: CrmPlatformApiService,\n private readonly fieldService: CrmFieldService,\n private readonly dialog: MatDialog,\n private readonly translate: TranslateService,\n private readonly injector: Injector,\n ) {\n this.addRecipientInterfaceRequested$$.pipe(takeUntilDestroyed()).subscribe((req) => {\n if (RECIPIENT_STRATEGY === RecipientStrategy.CRMContact) {\n this.openAddCRMContactModal(req);\n } else {\n this.openUserModal(req);\n }\n });\n this.contactAssociated$.subscribe((contactId) => this.getContactAndSetResult(contactId));\n }\n\n private async getContactAndSetResult(associatedContact: AssociatedContact): Promise {\n const recipient$ = this.crmAPIService\n .getMultiContact({\n namespace: associatedContact.namespace,\n crmObjectIds: [associatedContact.contactId],\n })\n .pipe(\n map((resp: GetMultiCrmObjectResponse) => {\n if (JSON.stringify(resp?.crmObjects?.[0]) === '{}') {\n throw false;\n }\n\n return resp?.crmObjects?.[0];\n }),\n retry({ delay: 1000 }),\n map((contact) => this.convertContactToRecipient(contact)),\n take(1),\n );\n\n await firstValueFrom(recipient$).then((recipient) => this.selectionResult$$.next(recipient));\n }\n\n private convertContactToRecipient(contact: CrmObject): Recipient {\n const userId =\n this.fieldService.getFieldValueFromCrmObject(contact, PlatformExtensionFieldIds.UserID)?.stringValue ?? '';\n\n const firstNameFieldId = this.fieldService.getFieldId(StandardExternalIds.FirstName);\n const firstName = contact?.fields?.find((field) => field.fieldId === firstNameFieldId)?.stringValue ?? '';\n\n const lastNameFieldId = this.fieldService.getFieldId(StandardExternalIds.LastName);\n const lastName = contact?.fields?.find((field) => field.fieldId === lastNameFieldId)?.stringValue ?? '';\n\n const emailFieldId = this.fieldService.getFieldId(StandardExternalIds.Email);\n const email = contact?.fields?.find((field) => field.fieldId === emailFieldId)?.stringValue ?? '';\n\n return {\n id: contact.crmObjectId,\n userID: userId,\n firstName: firstName,\n lastName: lastName,\n email: email,\n };\n }\n\n private addContactAsIAMUser(contactId: string, companyId: string, namespace: string): Observable {\n return this.platformService.addContactAsIamUserForCompany(contactId, companyId, true).pipe(\n map((response) => {\n if (!response) {\n return AddContactAsIamUserForCompanyStatus.ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_INVALID;\n } else if (\n response === AddContactAsIamUserForCompanyStatus.ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_SUCCEEDED\n ) {\n // success. Stop retrying.\n return response;\n } else if (response === AddContactAsIamUserForCompanyStatus.ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_FAILED) {\n // failure. Stop retrying.\n return response;\n }\n // throw error to poll again\n throw false;\n }),\n retry({ delay: 2000 }),\n switchMap((_) => this.crmAPIService.getMultiContact({ namespace: namespace, crmObjectIds: [contactId] })),\n map((resp: GetMultiCrmObjectResponse) => resp?.crmObjects?.[0]),\n map((contact) => this.convertContactToRecipient(contact)),\n );\n }\n\n private isRecipientUserForCompany(contactId: string, companyId: string): Observable {\n return this.platformService.isContactIamUserForCompany(contactId, companyId);\n }\n\n addRecipientAsUserOnAccount(accountGroupId: string, namespace: string, recipient: Recipient): Observable {\n if (RECIPIENT_STRATEGY === RecipientStrategy.CRMContact) {\n return this.accountGroupService\n .getMulti(\n [accountGroupId],\n new ProjectionFilter({\n accountGroupExternalIdentifiers: true,\n }),\n new ReadFilter({\n includeDeleted: true,\n }),\n )\n .pipe(\n map((accountGroups) => accountGroups?.[0]?.externalIdentifiers?.platformCrmCompanyId ?? ''),\n switchMap((companyId) =>\n this.isRecipientUserForCompany(recipient.id, companyId).pipe(\n map((isContact) => {\n return { isContact: isContact, companyId: companyId };\n }),\n ),\n ),\n switchMap((result) =>\n iif(\n () => result.isContact && !!recipient.userID,\n of(recipient),\n this.addContactAsIAMUser(recipient.id, result.companyId, namespace),\n ),\n ),\n );\n } else {\n return of(recipient);\n }\n }\n\n private retrieveRecipientsUsingAssociatedContacts(\n accountGroupId: string,\n namespace: string,\n ): Observable {\n const companyId$ = this.accountGroupService\n .getMulti(\n [accountGroupId],\n new ProjectionFilter({\n accountGroupExternalIdentifiers: true,\n }),\n new ReadFilter({\n includeDeleted: true,\n }),\n )\n .pipe(map((accountGroups) => accountGroups?.[0]?.externalIdentifiers?.platformCrmCompanyId ?? ''));\n\n const contactAssociations$ = companyId$.pipe(\n switchMap((companyId) =>\n this.crmAssociationApiService.listAssociation({\n namespace: namespace,\n pagingOptions: {\n pageSize: 100,\n },\n filtersV2: {\n operator: FilterGroupOperator.FILTER_GROUP_OPERATOR_AND,\n filters: [\n {\n fieldId: 'to_id',\n operator: FilterOperator.FILTER_OPERATOR_IS,\n values: [\n {\n string: companyId,\n },\n ],\n },\n {\n fieldId: 'association_type',\n operator: FilterOperator.FILTER_OPERATOR_IS,\n values: [\n {\n string: 'Contact-Company',\n },\n ],\n },\n ],\n },\n } as ListAssociationsRequestInterface),\n ),\n catchError((err: HttpErrorResponse) => {\n if (err.status === 408) {\n throw false;\n }\n return EMPTY;\n }),\n retry({ delay: 1000 }),\n map((resp) => resp?.associations?.map((r) => r.fromId) || []),\n );\n\n const contacts$: Observable = contactAssociations$.pipe(\n switchMap((ids) => {\n if (ids?.length === 0) {\n return of([]);\n }\n\n return this.crmAPIService\n .getMultiContact({\n namespace: namespace,\n crmObjectIds: ids,\n })\n .pipe(map((res) => res.crmObjects));\n }),\n );\n\n return contacts$.pipe(\n map((contacts) => {\n return contacts\n .filter((c) => JSON.stringify(c) !== '{}')\n .map((contact) => this.convertContactToRecipient(contact));\n }),\n );\n }\n\n private retrieveRecipientsUsingAccountGroupUsers(accountGroupId: string, partnerId: string): Observable {\n return this.accountService.loadUsers(accountGroupId, partnerId).pipe(\n map((users: User[]) => {\n return users.map((user) => convertUserToRecipient(user));\n }),\n );\n }\n\n retrieveRecipients(accountGroupId: string, partnerId: string): Observable {\n if (RECIPIENT_STRATEGY === RecipientStrategy.CRMContact) {\n return this.retrieveRecipientsUsingAssociatedContacts(accountGroupId, partnerId);\n } else {\n return this.retrieveRecipientsUsingAccountGroupUsers(accountGroupId, partnerId);\n }\n }\n\n private openCreateCRMContactModal(req: AddRecipientToAccountRequest): void {\n const ref = this.dialog.open(CrmCreateModalContactComponent, {\n width: '500px',\n });\n\n ref\n .afterClosed()\n .pipe(take(1))\n .subscribe({\n next: (contact: CrmObject) => {\n this.associateContact(contact.crmObjectId, req.accountGroupId, req.partnerId);\n },\n });\n }\n\n private async associateContact(contactId: string, accountGroupId: string, namespace): Promise {\n const association$ = this.accountGroupService\n .getMulti(\n [accountGroupId],\n new ProjectionFilter({\n accountGroupExternalIdentifiers: true,\n }),\n new ReadFilter({\n includeDeleted: true,\n }),\n )\n .pipe(\n map((accountGroups) => accountGroups?.[0]?.externalIdentifiers?.platformCrmCompanyId ?? ''),\n map((companyId) => {\n return {\n associationType: 'Contact-Company',\n fromId: contactId,\n toId: companyId,\n tags: [],\n };\n }),\n );\n\n const associationCall$ = association$.pipe(\n switchMap((association: Association) => {\n return this.crmAssociationApiService.createAssociation({\n namespace: namespace,\n association: association,\n });\n }),\n map((_) => contactId),\n catchError((err) => (err.status === 409 ? contactId : '')),\n );\n\n await firstValueFrom(associationCall$).then((_) => {\n const result: AssociatedContact = {\n contactId: contactId,\n namespace: namespace,\n };\n\n this.contactAssociated$$.next(result);\n });\n }\n\n private openAddCRMContactModal(req: AddRecipientToAccountRequest): void {\n const dialogRef = this.dialog.open(SelectObjectTypeModalComponent, {\n data: {\n baseColumnIds: [],\n modalTitle: this.translate.instant('BILLING.INVOICE_HEADER.ADD_RECIPIENT'),\n objectType: 'Contact',\n associations: [],\n hideCreateButton: false,\n enableMultiplePreSelectedRows: false,\n singleSelection: true,\n filters: [\n {\n fieldId: this.fieldService.getFieldId(StandardExternalIds.Email),\n filterId: 'filterContactByEmail',\n operator: GalaxyFilterOperator.FILTER_OPERATOR_IS_NOT_EMPTY,\n },\n ],\n } as ListObjectTypeDialogData,\n injector: Injector.create({\n providers: [\n {\n provide: PageAnalyticsInjectionToken,\n useFactory: () => {\n const deps = {\n trackEvent(): void {\n return;\n },\n };\n return deps;\n },\n },\n {\n provide: GalaxyFilterChipInjectionToken,\n useFactory: tableFiltersInjectionTokenGenerator('Contact'),\n },\n ],\n parent: this.injector,\n }),\n });\n\n dialogRef\n .afterClosed()\n .pipe(take(1))\n .subscribe((result: ListObjectTypeDialogResult) => {\n if (result?.clickedCreate) {\n this.openCreateCRMContactModal(req);\n }\n\n if (result?.selectedRows?.length > 0) {\n this.associateContact(result?.selectedRows?.[0]?.id, req.accountGroupId, req.partnerId);\n }\n });\n }\n\n private openUserModal(req: AddRecipientToAccountRequest): void {\n const users = req?.existingRecipientsOnAccount?.map((recipient) => convertRecipientToUser(recipient)) || [];\n const dialogRef: MatDialogRef = this.dialog.open(AddUserDialogComponent, {\n width: '620px',\n });\n dialogRef.componentInstance.accountGroupId = req.accountGroupId;\n dialogRef.componentInstance.partnerId = req.partnerId;\n dialogRef.componentInstance.existingUsers = users;\n dialogRef.componentInstance.showCreateTab = true;\n dialogRef\n .afterClosed()\n .pipe(take(1))\n .subscribe((result) => {\n const recipient = convertUserToRecipient(result?.users?.[0]);\n this.selectionResult$$.next(recipient);\n });\n }\n\n addRecipientsToAccount(\n accountGroupId: string,\n partnerId: string,\n existingRecipientsOnAccount?: Recipient[],\n ): Observable {\n const r: AddRecipientToAccountRequest = {\n accountGroupId: accountGroupId,\n partnerId: partnerId,\n existingRecipientsOnAccount: existingRecipientsOnAccount,\n };\n\n this.addRecipientInterfaceRequested$$.next(r);\n\n return this.selectionResult$$.pipe(take(1));\n }\n}\n"], "mappings": "myBAQM,SAAUA,EAAuBC,EAAU,CAC/C,GAAKA,EAIL,MAAO,CACLC,GAAID,EAAKE,OACTC,OAAQH,EAAKI,cACbC,MAAOL,EAAKK,MACZC,UAAWN,EAAKM,UAChBC,SAAUP,EAAKO,SAEnB,CAEM,SAAUC,GAAuBC,EAAoB,CACzD,GAAKA,EAIL,MAAa,CACXP,OAAQO,EAAUR,GAClBG,cAAeK,EAAUN,OACzBE,MAAOI,EAAUJ,MACjBC,UAAWG,EAAUH,UACrBC,SAAUE,EAAUF,SAExB,CAEM,SAAUG,GAAqBD,EAAoB,CAEvD,MADiB,GAAGA,EAAUH,WAAa,EAAE,IAAIG,EAAUF,UAAY,EAAE,GACzDI,KAAI,CACtB,CCWA,IAAKC,EAAL,SAAKA,EAAiB,CACpBA,OAAAA,EAAAA,EAAA,WAAA,CAAA,EAAA,aACAA,EAAAA,EAAA,QAAA,CAAA,EAAA,UAFGA,CAGL,EAHKA,GAAiB,CAAA,CAAA,EAKhBC,EAAwCD,EAAkBE,WAGnDC,IAAwB,IAAA,CAA/B,IAAOA,EAAP,MAAOA,CAAwB,CAQnCC,YACmBC,EACAC,EACAC,EACAC,EACAC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AGjG,GAAI7C,EAAI6D,eAAgB7D,EAAIqG,SAAS,CAE1F,CAAC,CACL,CAEQnG,cAAcF,EAAiC,CACrD,IAAMuG,EAAQvG,GAAK+I,6BAA6BpI,IAAKY,GAAcyH,GAAuBzH,CAAS,CAAC,GAAK,CAAA,EACnG0H,EAAkD,KAAK9J,OAAOyH,KAAKsC,EAAwB,CAC/FpC,MAAO,QACR,EACDmC,EAAUE,kBAAkBtF,eAAiB7D,EAAI6D,eACjDoF,EAAUE,kBAAkB9C,UAAYrG,EAAIqG,UAC5C4C,EAAUE,kBAAkBC,cAAgB7C,EAC5C0C,EAAUE,kBAAkBE,cAAgB,GAC5CJ,EACGlC,YAAW,EACXrH,KAAK0B,EAAK,CAAC,CAAC,EACZrB,UAAWwE,GAAU,CACpB,IAAMhD,EAAYkF,EAAuBlC,GAAQgC,QAAQ,CAAC,CAAC,EAC3D,KAAK3G,kBAAkB4B,KAAKD,CAAS,CACvC,CAAC,CACL,CAEA+H,uBACEzF,EACAwC,EACA0C,EAAyC,CAEzC,IAAMnD,EAAkC,CACtC/B,eAAgBA,EAChBwC,UAAWA,EACX0C,4BAA6BA,GAG/B,YAAKzJ,iCAAiCkC,KAAKoE,CAAC,EAErC,KAAKhG,kBAAkBF,KAAK0B,EAAK,CAAC,CAAC,CAC5C,yCA1XWzC,GAAwB4K,EAAAC,CAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,EAAAH,EAAAI,CAAA,EAAAJ,EAAAK,CAAA,EAAAL,EAAAM,CAAA,EAAAN,EAAAO,CAAA,EAAAP,EAAAQ,CAAA,EAAAR,EAAApB,CAAA,CAAA,CAAA,wBAAxBxJ,EAAwBqL,QAAxBrL,EAAwBsL,SAAA,CAAA,EAA/B,IAAOtL,EAAPuL,SAAOvL,CAAwB,GAAA", "names": ["convertUserToRecipient", "user", "id", "userId", "userID", "unifiedUserId", "email", "firstName", "lastName", "convertRecipientToUser", "recipient", "getRecipientFullName", "trim", "RecipientStrategy", "RECIPIENT_STRATEGY", "CRMContact", "RecipientProviderService", "constructor", "accountService", "crmAssociationApiService", "crmAPIService", "accountGroupService", "platformService", "fieldService", "dialog", "translate", "injector", "addRecipientInterfaceRequested$$", "ReplaySubject", "contactAssociated$$", "contactAssociated$", "pipe", "distinctUntilChanged", "selectionResult$$", "Subject", "takeUntilDestroyed", "subscribe", "req", "openAddCRMContactModal", "openUserModal", "contactId", "getContactAndSetResult", "associatedContact", "__async", "recipient$", "getMultiContact", "namespace", "crmObjectIds", "map", "resp", "JSON", "stringify", "crmObjects", "retry", "delay", "contact", "convertContactToRecipient", "take", "firstValueFrom", "then", "recipient", "next", "userId", "getFieldValueFromCrmObject", "PlatformExtensionFieldIds", "UserID", "stringValue", "firstNameFieldId", "getFieldId", "StandardExternalIds", "FirstName", "firstName", "fields", "find", "field", "fieldId", "lastNameFieldId", "LastName", "lastName", "emailFieldId", "Email", "email", "id", "crmObjectId", "userID", "addContactAsIAMUser", "companyId", "addContactAsIamUserForCompany", "response", "AddContactAsIamUserForCompanyStatus", "ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_SUCCEEDED", "ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_FAILED", "ADD_CONTACT_AS_IAM_USER_FOR_COMPANY_STATUS_INVALID", "switchMap", "_", "isRecipientUserForCompany", "isContactIamUserForCompany", "addRecipientAsUserOnAccount", "accountGroupId", "getMulti", "ProjectionFilter", "accountGroupExternalIdentifiers", "ReadFilter", "includeDeleted", "accountGroups", "externalIdentifiers", "platformCrmCompanyId", "isContact", "result", "iif", "of", "retrieveRecipientsUsingAssociatedContacts", "listAssociation", "pagingOptions", "pageSize", "filtersV2", "operator", "FilterGroupOperator", "FILTER_GROUP_OPERATOR_AND", "filters", "FilterOperator", "FILTER_OPERATOR_IS", "values", "string", "catchError", "err", "status", "EMPTY", "associations", "r", "fromId", "ids", "length", "res", "contacts", "filter", "c", "retrieveRecipientsUsingAccountGroupUsers", "partnerId", "loadUsers", "users", "user", "convertUserToRecipient", "retrieveRecipients", "openCreateCRMContactModal", "open", "CrmCreateModalContactComponent", "width", "afterClosed", "associateContact", "associationCall$", "associationType", "toId", "tags", "association", "createAssociation", "SelectObjectTypeModalComponent", "data", "baseColumnIds", "modalTitle", "instant", "objectType", "hideCreateButton", "enableMultiplePreSelectedRows", "singleSelection", "filterId", "GalaxyFilterOperator", "FILTER_OPERATOR_IS_NOT_EMPTY", "Injector", "create", "providers", "provide", "PageAnalyticsInjectionToken", "useFactory", "trackEvent", "GalaxyFilterChipInjectionToken", "tableFiltersInjectionTokenGenerator", "parent", "clickedCreate", "selectedRows", "existingRecipientsOnAccount", "convertRecipientToUser", "dialogRef", "AddUserDialogComponent", "componentInstance", "existingUsers", "showCreateTab", "addRecipientsToAccount", "\u0275\u0275inject", "AccountService", "CRMAssociationApiService", "CRMApiService", "AccountGroupService", "CrmPlatformApiService", "CrmFieldService", "MatDialog", "TranslateService", "factory", "\u0275fac", "_RecipientProviderService"] }