@bunnyapp/components 1.3.0-beta.9 → 1.4.0-beta.1

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.3.0-beta.8';
157
+ var PACKAGE_VERSION = '1.3.0';
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
  }),
@@ -21758,7 +21758,7 @@ var PlanPickerCheckoutBar = function (_a) {
21758
21758
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21759
21759
  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 featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21760
21760
  var getPriceListChangeOptions = function (_a) {
21761
- var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription, accountCurrencyId = _a.accountCurrencyId;
21761
+ var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21762
21762
  return __awaiter(void 0, void 0, void 0, function () {
21763
21763
  var response, priceListChangeOptions;
21764
21764
  return __generator(this, function (_b) {
@@ -21779,8 +21779,6 @@ var getPriceListChangeOptions = function (_a) {
21779
21779
  if (priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) {
21780
21780
  priceListChangeOptions.priceLists.sort(function (a, b) { return a.plan.position - b.plan.position; });
21781
21781
  }
21782
- // Filter out price lists that don't have the same currency as the account
21783
- priceListChangeOptions.priceLists = priceListChangeOptions.priceLists.filter(function (priceList) { return priceList.currencyId === accountCurrencyId; });
21784
21782
  return [2 /*return*/, priceListChangeOptions];
21785
21783
  }
21786
21784
  });
@@ -22552,7 +22550,6 @@ var PlanPicker = function () {
22552
22550
  var apiHost = react.useContext(BunnyContext).apiHost;
22553
22551
  var _b = react.useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, productId = _b.productId, upgradingSubscription = _b.upgradingSubscription;
22554
22552
  var _c = react.useContext(QuotePreviewContext), quotePreviewData = _c.quotePreviewData, setQuotePreviewData = _c.setQuotePreviewData;
22555
- var account = useCurrentUserData(token).account;
22556
22553
  // Hooks
22557
22554
  var showInfoNotification = common.useInfoNotification();
22558
22555
  // Queries
@@ -22575,7 +22572,6 @@ var PlanPicker = function () {
22575
22572
  productId: productId,
22576
22573
  token: token,
22577
22574
  upgradingSubscription: upgradingSubscription,
22578
- accountCurrencyId: account === null || account === void 0 ? void 0 : account.currencyId,
22579
22575
  });
22580
22576
  },
22581
22577
  enabled: !areSubscriptionsLoading,
@@ -23159,13 +23155,10 @@ var SubscriptionsListContainer = function (_a) {
23159
23155
  var apiHost = react.useContext(BunnyContext).apiHost;
23160
23156
  var gap = react.useContext(SubscriptionsContext).gap;
23161
23157
  var token = useToken();
23162
- var account = useCurrentUserData(token).account;
23163
23158
  // Queries
23164
23159
  var _c = reactQuery.useQuery({
23165
23160
  queryKey: common.QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
23166
- queryFn: function () {
23167
- return getPriceListChangeOptions({ apiHost: apiHost, token: token, accountCurrencyId: account === null || account === void 0 ? void 0 : account.currencyId });
23168
- },
23161
+ queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
23169
23162
  enabled: Boolean(onChangePlanClick),
23170
23163
  }), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
23171
23164
  if (subscriptionsAreLoading ||
@@ -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,10 +1,9 @@
1
1
  import { Subscription } from '@bunnyapp/common';
2
- declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId, token, upgradingSubscription, accountCurrencyId, }: {
2
+ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId, token, upgradingSubscription, }: {
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean | undefined;
5
5
  productId?: string | undefined;
6
6
  token?: string | undefined;
7
7
  upgradingSubscription?: Subscription | undefined;
8
- accountCurrencyId: string;
9
8
  }) => Promise<any>;
10
9
  export default getPriceListChangeOptions;
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.3.0-beta.8';
146
+ var PACKAGE_VERSION = '1.3.0';
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
  }),
@@ -21747,7 +21747,7 @@ var PlanPickerCheckoutBar = function (_a) {
21747
21747
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21748
21748
  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 featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21749
21749
  var getPriceListChangeOptions = function (_a) {
21750
- var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription, accountCurrencyId = _a.accountCurrencyId;
21750
+ var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21751
21751
  return __awaiter(void 0, void 0, void 0, function () {
21752
21752
  var response, priceListChangeOptions;
21753
21753
  return __generator(this, function (_b) {
@@ -21768,8 +21768,6 @@ var getPriceListChangeOptions = function (_a) {
21768
21768
  if (priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) {
21769
21769
  priceListChangeOptions.priceLists.sort(function (a, b) { return a.plan.position - b.plan.position; });
21770
21770
  }
21771
- // Filter out price lists that don't have the same currency as the account
21772
- priceListChangeOptions.priceLists = priceListChangeOptions.priceLists.filter(function (priceList) { return priceList.currencyId === accountCurrencyId; });
21773
21771
  return [2 /*return*/, priceListChangeOptions];
21774
21772
  }
21775
21773
  });
@@ -22541,7 +22539,6 @@ var PlanPicker = function () {
22541
22539
  var apiHost = useContext(BunnyContext).apiHost;
22542
22540
  var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, productId = _b.productId, upgradingSubscription = _b.upgradingSubscription;
22543
22541
  var _c = useContext(QuotePreviewContext), quotePreviewData = _c.quotePreviewData, setQuotePreviewData = _c.setQuotePreviewData;
22544
- var account = useCurrentUserData(token).account;
22545
22542
  // Hooks
22546
22543
  var showInfoNotification = useInfoNotification();
22547
22544
  // Queries
@@ -22564,7 +22561,6 @@ var PlanPicker = function () {
22564
22561
  productId: productId,
22565
22562
  token: token,
22566
22563
  upgradingSubscription: upgradingSubscription,
22567
- accountCurrencyId: account === null || account === void 0 ? void 0 : account.currencyId,
22568
22564
  });
22569
22565
  },
22570
22566
  enabled: !areSubscriptionsLoading,
@@ -23148,13 +23144,10 @@ var SubscriptionsListContainer = function (_a) {
23148
23144
  var apiHost = useContext(BunnyContext).apiHost;
23149
23145
  var gap = useContext(SubscriptionsContext).gap;
23150
23146
  var token = useToken();
23151
- var account = useCurrentUserData(token).account;
23152
23147
  // Queries
23153
23148
  var _c = useQuery({
23154
23149
  queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
23155
- queryFn: function () {
23156
- return getPriceListChangeOptions({ apiHost: apiHost, token: token, accountCurrencyId: account === null || account === void 0 ? void 0 : account.currencyId });
23157
- },
23150
+ queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
23158
23151
  enabled: Boolean(onChangePlanClick),
23159
23152
  }), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
23160
23153
  if (subscriptionsAreLoading ||
@@ -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,10 +1,9 @@
1
1
  import { Subscription } from '@bunnyapp/common';
2
- declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId, token, upgradingSubscription, accountCurrencyId, }: {
2
+ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId, token, upgradingSubscription, }: {
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean | undefined;
5
5
  productId?: string | undefined;
6
6
  token?: string | undefined;
7
7
  upgradingSubscription?: Subscription | undefined;
8
- accountCurrencyId: string;
9
8
  }) => Promise<any>;
10
9
  export default getPriceListChangeOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.3.0-beta.9",
3
+ "version": "1.4.0-beta.1",
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.5",
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",