@mx-cartographer/experiences 9.4.58 → 9.4.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -1
- package/dist/core/api/BeatApi.d.ts +6 -0
- package/dist/core/api/BeatApi.es.js +1 -1
- package/dist/core/api/BeatApi.es.js.map +1 -1
- package/dist/core/api/UserApi.d.ts +2 -1
- package/dist/core/api/UserApi.es.js +6 -5
- package/dist/core/api/UserApi.es.js.map +1 -1
- package/dist/core/constants/ApiEndpoints.d.ts +1 -0
- package/dist/core/constants/ApiEndpoints.es.js +1 -0
- package/dist/core/constants/ApiEndpoints.es.js.map +1 -1
- package/dist/core/stores/AccountStore.d.ts +2 -1
- package/dist/core/stores/AccountStore.es.js +16 -16
- package/dist/core/stores/AccountStore.es.js.map +1 -1
- package/dist/core/stores/BeatStore.d.ts +6 -0
- package/dist/core/stores/BeatStore.es.js +30 -17
- package/dist/core/stores/BeatStore.es.js.map +1 -1
- package/dist/core/stores/BudgetsStore.d.ts +2 -1
- package/dist/core/stores/BudgetsStore.es.js +8 -8
- package/dist/core/stores/BudgetsStore.es.js.map +1 -1
- package/dist/core/stores/CategoryStore.d.ts +7 -0
- package/dist/core/stores/CategoryStore.es.js +18 -7
- package/dist/core/stores/CategoryStore.es.js.map +1 -1
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/core/stores/SettingsStore.d.ts +2 -1
- package/dist/core/stores/SettingsStore.es.js +11 -11
- package/dist/core/stores/SettingsStore.es.js.map +1 -1
- package/dist/core/stores/TransactionStore.d.ts +4 -2
- package/dist/core/stores/TransactionStore.es.js +6 -6
- package/dist/core/stores/TransactionStore.es.js.map +1 -1
- package/dist/core/stores/UserStore.d.ts +15 -1
- package/dist/core/stores/UserStore.es.js +21 -3
- package/dist/core/stores/UserStore.es.js.map +1 -1
- package/dist/core/types/Beat.d.ts +6 -0
- package/dist/core/types/Beat.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +127 -5
- package/dist/core/types/InsightsInstanceSlotData.d.ts +1 -13
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/core/types/RepeatingTransaction.d.ts +2 -0
- package/dist/core/types/RepeatingTransaction.es.js.map +1 -1
- package/dist/core/types/User.d.ts +11 -0
- package/dist/core/types/index.d.ts +2 -3
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.d.ts +31 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +22 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.d.ts +10 -9
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +7 -7
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/beatActions.d.ts +7 -0
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +30 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +67 -24
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/components/BadgedTile.d.ts +22 -0
- package/dist/insights-v2/components/BadgedTile.es.js +46 -0
- package/dist/insights-v2/components/BadgedTile.es.js.map +1 -0
- package/dist/insights-v2/components/BaseLayout.es.js +113 -92
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.d.ts +31 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js +129 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -0
- package/dist/insights-v2/components/Footer.d.ts +1 -4
- package/dist/insights-v2/components/Footer.es.js +30 -21
- package/dist/insights-v2/components/Footer.es.js.map +1 -1
- package/dist/insights-v2/components/Header.es.js +10 -10
- package/dist/insights-v2/components/Header.es.js.map +1 -1
- package/dist/insights-v2/components/InsightErrorCard.d.ts +19 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js +45 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js.map +1 -0
- package/dist/insights-v2/components/InsightTransactionRow.es.js +19 -15
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +26 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js +48 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -0
- package/dist/insights-v2/components/StatusBadge.d.ts +16 -0
- package/dist/insights-v2/components/StatusBadge.es.js +29 -0
- package/dist/insights-v2/components/StatusBadge.es.js.map +1 -0
- package/dist/insights-v2/components/StatusPill.d.ts +11 -2
- package/dist/insights-v2/components/StatusPill.es.js +25 -13
- package/dist/insights-v2/components/StatusPill.es.js.map +1 -1
- package/dist/insights-v2/components/SubHeader.es.js +7 -5
- package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +11 -11
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/EntityLogo.d.ts +26 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js +33 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -0
- package/dist/insights-v2/index.d.ts +6 -0
- package/dist/insights-v2/index.es.js +95 -81
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +50 -44
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/insights-v2/resolveInsightRender.d.ts +30 -0
- package/dist/insights-v2/resolveInsightRender.es.js +10 -0
- package/dist/insights-v2/resolveInsightRender.es.js.map +1 -0
- package/dist/microinsights/cards/InsightCard.es.js +83 -39
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/carousel/BeatList.es.js +24 -24
- package/dist/microinsights/carousel/BeatList.es.js.map +1 -1
- package/dist/notifications/components/NotificationBadge.es.js +12 -10
- package/dist/notifications/components/NotificationBadge.es.js.map +1 -1
- package/dist/notifications/components/NotificationCard.es.js +27 -18
- package/dist/notifications/components/NotificationCard.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +7 -0
- package/dist/transactions/components/shared/TransactionDetails.es.js +159 -143
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionInsightTag.d.ts +26 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js +53 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js.map +1 -0
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +30 -39
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js +15 -15
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionStore.es.js","names":[],"sources":["../../../src/core/stores/TransactionStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { formatISO } from 'date-fns/formatISO'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { endOfUtcDay, startOfUtcDay } from '../utils/DateUtil'\n\nimport { BeatApi, TransactionApi } from '../api'\nimport { TABLE_CONST } from '../constants/Table'\nimport { COLUMN_NAMES, DEFAULT_TRANSACTION } from '../constants/Transaction'\nimport { TransactionType } from '../types'\nimport type { Beat, Tag, Tagging, Transaction, TransactionRule } from '../types'\nimport {\n buildDetailedTransactions,\n flattenTransactionsWithSplits,\n sortAndFilterTransactions,\n} from '../utils/TransactionUtils'\n\nimport { GlobalStore } from './GlobalStore'\nimport { upsertByGuid } from '../utils/upsertByGuid'\n\nexport type TransactionFilter = {\n accounts?: string[]\n dateRange?: { start: Date; end: Date }\n custom?: (value: Transaction) => boolean\n searchTerm?: string\n showSplits?: boolean\n}\n\nexport class TransactionStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new TransactionApi('/', '')\n beatApi = new BeatApi('/', '')\n\n associatedBeats: Beat[] = []\n associatedBeatsLoaded: boolean = false\n associatedBeatsLoading: boolean = false\n transactions: Transaction[] = []\n transactionsLoaded: boolean = false\n transactionsLoading: boolean = false\n taggings: Tagging[] = []\n taggingsLoaded: boolean = false\n taggingsLoading: boolean = false\n tags: Tag[] = []\n tagsLoaded: boolean = false\n tagsLoading: boolean = false\n transactionRules: TransactionRule[] = []\n transactionRulesLoaded: boolean = false\n transactionRulesLoading: boolean = false\n transactionSplitting: boolean = false\n\n cachedStartDate: Date = subDays(startOfToday(), 90)\n filter: TransactionFilter = {}\n isLoading = true\n\n alert = ''\n\n sortColumn = COLUMN_NAMES.DATE\n sortDirection = TABLE_CONST.DESC\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new TransactionApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n this.beatApi = new BeatApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadTransactionData = async () => {\n if (!this.globalStore.accountStore.isAccountDataLoaded) {\n await this.globalStore.accountStore.loadAccountData()\n }\n if (!this.globalStore.categoryStore.categoriesLoaded) {\n await this.globalStore.categoryStore.loadCategories()\n }\n await Promise.all([\n this.loadAssociatedBeats(startOfMonth(new Date())),\n this.loadTags(),\n this.loadTaggings(),\n this.loadTransactionRules(),\n // By default loads 90 days of transactions\n this.loadTransactions(this.cachedStartDate),\n ])\n }\n\n get isTransactionDataLoaded(): boolean {\n return (\n this.associatedBeatsLoaded &&\n this.tagsLoaded &&\n this.taggingsLoaded &&\n this.transactionRulesLoaded &&\n this.transactionsLoaded\n )\n }\n\n get detailedTransactions(): Transaction[] {\n return this.isTransactionDataLoaded\n ? buildDetailedTransactions(\n this.transactions,\n this.globalStore.accountStore.visibleAccounts,\n this.globalStore.categoryStore.categories,\n this.taggings,\n this.globalStore.copyStore.copy.categories,\n )\n : []\n }\n\n get sortedTransactions(): Transaction[] {\n return sortAndFilterTransactions(\n this.filter,\n this.uiStore.expandedSplits,\n this.sortColumn,\n this.sortDirection,\n this.tags,\n this.detailedTransactions,\n )\n }\n\n get sortedTransactionsWithSplits(): Transaction[] {\n return flattenTransactionsWithSplits(this.sortedTransactions, this.detailedTransactions)\n }\n\n setAssociatedBeats = (beats: Beat[]) => {\n this.associatedBeats = beats\n this.associatedBeatsLoading = false\n this.associatedBeatsLoaded = true\n }\n\n setTaggings = (taggings: Tagging[]) => {\n this.taggings = taggings\n this.taggingsLoading = false\n this.taggingsLoaded = true\n }\n\n setTags = (tags: Tag[]) => {\n this.tags = tags\n this.tagsLoading = false\n this.tagsLoaded = true\n }\n\n setTransactionRules = (transactionRules: TransactionRule[]) => {\n this.transactionRules = transactionRules\n this.transactionRulesLoading = false\n this.transactionRulesLoaded = true\n }\n\n setTransactions = (transactions: Transaction[]) => {\n this.transactions = transactions\n this.transactionsLoading = false\n this.transactionsLoaded = true\n }\n\n setAlert = (alert: string) => {\n this.alert = alert\n }\n\n addTag = async (name: string) => {\n try {\n await this.api.addTag({ name } as Tag)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while adding tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n addTagging = async (tagGuid: string, transactionGuid: string) => {\n try {\n await this.api.addTagging({\n tag_guid: tagGuid,\n transaction_guid: transactionGuid,\n } as Tagging)\n } catch (error) {\n console.error('Error occurred while adding tagging:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n addOrUpdateTransactionRule = async (categoryGuid: string, transaction: Transaction) => {\n try {\n const existingRule = this.transactionRules.find(\n (rule: TransactionRule) => rule.guid === transaction.user_transaction_rule_guid,\n ) as TransactionRule | undefined\n\n if (existingRule) {\n await this.api.updateTransactionRule({\n ...existingRule,\n category_guid: categoryGuid,\n description: transaction.description,\n } as TransactionRule)\n } else {\n await this.api.addTransactionRule({\n category_guid: categoryGuid,\n description: transaction.description,\n match_description: transaction.description,\n } as TransactionRule)\n }\n await this.loadTransactionRules()\n } catch (error) {\n console.error('Error occurred while adding/updating transaction rule:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n addTransaction = async (transaction: Transaction) => {\n try {\n const newTransaction = await this.api.addTransaction(transaction)\n\n if (newTransaction) {\n runInAction(() => {\n this.setTransactions(upsertByGuid(this.transactions, newTransaction, true))\n\n // Brokaw may insert the transaction via WebSocket, but it never\n // updates the account balance — that only happens here.\n // See: money-dashboard/src/util/BrokawClient.ts::handleTransactionEvents (search \"setTransactions\")\n // If that handler ever calls updateAccountBalance, remove this call or guard on !existing.\n const balanceChange =\n newTransaction.transaction_type === TransactionType.CREDIT\n ? newTransaction.amount\n : -newTransaction.amount\n\n this.globalStore.accountStore.updateAccountBalance(\n newTransaction.account_guid,\n balanceChange,\n )\n })\n }\n } catch (error) {\n console.error('Error occurred while adding transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n loadAssociatedBeats = async (fromDate?: Date) => {\n if (this.associatedBeatsLoading) return\n\n this.associatedBeatsLoading = true\n const fromDateISO = fromDate ? formatISO(fromDate, { representation: 'date' }) : undefined\n try {\n const beats = await this.beatApi.getBeatsWithAssociatedTransaction(fromDateISO)\n this.setAssociatedBeats(beats)\n } catch (error) {\n console.error('Error occurred while loading associated beats:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setAssociatedBeats([])\n } finally {\n // Clear the in-flight flag even on failure so a later load (e.g. a widget\n // remount) can retry instead of being no-oped by the guard above, which would\n // leave isTransactionDataLoaded false and the list empty until a hard refresh.\n runInAction(() => {\n this.associatedBeatsLoading = false\n })\n }\n }\n\n loadTags = async () => {\n if (this.tagsLoading) return\n\n this.tagsLoading = true\n try {\n const tags = await this.api.getTags()\n this.setTags(tags)\n } catch (error) {\n console.error('Error occurred while loading tags:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n } finally {\n runInAction(() => {\n this.tagsLoading = false\n })\n }\n }\n\n loadTaggings = async () => {\n if (this.taggingsLoading) return\n\n this.taggingsLoading = true\n try {\n const taggings = await this.api.getTaggings()\n this.setTaggings(taggings)\n } catch (error) {\n console.error('Error occurred while loading taggings:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setTaggings([])\n } finally {\n runInAction(() => {\n this.taggingsLoading = false\n })\n }\n }\n\n loadTransactionRules = async () => {\n if (this.transactionRulesLoading) return\n\n this.transactionRulesLoading = true\n try {\n const transactionRules = await this.api.getTransactionRules()\n this.setTransactionRules(transactionRules)\n } catch (error) {\n // Catch so a rejection can't abort the Promise.all in loadTransactionData.\n console.error('Error occurred while loading transaction rules:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setTransactionRules([])\n } finally {\n runInAction(() => {\n this.transactionRulesLoading = false\n })\n }\n }\n\n loadTransactions = async (startDate: Date = this.cachedStartDate) => {\n if (this.transactionsLoading) return\n\n this.setIsLoading(true)\n this.transactionsLoading = true\n\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n startOfUtcDay(startDate),\n endOfUtcDay(startOfToday()),\n )\n this.setTransactions(transactions)\n // Advance the cache only after the range is actually loaded, so the invariant\n // \"we hold transactions back to cachedStartDate\" always holds.\n runInAction(() => {\n this.cachedStartDate = startDate\n })\n } catch (error) {\n console.error('Error occurred while loading transactions:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n } finally {\n // See loadAssociatedBeats: clear the flag on failure so retries aren't no-oped.\n runInAction(() => {\n this.transactionsLoading = false\n })\n this.setIsLoading(false)\n }\n }\n\n modifyTransactionByAccountGuid = (guid: string, updates: Partial<Transaction>) => {\n this.transactions = this.transactions.map((txn) =>\n txn.account_guid === guid ? { ...txn, ...updates } : txn,\n )\n }\n\n removeTag = async (tagGuid: string) => {\n try {\n await this.api.removeTag(tagGuid)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while removing tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n removeTagging = async (taggingGuid: string) => {\n try {\n await this.api.removeTagging(taggingGuid)\n } catch (error) {\n console.error('Error occurred while removing tagging:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n removeTransaction = async (transactionGuid: string) => {\n try {\n await this.api.removeTransaction(transactionGuid)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transactionGuid)\n\n if (index >= 0) {\n const updatedTransactions = [...this.transactions]\n updatedTransactions.splice(index, 1)\n this.setTransactions(updatedTransactions)\n }\n } catch (error) {\n console.error('Error occurred while removing transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n setFilter = (filter: TransactionFilter) => {\n this.filter = filter\n\n // Only reload if the new start date is prior to the cached start date; end date\n // is always today. loadTransactions advances cachedStartDate on success, so we\n // must not advance it here (a skipped/failed load would leave the list empty).\n if (filter.dateRange && isBefore(filter.dateRange.start, this.cachedStartDate)) {\n this.loadTransactions(filter.dateRange.start)\n }\n }\n\n setIsLoading = (isLoading: boolean) => (this.isLoading = isLoading)\n\n splitTransaction = async (transaction: Transaction, splits: Transaction[]) => {\n if (this.transactionSplitting) return\n this.transactionSplitting = true\n\n try {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n const children = [] as Transaction[]\n\n for (let i = 0; i < splits.length; i++) {\n const child = await this.api.addTransaction(splits[i])\n children.push(child)\n }\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n // Remove old parent and any existing children\n const filtered = this.transactions.filter(\n (t) => t.guid !== transaction.guid && t.parent_guid !== transaction.guid,\n )\n\n // Insert updated parent + new children at original position\n this.setTransactions([\n ...filtered.slice(0, index),\n updatedTransaction,\n ...children,\n ...filtered.slice(index),\n ])\n }\n } catch (error) {\n console.error('Error occurred while splitting transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n throw error\n } finally {\n this.transactionSplitting = false\n }\n }\n\n unSplitTransaction = async (guid: string) => {\n try {\n const children = this.transactions.filter((t) => t.parent_guid === guid)\n\n await this.api.removeTransactionSplit(guid)\n\n // Remove children\n const transactions = [...this.transactions]\n children.forEach((child) => {\n const index = transactions.findIndex((t) => t.guid === child.guid)\n\n if (index >= 0) {\n transactions.splice(index, 1)\n }\n })\n\n // Update parent\n const index = transactions.findIndex((t) => t.guid === guid)\n\n runInAction(() => {\n const transaction = transactions[index]\n if (transaction) {\n transaction.has_been_split = false\n }\n\n if (index >= 0) {\n this.setTransactions([\n ...transactions.slice(0, index),\n transaction,\n ...transactions.slice(index + 1),\n ])\n }\n })\n } catch (error) {\n console.error('Error occurred while unsplitting transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n updateTaggings = async (tagGuids: string[], transactionGuid: string) => {\n try {\n const currentTaggings = this.taggings.filter((t) => t.transaction_guid === transactionGuid)\n\n const currentTagGuids = new Set(currentTaggings.map((t) => t.tag_guid))\n const incomingTagGuids = new Set(tagGuids)\n\n // Add new taggings that don't already exist\n for (const tagGuid of tagGuids) {\n if (!currentTagGuids.has(tagGuid)) {\n await this.addTagging(tagGuid, transactionGuid)\n }\n }\n\n // Remove taggings that are no longer needed\n for (const tagging of currentTaggings) {\n if (!incomingTagGuids.has(tagging.tag_guid)) {\n await this.removeTagging(tagging.guid)\n }\n }\n\n await this.loadTaggings()\n } catch (error) {\n console.error('Error occurred while updating taggings:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n updateTag = async (tag: Tag) => {\n try {\n await this.api.updateTag(tag)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while updating tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n updateTransaction = async (transaction: Transaction) => {\n try {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n this.setTransactions([\n ...this.transactions.slice(0, index),\n updatedTransaction,\n ...this.transactions.slice(index + 1),\n ])\n }\n } catch (error) {\n console.error('Error occurred while updating transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n // This is used for loading the transactions list on demand, on clicking the different transactions of the insightful beats.\n loadEmbeddedInstanceTransactions = async (fromDate: Date) => {\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n startOfUtcDay(fromDate),\n endOfUtcDay(startOfToday()),\n )\n this.cachedStartDate = fromDate\n this.transactions = transactions\n } catch (error) {\n console.error('Error occurred while loading embedded instance transactions:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n}\n\nexport class UiStore {\n beginDate = startOfMonth(new Date())\n endDate = endOfMonth(new Date())\n\n expandedSplits = [] as string[]\n height = 550\n width = 1000\n shouldDisableDrawerScroll = false\n\n searchValue = ''\n selectedAccountGuids = [] as string[]\n\n manualTransaction: Transaction = DEFAULT_TRANSACTION\n isAmountValid = false\n\n showInsights = false\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setDateRange = (beginDate: Date, endDate: Date) => {\n this.beginDate = beginDate\n this.endDate = endDate\n }\n\n setIsAmountValid = (valid: boolean) => (this.isAmountValid = valid)\n\n setSearchValue = (searchValue: string) => (this.searchValue = searchValue)\n\n setSelectedAccountGuids = (accountGuids: string[]) => (this.selectedAccountGuids = accountGuids)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowInsights = (showInsights: boolean) => {\n this.showInsights = showInsights\n }\n\n setSize = (height: number, width: number) => {\n this.height = height\n this.width = width\n }\n\n toggleSplit = (guid: string) => {\n const expandedSplits = [...this.expandedSplits]\n const index = this.expandedSplits.findIndex((splitGuid) => splitGuid === guid)\n\n if (index >= 0) {\n expandedSplits.splice(index, 1)\n } else {\n expandedSplits.push(guid)\n }\n\n this.expandedSplits = expandedSplits\n }\n\n clearExpandedSplits = () => {\n if (this.expandedSplits.length === 0) return\n this.expandedSplits = []\n }\n\n updateManualTransaction = (manualTransaction: Transaction) => {\n this.manualTransaction = manualTransaction\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,IAAa,IAAb,MAA8B;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,MAAM,IAAI,EAAe,KAAK,EAAE;AAAA,EAChC,UAAU,IAAI,EAAQ,KAAK,EAAE;AAAA,EAE7B,kBAA0B,CAAC;AAAA,EAC3B,wBAAiC;AAAA,EACjC,yBAAkC;AAAA,EAClC,eAA8B,CAAC;AAAA,EAC/B,qBAA8B;AAAA,EAC9B,sBAA+B;AAAA,EAC/B,WAAsB,CAAC;AAAA,EACvB,iBAA0B;AAAA,EAC1B,kBAA2B;AAAA,EAC3B,OAAc,CAAC;AAAA,EACf,aAAsB;AAAA,EACtB,cAAuB;AAAA,EACvB,mBAAsC,CAAC;AAAA,EACvC,yBAAkC;AAAA,EAClC,0BAAmC;AAAA,EACnC,uBAAgC;AAAA,EAEhC,kBAAwB,EAAQ,EAAa,GAAG,EAAE;AAAA,EAClD,SAA4B,CAAC;AAAA,EAC7B,YAAY;AAAA,EAEZ,QAAQ;AAAA,EAER,aAAa,EAAa;AAAA,EAC1B,gBAAgB,EAAY;AAAA,EAE5B,YAAY,GAA0B;AACpC,SAAK,cAAc,G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AW,MACnC,KAAK,iBAAiB,CAAC;AAAA,EACzB;AAAA,EAEA,0BAAA,CAA2B,MAAmC;AAC5D,SAAK,oBAAoB;AAAA,EAC3B;AACF"}
|
|
1
|
+
{"version":3,"file":"TransactionStore.es.js","names":[],"sources":["../../../src/core/stores/TransactionStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { formatISO } from 'date-fns/formatISO'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { endOfUtcDay, startOfUtcDay } from '../utils/DateUtil'\n\nimport { BeatApi, TransactionApi } from '../api'\nimport { TABLE_CONST } from '../constants/Table'\nimport { COLUMN_NAMES, DEFAULT_TRANSACTION } from '../constants/Transaction'\nimport { TransactionType } from '../types'\nimport type { Beat, Tag, Tagging, Transaction, TransactionRule } from '../types'\nimport {\n buildDetailedTransactions,\n flattenTransactionsWithSplits,\n sortAndFilterTransactions,\n} from '../utils/TransactionUtils'\n\nimport { GlobalStore } from './GlobalStore'\nimport { upsertByGuid } from '../utils/upsertByGuid'\n\nexport type TransactionFilter = {\n accounts?: string[]\n dateRange?: { start: Date; end: Date }\n custom?: (value: Transaction) => boolean\n searchTerm?: string\n showSplits?: boolean\n}\n\nexport class TransactionStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new TransactionApi('/', '')\n beatApi = new BeatApi('/', '')\n\n associatedBeats: Beat[] = []\n associatedBeatsLoaded: boolean = false\n associatedBeatsLoading: boolean = false\n transactions: Transaction[] = []\n transactionsLoaded: boolean = false\n transactionsLoading: boolean = false\n taggings: Tagging[] = []\n taggingsLoaded: boolean = false\n taggingsLoading: boolean = false\n tags: Tag[] = []\n tagsLoaded: boolean = false\n tagsLoading: boolean = false\n transactionRules: TransactionRule[] = []\n transactionRulesLoaded: boolean = false\n transactionRulesLoading: boolean = false\n transactionSplitting: boolean = false\n\n cachedStartDate: Date = subDays(startOfToday(), 90)\n filter: TransactionFilter = {}\n isLoading = true\n\n alert = ''\n\n sortColumn = COLUMN_NAMES.DATE\n sortDirection = TABLE_CONST.DESC\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new TransactionApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n this.beatApi = new BeatApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadTransactionData = async () => {\n if (!this.globalStore.accountStore.isAccountDataLoaded) {\n await this.globalStore.accountStore.loadAccountData()\n }\n if (!this.globalStore.categoryStore.categoriesLoaded) {\n await this.globalStore.categoryStore.loadCategories()\n }\n await Promise.all([\n this.loadAssociatedBeats(startOfMonth(new Date())),\n this.loadTags(),\n this.loadTaggings(),\n this.loadTransactionRules(),\n // By default loads 90 days of transactions\n this.loadTransactions(this.cachedStartDate),\n ])\n }\n\n get isTransactionDataLoaded(): boolean {\n return (\n this.associatedBeatsLoaded &&\n this.tagsLoaded &&\n this.taggingsLoaded &&\n this.transactionRulesLoaded &&\n this.transactionsLoaded\n )\n }\n\n get detailedTransactions(): Transaction[] {\n return this.isTransactionDataLoaded\n ? buildDetailedTransactions(\n this.transactions,\n this.globalStore.accountStore.visibleAccounts,\n this.globalStore.categoryStore.categories,\n this.taggings,\n this.globalStore.copyStore.copy.categories,\n )\n : []\n }\n\n get sortedTransactions(): Transaction[] {\n return sortAndFilterTransactions(\n this.filter,\n this.uiStore.expandedSplits,\n this.sortColumn,\n this.sortDirection,\n this.tags,\n this.detailedTransactions,\n )\n }\n\n get sortedTransactionsWithSplits(): Transaction[] {\n return flattenTransactionsWithSplits(this.sortedTransactions, this.detailedTransactions)\n }\n\n setAssociatedBeats = (beats: Beat[]) => {\n this.associatedBeats = beats\n this.associatedBeatsLoading = false\n this.associatedBeatsLoaded = true\n }\n\n setTaggings = (taggings: Tagging[]) => {\n this.taggings = taggings\n this.taggingsLoading = false\n this.taggingsLoaded = true\n }\n\n setTags = (tags: Tag[]) => {\n this.tags = tags\n this.tagsLoading = false\n this.tagsLoaded = true\n }\n\n setTransactionRules = (transactionRules: TransactionRule[]) => {\n this.transactionRules = transactionRules\n this.transactionRulesLoading = false\n this.transactionRulesLoaded = true\n }\n\n setTransactions = (transactions: Transaction[]) => {\n this.transactions = transactions\n this.transactionsLoading = false\n this.transactionsLoaded = true\n }\n\n setAlert = (alert: string) => {\n this.alert = alert\n }\n\n addTag = async (name: string) => {\n try {\n await this.api.addTag({ name } as Tag)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while adding tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n addTagging = async (tagGuid: string, transactionGuid: string) => {\n try {\n await this.api.addTagging({\n tag_guid: tagGuid,\n transaction_guid: transactionGuid,\n } as Tagging)\n } catch (error) {\n console.error('Error occurred while adding tagging:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n /** Resolves `true` when the rule was saved, `false` when an API call failed. */\n addOrUpdateTransactionRule = async (\n categoryGuid: string,\n transaction: Transaction,\n ): Promise<boolean> => {\n try {\n const existingRule = this.transactionRules.find(\n (rule: TransactionRule) => rule.guid === transaction.user_transaction_rule_guid,\n ) as TransactionRule | undefined\n\n if (existingRule) {\n await this.api.updateTransactionRule({\n ...existingRule,\n category_guid: categoryGuid,\n description: transaction.description,\n } as TransactionRule)\n } else {\n await this.api.addTransactionRule({\n category_guid: categoryGuid,\n description: transaction.description,\n match_description: transaction.description,\n } as TransactionRule)\n }\n await this.loadTransactionRules()\n return true\n } catch (error) {\n console.error('Error occurred while adding/updating transaction rule:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n return false\n }\n }\n\n addTransaction = async (transaction: Transaction) => {\n try {\n const newTransaction = await this.api.addTransaction(transaction)\n\n if (newTransaction) {\n runInAction(() => {\n this.setTransactions(upsertByGuid(this.transactions, newTransaction, true))\n\n // Brokaw may insert the transaction via WebSocket, but it never\n // updates the account balance — that only happens here.\n // See: money-dashboard/src/util/BrokawClient.ts::handleTransactionEvents (search \"setTransactions\")\n // If that handler ever calls updateAccountBalance, remove this call or guard on !existing.\n const balanceChange =\n newTransaction.transaction_type === TransactionType.CREDIT\n ? newTransaction.amount\n : -newTransaction.amount\n\n this.globalStore.accountStore.updateAccountBalance(\n newTransaction.account_guid,\n balanceChange,\n )\n })\n }\n } catch (error) {\n console.error('Error occurred while adding transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n loadAssociatedBeats = async (fromDate?: Date) => {\n if (this.associatedBeatsLoading) return\n\n this.associatedBeatsLoading = true\n const fromDateISO = fromDate ? formatISO(fromDate, { representation: 'date' }) : undefined\n try {\n const beats = await this.beatApi.getBeatsWithAssociatedTransaction(fromDateISO)\n this.setAssociatedBeats(beats)\n } catch (error) {\n console.error('Error occurred while loading associated beats:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setAssociatedBeats([])\n } finally {\n // Clear the in-flight flag even on failure so a later load (e.g. a widget\n // remount) can retry instead of being no-oped by the guard above, which would\n // leave isTransactionDataLoaded false and the list empty until a hard refresh.\n runInAction(() => {\n this.associatedBeatsLoading = false\n })\n }\n }\n\n loadTags = async () => {\n if (this.tagsLoading) return\n\n this.tagsLoading = true\n try {\n const tags = await this.api.getTags()\n this.setTags(tags)\n } catch (error) {\n console.error('Error occurred while loading tags:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n } finally {\n runInAction(() => {\n this.tagsLoading = false\n })\n }\n }\n\n loadTaggings = async () => {\n if (this.taggingsLoading) return\n\n this.taggingsLoading = true\n try {\n const taggings = await this.api.getTaggings()\n this.setTaggings(taggings)\n } catch (error) {\n console.error('Error occurred while loading taggings:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setTaggings([])\n } finally {\n runInAction(() => {\n this.taggingsLoading = false\n })\n }\n }\n\n loadTransactionRules = async () => {\n if (this.transactionRulesLoading) return\n\n this.transactionRulesLoading = true\n try {\n const transactionRules = await this.api.getTransactionRules()\n this.setTransactionRules(transactionRules)\n } catch (error) {\n // Catch so a rejection can't abort the Promise.all in loadTransactionData.\n console.error('Error occurred while loading transaction rules:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n this.setTransactionRules([])\n } finally {\n runInAction(() => {\n this.transactionRulesLoading = false\n })\n }\n }\n\n loadTransactions = async (startDate: Date = this.cachedStartDate) => {\n if (this.transactionsLoading) return\n\n this.setIsLoading(true)\n this.transactionsLoading = true\n\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n startOfUtcDay(startDate),\n endOfUtcDay(startOfToday()),\n )\n this.setTransactions(transactions)\n // Advance the cache only after the range is actually loaded, so the invariant\n // \"we hold transactions back to cachedStartDate\" always holds.\n runInAction(() => {\n this.cachedStartDate = startDate\n })\n } catch (error) {\n console.error('Error occurred while loading transactions:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n } finally {\n // See loadAssociatedBeats: clear the flag on failure so retries aren't no-oped.\n runInAction(() => {\n this.transactionsLoading = false\n })\n this.setIsLoading(false)\n }\n }\n\n modifyTransactionByAccountGuid = (guid: string, updates: Partial<Transaction>) => {\n this.transactions = this.transactions.map((txn) =>\n txn.account_guid === guid ? { ...txn, ...updates } : txn,\n )\n }\n\n removeTag = async (tagGuid: string) => {\n try {\n await this.api.removeTag(tagGuid)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while removing tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n removeTagging = async (taggingGuid: string) => {\n try {\n await this.api.removeTagging(taggingGuid)\n } catch (error) {\n console.error('Error occurred while removing tagging:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n removeTransaction = async (transactionGuid: string) => {\n try {\n await this.api.removeTransaction(transactionGuid)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transactionGuid)\n\n if (index >= 0) {\n const updatedTransactions = [...this.transactions]\n updatedTransactions.splice(index, 1)\n this.setTransactions(updatedTransactions)\n }\n } catch (error) {\n console.error('Error occurred while removing transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n setFilter = (filter: TransactionFilter) => {\n this.filter = filter\n\n // Only reload if the new start date is prior to the cached start date; end date\n // is always today. loadTransactions advances cachedStartDate on success, so we\n // must not advance it here (a skipped/failed load would leave the list empty).\n if (filter.dateRange && isBefore(filter.dateRange.start, this.cachedStartDate)) {\n this.loadTransactions(filter.dateRange.start)\n }\n }\n\n setIsLoading = (isLoading: boolean) => (this.isLoading = isLoading)\n\n splitTransaction = async (transaction: Transaction, splits: Transaction[]) => {\n if (this.transactionSplitting) return\n this.transactionSplitting = true\n\n try {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n const children = [] as Transaction[]\n\n for (let i = 0; i < splits.length; i++) {\n const child = await this.api.addTransaction(splits[i])\n children.push(child)\n }\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n // Remove old parent and any existing children\n const filtered = this.transactions.filter(\n (t) => t.guid !== transaction.guid && t.parent_guid !== transaction.guid,\n )\n\n // Insert updated parent + new children at original position\n this.setTransactions([\n ...filtered.slice(0, index),\n updatedTransaction,\n ...children,\n ...filtered.slice(index),\n ])\n }\n } catch (error) {\n console.error('Error occurred while splitting transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n throw error\n } finally {\n this.transactionSplitting = false\n }\n }\n\n unSplitTransaction = async (guid: string) => {\n try {\n const children = this.transactions.filter((t) => t.parent_guid === guid)\n\n await this.api.removeTransactionSplit(guid)\n\n // Remove children\n const transactions = [...this.transactions]\n children.forEach((child) => {\n const index = transactions.findIndex((t) => t.guid === child.guid)\n\n if (index >= 0) {\n transactions.splice(index, 1)\n }\n })\n\n // Update parent\n const index = transactions.findIndex((t) => t.guid === guid)\n\n runInAction(() => {\n const transaction = transactions[index]\n if (transaction) {\n transaction.has_been_split = false\n }\n\n if (index >= 0) {\n this.setTransactions([\n ...transactions.slice(0, index),\n transaction,\n ...transactions.slice(index + 1),\n ])\n }\n })\n } catch (error) {\n console.error('Error occurred while unsplitting transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n updateTaggings = async (tagGuids: string[], transactionGuid: string) => {\n try {\n const currentTaggings = this.taggings.filter((t) => t.transaction_guid === transactionGuid)\n\n const currentTagGuids = new Set(currentTaggings.map((t) => t.tag_guid))\n const incomingTagGuids = new Set(tagGuids)\n\n // Add new taggings that don't already exist\n for (const tagGuid of tagGuids) {\n if (!currentTagGuids.has(tagGuid)) {\n await this.addTagging(tagGuid, transactionGuid)\n }\n }\n\n // Remove taggings that are no longer needed\n for (const tagging of currentTaggings) {\n if (!incomingTagGuids.has(tagging.tag_guid)) {\n await this.removeTagging(tagging.guid)\n }\n }\n\n await this.loadTaggings()\n } catch (error) {\n console.error('Error occurred while updating taggings:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n updateTag = async (tag: Tag) => {\n try {\n await this.api.updateTag(tag)\n await this.loadTags()\n } catch (error) {\n console.error('Error occurred while updating tag:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n /** Resolves `true` when the transaction was saved, `false` when the API call failed. */\n updateTransaction = async (transaction: Transaction): Promise<boolean> => {\n try {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n this.setTransactions([\n ...this.transactions.slice(0, index),\n updatedTransaction,\n ...this.transactions.slice(index + 1),\n ])\n }\n return true\n } catch (error) {\n console.error('Error occurred while updating transaction:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n return false\n }\n }\n\n // This is used for loading the transactions list on demand, on clicking the different transactions of the insightful beats.\n loadEmbeddedInstanceTransactions = async (fromDate: Date) => {\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n startOfUtcDay(fromDate),\n endOfUtcDay(startOfToday()),\n )\n this.cachedStartDate = fromDate\n this.transactions = transactions\n } catch (error) {\n console.error('Error occurred while loading embedded instance transactions:', error)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n}\n\nexport class UiStore {\n beginDate = startOfMonth(new Date())\n endDate = endOfMonth(new Date())\n\n expandedSplits = [] as string[]\n height = 550\n width = 1000\n shouldDisableDrawerScroll = false\n\n searchValue = ''\n selectedAccountGuids = [] as string[]\n\n manualTransaction: Transaction = DEFAULT_TRANSACTION\n isAmountValid = false\n\n showInsights = false\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setDateRange = (beginDate: Date, endDate: Date) => {\n this.beginDate = beginDate\n this.endDate = endDate\n }\n\n setIsAmountValid = (valid: boolean) => (this.isAmountValid = valid)\n\n setSearchValue = (searchValue: string) => (this.searchValue = searchValue)\n\n setSelectedAccountGuids = (accountGuids: string[]) => (this.selectedAccountGuids = accountGuids)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowInsights = (showInsights: boolean) => {\n this.showInsights = showInsights\n }\n\n setSize = (height: number, width: number) => {\n this.height = height\n this.width = width\n }\n\n toggleSplit = (guid: string) => {\n const expandedSplits = [...this.expandedSplits]\n const index = this.expandedSplits.findIndex((splitGuid) => splitGuid === guid)\n\n if (index >= 0) {\n expandedSplits.splice(index, 1)\n } else {\n expandedSplits.push(guid)\n }\n\n this.expandedSplits = expandedSplits\n }\n\n clearExpandedSplits = () => {\n if (this.expandedSplits.length === 0) return\n this.expandedSplits = []\n }\n\n updateManualTransaction = (manualTransaction: Transaction) => {\n this.manualTransaction = manualTransaction\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgCA,IAAa,IAAb,MAA8B;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,MAAM,IAAI,EAAe,KAAK,EAAE;AAAA,EACh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,CAAoB,MAAoB,KAAK,gBAAgB;AAAA,EAE7D,iBAAA,CAAkB,MAAyB,KAAK,cAAc;AAAA,EAE9D,0BAAA,CAA2B,MAA4B,KAAK,uBAAuB;AAAA,EAEnF,+BAAA,CAAgC,MAC7B,KAAK,4BAA4B;AAAA,EAEpC,kBAAA,CAAmB,MAA0B;AAC3C,SAAK,eAAe;AAAA,EACtB;AAAA,EAEA,UAAA,CAAW,GAAgB,MAAkB;AAC3C,SAAK,SAAS,GACd,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,cAAA,CAAe,MAAiB;AAC9B,UAAM,IAAiB,CAAC,GAAG,KAAK,cAAc,GACxC,IAAQ,KAAK,eAAe,UAAA,CAAW,MAAc,MAAc,CAAI;AAE7E,IAAI,KAAS,IACX,EAAe,OAAO,GAAO,CAAC,IAE9B,EAAe,KAAK,CAAI,GAG1B,KAAK,iBAAiB;AAAA,EACxB;AAAA,EAEA,sBAAA,MAA4B;AAC1B,IAAI,KAAK,eAAe,WAAW,MACnC,KAAK,iBAAiB,CAAC;AAAA,EACzB;AAAA,EAEA,0BAAA,CAA2B,MAAmC;AAC5D,SAAK,oBAAoB;AAAA,EAC3B;AACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { UserApi } from '../api';
|
|
2
|
-
import { User, UserFeature, UserProfile } from '../types';
|
|
2
|
+
import { User, UserFeature, UserInsightProfile, UserProfile } from '../types';
|
|
3
3
|
import { GlobalStore } from './GlobalStore';
|
|
4
4
|
export declare class UserStore {
|
|
5
5
|
globalStore: GlobalStore;
|
|
6
6
|
api: UserApi;
|
|
7
7
|
userFeatures: UserFeature[];
|
|
8
8
|
userFeaturesLoaded: boolean;
|
|
9
|
+
userInsightProfile: UserInsightProfile | null;
|
|
9
10
|
constructor(globalStore: GlobalStore);
|
|
10
11
|
get userProfile(): UserProfile;
|
|
11
12
|
get user(): User;
|
|
@@ -13,4 +14,17 @@ export declare class UserStore {
|
|
|
13
14
|
loadUserFeatures: () => Promise<void>;
|
|
14
15
|
updateUser: (user: User) => Promise<void>;
|
|
15
16
|
updateUserProfile: (userProfile: UserProfile) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Seeds the profile. The host (pulse) loads `user_insight_profile` and pushes it in here;
|
|
19
|
+
* experiences itself never fetches it.
|
|
20
|
+
*/
|
|
21
|
+
setUserInsightProfile: (profile: UserInsightProfile | null) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Merges `fields` into the seeded profile and PUTs the whole profile. The endpoint is an
|
|
24
|
+
* upsert that writes every profile field from the request, so a partial body would null
|
|
25
|
+
* the fields it omits; the merge is what keeps them. Throws if the host has not seeded the
|
|
26
|
+
* profile yet, and rethrows API failures, so a caller driving UI state (e.g. an insight
|
|
27
|
+
* CTA) reports the error instead of silently treating the save as done.
|
|
28
|
+
*/
|
|
29
|
+
updateUserInsightProfile: (fields: Partial<UserInsightProfile>) => Promise<UserInsightProfile>;
|
|
16
30
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { UserApi as t } from "../api/UserApi.es.js";
|
|
2
|
-
import { makeAutoObservable as s } from "mobx";
|
|
3
|
-
var
|
|
2
|
+
import { makeAutoObservable as s, runInAction as o } from "mobx";
|
|
3
|
+
var u = class {
|
|
4
4
|
globalStore;
|
|
5
5
|
api = new t("/", "");
|
|
6
6
|
userFeatures = [];
|
|
7
7
|
userFeaturesLoaded = !1;
|
|
8
|
+
userInsightProfile = null;
|
|
8
9
|
constructor(e) {
|
|
9
10
|
this.globalStore = e, this.api = new t(e.endpoint, e.sessionToken, e.onError), s(this);
|
|
10
11
|
}
|
|
@@ -41,9 +42,26 @@ var i = class {
|
|
|
41
42
|
console.error("Error occurred while updating user profile:", r), this.globalStore.captureException(r, { store: "UserStore" });
|
|
42
43
|
}
|
|
43
44
|
};
|
|
45
|
+
setUserInsightProfile = (e) => {
|
|
46
|
+
this.userInsightProfile = e;
|
|
47
|
+
};
|
|
48
|
+
updateUserInsightProfile = async (e) => {
|
|
49
|
+
if (!this.userInsightProfile) throw new Error("User insight profile has not been loaded; refusing a partial PUT");
|
|
50
|
+
try {
|
|
51
|
+
const r = await this.api.updateUserInsightProfile({
|
|
52
|
+
...this.userInsightProfile,
|
|
53
|
+
...e
|
|
54
|
+
});
|
|
55
|
+
return o(() => {
|
|
56
|
+
this.userInsightProfile = r;
|
|
57
|
+
}), r;
|
|
58
|
+
} catch (r) {
|
|
59
|
+
throw console.error("Error occurred while updating user insight profile:", r), this.globalStore.captureException(r, { store: "UserStore" }), r;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
44
62
|
};
|
|
45
63
|
export {
|
|
46
|
-
|
|
64
|
+
u as UserStore
|
|
47
65
|
};
|
|
48
66
|
|
|
49
67
|
//# sourceMappingURL=UserStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStore.es.js","names":[],"sources":["../../../src/core/stores/UserStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport { UserApi } from '../api'\nimport type { User, UserFeature, UserProfile } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class UserStore {\n globalStore: GlobalStore\n api: UserApi = new UserApi('/', '')\n\n userFeatures: UserFeature[] = []\n userFeaturesLoaded: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new UserApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get userProfile() {\n return this.globalStore.appDataStore.userProfile\n }\n\n get user() {\n return this.globalStore.appDataStore.user\n }\n\n setUserFeatures = (features: UserFeature[]) => {\n this.userFeatures = features\n this.userFeaturesLoaded = true\n }\n\n loadUserFeatures = async () => {\n try {\n const features = await this.api.getUserFeatures()\n this.setUserFeatures(features)\n } catch (e) {\n console.error('Error occurred while loading user features:', e)\n this.globalStore.captureException(e, { store: 'UserStore' })\n this.setUserFeatures([])\n }\n }\n\n updateUser = async (user: User) => {\n try {\n const updatedUser = await this.api.updateUser(user)\n\n this.globalStore.appDataStore.setUser(updatedUser)\n } catch (error) {\n console.error('Error updating User:', error)\n this.globalStore.captureException(error, { store: 'UserStore' })\n throw error\n }\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n try {\n const updatedProfile = await this.api.updateUserProfile(userProfile)\n\n this.globalStore.appDataStore.setUserProfile(updatedProfile)\n } catch (error) {\n console.error('Error occurred while updating user profile:', error)\n this.globalStore.captureException(error, { store: 'UserStore' })\n }\n }\n}\n"],"mappings":";;AAOA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EACA,MAAe,IAAI,EAAQ,KAAK,EAAE;AAAA,EAElC,eAA8B,CAAC;AAAA,EAC/B,qBAA8B;AAAA,
|
|
1
|
+
{"version":3,"file":"UserStore.es.js","names":[],"sources":["../../../src/core/stores/UserStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { UserApi } from '../api'\nimport type { User, UserFeature, UserInsightProfile, UserProfile } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class UserStore {\n globalStore: GlobalStore\n api: UserApi = new UserApi('/', '')\n\n userFeatures: UserFeature[] = []\n userFeaturesLoaded: boolean = false\n userInsightProfile: UserInsightProfile | null = null\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new UserApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get userProfile() {\n return this.globalStore.appDataStore.userProfile\n }\n\n get user() {\n return this.globalStore.appDataStore.user\n }\n\n setUserFeatures = (features: UserFeature[]) => {\n this.userFeatures = features\n this.userFeaturesLoaded = true\n }\n\n loadUserFeatures = async () => {\n try {\n const features = await this.api.getUserFeatures()\n this.setUserFeatures(features)\n } catch (e) {\n console.error('Error occurred while loading user features:', e)\n this.globalStore.captureException(e, { store: 'UserStore' })\n this.setUserFeatures([])\n }\n }\n\n updateUser = async (user: User) => {\n try {\n const updatedUser = await this.api.updateUser(user)\n\n this.globalStore.appDataStore.setUser(updatedUser)\n } catch (error) {\n console.error('Error updating User:', error)\n this.globalStore.captureException(error, { store: 'UserStore' })\n throw error\n }\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n try {\n const updatedProfile = await this.api.updateUserProfile(userProfile)\n\n this.globalStore.appDataStore.setUserProfile(updatedProfile)\n } catch (error) {\n console.error('Error occurred while updating user profile:', error)\n this.globalStore.captureException(error, { store: 'UserStore' })\n }\n }\n\n /**\n * Seeds the profile. The host (pulse) loads `user_insight_profile` and pushes it in here;\n * experiences itself never fetches it.\n */\n setUserInsightProfile = (profile: UserInsightProfile | null) => {\n this.userInsightProfile = profile\n }\n\n /**\n * Merges `fields` into the seeded profile and PUTs the whole profile. The endpoint is an\n * upsert that writes every profile field from the request, so a partial body would null\n * the fields it omits; the merge is what keeps them. Throws if the host has not seeded the\n * profile yet, and rethrows API failures, so a caller driving UI state (e.g. an insight\n * CTA) reports the error instead of silently treating the save as done.\n */\n updateUserInsightProfile = async (fields: Partial<UserInsightProfile>) => {\n if (!this.userInsightProfile) {\n throw new Error('User insight profile has not been loaded; refusing a partial PUT')\n }\n\n try {\n const updated = await this.api.updateUserInsightProfile({\n ...this.userInsightProfile,\n ...fields,\n })\n\n runInAction(() => {\n this.userInsightProfile = updated\n })\n\n return updated\n } catch (error) {\n console.error('Error occurred while updating user insight profile:', error)\n this.globalStore.captureException(error, { store: 'UserStore' })\n throw error\n }\n }\n}\n"],"mappings":";;AAOA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EACA,MAAe,IAAI,EAAQ,KAAK,EAAE;AAAA,EAElC,eAA8B,CAAC;AAAA,EAC/B,qBAA8B;AAAA,EAC9B,qBAAgD;AAAA,EAEhD,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAQ,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE1F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KA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G,KAAK;AAAA,QACR,GAAG;AAAA,MACL,CAAC;AAED,aAAA,EAAA,MAAkB;AAChB,aAAK,qBAAqB;AAAA,MAC5B,CAAC,GAEM;AAAA,IACT,SAAS,GAAO;AACd,oBAAQ,MAAM,uDAAuD,CAAK,GAC1E,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,YAAY,CAAC,GACzD;AAAA,IACR;AAAA,EACF;AACF"}
|
|
@@ -59,6 +59,12 @@ export interface Beat {
|
|
|
59
59
|
institutionGuid?: string | null;
|
|
60
60
|
institutionName?: string | null;
|
|
61
61
|
insights_payload?: InsightsPayload;
|
|
62
|
+
/**
|
|
63
|
+
* Written by firefly, never by a template: true when the insight's Insights 2.0 flag is on (or
|
|
64
|
+
* the envelope is present). It gates which renderer draws the beat — see `resolveInsightRender`.
|
|
65
|
+
* Absent on an older firefly or on cortex, which renders the legacy path unchanged.
|
|
66
|
+
*/
|
|
67
|
+
is_insights_v2?: boolean;
|
|
62
68
|
}
|
|
63
69
|
export interface DataSeries {
|
|
64
70
|
names?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Beat.es.js","names":[],"sources":["../../../src/core/types/Beat.ts"],"sourcesContent":["import { Account } from './Account'\nimport { InsightsPayload } from './Insights'\nimport { Transaction } from './Transaction'\n\nexport interface Beat {\n account_guids: string[] | []\n active_at?: string | number\n associated_transaction_guid?: string | null\n call_to_action?: string | null\n category_guids?: string[] | []\n created_at?: string | number\n cta_clicked_at?: number | null\n data_series: DataSeries\n description?: string\n digest?: string\n dismissed_at?: number | null\n displayed_at?: string | null\n errors?: any\n guid: string\n has_been_displayed: boolean\n html_description?: string\n html_in_description_cta?: string\n html_micro_call_to_action?: string\n html_micro_description?: string\n html_micro_title?: string\n html_short_title?: string\n html_title: string\n icon_color?: string | null\n icon_type?: number | null\n in_description_cta?: string | null\n is_dismissed: boolean\n is_obsolete: boolean\n is_refreshable: boolean\n is_sampled: boolean\n merchant_guids: string[] | []\n metadata?: string | null\n micro_call_to_action?: string | null\n micro_description?: string | null\n micro_title?: string | null\n payload: any\n primary_account?: Account\n primary_account_guid?: string | null\n primary_category_guid?: string | null\n primary_goal_guid?: string | null\n primary_merchant_guid?: string | null\n primary_scheduled_payment_guid?: string | null\n primary_transaction?: Transaction\n primary_transaction_guid?: string | null\n power_action_completed_at?: string | null\n power_action_has_been_completed?: boolean\n scheduled_payment_guids: string[] | []\n short_title?: string | null\n supporting_action?: string | null\n template: string\n title: string\n transaction_guids: string[] | []\n transactions?: Transaction[]\n user_guid: string\n user_verification: UserVerification\n\n // Added for UI: optional institution info for displaying logos\n institutionGuid?: string | null\n institutionName?: string | null\n\n insights_payload?: InsightsPayload\n}\n\nexport interface DataSeries {\n names?: string[]\n types?: string[]\n data?: any[]\n}\n\nexport enum UserVerification {\n UNKNOWN = 0,\n CORRECT = 1,\n INCORRECT = 2,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Beat.es.js","names":[],"sources":["../../../src/core/types/Beat.ts"],"sourcesContent":["import { Account } from './Account'\nimport { InsightsPayload } from './Insights'\nimport { Transaction } from './Transaction'\n\nexport interface Beat {\n account_guids: string[] | []\n active_at?: string | number\n associated_transaction_guid?: string | null\n call_to_action?: string | null\n category_guids?: string[] | []\n created_at?: string | number\n cta_clicked_at?: number | null\n data_series: DataSeries\n description?: string\n digest?: string\n dismissed_at?: number | null\n displayed_at?: string | null\n errors?: any\n guid: string\n has_been_displayed: boolean\n html_description?: string\n html_in_description_cta?: string\n html_micro_call_to_action?: string\n html_micro_description?: string\n html_micro_title?: string\n html_short_title?: string\n html_title: string\n icon_color?: string | null\n icon_type?: number | null\n in_description_cta?: string | null\n is_dismissed: boolean\n is_obsolete: boolean\n is_refreshable: boolean\n is_sampled: boolean\n merchant_guids: string[] | []\n metadata?: string | null\n micro_call_to_action?: string | null\n micro_description?: string | null\n micro_title?: string | null\n payload: any\n primary_account?: Account\n primary_account_guid?: string | null\n primary_category_guid?: string | null\n primary_goal_guid?: string | null\n primary_merchant_guid?: string | null\n primary_scheduled_payment_guid?: string | null\n primary_transaction?: Transaction\n primary_transaction_guid?: string | null\n power_action_completed_at?: string | null\n power_action_has_been_completed?: boolean\n scheduled_payment_guids: string[] | []\n short_title?: string | null\n supporting_action?: string | null\n template: string\n title: string\n transaction_guids: string[] | []\n transactions?: Transaction[]\n user_guid: string\n user_verification: UserVerification\n\n // Added for UI: optional institution info for displaying logos\n institutionGuid?: string | null\n institutionName?: string | null\n\n insights_payload?: InsightsPayload\n /**\n * Written by firefly, never by a template: true when the insight's Insights 2.0 flag is on (or\n * the envelope is present). It gates which renderer draws the beat — see `resolveInsightRender`.\n * Absent on an older firefly or on cortex, which renders the legacy path unchanged.\n */\n is_insights_v2?: boolean\n}\n\nexport interface DataSeries {\n names?: string[]\n types?: string[]\n data?: any[]\n}\n\nexport enum UserVerification {\n UNKNOWN = 0,\n CORRECT = 1,\n INCORRECT = 2,\n}\n"],"mappings":"AA+EA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,YAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA"}
|
|
@@ -15,20 +15,86 @@ export interface DrilldownPayload {
|
|
|
15
15
|
transaction_guid?: string;
|
|
16
16
|
block?: string;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Which envelope a beat was fetched with. `embedded` (the transaction-row pill + details-drawer
|
|
20
|
+
* card) and `notification` are V2 additions; a surface asks for one with `widget_type=` on the fetch.
|
|
21
|
+
*/
|
|
22
|
+
export type WidgetType = 'full' | 'mini' | 'micro' | 'embedded' | 'notification';
|
|
23
|
+
/**
|
|
24
|
+
* V2: the transaction-row tag, its own small section of the `embedded` envelope (the same grammar
|
|
25
|
+
* as `description` / `footer`, with room for a tone or an icon later). Omitted for an insight that
|
|
26
|
+
* tags no transaction row. It deliberately is *not* `short_title`, which stays a per-variant
|
|
27
|
+
* attribute with a second consumer (the bank-holiday sub-header).
|
|
28
|
+
*/
|
|
29
|
+
export interface Pill {
|
|
30
|
+
text: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* V2: facts a drilldown shows that the card does not (e.g. the account number for the Transaction
|
|
34
|
+
* Details drawer). A flat hash shared by every CTA of the card, omitted when the insight has none.
|
|
35
|
+
* Never carries copy or user actions (memo, tags, hide, flag come from the transaction store).
|
|
36
|
+
*/
|
|
37
|
+
export type DrilldownData = Record<string, string | number | boolean | null>;
|
|
18
38
|
export interface InsightsPayload {
|
|
19
|
-
widget_type:
|
|
39
|
+
widget_type: WidgetType;
|
|
20
40
|
instance_slot: InstanceSlot;
|
|
21
|
-
|
|
41
|
+
/**
|
|
42
|
+
* V1 only. The v2 contract carries everything a block needs on `instance_slot.data_series` rows,
|
|
43
|
+
* and omits this key entirely (see the LargeTransactionV2 payload). Blocks that still require it
|
|
44
|
+
* get it as a required field through `BlockProps`, which re-declares it.
|
|
45
|
+
*/
|
|
46
|
+
instance_slot_data?: InsightsInstanceSlotData;
|
|
22
47
|
description: Description;
|
|
23
48
|
primary_cta?: PrimaryCTA;
|
|
24
49
|
secondary_cta?: SecondaryCTA;
|
|
25
50
|
title?: string;
|
|
26
51
|
sub_title?: Subtitle;
|
|
52
|
+
/**
|
|
53
|
+
* V2 rename of `sub_title`: a flat string, with the logo promoted to the payload-level `logo`
|
|
54
|
+
* field below. `sub_title` wins when both are present.
|
|
55
|
+
*/
|
|
56
|
+
subtitle?: string;
|
|
57
|
+
/** V2: header logo paired with the flat `subtitle`: an entity guid or a status icon (`LogoRef`). */
|
|
58
|
+
logo?: LogoRef;
|
|
59
|
+
/** V2: which design branch the backend picked (e.g. `no_merchant`). */
|
|
60
|
+
variant?: string;
|
|
61
|
+
/** V2, `embedded` envelope only: the transaction-row pill. */
|
|
62
|
+
pill?: Pill;
|
|
63
|
+
/** V2: drilldown-only facts, e.g. `{ account_number: 'XXXXXXXX043' }`. */
|
|
64
|
+
drilldown_data?: DrilldownData;
|
|
27
65
|
footer?: Footer;
|
|
28
66
|
guid: string;
|
|
29
67
|
user_guid: string;
|
|
68
|
+
client_guid?: string;
|
|
69
|
+
/** Template name, e.g. `LargeTransactionV2`. */
|
|
70
|
+
template?: string;
|
|
71
|
+
revision?: number;
|
|
72
|
+
/** Unix seconds. */
|
|
73
|
+
created_at?: number;
|
|
74
|
+
/** Unix seconds. */
|
|
75
|
+
updated_at?: number;
|
|
76
|
+
/** Unix seconds. */
|
|
77
|
+
active_at?: number;
|
|
78
|
+
displayed_at?: number | null;
|
|
30
79
|
dismissed_at: number | null;
|
|
80
|
+
cta_clicked_at?: number | null;
|
|
81
|
+
has_been_displayed?: boolean;
|
|
31
82
|
is_dismissed: boolean;
|
|
83
|
+
is_deleted?: boolean;
|
|
84
|
+
is_hidden_by_system?: boolean;
|
|
85
|
+
is_obsolete?: boolean;
|
|
86
|
+
is_refreshable?: boolean;
|
|
87
|
+
is_sampled?: boolean;
|
|
88
|
+
is_zero_state?: boolean;
|
|
89
|
+
status?: string | null;
|
|
90
|
+
/**
|
|
91
|
+
* V2 (LargeTransactionV2 onward): the entities the beat is about, carried on the payload so
|
|
92
|
+
* action blocks do not have to reach back out to the beat envelope.
|
|
93
|
+
*/
|
|
94
|
+
primary_account_guid?: string | null;
|
|
95
|
+
primary_transaction_guid?: string | null;
|
|
96
|
+
primary_category_guid?: string | null;
|
|
97
|
+
primary_merchant_guid?: string | null;
|
|
32
98
|
}
|
|
33
99
|
export interface Legends {
|
|
34
100
|
label: string;
|
|
@@ -51,6 +117,28 @@ export interface Subtitle {
|
|
|
51
117
|
logo?: Logo;
|
|
52
118
|
text: string;
|
|
53
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* A V2 logo, shared by the header (`InsightsPayload.logo`) and every instance-slot row. It takes
|
|
122
|
+
* one of two shapes:
|
|
123
|
+
*
|
|
124
|
+
* - **Entity**: `guid`, whose prefix (`INS-` / `MCH-` / `CAT-`) picks the logo component, plus an
|
|
125
|
+
* optional `fallback_guid` for when that component's asset cannot load. Today that is the
|
|
126
|
+
* category behind an `MCH-` guid, which `MerchantLogo` shows as a tile when the merchant image
|
|
127
|
+
* is missing.
|
|
128
|
+
* - **Status icon**: `icon` (an mx-icons name, e.g. `warning`) and `color` (a theme palette path,
|
|
129
|
+
* e.g. `error.main`), for subheaders that show a state rather than an entity (V1's
|
|
130
|
+
* `logo_name` / `logo_color`).
|
|
131
|
+
*
|
|
132
|
+
* `alt` is the accessible name for either shape. A logo sends one shape; if it sends both, `icon`
|
|
133
|
+
* wins, as `logo_name` does in V1's `SubHeader`.
|
|
134
|
+
*/
|
|
135
|
+
export interface LogoRef {
|
|
136
|
+
alt?: string;
|
|
137
|
+
color?: string;
|
|
138
|
+
fallback_guid?: string;
|
|
139
|
+
guid?: string;
|
|
140
|
+
icon?: string;
|
|
141
|
+
}
|
|
54
142
|
export interface CategoryLogo {
|
|
55
143
|
category_guid: string;
|
|
56
144
|
category_name: string;
|
|
@@ -78,15 +166,26 @@ export interface SecondaryCTA {
|
|
|
78
166
|
variant?: string | null;
|
|
79
167
|
}
|
|
80
168
|
export interface Footer {
|
|
81
|
-
|
|
82
|
-
|
|
169
|
+
/** V1: a pre-formatted date string. */
|
|
170
|
+
date?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The account label, on both V1 and V2. The backend resolves the plurality: one account sends
|
|
173
|
+
* its name (e.g. `Epic Bank`), several send a localized count (e.g. `2 Accounts`), none sends
|
|
174
|
+
* nothing. There is deliberately no separate `accounts` key — see tupac's `footer_account_label`.
|
|
175
|
+
*/
|
|
176
|
+
account?: string;
|
|
177
|
+
/**
|
|
178
|
+
* V2 (LargeTransactionV2 onward): unix seconds, formatted by `Footer` for display.
|
|
179
|
+
* Replaces `date`; `date` wins when a beat somehow sends both.
|
|
180
|
+
*/
|
|
181
|
+
timestamp?: number;
|
|
83
182
|
}
|
|
84
183
|
export declare const BlockType: {
|
|
85
184
|
readonly AccountBlock: "account_block";
|
|
86
185
|
readonly BarChartBlock: "bar_chart_block";
|
|
87
186
|
readonly BudgetBlock: "budget_block";
|
|
88
|
-
readonly CategoryTransactionsBlock: "category_transactions_block";
|
|
89
187
|
readonly ImageBlock: "image_block";
|
|
188
|
+
readonly TransactionBlock: "transaction_block";
|
|
90
189
|
readonly DonutChartBlock: "donut_chart_block";
|
|
91
190
|
readonly DoubleBarChartBlock: "double_bar_chart_block";
|
|
92
191
|
readonly DoubleProgressBarBlock: "double_progress_bar_block";
|
|
@@ -94,7 +193,30 @@ export declare const BlockType: {
|
|
|
94
193
|
readonly SVGImageBlock: "svg_image_block";
|
|
95
194
|
};
|
|
96
195
|
export type BlockType = (typeof BlockType)[keyof typeof BlockType];
|
|
196
|
+
/**
|
|
197
|
+
* A pre-localized row on a V2 instance slot. The backend resolves the copy and formatting; the
|
|
198
|
+
* logo is a `LogoRef` (an entity guid or a status icon, see `logoFromRef`).
|
|
199
|
+
*/
|
|
200
|
+
export interface InstanceSlotRow {
|
|
201
|
+
amount?: number;
|
|
202
|
+
logo?: LogoRef;
|
|
203
|
+
primary_text?: string;
|
|
204
|
+
secondary_text?: string;
|
|
205
|
+
}
|
|
97
206
|
export interface InstanceSlot {
|
|
98
207
|
block: BlockType;
|
|
99
208
|
variant: string | null;
|
|
209
|
+
/**
|
|
210
|
+
* V2: the slot's pre-localized header, sent by tupac's `instance_slot_with_text` /
|
|
211
|
+
* `instance_slot_with_header` envelopes (e.g. `"July 26"`, the transaction date).
|
|
212
|
+
*
|
|
213
|
+
* This is *not* a row field: under `with_header` a row's `secondary_text` is the category, so
|
|
214
|
+
* the header has to come from here. Absent on the `logos_only` envelopes (micro/notification).
|
|
215
|
+
*/
|
|
216
|
+
header_text?: string;
|
|
217
|
+
/**
|
|
218
|
+
* V2 (LargeTransactionV2 onward): rows carried inline on the slot. V1 blocks read their data
|
|
219
|
+
* from `InsightsPayload.instance_slot_data` instead and leave this absent.
|
|
220
|
+
*/
|
|
221
|
+
data_series?: InstanceSlotRow[];
|
|
100
222
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DataSeries, Legends } from '../../core';
|
|
2
|
-
|
|
3
|
-
export interface InsightsInstanceSlotData extends Partial<BarChartBlockData>, Partial<BudgetBlockData>, Partial<DonutChartBlockData>, Partial<DoubleProgressBarBlockData>, Partial<ImageBlockData>, Partial<AccountBlockData>, Partial<SaveExtraBlockData>, Partial<StepChartBlockData>, Partial<SVGImageBlockData>, Partial<CategoryTransactionsBlockData>, Partial<AccountSwitchBlockData>, Partial<TransactionDetailsBlockData>, Partial<CommonProps> {
|
|
2
|
+
export interface InsightsInstanceSlotData extends Partial<BarChartBlockData>, Partial<BudgetBlockData>, Partial<DonutChartBlockData>, Partial<DoubleProgressBarBlockData>, Partial<ImageBlockData>, Partial<AccountBlockData>, Partial<SaveExtraBlockData>, Partial<StepChartBlockData>, Partial<SVGImageBlockData>, Partial<AccountSwitchBlockData>, Partial<TransactionDetailsBlockData>, Partial<CommonProps> {
|
|
4
3
|
}
|
|
5
4
|
interface CommonProps {
|
|
6
5
|
amount?: number;
|
|
@@ -120,18 +119,7 @@ export interface BudgetBlockData {
|
|
|
120
119
|
export interface SVGImageBlockData {
|
|
121
120
|
isCIBC?: boolean;
|
|
122
121
|
}
|
|
123
|
-
export type InsightTransaction = Pick<Transaction, 'amount'> & Partial<Pick<Transaction, 'category_guid' | 'date' | 'description' | 'merchant_guid'>> & {
|
|
124
|
-
merchant_name?: string;
|
|
125
|
-
};
|
|
126
|
-
export interface CategoryTransactionsBlockData {
|
|
127
|
-
primary_transaction?: InsightTransaction;
|
|
128
|
-
}
|
|
129
122
|
export interface TransactionDetailsBlockData {
|
|
130
|
-
/**
|
|
131
|
-
* Explicit subject of the details drawer. Optional: the block falls back to
|
|
132
|
-
* `beat.primary_transaction_guid`, then `beat.transaction_guids[0]`.
|
|
133
|
-
*/
|
|
134
|
-
transaction_guid?: string;
|
|
135
123
|
/** `TopActions` member names, e.g. `['Category', 'Date', 'Memo']`. Omit for the defaults. */
|
|
136
124
|
top_actions?: string[];
|
|
137
125
|
/** `BottomActions` member names, e.g. `['MerchantBudget', 'HideTransaction']`. Omit for defaults. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightsInstanceSlotData.es.js","names":[],"sources":["../../../src/core/types/InsightsInstanceSlotData.ts"],"sourcesContent":["import type { DataSeries, Legends } from '../../core'\
|
|
1
|
+
{"version":3,"file":"InsightsInstanceSlotData.es.js","names":[],"sources":["../../../src/core/types/InsightsInstanceSlotData.ts"],"sourcesContent":["import type { DataSeries, Legends } from '../../core'\n\nexport interface InsightsInstanceSlotData\n extends\n Partial<BarChartBlockData>,\n Partial<BudgetBlockData>,\n Partial<DonutChartBlockData>,\n Partial<DoubleProgressBarBlockData>,\n Partial<ImageBlockData>,\n Partial<AccountBlockData>,\n Partial<SaveExtraBlockData>,\n Partial<StepChartBlockData>,\n Partial<SVGImageBlockData>,\n Partial<AccountSwitchBlockData>,\n Partial<TransactionDetailsBlockData>,\n Partial<CommonProps> {}\n\n//when any of the type is used more than one times, we can use the common props\ninterface CommonProps {\n amount?: number\n date?: string\n legends?: Legends[]\n category_guid?: string\n data_series?: DataSeries | DataSet[]\n transaction_guids?: string[]\n account_guids?: string[]\n primary_transaction_guid?: string\n}\n\n//BarChart Block\nexport interface BarChartBlockData {\n average_amount?: number\n ariaLabel?: string\n}\n\n//DonutChart Block\ninterface Main {\n value: string\n value_type: string\n label: string\n}\nexport interface DonutChartBlockData {\n main: Main\n}\n\n//DoubleBarChart Block\n// TODO : This has to be revisited again to update the below types based on API response once we have the final shape of the data_series for double bar chart from BE\nexport interface LegendProps extends Legends {\n amount: number\n formattedAmount: string\n label: string\n color?: string\n}\n\nexport interface DataSet extends DataSeries {\n ariaLabelComparison: string\n ariaLabelMain: string\n comparison: number\n formattedComparison: string\n formattedMain: string\n label: string\n main: number\n}\n\n//DoubleProgressBar Block\n\ninterface DoubleProgressBarProps {\n label: string\n value: number\n}\nexport interface DoubleProgressBarBlockData {\n doubleProgressBar: {\n previous: DoubleProgressBarProps\n latest: DoubleProgressBarProps\n }\n}\n\n//Image Block\nexport interface ImageBlockData {\n image: string\n}\n\n//Account Block\nexport interface AccountBlockData {\n sub_text: string\n institution_guid?: string\n institution_name?: string\n icon_name?: string\n /** Header bar text (standard card), or the colored category strip label (deposit cards). */\n header_text?: string\n // Deposit variants (Unified Deposit, Unified Deposit Emergency Fund, Savings Account Deposit)\n /** Merchant guid — renders a real merchant logo in the deposit card when present. */\n merchant_guid?: string\n /** Merchant display name — logo alt text and the payer line under the amount. */\n merchant_name?: string\n /** Secondary label beside the amount, e.g. `On {date}, you saved` or `Balance as of MM/DD/YY`. */\n label?: string\n}\n\nexport interface SaveExtraBlockData {\n /** Styled segments `[lead-in, amount digits, trailing copy]`, e.g. `['Save an extra', '100', 'to help your funds grow']`. */\n primary_text?: string[]\n /** Styled segments `[projected balance, caption]`, e.g. `['$8,313.87', 'After payday & projected expenses']`. */\n secondary_text?: string[]\n /** MakeTransfer drilldown: available balance (both variants). */\n available_balance?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: average monthly spend. */\n avg_monthly_spend?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: how long the balance lasts, overlaid on the timeline SVG (e.g. \"2 months, 11 days\"). */\n time_period?: string\n /** SAVE_AN_EXTRA_100: upcoming expenses (the \"Expenses\" figure). */\n upcoming_expenses?: number\n /** SAVE_AN_EXTRA_100: total remaining after expenses. */\n total_remaining?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: date for the \"Your available balances as of {date}\" line. */\n date?: string\n}\n\n//AccountSwitch Block\nexport interface AccountSwitchBlockData {\n discovered_institution_guid: string\n discovered_institution_name: string\n held_institution_guid: string\n held_institution_name: string\n is_connected: boolean\n}\n\n// StepChart Block\nexport interface StepChartBlockData {\n completed_steps: number\n label_1: string\n label_2?: string\n}\n\n//Budgets Blocks\nexport enum BudgetTierType {\n LOW_BUDGET_TIER = 'LOW',\n MEDIUM_BUDGET_TIER = 'MEDIUM',\n OFF_TRACK_BUDGET_TIER = 'OFF_TRACK',\n}\n\nexport type BudgetTierValue = `${BudgetTierType}`\n\nexport interface BudgetLocalizedPayload {\n primary_text?: string\n amount_left_label?: string\n spent_label?: string\n budgeted_label?: string\n}\n\nexport interface BudgetBlockData {\n budget_percent: number\n budget_tier: BudgetTierValue\n category_guid?: string\n merchant_guid?: string\n spent_amount: number\n budgeted_amount: number\n localized_payload: BudgetLocalizedPayload\n}\n\nexport interface SVGImageBlockData {\n isCIBC?: boolean\n}\n\n// TransactionDetails Action Block\n// The drawer's subject is `InsightsPayload.primary_transaction_guid`; only action configuration\n// lives here.\nexport interface TransactionDetailsBlockData {\n /** `TopActions` member names, e.g. `['Category', 'Date', 'Memo']`. Omit for the defaults. */\n top_actions?: string[]\n /** `BottomActions` member names, e.g. `['MerchantBudget', 'HideTransaction']`. Omit for defaults. */\n bottom_actions?: string[]\n}\n"],"mappings":"AAuIA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,kBAAA,OACA,EAAA,qBAAA,UACA,EAAA,wBAAA;AACF,GAAA,CAAA,CAAA"}
|
|
@@ -44,6 +44,8 @@ export interface RepeatingTransaction {
|
|
|
44
44
|
recurrence_day: number;
|
|
45
45
|
repeating_transaction_type: RepeatingType;
|
|
46
46
|
second_recurrence_day?: number;
|
|
47
|
+
/** User confirmation state written by subscription insights (e.g. CONFIRMED, CANCELLED). */
|
|
48
|
+
user_response?: string | null;
|
|
47
49
|
account?: Account;
|
|
48
50
|
transactions: Transaction[];
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatingTransaction.es.js","names":[],"sources":["../../../src/core/types/RepeatingTransaction.ts"],"sourcesContent":["import { Account } from './Account'\nimport { Transaction, TransactionType } from './Transaction'\n\nexport enum Frequency {\n Unknown = 0,\n EveryWeek = 1,\n EveryOtherWeek = 2,\n EveryMonth = 3,\n EveryOtherMonth = 4,\n EveryQuarter = 5,\n EveryOtherQuarter = 6,\n EveryYear = 7,\n TwiceAMonth = 8,\n}\n\nexport enum RecurrenceStatus {\n Paid = 0,\n Missed = 1,\n Upcoming = 2,\n}\n\nexport enum RecurrenceType {\n Expense = 0,\n Income = 1,\n}\n\nexport enum RepeatingType {\n Unknown = 0,\n Subscription = 1,\n Bill = 2,\n Income = 3,\n Transfer = 4,\n}\n\nexport interface RepeatingTransaction {\n // API fields\n guid: string\n account_guid: string\n category_guid?: string | null\n created_by: number\n main_class_guid?: string | null\n member_guid: string\n merchant_guid?: string | null\n user_guid: string\n description: string\n amount: number\n predicted_occurs_on: string\n transaction_type: TransactionType\n recurrence_type: Frequency\n recurrence_day: number\n repeating_transaction_type: RepeatingType\n second_recurrence_day?: number\n\n // UI fields\n account?: Account\n transactions: Transaction[]\n}\n\nexport interface Recurrence {\n accountGuid: string\n amount: number\n categoryGuid: string\n expectedDate: Date\n frequency: Frequency\n institutionGuid: string\n institutionName: string\n merchantGuid?: string | null\n name: string\n occurredOnDate?: Date\n recurrenceDay: number\n repeatingTransactionGuid: string\n secondRecurrenceDay?: number\n status: RecurrenceStatus\n type: RecurrenceType\n transaction?: Transaction\n}\n"],"mappings":"AAGA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,kBAAA,CAAA,IAAA,mBACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,oBAAA,CAAA,IAAA,qBACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,cAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,SAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RepeatingTransaction.es.js","names":[],"sources":["../../../src/core/types/RepeatingTransaction.ts"],"sourcesContent":["import { Account } from './Account'\nimport { Transaction, TransactionType } from './Transaction'\n\nexport enum Frequency {\n Unknown = 0,\n EveryWeek = 1,\n EveryOtherWeek = 2,\n EveryMonth = 3,\n EveryOtherMonth = 4,\n EveryQuarter = 5,\n EveryOtherQuarter = 6,\n EveryYear = 7,\n TwiceAMonth = 8,\n}\n\nexport enum RecurrenceStatus {\n Paid = 0,\n Missed = 1,\n Upcoming = 2,\n}\n\nexport enum RecurrenceType {\n Expense = 0,\n Income = 1,\n}\n\nexport enum RepeatingType {\n Unknown = 0,\n Subscription = 1,\n Bill = 2,\n Income = 3,\n Transfer = 4,\n}\n\nexport interface RepeatingTransaction {\n // API fields\n guid: string\n account_guid: string\n category_guid?: string | null\n created_by: number\n main_class_guid?: string | null\n member_guid: string\n merchant_guid?: string | null\n user_guid: string\n description: string\n amount: number\n predicted_occurs_on: string\n transaction_type: TransactionType\n recurrence_type: Frequency\n recurrence_day: number\n repeating_transaction_type: RepeatingType\n second_recurrence_day?: number\n /** User confirmation state written by subscription insights (e.g. CONFIRMED, CANCELLED). */\n user_response?: string | null\n\n // UI fields\n account?: Account\n transactions: Transaction[]\n}\n\nexport interface Recurrence {\n accountGuid: string\n amount: number\n categoryGuid: string\n expectedDate: Date\n frequency: Frequency\n institutionGuid: string\n institutionName: string\n merchantGuid?: string | null\n name: string\n occurredOnDate?: Date\n recurrenceDay: number\n repeatingTransactionGuid: string\n secondRecurrenceDay?: number\n status: RecurrenceStatus\n type: RecurrenceType\n transaction?: Transaction\n}\n"],"mappings":"AAGA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,kBAAA,CAAA,IAAA,mBACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,oBAAA,CAAA,IAAA,qBACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,cAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,SAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA"}
|
|
@@ -32,6 +32,17 @@ export interface UserProfile {
|
|
|
32
32
|
uses_detailed_notifications: boolean;
|
|
33
33
|
user_guid: string;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Per-user insight settings (pulse `user_insight_profile`). Written by insight CTAs such as
|
|
37
|
+
* designating an emergency savings account or saving a low-balance safety net.
|
|
38
|
+
*/
|
|
39
|
+
export interface UserInsightProfile {
|
|
40
|
+
guid?: string;
|
|
41
|
+
user_guid?: string;
|
|
42
|
+
credit_card_close_to_limit_percentage?: number | null;
|
|
43
|
+
emergency_savings_account_guid?: string | null;
|
|
44
|
+
savings_opportunity_minimum_checking_account_balance?: number | null;
|
|
45
|
+
}
|
|
35
46
|
export type EditableUser = Pick<User, 'birthday' | 'credit_score' | 'email' | 'first_name' | 'last_name' | 'phone' | 'postal_code'>;
|
|
36
47
|
export interface UserFeature {
|
|
37
48
|
feature_guid: string;
|
|
@@ -13,7 +13,7 @@ export type { Expense } from './Expense';
|
|
|
13
13
|
export { ExpenseStatus, ScheduledPaymentTypes } from './Expense';
|
|
14
14
|
export type { DynamicCopyElement, GlobalCopy } from './GlobalCopy';
|
|
15
15
|
export { GoalType, MetaType, TrackType } from './Goal';
|
|
16
|
-
export type { ThemedSVGImageProps, DrilldownPayload, InsightsPayload, InstanceSlot, BlockType, Description, PrimaryCTA, SecondaryCTA, Subtitle, Footer, Logo, CategoryLogo, MerchantLogo, InstitutionLogo, Legends, } from './Insights';
|
|
16
|
+
export type { ThemedSVGImageProps, DrilldownData, DrilldownPayload, InsightsPayload, InstanceSlot, Pill, WidgetType, InstanceSlotRow, BlockType, Description, PrimaryCTA, SecondaryCTA, Subtitle, Footer, Logo, LogoRef, CategoryLogo, MerchantLogo, InstitutionLogo, Legends, } from './Insights';
|
|
17
17
|
export type { Goal, MonthlyCashFlowProfile, RetirementGoalAccount } from './Goal';
|
|
18
18
|
export type { Debt } from './Debt';
|
|
19
19
|
export type { GlobalCaptureException, GlobalErrorHandler, GlobalEventHandler } from './Handlers';
|
|
@@ -30,10 +30,9 @@ export type { Offer } from './Offer';
|
|
|
30
30
|
export type { ScheduledPayment } from './ScheduledPayment';
|
|
31
31
|
export type { Tag, Tagging, Transaction, TransactionRule } from './Transaction';
|
|
32
32
|
export { TransactionStatus, TransactionType } from './Transaction';
|
|
33
|
-
export type { Device, EditableUser, User, UserCommunicationProfile, UserFeature, UserProfile, } from './User';
|
|
33
|
+
export type { Device, EditableUser, User, UserCommunicationProfile, UserFeature, UserInsightProfile, UserProfile, } from './User';
|
|
34
34
|
export { ScreenSize } from './ScreenSize';
|
|
35
35
|
export type { MiniWidgetProps, WidgetProps } from './Widgets';
|
|
36
36
|
export type { Holding } from './Holding';
|
|
37
37
|
export { Frequency, RecurrenceStatus, RecurrenceType, RepeatingType } from './RepeatingTransaction';
|
|
38
38
|
export type { Recurrence, RepeatingTransaction } from './RepeatingTransaction';
|
|
39
|
-
export type { CategoryTransactionsBlockData, InsightTransaction } from './InsightsInstanceSlotData';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ActionBlockProps } from '../mappings/blocks';
|
|
2
|
+
/**
|
|
3
|
+
* `contact_support_block` (`insights_v2.2.md` §7.3) is the help module's contact-support flow,
|
|
4
|
+
* but insights-v2 must **not** import it: hosts that don't ship the Help widget (pulse's webpack
|
|
5
|
+
* config `IgnorePlugin`s every `help` resource inside `@mx-cartographer/experiences/dist`) would
|
|
6
|
+
* get a `webpackMissingModule` stub and crash at import time. So the flow is injected instead:
|
|
7
|
+
*
|
|
8
|
+
* - Feed / mini cards: the host passes `beatActions.onContactSupport` (pulse already threads
|
|
9
|
+
* `beatActions` into `BaseLayout`). `BaseLayout` calls it directly instead of opening a drawer.
|
|
10
|
+
* - Transaction details drawer: the host passes `onContactSupport` to `TransactionDetails`.
|
|
11
|
+
* - The experiences Help widget is itself a host and wires `RequestSupport` through the same hook.
|
|
12
|
+
*
|
|
13
|
+
* The CTA renders disabled (label shown, `aria-disabled`, nothing opens or posts) whenever the
|
|
14
|
+
* client's `enable_support_requests` is off **or** the host supplied no handler — see
|
|
15
|
+
* `isContactSupportCtaDisabled`.
|
|
16
|
+
*
|
|
17
|
+
* This registry entry is only a safety net for a drawer opened by a path that bypassed that gate
|
|
18
|
+
* (e.g. a stale `actionDrawer` state): it hands off to the host handler if one exists, otherwise
|
|
19
|
+
* closes the drawer and shows the generic error.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ContactSupportActionBlock: ((_props: ActionBlockProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether a host must render a CTA disabled. Only `contact_support_block` is gated: by the client's
|
|
26
|
+
* `enable_support_requests` config (default false) and by whether the host actually wired a handler.
|
|
27
|
+
* Every other block is always enabled. No fallback to a host post message when it is off.
|
|
28
|
+
*/
|
|
29
|
+
export declare const isContactSupportCtaDisabled: (block: string | null | undefined, config: {
|
|
30
|
+
enable_support_requests?: boolean;
|
|
31
|
+
}, onContactSupport?: (() => void) | null) => boolean;
|