@pelatform/starter.shared 0.2.2 → 0.2.3

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/extend.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { Metadata } from 'next';
2
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
2
  import * as react from 'react';
4
3
  import { ComponentType } from 'react';
@@ -6,35 +5,6 @@ export { A as AvatarClassNames, a as AvatarProps, C as CardClassNames, b as Card
6
5
  import 'pelatform-ui/default';
7
6
  import '@pelatform/starter.utils';
8
7
 
9
- declare function mapLocale(locale?: string): string | undefined;
10
-
11
- type metadataProps = {
12
- baseUrl?: string;
13
- title?: string;
14
- fullTitle?: string;
15
- description?: string;
16
- icons?: Metadata["icons"];
17
- url?: string;
18
- image?: string | null;
19
- video?: string | null;
20
- openGraph?: {
21
- type?: "website" | "article" | "book" | "profile" | "music.song" | "music.album" | "music.playlist" | "music.radio_station" | "video.movie" | "video.episode" | "video.tv_show" | "video.other";
22
- locale?: string;
23
- name?: string;
24
- };
25
- twitter?: {
26
- site?: string;
27
- creator?: string;
28
- };
29
- canonicalUrl?: string;
30
- alternateLanguages?: Record<string, string>;
31
- noIndex?: boolean;
32
- noArchive?: boolean;
33
- noSnippet?: boolean;
34
- manifest?: string | URL | null;
35
- };
36
- declare function constructMetadata({ baseUrl, title, fullTitle, description, icons, image, video, url, openGraph, twitter, canonicalUrl, alternateLanguages, noIndex, noArchive, noSnippet, manifest, }: metadataProps): Metadata;
37
-
38
8
  declare const socialProviders: readonly [{
39
9
  readonly provider: "apple";
40
10
  readonly name: "Apple";
@@ -134,4 +104,4 @@ type Provider = {
134
104
  icon?: ProviderIcon;
135
105
  };
136
106
 
137
- export { type Provider, type ProviderIcon, constructMetadata, mapLocale, type metadataProps, socialProviders };
107
+ export { type Provider, type ProviderIcon, socialProviders };
package/dist/extend.js CHANGED
@@ -1,202 +1,3 @@
1
- // src/lib/locale.ts
2
- function mapLocale(locale) {
3
- if (!locale) return "en_US";
4
- const mapping = {
5
- af: "af_ZA",
6
- // Afrikaans - South Africa
7
- am: "am_ET",
8
- // Amharic - Ethiopia
9
- ar: "ar_AR",
10
- // Arabic - Saudi Arabia
11
- bn: "bn_BD",
12
- // Bengali - Bangladesh
13
- bg: "bg_BG",
14
- // Bulgarian - Bulgaria
15
- cs: "cs_CZ",
16
- // Czech - Czech Republic
17
- da: "da_DK",
18
- // Danish - Denmark
19
- de: "de_DE",
20
- // German - Germany
21
- el: "el_GR",
22
- // Greek - Greece
23
- en: "en_US",
24
- // English - United States
25
- en_uk: "en_GB",
26
- // English - United Kingdom
27
- es: "es_ES",
28
- // Spanish - Spain
29
- es_mx: "es_MX",
30
- // Spanish - Mexico
31
- fa: "fa_IR",
32
- // Persian/Farsi - Iran
33
- fi: "fi_FI",
34
- // Finnish - Finland
35
- fr: "fr_FR",
36
- // French - France
37
- fr_ca: "fr_CA",
38
- // French - Canada
39
- he: "he_IL",
40
- // Hebrew - Israel
41
- hi: "hi_IN",
42
- // Hindi - India
43
- hr: "hr_HR",
44
- // Croatian - Croatia
45
- hu: "hu_HU",
46
- // Hungarian - Hungary
47
- id: "id_ID",
48
- // Indonesian - Indonesia
49
- it: "it_IT",
50
- // Italian - Italy
51
- ja: "ja_JP",
52
- // Japanese - Japan
53
- ko: "ko_KR",
54
- // Korean - South Korea
55
- ms: "ms_MY",
56
- // Malay - Malaysia
57
- nl: "nl_NL",
58
- // Dutch - Netherlands
59
- no: "nb_NO",
60
- // Norwegian Bokmål - Norway
61
- pl: "pl_PL",
62
- // Polish - Poland
63
- pt: "pt_PT",
64
- // Portuguese - Portugal
65
- pt_br: "pt_BR",
66
- // Portuguese - Brazil
67
- ro: "ro_RO",
68
- // Romanian - Romania
69
- ru: "ru_RU",
70
- // Russian - Russia
71
- sk: "sk_SK",
72
- // Slovak - Slovakia
73
- sr: "sr_RS",
74
- // Serbian - Serbia
75
- sv: "sv_SE",
76
- // Swedish - Sweden
77
- sw: "sw_KE",
78
- // Swahili - Kenya
79
- th: "th_TH",
80
- // Thai - Thailand
81
- tl: "tl_PH",
82
- // Filipino/Tagalog - Philippines
83
- tr: "tr_TR",
84
- // Turkish - Türkiye
85
- uk: "uk_UA",
86
- // Ukrainian - Ukraine
87
- ur: "ur_PK",
88
- // Urdu - Pakistan
89
- vi: "vi_VN",
90
- // Vietnamese - Vietnam
91
- zh: "zh_CN",
92
- // Chinese (Simplified) - China
93
- zh_hk: "zh_HK",
94
- // Chinese (Traditional) - Hong Kong
95
- zh_tw: "zh_TW"
96
- // Chinese (Traditional) - Taiwan
97
- };
98
- return mapping[locale] || locale;
99
- }
100
-
101
- // src/lib/metadata.ts
102
- import { getAssetsUrl } from "pelatform-ui";
103
- function constructMetadata({
104
- baseUrl,
105
- title,
106
- fullTitle,
107
- description,
108
- icons = [
109
- {
110
- rel: "apple-touch-icon",
111
- sizes: "32x32",
112
- url: getAssetsUrl("favicon/apple-touch-icon.png")
113
- },
114
- {
115
- rel: "icon",
116
- type: "image/png",
117
- sizes: "32x32",
118
- url: getAssetsUrl("favicon/favicon-32x32.png")
119
- },
120
- {
121
- rel: "icon",
122
- type: "image/png",
123
- sizes: "16x16",
124
- url: getAssetsUrl("favicon/favicon-16x16.png")
125
- }
126
- ],
127
- image,
128
- video,
129
- url,
130
- openGraph = {
131
- type: "website",
132
- locale: "en_US"
133
- },
134
- twitter = {},
135
- canonicalUrl,
136
- alternateLanguages,
137
- noIndex = false,
138
- noArchive = false,
139
- noSnippet = false,
140
- manifest
141
- }) {
142
- return {
143
- metadataBase: baseUrl ? new URL(baseUrl) : void 0,
144
- title: fullTitle || title,
145
- description,
146
- icons,
147
- openGraph: {
148
- title,
149
- description,
150
- type: openGraph.type ?? "website",
151
- locale: mapLocale(openGraph.locale),
152
- ...openGraph.name && {
153
- siteName: openGraph.name
154
- },
155
- url,
156
- ...image && {
157
- images: image
158
- },
159
- ...video && {
160
- videos: video
161
- }
162
- },
163
- twitter: {
164
- title,
165
- description,
166
- ...image && {
167
- card: "summary_large_image",
168
- images: [image]
169
- },
170
- ...video && {
171
- player: video
172
- },
173
- ...twitter.site && {
174
- site: twitter.site
175
- },
176
- ...twitter.creator && {
177
- creator: twitter.creator
178
- }
179
- },
180
- ...(url || canonicalUrl || alternateLanguages) && {
181
- alternates: {
182
- ...url || canonicalUrl ? { canonical: url || canonicalUrl } : {},
183
- ...alternateLanguages ? { languages: alternateLanguages } : {}
184
- }
185
- },
186
- ...(noIndex || noArchive || noSnippet) && {
187
- robots: {
188
- ...noIndex ? { index: false, follow: false } : {},
189
- ...noArchive ? { noarchive: true } : {},
190
- ...noSnippet ? { nosnippet: true } : {}
191
- }
192
- },
193
- ...manifest && {
194
- manifest
195
- },
196
- creator: "lukmanaviccena"
197
- };
198
- }
199
-
200
1
  // src/lib/social-providers.ts
201
2
  import { Icons } from "pelatform-ui";
202
3
  var socialProviders = [
@@ -312,7 +113,5 @@ var socialProviders = [
312
113
  }
313
114
  ];
314
115
  export {
315
- constructMetadata,
316
- mapLocale,
317
116
  socialProviders
318
117
  };
package/dist/index.js CHANGED
@@ -199,7 +199,7 @@ function AuthLayout({
199
199
  // src/components/layouts/header.tsx
200
200
  import { useEffect as useEffect2, useState as useState2 } from "react";
201
201
  import { usePathname as usePathname2 } from "next/navigation";
202
- import { Menu, PanelRight } from "lucide-react";
202
+ import { MenuIcon, PanelRightIcon } from "lucide-react";
203
203
  import { useLayout } from "@pelatform/starter.hook";
204
204
  import {
205
205
  Button as Button2,
@@ -216,7 +216,7 @@ import {
216
216
  import { Fragment as Fragment2, useCallback, useEffect, useState } from "react";
217
217
  import Link4 from "next/link";
218
218
  import { useRouter as useRouter2 } from "next/navigation";
219
- import { LogOut, PlusCircleIcon, Settings, Shield, UserStar } from "lucide-react";
219
+ import { LogOutIcon, PlusCircleIcon, SettingsIcon, ShieldIcon, UserStarIcon } from "lucide-react";
220
220
  import { useTranslations as useTranslations7 } from "next-intl";
221
221
  import {
222
222
  useConfig as useConfig4,
@@ -224,7 +224,7 @@ import {
224
224
  useSession as useSession3,
225
225
  useSetActiveSession
226
226
  } from "@pelatform/starter.hook";
227
- import { getUserName as getUserName3 } from "@pelatform/starter.utils";
227
+ import { getUserName as getUserName3 } from "pelatform-ui";
228
228
  import { ModeSwitcher as ModeSwitcher2, UserAvatar as UserAvatar2 } from "pelatform-ui/components";
229
229
  import {
230
230
  Badge,
@@ -239,15 +239,13 @@ import {
239
239
  // src/components/view.tsx
240
240
  import { KeyRoundIcon } from "lucide-react";
241
241
  import { useLocale as useLocale2, useTranslations as useTranslations6 } from "next-intl";
242
- import { getUserName as getUserName2 } from "@pelatform/starter.utils";
243
- import { cn as cn4 } from "pelatform-ui";
242
+ import { cn as cn4, getUserName as getUserName2 } from "pelatform-ui";
244
243
  import { Skeleton as Skeleton2 } from "pelatform-ui/default";
245
244
 
246
245
  // src/components/avatar.tsx
247
246
  import { BuildingIcon, UserRoundIcon } from "lucide-react";
248
247
  import { useTranslations as useTranslations5 } from "next-intl";
249
- import { getSizeAvatar, getUserName } from "@pelatform/starter.utils";
250
- import { cn as cn3 } from "pelatform-ui";
248
+ import { cn as cn3, getSizeAvatar, getUserName } from "pelatform-ui";
251
249
  import { getInitials } from "pelatform-ui/components";
252
250
  import { Avatar, AvatarFallback, AvatarImage, Skeleton } from "pelatform-ui/default";
253
251
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -557,15 +555,15 @@ function UserMenu({ hiddenSwitcher = false }) {
557
555
  ] }),
558
556
  /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
559
557
  /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SETTINGS, children: [
560
- /* @__PURE__ */ jsx9(Settings, {}),
558
+ /* @__PURE__ */ jsx9(SettingsIcon, {}),
561
559
  /* @__PURE__ */ jsx9("span", { children: t("ui.navigation.preferences") })
562
560
  ] }) }),
563
561
  /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SECURITY, children: [
564
- /* @__PURE__ */ jsx9(Shield, {}),
562
+ /* @__PURE__ */ jsx9(ShieldIcon, {}),
565
563
  /* @__PURE__ */ jsx9("span", { children: t("ui.navigation.security") })
566
564
  ] }) }),
