kasy-cli 1.31.10 → 1.31.12

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 (30) hide show
  1. package/lib/commands/add.js +31 -0
  2. package/lib/commands/new.js +0 -14
  3. package/lib/scaffold/CHANGELOG.json +9 -0
  4. package/lib/scaffold/backends/supabase/edge-functions/admin-list-users/index.ts +4 -2
  5. package/lib/scaffold/backends/supabase/edge-functions/ai-chat/index.ts +1 -1
  6. package/lib/scaffold/backends/supabase/edge-functions/delete-user-account/index.ts +1 -1
  7. package/lib/scaffold/backends/supabase/edge-functions/meta-track-event/index.ts +1 -1
  8. package/lib/scaffold/backends/supabase/edge-functions/revenuecat-webhook/index.ts +1 -1
  9. package/lib/scaffold/backends/supabase/edge-functions/stripe-create-checkout-session/index.ts +28 -10
  10. package/lib/scaffold/backends/supabase/edge-functions/stripe-create-portal-session/index.ts +4 -2
  11. package/lib/scaffold/backends/supabase/edge-functions/stripe-list-prices/index.ts +4 -3
  12. package/lib/scaffold/shared/generator-utils.js +11 -0
  13. package/package.json +2 -2
  14. package/templates/firebase/functions/src/core/data/entities/subscription_entity.ts +12 -0
  15. package/templates/firebase/functions/src/subscriptions/models/subscriptions.ts +10 -0
  16. package/templates/firebase/functions/src/subscriptions/stripe_functions.ts +40 -5
  17. package/templates/firebase/functions/src/subscriptions/triggers.ts +35 -4
  18. package/templates/firebase/lib/components/kasy_app_bar.dart +22 -30
  19. package/templates/firebase/lib/components/kasy_toast.dart +6 -4
  20. package/templates/firebase/lib/core/web_device_preview/web_device_preview.dart +33 -14
  21. package/templates/firebase/lib/features/onboarding/repositories/user_infos_repository.dart +9 -2
  22. package/templates/firebase/lib/features/subscriptions/api/stripe_backend_api.dart +2 -0
  23. package/templates/firebase/lib/features/subscriptions/api/stripe_payment_api.dart +18 -6
  24. package/templates/firebase/lib/features/subscriptions/api/subscription_payment_api.dart +8 -0
  25. package/templates/firebase/lib/features/subscriptions/providers/premium_page_provider.dart +140 -69
  26. package/templates/firebase/lib/features/subscriptions/ui/widgets/premium_bottom_menu.dart +11 -18
  27. package/templates/firebase/lib/i18n/en.i18n.json +4 -0
  28. package/templates/firebase/lib/i18n/es.i18n.json +4 -0
  29. package/templates/firebase/lib/i18n/pt.i18n.json +4 -0
  30. package/templates/firebase/web/stripe_success.html +138 -0
