@chlp-tech/rpa-ui 0.0.14 → 0.0.15

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.
@@ -27,6 +27,7 @@ interface AccountBlockProps {
27
27
  interface PublishAccountProps {
28
28
  accounts: SocialMediaAccounts;
29
29
  boxWidth?: number | string;
30
+ defaultSelectAccount?: Account;
30
31
  onAccountSelect: (account: Account) => void;
31
32
  onErrorClose?: (account: Account) => void;
32
33
  }
@@ -76,8 +76,9 @@ var PublishAccount = function PublishAccount(_ref2) {
76
76
  var accounts = _ref2.accounts,
77
77
  onAccountSelect = _ref2.onAccountSelect,
78
78
  onErrorClose = _ref2.onErrorClose,
79
- boxWidth = _ref2.boxWidth;
80
- var _useState = useState(null),
79
+ boxWidth = _ref2.boxWidth,
80
+ defaultSelectAccount = _ref2.defaultSelectAccount;
81
+ var _useState = useState(defaultSelectAccount),
81
82
  _useState2 = _slicedToArray(_useState, 2),
82
83
  selectedAccount = _useState2[0],
83
84
  setSelectedAccount = _useState2[1];
@@ -91,12 +92,16 @@ var PublishAccount = function PublishAccount(_ref2) {
91
92
  return null;
92
93
  };
93
94
  useEffect(function () {
94
- var firstAccount = getFirstAvailableAccount();
95
- if (firstAccount) {
96
- setSelectedAccount(firstAccount);
97
- onAccountSelect(firstAccount);
95
+ if (defaultSelectAccount) {
96
+ setSelectedAccount(defaultSelectAccount);
97
+ } else {
98
+ var firstAccount = getFirstAvailableAccount();
99
+ if (firstAccount) {
100
+ setSelectedAccount(firstAccount);
101
+ onAccountSelect(firstAccount);
102
+ }
98
103
  }
99
- }, [accounts]);
104
+ }, [accounts, defaultSelectAccount]);
100
105
  var renderAccounts = function renderAccounts(platform, icon) {
101
106
  var _accounts$platform;
102
107
  if (!accounts[platform] || accounts[platform].length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chlp-tech/rpa-ui",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "rpa-ui",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",