@schematichq/schematic-components 0.4.5 → 0.4.7

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.
@@ -2076,7 +2076,7 @@ var require_pluralize = __commonJS({
2076
2076
  });
2077
2077
 
2078
2078
  // src/components/elements/included-features/IncludedFeatures.tsx
2079
- import { forwardRef as forwardRef7, useRef as useRef6, useState as useState12 } from "react";
2079
+ import { forwardRef as forwardRef7, useRef as useRef6, useState as useState13 } from "react";
2080
2080
 
2081
2081
  // node_modules/react-i18next/dist/es/Trans.js
2082
2082
  import { useContext } from "react";
@@ -10608,6 +10608,8 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
10608
10608
  return json;
10609
10609
  }
10610
10610
  return {
10611
+ cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
10612
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
10611
10613
  companyId: json["company_id"] == null ? void 0 : json["company_id"],
10612
10614
  createdAt: new Date(json["created_at"]),
10613
10615
  currency: json["currency"],
@@ -10694,6 +10696,8 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
10694
10696
  return json;
10695
10697
  }
10696
10698
  return {
10699
+ cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
10700
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
10697
10701
  companyId: json["company_id"] == null ? void 0 : json["company_id"],
10698
10702
  createdAt: new Date(json["created_at"]),
10699
10703
  currency: json["currency"],
@@ -10776,6 +10780,33 @@ function CheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
10776
10780
  };
10777
10781
  }
10778
10782
 
10783
+ // src/api/models/DeleteResponse.ts
10784
+ function DeleteResponseFromJSON(json) {
10785
+ return DeleteResponseFromJSONTyped(json, false);
10786
+ }
10787
+ function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
10788
+ if (json == null) {
10789
+ return json;
10790
+ }
10791
+ return {
10792
+ deleted: json["deleted"] == null ? void 0 : json["deleted"]
10793
+ };
10794
+ }
10795
+
10796
+ // src/api/models/CheckoutUnsubscribeResponse.ts
10797
+ function CheckoutUnsubscribeResponseFromJSON(json) {
10798
+ return CheckoutUnsubscribeResponseFromJSONTyped(json, false);
10799
+ }
10800
+ function CheckoutUnsubscribeResponseFromJSONTyped(json, ignoreDiscriminator) {
10801
+ if (json == null) {
10802
+ return json;
10803
+ }
10804
+ return {
10805
+ data: DeleteResponseFromJSON(json["data"]),
10806
+ params: json["params"]
10807
+ };
10808
+ }
10809
+
10779
10810
  // src/api/models/CompanyEventPeriodMetricsResponseData.ts
10780
10811
  function CompanyEventPeriodMetricsResponseDataFromJSON(json) {
10781
10812
  return CompanyEventPeriodMetricsResponseDataFromJSONTyped(json, false);
@@ -11275,6 +11306,8 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
11275
11306
  return json;
11276
11307
  }
