@bunnyapp/components 1.2.0 → 1.3.0-beta.10

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
@@ -154,9 +154,9 @@ var BrandContext = react.createContext({
154
154
  });
155
155
 
156
156
  // This will be replaced at build time by rollup-plugin-replace
157
- var PACKAGE_VERSION = '1.2.0-beta.2';
157
+ var PACKAGE_VERSION = '1.3.0-beta.9';
158
158
  var createRequestHeaders = function (token) {
159
- var headers = common.createClientDevHeaders(token);
159
+ var headers = common.createClientDevHeaders({ token: token });
160
160
  // Add the components version header
161
161
  headers[common.X_BUNNY_COMPONENTS_VERSION_HEADER_NAME] = PACKAGE_VERSION;
162
162
  return headers;
@@ -309,7 +309,7 @@ var useAjax = function (onError) {
309
309
  case 0: return [4 /*yield*/, fetch(url, {
310
310
  method: method,
311
311
  body: bodyData,
312
- headers: common.createClientDevHeaders(token),
312
+ headers: common.createClientDevHeaders({ token: token }),
313
313
  })];
314
314
  case 1:
315
315
  response = _a.sent();
@@ -476,7 +476,7 @@ var fetchPDF = function (apiHost, documentUuid, documentType, token) { return __
476
476
  throw new Error('Invoice ID is required to fetch PDF');
477
477
  }
478
478
  return [4 /*yield*/, fetch("".concat(apiHost, "/api/legacy_documents/").concat(documentUuid, "?type=").concat(documentType), {
479
- headers: common.createClientDevHeaders(token),
479
+ headers: common.createClientDevHeaders({ token: token }),
480
480
  })];
481
481
  case 1:
482
482
  response = _a.sent();
@@ -19755,7 +19755,7 @@ var getTransactions = function (filter, apiHost, token) { return __awaiter(void
19755
19755
  switch (_b.label) {
19756
19756
  case 0: return [4 /*yield*/, fetch(apiHost + '/graphql', {
19757
19757
  method: 'POST',
19758
- headers: common.createClientDevHeaders(token),
19758
+ headers: common.createClientDevHeaders({ token: token }),
19759
19759
  body: JSON.stringify({
19760
19760
  query: transactionMutation(filter),
19761
19761
  }),
@@ -20472,6 +20472,7 @@ var useCurrentUserData = function (token) {
20472
20472
  var currentUserData = reactQuery.useQuery({
20473
20473
  queryKey: common.QueryKeyFactory.default.currentUserKey(token),
20474
20474
  queryFn: function () { return getCurrentUserData({ token: token, apiHost: apiHost }); },
20475
+ enabled: Boolean(token),
20475
20476
  }).data;
20476
20477
  return currentUserData || {};
20477
20478
  };
@@ -20484,7 +20485,8 @@ var BunnyFooterIcon = function (_a) {
20484
20485
  var Text$g = antd.Typography.Text;
20485
20486
  var Footer = function (_a) {
20486
20487
  var className = _a.className;
20487
- var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20488
+ var token = useToken();
20489
+ var _b = useCurrentUserData(token), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20488
20490
  var isMobile = common.useIsMobile();
20489
20491
  return (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2' : '', " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3" }, { children: [termsUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsxRuntime.jsx(BunnyMarketingLink, {})] })));
20490
20492
  };
@@ -22385,7 +22387,7 @@ var PriceListGridDesktop = function (_a) {
22385
22387
  var doesPrevPriceListExist = displayPriceLists[index - 1];
22386
22388
  if (!priceList)
22387
22389
  return jsxRuntime.jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index);
22388
- return (jsxRuntime.jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
22390
+ return (jsxRuntime.jsx(PriceListCard, { isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
22389
22391
  }), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsxRuntime.jsx(EverythingPlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(PlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct }), hasFeatureAddons && (jsxRuntime.jsx(PlanFeatureAddons, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay }))] }))] }))] })));
22390
22392
  };
22391
22393
 
