@aws-amplify/ui-vue 2.0.12 → 2.1.0

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
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { openBlock, createElementBlock, renderSlot, defineComponent, useSlots, mergeProps, unref, createElementVNode, normalizeProps, guardReactiveProps, ref, createVNode, withCtx, createCommentVNode, toRefs, Fragment, createTextVNode, toDisplayString, isRef, renderList, onMounted, onBeforeUnmount, shallowRef, watch, effectScope, getCurrentScope, onScopeDispose, reactive, watchEffect, computed, createBlock, useAttrs, withModifiers, h, onUnmounted, normalizeClass } from "vue";
20
+ import { openBlock, createElementBlock, renderSlot, defineComponent, useSlots, mergeProps, unref, createElementVNode, normalizeProps, guardReactiveProps, ref, createVNode, withCtx, createCommentVNode, toRefs, Fragment, createTextVNode, toDisplayString, isRef, renderList, onMounted, onBeforeUnmount, shallowRef, watch, reactive, watchEffect, computed, createBlock, effectScope, getCurrentScope, onScopeDispose, useAttrs, withModifiers, h, onUnmounted, normalizeClass } from "vue";
21
21
  import { Auth, I18n, Hub, Amplify, Logger } from "aws-amplify";
22
22
  var _export_sfc = (sfc, props) => {
23
23
  const target = sfc.__vccOpts || sfc;
@@ -8406,35 +8406,6 @@ const facade = {
8406
8406
  submit: (data) => null,
8407
8407
  submitForm: (data) => null
8408
8408
  };
8409
- function tryOnScopeDispose(fn) {
8410
- if (getCurrentScope()) {
8411
- onScopeDispose(fn);
8412
- return true;
8413
- }
8414
- return false;
8415
- }
8416
- function createSharedComposable(composable) {
8417
- let subscribers = 0;
8418
- let state;
8419
- let scope;
8420
- const dispose = () => {
8421
- subscribers -= 1;
8422
- if (scope && subscribers <= 0) {
8423
- scope.stop();
8424
- state = void 0;
8425
- scope = void 0;
8426
- }
8427
- };
8428
- return (...args) => {
8429
- subscribers += 1;
8430
- if (!state) {
8431
- scope = effectScope(true);
8432
- state = scope.run(() => composable(...args));
8433
- }
8434
- tryOnScopeDispose(dispose);
8435
- return state;
8436
- };
8437
- }
8438
8409
  const service = ref();
8439
8410
  let useAuthenticatorValue = reactive(__spreadProps(__spreadValues({}, facade), { send: "", state: "" }));
8440
8411
  const useAuth = (serv) => {
@@ -8450,7 +8421,7 @@ const useInternalAuthenticator = () => {
8450
8421
  });
8451
8422
  return useAuthenticatorValue;
8452
8423
  };
8453
- const useAuthenticator = createSharedComposable(useInternalAuthenticator);
8424
+ const useAuthenticator = useInternalAuthenticator;
8454
8425
  function createValues() {
8455
8426
  if (!service.value)
8456
8427
  return;
@@ -8634,6 +8605,35 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
8634
8605
  };
8635
8606
  }
8636
8607
  });
8608
+ function tryOnScopeDispose(fn) {
8609
+ if (getCurrentScope()) {
8610
+ onScopeDispose(fn);
8611
+ return true;
8612
+ }
8613
+ return false;
8614
+ }
8615
+ function createSharedComposable(composable) {
8616
+ let subscribers = 0;
8617
+ let state;
8618
+ let scope;
8619
+ const dispose = () => {
8620
+ subscribers -= 1;
8621
+ if (scope && subscribers <= 0) {
8622
+ scope.stop();
8623
+ state = void 0;
8624
+ scope = void 0;
8625
+ }
8626
+ };
8627
+ return (...args) => {
8628
+ subscribers += 1;
8629
+ if (!state) {
8630
+ scope = effectScope(true);
8631
+ state = scope.run(() => composable(...args));
8632
+ }
8633
+ tryOnScopeDispose(dispose);
8634
+ return state;
8635
+ };
8636
+ }
8637
8637
  const _hoisted_1$8 = /* @__PURE__ */ createElementVNode("svg", {
8638
8638
  "aria-label": "Amazon icon",
8639
8639
  class: "amplify-icon federated-sign-in-icon",
@@ -8716,7 +8716,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8716
8716
  setup(__props) {
8717
8717
  var _a2;
8718
8718
  const { state } = useAuth();
8719
- const { route } = useAuthenticator();
8719
+ const useAuthShared = createSharedComposable(useAuthenticator);
8720
+ const { route } = useAuthShared();
8720
8721
  const { value: { context } } = state;
8721
8722
  const socialProviders = (_a2 = context == null ? void 0 : context.config) == null ? void 0 : _a2.socialProviders;
8722
8723
  const includeAmazon = socialProviders == null ? void 0 : socialProviders.includes("amazon");
@@ -9095,8 +9096,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
9095
9096
  var _a2, _b;
9096
9097
  const { state } = useAuth();
9097
9098
  const { value: { context } } = state;
9098
- const { validationErrors } = toRefs(useAuthenticator());
9099
- const props = useAuthenticator();
9099
+ const useAuthShared = createSharedComposable(useAuthenticator);
9100
+ const { validationErrors } = toRefs(useAuthShared());
9101
+ const props = useAuthShared();
9100
9102
  const inputAttributes = computed(() => M);
9101
9103
  const passwordLabel = computed(() => kt("Password"));
9102
9104
  const confirmPasswordLabel = computed(() => kt("Confirm Password"));
@@ -9166,8 +9168,9 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
9166
9168
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
9167
9169
  emits: ["signUpSubmit"],
9168
9170
  setup(__props, { emit }) {
9169
- const facadeValues = useAuthenticator();
9170
- const props = useAuthenticator();
9171
+ const useAuthShared = createSharedComposable(useAuthenticator);
9172
+ const facadeValues = useAuthShared();
9173
+ const props = useAuthShared();
9171
9174
  const { hasValidationErrors, isPending, error: error2 } = toRefs(facadeValues);
9172
9175
  const attrs = useAttrs();
9173
9176
  const createAccountLabel = computed(() => kt("Create Account"));
@@ -9355,8 +9358,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
9355
9358
  emits: ["confirmSignUpSubmit", "lostCodeClicked"],
9356
9359
  setup(__props, { emit }) {
9357
9360
  const attrs = useAttrs();
9358
- const { isPending, error: error2, codeDeliveryDetails } = toRefs(useAuthenticator());
9359
- const { submitForm, updateForm, resendCode } = useAuthenticator();
9361
+ const useAuthShared = createSharedComposable(useAuthenticator);
9362
+ const { isPending, error: error2, codeDeliveryDetails } = toRefs(useAuthShared());
9363
+ const { submitForm, updateForm, resendCode } = useAuthShared();
9360
9364
  const confirmSignUpHeading = computed(() => {
9361
9365
  var _a2, _b;
9362
9366
  return ((_a2 = codeDeliveryDetails.value) == null ? void 0 : _a2.DeliveryMedium) === "EMAIL" ? kt("We Emailed You") : ((_b = codeDeliveryDetails.value) == null ? void 0 : _b.DeliveryMedium) === "SMS" ? kt("We Texted You") : kt("We Sent A Code");
@@ -12005,7 +12009,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
12005
12009
  setup(__props, { emit }) {
12006
12010
  const attrs = useAttrs();
12007
12011
  const { state, send: send2 } = useAuth();
12008
- const props = useAuthenticator();
12012
+ const useAuthShared = createSharedComposable(useAuthenticator);
12013
+ const props = useAuthShared();
12009
12014
  const actorState = computed(() => Q(state.value));
12010
12015
  const actorContext = computed(() => jr(state.value));
12011
12016
  const changePasswordLabel = computed(() => kt("Change Password"));
@@ -12200,8 +12205,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
12200
12205
  emits: ["resetPasswordSubmit", "backToSignInClicked"],
12201
12206
  setup(__props, { emit }) {
12202
12207
  const attrs = useAttrs();
12203
- const { state, send: send2 } = useAuthenticator();
12204
- const { error: error2, isPending } = toRefs(useAuthenticator());
12208
+ const useAuthShared = createSharedComposable(useAuthenticator);
12209
+ const { state, send: send2 } = useAuthShared();
12210
+ const { error: error2, isPending } = toRefs(useAuthShared());
12205
12211
  const { label } = _a(state.context);
12206
12212
  const labelText = `Enter your ${label.toLowerCase()}`;
12207
12213
  const backSignInText = computed(() => kt("Back to Sign In"));
@@ -12371,7 +12377,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
12371
12377
  emits: ["confirmResetPasswordSubmit", "backToSignInClicked"],
12372
12378
  setup(__props, { emit }) {
12373
12379
  const { state, send: send2 } = useAuth();
12374
- const props = useAuthenticator();
12380
+ const useAuthShared = createSharedComposable(useAuthenticator);
12381
+ const props = useAuthShared();
12375
12382
  const attrs = useAttrs();
12376
12383
  const actorState = computed(() => Q(state.value));
12377
12384
  const actorContext = computed(() => jr(state.value));
@@ -12983,6 +12990,7 @@ const _hoisted_3$1 = {
12983
12990
  };
12984
12991
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
12985
12992
  props: {
12993
+ hideSignUp: { type: Boolean },
12986
12994
  initialState: null,
12987
12995
  loginMechanisms: null,
12988
12996
  services: null,
@@ -13003,7 +13011,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
13003
13011
  "confirmVerifyUserSubmit"
13004
13012
  ],
13005
13013
  setup(__props, { emit }) {
13006
- const { initialState, loginMechanisms, variation, services, signUpAttributes, socialProviders } = __props;
13014
+ const { initialState, loginMechanisms, variation, services, signUpAttributes, socialProviders, hideSignUp } = __props;
13007
13015
  const attrs = useAttrs();
13008
13016
  const machine = Sn();
13009
13017
  const service2 = useInterpret(machine);
@@ -13140,7 +13148,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
13140
13148
  "data-amplify-router": "",
13141
13149
  "data-amplify-router-content": unref(hasTabs) ? void 0 : ""
13142
13150
  }, [
13143
- unref(hasTabs) ? (openBlock(), createBlock(_component_base_two_tabs, { key: 0 }, {
13151
+ unref(hasTabs) && !hideSignUp ? (openBlock(), createBlock(_component_base_two_tabs, { key: 0 }, {
13144
13152
  default: withCtx(() => {
13145
13153
  var _a3, _b2;
13146
13154
  return [
@@ -13188,7 +13196,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
13188
13196
  ]),
13189
13197
  _: 3
13190
13198
  }, 512)) : createCommentVNode("", true),
13191
- ((_c = unref(actorState)) == null ? void 0 : _c.matches("signUp")) ? (openBlock(), createBlock(_sfc_main$i, {
13199
+ ((_c = unref(actorState)) == null ? void 0 : _c.matches("signUp")) && !hideSignUp ? (openBlock(), createBlock(_sfc_main$i, {
13192
13200
  key: 1,
13193
13201
  onSignUpSubmit: onSignUpSubmitI,
13194
13202
  ref: (_value, _refs) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-vue",
3
- "version": "2.0.12",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "prebuild": "rimraf dist",
22
22
  "build": "vue-tsc --noEmit && vite build",
23
23
  "dev": "vite build --watch",
24
- "clean": "rimraf dist",
24
+ "clean": "rimraf dist node_modules",
25
25
  "lint": "echo No linting enabled for @aws-amplify/ui-vue",
26
26
  "test": "yarn test:unit",
27
27
  "test:watch": "yarn test:unit:watch",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-amplify/ui": "3.0.12",
33
- "@vueuse/core": "7.4.1",
33
+ "@vueuse/core": "7.5.5",
34
34
  "@xstate/vue": "0.8.1",
35
35
  "qrcode": "1.5.0"
36
36
  },