@solvapay/react 1.0.8-preview.9 → 1.0.9

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.
@@ -9,12 +9,46 @@ import {
9
9
  ActivationFlowRetrying,
10
10
  ActivationFlowRoot,
11
11
  ActivationFlowSummary,
12
+ CreditGate,
13
+ CreditGateError,
14
+ CreditGateHeading,
15
+ CreditGateLoading,
16
+ CreditGateRoot,
17
+ CreditGateSubheading,
18
+ CreditGateTopup,
19
+ PlanBadge,
20
+ ProductBadge,
21
+ PurchaseGate,
22
+ PurchaseGateAllowed,
23
+ PurchaseGateBlocked,
24
+ PurchaseGateError,
25
+ PurchaseGateLoading,
26
+ PurchaseGateRoot,
27
+ useActivationFlow,
28
+ useCreditGate,
29
+ usePurchaseGate
30
+ } from "../chunk-R2ZPZ7VM.js";
31
+ import {
32
+ Balance,
33
+ EmbeddedCheckout,
34
+ Heading,
35
+ HostedCheckoutLink,
36
+ Message,
37
+ PaywallNotice,
38
+ Plans,
39
+ ProductContext,
40
+ Retry,
41
+ Root as Root2,
42
+ usePaywallNotice
43
+ } from "../chunk-ZAV7CQ4G.js";
44
+ import {
12
45
  AmountPicker,
13
46
  AmountPickerConfirm,
14
47
  AmountPickerCustom,
15
48
  AmountPickerOption,
16
49
  AmountPickerRoot,
17
50
  BalanceBadge,
51
+ Bar,
18
52
  CancelPlanButton,
19
53
  CancelledPlanNotice,
20
54
  CancelledPlanNoticeAccessUntil,
@@ -32,13 +66,9 @@ import {
32
66
  CheckoutSummaryRoot,
33
67
  CheckoutSummaryTaxNote,
34
68
  CheckoutSummaryTrial,
35
- CreditGate,
36
- CreditGateError,
37
- CreditGateHeading,
38
- CreditGateLoading,
39
- CreditGateRoot,
40
- CreditGateSubheading,
41
- CreditGateTopup,
69
+ Empty,
70
+ Label,
71
+ Loading,
42
72
  MandateText,
43
73
  PaymentForm,
44
74
  PaymentFormCardElement,
@@ -51,7 +81,7 @@ import {
51
81
  PaymentFormSubmitButton,
52
82
  PaymentFormSummary,
53
83
  PaymentFormTermsCheckbox,
54
- PlanBadge,
84
+ Percentage,
55
85
  PlanSelector,
56
86
  PlanSelectorCard,
57
87
  PlanSelectorCardBadge,
@@ -63,13 +93,8 @@ import {
63
93
  PlanSelectorHeading,
64
94
  PlanSelectorLoading,
65
95
  PlanSelectorRoot,
66
- ProductBadge,
67
- PurchaseGate,
68
- PurchaseGateAllowed,
69
- PurchaseGateBlocked,
70
- PurchaseGateError,
71
- PurchaseGateLoading,
72
- PurchaseGateRoot,
96
+ ResetsIn,
97
+ Root,
73
98
  Slot,
74
99
  Slottable,
75
100
  TopupForm,
@@ -78,20 +103,20 @@ import {
78
103
  TopupFormPaymentElement,
79
104
  TopupFormRoot,
80
105
  TopupFormSubmitButton,
106
+ UsageMeter,
81
107
  composeEventHandlers,
82
108
  composeRefs,
83
109
  setRef,
84
- useActivationFlow,
85
110
  useAmountPicker,
86
111
  useAmountPickerCopy,
87
112
  useCancelledPlanNotice,
88
113
  useCheckoutSummary,
89
- useCreditGate,
90
114
  usePlanSelector,
91
- usePurchaseGate,
92
- useTopupForm
93
- } from "../chunk-MOP3ZBGC.js";
115
+ useTopupForm,
116
+ useUsageMeter
117
+ } from "../chunk-37R5NZGF.js";
94
118
  import "../chunk-OUSEQRCT.js";
119
+ import "../chunk-MLKGABMK.js";
95
120
  export {
96
121
  ActivationFlow,
97
122
  ActivationFlowActivateButton,
@@ -145,6 +170,16 @@ export {
145
170
  PaymentFormSubmitButton,
146
171
  PaymentFormSummary,
147
172
  PaymentFormTermsCheckbox,
173
+ PaywallNotice,
174
+ Balance as PaywallNoticeBalance,
175
+ EmbeddedCheckout as PaywallNoticeEmbeddedCheckout,
176
+ Heading as PaywallNoticeHeading,
177
+ HostedCheckoutLink as PaywallNoticeHostedCheckoutLink,
178
+ Message as PaywallNoticeMessage,
179
+ Plans as PaywallNoticePlans,
180
+ ProductContext as PaywallNoticeProductContext,
181
+ Retry as PaywallNoticeRetry,
182
+ Root2 as PaywallNoticeRoot,
148
183
  PlanBadge,
149
184
  PlanSelector,
150
185
  PlanSelectorCard,
@@ -172,6 +207,14 @@ export {
172
207
  TopupFormPaymentElement,
173
208
  TopupFormRoot,
174
209
  TopupFormSubmitButton,
210
+ UsageMeter,
211
+ Bar as UsageMeterBar,
212
+ Empty as UsageMeterEmpty,
213
+ Label as UsageMeterLabel,
214
+ Loading as UsageMeterLoading,
215
+ Percentage as UsageMeterPercentage,
216
+ ResetsIn as UsageMeterResetsIn,
217
+ Root as UsageMeterRoot,
175
218
  composeEventHandlers,
176
219
  composeRefs,
177
220
  setRef,
@@ -181,7 +224,9 @@ export {
181
224
  useCancelledPlanNotice,
182
225
  useCheckoutSummary,
183
226
  useCreditGate,
227
+ usePaywallNotice,
184
228
  usePlanSelector,
185
229
  usePurchaseGate,
186
- useTopupForm
230
+ useTopupForm,
231
+ useUsageMeter
187
232
  };
package/dist/styles.css CHANGED
@@ -22,6 +22,28 @@
22
22
  --solvapay-font: inherit;
23
23
  }
24
24
 
25
+ /* -----------------------------------------------------------------------------
26
+ * Spinner (shared across PaymentForm, TopupForm, StripePaymentFormWrapper)
27
+ * -------------------------------------------------------------------------- */
28
+
29
+ @keyframes solvapay-spin {
30
+ to {
31
+ transform: rotate(360deg);
32
+ }
33
+ }
34
+
35
+ [data-solvapay-spinner] {
36
+ animation: solvapay-spin 0.8s linear infinite;
37
+ flex-shrink: 0;
38
+ vertical-align: middle;
39
+ }
40
+
41
+ @media (prefers-reduced-motion: reduce) {
42
+ [data-solvapay-spinner] {
43
+ animation: none;
44
+ }
45
+ }
46
+
25
47
  /* -----------------------------------------------------------------------------
26
48
  * Checkout layout shell (drop-in)
27
49
  * -------------------------------------------------------------------------- */
@@ -327,6 +349,10 @@
327
349
  }
328
350
 
329
351
  [data-solvapay-payment-form-submit] {
352
+ display: inline-flex;
353
+ align-items: center;
354
+ justify-content: center;
355
+ gap: 0.5rem;
330
356
  background: var(--solvapay-accent);
331
357
  color: var(--solvapay-accent-foreground);
332
358
  border: none;
@@ -796,6 +822,10 @@
796
822
 
797
823
  [data-solvapay-topup-form-submit],
798
824
  .solvapay-topup-form-submit {
825
+ display: inline-flex;
826
+ align-items: center;
827
+ justify-content: center;
828
+ gap: 0.5rem;
799
829
  align-self: stretch;
800
830
  background: var(--solvapay-accent);
801
831
  color: var(--solvapay-accent-foreground);
@@ -867,3 +897,219 @@
867
897
  font-weight: 500;
868
898
  padding: 0.25rem 0.625rem;
869
899
  }
900
+
901
+ /* -----------------------------------------------------------------------------
902
+ * CurrentPlanCard
903
+ * -------------------------------------------------------------------------- */
904
+
905
+ [data-solvapay-current-plan-card],
906
+ .solvapay-current-plan-card {
907
+ display: flex;
908
+ flex-direction: column;
909
+ gap: 0.5rem;
910
+ background: var(--solvapay-surface);
911
+ border: 1px solid var(--solvapay-border);
912
+ border-radius: var(--solvapay-radius);
913
+ padding: 1rem;
914
+ }
915
+
916
+ [data-solvapay-current-plan-heading],
917
+ .solvapay-current-plan-heading {
918
+ font-size: 1rem;
919
+ font-weight: 600;
920
+ margin: 0;
921
+ color: var(--solvapay-accent);
922
+ }
923
+
924
+ [data-solvapay-current-plan-name],
925
+ .solvapay-current-plan-name {
926
+ font-weight: 600;
927
+ color: var(--solvapay-accent);
928
+ }
929
+
930
+ [data-solvapay-current-plan-price],
931
+ .solvapay-current-plan-price {
932
+ font-size: 1.125rem;
933
+ font-weight: 600;
934
+ color: var(--solvapay-accent);
935
+ font-variant-numeric: tabular-nums;
936
+ }
937
+
938
+ [data-solvapay-current-plan-next-billing],
939
+ [data-solvapay-current-plan-expires],
940
+ .solvapay-current-plan-date-line {
941
+ display: block;
942
+ color: var(--solvapay-muted-foreground);
943
+ font-size: 0.8125rem;
944
+ }
945
+
946
+ [data-solvapay-current-plan-balance-line],
947
+ .solvapay-current-plan-balance-line {
948
+ display: flex;
949
+ align-items: baseline;
950
+ gap: 0.375rem;
951
+ font-size: 0.875rem;
952
+ }
953
+
954
+ [data-solvapay-current-plan-payment-method],
955
+ .solvapay-current-plan-payment-method {
956
+ display: block;
957
+ color: var(--solvapay-muted-foreground);
958
+ font-size: 0.8125rem;
959
+ }
960
+
961
+ [data-solvapay-current-plan-actions],
962
+ .solvapay-current-plan-actions {
963
+ display: flex;
964
+ flex-wrap: wrap;
965
+ gap: 0.5rem;
966
+ margin-top: 0.25rem;
967
+ }
968
+
969
+ /* -----------------------------------------------------------------------------
970
+ * LaunchCustomerPortalButton (also applies to UpdatePaymentMethodButton, which
971
+ * forwards `data-solvapay-update-payment-method` onto the same element).
972
+ *
973
+ * Ready state renders as <a target="_blank">; loading/error render as
974
+ * <button disabled>. The <a> rules explicitly reset `text-decoration` and
975
+ * align the label so the link doesn't fall back to the browser's default
976
+ * underlined styling inside the CurrentPlanCard actions row.
977
+ * -------------------------------------------------------------------------- */
978
+
979
+ [data-solvapay-launch-customer-portal] {
980
+ display: inline-flex;
981
+ align-items: center;
982
+ justify-content: center;
983
+ background: var(--solvapay-accent);
984
+ color: var(--solvapay-accent-foreground);
985
+ border: none;
986
+ border-radius: var(--solvapay-radius);
987
+ cursor: pointer;
988
+ font: inherit;
989
+ font-weight: 500;
990
+ padding: 0.5rem 0.875rem;
991
+ text-decoration: none;
992
+ transition:
993
+ background-color 120ms ease,
994
+ opacity 120ms ease;
995
+ }
996
+
997
+ [data-solvapay-launch-customer-portal][data-state='ready']:hover {
998
+ background: var(--solvapay-accent-hover);
999
+ }
1000
+
1001
+ [data-solvapay-launch-customer-portal]:focus-visible {
1002
+ outline: 2px solid var(--solvapay-accent);
1003
+ outline-offset: 2px;
1004
+ }
1005
+
1006
+ [data-solvapay-launch-customer-portal][data-state='loading'] {
1007
+ opacity: 0.75;
1008
+ cursor: wait;
1009
+ }
1010
+
1011
+ [data-solvapay-launch-customer-portal][data-state='error'] {
1012
+ opacity: 0.5;
1013
+ cursor: not-allowed;
1014
+ }
1015
+
1016
+ /* -----------------------------------------------------------------------------
1017
+ * UsageMeter (Phase 2.2)
1018
+ *
1019
+ * Horizontal progress bar with `data-state="safe|warning|critical|loading"`
1020
+ * on both the root and the bar itself. The fill width is driven by a CSS
1021
+ * custom property so the bar never needs inline styles.
1022
+ * -------------------------------------------------------------------------- */
1023
+
1024
+ :root {
1025
+ --solvapay-usage-safe: var(--solvapay-accent);
1026
+ --solvapay-usage-warning: var(--solvapay-warning);
1027
+ --solvapay-usage-critical: var(--solvapay-destructive);
1028
+ --solvapay-usage-meter-fill: 0%;
1029
+ }
1030
+
1031
+ [data-solvapay-usage-meter] {
1032
+ display: flex;
1033
+ flex-direction: column;
1034
+ gap: 0.375rem;
1035
+ font-size: 0.875rem;
1036
+ color: var(--solvapay-muted-foreground);
1037
+ }
1038
+
1039
+ [data-solvapay-usage-meter-bar] {
1040
+ position: relative;
1041
+ width: 100%;
1042
+ height: 0.5rem;
1043
+ background: var(--solvapay-muted);
1044
+ border-radius: 999px;
1045
+ overflow: hidden;
1046
+ }
1047
+
1048
+ [data-solvapay-usage-meter-bar]::after {
1049
+ content: '';
1050
+ display: block;
1051
+ height: 100%;
1052
+ width: var(--solvapay-usage-meter-fill, 0%);
1053
+ background: var(--solvapay-usage-safe);
1054
+ border-radius: inherit;
1055
+ transition: width 200ms ease;
1056
+ }
1057
+
1058
+ [data-solvapay-usage-meter-bar][data-state='warning']::after {
1059
+ background: var(--solvapay-usage-warning);
1060
+ }
1061
+
1062
+ [data-solvapay-usage-meter-bar][data-state='critical']::after {
1063
+ background: var(--solvapay-usage-critical);
1064
+ }
1065
+
1066
+ [data-solvapay-usage-meter-label] {
1067
+ color: var(--solvapay-accent);
1068
+ font-weight: 500;
1069
+ }
1070
+
1071
+ [data-solvapay-usage-meter-percentage],
1072
+ [data-solvapay-usage-meter-resets-in] {
1073
+ color: var(--solvapay-muted-foreground);
1074
+ }
1075
+
1076
+ [data-solvapay-usage-meter-empty] {
1077
+ color: var(--solvapay-muted-foreground);
1078
+ font-style: italic;
1079
+ }
1080
+
1081
+ /* -----------------------------------------------------------------------------
1082
+ * PaywallNotice (Phase 2.1)
1083
+ * -------------------------------------------------------------------------- */
1084
+
1085
+ [data-solvapay-paywall-notice] {
1086
+ display: flex;
1087
+ flex-direction: column;
1088
+ gap: 0.75rem;
1089
+ padding: 1rem;
1090
+ border: 1px solid var(--solvapay-border);
1091
+ border-radius: var(--solvapay-radius);
1092
+ background: var(--solvapay-surface);
1093
+ }
1094
+
1095
+ [data-solvapay-paywall-heading] {
1096
+ margin: 0;
1097
+ font-size: 1.125rem;
1098
+ font-weight: 600;
1099
+ color: var(--solvapay-accent);
1100
+ }
1101
+
1102
+ [data-solvapay-paywall-message] {
1103
+ margin: 0;
1104
+ color: var(--solvapay-muted-foreground);
1105
+ }
1106
+
1107
+ [data-solvapay-paywall-balance] {
1108
+ font-weight: 500;
1109
+ color: var(--solvapay-accent);
1110
+ }
1111
+
1112
+ [data-solvapay-paywall-retry][data-state='waiting'] {
1113
+ opacity: 0.5;
1114
+ cursor: wait;
1115
+ }