567
565
  "admin" === userRole && /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.admin.OVERVIEW, children: [
568
- /* @__PURE__ */ jsx9(UserStar, {}),
566
+ /* @__PURE__ */ jsx9(UserStarIcon, {}),
569
567
  /* @__PURE__ */ jsx9("span", { children: "Admin Dashboard" })
570
568
  ] }) }),
571
569
  !hiddenSwitcher && /* @__PURE__ */ jsxs7(Fragment3, { children: [
@@ -585,7 +583,7 @@ function UserMenu({ hiddenSwitcher = false }) {
585
583
  ] }),
586
584
  /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
587
585
  /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.auth.SIGN_OUT, children: [
588
- /* @__PURE__ */ jsx9(LogOut, {}),
586
+ /* @__PURE__ */ jsx9(LogOutIcon, {}),
589
587
  /* @__PURE__ */ jsx9("span", { children: t("ui.navigation.signOut") })
590
588
  ] }) }),
591
589
  user && features.multiSession && /* @__PURE__ */ jsxs7(Fragment3, { children: [
@@ -634,7 +632,7 @@ function HeaderLeft() {
634
632
  variant: "ghost",
635
633
  onClick: sidebarToggle,
636
634
  className: "hidden text-muted-foreground hover:text-foreground lg:inline-flex",
637
- children: /* @__PURE__ */ jsx10(PanelRight, { className: "-rotate-180 in-data-[sidebar-open=false]:rotate-0 opacity-100" })
635
+ children: /* @__PURE__ */ jsx10(PanelRightIcon, { className: "-rotate-180 in-data-[sidebar-open=false]:rotate-0 opacity-100" })
638
636
  }
639
637
  )
640
638
  ] }) });
