@bunnyapp/components 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -4604,9 +4604,11 @@ var SubscriptionChargeTotal = function (_a) {
4604
4604
  var currencyId = subscription.currencyId;
4605
4605
  var formattedDiscountedPrice = common.formatCurrency(charge.price, currencyId);
4606
4606
  var formattedPeriodPrice = common.formatCurrency(charge.periodPrice, currencyId);
4607
- return (jsxRuntime.jsx("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: charge.kind === common.SubscriptionChargeKind.DISCOUNT
4608
- ? "-".concat(formattedDiscountedPrice, " ").concat(billingPeriod)
4609
- : "".concat(formattedPeriodPrice, " ").concat(billingPeriod) })));
4607
+ return (jsxRuntime.jsx("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: charge.chargeType === common.ChargeType.USAGE || charge.trial
4608
+ ? "-"
4609
+ : charge.kind === common.SubscriptionChargeKind.DISCOUNT
4610
+ ? "-".concat(formattedDiscountedPrice, " ").concat(billingPeriod)
4611
+ : "".concat(formattedPeriodPrice, " ").concat(billingPeriod) })));
4610
4612
  };
4611
4613
 
4612
4614
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -4617,19 +4619,21 @@ var SubscriptionChargeUnitPrice = function (_a) {
4617
4619
  var isDiscount = (charge === null || charge === void 0 ? void 0 : charge.kind) === common.SubscriptionChargeKind.DISCOUNT;
4618
4620
  if (displayPriceTiers)
4619
4621
  return (jsxRuntime.jsx(antd.Dropdown, __assign({ dropdownRender: function () {
4620
- var _a, _b;
4622
+ var _a;
4621
4623
  return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded border border-solid border-slate-200 p-2", style: {
4622
4624
  backgroundColor: darkMode
4623
4625
  ? "var(--row-background-dark)"
4624
4626
  : "var(--row-background)",
4625
- } }, { children: jsxRuntime.jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b.map(function (tier, index) {
4626
- var _a, _b, _c, _d, _e;
4627
- var ends = ((_c = (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b[index + 1]) === null || _c === void 0 ? void 0 : _c.starts)
4628
- ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
4627
+ } }, { children: jsxRuntime.jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_a = charge.priceTiers) === null || _a === void 0 ? void 0 : _a.map(function (tier, index) {
4628
+ var _a, _b, _c;
4629
+ var ends = ((_b = (_a = charge.priceTiers) === null || _a === void 0 ? void 0 : _a[index + 1]) === null || _b === void 0 ? void 0 : _b.starts)
4630
+ ? ((_c = charge.priceTiers[index + 1]) === null || _c === void 0 ? void 0 : _c.starts) - 1
4629
4631
  : "∞";
4630
- return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsxRuntime.jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: common.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4632
+ return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " :"] })), jsxRuntime.jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: common.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4631
4633
  }) })) })));
4632
4634
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsxRuntime.jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "Hide tiers" : "Show tiers" })) })));
4635
+ else if (charge.chargeType === common.ChargeType.USAGE || charge.trial)
4636
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: "-" });
4633
4637
  else if (isDiscount)
4634
4638
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["-", common.formatCurrency(charge.discountedPrice, subscription.currencyId)] }));
4635
4639
  else
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import React__default, { createContext, useContext, useEffect, useState, useMemo
4
4
  import { Markup } from 'interweave';
5
5
  import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Modal, Form, Drawer, Card as Card$1, Select, Image, Dropdown, Skeleton } from 'antd';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, useAllErrorFormats, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useErrorNotification, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionChargeKind, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, PricingModel, ChargeType } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, useAllErrorFormats, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useErrorNotification, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionChargeKind, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, ChargeType, PricingModel } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useQueryClient, keepPreviousData, useMutation } from '@tanstack/react-query';
9
9
  import theme from 'antd/lib/theme';
10
10
  import { RecoilRoot } from 'recoil';
@@ -4576,9 +4576,11 @@ var SubscriptionChargeTotal = function (_a) {
4576
4576
  var currencyId = subscription.currencyId;
4577
4577
  var formattedDiscountedPrice = formatCurrency(charge.price, currencyId);
4578
4578
  var formattedPeriodPrice = formatCurrency(charge.periodPrice, currencyId);
4579
- return (jsx("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: charge.kind === SubscriptionChargeKind.DISCOUNT
4580
- ? "-".concat(formattedDiscountedPrice, " ").concat(billingPeriod)
4581
- : "".concat(formattedPeriodPrice, " ").concat(billingPeriod) })));
4579
+ return (jsx("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: charge.chargeType === ChargeType.USAGE || charge.trial
4580
+ ? "-"
4581
+ : charge.kind === SubscriptionChargeKind.DISCOUNT
4582
+ ? "-".concat(formattedDiscountedPrice, " ").concat(billingPeriod)
4583
+ : "".concat(formattedPeriodPrice, " ").concat(billingPeriod) })));
4582
4584
  };
4583
4585
 
4584
4586
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -4589,19 +4591,21 @@ var SubscriptionChargeUnitPrice = function (_a) {
4589
4591
  var isDiscount = (charge === null || charge === void 0 ? void 0 : charge.kind) === SubscriptionChargeKind.DISCOUNT;
4590
4592
  if (displayPriceTiers)
4591
4593
  return (jsx(Dropdown, __assign({ dropdownRender: function () {
4592
- var _a, _b;
4594
+ var _a;
4593
4595
  return (jsx("div", __assign({ className: "flex flex-col rounded border border-solid border-slate-200 p-2", style: {
4594
4596
  backgroundColor: darkMode
4595
4597
  ? "var(--row-background-dark)"
4596
4598
  : "var(--row-background)",
4597
- } }, { children: jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b.map(function (tier, index) {
4598
- var _a, _b, _c, _d, _e;
4599
- var ends = ((_c = (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b[index + 1]) === null || _c === void 0 ? void 0 : _c.starts)
4600
- ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
4599
+ } }, { children: jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_a = charge.priceTiers) === null || _a === void 0 ? void 0 : _a.map(function (tier, index) {
4600
+ var _a, _b, _c;
4601
+ var ends = ((_b = (_a = charge.priceTiers) === null || _a === void 0 ? void 0 : _a[index + 1]) === null || _b === void 0 ? void 0 : _b.starts)
4602
+ ? ((_c = charge.priceTiers[index + 1]) === null || _c === void 0 ? void 0 : _c.starts) - 1
4601
4603
  : "∞";
4602
- return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4604
+ return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " :"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4603
4605
  }) })) })));
4604
4606
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "Hide tiers" : "Show tiers" })) })));
4607
+ else if (charge.chargeType === ChargeType.USAGE || charge.trial)
4608
+ return jsx(Fragment, { children: "-" });
4605
4609
  else if (isDiscount)
4606
4610
  return (jsxs(Fragment, { children: ["-", formatCurrency(charge.discountedPrice, subscription.currencyId)] }));
4607
4611
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",