@mx-cartographer/experiences 9.7.71-alpha-ram-usp-2 → 9.7.72

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +2 -5
  2. package/dist/core/stores/GlobalCopyStore.d.ts +0 -6
  3. package/dist/core/stores/GlobalCopyStore.es.js +8 -14
  4. package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
  5. package/dist/core/types/localization/InsightsFeedCopy.d.ts +0 -24
  6. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
  7. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
  8. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +59 -92
  9. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  10. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +1 -9
  11. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +5 -9
  12. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  13. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +5 -5
  14. package/dist/insights-v2/components/BaseLayout.es.js +146 -160
  15. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  16. package/dist/insights-v2/components/CtaStatus.d.ts +1 -14
  17. package/dist/insights-v2/components/CtaStatus.es.js +38 -76
  18. package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
  19. package/dist/insights-v2/components/InsightTransactionRow.d.ts +1 -3
  20. package/dist/insights-v2/components/InsightTransactionRow.es.js +20 -36
  21. package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
  22. package/dist/insights-v2/components/TransactionListCard.d.ts +1 -5
  23. package/dist/insights-v2/components/TransactionListCard.es.js +49 -69
  24. package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
  25. package/dist/insights-v2/components/WithdrawalCard.es.js +8 -10
  26. package/dist/insights-v2/components/WithdrawalCard.es.js.map +1 -1
  27. package/dist/insights-v2/components/shared/StatusSnackbar.d.ts +1 -10
  28. package/dist/insights-v2/components/shared/StatusSnackbar.es.js +11 -27
  29. package/dist/insights-v2/components/shared/StatusSnackbar.es.js.map +1 -1
  30. package/dist/insights-v2/ctaActions/ctaConfig.es.js +9 -23
  31. package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
  32. package/dist/insights-v2/ctaActions/runCtaAction.d.ts +0 -7
  33. package/dist/insights-v2/ctaActions/runCtaAction.es.js +62 -73
  34. package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
  35. package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +1 -10
  36. package/dist/insights-v2/ctaActions/types.d.ts +2 -5
  37. package/dist/insights-v2/ctaActions/useCtaAction.d.ts +0 -6
  38. package/dist/insights-v2/ctaActions/useCtaAction.es.js +27 -32
  39. package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
  40. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +0 -1
  41. package/dist/insights-v2/mappings/actionBlocksKey.es.js +0 -1
  42. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  43. package/dist/insights-v2/mappings/blocks.es.js +68 -74
  44. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  45. package/dist/microinsights/MicroCardTemplate.es.js +17 -21
  46. package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
  47. package/dist/microinsights/cards/InsightCard.es.js +86 -91
  48. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  49. package/dist/microinsights/stores/CopyStore.d.ts +1 -4
  50. package/dist/microinsights/stores/CopyStore.es.js +10 -13
  51. package/dist/microinsights/stores/CopyStore.es.js.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.d.ts +0 -6
  54. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +0 -168
  55. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +0 -1
  56. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +0 -4
  57. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +0 -10
  58. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +0 -1
  59. package/dist/insights-v2/components/shared/elevation.d.ts +0 -16
  60. package/dist/insights-v2/components/shared/elevation.es.js +0 -15
  61. package/dist/insights-v2/components/shared/elevation.es.js.map +0 -1
  62. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +0 -115
  63. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +0 -1
  64. package/dist/microinsights/cards/MicroCtaStatus.d.ts +0 -18
  65. package/dist/microinsights/cards/MicroCtaStatus.es.js +0 -44
  66. package/dist/microinsights/cards/MicroCtaStatus.es.js.map +0 -1