@@ -654,7 +652,7 @@ function HeaderSidebarMobile({ children }) {
654
652
  setIsSheetOpen(false);
655
653
  }, [pathname]);
656
654
  return /* @__PURE__ */ jsxs8(Sheet, { open: isSheetOpen, onOpenChange: setIsSheetOpen, children: [
657
- /* @__PURE__ */ jsx10(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(Button2, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx10(Menu, { className: "size-4" }) }) }),
655
+ /* @__PURE__ */ jsx10(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(Button2, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx10(MenuIcon, { className: "size-4" }) }) }),
658
656
  /* @__PURE__ */ jsxs8(SheetContent, { className: "w-(--sidebar-width) gap-0 p-0", side: "left", close: false, children: [
659
657
  /* @__PURE__ */ jsxs8(SheetHeader, { className: "hidden space-y-0 p-0", children: [
660
658
  /* @__PURE__ */ jsx10(SheetTitle, { className: "sr-only", children: "Navigation menu" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pelatform/starter.shared",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "A part of SaaS starter kit for Pelatform applications.",
5
5
  "author": "Pelatform",
6
6
  "license": "MIT",
@@ -41,14 +41,14 @@
41
41
  "devDependencies": {
42
42
  "@pelatform/starter.config": "0.2.1",
43
43
  "@pelatform/starter.hook": "0.2.1",
44
- "@pelatform/starter.utils": "0.2.1",
44
+ "@pelatform/starter.utils": "0.2.2",
45
45
  "@pelatform/tsconfig": "^0.1.3",
46
46
  "@types/react": "^19.2.7",
47
- "lucide-react": "^0.559.0",
48
- "next": "^16.0.8",
49
- "next-intl": "^4.5.8",
50
- "pelatform-ui": "^1.1.3",
51
- "react": "^19.2.1",
47
+ "lucide-react": "^0.561.0",
48
+ "next": "^16.0.10",
49
+ "next-intl": "^4.6.0",
50
+ "pelatform-ui": "^1.1.6",
51
+ "react": "^19.2.3",
52
52
  "react-hook-form": "^7.68.0",
53
53
  "tsup": "^8.5.1"
54
54
  },