@growth-operations/ui-shared 1.0.0 → 1.0.2

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.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared HubSpot UI-extension modules (Home, Billing) for Growth Operations apps.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -115,8 +115,13 @@ function usePortalSession({ context, state, appKey }) {
115
115
  // before render).
116
116
  useStrictModeEffect(
117
117
  async ({ mounted }) => {
118
+ // `state` is the /v1/home payload, fetched async by the host page — it's
119
+ // null on the first render(s). Don't mistake "not loaded yet" for
120
+ // "misconfigured": stay in loading until state arrives, then decide. The
121
+ // effect re-runs when state?.billing_base_url changes (see deps).
122
+ if (!state) return;
118
123
  try {
119
- const base = state?.billing_base_url;
124
+ const base = state.billing_base_url;
120
125
  if (!base) throw new Error("Billing service not configured");
121
126
  if (!appKey) throw new Error("Missing appKey for billing portal");
122
127
  const portalId = context?.portal?.id;
@@ -165,9 +170,7 @@ function TrialSubscriptionBilling({ context, state, appKey }) {
165
170
  {/* PRIMARY CTA at the very top, large and obvious (per billing feedback). */}
166
171
  {portalUrl ? (
167
172
  <Link href={{ url: portalUrl, external: true }} variant="primary">
168
- <Text format={{ fontWeight: "bold", fontSize: "lg" }}>
169
- Manage billing in Stripe →
170
- </Text>
173
+ Manage billing in Stripe
171
174
  </Link>
172
175
  ) : loading ? (
173
176
  <LoadingSpinner showLabel label="Preparing billing…" />
@@ -206,9 +209,7 @@ function CreditsBilling({ context, state, appKey }) {
206
209
  {/* PRIMARY CTA at top: pick a plan / buy credits. */}
207
210
  {portalUrl ? (
208
211
  <Link href={{ url: portalUrl, external: true }} variant="primary">
209
- <Text format={{ fontWeight: "bold", fontSize: "lg" }}>
210
- Pick a plan / Buy credits →
211
- </Text>
212
+ Pick a plan or buy credits
212
213
  </Link>
213
214
  ) : loading ? (
214
215
  <LoadingSpinner showLabel label="Preparing checkout…" />