@vc-shell/framework 1.0.80 → 1.0.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "main": "./dist/framework.mjs",
5
5
  "module": "./dist/framework.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -38,7 +38,6 @@
38
38
  "@vueuse/integrations": "^10.1.2",
39
39
  "buffer-esm": "^1.2.0",
40
40
  "client-oauth2": "^4.3.3",
41
- "fetch-intercept": "^2.4.0",
42
41
  "moment": "^2.29.4",
43
42
  "normalize.css": "^8.0.1",
44
43
  "querystring-es3": "^0.2.1",
@@ -56,8 +55,8 @@
56
55
  "whatwg-fetch": "^3.6.2"
57
56
  },
58
57
  "devDependencies": {
59
- "@vc-shell/api-client-generator": "^1.0.80",
60
- "@vc-shell/config-generator": "^1.0.80",
58
+ "@vc-shell/api-client-generator": "^1.0.82",
59
+ "@vc-shell/config-generator": "^1.0.82",
61
60
  "@vitejs/plugin-vue": "^4.2.3",
62
61
  "sass": "^1.62.1",
63
62
  "typescript": "~5.0.4",
@@ -72,7 +72,7 @@
72
72
  </div>
73
73
  </VcForm>
74
74
  <div
75
- v-if="azureAdAuthAvailable && azureAdAuthCaption"
75
+ v-if="loginProviders && loginProviders.length"
76
76
  class="tw-mt-4"
77
77
  >
78
78
  <div
@@ -80,16 +80,18 @@
80
80
  >
81
81
  OR
82
82
  </div>
83
- <div class="tw-flex tw-justify-center tw-mt-4">
83
+ <div class="tw-flex tw-justify-center tw-mt-4 tw-flex-wrap tw-gap-2">
84
84
  <VcButton
85
+ v-for="external in loginProviders"
86
+ :key="external.authenticationType"
85
87
  outline
86
- @click="azureSignOn"
88
+ @click="externalSignOn(external.authenticationType)"
87
89
  ><div class="tw-flex tw-flex-row tw-items-center">
88
90
  <img
89
- :src="AzureAdIcon"
90
- alt="AzureAd"
91
+ :src="externalAuthIcon(external.authenticationType)"
92
+ :alt="external.authenticationType"
91
93
  class="tw-h-5 tw-mr-2"
92
- />{{ azureAdAuthCaption }}
94
+ />{{ external.displayName }}
93
95
  </div></VcButton
94
96
  >
95
97
  </div>
@@ -180,8 +182,8 @@ import { useIsFormValid, Field, useIsFormDirty, useForm } from "vee-validate";
180
182
  import { useSettings, useUser } from "./../../../../../core/composables";
181
183
  import { RequestPasswordResult, SignInResults } from "./../../../../../core/types";
182
184
  import { CommonPageComposables } from "./../../../../../typings";
183
- import { asyncComputed } from "@vueuse/core";
184
185
  import AzureAdIcon from "./../../../../../assets/img/AzureAd.svg";
186
+ import { ExternalSignInProviderInfo } from "./../../../../../core/api";
185
187
 
186
188
  export interface Props {
187
189
  logo: string;
@@ -197,35 +199,42 @@ useForm({ validateOnMount: false });
197
199
  const { getUiCustomizationSettings, uiSettings } = useSettings();
198
200
  let useLogin;
199
201
  const injected = inject<CommonPageComposables>("commonPageComposables");
200
- if (injected) {
201
- useLogin = injected?.useLogin;
202
- }
203
-
204
202
  const signInResult = ref<SignInResults>({ succeeded: true });
205
203
  const requestPassResult = ref<RequestPasswordResult>({ succeeded: true });
206
204
  const forgotPasswordRequestSent = ref(false);
207
- const { signIn, loading, loadUser, externalSignIn, isAzureAdAuthAvailable, getAzureAdAuthCaption } = useUser();
208
- let forgotPassword;
209
- if (useLogin) {
210
- const { forgotPassword: forgot } = useLogin();
211
- forgotPassword = forgot;
212
- }
213
-
205
+ const { signIn, loading, externalSignIn, getExternalLoginProviders } = useUser();
214
206
  const isLogin = ref(true);
215
207
  const isValid = useIsFormValid();
216
208
  const isDirty = useIsFormDirty();
217
209
  const customizationLoading = ref(false);
218
210
  const loadingForgotPassword = ref(false);
211
+ const loginProviders = ref<ExternalSignInProviderInfo[]>();
212
+ let forgotPassword;
213
+
214
+ if (injected) {
215
+ useLogin = injected?.useLogin;
216
+
217
+ if (useLogin) {
218
+ const { forgotPassword: forgot } = useLogin();
219
+ forgotPassword = forgot;
220
+ }
221
+ }
219
222
 
220
223
  onMounted(async () => {
221
224
  try {
222
225
  customizationLoading.value = true;
226
+ loginProviders.value = await getExternalLoginProviders();
223
227
  await getUiCustomizationSettings();
224
228
  } finally {
225
229
  customizationLoading.value = false;
226
230
  }
227
231
  });
228
232
 
233
+ const externalAuthIcon = (authenticationType: string) => {
234
+ if (authenticationType === "AzureAD") return AzureAdIcon;
235
+ else return;
236
+ };
237
+
229
238
  const customization = computed(() => {
230
239
  return (
231
240
  !customizationLoading.value && {
@@ -238,13 +247,6 @@ const isDisabled = computed(() => {
238
247
  return !isDirty.value || !isValid.value;
239
248
  });
240
249
 
241
- const azureAdAuthAvailable = asyncComputed(async () => {
242
- return await isAzureAdAuthAvailable();
243
- });
244
- const azureAdAuthCaption = asyncComputed(async () => {
245
- return await getAzureAdAuthCaption();
246
- });
247
-
248
250
  const form = reactive({
249
251
  username: "",
250
252
  password: "",
@@ -285,9 +287,8 @@ const togglePassRequest = () => {
285
287
  }
286
288
  };
287
289
 
288
- const azureSignOn = async () => {
289
- await externalSignIn("AzureAD", window.location.pathname);
290
- await loadUser();
290
+ const externalSignOn = async (authenticationType: string) => {
291
+ await externalSignIn(authenticationType, window.location.pathname);
291
292
  };
292
293
 
293
294
  console.debug("Init login-page");