@7365admin1/layer-common 1.11.35 → 1.11.36

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.11.36
4
+
5
+ ### Patch Changes
6
+
7
+ - c708a39: updates and fixes
8
+
3
9
  ## 1.11.35
4
10
 
5
11
  ### Patch Changes
@@ -130,15 +130,15 @@ export default function useFeedback() {
130
130
  });
131
131
  }
132
132
 
133
- function deleteFeedback(id: string) {
134
- return useNuxtApp().$api<Record<string, any>>(
135
- `/api/feedbacks/deleted/feedback/${id}`,
136
- {
137
- method: "PUT",
138
- // query: { id },
139
- }
140
- );
141
- }
133
+ // function deleteFeedback(id: string) {
134
+ // return useNuxtApp().$api<Record<string, any>>(
135
+ // `/api/feedbacks/deleted/feedback/${id}`,
136
+ // {
137
+ // method: "PUT",
138
+ // // query: { id },
139
+ // }
140
+ // );
141
+ // }
142
142
 
143
143
  function updateFeedbackServiceProvider(id: string, serviceProvider: string) {
144
144
  return useNuxtApp().$api<Record<string, any>>(
@@ -182,6 +182,12 @@ export default function useFeedback() {
182
182
  );
183
183
  }
184
184
 
185
+ function deleteFeedback(id: string) {
186
+ return useNuxtApp().$api<Record<string, any>>(`/api/feedbacks/${id}`, {
187
+ method: "DELETE",
188
+ });
189
+ }
190
+
185
191
  return {
186
192
  feedbacks,
187
193
  setFeedback,
@@ -0,0 +1,34 @@
1
+ type ProfilePhotoMessageLike = {
2
+ createdByProfile?: unknown;
3
+ };
4
+
5
+ export default function useProfilePhotoSrc() {
6
+ const { API_DO_STORAGE_ENDPOINT } = useRuntimeConfig().public;
7
+
8
+ const isProbablyUrl = (value: string) =>
9
+ /^(https?:\/\/|data:|blob:)/i.test(value);
10
+
11
+ const trimSlashes = (value: string) => value.replace(/^\/+|\/+$/g, "");
12
+
13
+ const joinUrl = (base: string, ...parts: string[]) => {
14
+ const safeBase = base.replace(/\/+$/g, "");
15
+ const safeParts = parts.map((p) => trimSlashes(p)).filter(Boolean);
16
+ return [safeBase, ...safeParts].join("/");
17
+ };
18
+
19
+ const getProfilePhotoSrc = (message: ProfilePhotoMessageLike) => {
20
+ const rawKey = message?.createdByProfile;
21
+ if (typeof rawKey !== "string") return "";
22
+
23
+ const key = rawKey.trim();
24
+ if (!key) return "";
25
+
26
+ if (isProbablyUrl(key)) return key;
27
+
28
+ return joinUrl(String(API_DO_STORAGE_ENDPOINT || ""), key);
29
+ };
30
+
31
+ return {
32
+ getProfilePhotoSrc,
33
+ };
34
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.35",
5
+ "version": "1.11.36",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {