@bunnyapp/components 1.0.68-beta.6 → 1.0.68-beta.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.
package/dist/cjs/index.js CHANGED
@@ -156,7 +156,7 @@ var BrandContext = react.createContext({
156
156
  });
157
157
 
158
158
  // This will be replaced at build time by rollup-plugin-replace
159
- var PACKAGE_VERSION = '1.0.68-beta.6';
159
+ var PACKAGE_VERSION = '1.0.68-beta.7';
160
160
  var createRequestHeaders = function (token) {
161
161
  var headers = common.createClientDevHeaders(token);
162
162
  // Add the components version header
@@ -21263,7 +21263,7 @@ var PlanPickerCheckoutBar = function (_a) {
21263
21263
  };
21264
21264
 
21265
21265
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21266
- var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21266
+ var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21267
21267
  var getPriceListChangeOptions = function (_a) {
21268
21268
  var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21269
21269
  return __awaiter(void 0, void 0, void 0, function () {
@@ -21367,10 +21367,30 @@ var PriceListCardTitle = function (_a) {
21367
21367
  : " " }))), jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center ".concat(isMobile ? "bunny-text-slate-500" : "bunny-text-orange-600"), style: { fontSize: "20px" } }, { children: priceList.plan.name }))] })));
21368
21368
  };
21369
21369
 
21370
+ var getPrice = function (priceList) {
21371
+ if (priceList.showPriceAsMonthly) {
21372
+ return priceList.monthlyBasePrice;
21373
+ }
21374
+ return priceList.basePrice;
21375
+ };
21376
+ var calculatePriceDecimals = function (priceList) {
21377
+ if (priceList.plan.pricingStyle === common.PricingStyle.PRICED) {
21378
+ var decimalPart = getPrice(priceList).toString().split('.')[1];
21379
+ if (!decimalPart)
21380
+ return 0;
21381
+ // If decimal part consists only of zeros, return 0
21382
+ if (parseInt(decimalPart) === 0) {
21383
+ return 0;
21384
+ }
21385
+ return undefined;
21386
+ }
21387
+ return 0;
21388
+ };
21370
21389
  var PriceListCardPrice = function (_a) {
21371
21390
  var priceList = _a.priceList;
21391
+ var priceDecimals = calculatePriceDecimals(priceList);
21372
21392
  return (jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === common.PricingStyle.PRICED
21373
- ? common.formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
21393
+ ? common.formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
21374
21394
  : priceList.plan.pricingStyle === common.PricingStyle.CONTACT_US
21375
21395
  ? ''
21376
21396
  : 'Free' })));
@@ -21409,7 +21429,9 @@ var PriceListCardPriceDescription = function (_a) {
21409
21429
  fontSize: isMobile ? '13px' : '12px',
21410
21430
  } }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsxRuntime.jsx(interweave.Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
21411
21431
  ? "".concat(feature.unitName.toLowerCase(), " / ")
21412
- : '', "month")) })), priceList.periodMonths > 1 && (jsxRuntime.jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21432
+ : '').concat(priceList.showPriceAsMonthly
21433
+ ? 'month'
21434
+ : common.PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)])) })), priceList.periodMonths > 1 && (jsxRuntime.jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21413
21435
  };
21414
21436
 
21415
21437
  var CheckIcon = function (_a) {
@@ -21447,11 +21469,11 @@ var PriceListCardMobile = function (_a) {
21447
21469
  if (!disableOnClick)
21448
21470
  onClick(priceList);
21449
21471
  }, style: {
21450
- minWidth: "220px",
21472
+ minWidth: '220px',
21451
21473
  borderColor: isSelected ? brandColor : common.SLATE_200,
21452
21474
  } }, { children: [isSelected && (jsxRuntime.jsx("div", __assign({ className: "bunny-absolute", style: {
21453
- top: "10px",
21454
- right: "10px",
21475
+ top: '10px',
21476
+ right: '10px',
21455
21477
  } }, { children: jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsxRuntime.jsx(PriceListCardDescription, { description: description })] })), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsxRuntime.jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
21456
21478
  };
21457
21479
 
@@ -1,4 +1,4 @@
1
- import { Feature, PriceList, Subscription } from "@bunnyapp/common";
1
+ import { Feature, PriceList, Subscription } from '@bunnyapp/common';
2
2
  declare const PriceListCardMobile: ({ description, disableOnClick, feature, isPriceListCurrentSubscription, isSelected, onClick, priceList, subscriptionPlan, trialRemainingDays, }: {
3
3
  description: string;
4
4
  disableOnClick: boolean;
package/dist/esm/index.js CHANGED
@@ -144,7 +144,7 @@ var BrandContext = createContext({
144
144
  });
145
145
 
146
146
  // This will be replaced at build time by rollup-plugin-replace
147
- var PACKAGE_VERSION = '1.0.68-beta.6';
147
+ var PACKAGE_VERSION = '1.0.68-beta.7';
148
148
  var createRequestHeaders = function (token) {
149
149
  var headers = createClientDevHeaders(token);
150
150
  // Add the components version header
@@ -21251,7 +21251,7 @@ var PlanPickerCheckoutBar = function (_a) {
21251
21251
  };
21252
21252
 
21253
21253
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21254
- var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21254
+ var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21255
21255
  var getPriceListChangeOptions = function (_a) {
21256
21256
  var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21257
21257
  return __awaiter(void 0, void 0, void 0, function () {
@@ -21355,10 +21355,30 @@ var PriceListCardTitle = function (_a) {
21355
21355
  : " " }))), jsx("div", __assign({ className: "bunny-font-medium bunny-text-center ".concat(isMobile ? "bunny-text-slate-500" : "bunny-text-orange-600"), style: { fontSize: "20px" } }, { children: priceList.plan.name }))] })));
