@planningcenter/topbar 10.20.4-qa-735.1 → 10.20.4-qa-735.2
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 +51 -39
- package/dist/topbar.js.map +1 -1
- package/dist/topbar.modern.js +51 -39
- package/dist/topbar.modern.js.map +1 -1
- package/dist/topbar.module.js +51 -39
- package/dist/topbar.module.js.map +1 -1
- package/dist/topbar.umd.js +51 -39
- package/dist/topbar.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -4
- package/package.json +1 -1
package/dist/topbar.js
CHANGED
|
@@ -935,6 +935,40 @@ function remove() {
|
|
|
935
935
|
function navigateTo(location) {
|
|
936
936
|
window.location = location;
|
|
937
937
|
}
|
|
938
|
+
function setConnectedPeopleInStore(connectedPeople) {
|
|
939
|
+
store$1.setState({
|
|
940
|
+
...store$1.getState(),
|
|
941
|
+
connectedPeople
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
function switchConnectedPerson(env, toId, returnPath) {
|
|
945
|
+
apiRequest(railsCsrfFetch, `${pcoUrl(env)("api")}/login/v2/me/switch_connected_person`, {
|
|
946
|
+
data: {
|
|
947
|
+
data: {
|
|
948
|
+
attributes: {
|
|
949
|
+
id: toId,
|
|
950
|
+
return_path: returnPath
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
method: "POST"
|
|
955
|
+
}).then(({
|
|
956
|
+
json
|
|
957
|
+
}) => {
|
|
958
|
+
var _a;
|
|
959
|
+
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);
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
function unlinkConnectedPeople(env) {
|
|
963
|
+
apiRequest(railsCsrfFetch, `${pcoUrl(env)("api")}/login/v2/me/unlink`, {
|
|
964
|
+
method: "POST"
|
|
965
|
+
}).then(({
|
|
966
|
+
json
|
|
967
|
+
}) => {
|
|
968
|
+
var _a;
|
|
969
|
+
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);
|
|
970
|
+
});
|
|
971
|
+
}
|
|
938
972
|
class ConnectedPeopleProvider extends React.Component {
|
|
939
973
|
constructor(props) {
|
|
940
974
|
super(props);
|
|
@@ -949,44 +983,26 @@ class ConnectedPeopleProvider extends React.Component {
|
|
|
949
983
|
}) => {
|
|
950
984
|
if (!ok || !json) return;
|
|
951
985
|
const connectedPeople = json.data;
|
|
986
|
+
setConnectedPeopleInStore(connectedPeople);
|
|
952
987
|
return this.setState({
|
|
953
988
|
connectedPeople
|
|
954
989
|
}, () => window.localStorage.setItem("Topbar:ConnectedPeople", JSON.stringify(connectedPeople)));
|
|
955
990
|
});
|
|
956
991
|
}
|
|
957
992
|
unlink() {
|
|
958
|
-
|
|
959
|
-
method: "POST"
|
|
960
|
-
}).then(({
|
|
961
|
-
json
|
|
962
|
-
}) => {
|
|
963
|
-
var _a;
|
|
964
|
-
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);
|
|
965
|
-
});
|
|
993
|
+
unlinkConnectedPeople(this.props.env);
|
|
966
994
|
}
|
|
967
995
|
switch(toId, returnPath) {
|
|
968
|
-
|
|
969
|
-
data: {
|
|
970
|
-
data: {
|
|
971
|
-
attributes: {
|
|
972
|
-
id: toId,
|
|
973
|
-
return_path: returnPath
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
},
|
|
977
|
-
method: "POST"
|
|
978
|
-
}).then(({
|
|
979
|
-
json
|
|
980
|
-
}) => {
|
|
981
|
-
var _a;
|
|
982
|
-
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);
|
|
983
|
-
});
|
|
996
|
+
switchConnectedPerson(this.props.env, toId, returnPath);
|
|
984
997
|
}
|
|
985
998
|
componentDidMount() {
|
|
986
999
|
const connectedPeople = JSON.parse(window.localStorage.getItem("Topbar:ConnectedPeople"));
|
|
987
|
-
if (connectedPeople && connectedPeople.length)
|
|
988
|
-
connectedPeople
|
|
989
|
-
|
|
1000
|
+
if (connectedPeople && connectedPeople.length) {
|
|
1001
|
+
setConnectedPeopleInStore(connectedPeople);
|
|
1002
|
+
return this.setState({
|
|
1003
|
+
connectedPeople
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
990
1006
|
return this.fetch();
|
|
991
1007
|
}
|
|
992
1008
|
render() {
|
|
@@ -2998,21 +3014,22 @@ const requestClearConnectedPeopleCache = () => remove();
|
|
|
2998
3014
|
function UserProfile({
|
|
2999
3015
|
appName,
|
|
3000
3016
|
closeDrawer,
|
|
3001
|
-
|
|
3017
|
+
env,
|
|
3002
3018
|
hasConnectedPeople,
|
|
3003
3019
|
linkToProfile,
|
|
3004
3020
|
loginSettingsUrl,
|
|
3005
3021
|
logoutUrl,
|
|
3006
3022
|
profileUrl,
|
|
3007
3023
|
requestClearAppsCache,
|
|
3008
|
-
requestSwitchConnectedPerson,
|
|
3009
|
-
requestUnlinkConnectedPeople,
|
|
3010
3024
|
userAvatarPath
|
|
3011
3025
|
}) {
|
|
3026
|
+
var _a;
|
|
3027
|
+
const storeState = useStore();
|
|
3012
3028
|
const {
|
|
3013
3029
|
mfaConfigured,
|
|
3014
3030
|
name
|
|
3015
|
-
} =
|
|
3031
|
+
} = storeState;
|
|
3032
|
+
const connectedPeople = (_a = storeState.connectedPeople) !== null && _a !== void 0 ? _a : [];
|
|
3016
3033
|
return /*#__PURE__*/React.createElement(tapestryReact.StackView, {
|
|
3017
3034
|
axis: "vertical",
|
|
3018
3035
|
spacing: /*#__PURE__*/React.createElement(tapestryReact.Divider, null),
|
|
@@ -3141,7 +3158,7 @@ function UserProfile({
|
|
|
3141
3158
|
onClick: e => {
|
|
3142
3159
|
requestClearAppsCache();
|
|
3143
3160
|
requestClearConnectedPeopleCache();
|
|
3144
|
-
|
|
3161
|
+
switchConnectedPerson(env, String(id), `${appName}/`);
|
|
3145
3162
|
e.preventDefault();
|
|
3146
3163
|
},
|
|
3147
3164
|
color: "var(--t-text-color-default-secondary)",
|
|
@@ -3152,7 +3169,7 @@ function UserProfile({
|
|
|
3152
3169
|
onClick: e => {
|
|
3153
3170
|
requestClearAppsCache();
|
|
3154
3171
|
requestClearConnectedPeopleCache();
|
|
3155
|
-
|
|
3172
|
+
unlinkConnectedPeople(env);
|
|
3156
3173
|
e.preventDefault();
|
|
3157
3174
|
},
|
|
3158
3175
|
color: "var(--t-text-color-status-error)",
|
|
@@ -4349,14 +4366,11 @@ function toolIsRoutable(tool) {
|
|
|
4349
4366
|
function Toolbar({
|
|
4350
4367
|
appName,
|
|
4351
4368
|
autoMountTool,
|
|
4352
|
-
connectedPeople,
|
|
4353
4369
|
env,
|
|
4354
4370
|
helpdeskConfig = {},
|
|
4355
4371
|
linkToProfile = true,
|
|
4356
4372
|
onReceiveTasksWorker,
|
|
4357
4373
|
requestClearAppsCache,
|
|
4358
|
-
requestSwitchConnectedPerson,
|
|
4359
|
-
requestUnlinkConnectedPeople,
|
|
4360
4374
|
userAvatarPath,
|
|
4361
4375
|
userName,
|
|
4362
4376
|
_storeDataOverride
|
|
@@ -4510,15 +4524,13 @@ function Toolbar({
|
|
|
4510
4524
|
Profile: {
|
|
4511
4525
|
appName,
|
|
4512
4526
|
closeDrawer,
|
|
4513
|
-
|
|
4527
|
+
env,
|
|
4514
4528
|
hasConnectedPeople: (storeData === null || storeData === void 0 ? void 0 : storeData.hasConnectedPeople) || false,
|
|
4515
4529
|
linkToProfile,
|
|
4516
4530
|
loginSettingsUrl,
|
|
4517
4531
|
logoutUrl,
|
|
4518
4532
|
profileUrl,
|
|
4519
4533
|
requestClearAppsCache: requestClearAppsCache || (() => {}),
|
|
4520
|
-
requestSwitchConnectedPerson: requestSwitchConnectedPerson || (() => {}),
|
|
4521
|
-
requestUnlinkConnectedPeople: requestUnlinkConnectedPeople || (() => {}),
|
|
4522
4534
|
userAvatarPath
|
|
4523
4535
|
},
|
|
4524
4536
|
Tasks: {
|