@eid-easy/eideasy-widget 3.0.3 → 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,
@@ -34484,11 +34484,19 @@ const _sfc_main = {
34484
34484
  });
34485
34485
  }
34486
34486
  });
34487
+ function validateSelectedMethod(selectedMethod) {
34488
+ const allMethods = Object.keys(appProvides.eidEasyMethodsConfig.methodsByActionType);
34489
+ return allMethods.includes(selectedMethod);
34490
+ }
34487
34491
  onMounted(() => {
34488
34492
  let countryToSelect = countryCode.value.toUpperCase();
34489
34493
  let calculatedSelectedMethod;
34490
34494
  if (props.selectedMethod) {
34491
- 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
+ }
34492
34500
  } else if (shouldStartAtOtpView.value) {
34493
34501
  calculatedSelectedMethod = eideasyBrowserClientExports.methodActionTypes.OTP_EMAIL;
34494
34502
  }