@schematichq/schematic-components 1.8.0 → 1.9.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.
@@ -2213,6 +2213,25 @@ function getCreditBasedEntitlementLimit(entitlement, credits) {
2213
2213
  };
2214
2214
  }
2215
2215
  }
2216
+ function extractCurrentUsageBasedEntitlements(features = [], planPeriod) {
2217
+ return features.reduce((acc, entitlement) => {
2218
+ if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
2219
+ const allocation = entitlement.allocation || 0;
2220
+ const usage = entitlement.usage || 0;
2221
+ const quantity = allocation ?? usage;
2222
+ acc.push({
2223
+ ...entitlement,
2224
+ allocation,
2225
+ usage,
2226
+ quantity
2227
+ });
2228
+ }
2229
+ return acc;
2230
+ }, []);
2231
+ }
2232
+ function getEntitlementFeatureName(entitlement, defaultValue) {
2233
+ return entitlement.feature?.pluralName || entitlement.feature?.name || entitlement.featureName || defaultValue || "";
2234
+ }
2216
2235
 
2217
2236
  // src/utils/pluralize.ts
2218
2237
  var pluralRules = [];
@@ -4792,7 +4811,12 @@ var Translator = class _Translator extends EventEmitter {
4792
4811
  };
4793
4812
  if (key == null) return false;
4794
4813
  const resolved = this.resolve(key, opt);
4795
- return resolved?.res !== void 0;
4814
+ if (resolved?.res === void 0) return false;
4815
+ const isObject2 = shouldHandleAsObject(resolved.res);
4816
+ if (opt.returnObjects === false && isObject2) {
4817
+ return false;
4818
+ }
4819
+ return true;
4796
4820
  }
4797
4821
  extractFromKey(key, opt) {
4798
4822
  let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
@@ -8112,6 +8136,85 @@ function EntityTraitDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8112
8136
  };
8113
8137
  }
8114
8138
 
8139
+ // src/api/checkoutexternal/models/TraitDefinition.ts
8140
+ function TraitDefinitionFromJSON(json) {
8141
+ return TraitDefinitionFromJSONTyped(json, false);
8142
+ }
8143
+ function TraitDefinitionFromJSONTyped(json, ignoreDiscriminator) {
8144
+ if (json == null) {
8145
+ return json;
8146
+ }
8147
+ return {
8148
+ comparableType: json["comparable_type"],
8149
+ entityType: json["entity_type"],
8150
+ id: json["id"]
8151
+ };
8152
+ }
8153
+
8154
+ // src/api/checkoutexternal/models/Condition.ts
8155
+ function ConditionFromJSON(json) {
8156
+ return ConditionFromJSONTyped(json, false);
8157
+ }
8158
+ function ConditionFromJSONTyped(json, ignoreDiscriminator) {
8159
+ if (json == null) {
8160
+ return json;
8161
+ }
8162
+ return {
8163
+ accountId: json["account_id"],
8164
+ comparisonTraitDefinition: json["comparison_trait_definition"] == null ? void 0 : TraitDefinitionFromJSON(json["comparison_trait_definition"]),
8165
+ conditionType: json["condition_type"],
8166
+ consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8167
+ creditId: json["credit_id"] == null ? void 0 : json["credit_id"],
8168
+ environmentId: json["environment_id"],
8169
+ eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
8170
+ id: json["id"],
8171
+ metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
8172
+ metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
8173
+ metricValue: json["metric_value"] == null ? void 0 : json["metric_value"],
8174
+ operator: json["operator"],
8175
+ resourceIds: json["resource_ids"],
8176
+ traitDefinition: json["trait_definition"] == null ? void 0 : TraitDefinitionFromJSON(json["trait_definition"]),
8177
+ traitValue: json["trait_value"]
8178
+ };
8179
+ }
8180
+
8181
+ // src/api/checkoutexternal/models/ConditionGroup.ts
8182
+ function ConditionGroupFromJSON(json) {
8183
+ return ConditionGroupFromJSONTyped(json, false);
8184
+ }
8185
+ function ConditionGroupFromJSONTyped(json, ignoreDiscriminator) {
8186
+ if (json == null) {
8187
+ return json;
8188
+ }
8189
+ return {
8190
+ conditions: json["conditions"].map(ConditionFromJSON)
8191
+ };
8192
+ }
8193
+
8194
+ // src/api/checkoutexternal/models/Rule.ts
8195
+ function RuleFromJSON(json) {
8196
+ return RuleFromJSONTyped(json, false);
8197
+ }
8198
+ function RuleFromJSONTyped(json, ignoreDiscriminator) {
8199
+ if (json == null) {
8200
+ return json;
8201
+ }
8202
+ return {
8203
+ accountId: json["account_id"],
8204
+ conditionGroups: json["condition_groups"].map(
8205
+ ConditionGroupFromJSON
8206
+ ),
8207
+ conditions: json["conditions"].map(ConditionFromJSON),
8208
+ environmentId: json["environment_id"],
8209
+ flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
8210
+ id: json["id"],
8211
+ name: json["name"],
8212
+ priority: json["priority"],
8213
+ ruleType: json["rule_type"],
8214
+ value: json["value"]
8215
+ };
8216
+ }
8217
+
8115
8218
  // src/api/checkoutexternal/models/GenericPreviewObject.ts
