@saasicat/ui-vue 0.2.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/LICENSE +202 -0
- package/README.md +47 -0
- package/dist/index.cjs +3776 -0
- package/dist/index.d.cts +2395 -0
- package/dist/index.d.ts +2395 -0
- package/dist/index.js +3659 -0
- package/dist/testing-e2e/admin-pages-suite.cjs +134 -0
- package/dist/testing-e2e/admin-pages-suite.d.cts +37 -0
- package/dist/testing-e2e/admin-pages-suite.d.ts +37 -0
- package/dist/testing-e2e/admin-pages-suite.js +109 -0
- package/package.json +87 -0
- package/src/action-registry.ts +110 -0
- package/src/batch-column-fetcher.ts +152 -0
- package/src/boot-loader.ts +60 -0
- package/src/components/BundleVersionPublishDialog.vue +359 -0
- package/src/components/BusinessTypeVersionEditorDialog.vue +417 -0
- package/src/components/BusinessTypeVersionPublishDialog.vue +258 -0
- package/src/components/FeatureGate.vue +56 -0
- package/src/components/KpiCard.vue +53 -0
- package/src/components/KvBlock.vue +36 -0
- package/src/components/MarketingPromotionsTab.vue +861 -0
- package/src/components/MfaPromptDialog.vue +104 -0
- package/src/components/TenantActionConfirmDialog.vue +252 -0
- package/src/components/VersionDiffPreview.vue +150 -0
- package/src/components/bundle-editor/BundleCreatePanel.vue +681 -0
- package/src/components/bundle-editor/BundleFeaturesEditor.vue +215 -0
- package/src/components/bundle-editor/BundlePlanCompatPicker.vue +316 -0
- package/src/components/bundle-editor/BundleQuotasEditor.vue +219 -0
- package/src/components/bundle-editor/BundleStatusBanner.vue +189 -0
- package/src/components/bundle-editor/BundleVersionInlineEditor.vue +659 -0
- package/src/components/bundle-editor/BundleVersionStrip.vue +207 -0
- package/src/components/bundle-editor/bundle-version-status.ts +164 -0
- package/src/components/bundle-editor/catalog-i18n.ts +85 -0
- package/src/components/dialogs/PilotCreateDialog.vue +780 -0
- package/src/components/dialogs/PilotEditDialog.vue +548 -0
- package/src/components/dialogs/PromoCodeCreateDialog.vue +737 -0
- package/src/components/dialogs/PromoCodeEditDialog.vue +859 -0
- package/src/components/dialogs/types.ts +126 -0
- package/src/components/plan/PlanCycleToggle.vue +99 -0
- package/src/components/plan/PlanGrid.vue +211 -0
- package/src/components/plan/PriceSummary.vue +293 -0
- package/src/components/plan/PromoCodeInput.vue +192 -0
- package/src/components/plan/PublicBundleGrid.vue +287 -0
- package/src/components/plan-cockpit/PlanCockpit.vue +993 -0
- package/src/components/plan-cockpit/PlanCockpitAuditLog.vue +65 -0
- package/src/components/plan-cockpit/PlanCockpitDiffPanel.vue +91 -0
- package/src/components/plan-cockpit/PlanCockpitHeader.vue +98 -0
- package/src/components/plan-cockpit/PlanCockpitImpactPanel.vue +99 -0
- package/src/components/plan-cockpit/PlanCockpitKpis.vue +57 -0
- package/src/components/plan-cockpit/PlanCockpitVersions.vue +226 -0
- package/src/components/plan-cockpit/types.ts +72 -0
- package/src/components/plan-create-dialog/PlanCreateDialog.vue +508 -0
- package/src/components/plan-detail/PlanAuditLog.vue +59 -0
- package/src/components/plan-detail/PlanDetail.vue +1195 -0
- package/src/components/plan-detail/PlanDetailHeader.vue +185 -0
- package/src/components/plan-detail/PlanDetailKpis.vue +57 -0
- package/src/components/plan-detail/PlanTerminateDialog.vue +76 -0
- package/src/components/plan-detail/PlanVersionDiffPanel.vue +149 -0
- package/src/components/plan-detail/PlanVersionsPanel.vue +255 -0
- package/src/components/plan-detail/types.ts +59 -0
- package/src/components/plan-list/PlanList.vue +1067 -0
- package/src/components/plan-matrix/PlanMatrix.vue +1113 -0
- package/src/components/plan-review/PlanReview.vue +742 -0
- package/src/components/plan-version-editor/PlanCatalogPreview.vue +184 -0
- package/src/components/plan-version-editor/PlanComponentPool.vue +272 -0
- package/src/components/plan-version-editor/PlanVersionBasket.vue +281 -0
- package/src/components/plan-version-editor/PlanVersionDiffDialog.vue +84 -0
- package/src/components/plan-version-editor/PlanVersionEditor.vue +1728 -0
- package/src/components/plan-version-editor/PlanVersionEditorHeader.vue +94 -0
- package/src/components/plan-version-editor/types.ts +96 -0
- package/src/components/wizard-stepper/WizardStepper.vue +107 -0
- package/src/create-admin-routes.ts +68 -0
- package/src/create-super-admin-app.ts +345 -0
- package/src/entitlement-provider.ts +36 -0
- package/src/feature-router-guard.ts +77 -0
- package/src/http-json.ts +62 -0
- package/src/index.ts +98 -0
- package/src/manifest-loader.ts +139 -0
- package/src/manifest-store-factory.ts +114 -0
- package/src/nav-builder.ts +274 -0
- package/src/pages-standard/AdminLayout.vue +411 -0
- package/src/pages-standard/AdminManifestErrorPage.vue +79 -0
- package/src/pages-standard/AuditPage.vue +223 -0
- package/src/pages-standard/BundlesPage.vue +910 -0
- package/src/pages-standard/BusinessTypesPage.vue +662 -0
- package/src/pages-standard/DashboardPage.vue +595 -0
- package/src/pages-standard/DiscoveryPage.vue +663 -0
- package/src/pages-standard/EmailHistoryPage.vue +576 -0
- package/src/pages-standard/MarketingCatalogPage.vue +1771 -0
- package/src/pages-standard/PilotsPage.vue +577 -0
- package/src/pages-standard/PlanVersionsPage.vue +216 -0
- package/src/pages-standard/PlansPage.vue +1222 -0
- package/src/pages-standard/PlatformEmailPage.vue +434 -0
- package/src/pages-standard/PromoCodeDetailPage.vue +331 -0
- package/src/pages-standard/PromoCodesPage.vue +589 -0
- package/src/pages-standard/SubscriptionsPage.vue +159 -0
- package/src/pages-standard/SuperAdminLoginPage.vue +299 -0
- package/src/pages-standard/SuperAdminSetupWizard.vue +405 -0
- package/src/pages-standard/TenantDetailPage.vue +432 -0
- package/src/pages-standard/TenantsPage.vue +732 -0
- package/src/pages-standard/UsersPage.vue +504 -0
- package/src/pages-standard/bundles-page/BundleAccordionList.vue +116 -0
- package/src/pages-standard/bundles-page/BundleDetailPanel.vue +193 -0
- package/src/pages-standard/bundles-page/BundlesFilterBar.vue +48 -0
- package/src/pages-standard/bundles-page/BundlesHeader.vue +67 -0
- package/src/pages-standard/bundles-page/BundlesKpis.vue +39 -0
- package/src/pages-standard/bundles-page/types.ts +15 -0
- package/src/pages-standard/discovery-page/CatalogEntryTransPanel.vue +246 -0
- package/src/pages-standard/discovery-page/DiscoveryCapList.vue +171 -0
- package/src/pages-standard/discovery-page/DiscoveryFeatureCard.vue +410 -0
- package/src/pages-standard/discovery-page/DiscoveryHeader.vue +31 -0
- package/src/pages-standard/discovery-page/DiscoveryKpis.vue +47 -0
- package/src/pages-standard/discovery-page/DiscoveryMetaBanner.vue +26 -0
- package/src/pages-standard/discovery-page/DiscoveryQuotaCard.vue +247 -0
- package/src/pages-standard/discovery-page/DiscoveryStatusControl.vue +73 -0
- package/src/pages-standard/discovery-page/discovery-ui.ts +166 -0
- package/src/pages-standard/email-history.types.ts +48 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogAdmin.vue +448 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogHeader.vue +93 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogPreview.vue +138 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogToolbar.vue +58 -0
- package/src/pages-standard/marketing-catalog/types.ts +43 -0
- package/src/pages-standard/plan-versions/PlanDiffCard.vue +132 -0
- package/src/pages-standard/plan-versions/PlanVersionHeader.vue +293 -0
- package/src/pages-standard/plan-versions/PlanVersionStatusBadge.vue +48 -0
- package/src/pages-standard/plan-versions/PlanVersionsAudit.vue +307 -0
- package/src/pages-standard/plan-versions/PlanVersionsDiff.vue +269 -0
- package/src/pages-standard/plan-versions/PlanVersionsKpi.vue +65 -0
- package/src/pages-standard/plan-versions/PlanVersionsList.vue +292 -0
- package/src/pages-standard/plan-versions/PlanVersionsMatrix.vue +261 -0
- package/src/pages-standard/plan-versions/PlanVersionsTimeline.vue +300 -0
- package/src/pages-standard/plan-versions/VersionDiffPreview.vue +167 -0
- package/src/pages-standard/plan-versions/format.ts +53 -0
- package/src/pages-standard/plan-versions/types.ts +33 -0
- package/src/pages-standard/plans-page/PlanArchiveDialog.vue +50 -0
- package/src/pages-standard/plans-page/PlanBundleOverview.vue +147 -0
- package/src/pages-standard/plans-page/PlanDiscardDraftDialog.vue +46 -0
- package/src/pages-standard/plans-page/PlanPublishDialog.vue +106 -0
- package/src/pages-standard/plans-page/PlansPageToast.vue +69 -0
- package/src/pages-standard/plans-page/types.ts +18 -0
- package/src/pages-standard/platform-email.types.ts +41 -0
- package/src/pages-standard/sa-theme.css +223 -0
- package/src/pages-standard/tenants/StatusPill.vue +62 -0
- package/src/pages-standard/tenants/format.ts +38 -0
- package/src/pages-tenant/LimitsRow.vue +67 -0
- package/src/pages-tenant/MySubscriptionBundlesPage.vue +604 -0
- package/src/pages-tenant/OnboardingConfigurator.vue +417 -0
- package/src/pages-tenant/PackageSnapshotPanel.vue +241 -0
- package/src/pages-tenant/PendingVersionBanner.vue +126 -0
- package/src/pages-tenant/PlanChangeWizard.vue +630 -0
- package/src/pages-tenant/TenantPlanSection.vue +729 -0
- package/src/pages-tenant/UsageBar.vue +107 -0
- package/src/pages-tenant/default-i18n.ts +280 -0
- package/src/pages-tenant/tenant-plan-section/BundlePreviewDialog.vue +304 -0
- package/src/pages-tenant/tenant-plan-section/TenantBundleStore.vue +323 -0
- package/src/pages-tenant/tenant-plan-section/TenantFeatureMatrix.vue +122 -0
- package/src/pages-tenant/tenant-plan-section/TenantPlanCardHeader.vue +67 -0
- package/src/pages-tenant/tenant-plan-section/TenantUsageGrid.vue +31 -0
- package/src/plan-versions-catalog.ts +368 -0
- package/src/platform-loaders.ts +68 -0
- package/src/project-page-host.ts +108 -0
- package/src/testing-e2e/admin-pages-suite.ts +187 -0
- package/src/types.ts +58 -0
- package/src/use-actions.ts +25 -0
- package/src/use-api-list.ts +151 -0
- package/src/use-audit-entries.ts +48 -0
- package/src/use-batch-columns.ts +59 -0
- package/src/use-bulk-publish.ts +150 -0
- package/src/use-bundle-versions-map.ts +112 -0
- package/src/use-bundles.ts +297 -0
- package/src/use-business-types.ts +269 -0
- package/src/use-catalog-entries.ts +243 -0
- package/src/use-discovery.ts +158 -0
- package/src/use-entitlement.ts +87 -0
- package/src/use-live-plan-versions.ts +126 -0
- package/src/use-manifest.ts +57 -0
- package/src/use-marketing-projections.ts +160 -0
- package/src/use-nav.ts +33 -0
- package/src/use-plan-editor.ts +162 -0
- package/src/use-plan-versions.ts +83 -0
- package/src/use-plans.ts +375 -0
- package/src/use-platform-tenant-actions.ts +286 -0
- package/src/use-promotions.ts +126 -0
- package/src/use-public-boot.ts +40 -0
- package/src/use-subscription-draft.ts +355 -0
- package/src/use-super-admin-context.ts +93 -0
- package/src/use-tenant-action-flow.ts +238 -0
- package/src/use-tenant-billing-catalog.ts +160 -0
- package/src/use-tenant-billing.ts +453 -0
- package/src/use-tenant-manifest.ts +94 -0
- package/src/use-tenant-subscription-bundles.ts +148 -0
- package/src/use-tenants.ts +61 -0
- package/src/version.ts +10 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<aside class="sp-summary">
|
|
3
|
+
<div class="sp-summary__head">
|
|
4
|
+
<div class="sp-summary__title">{{ planName ?? i18n.noPlan }}</div>
|
|
5
|
+
<div class="sp-summary__cycle">
|
|
6
|
+
{{ pricing.cycle === 'YEARLY' ? i18n.cycleYearly : i18n.cycleMonthly }}
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="sp-summary__body">
|
|
11
|
+
<div v-if="pricing.breakdown.plan" class="sp-summary__group">
|
|
12
|
+
<div class="sp-summary__group-head">{{ i18n.sectionPlan }}</div>
|
|
13
|
+
<div class="sp-summary__line">
|
|
14
|
+
<div>
|
|
15
|
+
<strong>{{ pricing.breakdown.plan.label }}</strong>
|
|
16
|
+
<small v-if="pricing.breakdown.plan.sublabel">
|
|
17
|
+
{{ pricing.breakdown.plan.sublabel }}
|
|
18
|
+
</small>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="sp-summary__price">
|
|
21
|
+
{{ formatCurrency(pricing.breakdown.plan.net) }}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div v-if="pricing.breakdown.bundles.length > 0" class="sp-summary__group">
|
|
27
|
+
<div class="sp-summary__group-head">
|
|
28
|
+
{{ i18n.sectionBundles }} ({{ pricing.breakdown.bundles.length }})
|
|
29
|
+
</div>
|
|
30
|
+
<div
|
|
31
|
+
v-for="item in pricing.breakdown.bundles"
|
|
32
|
+
:key="item.key"
|
|
33
|
+
class="sp-summary__line"
|
|
34
|
+
>
|
|
35
|
+
<div>
|
|
36
|
+
<strong>{{ item.label }}</strong>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="sp-summary__price">{{ formatCurrency(item.net) }}</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div v-if="pricing.breakdown.bundles.length === 0" class="sp-summary__empty">
|
|
43
|
+
{{ i18n.empty }}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="sp-summary__foot">
|
|
48
|
+
<div class="sp-summary__row">
|
|
49
|
+
<span>{{ i18n.subtotal }}</span>
|
|
50
|
+
<span>{{ formatCurrency(pricing.subtotalNet) }}</span>
|
|
51
|
+
</div>
|
|
52
|
+
<div v-if="pricing.discountNet > 0" class="sp-summary__row sp-summary__row--discount">
|
|
53
|
+
<span>{{ i18n.discount }}</span>
|
|
54
|
+
<span>−{{ formatCurrency(pricing.discountNet) }}</span>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<slot name="promo-input" />
|
|
58
|
+
|
|
59
|
+
<div class="sp-summary__total">
|
|
60
|
+
<div class="sp-summary__total-l">
|
|
61
|
+
{{ i18n.total }}
|
|
62
|
+
<small>{{
|
|
63
|
+
pricing.cycle === 'YEARLY' ? i18n.totalUnitYearly : i18n.totalUnitMonthly
|
|
64
|
+
}}</small>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="sp-summary__total-r">{{ formatCurrency(pricing.totalNet) }}</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div
|
|
70
|
+
v-if="pricing.cycle === 'YEARLY' && pricing.yearSavings > 0.5"
|
|
71
|
+
class="sp-summary__savings"
|
|
72
|
+
>
|
|
73
|
+
{{ i18n.yearSavings.replace('{amount}', formatCurrency(pricing.yearSavings)) }}
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<slot name="cta">
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
class="sp-summary__cta"
|
|
80
|
+
:disabled="ctaDisabled || pricing.subtotalNet <= 0"
|
|
81
|
+
@click="emit('submit')"
|
|
82
|
+
>
|
|
83
|
+
{{ ctaLabel }}
|
|
84
|
+
</button>
|
|
85
|
+
</slot>
|
|
86
|
+
|
|
87
|
+
<div v-if="i18n.disclaimer" class="sp-summary__disclaimer">{{ i18n.disclaimer }}</div>
|
|
88
|
+
</div>
|
|
89
|
+
</aside>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import type { DraftPricing } from '../../use-subscription-draft.js';
|
|
94
|
+
|
|
95
|
+
interface I18n {
|
|
96
|
+
noPlan: string;
|
|
97
|
+
cycleMonthly: string;
|
|
98
|
+
cycleYearly: string;
|
|
99
|
+
sectionPlan: string;
|
|
100
|
+
sectionBundles: string;
|
|
101
|
+
empty: string;
|
|
102
|
+
subtotal: string;
|
|
103
|
+
discount: string;
|
|
104
|
+
total: string;
|
|
105
|
+
totalUnitMonthly: string;
|
|
106
|
+
totalUnitYearly: string;
|
|
107
|
+
/** Mit `{amount}`-Platzhalter, z. B. "Du sparst {amount}/Jahr". */
|
|
108
|
+
yearSavings: string;
|
|
109
|
+
/** Optional: Disclaimer-Text unter CTA. */
|
|
110
|
+
disclaimer?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
defineProps<{
|
|
114
|
+
pricing: DraftPricing;
|
|
115
|
+
planName: string | null;
|
|
116
|
+
formatCurrency: (n: number) => string;
|
|
117
|
+
ctaLabel: string;
|
|
118
|
+
ctaDisabled?: boolean;
|
|
119
|
+
i18n: I18n;
|
|
120
|
+
}>();
|
|
121
|
+
|
|
122
|
+
const emit = defineEmits<{
|
|
123
|
+
submit: [];
|
|
124
|
+
}>();
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.sp-summary {
|
|
129
|
+
background: #fff;
|
|
130
|
+
border: 1.5px solid rgba(0, 0, 0, 0.85);
|
|
131
|
+
border-radius: 22px;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
box-shadow: 0 24px 80px rgba(31, 41, 51, 0.1);
|
|
134
|
+
position: sticky;
|
|
135
|
+
top: 24px;
|
|
136
|
+
}
|
|
137
|
+
.sp-summary__head {
|
|
138
|
+
padding: 16px 20px 14px;
|
|
139
|
+
background: rgba(0, 0, 0, 0.85);
|
|
140
|
+
color: #fff;
|
|
141
|
+
display: flex;
|
|
142
|
+
justify-content: space-between;
|
|
143
|
+
align-items: baseline;
|
|
144
|
+
gap: 8px;
|
|
145
|
+
}
|
|
146
|
+
.sp-summary__title {
|
|
147
|
+
font-size: 18px;
|
|
148
|
+
font-weight: 700;
|
|
149
|
+
}
|
|
150
|
+
.sp-summary__cycle {
|
|
151
|
+
font-family: 'SF Mono', Consolas, monospace;
|
|
152
|
+
font-size: 10px;
|
|
153
|
+
letter-spacing: 0.08em;
|
|
154
|
+
text-transform: uppercase;
|
|
155
|
+
background: rgba(255, 255, 255, 0.16);
|
|
156
|
+
padding: 4px 9px;
|
|
157
|
+
border-radius: 999px;
|
|
158
|
+
}
|
|
159
|
+
.sp-summary__body {
|
|
160
|
+
padding: 16px 20px 4px;
|
|
161
|
+
max-height: 50vh;
|
|
162
|
+
overflow-y: auto;
|
|
163
|
+
}
|
|
164
|
+
.sp-summary__group {
|
|
165
|
+
margin-bottom: 14px;
|
|
166
|
+
}
|
|
167
|
+
.sp-summary__group-head {
|
|
168
|
+
font-family: 'SF Mono', Consolas, monospace;
|
|
169
|
+
font-size: 10px;
|
|
170
|
+
letter-spacing: 0.12em;
|
|
171
|
+
text-transform: uppercase;
|
|
172
|
+
color: rgba(0, 0, 0, 0.5);
|
|
173
|
+
font-weight: 700;
|
|
174
|
+
padding-bottom: 6px;
|
|
175
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
176
|
+
margin-bottom: 6px;
|
|
177
|
+
}
|
|
178
|
+
.sp-summary__line {
|
|
179
|
+
display: grid;
|
|
180
|
+
grid-template-columns: 1fr auto;
|
|
181
|
+
gap: 10px;
|
|
182
|
+
align-items: baseline;
|
|
183
|
+
padding: 4px 0;
|
|
184
|
+
font-size: 13px;
|
|
185
|
+
}
|
|
186
|
+
.sp-summary__line strong {
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
}
|
|
189
|
+
.sp-summary__line small {
|
|
190
|
+
display: block;
|
|
191
|
+
font-family: 'SF Mono', Consolas, monospace;
|
|
192
|
+
font-size: 9.5px;
|
|
193
|
+
letter-spacing: 0.06em;
|
|
194
|
+
text-transform: uppercase;
|
|
195
|
+
color: rgba(0, 0, 0, 0.5);
|
|
196
|
+
margin-top: 2px;
|
|
197
|
+
}
|
|
198
|
+
.sp-summary__price {
|
|
199
|
+
white-space: nowrap;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
font-size: 14px;
|
|
202
|
+
}
|
|
203
|
+
.sp-summary__empty {
|
|
204
|
+
padding: 20px 8px;
|
|
205
|
+
text-align: center;
|
|
206
|
+
font-size: 12px;
|
|
207
|
+
color: rgba(0, 0, 0, 0.5);
|
|
208
|
+
line-height: 1.5;
|
|
209
|
+
font-style: italic;
|
|
210
|
+
}
|
|
211
|
+
.sp-summary__foot {
|
|
212
|
+
border-top: 1px solid rgba(0, 0, 0, 0.08);
|
|
213
|
+
padding: 16px 20px 18px;
|
|
214
|
+
background: rgba(15, 118, 110, 0.04);
|
|
215
|
+
}
|
|
216
|
+
.sp-summary__row {
|
|
217
|
+
display: flex;
|
|
218
|
+
justify-content: space-between;
|
|
219
|
+
align-items: baseline;
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
color: rgba(0, 0, 0, 0.55);
|
|
222
|
+
margin-bottom: 4px;
|
|
223
|
+
}
|
|
224
|
+
.sp-summary__row--discount {
|
|
225
|
+
color: #166534;
|
|
226
|
+
}
|
|
227
|
+
.sp-summary__total {
|
|
228
|
+
display: flex;
|
|
229
|
+
justify-content: space-between;
|
|
230
|
+
align-items: baseline;
|
|
231
|
+
margin-top: 6px;
|
|
232
|
+
}
|
|
233
|
+
.sp-summary__total-l {
|
|
234
|
+
font-size: 14px;
|
|
235
|
+
font-weight: 700;
|
|
236
|
+
}
|
|
237
|
+
.sp-summary__total-l small {
|
|
238
|
+
display: block;
|
|
239
|
+
font-family: 'SF Mono', Consolas, monospace;
|
|
240
|
+
font-size: 10px;
|
|
241
|
+
letter-spacing: 0.06em;
|
|
242
|
+
text-transform: uppercase;
|
|
243
|
+
color: rgba(0, 0, 0, 0.5);
|
|
244
|
+
font-weight: 500;
|
|
245
|
+
margin-top: 2px;
|
|
246
|
+
}
|
|
247
|
+
.sp-summary__total-r {
|
|
248
|
+
font-size: 32px;
|
|
249
|
+
font-weight: 800;
|
|
250
|
+
color: var(--q-primary, #0f766e);
|
|
251
|
+
letter-spacing: -0.02em;
|
|
252
|
+
line-height: 1;
|
|
253
|
+
}
|
|
254
|
+
.sp-summary__savings {
|
|
255
|
+
margin-top: 10px;
|
|
256
|
+
padding: 8px 10px;
|
|
257
|
+
background: rgba(22, 163, 74, 0.12);
|
|
258
|
+
color: #166534;
|
|
259
|
+
border-radius: 8px;
|
|
260
|
+
font-size: 12px;
|
|
261
|
+
font-weight: 600;
|
|
262
|
+
}
|
|
263
|
+
.sp-summary__cta {
|
|
264
|
+
display: block;
|
|
265
|
+
width: 100%;
|
|
266
|
+
margin-top: 14px;
|
|
267
|
+
padding: 14px 18px;
|
|
268
|
+
background: var(--q-primary, #0f766e);
|
|
269
|
+
color: #fff;
|
|
270
|
+
border: none;
|
|
271
|
+
border-radius: 14px;
|
|
272
|
+
font-family: inherit;
|
|
273
|
+
font-size: 14px;
|
|
274
|
+
font-weight: 700;
|
|
275
|
+
letter-spacing: 0.01em;
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
transition: all 200ms;
|
|
278
|
+
}
|
|
279
|
+
.sp-summary__cta:hover:not(:disabled) {
|
|
280
|
+
transform: translateY(-1px);
|
|
281
|
+
}
|
|
282
|
+
.sp-summary__cta:disabled {
|
|
283
|
+
opacity: 0.4;
|
|
284
|
+
cursor: not-allowed;
|
|
285
|
+
}
|
|
286
|
+
.sp-summary__disclaimer {
|
|
287
|
+
margin-top: 12px;
|
|
288
|
+
font-size: 11px;
|
|
289
|
+
color: rgba(0, 0, 0, 0.5);
|
|
290
|
+
line-height: 1.5;
|
|
291
|
+
text-align: center;
|
|
292
|
+
}
|
|
293
|
+
</style>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
v-if="!open && state.status === 'idle'"
|
|
4
|
+
type="button"
|
|
5
|
+
class="sp-promo__toggle"
|
|
6
|
+
@click="open = true"
|
|
7
|
+
>
|
|
8
|
+
🎟 {{ i18n.openLabel }}
|
|
9
|
+
</button>
|
|
10
|
+
<div v-else class="sp-promo" :class="`sp-promo--${state.status}`">
|
|
11
|
+
<div class="sp-promo__field">
|
|
12
|
+
<input
|
|
13
|
+
v-model="localCode"
|
|
14
|
+
:placeholder="i18n.placeholder"
|
|
15
|
+
:disabled="state.status === 'checking'"
|
|
16
|
+
:aria-label="i18n.placeholder"
|
|
17
|
+
@input="onInput"
|
|
18
|
+
@keydown.enter.prevent="apply"
|
|
19
|
+
/>
|
|
20
|
+
<button
|
|
21
|
+
v-if="state.status === 'valid'"
|
|
22
|
+
type="button"
|
|
23
|
+
class="sp-promo__btn sp-promo__btn--remove"
|
|
24
|
+
@click="remove"
|
|
25
|
+
>
|
|
26
|
+
{{ i18n.remove }}
|
|
27
|
+
</button>
|
|
28
|
+
<button
|
|
29
|
+
v-else
|
|
30
|
+
type="button"
|
|
31
|
+
class="sp-promo__btn"
|
|
32
|
+
:disabled="!localCode || state.status === 'checking'"
|
|
33
|
+
@click="apply"
|
|
34
|
+
>
|
|
35
|
+
{{ state.status === 'checking' ? '…' : i18n.apply }}
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
38
|
+
<div v-if="state.message" :class="['sp-promo__msg', `sp-promo__msg--${state.status}`]">
|
|
39
|
+
<template v-if="state.status === 'valid'">✓ </template>
|
|
40
|
+
<template v-else-if="state.status === 'invalid'">⚠ </template>
|
|
41
|
+
<template v-else-if="state.status === 'restricted'">ℹ </template>
|
|
42
|
+
{{ state.message }}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { ref, watch } from 'vue';
|
|
49
|
+
import type { PromoState } from '../../use-subscription-draft.js';
|
|
50
|
+
|
|
51
|
+
interface I18n {
|
|
52
|
+
openLabel: string;
|
|
53
|
+
placeholder: string;
|
|
54
|
+
apply: string;
|
|
55
|
+
remove: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const props = defineProps<{
|
|
59
|
+
modelValue: string;
|
|
60
|
+
state: PromoState;
|
|
61
|
+
i18n: I18n;
|
|
62
|
+
}>();
|
|
63
|
+
|
|
64
|
+
const emit = defineEmits<{
|
|
65
|
+
'update:modelValue': [string];
|
|
66
|
+
apply: [];
|
|
67
|
+
remove: [];
|
|
68
|
+
}>();
|
|
69
|
+
|
|
70
|
+
const open = ref(props.state.status !== 'idle');
|
|
71
|
+
const localCode = ref(props.modelValue);
|
|
72
|
+
|
|
73
|
+
watch(
|
|
74
|
+
() => props.modelValue,
|
|
75
|
+
(v) => {
|
|
76
|
+
if (v !== localCode.value) localCode.value = v;
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
watch(
|
|
80
|
+
() => props.state.status,
|
|
81
|
+
(s) => {
|
|
82
|
+
if (s !== 'idle') open.value = true;
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
function onInput(e: Event): void {
|
|
87
|
+
const v = (e.target as HTMLInputElement).value.toUpperCase();
|
|
88
|
+
localCode.value = v;
|
|
89
|
+
emit('update:modelValue', v);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function apply(): void {
|
|
93
|
+
if (!localCode.value) return;
|
|
94
|
+
emit('apply');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function remove(): void {
|
|
98
|
+
emit('remove');
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style scoped>
|
|
103
|
+
.sp-promo__toggle {
|
|
104
|
+
width: 100%;
|
|
105
|
+
padding: 10px 12px;
|
|
106
|
+
margin: 10px 0 6px;
|
|
107
|
+
border: 1px dashed rgba(15, 118, 110, 0.3);
|
|
108
|
+
background: rgba(15, 118, 110, 0.04);
|
|
109
|
+
border-radius: 10px;
|
|
110
|
+
color: var(--q-primary, #0f766e);
|
|
111
|
+
font-weight: 700;
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
font-family: inherit;
|
|
115
|
+
letter-spacing: 0.01em;
|
|
116
|
+
}
|
|
117
|
+
.sp-promo__toggle:hover {
|
|
118
|
+
background: rgba(15, 118, 110, 0.1);
|
|
119
|
+
}
|
|
120
|
+
.sp-promo {
|
|
121
|
+
margin: 10px 0 6px;
|
|
122
|
+
padding: 10px;
|
|
123
|
+
background: rgba(15, 118, 110, 0.04);
|
|
124
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
125
|
+
border-radius: 10px;
|
|
126
|
+
}
|
|
127
|
+
.sp-promo--valid {
|
|
128
|
+
border-color: rgba(22, 163, 74, 0.5);
|
|
129
|
+
background: rgba(22, 163, 74, 0.06);
|
|
130
|
+
}
|
|
131
|
+
.sp-promo--invalid {
|
|
132
|
+
border-color: rgba(220, 38, 38, 0.4);
|
|
133
|
+
background: rgba(220, 38, 38, 0.04);
|
|
134
|
+
}
|
|
135
|
+
.sp-promo--restricted {
|
|
136
|
+
border-color: rgba(245, 158, 11, 0.4);
|
|
137
|
+
background: rgba(245, 158, 11, 0.06);
|
|
138
|
+
}
|
|
139
|
+
.sp-promo__field {
|
|
140
|
+
display: flex;
|
|
141
|
+
gap: 6px;
|
|
142
|
+
}
|
|
143
|
+
.sp-promo__field input {
|
|
144
|
+
flex: 1;
|
|
145
|
+
padding: 8px 10px;
|
|
146
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
147
|
+
border-radius: 8px;
|
|
148
|
+
font-family: 'SF Mono', Consolas, monospace;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
letter-spacing: 0.04em;
|
|
151
|
+
background: #fff;
|
|
152
|
+
outline: none;
|
|
153
|
+
text-transform: uppercase;
|
|
154
|
+
}
|
|
155
|
+
.sp-promo__field input:focus {
|
|
156
|
+
border-color: var(--q-primary, #0f766e);
|
|
157
|
+
}
|
|
158
|
+
.sp-promo__btn {
|
|
159
|
+
padding: 8px 12px;
|
|
160
|
+
background: var(--q-primary, #0f766e);
|
|
161
|
+
color: #fff;
|
|
162
|
+
border: none;
|
|
163
|
+
border-radius: 8px;
|
|
164
|
+
font-family: inherit;
|
|
165
|
+
font-size: 11px;
|
|
166
|
+
font-weight: 700;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
min-width: 70px;
|
|
169
|
+
}
|
|
170
|
+
.sp-promo__btn:disabled {
|
|
171
|
+
opacity: 0.5;
|
|
172
|
+
cursor: not-allowed;
|
|
173
|
+
}
|
|
174
|
+
.sp-promo__btn--remove {
|
|
175
|
+
background: rgba(220, 38, 38, 0.1);
|
|
176
|
+
color: #b91c1c;
|
|
177
|
+
}
|
|
178
|
+
.sp-promo__msg {
|
|
179
|
+
margin-top: 6px;
|
|
180
|
+
font-size: 11px;
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
}
|
|
183
|
+
.sp-promo__msg--valid {
|
|
184
|
+
color: #166534;
|
|
185
|
+
}
|
|
186
|
+
.sp-promo__msg--invalid {
|
|
187
|
+
color: #b91c1c;
|
|
188
|
+
}
|
|
189
|
+
.sp-promo__msg--restricted {
|
|
190
|
+
color: #92400e;
|
|
191
|
+
}
|
|
192
|
+
</style>
|