@@ -1,15 +0,0 @@
1
- import { alpha as t, getOverlayAlpha as p } from "@mui/material/styles";
2
- var o = {
3
- 1: "0px 2px 8px rgba(0, 0, 0, 0.12)",
4
- 16: "0px 12px 20px rgba(0, 0, 0, 0.22)"
5
- }, l = (r, e) => {
6
- if (r.palette.mode !== "dark") return "none";
7
- const a = t(r.palette.common.white, p(e));
8
- return `linear-gradient(${a}, ${a})`;
9
- };
10
- export {
11
- o as ELEVATION_SHADOW,
12
- l as elevationOverlay
13
- };
14
-
15
- //# sourceMappingURL=elevation.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["import { alpha, getOverlayAlpha, type Theme } from '@mui/material/styles'\n\n/**\n * Figma elevation effects, as box-shadows. The MUI theme's `shadows[n]` are Material's three-layer\n * shadows; the insights designs use these single drop shadows instead.\n */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: cards and rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs and snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n\n/**\n * The surface tint MUI's Paper adds in dark mode at this elevation (`paper-elevation-n` in Figma),\n * for surfaces that are not a Paper. `none` in light mode.\n */\nexport const elevationOverlay = (theme: Theme, elevation: number): string => {\n if (theme.palette.mode !== 'dark') return 'none'\n\n const tint = alpha(theme.palette.common.white, getOverlayAlpha(elevation))\n\n return `linear-gradient(${tint}, ${tint})`\n}\n"],"mappings":";AAMA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN,GAMa,IAAA,CAAoB,GAAc,MAA8B;AAC3E,MAAI,EAAM,QAAQ,SAAS,OAAQ,QAAO;AAE1C,QAAM,IAAO,EAAM,EAAM,QAAQ,OAAO,OAAO,EAAgB,CAAS,CAAC;AAEzE,SAAO,mBAAmB,CAAA,KAAS,CAAA;AACrC"}
@@ -1,115 +0,0 @@
1
- import { ANALYTICS_EVENTS_CONFIG as i } from "../analytics/analyticsEventsConfig.es.js";
2
- import { resolveAnalyticsEvent as I } from "../analytics/resolveAnalyticsEvent.es.js";
3
- import { ctaHandlers as U } from "./ctaHandlers.es.js";
4
- var n = {
5
- UNKNOWN: "USER_RESPONSE_UNKNOWN",
6
- CONFIRMED: "CONFIRMED",
7
- CANCELLED: "CANCELLED",
8
- NEVER_SUBSCRIBED: "NEVER_SUBSCRIBED",
9
- WRONG_FREQUENCY: "WRONG_FREQUENCY",
10
- ONE_TIME_PURCHASE: "ONE_TIME_PURCHASE",
11
- OTHER: "OTHER"
12
- }, l = {
13
- [n.CONFIRMED]: i.SUBSCRIPTION_CONFIRMED,
14
- [n.NEVER_SUBSCRIBED]: i.SUBSCRIPTION_NEVER_SUBSCRIBED,
15
- [n.CANCELLED]: i.SUBSCRIPTION_CANCELLED,
16
- [n.ONE_TIME_PURCHASE]: i.SUBSCRIPTION_ONE_TIME_PURCHASE,
17
- [n.WRONG_FREQUENCY]: i.SUBSCRIPTION_WRONG_FREQUENCY
18
- }, v = {
19
- [n.OTHER]: "Other",
20
- [n.UNKNOWN]: "Default - Response Unknown"
21
- }, O = (e, t) => {
22
- const r = e.copyStore.copy.insights_feed?.general?.[t];
23
- return typeof r == "string" && r.trim() ? r : void 0;
24
- }, E = ({ beat: e, stores: t }) => {
25
- const r = e.primary_repeating_transaction_guid;
26
- return r ? t.recurringTransactionsStore.repeatingTransactions.find((a) => a.guid === r) : void 0;
27
- }, S = ({ beat: e, stores: t, hostActions: r }, a) => {
28
- try {
29
- r?.onAnalyticsEvent?.(I(a, e));
30
- } catch (o) {
31
- t.captureException(o, {
32
- store: "ctaActions",
33
- template: e.template,
34
- handler: "subscriptionAnswer"
35
- });
36
- }
37
- }, C = async (e, t) => {
38
- const r = {
39
- beat: e.beat,
40
- stores: e.stores,
41
- hostActions: e.hostActions ?? {},
42
- cta: {
43
- label: "",
44
- block: ""
45
- },
46
- slot: "primary",
47
- params: {
48
- userResponse: t,
49
- repeatingTransactionGuid: e.beat.primary_repeating_transaction_guid
50
- }
51
- };
52
- try {
53
- return await U.updateRepeatingTransactionResponse(r), !0;
54
- } catch (a) {
55
- return e.stores.captureException(a, {
56
- store: "ctaActions",
57
- template: e.beat.template,
58
- handler: "updateRepeatingTransactionResponse"
59
- }), !1;
60
- }
61
- }, h = async (e, t) => {
62
- const r = l[t];
63
- if (r && S(e, r), !await C(e, t)) throw new Error("Failed to save the subscription answer");
64
- }, m = (e) => S(e, i.SUBSCRIPTION_NOT_SUBSCRIBED), _ = /* @__PURE__ */ new Set(), g = async (e) => {
65
- const t = e.beat.primary_repeating_transaction_guid;
66
- if (!t || _.has(t)) return !1;
67
- const r = E(e)?.user_response ?? n.UNKNOWN, a = l[r]?.action ?? v[r], o = i.SUBSCRIPTION_UNDO;
68
- S(e, {
69
- ...o,
70
- action: `${o.action} - Previous action: ${a}`
71
- }), _.add(t);
72
- try {
73
- return await C(e, n.UNKNOWN);
74
- } finally {
75
- _.delete(t);
76
- }
77
- }, u = /* @__PURE__ */ new WeakSet(), T = (e) => {
78
- !e.beat.primary_repeating_transaction_guid || E(e) || u.has(e.stores) || (u.add(e.stores), e.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {
79
- E(e) || u.delete(e.stores);
80
- }));
81
- }, B = ({ statusLabels: e, statusVariant: t, sx: r, answeredTitle: a, answerCounts: o = () => !0 }) => ({
82
- prepare: T,
83
- presenter: (s) => {
84
- const N = E(s);
85
- if (!s.beat.primary_transaction_guid || !N) return {
86
- kind: "hidden",
87
- hideAll: !0
88
- };
89
- const p = N.user_response;
90
- if (!p || p === n.UNKNOWN || !o(s, N)) return;
91
- const c = p === n.CONFIRMED, R = O(s.stores, c ? e.positive : e.negative), d = O(s.stores, "undo");
92
- return !R || !d ? { kind: "hidden" } : {
93
- kind: "status",
94
- tone: c ? "success" : "neutral",
95
- icon: c ? "check_circle" : "cancel",
96
- label: R,
97
- variant: t,
98
- sx: r,
99
- title: a?.(s.stores.copyStore.copy) || void 0,
100
- action: {
101
- label: d,
102
- onPress: () => g(s)
103
- }
104
- };
105
- }
106
- });
107
- export {
108
- n as USER_RESPONSE,
109
- h as answerSubscription,
110
- E as repeatingTransactionOf,
111
- m as reportSubscriptionMarkedIncorrect,
112
- B as subscriptionEntryStep
113
- };
114
-
115
- //# sourceMappingURL=subscriptionAnswer.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscriptionAnswer.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/subscriptionAnswer.ts"],"sourcesContent":["import type { SxProps } from '@mui/system'\nimport type { CtaStatusVariant } from '../components/CtaStatus'\nimport type { GlobalCopy } from '../../core/types/GlobalCopy'\nimport type { GlobalStore } from '../../core/stores/GlobalStore'\nimport type { InsightsFeedCopy } from '../../core/types/localization/InsightsFeedCopy'\nimport type { RepeatingTransaction } from '../../core/types/RepeatingTransaction'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../analytics/analyticsEventsConfig'\nimport { resolveAnalyticsEvent } from '../analytics/resolveAnalyticsEvent'\nimport type { BeatActions } from '../beatActions'\nimport { ctaHandlers } from './ctaHandlers'\nimport type { CtaContext, CtaPresentation, CtaStateContext, CtaStep } from './types'\n\n/**\n * The shared subscription status CTA. The answer lives on the repeating transaction\n * (`user_response`), read at render time; the words are general copy, as pulse's were. Imports\n * nothing from runCtaAction, so ctaConfig can build entries at load time.\n */\n\n/** firefly's `user_response` names (Atlas::Sherlock::RepeatingTransaction::UserResponse). */\nexport const USER_RESPONSE = {\n UNKNOWN: 'USER_RESPONSE_UNKNOWN',\n CONFIRMED: 'CONFIRMED',\n CANCELLED: 'CANCELLED',\n NEVER_SUBSCRIBED: 'NEVER_SUBSCRIBED',\n WRONG_FREQUENCY: 'WRONG_FREQUENCY',\n ONE_TIME_PURCHASE: 'ONE_TIME_PURCHASE',\n OTHER: 'OTHER',\n} as const\n\ntype StateCtx = Pick<CtaStateContext, 'beat' | 'stores'>\ntype WriteCtx = StateCtx & { hostActions?: BeatActions }\n\n/** A key of `insights_feed.general` naming a status word, e.g. `confirmed`. */\ntype GeneralCopyKey = keyof InsightsFeedCopy['general']\n\n// Pulse's Subscription Confirmation event per answer.\nconst ANSWER_EVENTS: Record<string, AnalyticsEventConfigEntry> = {\n [USER_RESPONSE.CONFIRMED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CONFIRMED,\n [USER_RESPONSE.NEVER_SUBSCRIBED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NEVER_SUBSCRIBED,\n [USER_RESPONSE.CANCELLED]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_CANCELLED,\n [USER_RESPONSE.ONE_TIME_PURCHASE]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_ONE_TIME_PURCHASE,\n [USER_RESPONSE.WRONG_FREQUENCY]: ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_WRONG_FREQUENCY,\n}\n\n// Undo's \"Previous action\" for answers with no event of their own (pulse's wording).\nconst UNDO_PREVIOUS_ACTION_FALLBACK: Record<string, string> = {\n [USER_RESPONSE.OTHER]: 'Other',\n [USER_RESPONSE.UNKNOWN]: 'Default - Response Unknown',\n}\n\n/** A non-empty `insights_feed.general` word, or undefined. */\nconst generalWord = (stores: GlobalStore, key: GeneralCopyKey): string | undefined => {\n const value = stores.copyStore.copy.insights_feed?.general?.[key]\n\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\n/** The beat's repeating transaction, or undefined until loaded / when absent. */\nexport const repeatingTransactionOf = ({\n beat,\n stores,\n}: StateCtx): RepeatingTransaction | undefined => {\n const guid = beat.primary_repeating_transaction_guid\n\n return guid\n ? stores.recurringTransactionsStore.repeatingTransactions.find((rt) => rt.guid === guid)\n : undefined\n}\n\nconst reportEvent = ({ beat, stores, hostActions }: WriteCtx, event: AnalyticsEventConfigEntry) => {\n try {\n hostActions?.onAnalyticsEvent?.(resolveAnalyticsEvent(event, beat))\n } catch (error) {\n stores.captureException(error, {\n store: 'ctaActions',\n template: beat.template,\n handler: 'subscriptionAnswer',\n })\n }\n}\n\n/** Writes the beat's `user_response`; true on success, never throws. */\nconst writeUserResponse = async (ctx: WriteCtx, userResponse: string): Promise<boolean> => {\n const handlerCtx: CtaContext = {\n beat: ctx.beat,\n stores: ctx.stores,\n hostActions: ctx.hostActions ?? {},\n cta: { label: '', block: '' },\n slot: 'primary',\n params: { userResponse, repeatingTransactionGuid: ctx.beat.primary_repeating_transaction_guid },\n }\n\n try {\n await ctaHandlers.updateRepeatingTransactionResponse(handlerCtx)\n\n return true\n } catch (error) {\n ctx.stores.captureException(error, {\n store: 'ctaActions',\n template: ctx.beat.template,\n handler: 'updateRepeatingTransactionResponse',\n })\n\n return false\n }\n}\n\n/** Reports the answer (as pulse), then saves it; rejects on failure so a survey can offer Try Again. */\nexport const answerSubscription = async (ctx: WriteCtx, userResponse: string): Promise<void> => {\n const event = ANSWER_EVENTS[userResponse]\n\n if (event) reportEvent(ctx, event)\n if (!(await writeUserResponse(ctx, userResponse))) {\n throw new Error('Failed to save the subscription answer')\n }\n}\n\n/** The \"No\" press, before a reason is picked (pulse's DATA_IS_INCORRECT). */\nexport const reportSubscriptionMarkedIncorrect = (ctx: WriteCtx): void =>\n reportEvent(ctx, ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_NOT_SUBSCRIBED)\n\n// Repeating transactions with an Undo in flight; a second press is ignored.\nconst undoing = new Set<string>()\n\n/** Undo: writes USER_RESPONSE_UNKNOWN, reporting the answer it undoes. */\nconst undoSubscriptionAnswer = async (ctx: WriteCtx): Promise<boolean> => {\n const guid = ctx.beat.primary_repeating_transaction_guid\n\n if (!guid || undoing.has(guid)) return false\n\n const previous = repeatingTransactionOf(ctx)?.user_response ?? USER_RESPONSE.UNKNOWN\n const previousAction = ANSWER_EVENTS[previous]?.action ?? UNDO_PREVIOUS_ACTION_FALLBACK[previous]\n const undo = ANALYTICS_EVENTS_CONFIG.SUBSCRIPTION_UNDO\n\n reportEvent(ctx, { ...undo, action: `${undo.action} - Previous action: ${previousAction}` })\n undoing.add(guid)\n\n try {\n return await writeUserResponse(ctx, USER_RESPONSE.UNKNOWN)\n } finally {\n undoing.delete(guid)\n }\n}\n\n// One load per store, shared by every subscription card on the page.\nconst loadedStores = new WeakSet<GlobalStore>()\n\nconst ensureRepeatingTransactions = (ctx: StateCtx): void => {\n if (!ctx.beat.primary_repeating_transaction_guid || repeatingTransactionOf(ctx)) return\n if (loadedStores.has(ctx.stores)) return\n\n loadedStores.add(ctx.stores)\n // The store reports a failure itself; while the record is still missing, the next card retries.\n void ctx.stores.recurringTransactionsStore.loadRepeatingTransactions().then(() => {\n if (!repeatingTransactionOf(ctx)) loadedStores.delete(ctx.stores)\n })\n}\n\nexport interface SubscriptionEntryOptions {\n /** The `insights_feed.general` words for a positive (`CONFIRMED`) and any other answer. */\n statusLabels: { positive: GeneralCopyKey; negative: GeneralCopyKey }\n /** Whether the stored answer applies to this beat (default: every answer counts). */\n answerCounts?: (ctx: CtaStateContext, repeating: RepeatingTransaction) => boolean\n /** Which `CtaStatus` design the answered status uses (default `tinted`). */\n statusVariant?: CtaStatusVariant\n /** Status bar overrides for this step (e.g. a taller bar). */\n sx?: SxProps\n /** The card's title once answered, from copy (mini and micro retitle; full keeps its title). */\n answeredTitle?: (copy: GlobalCopy) => string | undefined\n}\n\n/**\n * The step a beat's `action_key` names: the button until answered, then the status with Undo. No\n * repeating transaction or transaction: no CTAs, as pulse. A missing word draws nothing.\n */\nexport const subscriptionEntryStep = ({\n statusLabels,\n statusVariant,\n sx,\n answeredTitle,\n answerCounts = () => true,\n}: SubscriptionEntryOptions): CtaStep => ({\n // Every card loads it, mini too, for the row's live frequency (WEC-2147).\n prepare: ensureRepeatingTransactions,\n presenter: (ctx): CtaPresentation | undefined => {\n const repeating = repeatingTransactionOf(ctx)\n\n if (!ctx.beat.primary_transaction_guid || !repeating) return { kind: 'hidden', hideAll: true }\n\n const answer = repeating.user_response\n\n if (!answer || answer === USER_RESPONSE.UNKNOWN || !answerCounts(ctx, repeating)) {\n return undefined\n }\n\n const positive = answer === USER_RESPONSE.CONFIRMED\n const label = generalWord(ctx.stores, positive ? statusLabels.positive : statusLabels.negative)\n const undoLabel = generalWord(ctx.stores, 'undo')\n\n if (!label || !undoLabel) return { kind: 'hidden' }\n\n return {\n kind: 'status',\n tone: positive ? 'success' : 'neutral',\n icon: positive ? 'check_circle' : 'cancel',\n label,\n variant: statusVariant,\n sx,\n title: answeredTitle?.(ctx.stores.copyStore.copy) || undefined,\n action: { label: undoLabel, onPress: () => undoSubscriptionAnswer(ctx) },\n }\n },\n})\n"],"mappings":";;;AAsBA,IAAa,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;A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AAA,MAAW;AAChF,IAAK,EAAuB,CAAG,KAAG,EAAa,OAAO,EAAI,MAAM;AAAA,EAClE,CAAC;AACH,GAmBa,IAAA,CAAyB,EACpC,cAAA,GACA,eAAA,GACA,IAAA,GACA,eAAA,GACA,cAAA,IAAA,MAAqB,GAAA,OACmB;AAAA,EAExC,SAAS;AAAA,EACT,WAAA,CAAY,MAAqC;AAC/C,UAAM,IAAY,EAAuB,CAAG;AAE5C,QAAI,CAAC,EAAI,KAAK,4BAA4B,CAAC,EAAW,QAAO;AAAA,MAAE,MAAM;AAAA,MAAU,SAAS;AAAA,IAAK;AAE7F,UAAM,IAAS,EAAU;AAEzB,QAAI,CAAC,KAAU,MAAW,EAAc,WAAW,CAAC,EAAa,GAAK,CAAS,EAC7E;AAGF,UAAM,IAAW,MAAW,EAAc,WACpC,IAAQ,EAAY,EAAI,QAAQ,IAAW,EAAa,WAAW,EAAa,QAAQ,GACxF,IAAY,EAAY,EAAI,QAAQ,MAAM;AAEhD,WAAI,CAAC,KAAS,CAAC,IAAkB,EAAE,MAAM,SAAS,IAE3C;AAAA,MACL,MAAM;AAAA,MACN,MAAM,IAAW,YAAY;AAAA,MAC7B,MAAM,IAAW,iBAAiB;AAAA,MAClC,OAAA;AAAA,MACA,SAAS;AAAA,MACT,IAAA;AAAA,MACA,OAAO,IAAgB,EAAI,OAAO,UAAU,IAAI,KAAK;AAAA,MACrD,QAAQ;AAAA,QAAE,OAAO;AAAA,QAAW,SAAA,MAAe,EAAuB,CAAG;AAAA,MAAE;AAAA,IACzE;AAAA,EACF;AACF"}
@@ -1,18 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Beat } from '../../core/types/Beat';
3
- import { CtaPresentation } from '../../insights-v2/ctaActions/types';
4
- import { TheWholeHog } from '../interfaces';
5
- export interface MicroCtaStatus {
6
- /** The micro action's presentation. */
7
- presentation?: CtaPresentation;
8
- }
9
- interface MicroCtaStatusGateProps {
10
- beat: Beat;
11
- posthog?: TheWholeHog;
12
- children: (status: MicroCtaStatus) => React.ReactNode;
13
- }
14
- /** Resolves the micro card's action CTA (`cardActionCta`) through the CTA layer, as full and mini do. */
15
- export declare const MicroCtaStatusGate: (({ beat, posthog, children, }: MicroCtaStatusGateProps) => import("react/jsx-runtime").JSX.Element) & {
16
- displayName: string;
17
- };
18
- export default MicroCtaStatusGate;
@@ -1,44 +0,0 @@
1
- import { GlobalDataContext as S } from "../../common/context/GlobalDataProvider.es.js";
2
- import { cardActionCta as C, resolveCtaState as g, resolveStep as v } from "../../insights-v2/ctaActions/runCtaAction.es.js";
3
- import { useCopyStore as y, useStore as h } from "../context/hooks.es.js";
4
- import { buildMicroBeatActions as x } from "../beatActions.es.js";
5
- import { useContext as M, useEffect as p, useMemo as A } from "react";
6
- import { observer as F } from "mobx-react-lite";
7
- import { Fragment as m, jsx as f } from "react/jsx-runtime";
8
- var b = F(function({ beat: o, posthog: s, children: a }) {
9
- const l = M(S), i = h(), t = l?.globalStore, n = C(o.insights_payload), e = n.action_key ? n : void 0, r = e ? v({ cta: e }) : void 0, u = A(() => x({
10
- store: i,
11
- template: o.template,
12
- posthog: s
13
- }), [
14
- i,
15
- o.template,
16
- s
17
- ]), { insightsFeedCopy: c } = y();
18
- if (p(() => {
19
- t && t.copyStore.setSection("insights_feed", c);
20
- }, [t, c]), p(() => {
21
- t && r?.prepare?.({
22
- beat: o,
23
- stores: t
24
- });
25
- }, [
26
- o.guid,
27
- r?.prepare,
28
- t
29
- ]), !t || !e || !r?.presenter) return /* @__PURE__ */ f(m, { children: a({}) });
30
- const { presentation: d } = g({
31
- beat: o,
32
- cta: e,
33
- slot: "primary",
34
- stores: t,
35
- hostActions: u
36
- });
37
- return /* @__PURE__ */ f(m, { children: a({ presentation: d }) });
38
- });
39
- export {
40
- b as MicroCtaStatusGate,
41
- b as default
42
- };
43
-
44
- //# sourceMappingURL=MicroCtaStatus.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MicroCtaStatus.es.js","names":[],"sources":["../../../src/microinsights/cards/MicroCtaStatus.tsx"],"sourcesContent":["import React, { useContext, useEffect, useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\n// Leaf imports.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\nimport type { Beat } from '../../core/types/Beat'\nimport {\n cardActionCta,\n resolveCtaState,\n resolveStep,\n} from '../../insights-v2/ctaActions/runCtaAction'\nimport type { CtaPresentation } from '../../insights-v2/ctaActions/types'\nimport { buildMicroBeatActions } from '../beatActions'\nimport { useCopyStore, useStore } from '../context/hooks'\nimport type { TheWholeHog } from '../interfaces'\n\nexport interface MicroCtaStatus {\n /** The micro action's presentation. */\n presentation?: CtaPresentation\n}\n\ninterface MicroCtaStatusGateProps {\n beat: Beat\n posthog?: TheWholeHog\n children: (status: MicroCtaStatus) => React.ReactNode\n}\n\n/** Resolves the micro card's action CTA (`cardActionCta`) through the CTA layer, as full and mini do. */\nexport const MicroCtaStatusGate = observer(function MicroCtaStatusGate({\n beat,\n posthog,\n children,\n}: MicroCtaStatusGateProps) {\n const globalData = useContext(GlobalDataContext)\n const appStore = useStore()\n const stores = globalData?.globalStore\n const actionCta = cardActionCta(beat.insights_payload)\n const ctaRef = actionCta.action_key ? actionCta : undefined\n const step = ctaRef ? resolveStep({ cta: ctaRef }) : undefined\n\n // The step's context (the presenter's Undo is never pressed from micro).\n const hostActions = useMemo(\n () => buildMicroBeatActions({ store: appStore, template: beat.template, posthog }),\n [appStore, beat.template, posthog],\n )\n\n // A micro host may not load the global copy: hand over the insights_feed micro loaded with its own\n // copy (one request per widget), so the presenter reads the same words as on full and mini.\n const { insightsFeedCopy } = useCopyStore()\n\n useEffect(() => {\n if (stores) stores.copyStore.setSection('insights_feed', insightsFeedCopy)\n }, [stores, insightsFeedCopy])\n\n useEffect(() => {\n if (stores) step?.prepare?.({ beat, stores })\n // eslint-disable-next-line react-hooks/exhaustive-deps -- once per beat\n }, [beat.guid, step?.prepare, stores])\n\n if (!stores || !ctaRef || !step?.presenter) return <>{children({})}</>\n\n const { presentation } = resolveCtaState({\n beat,\n cta: ctaRef,\n slot: 'primary',\n stores,\n hostActions,\n })\n\n return <>{children({ presentation })}</>\n})\n\nexport default MicroCtaStatusGate\n"],"mappings":";;;;;;;AA4BA,IAAa,IAAqB,EAAS,SAA4B,EACrE,MAAA,GACA,SAAA,GACA,UAAA,EAAA,GAC0B;AAC1B,QAAM,IAAa,EAAW,CAAiB,GACzC,IAAW,EAAS,GACpB,IAAS,GAAY,aACrB,IAAY,EAAc,EAAK,gBAAgB,GAC/C,IAAS,EAAU,aAAa,IAAY,QAC5C,IAAO,IAAS,EAAY,EAAE,KAAK,EAAO,CAAC,IAAI,QAG/C,IAAc,EAAA,MACZ,EAAsB;AAAA,IAAE,OAAO;AAAA,IAAU,UAAU,EAAK;AAAA,IAAU,SAAA;AAAA,EAAQ,CAAC,GACjF;AAAA,IAAC;AAAA,IAAU,EAAK;AAAA,IAAU;AAAA,EAAO,CACnC,GAIM,EAAE,kBAAA,EAAA,IAAqB,EAAa;AAW1C,MATA,EAAA,MAAgB;AACd,IAAI,KAAQ,EAAO,UAAU,WAAW,iBAAiB,CAAgB;AAAA,EAC3E,GAAG,CAAC,GAAQ,CAAgB,CAAC,GAE7B,EAAA,MAAgB;AACd,IAAI,KAAQ,GAAM,UAAU;AAAA,MAAE,MAAA;AAAA,MAAM,QAAA;AAAA,IAAO,CAAC;AAAA,EAE9C,GAAG;AAAA,IAAC,EAAK;AAAA,IAAM,GAAM;AAAA,IAAS;AAAA,EAAM,CAAC,GAEjC,CAAC,KAAU,CAAC,KAAU,CAAC,GAAM,UAAW,QAAO,gBAAA,EAAA,GAAA,EAAA,UAAG,EAAS,CAAC,CAAC,EAAI,CAAA;AAErE,QAAM,EAAE,cAAA,EAAA,IAAiB,EAAgB;AAAA,IACvC,MAAA;AAAA,IACA,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAA;AAAA,IACA,aAAA;AAAA,EACF,CAAC;AAED,SAAO,gBAAA,EAAA,G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