kasy-cli 1.31.13 → 1.32.0
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/lib/commands/new.js +15 -1
- package/lib/scaffold/CHANGELOG.json +9 -0
- package/lib/scaffold/backends/api/patch/README.md +87 -2
- package/lib/scaffold/backends/api/patch/lib/features/authentication/api/authentication_api.dart +34 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscriptions/api/stripe_backend_api.dart +12 -2
- package/lib/scaffold/backends/firebase/setup-from-scratch.js +22 -0
- package/lib/scaffold/backends/supabase/deploy.js +5 -0
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/README.md +26 -22
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/index.ts +8 -11
- package/lib/scaffold/backends/supabase/edge-functions/stripe-create-checkout-session/index.ts +3 -1
- package/lib/scaffold/backends/supabase/edge-functions/stripe-create-portal-session/index.ts +60 -3
- package/lib/scaffold/backends/supabase/patch/lib/features/authentication/api/authentication_api.dart +69 -17
- package/lib/scaffold/backends/supabase/patch/lib/features/subscriptions/api/stripe_backend_api.dart +12 -2
- package/lib/scaffold/backends/supabase/pubspec.yaml.tpl +6 -0
- package/lib/scaffold/generate.js +1 -1
- package/lib/scaffold/shared/generator-utils.js +22 -3
- package/lib/utils/i18n/messages-en.js +2 -0
- package/lib/utils/i18n/messages-es.js +2 -0
- package/lib/utils/i18n/messages-pt.js +2 -0
- package/package.json +2 -2
- package/templates/firebase/docs/auth-setup.en.md +7 -1
- package/templates/firebase/docs/auth-setup.es.md +7 -1
- package/templates/firebase/docs/auth-setup.pt.md +7 -1
- package/templates/firebase/functions/src/subscriptions/stripe_functions.ts +79 -5
- package/templates/firebase/lib/components/kasy_accordion.dart +2 -2
- package/templates/firebase/lib/components/kasy_alert.dart +1 -1
- package/templates/firebase/lib/components/kasy_app_bar.dart +3 -3
- package/templates/firebase/lib/components/kasy_bottom_sheet.dart +1 -1
- package/templates/firebase/lib/components/kasy_button.dart +8 -8
- package/templates/firebase/lib/components/kasy_chip.dart +1 -1
- package/templates/firebase/lib/components/kasy_date_picker.dart +26 -21
- package/templates/firebase/lib/components/kasy_dialog.dart +2 -2
- package/templates/firebase/lib/components/kasy_sidebar.dart +62 -11
- package/templates/firebase/lib/components/kasy_tabs.dart +2 -2
- package/templates/firebase/lib/components/kasy_text_area.dart +37 -5
- package/templates/firebase/lib/components/kasy_text_field.dart +77 -16
- package/templates/firebase/lib/components/kasy_toast.dart +1 -1
- package/templates/firebase/lib/components/kasy_web_header.dart +4 -3
- package/templates/firebase/lib/core/bottom_menu/bottom_menu.dart +6 -0
- package/templates/firebase/lib/core/bottom_menu/notification_bottom_item.dart +16 -37
- package/templates/firebase/lib/core/config/features.dart +13 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector.dart +21 -0
- package/templates/firebase/lib/core/rating/widgets/rate_banner.dart +1 -1
- package/templates/firebase/lib/core/rating/widgets/review_popup.dart +1 -1
- package/templates/firebase/lib/core/theme/icon_sizes.dart +47 -0
- package/templates/firebase/lib/core/theme/shadows.dart +13 -0
- package/templates/firebase/lib/core/theme/texts.dart +32 -0
- package/templates/firebase/lib/core/theme/theme.dart +2 -0
- package/templates/firebase/lib/core/web_device_preview/web_device_preview.dart +3 -0
- package/templates/firebase/lib/core/web_viewport_scale.dart +23 -4
- package/templates/firebase/lib/core/widgets/update_bottom_sheet.dart +1 -1
- package/templates/firebase/lib/features/ai_chat/ui/widgets/ai_conversation_tile.dart +1 -1
- package/templates/firebase/lib/features/authentication/ui/components/otp_verification.dart +1 -1
- package/templates/firebase/lib/features/authentication/ui/components/phone_input.dart +2 -1
- package/templates/firebase/lib/features/authentication/ui/recover_password_page.dart +3 -1
- package/templates/firebase/lib/features/authentication/ui/signin_page.dart +36 -14
- package/templates/firebase/lib/features/authentication/ui/signup_page.dart +27 -11
- package/templates/firebase/lib/features/authentication/ui/widgets/recover_password_result.dart +1 -1
- package/templates/firebase/lib/features/feedbacks/ui/feedback_page.dart +1 -1
- package/templates/firebase/lib/features/feedbacks/ui/widgets/add_feature_button.dart +1 -1
- package/templates/firebase/lib/features/feedbacks/ui/widgets/feature_card.dart +1 -1
- package/templates/firebase/lib/features/home/home_components_preview_registry.dart +22 -3
- package/templates/firebase/lib/features/home/home_image_grid.dart +1 -1
- package/templates/firebase/lib/features/local_reminders/ui/reminder_page.dart +2 -2
- package/templates/firebase/lib/features/notifications/providers/unread_notifications_count_provider.dart +17 -0
- package/templates/firebase/lib/features/notifications/ui/widgets/empty_notifications.dart +6 -1
- package/templates/firebase/lib/features/notifications/ui/widgets/notification_tile.dart +35 -38
- package/templates/firebase/lib/features/notifications/ui/widgets/permission_request_view.dart +1 -1
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_loader.dart +1 -1
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_module_mockups.dart +3 -3
- package/templates/firebase/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +1 -1
- package/templates/firebase/lib/features/settings/settings_page.dart +264 -307
- package/templates/firebase/lib/features/settings/ui/components/avatar_component.dart +2 -2
- package/templates/firebase/lib/features/settings/ui/components/delete_user_component.dart +13 -6
- package/templates/firebase/lib/features/settings/ui/components/edit_name_sheet.dart +115 -0
- package/templates/firebase/lib/features/settings/ui/components/language_switcher.dart +2 -2
- package/templates/firebase/lib/features/settings/ui/widgets/settings_bottom_sheet_option_tile.dart +1 -1
- package/templates/firebase/lib/features/settings/ui/widgets/settings_tile.dart +13 -5
- package/templates/firebase/lib/features/subscriptions/api/stripe_backend_api.dart +12 -2
- package/templates/firebase/lib/features/subscriptions/api/stripe_payment_api.dart +7 -1
- package/templates/firebase/lib/features/subscriptions/providers/premium_page_provider.dart +11 -3
- package/templates/firebase/lib/features/subscriptions/ui/component/paywall_row.dart +1 -1
- package/templates/firebase/lib/features/subscriptions/ui/widgets/comparison_table.dart +1 -1
- package/templates/firebase/lib/features/subscriptions/ui/widgets/feature_line.dart +2 -2
- package/templates/firebase/lib/features/subscriptions/ui/widgets/premium_close_button.dart +1 -1
- package/templates/firebase/lib/features/subscriptions/ui/widgets/premium_feature.dart +1 -1
- package/templates/firebase/lib/features/subscriptions/ui/widgets/selectable_col.dart +3 -3
- package/templates/firebase/lib/features/subscriptions/ui/widgets/selectable_row.dart +1 -1
- package/templates/firebase/lib/i18n/en.i18n.json +10 -1
- package/templates/firebase/lib/i18n/es.i18n.json +10 -1
- package/templates/firebase/lib/i18n/pt.i18n.json +10 -1
- package/templates/firebase/pubspec.yaml +0 -1
- package/templates/firebase/web/stripe_success.html +64 -26
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +0 -34
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +0 -67
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +0 -183
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +0 -34
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +0 -67
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +0 -183
- package/templates/firebase/lib/features/authentication/ui/components/facebook_signin.dart +0 -19
- package/templates/firebase/login-redesign-preview.png +0 -0
|
@@ -103,7 +103,7 @@ class _EditableUserAvatarState extends ConsumerState<EditableUserAvatar> {
|
|
|
103
103
|
),
|
|
104
104
|
child: const Icon(
|
|
105
105
|
KasyIcons.cameraAlt,
|
|
106
|
-
size:
|
|
106
|
+
size: KasyIconSize.xxs,
|
|
107
107
|
color: Colors.white,
|
|
108
108
|
),
|
|
109
109
|
),
|
|
@@ -336,7 +336,7 @@ class _BottomSheetTile extends StatelessWidget {
|
|
|
336
336
|
child: Row(
|
|
337
337
|
children: [
|
|
338
338
|
if (icon != null) ...[
|
|
339
|
-
Icon(icon, size:
|
|
339
|
+
Icon(icon, size: KasyIconSize.lg, color: fg),
|
|
340
340
|
const SizedBox(width: KasySpacing.sm),
|
|
341
341
|
],
|
|
342
342
|
Text(
|
|
@@ -14,12 +14,18 @@ class DeleteUserButton extends ConsumerWidget {
|
|
|
14
14
|
label: t.settings.delete_account.button,
|
|
15
15
|
variant: KasyButtonVariant.ghost,
|
|
16
16
|
foregroundColor: context.colors.muted,
|
|
17
|
-
onPressed: ()
|
|
17
|
+
onPressed: () {
|
|
18
|
+
// Only warn about losing the subscription when the user actually has an
|
|
19
|
+
// active one — otherwise the generic permanent-deletion warning.
|
|
20
|
+
final bool isSubscriber =
|
|
21
|
+
ref.read(userStateNotifierProvider).subscription?.isActive ?? false;
|
|
22
|
+
final account = t.settings.delete_account;
|
|
23
|
+
showKasyConfirmDialog(
|
|
18
24
|
context,
|
|
19
|
-
title:
|
|
20
|
-
message:
|
|
21
|
-
cancelLabel:
|
|
22
|
-
confirmLabel:
|
|
25
|
+
title: account.title,
|
|
26
|
+
message: isSubscriber ? account.content_subscriber : account.content,
|
|
27
|
+
cancelLabel: account.cancel,
|
|
28
|
+
confirmLabel: account.confirm,
|
|
23
29
|
destructive: true,
|
|
24
30
|
onConfirmAsync: () async {
|
|
25
31
|
try {
|
|
@@ -34,7 +40,8 @@ class DeleteUserButton extends ConsumerWidget {
|
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
|
-
|
|
43
|
+
);
|
|
44
|
+
},
|
|
38
45
|
);
|
|
39
46
|
}
|
|
40
47
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
3
|
+
import 'package:kasy_kit/components/components.dart';
|
|
4
|
+
import 'package:kasy_kit/core/data/repositories/user_repository.dart';
|
|
5
|
+
import 'package:kasy_kit/core/states/user_state_notifier.dart';
|
|
6
|
+
import 'package:kasy_kit/i18n/translations.g.dart';
|
|
7
|
+
|
|
8
|
+
/// Opens the "edit name" bottom sheet and, on success, shows a confirmation
|
|
9
|
+
/// toast on the calling [context]. The email is intentionally read-only — only
|
|
10
|
+
/// the display name can be changed here.
|
|
11
|
+
Future<void> showEditNameSheet(
|
|
12
|
+
BuildContext context, {
|
|
13
|
+
required String userId,
|
|
14
|
+
required String email,
|
|
15
|
+
required String currentName,
|
|
16
|
+
}) async {
|
|
17
|
+
final bool? saved = await showKasyBottomSheet<bool>(
|
|
18
|
+
context: context,
|
|
19
|
+
isScrollControlled: true,
|
|
20
|
+
builder: (_) => _EditNameSheet(
|
|
21
|
+
userId: userId,
|
|
22
|
+
email: email,
|
|
23
|
+
initialName: currentName,
|
|
24
|
+
),
|
|
25
|
+
);
|
|
26
|
+
if (saved == true && context.mounted) {
|
|
27
|
+
showKasyToast(
|
|
28
|
+
context,
|
|
29
|
+
title: context.t.settings.edit_name_success,
|
|
30
|
+
tone: KasyToastTone.success,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class _EditNameSheet extends ConsumerStatefulWidget {
|
|
36
|
+
final String userId;
|
|
37
|
+
final String email;
|
|
38
|
+
final String initialName;
|
|
39
|
+
|
|
40
|
+
const _EditNameSheet({
|
|
41
|
+
required this.userId,
|
|
42
|
+
required this.email,
|
|
43
|
+
required this.initialName,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
@override
|
|
47
|
+
ConsumerState<_EditNameSheet> createState() => _EditNameSheetState();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class _EditNameSheetState extends ConsumerState<_EditNameSheet> {
|
|
51
|
+
late final TextEditingController _controller =
|
|
52
|
+
TextEditingController(text: widget.initialName);
|
|
53
|
+
bool _saving = false;
|
|
54
|
+
|
|
55
|
+
@override
|
|
56
|
+
void dispose() {
|
|
57
|
+
_controller.dispose();
|
|
58
|
+
super.dispose();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Future<void> _save() async {
|
|
62
|
+
final String name = _controller.text.trim();
|
|
63
|
+
if (name.isEmpty || _saving) return;
|
|
64
|
+
setState(() => _saving = true);
|
|
65
|
+
final tr = context.t.settings;
|
|
66
|
+
try {
|
|
67
|
+
await ref.read(userRepositoryProvider).updateEmailAndName(
|
|
68
|
+
userId: widget.userId,
|
|
69
|
+
email: widget.email,
|
|
70
|
+
name: name,
|
|
71
|
+
);
|
|
72
|
+
await ref.read(userStateNotifierProvider.notifier).refresh();
|
|
73
|
+
if (!mounted) return;
|
|
74
|
+
// The success toast is shown by the launcher on the page context, since
|
|
75
|
+
// this sheet's context is gone right after the pop.
|
|
76
|
+
Navigator.of(context).pop(true);
|
|
77
|
+
} catch (_) {
|
|
78
|
+
if (!mounted) return;
|
|
79
|
+
setState(() => _saving = false);
|
|
80
|
+
showKasyToast(context, title: tr.edit_name_error, tone: KasyToastTone.danger);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@override
|
|
85
|
+
Widget build(BuildContext context) {
|
|
86
|
+
final tr = context.t.settings;
|
|
87
|
+
return KasyBottomSheet(
|
|
88
|
+
title: tr.edit_name_title,
|
|
89
|
+
addKeyboardInset: true,
|
|
90
|
+
body: KasyTextField(
|
|
91
|
+
controller: _controller,
|
|
92
|
+
label: tr.name_label,
|
|
93
|
+
hint: tr.edit_name_hint,
|
|
94
|
+
autofocus: true,
|
|
95
|
+
textCapitalization: TextCapitalization.words,
|
|
96
|
+
textInputAction: TextInputAction.done,
|
|
97
|
+
onSubmitted: (_) => _save(),
|
|
98
|
+
),
|
|
99
|
+
actions: [
|
|
100
|
+
KasyButton(
|
|
101
|
+
label: tr.edit_name_save,
|
|
102
|
+
expand: true,
|
|
103
|
+
isLoading: _saving,
|
|
104
|
+
onPressed: _save,
|
|
105
|
+
),
|
|
106
|
+
KasyButton(
|
|
107
|
+
label: tr.edit_name_cancel,
|
|
108
|
+
variant: KasyButtonVariant.ghost,
|
|
109
|
+
expand: true,
|
|
110
|
+
onPressed: _saving ? null : () => Navigator.of(context).pop(),
|
|
111
|
+
),
|
|
112
|
+
],
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -30,14 +30,14 @@ class LanguageSwitcher extends ConsumerWidget {
|
|
|
30
30
|
children: <Widget>[
|
|
31
31
|
Icon(
|
|
32
32
|
KasyIcons.language,
|
|
33
|
-
size:
|
|
33
|
+
size: KasyIconSize.rowLeading,
|
|
34
34
|
color: context.colors.onSurface,
|
|
35
35
|
),
|
|
36
36
|
const SizedBox(width: KasySpacing.sm),
|
|
37
37
|
Expanded(
|
|
38
38
|
child: Text(
|
|
39
39
|
context.t.settings.language_title,
|
|
40
|
-
style: context.textTheme.
|
|
40
|
+
style: context.textTheme.titleSmall?.copyWith(
|
|
41
41
|
color: context.colors.onSurface,
|
|
42
42
|
),
|
|
43
43
|
),
|
package/templates/firebase/lib/features/settings/ui/widgets/settings_bottom_sheet_option_tile.dart
CHANGED
|
@@ -39,7 +39,7 @@ class SettingsBottomSheetOptionTile extends StatelessWidget {
|
|
|
39
39
|
leading!,
|
|
40
40
|
const SizedBox(width: KasySpacing.sm),
|
|
41
41
|
] else if (icon != null) ...<Widget>[
|
|
42
|
-
Icon(icon, size:
|
|
42
|
+
Icon(icon, size: KasyIconSize.lg, color: fg),
|
|
43
43
|
const SizedBox(width: KasySpacing.sm),
|
|
44
44
|
],
|
|
45
45
|
Expanded(child: labelWidget),
|
|
@@ -42,7 +42,7 @@ class SettingsIconBadge extends StatelessWidget {
|
|
|
42
42
|
class SettingsListChevron extends StatelessWidget {
|
|
43
43
|
const SettingsListChevron({super.key});
|
|
44
44
|
|
|
45
|
-
static const double _iconSize =
|
|
45
|
+
static const double _iconSize = KasyIconSize.rowTrailing;
|
|
46
46
|
|
|
47
47
|
@override
|
|
48
48
|
Widget build(BuildContext context) {
|
|
@@ -97,7 +97,11 @@ class SettingsSwitchTile extends StatelessWidget {
|
|
|
97
97
|
if (iconBackgroundColor != null)
|
|
98
98
|
SettingsIconBadge(icon: icon, color: iconBackgroundColor!)
|
|
99
99
|
else
|
|
100
|
-
Icon(
|
|
100
|
+
Icon(
|
|
101
|
+
icon,
|
|
102
|
+
size: KasyIconSize.rowLeading,
|
|
103
|
+
color: context.colors.onSurface,
|
|
104
|
+
),
|
|
101
105
|
const SizedBox(width: KasySpacing.sm),
|
|
102
106
|
Expanded(
|
|
103
107
|
child: Column(
|
|
@@ -106,7 +110,7 @@ class SettingsSwitchTile extends StatelessWidget {
|
|
|
106
110
|
children: <Widget>[
|
|
107
111
|
Text(
|
|
108
112
|
title,
|
|
109
|
-
style: context.textTheme.
|
|
113
|
+
style: context.textTheme.titleSmall?.copyWith(
|
|
110
114
|
color: context.colors.onSurface,
|
|
111
115
|
),
|
|
112
116
|
),
|
|
@@ -166,12 +170,16 @@ class SettingsTile extends StatelessWidget {
|
|
|
166
170
|
if (iconBackgroundColor != null)
|
|
167
171
|
SettingsIconBadge(icon: icon, color: iconBackgroundColor!)
|
|
168
172
|
else
|
|
169
|
-
Icon(
|
|
173
|
+
Icon(
|
|
174
|
+
icon,
|
|
175
|
+
size: KasyIconSize.rowLeading,
|
|
176
|
+
color: context.colors.onSurface,
|
|
177
|
+
),
|
|
170
178
|
const SizedBox(width: KasySpacing.sm),
|
|
171
179
|
Expanded(
|
|
172
180
|
child: Text(
|
|
173
181
|
title,
|
|
174
|
-
style: context.textTheme.
|
|
182
|
+
style: context.textTheme.titleSmall?.copyWith(
|
|
175
183
|
color: context.colors.onSurface,
|
|
176
184
|
),
|
|
177
185
|
),
|
|
@@ -35,6 +35,7 @@ class StripeBackendApi {
|
|
|
35
35
|
String? successUrl,
|
|
36
36
|
String? cancelUrl,
|
|
37
37
|
String? locale,
|
|
38
|
+
bool? allowPromoCodes,
|
|
38
39
|
}) async {
|
|
39
40
|
final res = await _functions
|
|
40
41
|
.httpsCallable('stripeFunctions-createCheckoutSession')
|
|
@@ -43,15 +44,24 @@ class StripeBackendApi {
|
|
|
43
44
|
if (successUrl != null) 'successUrl': successUrl,
|
|
44
45
|
if (cancelUrl != null) 'cancelUrl': cancelUrl,
|
|
45
46
|
if (locale != null) 'locale': locale,
|
|
47
|
+
if (allowPromoCodes != null) 'allowPromoCodes': allowPromoCodes,
|
|
46
48
|
});
|
|
47
49
|
return (res.data as Map)['url'] as String;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/// Create a Customer Portal session (manage / cancel) and return its URL.
|
|
51
|
-
|
|
53
|
+
/// Pass [planSwitching] = true to auto-configure the portal with
|
|
54
|
+
/// upgrade/downgrade support (no manual Stripe dashboard setup needed).
|
|
55
|
+
Future<String> createPortalSession({
|
|
56
|
+
String? returnUrl,
|
|
57
|
+
bool? planSwitching,
|
|
58
|
+
}) async {
|
|
52
59
|
final res = await _functions
|
|
53
60
|
.httpsCallable('stripeFunctions-createPortalSession')
|
|
54
|
-
.call({
|
|
61
|
+
.call({
|
|
62
|
+
if (returnUrl != null) 'returnUrl': returnUrl,
|
|
63
|
+
if (planSwitching != null) 'planSwitching': planSwitching,
|
|
64
|
+
});
|
|
55
65
|
return (res.data as Map)['url'] as String;
|
|
56
66
|
}
|
|
57
67
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'package:kasy_kit/core/config/features.dart';
|
|
1
2
|
import 'package:kasy_kit/core/data/models/entitlement.dart';
|
|
2
3
|
import 'package:kasy_kit/core/data/models/subscription.dart';
|
|
3
4
|
import 'package:kasy_kit/features/subscriptions/api/entities/subscription_entity.dart';
|
|
@@ -39,7 +40,10 @@ class StripePaymentApi implements SubscriptionPaymentApi {
|
|
|
39
40
|
// tab. The original app tab keeps polling and flips to premium via the
|
|
40
41
|
// webhook. On cancel we send the user back to the app where they were.
|
|
41
42
|
final appUrl = Uri.base.toString();
|
|
42
|
-
|
|
43
|
+
// Pass the in-app language so the success page renders in the locale the
|
|
44
|
+
// user picked here, not just the browser's (?lang= takes priority there).
|
|
45
|
+
final lang = LocaleSettings.instance.currentLocale.languageCode;
|
|
46
|
+
final successUrl = '${Uri.base.origin}/stripe_success.html?lang=$lang';
|
|
43
47
|
final url = await _backend.createCheckoutSession(
|
|
44
48
|
priceId: product.skuId,
|
|
45
49
|
successUrl: successUrl,
|
|
@@ -48,6 +52,7 @@ class StripePaymentApi implements SubscriptionPaymentApi {
|
|
|
48
52
|
// deliver subscription notifications in the right language (on web there
|
|
49
53
|
// is no registered device to read the locale from).
|
|
50
54
|
locale: LocaleSettings.instance.currentLocale.languageCode,
|
|
55
|
+
allowPromoCodes: withStripePromoCodes,
|
|
51
56
|
);
|
|
52
57
|
await _open(url);
|
|
53
58
|
// Checkout is now open in a new tab. Payment is NOT confirmed yet — the
|
|
@@ -60,6 +65,7 @@ class StripePaymentApi implements SubscriptionPaymentApi {
|
|
|
60
65
|
Future<void> unsubscribe(SubscriptionStore? origin) async {
|
|
61
66
|
final url = await _backend.createPortalSession(
|
|
62
67
|
returnUrl: Uri.base.toString(),
|
|
68
|
+
planSwitching: withStripePlanSwitching,
|
|
63
69
|
);
|
|
64
70
|
await _open(url);
|
|
65
71
|
}
|
|
@@ -269,10 +269,18 @@ class PremiumStateNotifier extends _$PremiumStateNotifier {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
try {
|
|
272
|
-
|
|
272
|
+
// Store-level restore: RevenueCat on native (asks Apple/Google to restore
|
|
273
|
+
// purchases), a no-op on web (Stripe status lives server-side). Best-effort
|
|
274
|
+
// — RevenueCat throws when there is nothing to restore, but the backend
|
|
275
|
+
// re-read below is the source of truth and decides the message, so both
|
|
276
|
+
// web and native end on the same friendly "nothing to restore" path.
|
|
277
|
+
try {
|
|
278
|
+
await _subscriptionRepository.restorePurchase();
|
|
279
|
+
} catch (_) {
|
|
280
|
+
// Ignore: fall through to the backend check.
|
|
281
|
+
}
|
|
273
282
|
|
|
274
|
-
//
|
|
275
|
-
// we re-read the backend to learn the real state: the webhook may have
|
|
283
|
+
// Re-read the backend to learn the real state: the webhook may have
|
|
276
284
|
// already written the subscription. Only flip to active when the backend
|
|
277
285
|
// actually confirms it — otherwise we'd show a false "restored" success.
|
|
278
286
|
final userId = _userState.user.idOrNull;
|
|
@@ -312,7 +312,7 @@ class _ComparisonTable extends StatelessWidget {
|
|
|
312
312
|
isAvailable
|
|
313
313
|
? KasyIcons.check
|
|
314
314
|
: KasyIcons.close,
|
|
315
|
-
size:
|
|
315
|
+
size: KasyIconSize.lg,
|
|
316
316
|
color: isAvailable
|
|
317
317
|
? (isPremium ? context.colors.primary : context.colors.success)
|
|
318
318
|
: context.colors.error,
|
|
@@ -28,7 +28,7 @@ class FeatureLine extends StatelessWidget {
|
|
|
28
28
|
Icon(
|
|
29
29
|
icon,
|
|
30
30
|
color: context.colors.onBackground,
|
|
31
|
-
size:
|
|
31
|
+
size: KasyIconSize.sm,
|
|
32
32
|
),
|
|
33
33
|
if (icon != null)
|
|
34
34
|
const SizedBox(width: KasySpacing.smd),
|
|
@@ -93,7 +93,7 @@ class FeatureWithTwoLines extends StatelessWidget {
|
|
|
93
93
|
Icon(
|
|
94
94
|
icon,
|
|
95
95
|
color: context.colors.onBackground,
|
|
96
|
-
size:
|
|
96
|
+
size: KasyIconSize.xl,
|
|
97
97
|
),
|
|
98
98
|
const SizedBox(width: KasySpacing.smd),
|
|
99
99
|
Flexible(
|
|
@@ -230,8 +230,8 @@ class _SelectableColState extends State<SelectableCol>
|
|
|
230
230
|
Padding(
|
|
231
231
|
padding: const EdgeInsets.only(bottom: 2), // pixel-level icon alignment — intentional exception
|
|
232
232
|
child: Icon(
|
|
233
|
-
widget.icon,
|
|
234
|
-
size:
|
|
233
|
+
widget.icon,
|
|
234
|
+
size: KasyIconSize.xl,
|
|
235
235
|
color: switch(widget.brightness) {
|
|
236
236
|
Brightness.light => context.colors.onBackground,
|
|
237
237
|
_ => context.colors.background,
|
|
@@ -374,7 +374,7 @@ class RoundRadioBox extends StatelessWidget {
|
|
|
374
374
|
opacity: iconOpacity,
|
|
375
375
|
child: Transform.scale(
|
|
376
376
|
scale: iconSize,
|
|
377
|
-
child: Icon(icon, color: context.colors.onPrimary, size:
|
|
377
|
+
child: Icon(icon, color: context.colors.onPrimary, size: KasyIconSize.lg),
|
|
378
378
|
),
|
|
379
379
|
)
|
|
380
380
|
: const SizedBox.shrink(),
|
|
@@ -433,7 +433,7 @@ class RoundRadioBox extends StatelessWidget {
|
|
|
433
433
|
opacity: iconOpacity,
|
|
434
434
|
child: Transform.scale(
|
|
435
435
|
scale: iconSize,
|
|
436
|
-
child: Icon(icon, color: context.colors.background, size:
|
|
436
|
+
child: Icon(icon, color: context.colors.background, size: KasyIconSize.sm),
|
|
437
437
|
),
|
|
438
438
|
)
|
|
439
439
|
: const SizedBox.shrink(),
|
|
@@ -495,6 +495,14 @@
|
|
|
495
495
|
"my_account": "My account",
|
|
496
496
|
"not_signed_in": "Not signed in",
|
|
497
497
|
"register": "Register",
|
|
498
|
+
"name_label": "Name",
|
|
499
|
+
"email_label": "Email",
|
|
500
|
+
"edit_name_title": "Edit name",
|
|
501
|
+
"edit_name_hint": "Your name",
|
|
502
|
+
"edit_name_save": "Save",
|
|
503
|
+
"edit_name_cancel": "Cancel",
|
|
504
|
+
"edit_name_success": "Name updated",
|
|
505
|
+
"edit_name_error": "Couldn't update your name. Please try again.",
|
|
498
506
|
"reminders": "Reminders",
|
|
499
507
|
"admin_panel": "Admin Panel",
|
|
500
508
|
"admin_debug_section_label": "ADMIN (DEBUG ONLY)",
|
|
@@ -502,7 +510,8 @@
|
|
|
502
510
|
"delete_account": {
|
|
503
511
|
"button": "I want to delete my account",
|
|
504
512
|
"title": "Delete your account?",
|
|
505
|
-
"content": "Warning: this is permanent
|
|
513
|
+
"content": "Warning: this action is permanent and cannot be undone.",
|
|
514
|
+
"content_subscriber": "Warning: this is permanent. You will lose your active subscription, and creating a new account later (even with the same email) will not restore it.",
|
|
506
515
|
"cancel": "Cancel",
|
|
507
516
|
"confirm": "Yes, delete",
|
|
508
517
|
"error": "Something went wrong. Please try again."
|
|
@@ -495,6 +495,14 @@
|
|
|
495
495
|
"my_account": "Mi cuenta",
|
|
496
496
|
"not_signed_in": "No conectado",
|
|
497
497
|
"register": "Registrarse",
|
|
498
|
+
"name_label": "Nombre",
|
|
499
|
+
"email_label": "Correo electrónico",
|
|
500
|
+
"edit_name_title": "Editar nombre",
|
|
501
|
+
"edit_name_hint": "Tu nombre",
|
|
502
|
+
"edit_name_save": "Guardar",
|
|
503
|
+
"edit_name_cancel": "Cancelar",
|
|
504
|
+
"edit_name_success": "Nombre actualizado",
|
|
505
|
+
"edit_name_error": "No se pudo actualizar tu nombre. Inténtalo de nuevo.",
|
|
498
506
|
"reminders": "Recordatorios",
|
|
499
507
|
"admin_panel": "Panel de Administración",
|
|
500
508
|
"admin_debug_section_label": "ADMIN (SOLO DEBUG)",
|
|
@@ -502,7 +510,8 @@
|
|
|
502
510
|
"delete_account": {
|
|
503
511
|
"button": "Quiero eliminar mi cuenta",
|
|
504
512
|
"title": "¿Quieres eliminar tu cuenta?",
|
|
505
|
-
"content": "Advertencia: esta acción es permanente
|
|
513
|
+
"content": "Advertencia: esta acción es permanente y no se puede deshacer.",
|
|
514
|
+
"content_subscriber": "Advertencia: esta acción es permanente. Perderás tu suscripción activa, y crear una cuenta nueva más tarde (incluso con el mismo correo) no la recuperará.",
|
|
506
515
|
"cancel": "Cancelar",
|
|
507
516
|
"confirm": "Sí, eliminar",
|
|
508
517
|
"error": "Algo salió mal. Por favor, inténtalo de nuevo."
|
|
@@ -495,6 +495,14 @@
|
|
|
495
495
|
"my_account": "Minha conta",
|
|
496
496
|
"not_signed_in": "Não conectado",
|
|
497
497
|
"register": "Cadastrar",
|
|
498
|
+
"name_label": "Nome",
|
|
499
|
+
"email_label": "Email",
|
|
500
|
+
"edit_name_title": "Editar nome",
|
|
501
|
+
"edit_name_hint": "Seu nome",
|
|
502
|
+
"edit_name_save": "Salvar",
|
|
503
|
+
"edit_name_cancel": "Cancelar",
|
|
504
|
+
"edit_name_success": "Nome atualizado",
|
|
505
|
+
"edit_name_error": "Não foi possível atualizar seu nome. Tente novamente.",
|
|
498
506
|
"reminders": "Lembretes",
|
|
499
507
|
"admin_panel": "Painel Admin",
|
|
500
508
|
"admin_debug_section_label": "ADMIN (SÓ EM DEBUG)",
|
|
@@ -502,7 +510,8 @@
|
|
|
502
510
|
"delete_account": {
|
|
503
511
|
"button": "Quero excluir minha conta",
|
|
504
512
|
"title": "Quer excluir sua conta?",
|
|
505
|
-
"content": "Atenção: esta ação é permanente
|
|
513
|
+
"content": "Atenção: esta ação é permanente e não pode ser desfeita.",
|
|
514
|
+
"content_subscriber": "Atenção: esta ação é permanente. Você perde sua assinatura ativa, e criar uma nova conta depois (mesmo com o mesmo e-mail) não recupera ela.",
|
|
506
515
|
"cancel": "Cancelar",
|
|
507
516
|
"confirm": "Sim, excluir",
|
|
508
517
|
"error": "Algo deu errado. Por favor, tente novamente."
|