@growth-operations/ui-shared 1.0.5 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-operations/ui-shared",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -34,10 +34,12 @@ function StatusPanel({ entitlement }) {
34
34
  if (!entitlement) return null;
35
35
  const {
36
36
  status,
37
+ mode,
37
38
  current_period_end,
38
39
  trial_ends_at,
39
40
  sandbox_trial_expires_at,
40
41
  cancel_at_period_end,
42
+ has_payment_method,
41
43
  } = entitlement;
42
44
 
43
45
  // HubSpot's Alert renders `title` beside the body in a narrow column, which
@@ -53,13 +55,26 @@ function StatusPanel({ entitlement }) {
53
55
  : left <= 0
54
56
  ? "Your free trial ends today"
55
57
  : `${left} day${left === 1 ? "" : "s"} left in your free trial`;
58
+ // What (if anything) the customer must do before the trial ends, by mode:
59
+ // - credits: pick/buy a credit plan to continue.
60
+ // - trial_subscription (plan already chosen — toast): the trial just needs
61
+ // a payment method. If one's already on file it auto-converts (nothing to
62
+ // do); if not, they must add one or Stripe cancels at trial end.
63
+ // has_payment_method may be null (unknown) — then give the safe ask.
64
+ const trialCta =
65
+ mode === "credits"
66
+ ? "Choose a plan in Stripe before then to keep going."
67
+ : has_payment_method === true
68
+ ? "Your payment method is on file, so it converts automatically — nothing to do."
69
+ : has_payment_method === false
70
+ ? "Add a payment method in Stripe before then, or your subscription will be canceled."
71
+ : "Add a payment method in Stripe before then so your subscription continues.";
56
72
  return (
57
73
  <Alert variant="warning">
58
74
  <Flex direction="column" gap="extra-small">
59
75
  <Text format={{ fontWeight: "bold" }}>{leftLabel}</Text>
60
76
  <Text>
61
- Trial ends {fmtDate(trialEnd)}. Add a plan in Stripe before then to
62
- keep syncing.
77
+ Trial ends {fmtDate(trialEnd)}. {trialCta}
63
78
  </Text>
64
79
  </Flex>
65
80
  </Alert>
@@ -102,11 +117,15 @@ function StatusPanel({ entitlement }) {
102
117
  }
103
118
 
104
119
  if (status === "pending_purchase") {
120
+ const resumeCta =
121
+ mode === "credits"
122
+ ? "Choose a plan in Stripe to resume."
123
+ : "Add a payment method in Stripe to resume syncing your data.";
105
124
  return (
106
125
  <Alert variant="warning">
107
126
  <Flex direction="column" gap="extra-small">
108
127
  <Text format={{ fontWeight: "bold" }}>Your free trial has ended</Text>
109
- <Text>Choose a plan in Stripe to resume syncing your data.</Text>
128
+ <Text>{resumeCta}</Text>
110
129
  </Flex>
111
130
  </Alert>
112
131
  );