@bunnyapp/components 1.6.0-beta.13 → 1.6.0-beta.14

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
@@ -52,7 +52,7 @@ var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-altern
52
52
  styleInject(css_248z);
53
53
 
54
54
  // This will be replaced at build time by rollup-plugin-replace
55
- const PACKAGE_VERSION = '1.6.0-beta.12';
55
+ const PACKAGE_VERSION = '1.6.0-beta.13';
56
56
  const createRequestHeaders = (token) => {
57
57
  const headers = createClientDevHeaders({ token });
58
58
  // Add the components version header
@@ -22882,7 +22882,7 @@ function doesPriceListHaveFlatFeeCharges(priceList) {
22882
22882
  }
22883
22883
 
22884
22884
  function priceDescriptionString({ unitName, showPriceAsMonthly, periodMonths, priceListHasFlatFeeCharges, }) {
22885
- return `Per ${unitName && !priceListHasFlatFeeCharges ? `${unitName.toLowerCase()} / ` : ''}${showPriceAsMonthly ? 'month' : common.PERIOD_LABELS[periodMonthsConverter(periodMonths)]}`;
22885
+ return `per ${unitName && !priceListHasFlatFeeCharges ? `${unitName.toLowerCase()} / ` : ''}${showPriceAsMonthly ? 'month' : common.PERIOD_LABELS[periodMonthsConverter(periodMonths)]}`;
22886
22886
  }
22887
22887
 
22888
22888
  var localizedFormat$2 = {exports: {}};
@@ -23013,10 +23013,20 @@ const getFirstTierPrice = (charge, currencyId) => {
23013
23013
  var _a, _b, _c;
23014
23014
  const price = (_b = (_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.price;
23015
23015
  if (!price)
23016
- return '';
23016
+ return 'DNE';
23017
23017
  return formatCurrency(price, currencyId, (_c = charge.priceDecimals) !== null && _c !== void 0 ? _c : 0);
23018
23018
  };
23019
23019
 
23020
+ const getChargeBasePrice = (charge, currencyId) => {
23021
+ var _a, _b;
23022
+ if (((_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a.length) && charge.priceListChargeTiers.length > 0) {
23023
+ return getFirstTierPrice(charge, currencyId);
23024
+ }
23025
+ else {
23026
+ return formatCurrency(charge.basePrice, currencyId, (_b = charge.priceDecimals) !== null && _b !== void 0 ? _b : 0);
23027
+ }
23028
+ };
23029
+
23020
23030
  const PricingTooltip_PriceListChargeFragment = t(`
23021
23031
  fragment PricingTooltip_PriceListChargeFragment on PriceListCharge {
23022
23032
  priceListChargeTiers {
@@ -23028,6 +23038,7 @@ const PricingTooltip_PriceListChargeFragment = t(`
23028
23038
  unitName
23029
23039
  }
23030
23040
  priceDecimals
23041
+ basePrice
23031
23042
  name
23032
23043
  ...ChargePriceTiers_PriceListChargeFragment
23033
23044
  }
@@ -23041,7 +23052,7 @@ const PricingTooltip = ({ className, priceListCharges: maskedPriceListCharges, c
23041
23052
  if (hasPriceTiers) {
23042
23053
  return jsxRuntime.jsx(ChargePriceTiers, { charge: charge, currencyId: currencyId }, index);
23043
23054
  }
23044
- return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsxRuntime.jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxRuntime.jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getFirstTierPrice(charge, currencyId), ' ', priceDescriptionString({
23055
+ return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsxRuntime.jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxRuntime.jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getChargeBasePrice(charge, currencyId), ' ', priceDescriptionString({
23045
23056
  unitName: (_b = (_a = charge.feature) === null || _a === void 0 ? void 0 : _a.unitName) !== null && _b !== void 0 ? _b : undefined,
23046
23057
  showPriceAsMonthly: priceList === null || priceList === void 0 ? void 0 : priceList.showPriceAsMonthly,
23047
23058
  periodMonths: priceList === null || priceList === void 0 ? void 0 : priceList.periodMonths,
@@ -10,6 +10,7 @@ export declare const PricingTooltip_PriceListChargeFragment: import("gql.tada").
10
10
  unitName: string | null;
11
11
  } | null;
12
12
  priceDecimals: number | null;
13
+ basePrice: number;
13
14
  name: string;
14
15
  [$tada.fragmentRefs]: {
15
16
  ChargePriceTiers_PriceListChargeFragment: "PriceListCharge";
@@ -0,0 +1,8 @@
1
+ export declare const getChargeBasePrice: (charge: {
2
+ priceListChargeTiers: {
3
+ starts: number | null;
4
+ price: number | null;
5
+ }[] | null;
6
+ priceDecimals: number | null;
7
+ basePrice: number;
8
+ }, currencyId: string) => string | number;
package/dist/esm/index.js CHANGED
@@ -50,7 +50,7 @@ var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-altern
50
50
  styleInject(css_248z);
51
51
 
52
52
  // This will be replaced at build time by rollup-plugin-replace
53
- const PACKAGE_VERSION = '1.6.0-beta.12';
53
+ const PACKAGE_VERSION = '1.6.0-beta.13';
54
54
  const createRequestHeaders = (token) => {
55
55
  const headers = createClientDevHeaders({ token });
56
56
  // Add the components version header
@@ -22880,7 +22880,7 @@ function doesPriceListHaveFlatFeeCharges(priceList) {
22880
22880
  }
22881
22881
 
22882
22882
  function priceDescriptionString({ unitName, showPriceAsMonthly, periodMonths, priceListHasFlatFeeCharges, }) {
22883
- return `Per ${unitName && !priceListHasFlatFeeCharges ? `${unitName.toLowerCase()} / ` : ''}${showPriceAsMonthly ? 'month' : PERIOD_LABELS[periodMonthsConverter(periodMonths)]}`;
22883
+ return `per ${unitName && !priceListHasFlatFeeCharges ? `${unitName.toLowerCase()} / ` : ''}${showPriceAsMonthly ? 'month' : PERIOD_LABELS[periodMonthsConverter(periodMonths)]}`;
22884
22884
  }
22885
22885
 
22886
22886
  var localizedFormat$2 = {exports: {}};
@@ -23011,10 +23011,20 @@ const getFirstTierPrice = (charge, currencyId) => {
23011
23011
  var _a, _b, _c;
23012
23012
  const price = (_b = (_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.price;
23013
23013
  if (!price)
23014
- return '';
23014
+ return 'DNE';
23015
23015
  return formatCurrency(price, currencyId, (_c = charge.priceDecimals) !== null && _c !== void 0 ? _c : 0);
23016
23016
  };
23017
23017
 
23018
+ const getChargeBasePrice = (charge, currencyId) => {
23019
+ var _a, _b;
23020
+ if (((_a = charge.priceListChargeTiers) === null || _a === void 0 ? void 0 : _a.length) && charge.priceListChargeTiers.length > 0) {
23021
+ return getFirstTierPrice(charge, currencyId);
23022
+ }
23023
+ else {
23024
+ return formatCurrency(charge.basePrice, currencyId, (_b = charge.priceDecimals) !== null && _b !== void 0 ? _b : 0);
23025
+ }
23026
+ };
23027
+
23018
23028
  const PricingTooltip_PriceListChargeFragment = t(`
23019
23029
  fragment PricingTooltip_PriceListChargeFragment on PriceListCharge {
23020
23030
  priceListChargeTiers {
@@ -23026,6 +23036,7 @@ const PricingTooltip_PriceListChargeFragment = t(`
23026
23036
  unitName
23027
23037
  }
23028
23038
  priceDecimals
23039
+ basePrice
23029
23040
  name
23030
23041
  ...ChargePriceTiers_PriceListChargeFragment
23031
23042
  }
@@ -23039,7 +23050,7 @@ const PricingTooltip = ({ className, priceListCharges: maskedPriceListCharges, c
23039
23050
  if (hasPriceTiers) {
23040
23051
  return jsx(ChargePriceTiers, { charge: charge, currencyId: currencyId }, index);
23041
23052
  }
23042
- return (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getFirstTierPrice(charge, currencyId), ' ', priceDescriptionString({
23053
+ return (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-1", children: [jsx("div", { className: "bunny-text-white bunny-font-bold", children: charge.name }), jsxs("div", { className: "bunny-text-gray-400 bunny-text-xs/3", children: [getChargeBasePrice(charge, currencyId), ' ', priceDescriptionString({
23043
23054
  unitName: (_b = (_a = charge.feature) === null || _a === void 0 ? void 0 : _a.unitName) !== null && _b !== void 0 ? _b : undefined,
23044
23055
  showPriceAsMonthly: priceList === null || priceList === void 0 ? void 0 : priceList.showPriceAsMonthly,
23045
23056
  periodMonths: priceList === null || priceList === void 0 ? void 0 : priceList.periodMonths,
@@ -10,6 +10,7 @@ export declare const PricingTooltip_PriceListChargeFragment: import("gql.tada").
10
10
  unitName: string | null;
11
11
  } | null;
12
12
  priceDecimals: number | null;
13
+ basePrice: number;
13
14
  name: string;
14
15
  [$tada.fragmentRefs]: {
15
16
  ChargePriceTiers_PriceListChargeFragment: "PriceListCharge";
@@ -0,0 +1,8 @@
1
+ export declare const getChargeBasePrice: (charge: {
2
+ priceListChargeTiers: {
3
+ starts: number | null;
4
+ price: number | null;
5
+ }[] | null;
6
+ priceDecimals: number | null;
7
+ basePrice: number;
8
+ }, currencyId: string) => string | number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.6.0-beta.13",
3
+ "version": "1.6.0-beta.14",
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",