@@ -5,6 +5,8 @@ export declare const filterUniqueFeatures: ({ availablePriceLists, }: {
5
5
  plan: {
6
6
  planFeatures: PlanFeature[] | undefined;
7
7
  addon?: boolean | undefined;
8
+ compatiblePlans?: import("@bunnyapp/common").Plan[] | undefined;
9
+ addonPlans?: import("@bunnyapp/common").Plan[] | undefined;
8
10
  availableFrom?: string | undefined;
9
11
  availableTo?: string | undefined;
10
12
  basePrice?: number | undefined;
@@ -58,6 +60,7 @@ export declare const filterUniqueFeatures: ({ availablePriceLists, }: {
58
60
  trialExpirationAction?: ("CANCEL" | "ACTIVATE") | undefined;
59
61
  trialLengthDays?: number | undefined;
60
62
  updatedAt: string;
63
+ addonPlans?: import("@bunnyapp/common").Plan[] | undefined;
61
64
  }[];
62
65
  declare const EverythingPlanFeatures: ({ displayPriceLists, selectedProduct, plansToDisplay, }: {
63
66
  displayPriceLists: PriceList[];
@@ -1,5 +1,5 @@
1
1
  import { currentUser as CurrentUser } from '@bunnyapp/common';
2
- declare const useCurrentUserData: (token?: string) => {
2
+ declare const useCurrentUserData: (token: string | undefined) => {
3
3
  authObjectName: any;
4
4
  account: any;
5
5
  companyName: any;
package/dist/esm/index.js CHANGED
@@ -143,9 +143,9 @@ var BrandContext = createContext({
143
143
  });
144
144
 
145
145
  // This will be replaced at build time by rollup-plugin-replace
146
- var PACKAGE_VERSION = '1.2.0-beta.2';
146
+ var PACKAGE_VERSION = '1.3.0-beta.9';
147
147
  var createRequestHeaders = function (token) {
148
- var headers = createClientDevHeaders(token);
148
+ var headers = createClientDevHeaders({ token: token });
149
149
  // Add the components version header
150
150
  headers[X_BUNNY_COMPONENTS_VERSION_HEADER_NAME] = PACKAGE_VERSION;
151
151
  return headers;
@@ -298,7 +298,7 @@ var useAjax = function (onError) {
298
298
  case 0: return [4 /*yield*/, fetch(url, {
299
299
  method: method,
300
300
  body: bodyData,
301
- headers: createClientDevHeaders(token),
301
+ headers: createClientDevHeaders({ token: token }),
302
302
  })];
303
303
  case 1:
304
304
  response = _a.sent();
@@ -465,7 +465,7 @@ var fetchPDF = function (apiHost, documentUuid, documentType, token) { return __
465
465
  throw new Error('Invoice ID is required to fetch PDF');
466
466
  }
467
467
  return [4 /*yield*/, fetch("".concat(apiHost, "/api/legacy_documents/").concat(documentUuid, "?type=").concat(documentType), {
468
- headers: createClientDevHeaders(token),
468
+ headers: createClientDevHeaders({ token: token }),
469
469
  })];
470
470
  case 1:
471
471
  response = _a.sent();
@@ -19744,7 +19744,7 @@ var getTransactions = function (filter, apiHost, token) { return __awaiter(void
19744
19744
  switch (_b.label) {
19745
19745
  case 0: return [4 /*yield*/, fetch(apiHost + '/graphql', {
19746
19746
  method: 'POST',
19747
- headers: createClientDevHeaders(token),
19747
+ headers: createClientDevHeaders({ token: token }),
19748
19748
  body: JSON.stringify({
19749
19749
  query: transactionMutation(filter),
19750
19750
  }),
@@ -20461,6 +20461,7 @@ var useCurrentUserData = function (token) {
20461
20461
  var currentUserData = useQuery({
20462
20462
  queryKey: QueryKeyFactory.default.currentUserKey(token),
20463
20463
  queryFn: function () { return getCurrentUserData({ token: token, apiHost: apiHost }); },
20464
+ enabled: Boolean(token),
20464
20465
  }).data;
20465
20466
  return currentUserData || {};
20466
20467
  };
@@ -20473,7 +20474,8 @@ var BunnyFooterIcon = function (_a) {
20473
20474
  var Text$g = Typography.Text;
20474
20475
  var Footer = function (_a) {
20475
20476
  var className = _a.className;
20476
- var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20477
+ var token = useToken();
20478
+ var _b = useCurrentUserData(token), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20477
20479
  var isMobile = useIsMobile();
20478
20480
  return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2' : '', " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3" }, { children: [termsUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsx(BunnyMarketingLink, {})] })));
20479
20481
  };
@@ -22374,7 +22376,7 @@ var PriceListGridDesktop = function (_a) {
22374
22376
  var doesPrevPriceListExist = displayPriceLists[index - 1];
22375
22377
  if (!priceList)
22376
22378
  return jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index);
22377
- return (jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
22379
+ return (jsx(PriceListCard, { isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), onClick: onChangePriceList, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
22378
22380
  }), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct })) : (jsxs(Fragment, { children: [jsx(PlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct }), hasFeatureAddons && (jsx(PlanFeatureAddons, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay }))] }))] }))] })));
22379
22381
  };
22380
22382
 
@@ -5,6 +5,8 @@ export declare const filterUniqueFeatures: ({ availablePriceLists, }: {
5
5
  plan: {
6
6
  planFeatures: PlanFeature[] | undefined;
7
7
  addon?: boolean | undefined;
8
+ compatiblePlans?: import("@bunnyapp/common").Plan[] | undefined;
9
+ addonPlans?: import("@bunnyapp/common").Plan[] | undefined;
8
10
  availableFrom?: string | undefined;
9
11
  availableTo?: string | undefined;
10
12
  basePrice?: number | undefined;
@@ -58,6 +60,7 @@ export declare const filterUniqueFeatures: ({ availablePriceLists, }: {
58
60
  trialExpirationAction?: ("CANCEL" | "ACTIVATE") | undefined;
59
61
  trialLengthDays?: number | undefined;
60
62
  updatedAt: string;
63
+ addonPlans?: import("@bunnyapp/common").Plan[] | undefined;
61
64
  }[];
62
65
  declare const EverythingPlanFeatures: ({ displayPriceLists, selectedProduct, plansToDisplay, }: {
63
66
  displayPriceLists: PriceList[];
@@ -1,5 +1,5 @@
1
1
  import { currentUser as CurrentUser } from '@bunnyapp/common';
2
- declare const useCurrentUserData: (token?: string) => {
2
+ declare const useCurrentUserData: (token: string | undefined) => {
3
3
  authObjectName: any;
4
4
  account: any;
5
5
  companyName: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-beta.10",
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.1.0-beta.4",
67
+ "@bunnyapp/common": "1.3.0-beta.10",
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",