8116
8219
  function GenericPreviewObjectFromJSON(json) {
8117
8220
  return GenericPreviewObjectFromJSONTyped(json, false);
@@ -8164,6 +8267,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8164
8267
  ),
8165
8268
  plan: json["plan"] == null ? void 0 : CompanyPlanWithBillingSubViewFromJSON(json["plan"]),
8166
8269
  plans: json["plans"].map(GenericPreviewObjectFromJSON),
8270
+ rules: json["rules"].map(RuleFromJSON),
8167
8271
  traits: json["traits"] == null ? void 0 : json["traits"],
8168
8272
  updatedAt: new Date(json["updated_at"]),
8169
8273
  userCount: json["user_count"]
@@ -8578,14 +8682,20 @@ function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8578
8682
  creditTotal: json["credit_total"] == null ? void 0 : json["credit_total"],
8579
8683
  creditTypeIcon: json["credit_type_icon"] == null ? void 0 : json["credit_type_icon"],
8580
8684
  creditUsed: json["credit_used"] == null ? void 0 : json["credit_used"],
8685
+ effectiveLimit: json["effective_limit"] == null ? void 0 : json["effective_limit"],
8686
+ effectivePrice: json["effective_price"] == null ? void 0 : json["effective_price"],
8581
8687
  entitlementExpirationDate: json["entitlement_expiration_date"] == null ? void 0 : new Date(json["entitlement_expiration_date"]),
8582
8688
  entitlementId: json["entitlement_id"],
8583
8689
  entitlementSource: json["entitlement_source"] == null ? void 0 : json["entitlement_source"],
8584
8690
  entitlementType: json["entitlement_type"],
8585
8691
  feature: json["feature"] == null ? void 0 : FeatureDetailResponseDataFromJSON(json["feature"]),
8692
+ hasValidAllocation: json["has_valid_allocation"] == null ? void 0 : json["has_valid_allocation"],
8693
+ isUnlimited: json["is_unlimited"] == null ? void 0 : json["is_unlimited"],
8586
8694
  metricResetAt: json["metric_reset_at"] == null ? void 0 : new Date(json["metric_reset_at"]),
8587
8695
  monthReset: json["month_reset"] == null ? void 0 : json["month_reset"],
