@quicktalog/common 1.0.0 → 1.1.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.
@@ -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,3 @@
1
+ npm version minor
2
+ git add .
3
+ git commit -m "updated version"
package/dist/helpers.js CHANGED
@@ -29,4 +29,3 @@ const generateUniqueSlug = (name) => {
29
29
  return slug;
30
30
  };
31
31
  exports.generateUniqueSlug = generateUniqueSlug;
32
- // npm publish --access public
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.0.0",
3
+ "version": "1.1.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
- try {
3
- const res = await fetch(
4
- `https://api.unsplash.com/search/photos?page=1&per_page=1&query=${encodeURIComponent(query)}`,
5
- {
6
- headers: {
7
- Authorization: `Client-ID ${process.env.UNSPLASH_API_KEY}`,
8
- },
9
- },
10
- );
11
-
12
- const data = await res.json();
13
-
14
- if (data?.results?.[0]?.urls?.regular) {
15
- return data.results[0].urls.regular;
16
- }
17
- } catch (err) {
18
- console.error(`Failed to fetch image for "${query}":`, err);
19
- }
20
-
21
- return "https://static1.squarespace.com/static/5898e29c725e25e7132d5a5a/58aa11bc9656ca13c4524c68/58aa11e99656ca13c45253e2/1487540713345/600x400-Image-Placeholder.jpg?format=original";
22
- }
23
-
24
- export const generateUniqueSlug = (name: string) => {
25
- const slug = name
26
- .toLowerCase()
27
- .trim()
28
- .replace(/\s+/g, "-")
29
- .replace(/-+/g, "-")
30
- .replace(/^-|-$/g, "");
31
-
32
- return slug;
33
- };
34
-
35
- // npm publish --access public
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
- accepted: boolean;
7
- essential: boolean;
8
- analytics: boolean;
9
- marketing: boolean;
10
- timestamp: string;
11
- version: string;
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
- name: string;
16
- description: string;
17
- price: number;
18
- image: string;
15
+ name: string;
16
+ description: string;
17
+ price: number;
18
+ image: string;
19
19
  };
20
20
 
21
21
  export type Theme = {
22
- key: string;
23
- label: string;
24
- image: string;
25
- description: string;
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
- order: number;
35
- name: string;
36
- layout: LayoutVariant;
37
- items: CategoryItem[];
34
+ order: number;
35
+ name: string;
36
+ layout: LayoutVariant;
37
+ items: CategoryItem[];
38
38
  };
39
39
  export type Catalogue = {
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;
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
- name?: string;
70
- address?: string;
71
- terms_and_conditions?: string;
72
- privacy_policy?: string;
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
- name: string;
77
- logo: string;
78
- description: string;
79
- rating: number;
80
- url?: string;
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
- ctaNavbar?: {
85
- enabled: boolean;
86
- label: string;
87
- url: string;
88
- };
89
- ctaFooter?: {
90
- enabled: boolean;
91
- label: string;
92
- url: string;
93
- };
94
- newsletter?: {
95
- enabled: boolean;
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
- date: string;
101
- current_url: string;
102
- pageview_count: number;
103
- unique_visitors: number;
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
- id: string;
108
- email: string | null;
109
- name: string | null;
110
- created_at: string;
111
- image: string | null;
112
- cookie_preferences?: CookiePreferences | null;
113
- plan_id: string | null;
114
- customer_id: string | null;
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
- id: string;
119
- file: File;
120
- originalUrl: string;
121
- confidence?: number;
122
- isProcessed: boolean;
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
- type: string;
127
- value: string;
119
+ type: string;
120
+ value: string;
128
121
  };
129
122
 
130
123
  export type Usage = {
131
- traffic: { pageview_count: number; unique_visitors: number };
132
- ocr: number;
133
- prompts: number;
134
- catalogues: number;
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
- usage: Usage;
139
- currentPlan: PricingPlan;
140
- nextPlan: PricingPlan;
131
+ usage: Usage;
132
+ currentPlan: PricingPlan;
133
+ nextPlan: PricingPlan;
141
134
  };
142
135
 
143
136
  export type PricingPlan = {
144
- id: number;
145
- name: string;
146
- type: string;
147
- priceId: {
148
- month: string;
149
- year: string;
150
- };
151
- description: string;
152
- features: {
153
- support: string;
154
- catalogues: number;
155
- newsletter: boolean;
156
- custom_features: boolean;
157
- ocr_ai_import: number;
158
- traffic_limit: number;
159
- branding: boolean;
160
- analytics: string;
161
- ai_prompts: number;
162
- categories_per_catalogue?: number | "unlimited";
163
- items_per_catalogue?: number | "unlimited";
164
- };
165
- billing_period?: "month" | "year";
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
- message: string;
170
- email: string;
171
- name: string;
172
- subject: string;
162
+ message: string;
163
+ email: string;
164
+ name: string;
165
+ subject: string;
173
166
  };