@planningcenter/topbar 10.20.5 → 11.0.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/topbar.js +69 -46
- package/dist/topbar.js.map +1 -1
- package/dist/topbar.modern.js +69 -46
- package/dist/topbar.modern.js.map +1 -1
- package/dist/topbar.module.js +69 -46
- package/dist/topbar.module.js.map +1 -1
- package/dist/topbar.umd.js +69 -46
- package/dist/topbar.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -35
- package/package.json +1 -1
package/dist/topbar.module.js
CHANGED
|
@@ -911,6 +911,40 @@ function remove() {
|
|
|
911
911
|
function navigateTo(location) {
|
|
912
912
|
window.location = location;
|
|
913
913
|
}
|
|
914
|
+
function setConnectedPeopleInStore(connectedPeople) {
|
|
915
|
+
store$1.setState({
|
|
916
|
+
...store$1.getState(),
|
|
917
|
+
connectedPeople
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
function switchConnectedPerson(env, toId, returnPath) {
|
|
921
|
+
apiRequest(railsCsrfFetch, `${pcoUrl(env)("api")}/login/v2/me/switch_connected_person`, {
|
|
922
|
+
data: {
|
|
923
|
+
data: {
|
|
924
|
+
attributes: {
|
|
925
|
+
id: toId,
|
|
926
|
+
return_path: returnPath
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
},
|
|
930
|
+
method: "POST"
|
|
931
|
+
}).then(({
|
|
932
|
+
json
|
|
933
|
+
}) => {
|
|
934
|
+
var _a;
|
|
935
|
+
if ((_a = json === null || json === void 0 ? void 0 : json.meta) === null || _a === void 0 ? void 0 : _a.redirect_to) navigateTo(json.meta.redirect_to);
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
function unlinkConnectedPeople(env) {
|
|
939
|
+
apiRequest(railsCsrfFetch, `${pcoUrl(env)("api")}/login/v2/me/unlink`, {
|
|
940
|
+
method: "POST"
|
|
941
|
+
}).then(({
|
|
942
|
+
json
|
|
943
|
+
}) => {
|
|
944
|
+
var _a;
|
|
945
|
+
if ((_a = json === null || json === void 0 ? void 0 : json.meta) === null || _a === void 0 ? void 0 : _a.redirect_to) navigateTo(json.meta.redirect_to);
|
|
946
|
+
});
|
|
947
|
+
}
|
|
914
948
|
class ConnectedPeopleProvider extends React__default.Component {
|
|
915
949
|
constructor(props) {
|
|
916
950
|
super(props);
|
|
@@ -925,44 +959,26 @@ class ConnectedPeopleProvider extends React__default.Component {
|
|
|
925
959
|
}) => {
|
|
926
960
|
if (!ok || !json) return;
|
|
927
961
|
const connectedPeople = json.data;
|
|
962
|
+
setConnectedPeopleInStore(connectedPeople);
|
|
928
963
|
return this.setState({
|
|
929
964
|
connectedPeople
|
|
930
965
|
}, () => window.localStorage.setItem("Topbar:ConnectedPeople", JSON.stringify(connectedPeople)));
|
|
931
966
|
});
|
|
932
967
|
}
|
|
933
968
|
unlink() {
|
|
934
|
-
|
|
935
|
-
method: "POST"
|
|
936
|
-
}).then(({
|
|
937
|
-
json
|
|
938
|
-
}) => {
|
|
939
|
-
var _a;
|
|
940
|
-
if ((_a = json === null || json === void 0 ? void 0 : json.meta) === null || _a === void 0 ? void 0 : _a.redirect_to) navigateTo(json.meta.redirect_to);
|
|
941
|
-
});
|
|
969
|
+
unlinkConnectedPeople(this.props.env);
|
|
942
970
|
}
|
|
943
971
|
switch(toId, returnPath) {
|
|
944
|
-
|
|
945
|
-
data: {
|
|
946
|
-
data: {
|
|
947
|
-
attributes: {
|
|
948
|
-
id: toId,
|
|
949
|
-
return_path: returnPath
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
},
|
|
953
|
-
method: "POST"
|
|
954
|
-
}).then(({
|
|
955
|
-
json
|
|
956
|
-
}) => {
|
|
957
|
-
var _a;
|
|
958
|
-
if ((_a = json === null || json === void 0 ? void 0 : json.meta) === null || _a === void 0 ? void 0 : _a.redirect_to) navigateTo(json.meta.redirect_to);
|
|
959
|
-
});
|
|
972
|
+
switchConnectedPerson(this.props.env, toId, returnPath);
|
|
960
973
|
}
|
|
961
974
|
componentDidMount() {
|
|
962
975
|
const connectedPeople = JSON.parse(window.localStorage.getItem("Topbar:ConnectedPeople"));
|
|
963
|
-
if (connectedPeople
|
|
964
|
-
connectedPeople
|
|
965
|
-
|
|
976
|
+
if (connectedPeople && connectedPeople.length) {
|
|
977
|
+
setConnectedPeopleInStore(connectedPeople);
|
|
978
|
+
return this.setState({
|
|
979
|
+
connectedPeople
|
|
980
|
+
});
|
|
981
|
+
}
|
|
966
982
|
return this.fetch();
|
|
967
983
|
}
|
|
968
984
|
render() {
|
|
@@ -2546,7 +2562,8 @@ const SmallTopbar = ({
|
|
|
2546
2562
|
className: styles$3["profile-button"],
|
|
2547
2563
|
onClick: () => {
|
|
2548
2564
|
var _a, _b;
|
|
2549
|
-
|
|
2565
|
+
props.requestConnectedPeopleFetch();
|
|
2566
|
+
(_b = (_a = window.topbar) === null || _a === void 0 ? void 0 : _a.openProfile) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2550
2567
|
}
|
|
2551
2568
|
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
2552
2569
|
env: props.env,
|
|
@@ -2973,25 +2990,27 @@ const requestClearConnectedPeopleCache = () => remove();
|
|
|
2973
2990
|
function UserProfile({
|
|
2974
2991
|
appName,
|
|
2975
2992
|
closeDrawer,
|
|
2976
|
-
|
|
2993
|
+
env,
|
|
2977
2994
|
hasConnectedPeople,
|
|
2978
2995
|
linkToProfile,
|
|
2979
2996
|
loginSettingsUrl,
|
|
2980
2997
|
logoutUrl,
|
|
2981
2998
|
profileUrl,
|
|
2982
2999
|
requestClearAppsCache,
|
|
2983
|
-
requestSwitchConnectedPerson,
|
|
2984
|
-
requestUnlinkConnectedPeople,
|
|
2985
3000
|
userAvatarPath
|
|
2986
3001
|
}) {
|
|
3002
|
+
var _a;
|
|
3003
|
+
const storeState = useStore();
|
|
2987
3004
|
const {
|
|
2988
3005
|
mfaConfigured,
|
|
2989
3006
|
name
|
|
2990
|
-
} =
|
|
3007
|
+
} = storeState;
|
|
3008
|
+
const connectedPeople = (_a = storeState.connectedPeople) !== null && _a !== void 0 ? _a : [];
|
|
2991
3009
|
return /*#__PURE__*/React__default.createElement(StackView$2, {
|
|
2992
3010
|
axis: "vertical",
|
|
2993
3011
|
spacing: /*#__PURE__*/React__default.createElement(Divider, null),
|
|
2994
|
-
|
|
3012
|
+
grow: 1,
|
|
3013
|
+
shrink: 1
|
|
2995
3014
|
}, /*#__PURE__*/React__default.createElement(GridView, {
|
|
2996
3015
|
columns: "auto 1fr auto",
|
|
2997
3016
|
alignment: "start",
|
|
@@ -3088,17 +3107,24 @@ function UserProfile({
|
|
|
3088
3107
|
display: "none"
|
|
3089
3108
|
}
|
|
3090
3109
|
},
|
|
3091
|
-
marginTop: "auto"
|
|
3110
|
+
marginTop: "auto",
|
|
3111
|
+
shrink: 1,
|
|
3112
|
+
minHeight: 0,
|
|
3113
|
+
overflow: "auto",
|
|
3114
|
+
position: "relative"
|
|
3092
3115
|
}, /*#__PURE__*/React__default.createElement(StackView$2, {
|
|
3093
3116
|
backgroundColor: "var(--t-fill-color-neutral-060)",
|
|
3094
3117
|
paddingVertical: 1.5,
|
|
3095
3118
|
paddingHorizontal: 2,
|
|
3096
|
-
borderBottom: `1px solid var(--t-border-color
|
|
3119
|
+
borderBottom: `1px solid var(--t-border-color)`,
|
|
3120
|
+
position: "sticky",
|
|
3121
|
+
top: 0,
|
|
3122
|
+
zIndex: 1
|
|
3097
3123
|
}, /*#__PURE__*/React__default.createElement(HeadingUppercase, {
|
|
3098
|
-
color: "var(--t-text-color-
|
|
3124
|
+
color: "var(--t-text-color-secondary)",
|
|
3099
3125
|
fontWeight: 500
|
|
3100
3126
|
}, "Linked Accounts")), /*#__PURE__*/React__default.createElement(List, {
|
|
3101
|
-
dividerColor: "var(--t-border-color
|
|
3127
|
+
dividerColor: "var(--t-border-color)",
|
|
3102
3128
|
width: "100%"
|
|
3103
3129
|
}, connectedPeopleMenuFormatter(connectedPeople).map(({
|
|
3104
3130
|
id,
|
|
@@ -3108,10 +3134,11 @@ function UserProfile({
|
|
|
3108
3134
|
onClick: e => {
|
|
3109
3135
|
requestClearAppsCache();
|
|
3110
3136
|
requestClearConnectedPeopleCache();
|
|
3111
|
-
|
|
3137
|
+
switchConnectedPerson(env, String(id), `${appName}/`);
|
|
3112
3138
|
e.preventDefault();
|
|
3113
3139
|
},
|
|
3114
|
-
color: "var(--t-text-color-
|
|
3140
|
+
color: "var(--t-text-color-secondary)",
|
|
3141
|
+
cursor: "pointer",
|
|
3115
3142
|
padding: 2
|
|
3116
3143
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
3117
3144
|
truncate: true
|
|
@@ -3119,10 +3146,11 @@ function UserProfile({
|
|
|
3119
3146
|
onClick: e => {
|
|
3120
3147
|
requestClearAppsCache();
|
|
3121
3148
|
requestClearConnectedPeopleCache();
|
|
3122
|
-
|
|
3149
|
+
unlinkConnectedPeople(env);
|
|
3123
3150
|
e.preventDefault();
|
|
3124
3151
|
},
|
|
3125
3152
|
color: "var(--t-text-color-status-error)",
|
|
3153
|
+
cursor: "pointer",
|
|
3126
3154
|
padding: 2,
|
|
3127
3155
|
underline: false
|
|
3128
3156
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
@@ -4316,14 +4344,11 @@ function toolIsRoutable(tool) {
|
|
|
4316
4344
|
function Toolbar({
|
|
4317
4345
|
appName,
|
|
4318
4346
|
autoMountTool,
|
|
4319
|
-
connectedPeople,
|
|
4320
4347
|
env,
|
|
4321
4348
|
helpdeskConfig = {},
|
|
4322
4349
|
linkToProfile = true,
|
|
4323
4350
|
onReceiveTasksWorker,
|
|
4324
4351
|
requestClearAppsCache,
|
|
4325
|
-
requestSwitchConnectedPerson,
|
|
4326
|
-
requestUnlinkConnectedPeople,
|
|
4327
4352
|
userAvatarPath,
|
|
4328
4353
|
userName,
|
|
4329
4354
|
_storeDataOverride
|
|
@@ -4477,15 +4502,13 @@ function Toolbar({
|
|
|
4477
4502
|
Profile: {
|
|
4478
4503
|
appName,
|
|
4479
4504
|
closeDrawer,
|
|
4480
|
-
|
|
4505
|
+
env,
|
|
4481
4506
|
hasConnectedPeople: (storeData === null || storeData === void 0 ? void 0 : storeData.hasConnectedPeople) || false,
|
|
4482
4507
|
linkToProfile,
|
|
4483
4508
|
loginSettingsUrl,
|
|
4484
4509
|
logoutUrl,
|
|
4485
4510
|
profileUrl,
|
|
4486
4511
|
requestClearAppsCache: requestClearAppsCache || (() => {}),
|
|
4487
|
-
requestSwitchConnectedPerson: requestSwitchConnectedPerson || (() => {}),
|
|
4488
|
-
requestUnlinkConnectedPeople: requestUnlinkConnectedPeople || (() => {}),
|
|
4489
4512
|
userAvatarPath
|
|
4490
4513
|
},
|
|
4491
4514
|
Tasks: {
|