@myrjfa/state 1.1.2 → 2.0.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.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/lib/actions/actions.d.ts +1 -20
- package/dist/lib/actions/actions.d.ts.map +1 -1
- package/dist/lib/actions/actions.js +10 -50
- package/dist/lib/actions/auth.d.ts +22 -12
- package/dist/lib/actions/auth.d.ts.map +1 -1
- package/dist/lib/actions/booking.d.ts +30 -0
- package/dist/lib/actions/booking.d.ts.map +1 -0
- package/dist/lib/actions/booking.js +77 -0
- package/dist/lib/actions/fetcher.d.ts +3 -0
- package/dist/lib/actions/fetcher.d.ts.map +1 -1
- package/dist/lib/actions/fetcher.js +6 -44
- package/dist/lib/actions/{serverActions.d.ts → severActions.d.ts} +1 -1
- package/dist/lib/actions/severActions.d.ts.map +1 -0
- package/dist/lib/actions/{serverActions.js → severActions.js} +2 -5
- package/dist/lib/authSessionManager.d.ts.map +1 -1
- package/dist/lib/authSessionManager.js +7 -14
- package/dist/lib/context/ChatContext.d.ts +1 -1
- package/dist/lib/context/ChatContext.d.ts.map +1 -1
- package/dist/lib/models/adventure.d.ts +75 -0
- package/dist/lib/models/adventure.d.ts.map +1 -0
- package/dist/lib/models/adventure.js +1 -0
- package/dist/lib/models/blog.d.ts +6 -7
- package/dist/lib/models/blog.d.ts.map +1 -1
- package/dist/lib/models/booking.d.ts +47 -0
- package/dist/lib/models/booking.d.ts.map +1 -0
- package/dist/lib/models/booking.js +1 -0
- package/dist/lib/models/guide.d.ts +43 -0
- package/dist/lib/models/guide.d.ts.map +1 -0
- package/dist/lib/models/guide.js +1 -0
- package/dist/lib/models/{notifications.d.ts → notfications.d.ts} +1 -1
- package/dist/lib/models/notfications.d.ts.map +1 -0
- package/dist/lib/models/opportunities/freelance.d.ts +94 -54
- package/dist/lib/models/opportunities/freelance.d.ts.map +1 -1
- package/dist/lib/models/opportunities/internship.d.ts +94 -54
- package/dist/lib/models/opportunities/internship.d.ts.map +1 -1
- package/dist/lib/models/opportunities/job.d.ts +104 -64
- package/dist/lib/models/opportunities/job.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.d.ts +107 -67
- package/dist/lib/models/opportunities/opportunity.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.js +0 -1
- package/dist/lib/models/opportunities/volunteerJob.d.ts +94 -54
- package/dist/lib/models/opportunities/volunteerJob.d.ts.map +1 -1
- package/dist/lib/models/package.d.ts +264 -0
- package/dist/lib/models/package.d.ts.map +1 -0
- package/dist/lib/models/package.js +58 -0
- package/dist/lib/models/portfolio.d.ts +2 -2
- package/dist/lib/models/props.d.ts +7 -21
- package/dist/lib/models/props.d.ts.map +1 -1
- package/dist/lib/models/props.js +36 -0
- package/dist/lib/models/rental.d.ts +85 -0
- package/dist/lib/models/rental.d.ts.map +1 -0
- package/dist/lib/models/rental.js +1 -0
- package/dist/lib/models/review.d.ts +1 -1
- package/dist/lib/models/review.d.ts.map +1 -1
- package/dist/lib/models/stay.d.ts +459 -0
- package/dist/lib/models/stay.d.ts.map +1 -0
- package/dist/lib/models/stay.js +214 -0
- package/dist/lib/models/tile.d.ts +26 -1
- package/dist/lib/models/tile.d.ts.map +1 -1
- package/dist/lib/models/user.d.ts +52 -19
- package/dist/lib/models/user.d.ts.map +1 -1
- package/dist/lib/models/user.js +10 -5
- package/dist/lib/userAtom.d.ts +44 -24
- package/dist/lib/userAtom.d.ts.map +1 -1
- package/dist/lib/userAtom.js +11 -13
- package/dist/lib/utils.js +4 -4
- package/package.json +5 -2
- package/dist/lib/actions/serverActions.d.ts.map +0 -1
- package/dist/lib/models/notifications.d.ts.map +0 -1
- package/dist/lib/utils/socialMediaUrl.d.ts +0 -25
- package/dist/lib/utils/socialMediaUrl.d.ts.map +0 -1
- package/dist/lib/utils/socialMediaUrl.js +0 -97
- /package/dist/lib/models/{notifications.js → notfications.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socialMediaUrl.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/socialMediaUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAE7H,UAAU,cAAc;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAyDhE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,MAAM,GACd;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAiCvC;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,kBAAkB,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizes social media input (username or partial URL) into a fully qualified URL.
|
|
3
|
-
* Handles cases where users enter just a username, handle, or partial URL.
|
|
4
|
-
*/
|
|
5
|
-
const PLATFORM_CONFIGS = {
|
|
6
|
-
instagram: {
|
|
7
|
-
baseUrl: 'https://instagram.com/',
|
|
8
|
-
usernameRegex: /^[a-zA-Z0-9._]{1,30}$/,
|
|
9
|
-
urlPattern: /^https?:\/\/(www\.)?instagram\.com\/([a-zA-Z0-9._]+)\/?/,
|
|
10
|
-
buildUrl: (u) => `https://instagram.com/${u}`,
|
|
11
|
-
placeholder: 'pankaj.sharma or https://instagram.com/pankaj.sharma',
|
|
12
|
-
hint: 'Username: letters, numbers, . and _ (max 30 chars)',
|
|
13
|
-
},
|
|
14
|
-
twitter: {
|
|
15
|
-
baseUrl: 'https://x.com/',
|
|
16
|
-
usernameRegex: /^[a-zA-Z0-9_]{1,15}$/,
|
|
17
|
-
urlPattern: /^https?:\/\/(www\.)?(twitter\.com|x\.com)\/([a-zA-Z0-9_]+)\/?/,
|
|
18
|
-
buildUrl: (u) => `https://x.com/${u}`,
|
|
19
|
-
placeholder: 'pankajsharma or https://x.com/pankajsharma',
|
|
20
|
-
hint: 'Username: letters, numbers, _ (max 15 chars)',
|
|
21
|
-
},
|
|
22
|
-
linkedin: {
|
|
23
|
-
baseUrl: 'https://linkedin.com/in/',
|
|
24
|
-
usernameRegex: /^[a-zA-Z0-9-]{3,100}$/,
|
|
25
|
-
urlPattern: /^https?:\/\/(www\.)?linkedin\.com\/in\/([a-zA-Z0-9-]+)\/?/,
|
|
26
|
-
buildUrl: (u) => `https://linkedin.com/in/${u}`,
|
|
27
|
-
placeholder: 'pankaj-sharma or https://linkedin.com/in/pankaj-sharma',
|
|
28
|
-
hint: 'Username: letters, numbers, - (3–100 chars)',
|
|
29
|
-
},
|
|
30
|
-
facebook: {
|
|
31
|
-
baseUrl: 'https://facebook.com/',
|
|
32
|
-
usernameRegex: /^[a-zA-Z0-9.]{5,50}$/,
|
|
33
|
-
urlPattern: /^https?:\/\/(www\.)?facebook\.com\/([a-zA-Z0-9.]+)\/?/,
|
|
34
|
-
buildUrl: (u) => `https://facebook.com/${u}`,
|
|
35
|
-
placeholder: 'pankaj.sharma or https://facebook.com/pankaj.sharma',
|
|
36
|
-
hint: 'Username: letters, numbers, . (5–50 chars)',
|
|
37
|
-
},
|
|
38
|
-
youtube: {
|
|
39
|
-
baseUrl: 'https://youtube.com/@',
|
|
40
|
-
usernameRegex: /^@?[a-zA-Z0-9_-]{3,30}$/,
|
|
41
|
-
urlPattern: /^https?:\/\/(www\.)?youtube\.com\/@?([a-zA-Z0-9_-]+)\/?/,
|
|
42
|
-
buildUrl: (u) => `https://youtube.com/@${u.replace(/^@/, '')}`,
|
|
43
|
-
placeholder: '@pankajsharma or https://youtube.com/@pankajsharma',
|
|
44
|
-
hint: 'Handle: letters, numbers, _ and - (3–30 chars)',
|
|
45
|
-
},
|
|
46
|
-
github: {
|
|
47
|
-
baseUrl: 'https://github.com/',
|
|
48
|
-
usernameRegex: /^[a-zA-Z0-9-]{1,39}$/,
|
|
49
|
-
urlPattern: /^https?:\/\/(www\.)?github\.com\/([a-zA-Z0-9-]+)\/?/,
|
|
50
|
-
buildUrl: (u) => `https://github.com/${u}`,
|
|
51
|
-
placeholder: 'pankaj-sharma or https://github.com/pankaj-sharma',
|
|
52
|
-
hint: 'Username: letters, numbers, - (max 39 chars)',
|
|
53
|
-
},
|
|
54
|
-
googleBusiness: {
|
|
55
|
-
baseUrl: 'https://mybusiness.google.com/',
|
|
56
|
-
usernameRegex: /^[a-zA-Z0-9-]{1,39}$/, // Adjust regex as needed
|
|
57
|
-
urlPattern: /^https?:\/\/(www\.)?mybusiness\.google\.com\/([a-zA-Z0-9-]+)\/?/,
|
|
58
|
-
buildUrl: (u) => `https://mybusiness.google.com/${u}`,
|
|
59
|
-
placeholder: 'pankaj-sharma or https://mybusiness.google.com/pankaj-sharma',
|
|
60
|
-
hint: 'Username: letters, numbers, - (max 39 chars)',
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Attempts to normalize a social media input into a full URL.
|
|
65
|
-
* Returns { url, error } — url is the corrected URL or the original input, error is a message if invalid.
|
|
66
|
-
*/
|
|
67
|
-
export function normalizeSocialUrl(platform, input) {
|
|
68
|
-
const cfg = PLATFORM_CONFIGS[platform];
|
|
69
|
-
if (!input || input.trim() === '')
|
|
70
|
-
return { url: '', error: null };
|
|
71
|
-
const trimmed = input.trim();
|
|
72
|
-
// Already a full URL for this platform → extract username and rebuild canonical
|
|
73
|
-
const urlMatch = trimmed.match(cfg.urlPattern);
|
|
74
|
-
if (urlMatch) {
|
|
75
|
-
// Take the captured username group (last capture group)
|
|
76
|
-
const username = urlMatch[urlMatch.length - 1] ?? trimmed;
|
|
77
|
-
return { url: cfg.buildUrl(username), error: null };
|
|
78
|
-
}
|
|
79
|
-
// Looks like a URL for a *different* site or malformed URL
|
|
80
|
-
if (trimmed.startsWith('http://') || trimmed.startsWith('https://') || trimmed.includes('.com/') || trimmed.includes('.net/')) {
|
|
81
|
-
return {
|
|
82
|
-
url: trimmed,
|
|
83
|
-
error: `That doesn't look like a valid ${platform} URL. ${cfg.hint}`,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
// Plain username — validate and build URL
|
|
87
|
-
const usernameToTest = trimmed.replace(/^@/, ''); // strip leading @ for youtube/etc
|
|
88
|
-
const testValue = platform === 'youtube' ? trimmed : usernameToTest;
|
|
89
|
-
if (!cfg.usernameRegex.test(testValue)) {
|
|
90
|
-
return {
|
|
91
|
-
url: trimmed,
|
|
92
|
-
error: `Invalid ${platform} username. ${cfg.hint}`,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
return { url: cfg.buildUrl(usernameToTest), error: null };
|
|
96
|
-
}
|
|
97
|
-
export { PLATFORM_CONFIGS };
|
|
File without changes
|