@quicktalog/common 1.0.0 → 1.2.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/.github/workflows/publish.yaml +31 -0
- package/.husky/pre-commit +1 -0
- package/dist/helpers.js +0 -1
- package/dist/types.d.ts +0 -6
- package/package.json +4 -2
- package/src/helpers.ts +35 -35
- package/src/types.ts +109 -116
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main # or 'release' if you prefer
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Setup Node.js
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: 22
|
|
20
|
+
registry-url: "https://registry.npmjs.org/"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
|
|
25
|
+
- name: Build (optional)
|
|
26
|
+
run: npm run build --if-present
|
|
27
|
+
|
|
28
|
+
- name: Publish package
|
|
29
|
+
run: npm publish --access public
|
|
30
|
+
env:
|
|
31
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm version minor
|
package/dist/helpers.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -49,12 +49,6 @@ export type Catalogue = {
|
|
|
49
49
|
source?: string;
|
|
50
50
|
};
|
|
51
51
|
export type ServicesFormData = Omit<Catalogue, "id" | "created_by" | "">;
|
|
52
|
-
export type Service = {
|
|
53
|
-
name: string;
|
|
54
|
-
image: string;
|
|
55
|
-
price: number | string;
|
|
56
|
-
description: string;
|
|
57
|
-
};
|
|
58
52
|
export type Legal = {
|
|
59
53
|
name?: string;
|
|
60
54
|
address?: string;
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicktalog/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "tsc"
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"prepare": "husky install"
|
|
8
9
|
},
|
|
9
10
|
"devDependencies": {
|
|
11
|
+
"husky": "^9.1.7",
|
|
10
12
|
"typescript": "^5.1.6"
|
|
11
13
|
},
|
|
12
14
|
"dependencies": {
|
package/src/helpers.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export async function fetchImageFromUnsplash(query: string): Promise<string> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
export async function fetchImageFromUnsplash(query: string): Promise<string> {
|
|
2
|
+
try {
|
|
3
|
+
const res = await fetch(
|
|
4
|
+
`https://api.unsplash.com/search/photos?page=1&per_page=1&query=${encodeURIComponent(
|
|
5
|
+
query
|
|
6
|
+
)}`,
|
|
7
|
+
{
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: `Client-ID ${process.env.UNSPLASH_API_KEY}`,
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const data = await res.json();
|
|
15
|
+
|
|
16
|
+
if (data?.results?.[0]?.urls?.regular) {
|
|
17
|
+
return data.results[0].urls.regular;
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error(`Failed to fetch image for "${query}":`, err);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return "https://static1.squarespace.com/static/5898e29c725e25e7132d5a5a/58aa11bc9656ca13c4524c68/58aa11e99656ca13c45253e2/1487540713345/600x400-Image-Placeholder.jpg?format=original";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const generateUniqueSlug = (name: string) => {
|
|
27
|
+
const slug = name
|
|
28
|
+
.toLowerCase()
|
|
29
|
+
.trim()
|
|
30
|
+
.replace(/\s+/g, "-")
|
|
31
|
+
.replace(/-+/g, "-")
|
|
32
|
+
.replace(/^-|-$/g, "");
|
|
33
|
+
|
|
34
|
+
return slug;
|
|
35
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -3,26 +3,26 @@ import { layouts, themes } from "./constants";
|
|
|
3
3
|
export type Status = "active" | "inactive" | "draft";
|
|
4
4
|
|
|
5
5
|
export type CookiePreferences = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
accepted: boolean;
|
|
7
|
+
essential: boolean;
|
|
8
|
+
analytics: boolean;
|
|
9
|
+
marketing: boolean;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
version: string;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export type CategoryItem = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
price: number;
|
|
18
|
+
image: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export type Theme = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
key: string;
|
|
23
|
+
label: string;
|
|
24
|
+
image: string;
|
|
25
|
+
description: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export type Layout = Theme;
|
|
@@ -31,143 +31,136 @@ export type ThemeVariant = (typeof themes)[number]["key"];
|
|
|
31
31
|
export type LayoutVariant = (typeof layouts)[number]["key"];
|
|
32
32
|
|
|
33
33
|
export type CatalogueCategory = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
order: number;
|
|
35
|
+
name: string;
|
|
36
|
+
layout: LayoutVariant;
|
|
37
|
+
items: CategoryItem[];
|
|
38
38
|
};
|
|
39
39
|
export type Catalogue = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
id?: string;
|
|
41
|
+
name: string;
|
|
42
|
+
status: Status;
|
|
43
|
+
created_by?: string;
|
|
44
|
+
theme: ThemeVariant;
|
|
45
|
+
logo?: string;
|
|
46
|
+
title: string;
|
|
47
|
+
currency: string;
|
|
48
|
+
contact?: ContactInfo[];
|
|
49
|
+
subtitle?: string;
|
|
50
|
+
services: CatalogueCategory[];
|
|
51
|
+
partners?: Partner[];
|
|
52
|
+
legal?: Legal;
|
|
53
|
+
configuration?: Configuration;
|
|
54
|
+
created_at?: string;
|
|
55
|
+
updated_at?: string;
|
|
56
|
+
source?: string;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
export type ServicesFormData = Omit<Catalogue, "id" | "created_by" | "">;
|
|
60
60
|
|
|
61
|
-
export type Service = {
|
|
62
|
-
name: string;
|
|
63
|
-
image: string;
|
|
64
|
-
price: number | string;
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
61
|
export type Legal = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
name?: string;
|
|
63
|
+
address?: string;
|
|
64
|
+
terms_and_conditions?: string;
|
|
65
|
+
privacy_policy?: string;
|
|
73
66
|
};
|
|
74
67
|
|
|
75
68
|
export type Partner = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
name: string;
|
|
70
|
+
logo: string;
|
|
71
|
+
description: string;
|
|
72
|
+
rating: number;
|
|
73
|
+
url?: string;
|
|
81
74
|
};
|
|
82
75
|
|
|
83
76
|
export type Configuration = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
ctaNavbar?: {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
label: string;
|
|
80
|
+
url: string;
|
|
81
|
+
};
|
|
82
|
+
ctaFooter?: {
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
label: string;
|
|
85
|
+
url: string;
|
|
86
|
+
};
|
|
87
|
+
newsletter?: {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
};
|
|
97
90
|
};
|
|
98
91
|
|
|
99
92
|
export type Analytics = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
date: string;
|
|
94
|
+
current_url: string;
|
|
95
|
+
pageview_count: number;
|
|
96
|
+
unique_visitors: number;
|
|
104
97
|
};
|
|
105
98
|
|
|
106
99
|
export type User = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
id: string;
|
|
101
|
+
email: string | null;
|
|
102
|
+
name: string | null;
|
|
103
|
+
created_at: string;
|
|
104
|
+
image: string | null;
|
|
105
|
+
cookie_preferences?: CookiePreferences | null;
|
|
106
|
+
plan_id: string | null;
|
|
107
|
+
customer_id: string | null;
|
|
115
108
|
};
|
|
116
109
|
|
|
117
110
|
export type OCRImageData = {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
id: string;
|
|
112
|
+
file: File;
|
|
113
|
+
originalUrl: string;
|
|
114
|
+
confidence?: number;
|
|
115
|
+
isProcessed: boolean;
|
|
123
116
|
};
|
|
124
117
|
|
|
125
118
|
export type ContactInfo = {
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
type: string;
|
|
120
|
+
value: string;
|
|
128
121
|
};
|
|
129
122
|
|
|
130
123
|
export type Usage = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
traffic: { pageview_count: number; unique_visitors: number };
|
|
125
|
+
ocr: number;
|
|
126
|
+
prompts: number;
|
|
127
|
+
catalogues: number;
|
|
135
128
|
};
|
|
136
129
|
|
|
137
130
|
export type UserData = User & {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
usage: Usage;
|
|
132
|
+
currentPlan: PricingPlan;
|
|
133
|
+
nextPlan: PricingPlan;
|
|
141
134
|
};
|
|
142
135
|
|
|
143
136
|
export type PricingPlan = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
137
|
+
id: number;
|
|
138
|
+
name: string;
|
|
139
|
+
type: string;
|
|
140
|
+
priceId: {
|
|
141
|
+
month: string;
|
|
142
|
+
year: string;
|
|
143
|
+
};
|
|
144
|
+
description: string;
|
|
145
|
+
features: {
|
|
146
|
+
support: string;
|
|
147
|
+
catalogues: number;
|
|
148
|
+
newsletter: boolean;
|
|
149
|
+
custom_features: boolean;
|
|
150
|
+
ocr_ai_import: number;
|
|
151
|
+
traffic_limit: number;
|
|
152
|
+
branding: boolean;
|
|
153
|
+
analytics: string;
|
|
154
|
+
ai_prompts: number;
|
|
155
|
+
categories_per_catalogue?: number | "unlimited";
|
|
156
|
+
items_per_catalogue?: number | "unlimited";
|
|
157
|
+
};
|
|
158
|
+
billing_period?: "month" | "year";
|
|
166
159
|
};
|
|
167
160
|
|
|
168
161
|
export type ContactData = {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
message: string;
|
|
163
|
+
email: string;
|
|
164
|
+
name: string;
|
|
165
|
+
subject: string;
|
|
173
166
|
};
|