pukaad-ui-lib 1.272.0 → 1.274.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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.272.0",
4
+ "version": "1.274.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -7,7 +7,7 @@
7
7
  v-model="modelValue"
8
8
  >
9
9
  <ShadFormItem>
10
- <ShadFormLabel class="w-full">
10
+ <ShadFormLabel v-if="props.label || $slots.label" class="w-full">
11
11
  <slot name="label">
12
12
  <div class="flex-1">
13
13
  {{ props.label }}
@@ -18,12 +18,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
18
18
  "update:modelValue": (value: boolean) => any;
19
19
  complete: (data: {
20
20
  secId: string;
21
+ resetToken?: string;
21
22
  }) => any;
22
23
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
24
  onClose?: (() => any) | undefined;
24
25
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
25
26
  onComplete?: ((data: {
26
27
  secId: string;
28
+ resetToken?: string;
27
29
  }) => any) | undefined;
28
30
  }>, {
29
31
  title: string;
@@ -51,7 +51,7 @@ const handleSubmit = async () => {
51
51
  body: { password: password.value }
52
52
  });
53
53
  if (res.message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
54
- emit("complete", { secId: "" });
54
+ emit("complete", { secId: "", resetToken: res.data?.reset_token });
55
55
  isOpen.value = false;
56
56
  } else {
57
57
  if (!props.loginToken) {
@@ -18,12 +18,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
18
18
  "update:modelValue": (value: boolean) => any;
19
19
  complete: (data: {
20
20
  secId: string;
21
+ resetToken?: string;
21
22
  }) => any;
22
23
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
24
  onClose?: (() => any) | undefined;
24
25
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
25
26
  onComplete?: ((data: {
26
27
  secId: string;
28
+ resetToken?: string;
27
29
  }) => any) | undefined;
28
30
  }>, {
29
31
  title: string;
@@ -4,7 +4,7 @@
4
4
  :confirmed-text="isLastStep ? '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19' : '\u0E16\u0E31\u0E14\u0E44\u0E1B'" @close="isOpen = false" v-model="modalStates[modal.key]"
5
5
  :request-path="modal.key === 'phoneOTP' ? '/otp/phone-request' : void 0"
6
6
  :verify-path="modal.key === 'phoneOTP' ? '/otp/phone-verify' : void 0"
7
- />
7
+ :reset-token="resetTokenState" />
8
8
  </template>
9
9
 
10
10
  <script setup>
@@ -30,6 +30,7 @@ const isOpen = defineModel({ type: Boolean, ...{
30
30
  default: false
31
31
  } });
32
32
  const isLastStep = ref(false);
33
+ const resetTokenState = ref("");
33
34
  const modals = [
34
35
  { key: "password", component: ModalPasswordVerify },
35
36
  { key: "passwordNew", component: ModalPasswordNew },
@@ -43,6 +44,9 @@ const modalStates = reactive(
43
44
  );
44
45
  const handleComplete = (key, data) => {
45
46
  modalStates[key] = false;
47
+ if (data?.resetToken || data?.reset_token) {
48
+ resetTokenState.value = data.resetToken || data.reset_token;
49
+ }
46
50
  if (props.state === "add-phone") {
47
51
  if (key === "password") {
48
52
  if (props.twoFaEnabled) {
@@ -119,6 +123,22 @@ const handleComplete = (key, data) => {
119
123
  return;
120
124
  }
121
125
  }
126
+ if (props.state === "reset-password") {
127
+ if (key === "password") {
128
+ if (props.twoFaEnabled) {
129
+ modalStates.twoFa = true;
130
+ } else {
131
+ isLastStep.value = true;
132
+ modalStates.passwordNew = true;
133
+ }
134
+ } else if (key === "twoFa") {
135
+ isLastStep.value = true;
136
+ modalStates.passwordNew = true;
137
+ } else if (key === "passwordNew") {
138
+ isOpen.value = false;
139
+ emit("complete", "reset-password");
140
+ }
141
+ }
122
142
  };
123
143
  const onEnabled2FA = async (token) => {
124
144
  try {
@@ -152,6 +172,7 @@ const onDisabled2FA = async () => {
152
172
  };
153
173
  watch(isOpen, (v) => {
154
174
  if (!v) return;
175
+ resetTokenState.value = "";
155
176
  modalStates.password = true;
156
177
  if (["delete-phone", "delete-email"].includes(props.state)) {
157
178
  isLastStep.value = !props.twoFaEnabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.272.0",
3
+ "version": "1.274.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",