21356
21356
  };
21357
21357
 
21358
+ var getPrice = function (priceList) {
21359
+ if (priceList.showPriceAsMonthly) {
21360
+ return priceList.monthlyBasePrice;
21361
+ }
21362
+ return priceList.basePrice;
21363
+ };
21364
+ var calculatePriceDecimals = function (priceList) {
21365
+ if (priceList.plan.pricingStyle === PricingStyle.PRICED) {
21366
+ var decimalPart = getPrice(priceList).toString().split('.')[1];
21367
+ if (!decimalPart)
21368
+ return 0;
21369
+ // If decimal part consists only of zeros, return 0
21370
+ if (parseInt(decimalPart) === 0) {
21371
+ return 0;
21372
+ }
21373
+ return undefined;
21374
+ }
21375
+ return 0;
21376
+ };
21358
21377
  var PriceListCardPrice = function (_a) {
21359
21378
  var priceList = _a.priceList;
21379
+ var priceDecimals = calculatePriceDecimals(priceList);
21360
21380
  return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === PricingStyle.PRICED
21361
- ? formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
21381
+ ? formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
21362
21382
  : priceList.plan.pricingStyle === PricingStyle.CONTACT_US
21363
21383
  ? ''
21364
21384
  : 'Free' })));
@@ -21397,7 +21417,9 @@ var PriceListCardPriceDescription = function (_a) {
21397
21417
  fontSize: isMobile ? '13px' : '12px',
21398
21418
  } }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsx(Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
21399
21419
  ? "".concat(feature.unitName.toLowerCase(), " / ")
21400
- : '', "month")) })), priceList.periodMonths > 1 && (jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21420
+ : '').concat(priceList.showPriceAsMonthly
21421
+ ? 'month'
21422
+ : PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)])) })), priceList.periodMonths > 1 && (jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21401
21423
  };
21402
21424
 
21403
21425
  var CheckIcon = function (_a) {
@@ -21435,11 +21457,11 @@ var PriceListCardMobile = function (_a) {
21435
21457
  if (!disableOnClick)
21436
21458
  onClick(priceList);
21437
21459
  }, style: {
21438
- minWidth: "220px",
21460
+ minWidth: '220px',
21439
21461
  borderColor: isSelected ? brandColor : SLATE_200,
21440
21462
  } }, { children: [isSelected && (jsx("div", __assign({ className: "bunny-absolute", style: {
21441
- top: "10px",
21442
- right: "10px",
21463
+ top: '10px',
21464
+ right: '10px',
21443
21465
  } }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
21444
21466
  };
21445
21467
 
@@ -1,4 +1,4 @@
1
- import { Feature, PriceList, Subscription } from "@bunnyapp/common";
1
+ import { Feature, PriceList, Subscription } from '@bunnyapp/common';
2
2
  declare const PriceListCardMobile: ({ description, disableOnClick, feature, isPriceListCurrentSubscription, isSelected, onClick, priceList, subscriptionPlan, trialRemainingDays, }: {
3
3
  description: string;
4
4
  disableOnClick: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.68-beta.6",
3
+ "version": "1.0.68-beta.7",
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",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@ant-design/icons": "^5.6.1",
67
- "@bunnyapp/common": "^1.0.66-beta.5",
67
+ "@bunnyapp/common": "^1.0.66-beta.6",
68
68
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
69
69
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
70
70
  "@fortawesome/free-regular-svg-icons": "^6.7.2",