@hook-sdk/template 0.7.2 → 0.7.3

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/dist/index.d.cts CHANGED
@@ -273,6 +273,13 @@ interface PixPending {
273
273
  qrCodePayload: string | null;
274
274
  qrCodeBase64: string | null;
275
275
  expiresAt: string | null;
276
+ /**
277
+ * Flipa `true` quando o polling detecta subscription ACTIVE/TRIAL (webhook
278
+ * PAYMENT_RECEIVED ou AUTHORIZATION_ACTIVATED chegou). UI deve renderizar
279
+ * confirmação visual nesse momento; após 2-3s chama `dismissPix` pra
280
+ * limpar o modal e deixar SubscriptionGate liberar o app.
281
+ */
282
+ paid: boolean;
276
283
  }
277
284
  /**
278
285
  * Hook headless pro Paywall. Expõe status atual da subscription + ação
package/dist/index.d.ts CHANGED
@@ -273,6 +273,13 @@ interface PixPending {
273
273
  qrCodePayload: string | null;
274
274
  qrCodeBase64: string | null;
275
275
  expiresAt: string | null;
276
+ /**
277
+ * Flipa `true` quando o polling detecta subscription ACTIVE/TRIAL (webhook
278
+ * PAYMENT_RECEIVED ou AUTHORIZATION_ACTIVATED chegou). UI deve renderizar
279
+ * confirmação visual nesse momento; após 2-3s chama `dismissPix` pra
280
+ * limpar o modal e deixar SubscriptionGate liberar o app.
281
+ */
282
+ paid: boolean;
276
283
  }
277
284
  /**
278
285
  * Hook headless pro Paywall. Expõe status atual da subscription + ação
package/dist/index.js CHANGED
@@ -121,7 +121,8 @@ function usePaywallState() {
121
121
  method: "pix-auto",
122
122
  qrCodePayload: result.qrCodePayload,
123
123
  qrCodeBase64: result.qrCodeBase64,
124
- expiresAt: null
124
+ expiresAt: null,
125
+ paid: false
125
126
  });
126
127
  setOpening(false);
127
128
  return;
@@ -132,7 +133,8 @@ function usePaywallState() {
132
133
  method: "pix-once",
133
134
  qrCodePayload: result.qrCodePayload,
134
135
  qrCodeBase64: result.qrCodeBase64,
135
- expiresAt: result.expiresAt
136
+ expiresAt: result.expiresAt,
137
+ paid: false
136
138
  });
137
139
  setOpening(false);
138
140
  return;
@@ -156,7 +158,7 @@ function usePaywallState() {
156
158
  const subRef = useRef(subscription);
157
159
  subRef.current = subscription;
158
160
  useEffect2(() => {
159
- if (!pixPending) return;
161
+ if (!pixPending || pixPending.paid) return;
160
162
  let attempts = 0;
161
163
  const MAX_ATTEMPTS = 60;
162
164
  let cancelled = false;
@@ -168,7 +170,7 @@ function usePaywallState() {
168
170
  if (cancelled) return;
169
171
  const s = subRef.current.status();
170
172
  if (s === "active" || s === "trialing") {
171
- setPixPending(null);
173
+ setPixPending((prev) => prev ? { ...prev, paid: true } : prev);
172
174
  return;
173
175
  }
174
176
  } catch {