@aws-amplify/ui-vue 4.0.4 → 4.0.6

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/index.js CHANGED
@@ -175,7 +175,7 @@ function isFunction$5(value) {
175
175
  function noop$1(..._) {
176
176
  return;
177
177
  }
178
- const defaultAuthHubHandler = async ({ payload }, service, options) => {
178
+ const defaultAuthHubHandler = ({ payload }, service, options) => {
179
179
  const { event: event2 } = payload;
180
180
  const { send: send2 } = service;
181
181
  const { onSignIn, onSignOut } = options != null ? options : {};
@@ -200,11 +200,9 @@ const defaultAuthHubHandler = async ({ payload }, service, options) => {
200
200
  }
201
201
  }
202
202
  };
203
- const getHubEventHandler = (service, handler) => (data) => {
204
- handler(data, service);
205
- };
206
203
  const listenToAuthHub = (service, handler = defaultAuthHubHandler) => {
207
- return Hub.listen("auth", getHubEventHandler(service, handler), "authenticator-hub-handler");
204
+ const eventHandler = (data) => handler(data, service);
205
+ return Hub.listen("auth", eventHandler, "authenticator-hub-handler");
208
206
  };
209
207
  const countryDialCodes = [
210
208
  "+1",
@@ -8345,6 +8343,16 @@ const runValidators = async (formData, touchData, passwordSettings, validators)
8345
8343
  }
8346
8344
  };
8347
8345
  const DEFAULT_COGNITO_PASSWORD_MIN_LENGTH = 8;
8346
+ const isInvalidUserAtributes = (userAttributes) => Array.isArray(userAttributes);
8347
+ const parseUserAttributes = (userAttributes) => {
8348
+ if (!userAttributes) {
8349
+ return void 0;
8350
+ }
8351
+ if (isInvalidUserAtributes(userAttributes)) {
8352
+ return Object.entries(userAttributes).map(([_, value]) => Object.keys(value)[0]);
8353
+ }
8354
+ return Object.keys(userAttributes);
8355
+ };
8348
8356
  const defaultServices = {
8349
8357
  async getAmplifyConfig() {
8350
8358
  var _a2, _b, _c, _d, _e;
@@ -8354,7 +8362,7 @@ const defaultServices = {
8354
8362
  const parsedLoginMechanisms = loginWith ? Object.entries(loginWith).filter(([key, _value]) => key !== "oauth").filter(([_key, value]) => !!value).map((keyValueArray) => {
8355
8363
  return keyValueArray[0] === "phone" ? "phone_number" : keyValueArray[0];
8356
8364
  }) : void 0;
8357
- const parsedSignupAttributes = userAttributes ? Object.entries(userAttributes).map(([_key, value]) => Object.keys(value)[0]) : void 0;
8365
+ const parsedSignupAttributes = parseUserAttributes(userAttributes);
8358
8366
  const parsedSocialProviders = ((_d = loginWith == null ? void 0 : loginWith.oauth) == null ? void 0 : _d.providers) ? (_e = loginWith.oauth.providers) == null ? void 0 : _e.map((provider) => provider.toString().toLowerCase()) : void 0;
8359
8367
  return {
8360
8368
  ...cliConfig,
@@ -10026,9 +10034,10 @@ const useAuth = createSharedComposable(() => {
10026
10034
  const onSignOut = () => {
10027
10035
  authStatus.value = "unauthenticated";
10028
10036
  };
10029
- const unsubscribeHub = listenToAuthHub(service, async (data, service2) => {
10030
- await defaultAuthHubHandler(data, service2, { onSignIn, onSignOut });
10031
- });
10037
+ const unsubscribeHub = listenToAuthHub(
10038
+ service,
10039
+ (data, service2) => defaultAuthHubHandler(data, service2, { onSignIn, onSignOut })
10040
+ );
10032
10041
  getCurrentUser().then(() => {
10033
10042
  authStatus.value = "authenticated";
10034
10043
  }).catch(() => {
@@ -10898,7 +10907,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
10898
10907
  };
10899
10908
  }
10900
10909
  });
10901
- const VERSION = "4.0.4";
10910
+ const VERSION = "4.0.6";
10902
10911
  const _sfc_main$e = {};
10903
10912
  function _sfc_render(_ctx, _cache) {
10904
10913
  return renderSlot(_ctx.$slots, "textI", normalizeProps(guardReactiveProps(_ctx.$attrs)), () => [