@bunnyapp/components 1.0.68-beta.2 → 1.0.68-beta.3

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
@@ -174,7 +174,7 @@ var BrandContext = react.createContext({
174
174
  });
175
175
 
176
176
  // This will be replaced at build time by rollup-plugin-replace
177
- var PACKAGE_VERSION = '1.0.68-beta.2';
177
+ var PACKAGE_VERSION = '1.0.68-beta.3';
178
178
  var createRequestHeaders = function (token) {
179
179
  var headers = common.createClientDevHeaders(token);
180
180
  // Add the components version header
@@ -583,19 +583,14 @@ var usePaymentMethod = function (_a) {
583
583
  };
584
584
 
585
585
  var filterPaymentPlugins = function (plugins) {
586
- return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
587
- var _a, _b, _c, _d;
588
- return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'payment' &&
589
- ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'valid' &&
590
- ((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
591
- });
586
+ return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) { var _a, _b; return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'payment' && ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'valid'; });
592
587
  };
593
588
  var filterPaymentPluginsByEntity = function (plugins, selectedEntityId) {
594
589
  return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
595
590
  var _a, _b;
596
591
  return selectedEntityId === undefined ||
597
592
  selectedEntityId === null ||
598
- ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(selectedEntityId))) ||
593
+ ((_a = plugin.entityIds) === null || _a === void 0 ? void 0 : _a.includes(selectedEntityId)) ||
599
594
  ((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0;
600
595
  });
601
596
  };
@@ -632,13 +627,9 @@ var usePaymentPlugins = function (_a) {
632
627
  staleTime: 5 * 60 * 1000, // Consider data fresh for 5 minutes
633
628
  }), paymentPlugins = _b.data, isFetched = _b.isFetched;
634
629
  var filteredPaymentPlugins = filterPaymentPlugins(paymentPlugins);
635
- var paymentMethodAllowedPlugins = filteredPaymentPlugins === null || filteredPaymentPlugins === void 0 ? void 0 : filteredPaymentPlugins.filter(function (plugin) {
636
- var _a, _b;
637
- return (_b = (_a = plugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.some(function (component) { var _a; return (_a = component === null || component === void 0 ? void 0 : component.scenarios) === null || _a === void 0 ? void 0 : _a.includes('admin-payment_method'); });
638
- });
639
630
  var filteredPaymentPluginsByEntity = selectedEntityId
640
- ? filterPaymentPluginsByEntity(paymentMethodAllowedPlugins, selectedEntityId)
641
- : paymentMethodAllowedPlugins;
631
+ ? filterPaymentPluginsByEntity(filteredPaymentPlugins, selectedEntityId)
632
+ : filteredPaymentPlugins;
642
633
  return {
643
634
  paymentPlugins: filteredPaymentPluginsByEntity,
644
635
  isFetched: isFetched,
@@ -1,10 +1,10 @@
1
- import { PluginData } from '@bunnyapp/common';
1
+ import { Plugin } from '@bunnyapp/common';
2
2
  export declare const usePaymentPlugins: ({ apiHost, token, selectedEntityId, }: {
3
3
  apiHost: string;
4
4
  token?: string | undefined;
5
5
  selectedEntityId?: string | null | undefined;
6
6
  }) => {
7
- paymentPlugins: PluginData[];
7
+ paymentPlugins: Plugin[];
8
8
  isFetched: boolean;
9
9
  };
10
10
  export default usePaymentPlugins;
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.2';
147
+ var PACKAGE_VERSION = '1.0.68-beta.3';
148
148
  var createRequestHeaders = function (token) {
149
149
  var headers = createClientDevHeaders(token);
150
150
  // Add the components version header
@@ -553,19 +553,14 @@ var usePaymentMethod = function (_a) {
553
553
  };
554
554
 
555
555
  var filterPaymentPlugins = function (plugins) {
556
- return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
557
- var _a, _b, _c, _d;
558
- return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'payment' &&
559
- ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'valid' &&
560
- ((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
561
- });
556
+ return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) { var _a, _b; return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'payment' && ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'valid'; });
562
557
  };
563
558
  var filterPaymentPluginsByEntity = function (plugins, selectedEntityId) {
564
559
  return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
565
560
  var _a, _b;
566
561
  return selectedEntityId === undefined ||
567
562
  selectedEntityId === null ||
568
- ((_a = plugin.entities) === null || _a === void 0 ? void 0 : _a.includes(Number(selectedEntityId))) ||
563
+ ((_a = plugin.entityIds) === null || _a === void 0 ? void 0 : _a.includes(selectedEntityId)) ||
569
564
  ((_b = plugin.entities) === null || _b === void 0 ? void 0 : _b.length) === 0;
570
565
  });
571
566
  };
@@ -602,13 +597,9 @@ var usePaymentPlugins = function (_a) {
602
597
  staleTime: 5 * 60 * 1000, // Consider data fresh for 5 minutes
603
598
  }), paymentPlugins = _b.data, isFetched = _b.isFetched;
604
599
  var filteredPaymentPlugins = filterPaymentPlugins(paymentPlugins);
605
- var paymentMethodAllowedPlugins = filteredPaymentPlugins === null || filteredPaymentPlugins === void 0 ? void 0 : filteredPaymentPlugins.filter(function (plugin) {
606
- var _a, _b;
607
- return (_b = (_a = plugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.some(function (component) { var _a; return (_a = component === null || component === void 0 ? void 0 : component.scenarios) === null || _a === void 0 ? void 0 : _a.includes('admin-payment_method'); });
608
- });
609
600
  var filteredPaymentPluginsByEntity = selectedEntityId
610
- ? filterPaymentPluginsByEntity(paymentMethodAllowedPlugins, selectedEntityId)
611
- : paymentMethodAllowedPlugins;
601
+ ? filterPaymentPluginsByEntity(filteredPaymentPlugins, selectedEntityId)
602
+ : filteredPaymentPlugins;
612
603
  return {
613
604
  paymentPlugins: filteredPaymentPluginsByEntity,
614
605
  isFetched: isFetched,
@@ -1,10 +1,10 @@
1
- import { PluginData } from '@bunnyapp/common';
1
+ import { Plugin } from '@bunnyapp/common';
2
2
  export declare const usePaymentPlugins: ({ apiHost, token, selectedEntityId, }: {
3
3
  apiHost: string;
4
4
  token?: string | undefined;
5
5
  selectedEntityId?: string | null | undefined;
6
6
  }) => {
7
- paymentPlugins: PluginData[];
7
+ paymentPlugins: Plugin[];
8
8
  isFetched: boolean;
9
9
  };
10
10
  export default usePaymentPlugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.68-beta.2",
3
+ "version": "1.0.68-beta.3",
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",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@ant-design/icons": "^5.6.1",
68
- "@bunnyapp/common": "^1.0.66-beta.3",
68
+ "@bunnyapp/common": "^1.0.66-beta.5",
69
69
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
70
70
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
71
71
  "@fortawesome/free-regular-svg-icons": "^6.7.2",