@@ -0,0 +1,138 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ Stripe Checkout success page.
4
+
5
+ Stripe redirects the checkout tab here (success_url) after a successful
6
+ payment. It is intentionally a tiny standalone page — NOT the full Flutter
7
+ app — so the user does not end up with two heavy app tabs open. The original
8
+ app tab keeps polling and flips to premium on its own (via the webhook), so
9
+ here we just congratulate the user and let them close this tab / return.
10
+
11
+ Localized client-side from navigator.language (pt / es / en).
12
+ -->
13
+ <html lang="en">
14
+ <head>
15
+ <meta charset="UTF-8" />
16
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
17
+ <title>Payment complete</title>
18
+ <style>
19
+ :root {
20
+ --accent: #0485F7;
21
+ --success: #16A34A;
22
+ --bg: #F6F8FB;
23
+ --card: #FFFFFF;
24
+ --text: #0B1524;
25
+ --muted: #5B6776;
26
+ --border: rgba(11, 21, 36, 0.08);
27
+ }
28
+ @media (prefers-color-scheme: dark) {
29
+ :root {
30
+ --bg: #0B1220;
31
+ --card: #131C2B;
32
+ --text: #F3F6FB;
33
+ --muted: #9AA7B8;
34
+ --border: rgba(255, 255, 255, 0.10);
35
+ }
36
+ }
37
+ * { box-sizing: border-box; }
38
+ html, body { height: 100%; margin: 0; }
39
+ body {
40
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
41
+ Helvetica, Arial, sans-serif;
42
+ background: var(--bg);
43
+ color: var(--text);
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ padding: 24px;
48
+ }
49
+ .card {
50
+ width: 100%;
51
+ max-width: 420px;
52
+ background: var(--card);
53
+ border: 1px solid var(--border);
54
+ border-radius: 20px;
55
+ padding: 40px 32px;
56
+ text-align: center;
57
+ box-shadow: 0 12px 40px rgba(11, 21, 36, 0.08);
58
+ }
59
+ .check {
60
+ width: 72px;
61
+ height: 72px;
62
+ margin: 0 auto 24px;
63
+ border-radius: 50%;
64
+ background: rgba(22, 163, 74, 0.12);
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ }
69
+ .check svg { width: 38px; height: 38px; stroke: var(--success); }
70
+ h1 { font-size: 22px; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.4px; }
71
+ p { font-size: 15px; line-height: 1.5; color: var(--muted); margin: 0 0 28px; }
72
+ button {
73
+ width: 100%;
74
+ border: none;
75
+ border-radius: 12px;
76
+ padding: 14px 20px;
77
+ font-size: 15px;
78
+ font-weight: 600;
79
+ color: #FFFFFF;
80
+ background: var(--accent);
81
+ cursor: pointer;
82
+ transition: opacity 0.15s ease;
83
+ }
84
+ button:hover { opacity: 0.92; }
85
+ </style>
86
+ </head>
87
+ <body>
88
+ <div class="card">
89
+ <div class="check">
90
+ <svg viewBox="0 0 24 24" fill="none" stroke-width="2.5"
91
+ stroke-linecap="round" stroke-linejoin="round">
92
+ <path d="M20 6L9 17l-5-5" />
93
+ </svg>
94
+ </div>
95
+ <h1 id="title">Payment complete</h1>
96
+ <p id="subtitle">Your subscription is confirmed. You can return to the app.</p>
97
+ <button id="close">Return to the app</button>
98
+ </div>
99
+
100
+ <script>
101
+ var I18N = {
102
+ en: {
103
+ doc: "Payment complete",
104
+ title: "Payment complete",
105
+ subtitle: "Your subscription is confirmed. You can return to the app.",
106
+ button: "Return to the app",
107
+ },
108
+ pt: {
109
+ doc: "Pagamento concluído",
110
+ title: "Pagamento concluído!",
111
+ subtitle: "Sua assinatura foi confirmada. Você já pode voltar ao aplicativo.",
112
+ button: "Voltar ao aplicativo",
113
+ },
114
+ es: {
115
+ doc: "Pago completado",
116
+ title: "¡Pago completado!",
117
+ subtitle: "Tu suscripción está confirmada. Ya puedes volver a la aplicación.",
118
+ button: "Volver a la aplicación",
119
+ },
120
+ };
121
+
122
+ var lang = (navigator.language || "en").slice(0, 2).toLowerCase();
123
+ var t = I18N[lang] || I18N.en;
124
+ document.documentElement.lang = lang in I18N ? lang : "en";
125
+ document.title = t.doc;
126
+ document.getElementById("title").textContent = t.title;
127
+ document.getElementById("subtitle").textContent = t.subtitle;
128
+ document.getElementById("close").textContent = t.button;
129
+
130
+ // This tab was opened by the app via window.open, so window.close() is
131
+ // allowed. A button click is a user gesture, so it closes reliably and
132
+ // returns focus to the original app tab (already flipped to premium).
133
+ document.getElementById("close").addEventListener("click", function () {
134
+ window.close();
135
+ });
136
+ </script>
137
+ </body>
138
+ </html>