@eid-easy/eideasy-widget 3.0.2 → 3.0.4

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.
@@ -14365,7 +14365,7 @@ const createAppStore = ({ methodsConfig }) => {
14365
14365
  },
14366
14366
  selectMethod(actionType) {
14367
14367
  const timestamp = Date.now();
14368
- const { viewName } = methodsByActionType[actionType];
14368
+ const { viewName } = methodsByActionType[actionType] || {};
14369
14369
  this.clearFlashMessages();
14370
14370
  this.setCurrentMethod({
14371
14371
  actionType,
@@ -30205,7 +30205,7 @@ const _sfc_main$o = {
30205
30205
  const useAppStore = inject("useAppStore");
30206
30206
  const appStore = useAppStore();
30207
30207
  const { loadingStart, loadingEnd, addFlashMessage, clearFlashMessages } = appStore;
30208
- const { clientInfo, additionalMethodConfig } = storeToRefs(appStore);
30208
+ const { clientInfo, additionalMethodConfig, mode } = storeToRefs(appStore);
30209
30209
  const fieldErrors = ref({});
30210
30210
  const authProcess = ref({});
30211
30211
  function clearErrors() {
@@ -30229,6 +30229,7 @@ const _sfc_main$o = {
30229
30229
  clearErrors();
30230
30230
  const extraConfig = additionalMethodConfig.value || {};
30231
30231
  authProcess.value = eidEasyClient.identification.mitId.start({
30232
+ action: mode.value,
30232
30233
  fail: (error2) => {
30233
30234
  if (!error2.isCancel) {
30234
30235
  addFlashMessage(error2);
@@ -34483,11 +34484,19 @@ const _sfc_main = {
34483
34484
  });
34484
34485
  }
34485
34486
  });
34487
+ function validateSelectedMethod(selectedMethod) {
34488
+ const allMethods = Object.keys(appProvides.eidEasyMethodsConfig.methodsByActionType);
34489
+ return allMethods.includes(selectedMethod);
34490
+ }
34486
34491
  onMounted(() => {
34487
34492
  let countryToSelect = countryCode.value.toUpperCase();
34488
34493
  let calculatedSelectedMethod;
34489
34494
  if (props.selectedMethod) {
34490
- calculatedSelectedMethod = props.selectedMethod;
34495
+ if (validateSelectedMethod(props.selectedMethod)) {
34496
+ calculatedSelectedMethod = props.selectedMethod;
34497
+ } else {
34498
+ console.warn(`Provided selectedMethod value: "${props.selectedMethod}" is not valid, the widget will ignore it.`);
34499
+ }
34491
34500
  } else if (shouldStartAtOtpView.value) {
34492
34501
  calculatedSelectedMethod = eideasyBrowserClientExports.methodActionTypes.OTP_EMAIL;
34493
34502
  }