8588
8696
  monthlyUsageBasedPrice: json["monthly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["monthly_usage_based_price"]),
8697
+ overuse: json["overuse"] == null ? void 0 : json["overuse"],
8698
+ percentUsed: json["percent_used"] == null ? void 0 : json["percent_used"],
8589
8699
  period: json["period"] == null ? void 0 : json["period"],
8590
8700
  plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
8591
8701
  planEntitlement: json["plan_entitlement"] == null ? void 0 : PlanEntitlementResponseDataFromJSON(json["plan_entitlement"]),
@@ -10666,7 +10776,7 @@ var EmbedProvider = ({
10666
10776
  });
10667
10777
  const customHeaders = (0, import_react12.useMemo)(
10668
10778
  () => ({
10669
- "X-Schematic-Components-Version": "1.8.0",
10779
+ "X-Schematic-Components-Version": "1.9.0",
10670
10780
  "X-Schematic-Session-ID": sessionIdRef.current
10671
10781
  }),
10672
10782
  []
@@ -12900,21 +13010,9 @@ var Sidebar = ({
12900
13010
  currentPlan: data.company?.plan,
12901
13011
  currentAddOns: data.company?.addOns || [],
12902
13012
  currentEntitlements: currentEntitlements2,
12903
- currentUsageBasedEntitlements: currentEntitlements2.reduce(
12904
- (acc, entitlement) => {
12905
- if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
12906
- const allocation = entitlement.allocation || 0;
12907
- const usage = entitlement.usage || 0;
12908
- acc.push({
12909
- ...entitlement,
12910
- allocation,
12911
- usage,
12912
- quantity: allocation ?? usage
12913
- });
12914
- }
12915
- return acc;
12916
- },
12917
- []
13013
+ currentUsageBasedEntitlements: extractCurrentUsageBasedEntitlements(
13014
+ data.featureUsage?.features,
13015
+ planPeriod
12918
13016
  ),
12919
13017
  billingSubscription: data.company?.billingSubscription,
12920
13018
  paymentMethod: data.subscription?.paymentMethod,
@@ -13729,9 +13827,53 @@ var Sidebar = ({
13729
13827
 
13730
13828
  // src/components/shared/checkout-dialog/AddOns.tsx
13731
13829
  var import_jsx_runtime16 = require("react/jsx-runtime");
13830
+ function renderMeteredEntitlementPricing({
13831
+ priceBehavior,
13832
+ softLimit,
13833
+ price,
13834
+ currency,
13835
+ packageSize,
13836
+ feature,
13837
+ featureName,
13838
+ isTiered
13839
+ }) {
13840
+ if (priceBehavior === "overage" /* Overage */ && softLimit) {
13841
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13842
+ "Additional: ",
13843
+ formatCurrency(price, currency),
13844
+ "/",
13845
+ feature ? getFeatureName(
13846
+ feature,
13847
+ packageSize
13848
+ ) : featureName || "unit"
13849
+ ] });
13850
+ }
13851
+ if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "pay_in_advance" /* PayInAdvance */) {
13852
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13853
+ formatCurrency(price, currency),
13854
+ "/",
13855
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13856
+ packageSize,
13857
+ " "
13858
+ ] }),
13859
+ feature ? getFeatureName(
13860
+ feature,
13861
+ packageSize
13862
+ ) : featureName || "unit"
13863
+ ] });
13864
+ }
13865
+ if (isTiered) {
13866
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: "Tier-based pricing" });
13867
+ }
13868
+ return null;
13869
+ }
13870
+ function shouldShowUsageBased(price, displayableEntitlements) {
13871
+ return price < 0.01 && displayableEntitlements.some((ent) => !ent.isUnlimited);
13872
+ }
13732
13873
  var AddOns = ({ addOns, toggle, isLoading, period }) => {
13733
13874
  const { t: t2 } = useTranslation();
13734
13875
  const { settings } = useEmbed();
13876
+ const isLightBackground = useIsLightBackground();
13735
13877
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
13736
13878
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13737
13879
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -13744,29 +13886,40 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
13744
13886
  const { price, currency } = getAddOnPrice(addOn, period) || {};
13745
13887
  const isAddOnValid = isHydratedPlan(addOn) && addOn.valid;
13746
13888
  const isAddOnCurrent = isHydratedPlan(addOn) && addOn.current;
13747
- const overageEntitlement = addOn.entitlements?.find(
13748
- (entitlement) => entitlement.priceBehavior === "overage" /* Overage */
13749
- );
13750
- let overageInfo = null;
13751
- if (overageEntitlement) {
13752
- const priceData = period === "year" ? overageEntitlement.meteredYearlyPrice : overageEntitlement.meteredMonthlyPrice;
13753
- if (priceData?.priceTier && priceData.priceTier.length >= 2) {
13754
- const overageTier = priceData.priceTier[priceData.priceTier.length - 1];
13755
- overageInfo = {
13756
- softLimit: overageEntitlement.softLimit,
13757
- perUnitPrice: overageTier.perUnitPriceDecimal ? Number(overageTier.perUnitPriceDecimal) : overageTier.perUnitPrice || 0,
13758
- currency: priceData.currency || currency,
13759
- featureName: overageEntitlement.feature?.name
13889
+ const displayableEntitlements = addOn.entitlements?.filter(
13890
+ (entitlement) => entitlement.valueType === "unlimited" || entitlement.priceBehavior && [
13891
+ "pay_as_you_go" /* PayAsYouGo */,
13892
+ "pay_in_advance" /* PayInAdvance */,
13893
+ "overage" /* Overage */,
13894
+ "tier" /* Tiered */
13895
+ ].includes(entitlement.priceBehavior)
13896
+ ).map((entitlement) => {
13897
+ if (entitlement.valueType === "unlimited" && !entitlement.priceBehavior) {
13898
+ return {
13899
+ isUnlimited: true,
13900
+ featureName: entitlement.feature?.name,
13901
+ feature: entitlement.feature
13760
13902
  };
13761
13903
  }
13762
- }
13904
+ const priceData = getEntitlementPrice(entitlement, period);
13905
+ return {
13906
+ isUnlimited: false,
13907
+ priceBehavior: entitlement.priceBehavior,
13908
+ softLimit: entitlement.softLimit,
13909
+ price: priceData?.price ?? 0,
13910
+ currency: priceData?.currency || currency,
13911
+ featureName: entitlement.feature?.name,
13912
+ feature: entitlement.feature,
13913
+ packageSize: priceData?.packageSize ?? 1,
13914
+ isTiered: entitlement.priceBehavior === "tier" /* Tiered */
13915
+ };
13916
+ }) || [];
13763
13917
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13764
13918
  Flex,
13765
13919
  {
13766
13920
  $position: "relative",
13767
13921
  $flexDirection: "column",
13768
- $gap: "2rem",
13769
- $padding: `${cardPadding}rem`,
13922
+ $padding: `${0.75 * cardPadding}rem 0`,
13770
13923
  $backgroundColor: settings.theme.card.background,
13771
13924
  $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13772
13925
  $outlineWidth: "2px",
@@ -13776,86 +13929,180 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
13776
13929
  $boxShadow: cardBoxShadow
13777
13930
  },
13778
13931
  children: [
13779
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
13780
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading3", children: addOn.name }) }),
13781
- addOn.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: addOn.description }) }),
13782
- (addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
13783
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box, { children: [
13784
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: formatCurrency(price ?? 0, currency) }),
13785
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13786
- Text,
13932
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13933
+ Flex,
13934
+ {
13935
+ $flexDirection: "column",
13936
+ $gap: "0.75rem",
13937
+ $padding: `0 ${cardPadding}rem ${displayableEntitlements.length > 0 ? 0.75 * cardPadding : 0}rem`,
13938
+ $borderWidth: "0",
13939
+ $borderBottomWidth: displayableEntitlements.length > 0 ? "1px" : "0",
13940
+ $borderStyle: "solid",
13941
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
13942
+ children: [
13943
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading3", children: addOn.name }) }),
13944
+ addOn.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: addOn.description }) }),
13945
+ (addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: shouldShowUsageBased(price ?? 0, displayableEntitlements) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: t2("Usage-based") }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13946
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: formatCurrency(price ?? 0, currency) }),
13947
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13948
+ Text,
13949
+ {
13950
+ display: "heading2",
13951
+ $size: 16 / 30 * settings.theme.typography.heading2.fontSize,
13952
+ children: addOn.chargeType === ChargeType.oneTime ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13953
+ " ",
13954
+ t2("one time")
13955
+ ] }) : `/${period}`
13956
+ }
13957
+ )
13958
+ ] }) }),
13959
+ isAddOnCurrent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13960
+ Flex,
13787
13961
  {
13788
- display: "heading2",
13789
- $size: 16 / 30 * settings.theme.typography.heading2.fontSize,
13790
- children: addOn.chargeType === ChargeType.oneTime ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13791
- " ",
13792
- t2("one time")
13793
- ] }) : `/${period}`
13962
+ $position: "absolute",
13963
+ $right: "1rem",
13964
+ $top: "1rem",
13965
+ $backgroundColor: settings.theme.primary,
13966
+ $borderRadius: "9999px",
13967
+ $padding: "0.125rem 0.85rem",
13968
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13969
+ Text,
13970
+ {
13971
+ $size: 0.75 * settings.theme.typography.text.fontSize,
13972
+ $color: hexToHSL(settings.theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13973
+ children: t2("Active")
13974
+ }
13975
+ )
13794
13976
  }