11277
11308
  return {
11309
+ cancelAt: json["cancel_at"] == null ? void 0 : new Date(json["cancel_at"]),
11310
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
11278
11311
  currency: json["currency"],
11279
11312
  customerExternalId: json["customer_external_id"],
11280
11313
  discounts: json["discounts"].map(
@@ -11635,6 +11668,38 @@ var CheckoutexternalApi = class extends BaseAPI {
11635
11668
  const response = await this.checkoutRaw(requestParameters, initOverrides);
11636
11669
  return await response.value();
11637
11670
  }
11671
+ /**
11672
+ * Checkout unsubscribe
11673
+ */
11674
+ async checkoutUnsubscribeRaw(initOverrides) {
11675
+ const queryParameters = {};
11676
+ const headerParameters = {};
11677
+ if (this.configuration && this.configuration.apiKey) {
11678
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
11679
+ "X-Schematic-Api-Key"
11680
+ );
11681
+ }
11682
+ const response = await this.request(
11683
+ {
11684
+ path: `/checkout/unsubscribe`,
11685
+ method: "DELETE",
11686
+ headers: headerParameters,
11687
+ query: queryParameters
11688
+ },
11689
+ initOverrides
11690
+ );
11691
+ return new JSONApiResponse(
11692
+ response,
11693
+ (jsonValue) => CheckoutUnsubscribeResponseFromJSON(jsonValue)
11694
+ );
11695
+ }
11696
+ /**
11697
+ * Checkout unsubscribe
11698
+ */
11699
+ async checkoutUnsubscribe(initOverrides) {
11700
+ const response = await this.checkoutUnsubscribeRaw(initOverrides);
11701
+ return await response.value();
11702
+ }
11638
11703
  /**
11639
11704
  * Get setup intent
11640
11705
  */
@@ -11860,6 +11925,7 @@ var CheckoutexternalApi = class extends BaseAPI {
11860
11925
  var en_default = {
11861
11926
  translation: {
11862
11927
  "A problem occurred while saving your payment method.": "A problem occurred while saving your payment method.",
11928
+ "Access to plan will end on": "Access to plan will end on {{date}}",
11863
11929
  Active: "Active",
11864
11930
  "Add payment method": "Add payment method",
11865
11931
  "Add Seats": "Add More",
@@ -11869,6 +11935,7 @@ var en_default = {
11869
11935
  "After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
11870
11936
  Billed: "Billed {{period}}",
11871
11937
  "billing period": "billing period",
11938
+ "Cancel subscription": "Cancel subscription",
11872
11939
  "Cannot downgrade entitlement": "Cannot downgrade to a lower quantity than current usage.",
11873
11940
  "Card ending in": "\u{1F4B3} Card ending in {{value}}",
11874
11941
  "Change add-on": "Change add-on",
@@ -11903,9 +11970,11 @@ var en_default = {
11903
11970
  Invoices: "Invoices",
11904
11971
  "Limit of": "Limit of {{amount}}",
11905
11972
  Loading: "Loading",
11973
+ "Manage plan": "Manage plan",
11906
11974
  Monthly: "Monthly",
11907
11975
  Next: "Next",
11908
11976
  "No limit": "No limit",
11977
+ "Not ready to cancel?": "Not ready to cancel?",
11909
11978
  "Optionally add features to your subscription": "Optionally add features to your subscription",
11910
11979
  "Other existing payment method": "Other existing payment method",
11911
11980
  "Over usage limit": "Over usage limit",
@@ -11932,10 +12001,13 @@ var en_default = {
11932
12001
  "Start trial": "Start trial",
11933
12002
  "Subscribe and close": "Subscribe and close",
11934
12003
  Subscription: "Subscription",
12004
+ "Subscription canceled": "Subscription canceled",
11935
12005
  Trial: "Trial",
11936
12006
  "Trial ends in": "Trial ends in {{days}} days",
11937
12007
  "Trial plan": "Try free for {{days}} days",
11938
12008
  Unlimited: "Unlimited {{item}}",
12009
+ Unsubscribe: "Unsubscribe",
12010
+ "Unsubscribe failed": "Unsubscribe failed",
11939
12011
  "Unused time": "Unused time",
11940
12012
  Usage: "Usage",
11941
12013
  "Usage-based": "Usage-based",
@@ -11943,6 +12015,7 @@ var en_default = {
11943
12015
  "X% off": "{{percent}}% off",
11944
12016
  "X off": "{{amount}} off",
11945
12017
  Yearly: "Yearly",
12018
+ "You will retain access to your plan until the end of the billing period, on": "You will retain access to your plan until the end of the billing period, on",
11946
12019
  day: "day",
11947
12020
  month: "month",
11948
12021
  per: "per",
@@ -12677,7 +12750,8 @@ var EmbedProvider = ({
12677
12750
  useEffect2(() => {
12678
12751
  const element = document.getElementById("schematic-fonts");
12679
12752
  if (element) {
12680
- return void (styleRef.current = element);
12753
+ styleRef.current = element;
12754
+ return;
12681
12755
  }
12682
12756
  const style = document.createElement("link");
12683
12757
  style.id = "schematic-fonts";
@@ -12688,7 +12762,7 @@ var EmbedProvider = ({
12688
12762
  useEffect2(() => {
12689
12763
  if (accessToken) {
12690
12764
  const { headers = {} } = apiConfig ?? {};
12691
- headers["X-Schematic-Components-Version"] = "0.4.5";
12765
+ headers["X-Schematic-Components-Version"] = "0.4.7";
12692
12766
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
12693
12767
  const config = new Configuration({
12694
12768
  ...apiConfig,
@@ -12863,13 +12937,15 @@ function shortenPeriod(period) {
12863
12937
  }
12864
12938
 
12865
12939
  // src/utils/string.ts
12940
+ var DEFAULT_CURRENCY = "USD";
12866
12941
  function camelToHyphen(str) {
12867
12942
  return str.replace(/([a-z][A-Z])/g, (g2) => `${g2[0]}-${g2[1].toLowerCase()}`);
12868
12943
  }
12869
12944
  function formatNumber(num) {
12870
12945
  return new Intl.NumberFormat("en-US").format(num);
12871
12946
  }
12872
- function formatCurrency(amount, currency = "USD") {
12947
+ function formatCurrency(amount, currency = DEFAULT_CURRENCY) {
12948
+ const nonEmptyCurrency = currency ? currency.toUpperCase() : DEFAULT_CURRENCY;
12873
12949
  try {
12874
12950
  const dollars = amount / 100;
12875
12951
  const formatValue = (value, symbol) => {
@@ -12877,8 +12953,8 @@ function formatCurrency(amount, currency = "USD") {
12877
12953
  if (formatted.endsWith(".0")) {
12878
12954
  formatted = formatted.slice(0, -2);
12879
12955
  }
12880
- if (currency.toUpperCase() !== "USD") {
12881
- return `${currency.toUpperCase()}${formatted}${symbol}`;
12956
+ if (nonEmptyCurrency !== DEFAULT_CURRENCY) {
12957
+ return `${nonEmptyCurrency}${formatted}${symbol}`;
12882
12958
  }
12883
12959
  return `$${formatted}${symbol}`;
12884
12960
  };
@@ -12889,14 +12965,14 @@ function formatCurrency(amount, currency = "USD") {
12889
12965
  } else {
12890
12966
  return new Intl.NumberFormat("en-US", {
12891
12967
  style: "currency",
12892
- currency: currency.toUpperCase()
12968
+ currency: nonEmptyCurrency
12893
12969
  }).format(dollars);
12894
12970
  }
12895
12971
  } catch (error) {
12896
12972
  console.error("Error formatting currency", error);
12897
12973
  return new Intl.NumberFormat("en-US", {
12898
12974
  style: "currency",
12899
- currency: currency.toUpperCase()
12975
+ currency: nonEmptyCurrency
12900
12976
  }).format(amount / 100);
12901
12977
  }
12902
12978
  }
@@ -13133,7 +13209,7 @@ var Button2 = forwardRef(
13133
13209
  disabled,
13134
13210
  ...props,
13135
13211
  children: [
13136
- /* @__PURE__ */ jsx2(Loader, { $size: "sm", $isLoading: isLoading }),
13212
+ isLoading && /* @__PURE__ */ jsx2(Loader, { $size: "sm", $isLoading: isLoading }),
13137
13213
  children
13138
13214
  ]
13139
13215
  }
@@ -13210,8 +13286,6 @@ var EmbedButton = dt(Button2)`
13210
13286
  font-family: "Public Sans", sans-serif;
13211
13287
  font-weight: 500;
13212
13288
  text-align: center;
13213
- width: 100%;
13214
- padding: 0;
13215
13289
 
13216
13290
  ${({ disabled, $color = "primary", theme }) => {
13217
13291
  const { l: l2 } = hexToHSL(theme[$color]);
@@ -13341,6 +13415,38 @@ var EmbedButton = dt(Button2)`
13341
13415
  `;
13342
13416
  }
13343
13417
  }}
13418
+
13419
+ ${({ $alignment = "center" }) => {
13420
+ switch ($alignment) {
13421
+ case "start":
13422
+ return lt`
13423
+ justify-content: start;
13424
+ `;
13425
+ case "end":
13426
+ return lt`
13427
+ justify-content: end;
13428
+ `;
13429
+ case "center":
13430
+ default:
13431
+ return lt`
13432
+ justify-content: center;
13433
+ `;
13434
+ }
13435
+ }}
13436
+
13437
+ ${({ $fullWidth = true }) => {
13438
+ if ($fullWidth) {
13439
+ return lt`
13440
+ width: 100%;
13441
+ padding: 0;
13442
+ `;
13443
+ }
13444
+ return lt`
13445
+ width: fit-content;
13446
+ padding-left: 1rem;
13447
+ padding-right: 1rem;
13448
+ `;
13449
+ }}
13344
13450
  `;
13345
13451
 
13346
13452
  // src/components/ui/flex/styles.ts
@@ -14079,7 +14185,7 @@ var Root = forwardRef3(
14079
14185
  Root.displayName = "Root";
14080
14186
 
14081
14187
  // src/components/layout/viewport/Viewport.tsx
14082
- import { forwardRef as forwardRef4, useLayoutEffect as useLayoutEffect5, useState as useState11 } from "react";
14188
+ import { forwardRef as forwardRef4, useLayoutEffect as useLayoutEffect5, useState as useState12 } from "react";
14083
14189
  import { createPortal as createPortal2 } from "react-dom";
14084
14190
 
14085
14191
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
@@ -14194,11 +14300,11 @@ var Navigation = ({
14194
14300
  ] });
14195
14301
  };
14196
14302
 
14197
- // src/components/shared/checkout-dialog/Sidebar.tsx
14303
+ // src/components/shared/sidebar/Sidebar.tsx
14198
14304
  import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
14199
14305
  var import_pluralize = __toESM(require_pluralize());
14200
14306
 
14201
- // src/components/shared/checkout-dialog/StageButton.tsx
14307
+ // src/components/shared/sidebar/StageButton.tsx
14202
14308
  import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
14203
14309
  var StageButton = ({
14204
14310
  canTrial,
@@ -14389,7 +14495,7 @@ var StageButton = ({
14389
14495
  }
14390
14496
  };
14391
14497
 
14392
- // src/components/shared/checkout-dialog/Sidebar.tsx
14498
+ // src/components/shared/sidebar/Sidebar.tsx
14393
14499
  import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
14394
14500
  var Sidebar = ({
14395
14501
  addOns,
@@ -14412,11 +14518,12 @@ var Sidebar = ({
14412
14518
  showPaymentForm,
14413
14519
  toggleLoading,
14414
14520
  updatePromoCode,
14415
- usageBasedEntitlements
14521
+ usageBasedEntitlements,
14522
+ showHeader = true
14416
14523
  }) => {
14417
14524
  const { t: t2 } = useTranslation();
14418
14525
  const theme = nt();
14419
- const { api, data, mode, setLayout } = useEmbed();
14526
+ const { api, data, mode, layout, setLayout } = useEmbed();
14420
14527
  const isLightBackground = useIsLightBackground();
14421
14528
  const payInAdvanceEntitlements = usageBasedEntitlements.filter(
14422
14529
  ({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
@@ -14425,27 +14532,28 @@ var Sidebar = ({
14425
14532
  ({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
14426
14533
  );
14427
14534
  const subscriptionPrice = useMemo4(() => {
14428
- if (!selectedPlan || !selectedPlan.monthlyPrice || !selectedPlan.yearlyPrice) {
14535
+ const plan = selectedPlan || currentPlan;
14536
+ if (!plan || !plan.monthlyPrice || !plan.yearlyPrice) {
14429
14537
  return;
14430
14538
  }
14431
14539
  let total = 0;
14432
- const planPrice = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price;
14433
- const currency = (planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.currency;
14540
+ const planPrice = (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price;
14541
+ const currency = (planPeriod === "month" ? plan?.monthlyPrice : plan?.yearlyPrice)?.currency;
14434
14542
  if (planPrice) {
14435
14543
  total += planPrice;
14436
14544
  }
14437
14545
  const addOnCost = addOns.reduce(
14438
- (sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price || 0 : 0),
14546
+ (sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0 : 0),
14439
14547
  0
14440
14548
  );
14441
14549
  total += addOnCost;
14442
14550
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
14443
- (sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price || 0),
14551
+ (sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price ?? 0),
14444
14552
  0
14445
14553
  );
14446
14554
  total += payInAdvanceCost;
14447
14555
  return formatCurrency(total, currency);
14448
- }, [selectedPlan, addOns, payInAdvanceEntitlements, planPeriod]);
14556
+ }, [selectedPlan, currentPlan, planPeriod, addOns, payInAdvanceEntitlements]);
14449
14557
  const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = useMemo4(() => {
14450
14558
  return {
14451
14559
  amountOff: charges?.amountOff ?? 0,
@@ -14518,8 +14626,23 @@ var Sidebar = ({
14518
14626
  payInAdvanceEntitlements,
14519
14627
  promoCode
14520
14628
  ]);
14629
+ const unsubscribe = useCallback6(async () => {
14630
+ if (!api) {
14631
+ return;
14632
+ }
14633
+ try {
14634
+ setError(void 0);
14635
+ toggleLoading();
14636
+ await api.checkoutUnsubscribe();
14637
+ setError("success");
14638
+ } catch {
14639
+ setError(t2("Unsubscribe failed"));
14640
+ } finally {
14641
+ toggleLoading();
14642
+ }
14643
+ }, [api, setError, t2, toggleLoading]);
14521
14644
  const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
14522
- const willPlanChange = typeof selectedPlan !== "undefined" && selectedPlan.current === false;
14645
+ const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
14523
14646
  const canUpdateSubscription = mode === "edit" || api !== null && (willPlanChange || // TODO: test add-on comparison for finding "changes"
14524
14647
  selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
14525
14648
  (addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
@@ -14599,7 +14722,7 @@ var Sidebar = ({
14599
14722
  }
14600
14723
  },
14601
14724
  children: [
14602
- /* @__PURE__ */ jsx12(
14725
+ showHeader && /* @__PURE__ */ jsx12(
14603
14726
  Flex,
14604
14727
  {
14605
14728
  $position: "relative",
@@ -15349,7 +15472,7 @@ var Sidebar = ({
15349
15472
  ]
15350
15473
  }
15351
15474
  ),
15352
- selectedPlan && subscriptionPrice && /* @__PURE__ */ jsxs8(
15475
+ subscriptionPrice && /* @__PURE__ */ jsxs8(
15353
15476
  Flex,
15354
15477
  {
15355
15478
  $justifyContent: "space-between",
@@ -15452,11 +15575,11 @@ var Sidebar = ({
15452
15575
  }
15453
15576
  ) })
15454
15577
  ] }),
15455
- /* @__PURE__ */ jsx12(
15578
+ layout === "checkout" && /* @__PURE__ */ jsx12(
15456
15579
  StageButton,
15457
15580
  {
15458
15581
  canTrial: selectedPlan?.companyCanTrial === true,
15459
- canCheckout: canCheckout === true,
15582
+ canCheckout,
15460
15583
  canUpdateSubscription,
15461
15584
  checkout,
15462
15585
  checkoutStage,
@@ -15469,6 +15592,16 @@ var Sidebar = ({
15469
15592
  trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
15470
15593
  }
15471
15594
  ),
15595
+ layout === "unsubscribe" && /* @__PURE__ */ jsx12(
15596
+ EmbedButton,
15597
+ {
15598
+ onClick: async () => {
15599
+ unsubscribe();
15600
+ },
15601
+ isLoading,
15602
+ children: t2("Cancel subscription")
15603
+ }
15604
+ ),
15472
15605
  !isLoading && error && /* @__PURE__ */ jsx12(Box, { children: /* @__PURE__ */ jsx12(
15473
15606
  Text,
15474
15607
  {
@@ -15479,7 +15612,7 @@ var Sidebar = ({
15479
15612
  children: error
15480
15613
  }
15481
15614
  ) }),
15482
- /* @__PURE__ */ jsx12(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx12(
15615
+ layout !== "unsubscribe" && /* @__PURE__ */ jsx12(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx12(
15483
15616
  Text,
15484
15617
  {
15485
15618
  $font: theme.typography.text.fontFamily,
@@ -16574,7 +16707,7 @@ var CheckoutDialog = ({ top = 0 }) => {
16574
16707
  ),
16575
16708
  [usageBasedEntitlements]
16576
16709
  );
16577
- const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
16710
+ const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
16578
16711
  const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
16579
16712
  ({ quantity }) => quantity > 0
16580
16713
  );
@@ -17188,20 +17321,234 @@ var PeriodToggle = ({
17188
17321
  );
17189
17322
  };
17190
17323
 
17191
- // src/components/ui/badge/Badge.tsx
17324
+ // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
17325
+ import { useCallback as useCallback8, useMemo as useMemo7, useState as useState10 } from "react";
17192
17326
  import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
17327
+ var UnsubscribeDialog = () => {
17328
+ const { t: t2 } = useTranslation();
17329
+ const theme = nt();
17330
+ const { data, setSelected } = useEmbed();
17331
+ const [error, setError] = useState10();
17332
+ const [isLoading, setIsLoading] = useState10(false);
17333
+ const planPeriod = useMemo7(
17334
+ () => data.company?.plan?.planPeriod ?? "month",
17335
+ [data.company?.plan?.planPeriod]
17336
+ );
17337
+ const { setLayout } = useEmbed();
17338
+ const currentPlan = useMemo7(
17339
+ () => ({
17340
+ ...data.company?.plan,
17341
+ monthlyPrice: { price: data.company?.plan?.planPrice },
17342
+ yearlyPrice: { price: data.company?.plan?.planPrice }
17343
+ }),
17344
+ [data.company?.plan]
17345
+ );
17346
+ const currentAddOns = useMemo7(
17347
+ () => data.company?.addOns || [],
17348
+ [data.company?.addOns]
17349
+ );
17350
+ const addOns = useMemo7(
17351
+ () => currentAddOns.map((addOn) => ({
17352
+ ...addOn,
17353
+ isSelected: true,
17354
+ monthlyPrice: {
17355
+ price: addOn.planPrice
17356
+ },
17357
+ yearlyPrice: {
17358
+ price: addOn.planPrice
17359
+ }
17360
+ })),
17361
+ [currentAddOns]
17362
+ );
17363
+ const currentUsageBasedEntitlements = useMemo7(
17364
+ () => data.activeUsageBasedEntitlements.reduce(
17365
+ (acc, usageData) => {
17366
+ const featureUsage = data.featureUsage?.features.find(
17367
+ (usage2) => usage2.feature?.id === usageData.featureId
17368
+ );
17369
+ const allocation = featureUsage?.allocation ?? 0;
17370
+ const usage = featureUsage?.usage ?? 0;
17371
+ acc.push({
17372
+ entitlement: {
17373
+ ...usageData,
17374
+ id: featureUsage?.entitlementId ?? usageData.featureId,
17375
+ feature: featureUsage?.feature,
17376
+ meteredMonthlyPrice: usageData.meteredPrice,
17377
+ meteredYearlyPrice: usageData.meteredPrice
17378
+ },
17379
+ usageData,
17380
+ allocation,
17381
+ quantity: allocation ?? usage,
17382
+ usage
17383
+ });
17384
+ return acc;
17385
+ },
17386
+ []
17387
+ ),
17388
+ [data.activeUsageBasedEntitlements, data.featureUsage?.features]
17389
+ );
17390
+ const cancelDate = new Date(
17391
+ data.subscription?.cancelAt || data.upcomingInvoice?.dueDate || Date.now()
17392
+ );
17393
+ const isLightBackground = useIsLightBackground();
17394
+ const handleClose = useCallback8(() => {
17395
+ setLayout("portal");
17396
+ }, [setLayout]);
17397
+ return /* @__PURE__ */ jsxs15(Modal, { id: "unsubscribe-dialog", size: "auto", children: [
17398
+ /* @__PURE__ */ jsx20(
17399
+ Box,
17400
+ {
17401
+ $display: "inline-flex",
17402
+ $position: "absolute",
17403
+ $top: 0,
17404
+ $right: 0,
17405
+ $zIndex: 1,
17406
+ $cursor: "pointer",
17407
+ onClick: handleClose,
17408
+ children: /* @__PURE__ */ jsx20(
17409
+ Icon2,
17410
+ {
17411
+ name: "close",
17412
+ style: {
17413
+ fontSize: 36,
17414
+ color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
17415
+ }
17416
+ }
17417
+ )
17418
+ }
17419
+ ),
17420
+ /* @__PURE__ */ jsxs15(
17421
+ Flex,
17422
+ {
17423
+ $position: "relative",
17424
+ $flexDirection: "column",
17425
+ $height: "auto",
17426
+ $viewport: {
17427
+ md: {
17428
+ $flexDirection: "row",
17429
+ $height: "calc(100% - 5rem)"
17430
+ }
17431
+ },
17432
+ children: [
17433
+ /* @__PURE__ */ jsxs15(
17434
+ Flex,
17435
+ {
17436
+ $flexDirection: "column",
17437
+ $flexWrap: "wrap",
17438
+ $justifyContent: "space-around",
17439
+ $gap: "5rem",
17440
+ $padding: "2.5rem",
17441
+ children: [
17442
+ /* @__PURE__ */ jsxs15(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17443
+ /* @__PURE__ */ jsx20(
17444
+ Text,
17445
+ {
17446
+ as: "h2",
17447
+ $font: theme.typography.heading2.fontFamily,
17448
+ $size: theme.typography.heading2.fontSize,
17449
+ $weight: theme.typography.heading2.fontWeight,
17450
+ $color: theme.typography.heading2.color,
17451
+ children: t2("Cancel subscription")
17452
+ }
17453
+ ),
17454
+ /* @__PURE__ */ jsxs15(
17455
+ Text,
17456
+ {
17457
+ as: "p",
17458
+ $font: theme.typography.text.fontFamily,
17459
+ $size: theme.typography.text.fontSize,
17460
+ $weight: theme.typography.text.fontWeight,
17461
+ $color: theme.typography.text.color,
17462
+ children: [
17463
+ t2(
17464
+ "You will retain access to your plan until the end of the billing period, on"
17465
+ ),
17466
+ " ",
17467
+ cancelDate ? toPrettyDate(cancelDate, {
17468
+ month: "numeric"
17469
+ }) : ""
17470
+ ]
17471
+ }
17472
+ )
17473
+ ] }),
17474
+ /* @__PURE__ */ jsxs15(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
17475
+ /* @__PURE__ */ jsx20(
17476
+ Text,
17477
+ {
17478
+ as: "p",
17479
+ $font: theme.typography.text.fontFamily,
17480
+ $size: theme.typography.text.fontSize,
17481
+ $weight: theme.typography.text.fontWeight,
17482
+ $color: theme.typography.text.color,
17483
+ children: t2("Not ready to cancel?")
17484
+ }
17485
+ ),
17486
+ /* @__PURE__ */ jsx20(
17487
+ EmbedButton,
17488
+ {
17489
+ onClick: () => {
17490
+ setSelected({
17491
+ planId: currentPlan?.id,
17492
+ addOnId: void 0,
17493
+ usage: false
17494
+ });
17495
+ setLayout("checkout");
17496
+ },
17497
+ $size: "sm",
17498
+ $color: "secondary",
17499
+ $variant: "ghost",
17500
+ $fullWidth: false,
17501
+ children: t2("Manage plan")
17502
+ }
17503
+ )
17504
+ ] })
17505
+ ]
17506
+ }
17507
+ ),
17508
+ /* @__PURE__ */ jsx20(
17509
+ Sidebar,
17510
+ {
17511
+ addOns,
17512
+ checkoutStage: "checkout",
17513
+ checkoutStages: [],
17514
+ currentAddOns,
17515
+ currentUsageBasedEntitlements,
17516
+ error,
17517
+ currentPlan,
17518
+ isLoading,
17519
+ planPeriod,
17520
+ requiresPayment: false,
17521
+ setCheckoutStage: () => {
17522
+ },
17523
+ setError: (msg) => setError(msg),
17524
+ showPaymentForm: false,
17525
+ toggleLoading: () => setIsLoading((prev2) => !prev2),
17526
+ updatePromoCode: () => {
17527
+ },
17528
+ usageBasedEntitlements: currentUsageBasedEntitlements,
17529
+ showHeader: false
17530
+ }
17531
+ )
17532
+ ]
17533
+ }
17534
+ )
17535
+ ] });
17536
+ };
17537
+
17538
+ // src/components/ui/badge/Badge.tsx
17539
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
17193
17540
  var Badge = () => {
17194
17541
  const { t: t2 } = useTranslation();
17195
17542
  const { settings } = useEmbed();
17196
- return /* @__PURE__ */ jsxs15(
17543
+ return /* @__PURE__ */ jsxs16(
17197
17544
  Flex,
17198
17545
  {
17199
17546
  $justifyContent: settings.badge?.alignment || "start",
17200
17547
  $alignItems: "center",
17201
17548
  $gridColumn: "1 / -1",
17202
17549
  children: [
17203
- /* @__PURE__ */ jsx20(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: t2("Powered by") }),
17204
- /* @__PURE__ */ jsxs15(
17550
+ /* @__PURE__ */ jsx21(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: t2("Powered by") }),
17551
+ /* @__PURE__ */ jsxs16(
17205
17552
  "svg",
17206
17553
  {
17207
17554
  width: 86,
@@ -17209,77 +17556,77 @@ var Badge = () => {
17209
17556
  viewBox: "0 0 86 16",
17210
17557
  style: { marginTop: "0.125rem" },
17211
17558
  children: [
17212
- /* @__PURE__ */ jsx20(
17559
+ /* @__PURE__ */ jsx21(
17213
17560
  "path",
17214
17561
  {
17215
17562
  d: "M21.2354 6.16227C21.1796 5.95015 21.0494 5.76779 20.8261 5.61893C20.6028 5.46635 20.3423 5.39564 20.0408 5.39564C19.3151 5.39564 18.7941 5.69708 18.7941 6.2367C18.7941 6.49721 18.9095 6.69073 19.1402 6.81726C19.3635 6.94379 19.732 7.07033 20.2344 7.18569C21.0084 7.37177 21.4922 7.51691 21.9686 7.7402C22.203 7.85557 22.3928 7.97465 22.5305 8.10863C22.7948 8.3803 22.9548 8.74501 22.9362 9.20276C22.9176 9.86147 22.6571 10.375 22.1547 10.7397C21.6523 11.1082 20.9563 11.2905 20.0818 11.2905C19.2072 11.2905 18.5597 11.1268 18.0312 10.8067C17.5065 10.4867 17.2013 10.0215 17.1194 9.41116L18.6192 9.27719C18.6974 9.57491 18.8723 9.7982 19.1514 9.94706C19.4305 10.0959 19.7394 10.1778 20.0818 10.1778C20.4614 10.1778 20.7777 10.0996 21.0308 9.9359C21.2838 9.77959 21.4104 9.56002 21.4104 9.28835C21.4104 8.90876 21.0531 8.61104 20.5991 8.43613C20.3683 8.35053 20.0855 8.27238 19.7468 8.19423C19.2705 8.07886 18.8946 7.97094 18.6155 7.87418C18.3364 7.78486 18.0908 7.66205 17.8712 7.51319C17.4358 7.21547 17.2832 6.8247 17.2832 6.2367C17.2832 5.61521 17.5325 5.13141 18.0312 4.79648C18.5262 4.46526 19.2035 4.29407 20.0669 4.29407C21.5853 4.29407 22.5752 4.9044 22.7389 6.05807L21.228 6.16227H21.2354Z",
17216
17563
  fill: "currentColor"
17217
17564
  }
17218
17565
  ),
17219
- /* @__PURE__ */ jsx20(
17566
+ /* @__PURE__ */ jsx21(
17220
17567
  "path",
17221
17568
  {
17222
17569
  d: "M29.4145 8.9796L30.7803 9.55271C30.49 10.0923 30.0621 10.5129 29.5001 10.8217C28.9382 11.1344 28.3167 11.2944 27.6319 11.2944C26.9472 11.2944 26.3629 11.1567 25.8121 10.8701C25.2613 10.5873 24.8147 10.1742 24.4835 9.6383C24.1523 9.09868 23.9811 8.48835 23.9811 7.79987C23.9811 7.11138 24.1486 6.49361 24.4835 5.95771C24.8147 5.41809 25.2613 5.00873 25.8121 4.72589C26.3629 4.44305 26.9732 4.30164 27.6319 4.30164C28.2906 4.30164 28.9382 4.45794 29.5038 4.77427C30.0658 5.08688 30.4938 5.51113 30.7803 6.05075L29.4145 6.62015C29.0535 5.93539 28.3985 5.56323 27.6319 5.56323C27.0327 5.56323 26.5303 5.77536 26.1135 6.19961C25.6967 6.62387 25.492 7.15977 25.492 7.80731C25.492 8.45486 25.6967 8.99076 26.1135 9.40757C26.5303 9.83182 27.0327 10.0439 27.6319 10.0439C28.3985 10.0439 29.0535 9.66807 29.4145 8.98703V8.9796Z",
17223
17570
  fill: "currentColor"
17224
17571
  }
17225
17572
  ),
17226
- /* @__PURE__ */ jsx20(
17573
+ /* @__PURE__ */ jsx21(
17227
17574
  "path",
17228
17575
  {
17229
17576
  d: "M37.4386 11.2049V7.80341C37.4386 6.35945 36.9139 5.59282 35.697 5.59282C35.0978 5.59282 34.614 5.7975 34.2419 6.21059C33.8623 6.61996 33.6725 7.15214 33.6725 7.80713V11.2086H32.1615V1.9234H33.6725V5.47745C34.1004 4.73315 35.001 4.29773 36.1919 4.29773C37.167 4.29773 37.8666 4.59917 38.302 5.19834C38.7375 5.7975 38.9533 6.66834 38.9533 7.80341V11.2049H37.4349H37.4386Z",
17230
17577
  fill: "currentColor"
17231
17578
  }
17232
17579
  ),
17233
- /* @__PURE__ */ jsx20(
17580
+ /* @__PURE__ */ jsx21(
17234
17581
  "path",
17235
17582
  {
17236
17583
  d: "M46.5692 5.38819C47.2167 6.07295 47.5777 7.1187 47.5107 8.30587H41.8242C41.9284 8.83805 42.1741 9.26602 42.5611 9.59352C42.9481 9.92473 43.4022 10.0885 43.9157 10.0885C44.8052 10.0885 45.5234 9.59724 45.8844 8.78222L47.1795 9.40372C46.8818 9.99172 46.4352 10.4495 45.8509 10.7881C45.2629 11.1268 44.6191 11.2943 43.9157 11.2943C42.9295 11.2943 42.0178 10.9444 41.3516 10.3453C40.6855 9.7461 40.2649 8.83432 40.2649 7.79602C40.2649 6.75771 40.6892 5.84222 41.3516 5.23933C42.0178 4.64017 42.9295 4.29034 43.9157 4.29034C44.9801 4.29034 45.9216 4.69971 46.5692 5.38447V5.38819ZM42.5388 6.00224C42.1592 6.32974 41.921 6.75772 41.8205 7.29734H46.0221C45.9179 6.75772 45.6835 6.3223 45.3039 5.99852C44.9243 5.67847 44.4628 5.51473 43.9195 5.51473C43.3761 5.51473 42.9221 5.67847 42.5425 6.00597L42.5388 6.00224Z",
17237
17584
  fill: "currentColor"
17238
17585
  }
17239
17586
  ),
17240
- /* @__PURE__ */ jsx20(
17587
+ /* @__PURE__ */ jsx21(
17241
17588
  "path",
17242
17589
  {
17243
17590
  d: "M59.7699 5.23933C60.1495 5.86827 60.3132 6.68329 60.3132 7.80347V11.2049H58.8023V7.80347C58.8023 6.35952 58.3371 5.59288 57.2318 5.59288C56.6438 5.59288 56.1861 5.79384 55.8586 6.19577C55.5311 6.60141 55.3673 7.13731 55.3673 7.80347V11.2049H53.8489V7.80347C53.8489 6.35952 53.3838 5.59288 52.2785 5.59288C51.6905 5.59288 51.2327 5.79384 50.9052 6.19577C50.574 6.60141 50.4102 7.13731 50.4102 7.80347V11.2049H48.8993V4.39827H50.3433L50.4102 5.47379C50.8196 4.65878 51.5825 4.29407 52.8106 4.29407C53.9606 4.29407 54.7161 4.78531 55.077 5.76407C55.5199 4.81508 56.4428 4.29407 57.7677 4.29407C58.7093 4.29407 59.3829 4.61412 59.7699 5.23562V5.23933Z",
17244
17591
  fill: "currentColor"
17245
17592
  }
17246
17593
  ),
17247
- /* @__PURE__ */ jsx20(
17594
+ /* @__PURE__ */ jsx21(
17248
17595
  "path",
17249
17596
  {
17250
17597
  d: "M67.4264 5.47382L67.4934 4.3983H68.9373V11.205H67.4934L67.4264 10.1294C67.0282 10.9147 66.1797 11.3092 64.8809 11.3017C63.102 11.3427 61.591 9.79823 61.6283 7.8035C61.591 5.8162 63.102 4.2606 64.8809 4.29782C66.0643 4.29782 67.0096 4.7444 67.4264 5.47754V5.47382ZM66.8049 9.37398C67.2217 8.95717 67.4264 8.43243 67.4264 7.79605C67.4264 7.15967 67.2217 6.64238 66.8049 6.21813C66.3881 5.80132 65.8782 5.58919 65.2828 5.58919C64.6874 5.58919 64.1887 5.80132 63.7719 6.21813C63.355 6.64238 63.1504 7.16711 63.1504 7.79605C63.1504 8.42499 63.355 8.95717 63.7719 9.37398C64.1887 9.79823 64.6911 10.0104 65.2828 10.0104C65.8745 10.0104 66.3881 9.79823 66.8049 9.37398Z",
17251
17598
  fill: "currentColor"
17252
17599
  }
17253
17600
  ),
17254
- /* @__PURE__ */ jsx20(
17601
+ /* @__PURE__ */ jsx21(
17255
17602
  "path",
17256
17603
  {
17257
17604
  d: "M71.3891 2.85757H72.8926V4.39828H74.6455V5.58172H72.8926V8.9683C72.8926 9.5898 73.1048 9.90985 73.5923 9.96568C73.89 10.0252 74.2398 10.0141 74.6455 9.9359V11.1863C74.1989 11.257 73.7858 11.2943 73.4062 11.2943C72.6731 11.2943 72.1595 11.1082 71.8543 10.7323C71.5454 10.3639 71.3891 9.79076 71.3891 9.02041V5.58172H70.4215V4.39828H71.3891V2.85757Z",
17258
17605
  fill: "currentColor"
17259
17606
  }
17260
17607
  ),
17261
- /* @__PURE__ */ jsx20(
17608
+ /* @__PURE__ */ jsx21(
17262
17609
  "path",
17263
17610
  {
17264
17611
  d: "M76.1747 3.15526C75.9923 2.98035 75.903 2.76078 75.903 2.50772C75.903 2.25466 75.9923 2.04997 76.1747 1.86762C76.3496 1.69271 76.5691 1.60339 76.8222 1.60339C77.0753 1.60339 77.2874 1.69271 77.4623 1.86762C77.6372 2.04997 77.7265 2.2621 77.7265 2.50772C77.7265 2.75334 77.6372 2.97291 77.4623 3.15526C77.2874 3.33762 77.0678 3.42694 76.8222 3.42694C76.5766 3.42694 76.3496 3.33762 76.1747 3.15526ZM76.0593 4.39826H77.5777V11.2049H76.0593V4.39826Z",
17265
17612
  fill: "currentColor"
17266
17613
  }
17267
17614
  ),
17268
- /* @__PURE__ */ jsx20(
17615
+ /* @__PURE__ */ jsx21(
17269
17616
  "path",
17270
17617
  {
17271
17618
  d: "M84.3023 8.9796L85.6681 9.55271C85.3778 10.0923 84.9498 10.5129 84.3879 10.8217C83.8259 11.1344 83.2044 11.2944 82.5197 11.2944C81.8349 11.2944 81.2506 11.1567 80.6998 10.8701C80.1491 10.5873 79.7025 10.1742 79.3713 9.6383C79.04 9.09868 78.8689 8.48835 78.8689 7.79987C78.8689 7.11138 79.0363 6.49361 79.3713 5.95771C79.7025 5.41809 80.1528 5.00873 80.6998 4.72589C81.2469 4.44305 81.8609 4.30164 82.5197 4.30164C83.1784 4.30164 83.8259 4.45794 84.3916 4.77427C84.9535 5.08688 85.3815 5.51113 85.6681 6.05075L84.3023 6.62015C83.9413 5.93539 83.2863 5.56323 82.5197 5.56323C81.9205 5.56323 81.4181 5.77536 81.0013 6.19961C80.5845 6.62387 80.3798 7.15977 80.3798 7.80731C80.3798 8.45486 80.5845 8.99076 81.0013 9.40757C81.4181 9.83182 81.9205 10.0439 82.5197 10.0439C83.2863 10.0439 83.9413 9.66807 84.3023 8.98703V8.9796Z",
17272
17619
  fill: "currentColor"
17273
17620
  }
17274
17621
  ),
17275
- /* @__PURE__ */ jsx20(
17622
+ /* @__PURE__ */ jsx21(
17276
17623
  "path",
17277
17624
  {
17278
17625
  d: "M5.93091 10.8141L7.2758 9.41753L3.83719 5.84667C2.98568 4.9624 2.98568 3.52157 3.83719 2.63731C4.68871 1.75305 6.07617 1.75305 6.92769 2.63731L10.3663 6.20817L11.7112 4.81156L8.27258 1.24069C6.67975 -0.413401 4.08513 -0.413401 2.4923 1.24069C0.899472 2.89479 0.899472 5.58919 2.4923 7.24328L5.93091 10.8141Z",
17279
17626
  fill: "currentColor"
17280
17627
  }
17281
17628
  ),
17282
- /* @__PURE__ */ jsx20(
17629
+ /* @__PURE__ */ jsx21(
17283
17630
  "path",
17284
17631
  {
17285
17632
  d: "M6.05827 3.54751C5.68761 3.1626 5.08404 3.1626 4.71338 3.54751C4.34272 3.93243 4.34272 4.55921 4.71338 4.94413L9.02103 9.41746L5.93054 12.6268L1.62288 8.15349C1.25223 7.76857 0.648653 7.76857 0.277994 8.15349C-0.0926647 8.5384 -0.0926647 9.16519 0.277994 9.5501L5.93054 15.4201L11.7108 9.41746L6.05827 3.54751Z",
@@ -17295,11 +17642,11 @@ var Badge = () => {
17295
17642
  };
17296
17643
 
17297
17644
  // src/components/layout/RenderLayout.tsx
17298
- import { useEffect as useEffect6, useState as useState10 } from "react";
17299
- import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
17645
+ import { useEffect as useEffect6, useState as useState11 } from "react";
17646
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
17300
17647
  var Disabled = () => {
17301
17648
  const theme = nt();
17302
- return /* @__PURE__ */ jsx21(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx21(Card, { children: /* @__PURE__ */ jsxs16(
17649
+ return /* @__PURE__ */ jsx22(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx22(Card, { children: /* @__PURE__ */ jsxs17(
17303
17650
  Element,
17304
17651
  {
17305
17652
  as: Flex,
@@ -17308,7 +17655,7 @@ var Disabled = () => {
17308
17655
  $alignItems: "center",
17309
17656
  $whiteSpace: "nowrap",
17310
17657
  children: [
17311
- /* @__PURE__ */ jsx21(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx21(
17658
+ /* @__PURE__ */ jsx22(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx22(
17312
17659
  Text,
17313
17660
  {
17314
17661
  as: "h1",
@@ -17319,7 +17666,7 @@ var Disabled = () => {
17319
17666
  children: "Portal not found"
17320
17667
  }
17321
17668
  ) }),
17322
- /* @__PURE__ */ jsx21(
17669
+ /* @__PURE__ */ jsx22(
17323
17670
  Text,
17324
17671
  {
17325
17672
  as: "p",
@@ -17337,7 +17684,7 @@ var Disabled = () => {
17337
17684
  var Success = () => {
17338
17685
  const theme = nt();
17339
17686
  const { hydrate, data, api, setLayout, isPending } = useEmbed();
17340
- const [isOpen, setIsOpen] = useState10(true);
17687
+ const [isOpen, setIsOpen] = useState11(true);
17341
17688
  useEffect6(() => {
17342
17689
  if (api && data.component?.id) {
17343
17690
  hydrate();
@@ -17349,7 +17696,7 @@ var Success = () => {
17349
17696
  setLayout("portal");
17350
17697
  }
17351
17698
  }, [isPending, isOpen, setLayout]);
17352
- return /* @__PURE__ */ jsx21(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx21(Card, { children: /* @__PURE__ */ jsxs16(
17699
+ return /* @__PURE__ */ jsx22(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx22(Card, { children: /* @__PURE__ */ jsxs17(
17353
17700
  Element,
17354
17701
  {
17355
17702
  as: Flex,
@@ -17358,7 +17705,7 @@ var Success = () => {
17358
17705
  $alignItems: "center",
17359
17706
  $whiteSpace: "nowrap",
17360
17707
  children: [
17361
- /* @__PURE__ */ jsx21(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx21(
17708
+ /* @__PURE__ */ jsx22(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx22(
17362
17709
  IconRound,
17363
17710
  {
17364
17711
  name: "check",
@@ -17366,7 +17713,7 @@ var Success = () => {
17366
17713
  colors: [theme.card.background, theme.primary]
17367
17714
  }
17368
17715
  ) }),
17369
- /* @__PURE__ */ jsx21(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx21(
17716
+ /* @__PURE__ */ jsx22(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx22(
17370
17717
  Text,
17371
17718
  {
17372
17719
  as: "h1",
@@ -17377,7 +17724,7 @@ var Success = () => {
17377
17724
  children: "Subscription updated!"
17378
17725
  }
17379
17726
  ) }),
17380
- /* @__PURE__ */ jsx21(
17727
+ /* @__PURE__ */ jsx22(
17381
17728
  Text,
17382
17729
  {
17383
17730
  as: "p",
@@ -17396,9 +17743,9 @@ var RenderLayout = ({ children }) => {
17396
17743
  const { layout } = useEmbed();
17397
17744
  switch (layout) {
17398
17745
  case "disabled":
17399
- return /* @__PURE__ */ jsx21(Disabled, {});
17746
+ return /* @__PURE__ */ jsx22(Disabled, {});
17400
17747
  case "success":
17401
- return /* @__PURE__ */ jsx21(Success, {});
17748
+ return /* @__PURE__ */ jsx22(Success, {});
17402
17749
  default:
17403
17750
  return children;
17404
17751
  }
@@ -17423,14 +17770,14 @@ var StyledViewport = dt(Box).attrs(({ theme }) => ({
17423
17770
  `;
17424
17771
 
17425
17772
  // src/components/layout/viewport/Viewport.tsx
17426
- import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
17773
+ import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
17427
17774
  var Viewport = forwardRef4(
17428
17775
  ({ children, portal, ...props }, ref) => {
17429
17776
  const { data, layout } = useEmbed();
17430
- const [top, setTop] = useState11(0);
17777
+ const [top, setTop] = useState12(0);
17431
17778
  const canCheckout = data.capabilities?.checkout ?? true;
17432
17779
  useLayoutEffect5(() => {
17433
- if (layout !== "checkout") {
17780
+ if (layout !== "checkout" && layout !== "unsubscribe") {
17434
17781
  return;
17435
17782
  }
17436
17783
  const parent = portal || document.body;
@@ -17443,12 +17790,13 @@ var Viewport = forwardRef4(
17443
17790
  parent.style.overflow = "";
17444
17791
  };
17445
17792
  }, [layout, portal]);
17446
- return /* @__PURE__ */ jsxs17(Fragment9, { children: [
17447
- /* @__PURE__ */ jsxs17(StyledViewport, { ref, ...props, children: [
17448
- /* @__PURE__ */ jsx22(RenderLayout, { children }),
17449
- /* @__PURE__ */ jsx22(Badge, {})
17793
+ return /* @__PURE__ */ jsxs18(Fragment9, { children: [
17794
+ /* @__PURE__ */ jsxs18(StyledViewport, { ref, ...props, children: [
17795
+ /* @__PURE__ */ jsx23(RenderLayout, { children }),
17796
+ /* @__PURE__ */ jsx23(Badge, {})
17450
17797
  ] }),
17451
- canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx22(CheckoutDialog, { top }), portal || document.body)
17798
+ canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx23(CheckoutDialog, { top }), portal || document.body),
17799
+ layout === "unsubscribe" && createPortal2(/* @__PURE__ */ jsx23(UnsubscribeDialog, {}), portal || document.body)
17452
17800
  ] });
17453
17801
  }
17454
17802
  );
@@ -17501,10 +17849,10 @@ var StyledCard = dt.div(({ theme }) => {
17501
17849
  });
17502
17850
 
17503
17851
  // src/components/layout/card/Card.tsx
17504
- import { jsx as jsx23 } from "react/jsx-runtime";
17852
+ import { jsx as jsx24 } from "react/jsx-runtime";
17505
17853
  var Card = forwardRef5(
17506
17854
  ({ children, className }, ref) => {
17507
- return /* @__PURE__ */ jsx23(StyledCard, { ref, className, children });
17855
+ return /* @__PURE__ */ jsx24(StyledCard, { ref, className, children });
17508
17856
  }
17509
17857
  );
17510
17858
  Card.displayName = "Card";
@@ -17515,18 +17863,18 @@ var StyledColumn = dt.div`
17515
17863
  `;
17516
17864
 
17517
17865
  // src/components/layout/column/Column.tsx
17518
- import { jsx as jsx24 } from "react/jsx-runtime";
17866
+ import { jsx as jsx25 } from "react/jsx-runtime";
17519
17867
  var Column = forwardRef6(
17520
17868
  ({ children, basis, ...props }, ref) => {
17521
- return /* @__PURE__ */ jsx24(StyledColumn, { ref, ...props, children: /* @__PURE__ */ jsx24(Card, { children }) });
17869
+ return /* @__PURE__ */ jsx25(StyledColumn, { ref, ...props, children: /* @__PURE__ */ jsx25(Card, { children }) });
17522
17870
  }
17523
17871
  );
17524
17872
  Column.displayName = "Column";
17525
17873
 
17526
17874
  // src/components/elements/included-features/Details.tsx
17527
- import { useMemo as useMemo7 } from "react";
17875
+ import { useMemo as useMemo8 } from "react";
17528
17876
  var import_pluralize4 = __toESM(require_pluralize());
17529
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
17877
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
17530
17878
  var Details = ({
17531
17879
  details,
17532
17880
  shouldWrapChildren,
@@ -17544,7 +17892,7 @@ var Details = ({
17544
17892
  const { t: t2 } = useTranslation();
17545
17893
  const theme = nt();
17546
17894
  const { data } = useEmbed();
17547
- const currency = useMemo7(() => {
17895
+ const currency = useMemo8(() => {
17548
17896
  if (data.company?.plan?.planPeriod === "month") {
17549
17897
  return monthlyUsageBasedPrice?.currency;
17550
17898
  }
@@ -17556,7 +17904,7 @@ var Details = ({
17556
17904
  monthlyUsageBasedPrice,
17557
17905
  yearlyUsageBasedPrice
17558
17906
  ]);
17559
- const price = useMemo7(() => {
17907
+ const price = useMemo8(() => {
17560
17908
  if (data.company?.plan?.planPeriod === "month") {
17561
17909
  return monthlyUsageBasedPrice?.price;
17562
17910
  }
@@ -17568,7 +17916,7 @@ var Details = ({
17568
17916
  monthlyUsageBasedPrice,
17569
17917
  yearlyUsageBasedPrice
17570
17918
  ]);
17571
- const text = useMemo7(() => {
17919
+ const text = useMemo8(() => {
17572
17920
  if (!feature?.name) {
17573
17921
  return;
17574
17922
  }
@@ -17585,7 +17933,7 @@ var Details = ({
17585
17933
  return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
17586
17934
  }
17587
17935
  }, [allocation, feature?.name, price, priceBehavior, t2, currency]);
17588
- const usageText = useMemo7(() => {
17936
+ const usageText = useMemo8(() => {
17589
17937
  if (!feature?.name) {
17590
17938
  return;
17591
17939
  }
@@ -17627,14 +17975,14 @@ var Details = ({
17627
17975
  if (!text) {
17628
17976
  return null;
17629
17977
  }
17630
- return /* @__PURE__ */ jsxs18(
17978
+ return /* @__PURE__ */ jsxs19(
17631
17979
  Box,
17632
17980
  {
17633
17981
  $flexBasis: "min-content",
17634
17982
  $flexGrow: "1",
17635
17983
  $textAlign: shouldWrapChildren ? "left" : "right",
17636
17984
  children: [
17637
- props.entitlement.isVisible && /* @__PURE__ */ jsx25(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx25(
17985
+ props.entitlement.isVisible && /* @__PURE__ */ jsx26(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx26(
17638
17986
  Text,
17639
17987
  {
17640
17988
  $font: theme.typography[props.entitlement.fontStyle].fontFamily,
@@ -17645,7 +17993,7 @@ var Details = ({
17645
17993
  children: text
17646
17994
  }
17647
17995
  ) }),
17648
- props.usage.isVisible && usageText && /* @__PURE__ */ jsx25(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx25(
17996
+ props.usage.isVisible && usageText && /* @__PURE__ */ jsx26(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx26(
17649
17997
  Text,
17650
17998
  {
17651
17999
  $font: theme.typography[props.usage.fontStyle].fontFamily,
@@ -17662,7 +18010,7 @@ var Details = ({
17662
18010
  };
17663
18011
 
17664
18012
  // src/components/elements/included-features/IncludedFeatures.tsx
17665
- import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
18013
+ import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
17666
18014
  function resolveDesignProps(props) {
17667
18015
  return {
17668
18016
  header: {
@@ -17699,7 +18047,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17699
18047
  const elements = useRef6([]);
17700
18048
  const shouldWrapChildren = useWrapChildren(elements.current);
17701
18049
  const isLightBackground = useIsLightBackground();
17702
- const [showCount, setShowCount] = useState12(VISIBLE_ENTITLEMENT_COUNT);
18050
+ const [showCount, setShowCount] = useState13(VISIBLE_ENTITLEMENT_COUNT);
17703
18051
  const entitlements = (props.visibleFeatures ? props.visibleFeatures : data.featureUsage?.features.sort((a2, b2) => {
17704
18052
  if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
17705
18053
  return 1;
@@ -17743,7 +18091,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17743
18091
  }
17744
18092
  const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
17745
18093
  const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
17746
- return /* @__PURE__ */ jsxs19(
18094
+ return /* @__PURE__ */ jsxs20(
17747
18095
  Element,
17748
18096
  {
17749
18097
  as: Flex,
@@ -17752,7 +18100,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17752
18100
  $flexDirection: "column",
17753
18101
  $gap: "1rem",
17754
18102
  children: [
17755
- props.header.isVisible && /* @__PURE__ */ jsx26(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx26(
18103
+ props.header.isVisible && /* @__PURE__ */ jsx27(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx27(
17756
18104
  Text,
17757
18105
  {
17758
18106
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -17765,7 +18113,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17765
18113
  entitlements.slice(0, showCount).map((entitlement, index) => {
17766
18114
  const { entitlementExpirationDate, feature } = entitlement.featureUsage || {};
17767
18115
  const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
17768
- return /* @__PURE__ */ jsxs19(
18116
+ return /* @__PURE__ */ jsxs20(
17769
18117
  Flex,
17770
18118
  {
17771
18119
  ref: (el) => {
@@ -17778,7 +18126,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17778
18126
  $alignItems: "center",
17779
18127
  $gap: "1rem",
17780
18128
  children: [
17781
- /* @__PURE__ */ jsxs19(
18129
+ /* @__PURE__ */ jsxs20(
17782
18130
  Flex,
17783
18131
  {
17784
18132
  $alignItems: "center",
@@ -17786,7 +18134,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17786
18134
  $flexBasis: "min-content",
17787
18135
  $gap: "1rem",
17788
18136
  children: [
17789
- props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx26(
18137
+ props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx27(
17790
18138
  IconRound,
17791
18139
  {
17792
18140
  name: feature.icon,
@@ -17797,7 +18145,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17797
18145
  ]
17798
18146
  }
17799
18147
  ),
17800
- feature?.name && /* @__PURE__ */ jsx26(
18148
+ feature?.name && /* @__PURE__ */ jsx27(
17801
18149
  Text,
17802
18150
  {
17803
18151
  $font: theme.typography[props.icons.fontStyle].fontFamily,
@@ -17807,7 +18155,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17807
18155
  children: feature.name
17808
18156
  }
17809
18157
  ),
17810
- props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ jsxs19(
18158
+ props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ jsxs20(
17811
18159
  Text,
17812
18160
  {
17813
18161
  $font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
@@ -17827,7 +18175,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17827
18175
  ]
17828
18176
  }
17829
18177
  ),
17830
- shouldShowDetails && /* @__PURE__ */ jsx26(
18178
+ shouldShowDetails && /* @__PURE__ */ jsx27(
17831
18179
  Details,
17832
18180
  {
17833
18181
  details: entitlement,
@@ -17840,8 +18188,8 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17840
18188
  index
17841
18189
  );
17842
18190
  }),
17843
- shouldShowExpand && /* @__PURE__ */ jsxs19(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
17844
- /* @__PURE__ */ jsx26(
18191
+ shouldShowExpand && /* @__PURE__ */ jsxs20(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
18192
+ /* @__PURE__ */ jsx27(
17845
18193
  Icon2,
17846
18194
  {
17847
18195
  name: isExpanded ? "chevron-up" : "chevron-down",
@@ -17853,7 +18201,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17853
18201
  }
17854
18202
  }
17855
18203
  ),
17856
- /* @__PURE__ */ jsx26(
18204
+ /* @__PURE__ */ jsx27(
17857
18205
  Text,
17858
18206
  {
17859
18207
  onClick: handleToggleShowAll,
@@ -17874,8 +18222,8 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
17874
18222
  IncludedFeatures.displayName = "IncludedFeatures";
17875
18223
 
17876
18224
  // src/components/elements/invoices/Invoices.tsx
17877
- import { forwardRef as forwardRef8, useEffect as useEffect7, useState as useState13 } from "react";
17878
- import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
18225
+ import { forwardRef as forwardRef8, useEffect as useEffect7, useState as useState14 } from "react";
18226
+ import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
17879
18227
  function resolveDesignProps2(props) {
17880
18228
  return {
17881
18229
  header: {
@@ -17911,7 +18259,7 @@ function formatInvoices(invoices) {
17911
18259
  }
17912
18260
  var InvoiceDate = ({ date, fontStyle, url }) => {
17913
18261
  const theme = nt();
17914
- const dateText = /* @__PURE__ */ jsx27(
18262
+ const dateText = /* @__PURE__ */ jsx28(
17915
18263
  Text,
17916
18264
  {
17917
18265
  ...url && { onClick: () => {
@@ -17924,7 +18272,7 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
17924
18272
  }
17925
18273
  );
17926
18274
  if (url) {
17927
- return /* @__PURE__ */ jsx27("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
18275
+ return /* @__PURE__ */ jsx28("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
17928
18276
  }
17929
18277
  return dateText;
17930
18278
  };
@@ -17933,8 +18281,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17933
18281
  const { t: t2 } = useTranslation();
17934
18282
  const theme = nt();
17935
18283
  const { api } = useEmbed();
17936
- const [invoices, setInvoices] = useState13(() => formatInvoices(data));
17937
- const [listSize, setListSize] = useState13(props.limit.number);
18284
+ const [invoices, setInvoices] = useState14(() => formatInvoices(data));
18285
+ const [listSize, setListSize] = useState14(props.limit.number);
17938
18286
  const toggleListSize = () => {
17939
18287
  setListSize(
17940
18288
  (prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
@@ -17948,8 +18296,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17948
18296
  if (invoices.length === 0) {
17949
18297
  return null;
17950
18298
  }
17951
- return /* @__PURE__ */ jsx27(Element, { ref, className, children: /* @__PURE__ */ jsxs20(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17952
- props.header.isVisible && /* @__PURE__ */ jsx27(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx27(
18299
+ return /* @__PURE__ */ jsx28(Element, { ref, className, children: /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18300
+ props.header.isVisible && /* @__PURE__ */ jsx28(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx28(
17953
18301
  Text,
17954
18302
  {
17955
18303
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -17959,9 +18307,9 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17959
18307
  children: t2("Invoices")
17960
18308
  }
17961
18309
  ) }),
17962
- /* @__PURE__ */ jsx27(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
17963
- return /* @__PURE__ */ jsxs20(Flex, { $justifyContent: "space-between", children: [
17964
- props.date.isVisible && date && /* @__PURE__ */ jsx27(
18310
+ /* @__PURE__ */ jsx28(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
18311
+ return /* @__PURE__ */ jsxs21(Flex, { $justifyContent: "space-between", children: [
18312
+ props.date.isVisible && date && /* @__PURE__ */ jsx28(
17965
18313
  InvoiceDate,
17966
18314
  {
17967
18315
  date,
@@ -17969,7 +18317,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17969
18317
  url
17970
18318
  }
17971
18319
  ),
17972
- props.amount.isVisible && /* @__PURE__ */ jsx27(
18320
+ props.amount.isVisible && /* @__PURE__ */ jsx28(
17973
18321
  Text,
17974
18322
  {
17975
18323
  $font: theme.typography[props.amount.fontStyle].fontFamily,
@@ -17981,15 +18329,15 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
17981
18329
  )
17982
18330
  ] }, index);
17983
18331
  }) }),
17984
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs20(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17985
- /* @__PURE__ */ jsx27(
18332
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs21(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
18333
+ /* @__PURE__ */ jsx28(
17986
18334
  Icon2,
17987
18335
  {
17988
18336
  name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
17989
18337
  style: { color: "#D0D0D0" }
17990
18338
  }
17991
18339
  ),
17992
- /* @__PURE__ */ jsx27(
18340
+ /* @__PURE__ */ jsx28(
17993
18341
  Text,
17994
18342
  {
17995
18343
  onClick: toggleListSize,
@@ -18027,7 +18375,7 @@ var Container4 = dt(Flex)`
18027
18375
  `;
18028
18376
 
18029
18377
  // src/components/elements/metered-features/MeteredFeatures.tsx
18030
- import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
18378
+ import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
18031
18379
  function resolveDesignProps3(props) {
18032
18380
  return {
18033
18381
  isVisible: props.isVisible ?? true,
@@ -18077,7 +18425,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18077
18425
  if (!shouldShowFeatures) {
18078
18426
  return null;
18079
18427
  }
18080
- return /* @__PURE__ */ jsx28(Container4, { ref, className, children: featureUsage.map(
18428
+ return /* @__PURE__ */ jsx29(Container4, { ref, className, children: featureUsage.map(
18081
18429
  ({
18082
18430
  allocation,
18083
18431
  feature,
@@ -18096,8 +18444,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18096
18444
  price = yearlyUsageBasedPrice?.price;
18097
18445
  currency = yearlyUsageBasedPrice?.currency;
18098
18446
  }
18099
- return /* @__PURE__ */ jsxs21(Element, { as: Flex, $gap: "1.5rem", children: [
18100
- props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx28(
18447
+ return /* @__PURE__ */ jsxs22(Element, { as: Flex, $gap: "1.5rem", children: [
18448
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx29(
18101
18449
  IconRound,
18102
18450
  {
18103
18451
  name: feature.icon,
@@ -18108,8 +18456,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18108
18456
  ]
18109
18457
  }
18110
18458
  ),
18111
- /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
18112
- /* @__PURE__ */ jsxs21(
18459
+ /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
18460
+ /* @__PURE__ */ jsxs22(
18113
18461
  Flex,
18114
18462
  {
18115
18463
  ref: (el) => {
@@ -18120,8 +18468,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18120
18468
  $flexWrap: "wrap",
18121
18469
  $gap: "1rem",
18122
18470
  children: [
18123
- feature?.name && /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
18124
- /* @__PURE__ */ jsx28(
18471
+ feature?.name && /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
18472
+ /* @__PURE__ */ jsx29(
18125
18473
  Text,
18126
18474
  {
18127
18475
  as: Box,
@@ -18129,14 +18477,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18129
18477
  $size: theme.typography[props.header.fontStyle].fontSize,
18130
18478
  $weight: theme.typography[props.header.fontStyle].fontWeight,
18131
18479
  $color: theme.typography[props.header.fontStyle].color,
18132
- children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs21(Fragment10, { children: [
18480
+ children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
18133
18481
  formatNumber(usage),
18134
18482
  " ",
18135
18483
  (0, import_pluralize5.default)(feature.name, usage)
18136
18484
  ] }) : feature.name
18137
18485
  }
18138
18486
  ),
18139
- props.description.isVisible && /* @__PURE__ */ jsx28(
18487
+ props.description.isVisible && /* @__PURE__ */ jsx29(
18140
18488
  Text,
18141
18489
  {
18142
18490
  as: Box,
@@ -18148,14 +18496,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18148
18496
  }
18149
18497
  )
18150
18498
  ] }),
18151
- (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs21(
18499
+ (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs22(
18152
18500
  Box,
18153
18501
  {
18154
18502
  $flexBasis: "min-content",
18155
18503
  $flexGrow: "1",
18156
18504
  $textAlign: shouldWrapChildren ? "left" : "right",
18157
18505
  children: [
18158
- props.usage.isVisible && /* @__PURE__ */ jsx28(
18506
+ props.usage.isVisible && /* @__PURE__ */ jsx29(
18159
18507
  Text,
18160
18508
  {
18161
18509
  as: Box,
@@ -18164,18 +18512,18 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18164
18512
  $weight: theme.typography[props.usage.fontStyle].fontWeight,
18165
18513
  $leading: 1.25,
18166
18514
  $color: theme.typography[props.usage.fontStyle].color,
18167
- children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs21(Fragment10, { children: [
18515
+ children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
18168
18516
  formatNumber(allocation),
18169
18517
  " ",
18170
18518
  (0, import_pluralize5.default)(feature.name, allocation)
18171
- ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs21(Fragment10, { children: [
18519
+ ] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
18172
18520
  formatNumber(usage),
18173
18521
  " ",
18174
18522
  (0, import_pluralize5.default)(feature.name, usage)
18175
18523
  ] })
18176
18524
  }
18177
18525
  ),
18178
- props.allocation.isVisible && /* @__PURE__ */ jsx28(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx28(
18526
+ props.allocation.isVisible && /* @__PURE__ */ jsx29(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx29(
18179
18527
  Text,
18180
18528
  {
18181
18529
  $font: theme.typography[props.allocation.fontStyle].fontFamily,
@@ -18199,8 +18547,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18199
18547
  ]
18200
18548
  }
18201
18549
  ),
18202
- props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ jsxs21(Flex, { $gap: "2rem", children: [
18203
- /* @__PURE__ */ jsx28(
18550
+ props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ jsxs22(Flex, { $gap: "2rem", children: [
18551
+ /* @__PURE__ */ jsx29(
18204
18552
  ProgressBar,
18205
18553
  {
18206
18554
  progress: usage / allocation * 100,
@@ -18212,7 +18560,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
18212
18560
  $flexGrow: "1"
18213
18561
  }
18214
18562
  ),
18215
- priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsx28(
18563
+ priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsx29(
18216
18564
  EmbedButton,
18217
18565
  {
18218
18566
  onClick: () => {
@@ -18237,15 +18585,15 @@ MeteredFeatures.displayName = "MeteredFeatures";
18237
18585
  // src/components/elements/payment-method/PaymentMethod.tsx
18238
18586
  import {
18239
18587
  forwardRef as forwardRef10,
18240
- useCallback as useCallback8,
18588
+ useCallback as useCallback9,
18241
18589
  useEffect as useEffect8,
18242
18590
  useLayoutEffect as useLayoutEffect6,
18243
- useMemo as useMemo8,
18244
- useState as useState14
18591
+ useMemo as useMemo9,
18592
+ useState as useState15
18245
18593
  } from "react";
18246
18594
  import { createPortal as createPortal3 } from "react-dom";
18247
18595
  import { Elements as Elements2 } from "@stripe/react-stripe-js";
18248
- import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
18596
+ import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
18249
18597
  var PaymentElement2 = ({
18250
18598
  iconName,
18251
18599
  iconTitle,
@@ -18254,11 +18602,11 @@ var PaymentElement2 = ({
18254
18602
  paymentLast4
18255
18603
  }) => {
18256
18604
  const theme = nt();
18257
- return /* @__PURE__ */ jsx29(Fragment11, { children: /* @__PURE__ */ jsx29(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "row", $alignItems: "center", children: [
18258
- iconName && /* @__PURE__ */ jsx29(Box, { children: /* @__PURE__ */ jsx29(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
18259
- /* @__PURE__ */ jsxs22(Flex, { $alignItems: "center", children: [
18260
- /* @__PURE__ */ jsx29(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
18261
- paymentLast4 && /* @__PURE__ */ jsx29(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
18605
+ return /* @__PURE__ */ jsx30(Fragment11, { children: /* @__PURE__ */ jsx30(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "row", $alignItems: "center", children: [
18606
+ iconName && /* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
18607
+ /* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", children: [
18608
+ /* @__PURE__ */ jsx30(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
18609
+ paymentLast4 && /* @__PURE__ */ jsx30(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
18262
18610
  ] })
18263
18611
  ] }) }) });
18264
18612
  };
@@ -18356,16 +18704,16 @@ var PaymentMethodElement = ({
18356
18704
  iconTitle: genericLabel,
18357
18705
  label: genericLabel
18358
18706
  };
18359
- return /* @__PURE__ */ jsx29(
18707
+ return /* @__PURE__ */ jsx30(
18360
18708
  PaymentElement2,
18361
18709
  {
18362
18710
  ...paymentMethodElementProps(iconName, iconTitle, label, paymentLast4)
18363
18711
  }
18364
18712
  );
18365
18713
  };
18366
- return /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
18367
- props.header.isVisible && /* @__PURE__ */ jsxs22(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
18368
- /* @__PURE__ */ jsx29(
18714
+ return /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
18715
+ props.header.isVisible && /* @__PURE__ */ jsxs23(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
18716
+ /* @__PURE__ */ jsx30(
18369
18717
  Text,
18370
18718
  {
18371
18719
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -18375,7 +18723,7 @@ var PaymentMethodElement = ({
18375
18723
  children: t2("Payment Method")
18376
18724
  }
18377
18725
  ),
18378
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx29(
18726
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx30(
18379
18727
  Text,
18380
18728
  {
18381
18729
  $font: theme.typography.text.fontFamily,
@@ -18385,7 +18733,7 @@ var PaymentMethodElement = ({
18385
18733
  }
18386
18734
  )
18387
18735
  ] }),
18388
- /* @__PURE__ */ jsxs22(
18736
+ /* @__PURE__ */ jsxs23(
18389
18737
  Flex,
18390
18738
  {
18391
18739
  $justifyContent: "space-between",
@@ -18395,7 +18743,7 @@ var PaymentMethodElement = ({
18395
18743
  $borderRadius: "9999px",
18396
18744
  children: [
18397
18745
  renderPaymentMethodElement(),
18398
- props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx29(
18746
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx30(
18399
18747
  Text,
18400
18748
  {
18401
18749
  onClick: onEdit,
@@ -18418,18 +18766,18 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18418
18766
  const theme = nt();
18419
18767
  const { api, data, layout, setLayout } = useEmbed();
18420
18768
  const isLightBackground = useIsLightBackground();
18421
- const [isLoading, setIsLoading] = useState14(false);
18422
- const [error, setError] = useState14();
18423
- const [showPaymentForm, setShowPaymentForm] = useState14(
18769
+ const [isLoading, setIsLoading] = useState15(false);
18770
+ const [error, setError] = useState15();
18771
+ const [showPaymentForm, setShowPaymentForm] = useState15(
18424
18772
  () => typeof data.subscription?.paymentMethod === "undefined"
18425
18773
  );
18426
- const [stripe, setStripe] = useState14(null);
18427
- const [setupIntent, setSetupIntent] = useState14();
18428
- const [top, setTop] = useState14(0);
18429
- const paymentMethod = useMemo8(() => {
18774
+ const [stripe, setStripe] = useState15(null);
18775
+ const [setupIntent, setSetupIntent] = useState15();
18776
+ const [top, setTop] = useState15(0);
18777
+ const paymentMethod = useMemo9(() => {
18430
18778
  return data.subscription?.paymentMethod;
18431
18779
  }, [data.subscription?.paymentMethod]);
18432
- const monthsToExpiration = useMemo8(() => {
18780
+ const monthsToExpiration = useMemo9(() => {
18433
18781
  let expiration;
18434
18782
  if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
18435
18783
  const today = /* @__PURE__ */ new Date();
@@ -18442,7 +18790,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18442
18790
  }
18443
18791
  return expiration;
18444
18792
  }, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
18445
- const createSetupIntent = useCallback8(async () => {
18793
+ const createSetupIntent = useCallback9(async () => {
18446
18794
  if (!api || !data.component?.id) {
18447
18795
  return;
18448
18796
  }
@@ -18461,7 +18809,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18461
18809
  setIsLoading(false);
18462
18810
  }
18463
18811
  }, [t2, api, data.component?.id]);
18464
- const updatePaymentMethod = useCallback8(
18812
+ const updatePaymentMethod = useCallback9(
18465
18813
  async (id) => {
18466
18814
  if (!api || !id) {
18467
18815
  return;
@@ -18501,8 +18849,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18501
18849
  if (!paymentMethod?.paymentMethodType) {
18502
18850
  return null;
18503
18851
  }
18504
- return /* @__PURE__ */ jsxs22(Element, { ref, className, children: [
18505
- /* @__PURE__ */ jsx29(
18852
+ return /* @__PURE__ */ jsxs23(Element, { ref, className, children: [
18853
+ /* @__PURE__ */ jsx30(
18506
18854
  PaymentMethodElement,
18507
18855
  {
18508
18856
  paymentMethod,
@@ -18512,8 +18860,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18512
18860
  }
18513
18861
  ),
18514
18862
  layout === "payment" && createPortal3(
18515
- /* @__PURE__ */ jsxs22(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
18516
- /* @__PURE__ */ jsx29(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx29(
18863
+ /* @__PURE__ */ jsxs23(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
18864
+ /* @__PURE__ */ jsx30(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx30(
18517
18865
  Text,
18518
18866
  {
18519
18867
  $font: theme.typography.text.fontFamily,
@@ -18523,7 +18871,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18523
18871
  children: t2("Edit payment method")
18524
18872
  }
18525
18873
  ) }),
18526
- /* @__PURE__ */ jsx29(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ jsx29(
18874
+ /* @__PURE__ */ jsx30(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ jsx30(
18527
18875
  Flex,
18528
18876
  {
18529
18877
  $flexDirection: "column",
@@ -18532,8 +18880,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18532
18880
  $padding: "2rem 2.5rem 2rem 2.5rem",
18533
18881
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
18534
18882
  $overflow: "auto",
18535
- children: /* @__PURE__ */ jsxs22(Fragment11, { children: [
18536
- showPaymentForm ? /* @__PURE__ */ jsx29(
18883
+ children: /* @__PURE__ */ jsxs23(Fragment11, { children: [
18884
+ showPaymentForm ? /* @__PURE__ */ jsx30(
18537
18885
  Elements2,
18538
18886
  {
18539
18887
  stripe,
@@ -18562,15 +18910,15 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18562
18910
  },
18563
18911
  clientSecret: setupIntent?.setupIntentClientSecret
18564
18912
  },
18565
- children: /* @__PURE__ */ jsx29(
18913
+ children: /* @__PURE__ */ jsx30(
18566
18914
  PaymentForm,
18567
18915
  {
18568
18916
  onConfirm: (value) => updatePaymentMethod(value)
18569
18917
  }
18570
18918
  )
18571
18919
  }
18572
- ) : /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: "2rem", children: [
18573
- /* @__PURE__ */ jsx29(
18920
+ ) : /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "2rem", children: [
18921
+ /* @__PURE__ */ jsx30(
18574
18922
  PaymentMethodElement,
18575
18923
  {
18576
18924
  size: "lg",
@@ -18579,7 +18927,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18579
18927
  ...props
18580
18928
  }
18581
18929
  ),
18582
- /* @__PURE__ */ jsx29(Box, { children: /* @__PURE__ */ jsx29(
18930
+ /* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(
18583
18931
  Text,
18584
18932
  {
18585
18933
  onClick: createSetupIntent,
@@ -18591,7 +18939,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
18591
18939
  }
18592
18940
  ) })
18593
18941
  ] }),
18594
- !isLoading && error && /* @__PURE__ */ jsx29(Box, { children: /* @__PURE__ */ jsx29(
18942
+ !isLoading && error && /* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(
18595
18943
  Text,
18596
18944
  {
18597
18945
  $font: theme.typography.text.fontFamily,
@@ -18614,7 +18962,7 @@ PaymentMethod.displayName = "PaymentMethod";
18614
18962
  // src/components/elements/plan-manager/PlanManager.tsx
18615
18963
  import { forwardRef as forwardRef11 } from "react";
18616
18964
  var import_pluralize6 = __toESM(require_pluralize());
18617
- import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
18965
+ import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
18618
18966
  var resolveDesignProps5 = (props) => {
18619
18967
  return {
18620
18968
  header: {
@@ -18676,22 +19024,23 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18676
19024
  []
18677
19025
  );
18678
19026
  const billingSubscription = data.company?.billingSubscription;
18679
- const subscriptionCurrency = billingSubscription?.currency ?? "USD";
19027
+ const subscriptionCurrency = billingSubscription?.currency;
18680
19028
  const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
19029
+ const showUnsubscribeBox = billingSubscription && billingSubscription.status == "cancelled";
18681
19030
  const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
18682
19031
  const todayDate = /* @__PURE__ */ new Date();
18683
19032
  const trialEndDays = Math.floor(
18684
19033
  (trialEndDate.getTime() - todayDate.getTime()) / (1e3 * 60 * 60 * 24)
18685
19034
  );
18686
- return /* @__PURE__ */ jsxs23(Fragment12, { children: [
18687
- showTrialBox && /* @__PURE__ */ jsxs23(
19035
+ return /* @__PURE__ */ jsxs24(Fragment12, { children: [
19036
+ showTrialBox && !showUnsubscribeBox && /* @__PURE__ */ jsxs24(
18688
19037
  Box,
18689
19038
  {
18690
19039
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
18691
19040
  $textAlign: "center",
18692
19041
  $padding: "1rem",
18693
19042
  children: [
18694
- /* @__PURE__ */ jsx30(
19043
+ /* @__PURE__ */ jsx31(
18695
19044
  Text,
18696
19045
  {
18697
19046
  as: "h3",
@@ -18702,7 +19051,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18702
19051
  children: t2("Trial ends in", { days: trialEndDays.toString() })
18703
19052
  }
18704
19053
  ),
18705
- /* @__PURE__ */ jsx30(
19054
+ /* @__PURE__ */ jsx31(
18706
19055
  Text,
18707
19056
  {
18708
19057
  as: "p",
@@ -18720,7 +19069,43 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18720
19069
  ]
18721
19070
  }
18722
19071
  ),
18723
- /* @__PURE__ */ jsxs23(
19072
+ showUnsubscribeBox && /* @__PURE__ */ jsxs24(
19073
+ Box,
19074
+ {
19075
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
19076
+ $textAlign: "center",
19077
+ $padding: "1rem",
19078
+ children: [
19079
+ /* @__PURE__ */ jsx31(
19080
+ Text,
19081
+ {
19082
+ as: "h3",
19083
+ $font: theme.typography.heading3.fontFamily,
19084
+ $size: theme.typography.heading3.fontSize,
19085
+ $weight: theme.typography.heading3.fontWeight,
19086
+ $color: theme.typography.heading3.color,
19087
+ children: t2("Subscription canceled")
19088
+ }
19089
+ ),
19090
+ /* @__PURE__ */ jsx31(
19091
+ Text,
19092
+ {
19093
+ as: "p",
19094
+ $font: theme.typography.text.fontFamily,
19095
+ $size: theme.typography.text.fontSize * 0.8125,
19096
+ $weight: theme.typography.text.fontWeight,
19097
+ $color: theme.typography.text.color,
19098
+ children: billingSubscription.cancelAt ? t2("Access to plan will end on", {
19099
+ date: toPrettyDate(new Date(billingSubscription.cancelAt), {
19100
+ month: "numeric"
19101
+ })
19102
+ }) : ""
19103
+ }
19104
+ )
19105
+ ]
19106
+ }
19107
+ ),
19108
+ /* @__PURE__ */ jsxs24(
18724
19109
  Element,
18725
19110
  {
18726
19111
  as: Flex,
@@ -18729,7 +19114,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18729
19114
  $flexDirection: "column",
18730
19115
  $gap: "2rem",
18731
19116
  children: [
18732
- props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs23(
19117
+ props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs24(
18733
19118
  Flex,
18734
19119
  {
18735
19120
  $justifyContent: "space-between",
@@ -18737,8 +19122,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18737
19122
  $flexWrap: "wrap",
18738
19123
  $gap: "1rem",
18739
19124
  children: [
18740
- /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18741
- /* @__PURE__ */ jsx30(
19125
+ /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
19126
+ /* @__PURE__ */ jsx31(
18742
19127
  Text,
18743
19128
  {
18744
19129
  as: Box,
@@ -18750,7 +19135,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18750
19135
  children: currentPlan.name
18751
19136
  }
18752
19137
  ),
18753
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx30(
19138
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx31(
18754
19139
  Text,
18755
19140
  {
18756
19141
  as: Box,
@@ -18762,8 +19147,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18762
19147
  }
18763
19148
  )
18764
19149
  ] }),
18765
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs23(Box, { children: [
18766
- /* @__PURE__ */ jsx30(
19150
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs24(Box, { children: [
19151
+ /* @__PURE__ */ jsx31(
18767
19152
  Text,
18768
19153
  {
18769
19154
  $font: theme.typography[props.header.price.fontStyle].fontFamily,
@@ -18776,14 +19161,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18776
19161
  )
18777
19162
  }
18778
19163
  ),
18779
- /* @__PURE__ */ jsx30(
19164
+ /* @__PURE__ */ jsx31(
18780
19165
  Text,
18781
19166
  {
18782
19167
  $font: theme.typography[props.header.price.fontStyle].fontFamily,
18783
19168
  $size: theme.typography[props.header.price.fontStyle].fontSize,
18784
19169
  $weight: theme.typography[props.header.price.fontStyle].fontWeight,
18785
19170
  $color: theme.typography[props.header.price.fontStyle].color,
18786
- children: /* @__PURE__ */ jsxs23("sub", { children: [
19171
+ children: /* @__PURE__ */ jsxs24("sub", { children: [
18787
19172
  "/",
18788
19173
  shortenPeriod(currentPlan.planPeriod)
18789
19174
  ] })
@@ -18793,8 +19178,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18793
19178
  ]
18794
19179
  }
18795
19180
  ),
18796
- props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18797
- props.addOns.showLabel && /* @__PURE__ */ jsx30(
19181
+ props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
19182
+ props.addOns.showLabel && /* @__PURE__ */ jsx31(
18798
19183
  Text,
18799
19184
  {
18800
19185
  $font: theme.typography.text.fontFamily,
@@ -18805,7 +19190,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18805
19190
  children: t2("Add-ons")
18806
19191
  }
18807
19192
  ),
18808
- addOns.map((addOn) => /* @__PURE__ */ jsxs23(
19193
+ addOns.map((addOn) => /* @__PURE__ */ jsxs24(
18809
19194
  Flex,
18810
19195
  {
18811
19196
  $justifyContent: "space-between",
@@ -18813,7 +19198,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18813
19198
  $flexWrap: "wrap",
18814
19199
  $gap: "1rem",
18815
19200
  children: [
18816
- /* @__PURE__ */ jsx30(
19201
+ /* @__PURE__ */ jsx31(
18817
19202
  Text,
18818
19203
  {
18819
19204
  $font: theme.typography[props.addOns.fontStyle].fontFamily,
@@ -18823,7 +19208,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18823
19208
  children: addOn.name
18824
19209
  }
18825
19210
  ),
18826
- addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ jsxs23(
19211
+ addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ jsxs24(
18827
19212
  Text,
18828
19213
  {
18829
19214
  $font: theme.typography.text.fontFamily,
@@ -18832,7 +19217,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18832
19217
  $color: theme.typography.text.color,
18833
19218
  children: [
18834
19219
  formatCurrency(addOn.planPrice, subscriptionCurrency),
18835
- /* @__PURE__ */ jsxs23("sub", { children: [
19220
+ /* @__PURE__ */ jsxs24("sub", { children: [
18836
19221
  "/",
18837
19222
  shortenPeriod(addOn.planPeriod)
18838
19223
  ] })
@@ -18844,8 +19229,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18844
19229
  addOn.id
18845
19230
  ))
18846
19231
  ] }),
18847
- usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18848
- /* @__PURE__ */ jsx30(
19232
+ usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
19233
+ /* @__PURE__ */ jsx31(
18849
19234
  Text,
18850
19235
  {
18851
19236
  $font: theme.typography.text.fontFamily,
@@ -18860,7 +19245,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18860
19245
  (acc, entitlement) => {
18861
19246
  if (entitlement.feature?.name) {
18862
19247
  acc.push(
18863
- /* @__PURE__ */ jsxs23(
19248
+ /* @__PURE__ */ jsxs24(
18864
19249
  Flex,
18865
19250
  {
18866
19251
  $justifyContent: "space-between",
@@ -18868,14 +19253,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18868
19253
  $flexWrap: "wrap",
18869
19254
  $gap: "1rem",
18870
19255
  children: [
18871
- /* @__PURE__ */ jsx30(
19256
+ /* @__PURE__ */ jsx31(
18872
19257
  Text,
18873
19258
  {
18874
19259
  $font: theme.typography[props.addOns.fontStyle].fontFamily,
18875
19260
  $size: theme.typography[props.addOns.fontStyle].fontSize,
18876
19261
  $weight: theme.typography[props.addOns.fontStyle].fontWeight,
18877
19262
  $color: theme.typography[props.addOns.fontStyle].color,
18878
- children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs23(Fragment12, { children: [
19263
+ children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs24(Fragment12, { children: [
18879
19264
  entitlement.quantity,
18880
19265
  " ",
18881
19266
  (0, import_pluralize6.default)(
@@ -18885,8 +19270,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18885
19270
  ] }) : entitlement.feature.name
18886
19271
  }
18887
19272
  ),
18888
- /* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", $gap: "1rem", children: [
18889
- entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs23(
19273
+ /* @__PURE__ */ jsxs24(Flex, { $alignItems: "center", $gap: "1rem", children: [
19274
+ entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs24(
18890
19275
  Text,
18891
19276
  {
18892
19277
  $font: theme.typography.text.fontFamily,
@@ -18898,7 +19283,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18898
19283
  entitlement.price,
18899
19284
  entitlement.currencyCode
18900
19285
  ),
18901
- /* @__PURE__ */ jsxs23("sub", { children: [
19286
+ /* @__PURE__ */ jsxs24("sub", { children: [
18902
19287
  "/",
18903
19288
  (0, import_pluralize6.default)(
18904
19289
  entitlement.feature.name.toLowerCase(),
@@ -18910,7 +19295,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18910
19295
  ]
18911
19296
  }
18912
19297
  ),
18913
- /* @__PURE__ */ jsxs23(
19298
+ /* @__PURE__ */ jsxs24(
18914
19299
  Text,
18915
19300
  {
18916
19301
  $font: theme.typography.text.fontFamily,
@@ -18922,7 +19307,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18922
19307
  entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
18923
19308
  entitlement.currencyCode
18924
19309
  ),
18925
- /* @__PURE__ */ jsxs23("sub", { children: [
19310
+ /* @__PURE__ */ jsxs24("sub", { children: [
18926
19311
  "/",
18927
19312
  currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
18928
19313
  entitlement.feature.name.toLowerCase(),
@@ -18944,7 +19329,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18944
19329
  []
18945
19330
  )
18946
19331
  ] }),
18947
- canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx30(
19332
+ canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx31(
18948
19333
  EmbedButton,
18949
19334
  {
18950
19335
  onClick: () => {
@@ -18968,9 +19353,9 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
18968
19353
  PlanManager.displayName = "PlanManager";
18969
19354
 
18970
19355
  // src/components/elements/pricing-table/PricingTable.tsx
18971
- import { forwardRef as forwardRef12, useState as useState15 } from "react";
19356
+ import { forwardRef as forwardRef12, useState as useState16 } from "react";
18972
19357
  var import_pluralize7 = __toESM(require_pluralize());
18973
- import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
19358
+ import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
18974
19359
  var resolveDesignProps6 = (props) => {
18975
19360
  return {
18976
19361
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -19016,12 +19401,12 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19016
19401
  const theme = nt();
19017
19402
  const { data, setLayout, setSelected } = useEmbed();
19018
19403
  const trialEndDays = useTrialEnd();
19019
- const [selectedPeriod, setSelectedPeriod] = useState15(
19404
+ const [selectedPeriod, setSelectedPeriod] = useState16(
19020
19405
  () => data.company?.plan?.planPeriod || "month"
19021
19406
  );
19022
19407
  const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
19023
19408
  const isLightBackground = useIsLightBackground();
19024
- const [entitlementCounts, setEntitlementCounts] = useState15(
19409
+ const [entitlementCounts, setEntitlementCounts] = useState16(
19025
19410
  () => plans.reduce(
19026
19411
  (acc, plan) => {
19027
19412
  acc[plan.id] = {
@@ -19048,7 +19433,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19048
19433
  };
19049
19434
  });
19050
19435
  };
19051
- return /* @__PURE__ */ jsxs24(
19436
+ return /* @__PURE__ */ jsxs25(
19052
19437
  FussyChild,
19053
19438
  {
19054
19439
  ref,
@@ -19057,8 +19442,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19057
19442
  $flexDirection: "column",
19058
19443
  $gap: "2rem",
19059
19444
  children: [
19060
- /* @__PURE__ */ jsxs24(Box, { children: [
19061
- /* @__PURE__ */ jsxs24(
19445
+ /* @__PURE__ */ jsxs25(Box, { children: [
19446
+ /* @__PURE__ */ jsxs25(
19062
19447
  Flex,
19063
19448
  {
19064
19449
  $flexDirection: "column",
@@ -19073,7 +19458,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19073
19458
  }
19074
19459
  },
19075
19460
  children: [
19076
- /* @__PURE__ */ jsx31(
19461
+ /* @__PURE__ */ jsx32(
19077
19462
  Text,
19078
19463
  {
19079
19464
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -19083,7 +19468,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19083
19468
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
19084
19469
  }
19085
19470
  ),
19086
- props.showPeriodToggle && /* @__PURE__ */ jsx31(
19471
+ props.showPeriodToggle && /* @__PURE__ */ jsx32(
19087
19472
  PeriodToggle,
19088
19473
  {
19089
19474
  options: periods,
@@ -19094,7 +19479,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19094
19479
  ]
19095
19480
  }
19096
19481
  ),
19097
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx31(
19482
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx32(
19098
19483
  Box,
19099
19484
  {
19100
19485
  $display: "grid",
@@ -19107,7 +19492,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19107
19492
  if (count?.limit && count.limit > VISIBLE_ENTITLEMENT_COUNT) {
19108
19493
  isExpanded = true;
19109
19494
  }
19110
- return /* @__PURE__ */ jsxs24(
19495
+ return /* @__PURE__ */ jsxs25(
19111
19496
  Flex,
19112
19497
  {
19113
19498
  $position: "relative",
@@ -19120,7 +19505,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19120
19505
  $outlineColor: isActivePlan ? theme.primary : "transparent",
19121
19506
  ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
19122
19507
  children: [
19123
- /* @__PURE__ */ jsxs24(
19508
+ /* @__PURE__ */ jsxs25(
19124
19509
  Flex,
19125
19510
  {
19126
19511
  $flexDirection: "column",
@@ -19131,7 +19516,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19131
19516
  $borderStyle: "solid",
19132
19517
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
19133
19518
  children: [
19134
- /* @__PURE__ */ jsx31(Box, { children: /* @__PURE__ */ jsx31(
19519
+ /* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
19135
19520
  Text,
19136
19521
  {
19137
19522
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19141,7 +19526,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19141
19526
  children: plan.name
19142
19527
  }
19143
19528
  ) }),
19144
- props.plans.description.isVisible && /* @__PURE__ */ jsx31(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx31(
19529
+ props.plans.description.isVisible && /* @__PURE__ */ jsx32(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx32(
19145
19530
  Text,
19146
19531
  {
19147
19532
  $font: theme.typography[props.plans.description.fontStyle].fontFamily,
@@ -19151,8 +19536,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19151
19536
  children: plan.description
19152
19537
  }
19153
19538
  ) }),
19154
- /* @__PURE__ */ jsxs24(Box, { children: [
19155
- /* @__PURE__ */ jsx31(
19539
+ /* @__PURE__ */ jsxs25(Box, { children: [
19540
+ /* @__PURE__ */ jsx32(
19156
19541
  Text,
19157
19542
  {
19158
19543
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19165,7 +19550,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19165
19550
  )
19166
19551
  }
19167
19552
  ),
19168
- !plan.custom && /* @__PURE__ */ jsxs24(
19553
+ !plan.custom && /* @__PURE__ */ jsxs25(
19169
19554
  Text,
19170
19555
  {
19171
19556
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19179,7 +19564,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19179
19564
  }
19180
19565
  )
19181
19566
  ] }),
19182
- isActivePlan && /* @__PURE__ */ jsx31(
19567
+ isActivePlan && /* @__PURE__ */ jsx32(
19183
19568
  Flex,
19184
19569
  {
19185
19570
  $position: "absolute",
@@ -19196,7 +19581,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19196
19581
  ]
19197
19582
  }
19198
19583
  ),
19199
- /* @__PURE__ */ jsxs24(
19584
+ /* @__PURE__ */ jsxs25(
19200
19585
  Flex,
19201
19586
  {
19202
19587
  $flexDirection: "column",
@@ -19205,7 +19590,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19205
19590
  $gap: `${cardPadding}rem`,
19206
19591
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
19207
19592
  children: [
19208
- props.plans.showEntitlements && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
19593
+ props.plans.showEntitlements && /* @__PURE__ */ jsxs25(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
19209
19594
  plan.entitlements.slice().sort((a2, b2) => {
19210
19595
  if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
19211
19596
  return 1;
@@ -19228,8 +19613,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19228
19613
  return acc;
19229
19614
  }
19230
19615
  acc.push(
19231
- /* @__PURE__ */ jsxs24(Flex, { $gap: "1rem", children: [
19232
- props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx31(
19616
+ /* @__PURE__ */ jsxs25(Flex, { $gap: "1rem", children: [
19617
+ props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx32(
19233
19618
  IconRound,
19234
19619
  {
19235
19620
  name: entitlement.feature.icon,
@@ -19240,7 +19625,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19240
19625
  ]
19241
19626
  }
19242
19627
  ),
19243
- entitlement.feature?.name && /* @__PURE__ */ jsx31(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx31(
19628
+ entitlement.feature?.name && /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(
19244
19629
  Text,
19245
19630
  {
19246
19631
  $font: theme.typography.text.fontFamily,
@@ -19248,7 +19633,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19248
19633
  $weight: theme.typography.text.fontWeight,
19249
19634
  $color: theme.typography.text.color,
19250
19635
  $leading: 1.35,
19251
- children: typeof price !== "undefined" ? /* @__PURE__ */ jsxs24(Fragment13, { children: [
19636
+ children: typeof price !== "undefined" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
19252
19637
  formatCurrency(price, currency),
19253
19638
  " ",
19254
19639
  t2("per"),
@@ -19257,19 +19642,19 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19257
19642
  entitlement.feature.name,
19258
19643
  1
19259
19644
  ),
19260
- entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs24(Fragment13, { children: [
19645
+ entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs25(Fragment13, { children: [
19261
19646
  " ",
19262
19647
  t2("per"),
19263
19648
  " ",
19264
19649
  selectedPeriod
19265
19650
  ] })
19266
- ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs24(Fragment13, { children: [
19651
+ ] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
19267
19652
  entitlement.valueType === "unlimited" ? t2("Unlimited", {
19268
19653
  item: (0, import_pluralize7.default)(
19269
19654
  entitlement.feature.name
19270
19655
  )
19271
19656
  }) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
19272
- entitlement.metricPeriod && /* @__PURE__ */ jsxs24(Fragment13, { children: [
19657
+ entitlement.metricPeriod && /* @__PURE__ */ jsxs25(Fragment13, { children: [
19273
19658
  " ",
19274
19659
  t2("per"),
19275
19660
  " ",
@@ -19287,14 +19672,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19287
19672
  );
19288
19673
  return acc;
19289
19674
  }, []).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
19290
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs24(
19675
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs25(
19291
19676
  Flex,
19292
19677
  {
19293
19678
  $alignItems: "center",
19294
19679
  $justifyContent: "start",
19295
19680
  $marginTop: "1rem",
19296
19681
  children: [
19297
- /* @__PURE__ */ jsx31(
19682
+ /* @__PURE__ */ jsx32(
19298
19683
  Icon2,
19299
19684
  {
19300
19685
  name: isExpanded ? "chevron-up" : "chevron-down",
@@ -19306,7 +19691,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19306
19691
  }
19307
19692
  }
19308
19693
  ),
19309
- /* @__PURE__ */ jsx31(
19694
+ /* @__PURE__ */ jsx32(
19310
19695
  Text,
19311
19696
  {
19312
19697
  onClick: () => handleToggleShowAll(plan.id),
@@ -19323,7 +19708,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19323
19708
  }
19324
19709
  )
19325
19710
  ] }),
19326
- isActivePlan ? /* @__PURE__ */ jsxs24(
19711
+ isActivePlan ? /* @__PURE__ */ jsxs25(
19327
19712
  Flex,
19328
19713
  {
19329
19714
  $justifyContent: "center",
@@ -19331,7 +19716,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19331
19716
  $gap: "0.25rem",
19332
19717
  $padding: "0.625rem 0",
19333
19718
  children: [
19334
- /* @__PURE__ */ jsx31(
19719
+ /* @__PURE__ */ jsx32(
19335
19720
  Icon2,
19336
19721
  {
19337
19722
  name: "check-rounded",
@@ -19342,7 +19727,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19342
19727
  }
19343
19728
  }
19344
19729
  ),
19345
- /* @__PURE__ */ jsx31(
19730
+ /* @__PURE__ */ jsx32(
19346
19731
  Text,
19347
19732
  {
19348
19733
  $size: 15,
@@ -19353,7 +19738,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19353
19738
  )
19354
19739
  ]
19355
19740
  }
19356
- ) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ jsx31(
19741
+ ) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ jsx32(
19357
19742
  EmbedButton,
19358
19743
  {
19359
19744
  disabled: !plan.valid || !canCheckout,
@@ -19376,14 +19761,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19376
19761
  $color: props.downgrade.buttonStyle,
19377
19762
  $variant: "outline"
19378
19763
  },
19379
- children: plan.custom ? /* @__PURE__ */ jsx31(
19764
+ children: plan.custom ? /* @__PURE__ */ jsx32(
19380
19765
  ButtonLink,
19381
19766
  {
19382
19767
  href: plan.customPlanConfig?.ctaWebSite ?? "#",
19383
19768
  target: "_blank",
19384
19769
  children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
19385
19770
  }
19386
- ) : !plan.valid ? /* @__PURE__ */ jsx31(
19771
+ ) : !plan.valid ? /* @__PURE__ */ jsx32(
19387
19772
  Tooltip,
19388
19773
  {
19389
19774
  trigger: t2("Over usage limit"),
@@ -19405,14 +19790,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19405
19790
  }
19406
19791
  )
19407
19792
  ] }),
19408
- /* @__PURE__ */ jsx31(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs24(Fragment13, { children: [
19409
- props.header.isVisible && /* @__PURE__ */ jsx31(
19793
+ /* @__PURE__ */ jsx32(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs25(Fragment13, { children: [
19794
+ props.header.isVisible && /* @__PURE__ */ jsx32(
19410
19795
  Flex,
19411
19796
  {
19412
19797
  $justifyContent: "space-between",
19413
19798
  $alignItems: "center",
19414
19799
  $marginBottom: "1rem",
19415
- children: /* @__PURE__ */ jsx31(
19800
+ children: /* @__PURE__ */ jsx32(
19416
19801
  Text,
19417
19802
  {
19418
19803
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -19424,7 +19809,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19424
19809
  )
19425
19810
  }
19426
19811
  ),
19427
- /* @__PURE__ */ jsx31(
19812
+ /* @__PURE__ */ jsx32(
19428
19813
  Box,
19429
19814
  {
19430
19815
  $display: "grid",
@@ -19432,7 +19817,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19432
19817
  $gap: "1rem",
19433
19818
  children: addOns.map((addOn, index) => {
19434
19819
  const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
19435
- return /* @__PURE__ */ jsxs24(
19820
+ return /* @__PURE__ */ jsxs25(
19436
19821
  Flex,
19437
19822
  {
19438
19823
  $position: "relative",
@@ -19446,8 +19831,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19446
19831
  $outlineColor: isActiveAddOn ? theme.primary : "transparent",
19447
19832
  ...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
19448
19833
  children: [
19449
- /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
19450
- /* @__PURE__ */ jsx31(Box, { children: /* @__PURE__ */ jsx31(
19834
+ /* @__PURE__ */ jsxs25(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
19835
+ /* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
19451
19836
  Text,
19452
19837
  {
19453
19838
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19457,7 +19842,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19457
19842
  children: addOn.name
19458
19843
  }
19459
19844
  ) }),
19460
- props.addOns.showDescription && /* @__PURE__ */ jsx31(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx31(
19845
+ props.addOns.showDescription && /* @__PURE__ */ jsx32(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx32(
19461
19846
  Text,
19462
19847
  {
19463
19848
  $font: theme.typography[props.plans.description.fontStyle].fontFamily,
@@ -19467,8 +19852,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19467
19852
  children: addOn.description
19468
19853
  }
19469
19854
  ) }),
19470
- /* @__PURE__ */ jsxs24(Box, { children: [
19471
- /* @__PURE__ */ jsx31(
19855
+ /* @__PURE__ */ jsxs25(Box, { children: [
19856
+ /* @__PURE__ */ jsx32(
19472
19857
  Text,
19473
19858
  {
19474
19859
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19481,7 +19866,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19481
19866
  )
19482
19867
  }
19483
19868
  ),
19484
- /* @__PURE__ */ jsxs24(
19869
+ /* @__PURE__ */ jsxs25(
19485
19870
  Text,
19486
19871
  {
19487
19872
  $font: theme.typography[props.plans.name.fontStyle].fontFamily,
@@ -19495,7 +19880,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19495
19880
  }
19496
19881
  )
19497
19882
  ] }),
19498
- isActiveAddOn && /* @__PURE__ */ jsx31(
19883
+ isActiveAddOn && /* @__PURE__ */ jsx32(
19499
19884
  Flex,
19500
19885
  {
19501
19886
  $position: "absolute",
@@ -19510,7 +19895,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19510
19895
  }
19511
19896
  )
19512
19897
  ] }),
19513
- /* @__PURE__ */ jsxs24(
19898
+ /* @__PURE__ */ jsxs25(
19514
19899
  Flex,
19515
19900
  {
19516
19901
  $flexDirection: "column",
@@ -19518,7 +19903,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19518
19903
  $gap: `${cardPadding}rem`,
19519
19904
  $flexGrow: "1",
19520
19905
  children: [
19521
- props.addOns.showEntitlements && /* @__PURE__ */ jsx31(
19906
+ props.addOns.showEntitlements && /* @__PURE__ */ jsx32(
19522
19907
  Flex,
19523
19908
  {
19524
19909
  $flexDirection: "column",
@@ -19526,15 +19911,15 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19526
19911
  $gap: "1rem",
19527
19912
  $flexGrow: "1",
19528
19913
  children: addOn.entitlements.map((entitlement) => {
19529
- return /* @__PURE__ */ jsx31(
19914
+ return /* @__PURE__ */ jsx32(
19530
19915
  Flex,
19531
19916
  {
19532
19917
  $flexWrap: "wrap",
19533
19918
  $justifyContent: "space-between",
19534
19919
  $alignItems: "center",
19535
19920
  $gap: "1rem",
19536
- children: /* @__PURE__ */ jsxs24(Flex, { $gap: "1rem", children: [
19537
- props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx31(
19921
+ children: /* @__PURE__ */ jsxs25(Flex, { $gap: "1rem", children: [
19922
+ props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx32(
19538
19923
  IconRound,
19539
19924
  {
19540
19925
  name: entitlement.feature.icon,
@@ -19545,20 +19930,20 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19545
19930
  ]
19546
19931
  }
19547
19932
  ),
19548
- entitlement.feature?.name && /* @__PURE__ */ jsx31(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx31(
19933
+ entitlement.feature?.name && /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(
19549
19934
  Text,
19550
19935
  {
19551
19936
  $font: theme.typography.text.fontFamily,
19552
19937
  $size: theme.typography.text.fontSize,
19553
19938
  $weight: theme.typography.text.fontWeight,
19554
19939
  $color: theme.typography.text.color,
19555
- children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs24(Fragment13, { children: [
19940
+ children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
19556
19941
  entitlement.valueType === "unlimited" ? t2("Unlimited", {
19557
19942
  item: (0, import_pluralize7.default)(
19558
19943
  entitlement.feature.name
19559
19944
  )
19560
19945
  }) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
19561
- entitlement.metricPeriod && /* @__PURE__ */ jsxs24(Fragment13, { children: [
19946
+ entitlement.metricPeriod && /* @__PURE__ */ jsxs25(Fragment13, { children: [
19562
19947
  " ",
19563
19948
  t2("per"),
19564
19949
  " ",
@@ -19579,7 +19964,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19579
19964
  })
19580
19965
  }
19581
19966
  ),
19582
- props.upgrade.isVisible && /* @__PURE__ */ jsx31(
19967
+ props.upgrade.isVisible && /* @__PURE__ */ jsx32(
19583
19968
  EmbedButton,
19584
19969
  {
19585
19970
  disabled: !addOn.valid || !canCheckout,
@@ -19615,8 +20000,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
19615
20000
  PricingTable.displayName = "PricingTable";
19616
20001
 
19617
20002
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
19618
- import { forwardRef as forwardRef13, useMemo as useMemo9 } from "react";
19619
- import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
20003
+ import { forwardRef as forwardRef13, useMemo as useMemo10 } from "react";
20004
+ import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
19620
20005
  function resolveDesignProps7(props) {
19621
20006
  return {
19622
20007
  header: {
@@ -19641,7 +20026,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19641
20026
  const theme = nt();
19642
20027
  const { data } = useEmbed();
19643
20028
  const isLightBackground = useIsLightBackground();
19644
- const { upcomingInvoice, discounts } = useMemo9(() => {
20029
+ const { upcomingInvoice, discounts } = useMemo10(() => {
19645
20030
  const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
19646
20031
  amountOff: discount.amountOff,
19647
20032
  couponId: discount.couponId,
@@ -19668,7 +20053,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19668
20053
  if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
19669
20054
  return null;
19670
20055
  }
19671
- return /* @__PURE__ */ jsxs25(
20056
+ return /* @__PURE__ */ jsxs26(
19672
20057
  Element,
19673
20058
  {
19674
20059
  as: Flex,
@@ -19677,7 +20062,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19677
20062
  $flexDirection: "column",
19678
20063
  $gap: "1rem",
19679
20064
  children: [
19680
- props.header.isVisible && /* @__PURE__ */ jsx32(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsxs25(
20065
+ props.header.isVisible && /* @__PURE__ */ jsx33(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsxs26(
19681
20066
  Text,
19682
20067
  {
19683
20068
  $font: theme.typography[props.header.fontStyle].fontFamily,
@@ -19691,8 +20076,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19691
20076
  ]
19692
20077
  }
19693
20078
  ) }),
19694
- /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
19695
- props.price.isVisible && /* @__PURE__ */ jsx32(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsx32(
20079
+ /* @__PURE__ */ jsxs26(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
20080
+ props.price.isVisible && /* @__PURE__ */ jsx33(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsx33(
19696
20081
  Text,
19697
20082
  {
19698
20083
  $font: theme.typography[props.price.fontStyle].fontFamily,
@@ -19706,7 +20091,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19706
20091
  )
19707
20092
  }
19708
20093
  ) }),
19709
- /* @__PURE__ */ jsx32(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx32(
20094
+ /* @__PURE__ */ jsx33(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx33(
19710
20095
  Text,
19711
20096
  {
19712
20097
  $font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
@@ -19718,8 +20103,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19718
20103
  }
19719
20104
  ) })
19720
20105
  ] }),
19721
- discounts.length > 0 && /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
19722
- /* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
20106
+ discounts.length > 0 && /* @__PURE__ */ jsxs26(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
20107
+ /* @__PURE__ */ jsx33(Box, { children: /* @__PURE__ */ jsx33(
19723
20108
  Text,
19724
20109
  {
19725
20110
  $font: theme.typography.text.fontFamily,
@@ -19729,8 +20114,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19729
20114
  children: t2("Discount")
19730
20115
  }
19731
20116
  ) }),
19732
- /* @__PURE__ */ jsx32(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs25(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
19733
- /* @__PURE__ */ jsx32(
20117
+ /* @__PURE__ */ jsx33(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs26(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
20118
+ /* @__PURE__ */ jsx33(
19734
20119
  Flex,
19735
20120
  {
19736
20121
  $alignItems: "center",
@@ -19739,7 +20124,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19739
20124
  $borderStyle: "solid",
19740
20125
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
19741
20126
  $borderRadius: "0.3125rem",
19742
- children: /* @__PURE__ */ jsx32(
20127
+ children: /* @__PURE__ */ jsx33(
19743
20128
  Text,
19744
20129
  {
19745
20130
  $font: theme.typography.text.fontFamily,
@@ -19751,7 +20136,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19751
20136
  )
19752
20137
  }
19753
20138
  ),
19754
- /* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
20139
+ /* @__PURE__ */ jsx33(Box, { children: /* @__PURE__ */ jsx33(
19755
20140
  Text,
19756
20141
  {
19757
20142
  $font: theme.typography.text.fontFamily,
@@ -19769,8 +20154,69 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
19769
20154
  });
19770
20155
  UpcomingBill.displayName = "UpcomingBill";
19771
20156
 
20157
+ // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
20158
+ import { forwardRef as forwardRef14 } from "react";
20159
+ import { jsx as jsx34 } from "react/jsx-runtime";
20160
+ var resolveDesignProps8 = (props) => {
20161
+ return {
20162
+ button: {
20163
+ text: props.button?.text ?? "Unsubscribe",
20164
+ style: props.button?.style ?? "primary",
20165
+ size: props.button?.size ?? "md",
20166
+ fullWidth: props.button?.fullWidth ?? true,
20167
+ alignment: props.button?.alignment ?? "center"
20168
+ }
20169
+ };
20170
+ };
20171
+ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) => {
20172
+ const props = resolveDesignProps8(rest);
20173
+ const { t: t2 } = useTranslation();
20174
+ const { data, setLayout } = useEmbed();
20175
+ const disabled = !data.subscription || data.subscription.status === "cancelled";
20176
+ const buttonStyles = {
20177
+ primary: {
20178
+ color: "primary",
20179
+ variant: "filled"
20180
+ },
20181
+ secondary: {
20182
+ color: "primary",
20183
+ variant: "outline"
20184
+ },
20185
+ tertiary: {
20186
+ color: "primary",
20187
+ variant: "text"
20188
+ }
20189
+ };
20190
+ return /* @__PURE__ */ jsx34(
20191
+ Element,
20192
+ {
20193
+ as: Flex,
20194
+ ref,
20195
+ className,
20196
+ $flexDirection: "column",
20197
+ $gap: "2rem",
20198
+ children: /* @__PURE__ */ jsx34(
20199
+ EmbedButton,
20200
+ {
20201
+ $size: props.button.size,
20202
+ $color: buttonStyles[props.button.style].color,
20203
+ $variant: buttonStyles[props.button.style].variant,
20204
+ $alignment: props.button.alignment,
20205
+ $fullWidth: props.button.fullWidth,
20206
+ onClick: () => {
20207
+ setLayout("unsubscribe");
20208
+ },
20209
+ disabled,
20210
+ children: t2(props.button.text) ?? t2("Unsubscribe")
20211
+ }
20212
+ )
20213
+ }
20214
+ );
20215
+ });
20216
+ UnsubscribeButton.displayName = "UnsubscribeButton";
20217
+
19772
20218
  // src/components/embed/ComponentTree.tsx
19773
- import { useEffect as useEffect9, useState as useState16 } from "react";
20219
+ import { useEffect as useEffect9, useState as useState17 } from "react";
19774
20220
 
19775
20221
  // src/components/embed/renderer.ts
19776
20222
  import { createElement as createElement5 } from "react";
@@ -19785,7 +20231,8 @@ var components = {
19785
20231
  UpcomingBill,
19786
20232
  PaymentMethod,
19787
20233
  Invoices,
19788
- PricingTable
20234
+ PricingTable,
20235
+ UnsubscribeButton
19789
20236
  };
19790
20237
  function createRenderer(options) {
19791
20238
  const { useFallback = false } = options || {};
@@ -19795,7 +20242,7 @@ function createRenderer(options) {
19795
20242
  const component = useFallback ? components[name] || "div" : components[name];
19796
20243
  if (!components[name]) {
19797
20244
  console.debug(
19798
- "`schematic-embed`: Encounted an unknown component during render cycle.",
20245
+ "`schematic-embed`: Encountered an unknown component during render cycle.",
19799
20246
  name
19800
20247
  );
19801
20248
  }
@@ -19818,10 +20265,10 @@ function createRenderer(options) {
19818
20265
  }
19819
20266
 
19820
20267
  // src/components/embed/ComponentTree.tsx
19821
- import { Fragment as Fragment14, jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
20268
+ import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
19822
20269
  var Loading = () => {
19823
20270
  const theme = nt();
19824
- return /* @__PURE__ */ jsx33(
20271
+ return /* @__PURE__ */ jsx35(
19825
20272
  Flex,
19826
20273
  {
19827
20274
  $width: "100%",
@@ -19829,13 +20276,13 @@ var Loading = () => {
19829
20276
  $alignItems: "center",
19830
20277
  $justifyContent: "center",
19831
20278
  $padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
19832
- children: /* @__PURE__ */ jsx33(Loader, { $size: "2xl", $color: "#194BFB" })
20279
+ children: /* @__PURE__ */ jsx35(Loader, { $size: "2xl", $color: "#194BFB" })
19833
20280
  }
19834
20281
  );
19835
20282
  };
19836
20283
  var Error2 = ({ message }) => {
19837
20284
  const theme = nt();
19838
- return /* @__PURE__ */ jsxs26(
20285
+ return /* @__PURE__ */ jsxs27(
19839
20286
  Flex,
19840
20287
  {
19841
20288
  $flexDirection: "column",
@@ -19846,7 +20293,7 @@ var Error2 = ({ message }) => {
19846
20293
  $alignItems: "center",
19847
20294
  $justifyContent: "center",
19848
20295
  children: [
19849
- /* @__PURE__ */ jsx33(
20296
+ /* @__PURE__ */ jsx35(
19850
20297
  Box,
19851
20298
  {
19852
20299
  $marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
@@ -19857,7 +20304,7 @@ var Error2 = ({ message }) => {
19857
20304
  children: "Error"
19858
20305
  }
19859
20306
  ),
19860
- /* @__PURE__ */ jsx33(
20307
+ /* @__PURE__ */ jsx35(
19861
20308
  Box,
19862
20309
  {
19863
20310
  $marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
@@ -19874,31 +20321,31 @@ var Error2 = ({ message }) => {
19874
20321
  };
19875
20322
  var ComponentTree = () => {
19876
20323
  const { error, nodes, isPending } = useEmbed();
19877
- const [children, setChildren] = useState16(/* @__PURE__ */ jsx33(Loading, {}));
20324
+ const [children, setChildren] = useState17(/* @__PURE__ */ jsx35(Loading, {}));
19878
20325
  useEffect9(() => {
19879
20326
  const renderer = createRenderer();
19880
20327
  setChildren(nodes.map(renderer));
19881
20328
  }, [nodes]);
19882
20329
  if (error) {
19883
20330
  console.error(error);
19884
- return /* @__PURE__ */ jsx33(Error2, { message: error.message });
20331
+ return /* @__PURE__ */ jsx35(Error2, { message: error.message });
19885
20332
  }
19886
20333
  if (isPending) {
19887
- return /* @__PURE__ */ jsx33(Loading, {});
20334
+ return /* @__PURE__ */ jsx35(Loading, {});
19888
20335
  }
19889
- return /* @__PURE__ */ jsx33(Fragment14, { children });
20336
+ return /* @__PURE__ */ jsx35(Fragment14, { children });
19890
20337
  };
19891
20338
 
19892
20339
  // src/components/embed/Embed.tsx
19893
- import { jsx as jsx34 } from "react/jsx-runtime";
20340
+ import { jsx as jsx36 } from "react/jsx-runtime";
19894
20341
  var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
19895
20342
  if (accessToken?.length === 0) {
19896
- return /* @__PURE__ */ jsx34("div", { children: "Please provide an access token." });
20343
+ return /* @__PURE__ */ jsx36("div", { children: "Please provide an access token." });
19897
20344
  }
19898
20345
  if (!accessToken?.startsWith("token_")) {
19899
- return /* @__PURE__ */ jsx34("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
20346
+ return /* @__PURE__ */ jsx36("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
19900
20347
  }
19901
- return /* @__PURE__ */ jsx34(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx34(ComponentTree, {}) });
20348
+ return /* @__PURE__ */ jsx36(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx36(ComponentTree, {}) });
19902
20349
  };
19903
20350
  export {
19904
20351
  Box,
@@ -19930,6 +20377,7 @@ export {
19930
20377
  StyledCard,
19931
20378
  Text,
19932
20379
  Tooltip,
20380
+ UnsubscribeButton,
19933
20381
  UpcomingBill,
19934
20382
  Viewport,
19935
20383
  cardBoxShadow,