({
accountUuid,
emailAddress,
organizationUuid,
displayName,
hasExtraUsageEnabled,
billingType,
accountCreatedAt,
subscriptionCreatedAt,
}: {
accountUuid: string
emailAddress: string
organizationUuid: string | undefined
displayName?: string
hasExtraUsageEnabled?: boolean
billingType?: BillingType
accountCreatedAt?: string
subscriptionCreatedAt?: string
})
| 515 | } |
| 516 | |
| 517 | export function storeOAuthAccountInfo({ |
| 518 | accountUuid, |
| 519 | emailAddress, |
| 520 | organizationUuid, |
| 521 | displayName, |
| 522 | hasExtraUsageEnabled, |
| 523 | billingType, |
| 524 | accountCreatedAt, |
| 525 | subscriptionCreatedAt, |
| 526 | }: { |
| 527 | accountUuid: string |
| 528 | emailAddress: string |
| 529 | organizationUuid: string | undefined |
| 530 | displayName?: string |
| 531 | hasExtraUsageEnabled?: boolean |
| 532 | billingType?: BillingType |
| 533 | accountCreatedAt?: string |
| 534 | subscriptionCreatedAt?: string |
| 535 | }): void { |
| 536 | const accountInfo: AccountInfo = { |
| 537 | accountUuid, |
| 538 | emailAddress, |
| 539 | organizationUuid, |
| 540 | hasExtraUsageEnabled, |
| 541 | billingType, |
| 542 | accountCreatedAt, |
| 543 | subscriptionCreatedAt, |
| 544 | } |
| 545 | if (displayName) { |
| 546 | accountInfo.displayName = displayName |
| 547 | } |
| 548 | saveGlobalConfig(current => { |
| 549 | // For oauthAccount we need to compare content since it's an object |
| 550 | if ( |
| 551 | current.oauthAccount?.accountUuid === accountInfo.accountUuid && |
| 552 | current.oauthAccount?.emailAddress === accountInfo.emailAddress && |
| 553 | current.oauthAccount?.organizationUuid === accountInfo.organizationUuid && |
| 554 | current.oauthAccount?.displayName === accountInfo.displayName && |
| 555 | current.oauthAccount?.hasExtraUsageEnabled === |
| 556 | accountInfo.hasExtraUsageEnabled && |
| 557 | current.oauthAccount?.billingType === accountInfo.billingType && |
| 558 | current.oauthAccount?.accountCreatedAt === accountInfo.accountCreatedAt && |
| 559 | current.oauthAccount?.subscriptionCreatedAt === |
| 560 | accountInfo.subscriptionCreatedAt |
| 561 | ) { |
| 562 | return current |
| 563 | } |
| 564 | return { ...current, oauthAccount: accountInfo } |
| 565 | }) |
| 566 | } |
| 567 |
no test coverage detected