13795
13977
  )
13796
- ] }),
13797
- overageInfo && overageInfo.softLimit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { $size: 0.875, style: { opacity: 0.8 }, children: [
13798
- overageInfo.softLimit,
13799
- " ",
13800
- overageInfo.featureName || "units",
13801
- " included, then",
13802
- " ",
13803
- formatCurrency(
13804
- overageInfo.perUnitPrice,
13805
- overageInfo.currency
13806
- ),
13807
- "/",
13808
- overageInfo.featureName?.toLowerCase() || "unit"
13809
- ] }) })
13810
- ] }),
13811
- isAddOnCurrent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13812
- Flex,
13813
- {
13814
- $position: "absolute",
13815
- $right: "1rem",
13816
- $top: "1rem",
13817
- $backgroundColor: settings.theme.primary,
13818
- $borderRadius: "9999px",
13819
- $padding: "0.125rem 0.85rem",
13820
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13821
- Text,
13978
+ ]
13979
+ }
13980
+ ),
13981
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13982
+ Flex,
13983
+ {
13984
+ $flexDirection: "column",
13985
+ $justifyContent: "end",
13986
+ $flexGrow: 1,
13987
+ $gap: `${cardPadding}rem`,
13988
+ $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13989
+ children: [
13990
+ displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: displayableEntitlements.map((entitlement, idx) => {
13991
+ if (entitlement.isUnlimited) {
13992
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13993
+ Flex,
13994
+ {
13995
+ $flexWrap: "wrap",
13996
+ $justifyContent: "space-between",
13997
+ $alignItems: "center",
13998
+ $gap: "1rem",
13999
+ children: [
14000
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $gap: "1rem", children: [
14001
+ entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14002
+ Icon3,
14003
+ {
14004
+ name: entitlement.feature.icon,
14005
+ color: settings.theme.primary,
14006
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
14007
+ rounded: true
14008
+ }
14009
+ ),
14010
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14011
+ Flex,
14012
+ {
14013
+ $flexDirection: "column",
14014
+ $justifyContent: "center",
14015
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: entitlement.feature?.pluralName || entitlement.feature?.name || entitlement.featureName })
14016
+ }
14017
+ )
14018
+ ] }),
14019
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14020
+ Text,
14021
+ {
14022
+ style: { opacity: 0.54 },
14023
+ $size: 0.875 * settings.theme.typography.text.fontSize,
14024
+ $color: settings.theme.typography.text.color,
14025
+ children: "Unlimited"
14026
+ }
14027
+ )
14028
+ ]
14029
+ },
14030
+ idx
14031
+ );
14032
+ }
14033
+ const meteredEntitlement = entitlement;
14034
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
14035
+ Flex,
14036
+ {
14037
+ $flexWrap: "wrap",
14038
+ $justifyContent: "space-between",
14039
+ $alignItems: "center",
14040
+ $gap: "1rem",
14041
+ children: [
14042
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $gap: "1rem", children: [
14043
+ meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14044
+ Icon3,
14045
+ {
14046
+ name: meteredEntitlement.feature.icon,
14047
+ color: settings.theme.primary,
14048
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
14049
+ rounded: true
14050
+ }
14051
+ ),
14052
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14053
+ Flex,
14054
+ {
14055
+ $flexDirection: "column",
14056
+ $justifyContent: "center",
14057
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: meteredEntitlement.priceBehavior === "overage" /* Overage */ && meteredEntitlement.softLimit ? `${meteredEntitlement.softLimit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) })
14058
+ }
14059
+ )
14060
+ ] }),
14061
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14062
+ Text,
14063
+ {
14064
+ style: { opacity: 0.54 },
14065
+ $size: 0.875 * settings.theme.typography.text.fontSize,
14066
+ $color: settings.theme.typography.text.color,
14067
+ children: renderMeteredEntitlementPricing(meteredEntitlement)
14068
+ }
14069
+ )
14070
+ ]
14071
+ },
14072
+ idx
14073
+ );
14074
+ }) }),
14075
+ !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14076
+ Button,
13822
14077
  {
13823
- $size: 0.75 * settings.theme.typography.text.fontSize,
13824
- $color: hexToHSL(settings.theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13825
- children: t2("Active")
14078
+ type: "button",
14079
+ disabled: isLoading || !isAddOnValid,
14080
+ onClick: () => toggle(addOn.id),
14081
+ $size: "sm",
14082
+ $color: "primary",
14083
+ $variant: "outline",
14084
+ $fullWidth: true,
14085
+ children: t2("Choose add-on")
14086
+ }
14087
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14088
+ Button,
14089
+ {
14090
+ type: "button",
14091
+ disabled: isLoading || !isAddOnValid,
14092
+ onClick: () => toggle(addOn.id),
14093
+ $size: "sm",
14094
+ $color: isAddOnCurrent ? "danger" : "primary",
14095
+ $variant: isAddOnCurrent ? "ghost" : "text",
14096
+ $fullWidth: true,
14097
+ children: isAddOnCurrent ? t2("Remove add-on") : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
14098
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon3, { name: "check-rounded", size: "sm" }),
14099
+ t2("Selected")
14100
+ ] })
13826
14101
  }
13827
14102
  )
13828
- }
13829
- )
13830
- ] }),
13831
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13832
- Button,
13833
- {
13834
- type: "button",
13835
- disabled: isLoading || !isAddOnValid,
13836
- onClick: () => toggle(addOn.id),
13837
- $size: "sm",
13838
- $color: "primary",
13839
- $variant: "outline",
13840
- $fullWidth: true,
13841
- children: t2("Choose add-on")
13842
- }
13843
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13844
- Button,
13845
- {
13846
- type: "button",
13847
- disabled: isLoading || !isAddOnValid,
13848
- onClick: () => toggle(addOn.id),
13849
- $size: "sm",
13850
- $color: isAddOnCurrent ? "danger" : "primary",
13851
- $variant: isAddOnCurrent ? "ghost" : "text",
13852
- $fullWidth: true,
13853
- children: isAddOnCurrent ? t2("Remove add-on") : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13854
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon3, { name: "check-rounded", size: "sm" }),
13855
- t2("Selected")
13856
- ] })
14103
+ ]
13857
14104
  }
13858
- ) })
14105
+ )
13859
14106
  ]
13860
14107
  },
13861
14108
  index
@@ -17749,7 +17996,7 @@ PaymentMethod.displayName = "PaymentMethod";
17749
17996
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
17750
17997
 
17751
17998
  // node_modules/@stripe/stripe-js/dist/index.mjs
17752
- var RELEASE_TRAIN = "basil";
17999
+ var RELEASE_TRAIN = "clover";
17753
18000
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
17754
18001
  return version === 3 ? "v3" : version;
17755
18002
  };
@@ -17789,7 +18036,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
17789
18036
  }
17790
18037
  stripe._registerWrapper({
17791
18038
  name: "stripe-js",
17792
- version: "7.9.0",
18039
+ version: "8.1.0",
17793
18040
  startTime
17794
18041
  });
17795
18042
  };
@@ -17864,7 +18111,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
17864
18111
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
17865
18112
  var expectedVersion = RELEASE_TRAIN;
17866
18113
  if (isTestKey && version !== expectedVersion) {
17867
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
18114
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
17868
18115
  }
17869
18116
  var stripe = maybeStripe.apply(void 0, args);
17870
18117
  registerWrapper(stripe, startTime);