@planningcenter/topbar 10.20.4-qa-735.0 → 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 +62 -42
- package/dist/topbar.js.map +1 -1
- package/dist/topbar.modern.js +62 -42
- package/dist/topbar.modern.js.map +1 -1
- package/dist/topbar.module.js +62 -42
- package/dist/topbar.module.js.map +1 -1
- package/dist/topbar.umd.js +62 -42
- 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,25 +3014,27 @@ 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),
|
|
3019
|
-
|
|
3036
|
+
grow: 1,
|
|
3037
|
+
shrink: 1
|
|
3020
3038
|
}, /*#__PURE__*/React.createElement(tapestryReact.GridView, {
|
|
3021
3039
|
columns: "auto 1fr auto",
|
|
3022
3040
|
alignment: "start",
|
|
@@ -3113,12 +3131,19 @@ function UserProfile({
|
|
|
3113
3131
|
display: "none"
|
|
3114
3132
|
}
|
|
3115
3133
|
},
|
|
3116
|
-
marginTop: "auto"
|
|
3134
|
+
marginTop: "auto",
|
|
3135
|
+
shrink: 1,
|
|
3136
|
+
minHeight: 0,
|
|
3137
|
+
overflow: "auto",
|
|
3138
|
+
position: "relative"
|
|
3117
3139
|
}, /*#__PURE__*/React.createElement(tapestryReact.StackView, {
|
|
3118
3140
|
backgroundColor: "var(--t-fill-color-neutral-060)",
|
|
3119
3141
|
paddingVertical: 1.5,
|
|
3120
3142
|
paddingHorizontal: 2,
|
|
3121
|
-
borderBottom: `1px solid var(--t-border-color-default-base)
|
|
3143
|
+
borderBottom: `1px solid var(--t-border-color-default-base)`,
|
|
3144
|
+
position: "sticky",
|
|
3145
|
+
top: 0,
|
|
3146
|
+
zIndex: 1
|
|
3122
3147
|
}, /*#__PURE__*/React.createElement(tapestryReact.HeadingUppercase, {
|
|
3123
3148
|
color: "var(--t-text-color-default-secondary)",
|
|
3124
3149
|
fontWeight: 500
|
|
@@ -3133,7 +3158,7 @@ function UserProfile({
|
|
|
3133
3158
|
onClick: e => {
|
|
3134
3159
|
requestClearAppsCache();
|
|
3135
3160
|
requestClearConnectedPeopleCache();
|
|
3136
|
-
|
|
3161
|
+
switchConnectedPerson(env, String(id), `${appName}/`);
|
|
3137
3162
|
e.preventDefault();
|
|
3138
3163
|
},
|
|
3139
3164
|
color: "var(--t-text-color-default-secondary)",
|
|
@@ -3144,7 +3169,7 @@ function UserProfile({
|
|
|
3144
3169
|
onClick: e => {
|
|
3145
3170
|
requestClearAppsCache();
|
|
3146
3171
|
requestClearConnectedPeopleCache();
|
|
3147
|
-
|
|
3172
|
+
unlinkConnectedPeople(env);
|
|
3148
3173
|
e.preventDefault();
|
|
3149
3174
|
},
|
|
3150
3175
|
color: "var(--t-text-color-status-error)",
|
|
@@ -4341,14 +4366,11 @@ function toolIsRoutable(tool) {
|
|
|
4341
4366
|
function Toolbar({
|
|
4342
4367
|
appName,
|
|
4343
4368
|
autoMountTool,
|
|
4344
|
-
connectedPeople,
|
|
4345
4369
|
env,
|
|
4346
4370
|
helpdeskConfig = {},
|
|
4347
4371
|
linkToProfile = true,
|
|
4348
4372
|
onReceiveTasksWorker,
|
|
4349
4373
|
requestClearAppsCache,
|
|
4350
|
-
requestSwitchConnectedPerson,
|
|
4351
|
-
requestUnlinkConnectedPeople,
|
|
4352
4374
|
userAvatarPath,
|
|
4353
4375
|
userName,
|
|
4354
4376
|
_storeDataOverride
|
|
@@ -4502,15 +4524,13 @@ function Toolbar({
|
|
|
4502
4524
|
Profile: {
|
|
4503
4525
|
appName,
|
|
4504
4526
|
closeDrawer,
|
|
4505
|
-
|
|
4527
|
+
env,
|
|
4506
4528
|
hasConnectedPeople: (storeData === null || storeData === void 0 ? void 0 : storeData.hasConnectedPeople) || false,
|
|
4507
4529
|
linkToProfile,
|
|
4508
4530
|
loginSettingsUrl,
|
|
4509
4531
|
logoutUrl,
|
|
4510
4532
|
profileUrl,
|
|
4511
4533
|
requestClearAppsCache: requestClearAppsCache || (() => {}),
|
|
4512
|
-
requestSwitchConnectedPerson: requestSwitchConnectedPerson || (() => {}),
|
|
4513
|
-
requestUnlinkConnectedPeople: requestUnlinkConnectedPeople || (() => {}),
|
|
4514
4534
|
userAvatarPath
|
|
4515
4535
|
},
|
|
4516
4536
|
Tasks: {
|