@pagesolver/sdk 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -31,6 +31,12 @@ if (showcases.data) {
31
31
  console.log(showcases.data.showcases);
32
32
  }
33
33
 
34
+ // Get quick quotes
35
+ const quickQuotes = await client.getQuickQuotes();
36
+ if (quickQuotes.data) {
37
+ console.log(quickQuotes.data.quotes);
38
+ }
39
+
34
40
  // Send contact form
35
41
  const contactResult = await client.contact({
36
42
  name: "John Doe",
@@ -75,6 +81,15 @@ const result = await client.getShowcases();
75
81
  // Returns: ApiResponse<{ showcases: ShowcaseImage[] }>
76
82
  ```
77
83
 
84
+ ##### `getQuickQuotes()`
85
+
86
+ Retrieves all quick quotes for your business.
87
+
88
+ ```typescript
89
+ const result = await client.getQuickQuotes();
90
+ // Returns: ApiResponse<{ quotes: QuickQuote[] }>
91
+ ```
92
+
78
93
  ##### `contact(data: ContactData)`
79
94
 
80
95
  Sends a contact form submission.
@@ -96,11 +111,12 @@ const result = await client.contact({
96
111
  ```typescript
97
112
  interface ComparisonImage {
98
113
  id: string;
99
- url: string;
100
- title?: string;
101
- description?: string;
102
- createdAt: string;
103
- updatedAt: string;
114
+ businessId: string;
115
+ beforeUrl: string;
116
+ afterUrl: string;
117
+ description: string | null;
118
+ createdAt: Date;
119
+ title: string;
104
120
  }
105
121
  ```
106
122
 
@@ -109,11 +125,27 @@ interface ComparisonImage {
109
125
  ```typescript
110
126
  interface ShowcaseImage {
111
127
  id: string;
112
- url: string;
113
- title?: string;
114
- description?: string;
115
- createdAt: string;
116
- updatedAt: string;
128
+ businessId: string;
129
+ blobUrl: string[];
130
+ createdAt: Date;
131
+ description: string | null;
132
+ title: string;
133
+ }
134
+ ```
135
+
136
+ ### QuickQuote
137
+
138
+ ```typescript
139
+ interface QuickQuote {
140
+ id: string;
141
+ businessId: string;
142
+ parentId: string | null;
143
+ name: string;
144
+ description: string | null;
145
+ basePrice: string | null;
146
+ enabled: boolean;
147
+ createdAt: Date;
148
+ updatedAt: Date;
117
149
  }
118
150
  ```
119
151
 
@@ -157,33 +189,6 @@ if (result.error) {
157
189
  }
158
190
  ```
159
191
 
160
- ## Development
161
-
162
- ### Building
163
-
164
- ```bash
165
- bun run build
166
- ```
167
-
168
- ### Testing
169
-
170
- ```bash
171
- bun test
172
- ```
173
-
174
- ### Linting
175
-
176
- ```bash
177
- bun run lint
178
- bun run lint:fix
179
- ```
180
-
181
- ### Type Checking
182
-
183
- ```bash
184
- bun run type-check
185
- ```
186
-
187
192
  ## License
188
193
 
189
194
  MIT
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- class o{baseUrl="https://pagesolver.com/api/v1";businessKey;constructor(e){this.businessKey=e}async request(e,t={}){try{let n=`${this.baseUrl}${e}`,i={"Content-Type":"application/json","x-business-key":this.businessKey,...t.headers},s=await fetch(n,{...t,headers:i}),r;if(s.headers.get("Content-Type")?.includes("application/json"))r=await s.json();else r=await s.text();if(!s.ok)return{error:r?.error||"An unknown error occurred",status:s.status};return{data:r,status:s.status}}catch(n){return{error:n instanceof Error?n.message:"Network error",status:500}}}async getComparisons(){return this.request("/business/comparisons")}async getShowcases(){return this.request("/business/showcases")}async getQuickQuotes(){return this.request("/business/quick-quotes")}async createQuickQuote(e){return this.request("/business/quick-quotes",{method:"POST",body:JSON.stringify(e)})}async updateQuickQuote(e,t){return this.request(`/business/quick-quotes/${e}`,{method:"PUT",body:JSON.stringify(t)})}async deleteQuickQuote(e){return this.request(`/business/quick-quotes/${e}`,{method:"DELETE"})}async contact(e){return this.request("/business/contact",{method:"POST",body:JSON.stringify(e)})}}export{o as PageSolverClient};
1
+ class i{baseUrl="https://pagesolver.com/api/v1";businessKey;constructor(s){this.businessKey=s}async request(s,r={}){try{let t=`${this.baseUrl}${s}`,a={"Content-Type":"application/json","x-business-key":this.businessKey,...r.headers},e=await fetch(t,{...r,headers:a}),n;if(e.headers.get("Content-Type")?.includes("application/json"))n=await e.json();else n=await e.text();if(!e.ok)return{error:n?.error||"An unknown error occurred",status:e.status};return{data:n,status:e.status}}catch(t){return{error:t instanceof Error?t.message:"Network error",status:500}}}async getComparisons(){return this.request("/business/comparisons")}async getShowcases(){return this.request("/business/showcases")}async getQuickQuotes(){return this.request("/business/quick-quotes")}async contact(s){return this.request("/business/contact",{method:"POST",body:JSON.stringify(s)})}}export{i as PageSolverClient};
2
2
 
3
- //# debugId=5AFD190CD8D6E0B664756E2164756E21
3
+ //# debugId=7DE63FC008843B0364756E2164756E21
package/dist/index.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "// Database schema types\nexport interface ComparisonImage {\n id: string;\n businessId: string;\n beforeUrl: string;\n afterUrl: string;\n description: string | null;\n createdAt: Date;\n title: string;\n}\n\nexport interface ShowcaseImage {\n id: string;\n businessId: string;\n blobUrl: string[];\n createdAt: Date;\n description: string | null;\n title: string;\n}\n\nexport interface QuickQuote {\n id: string;\n businessId: string;\n parentId: string | null;\n name: string;\n description: string | null;\n basePrice: string | null;\n enabled: boolean;\n createdAt: Date;\n updatedAt: Date;\n}\n\ninterface ApiResponse<T> {\n data?: T;\n error?: string;\n status: number;\n}\n\ninterface ContactData {\n name: string;\n email: string;\n phone?: string;\n message?: string;\n}\n\ninterface ContactResponse {\n success: boolean;\n}\n\ninterface QuickQuoteRequestData {\n name: string;\n description?: string;\n basePrice?: string;\n parentId?: string;\n enabled?: boolean;\n}\n\nexport class PageSolverClient {\n private baseUrl = \"https://pagesolver.com/api/v1\";\n private businessKey: string;\n\n constructor(businessKey: string) {\n this.businessKey = businessKey;\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {}\n ): Promise<ApiResponse<T>> {\n try {\n const url = `${this.baseUrl}${endpoint}`;\n\n const headers = {\n \"Content-Type\": \"application/json\",\n \"x-business-key\": this.businessKey,\n ...options.headers,\n };\n\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n let data: unknown;\n const contentType = response.headers.get(\"Content-Type\");\n if (contentType?.includes(\"application/json\")) {\n data = await response.json();\n } else {\n data = await response.text();\n }\n\n if (!response.ok) {\n return {\n error:\n (data as { error?: string })?.error || \"An unknown error occurred\",\n status: response.status,\n };\n }\n\n return {\n data: data as T,\n status: response.status,\n };\n } catch (error) {\n return {\n error: error instanceof Error ? error.message : \"Network error\",\n status: 500,\n };\n }\n }\n\n // Comparison Images\n async getComparisons(): Promise<\n ApiResponse<{ comparisons: ComparisonImage[] }>\n > {\n return this.request<{ comparisons: ComparisonImage[] }>(\n \"/business/comparisons\"\n );\n }\n\n // Showcase Images\n async getShowcases(): Promise<ApiResponse<{ showcases: ShowcaseImage[] }>> {\n return this.request<{ showcases: ShowcaseImage[] }>(\"/business/showcases\");\n }\n\n // Quick Quotes\n async getQuickQuotes(): Promise<ApiResponse<{ quotes: QuickQuote[] }>> {\n return this.request<{ quotes: QuickQuote[] }>(\"/business/quick-quotes\");\n }\n\n async createQuickQuote(\n data: QuickQuoteRequestData\n ): Promise<ApiResponse<QuickQuote>> {\n return this.request<QuickQuote>(\"/business/quick-quotes\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n\n async updateQuickQuote(\n id: string,\n data: Partial<QuickQuoteRequestData>\n ): Promise<ApiResponse<QuickQuote>> {\n return this.request<QuickQuote>(`/business/quick-quotes/${id}`, {\n method: \"PUT\",\n body: JSON.stringify(data),\n });\n }\n\n async deleteQuickQuote(\n id: string\n ): Promise<ApiResponse<{ success: boolean }>> {\n return this.request<{ success: boolean }>(`/business/quick-quotes/${id}`, {\n method: \"DELETE\",\n });\n }\n\n // Contact\n async contact(data: ContactData): Promise<ApiResponse<ContactResponse>> {\n return this.request<ContactResponse>(\"/business/contact\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n}\n\n// Export types for consumers\nexport type {\n ApiResponse,\n ContactData,\n ContactResponse,\n QuickQuoteRequestData,\n};\n"
5
+ "// Database schema types\nexport interface ComparisonImage {\n id: string;\n businessId: string;\n beforeUrl: string;\n afterUrl: string;\n description: string | null;\n createdAt: Date;\n title: string;\n}\n\nexport interface ShowcaseImage {\n id: string;\n businessId: string;\n blobUrl: string[];\n createdAt: Date;\n description: string | null;\n title: string;\n}\n\nexport interface QuickQuote {\n id: string;\n businessId: string;\n parentId: string | null;\n name: string;\n description: string | null;\n basePrice: string | null;\n enabled: boolean;\n createdAt: Date;\n updatedAt: Date;\n}\n\ninterface ApiResponse<T> {\n data?: T;\n error?: string;\n status: number;\n}\n\ninterface ContactData {\n name: string;\n email: string;\n phone?: string;\n message?: string;\n}\n\ninterface ContactResponse {\n success: boolean;\n}\n\nexport class PageSolverClient {\n private baseUrl = \"https://pagesolver.com/api/v1\";\n private businessKey: string;\n\n constructor(businessKey: string) {\n this.businessKey = businessKey;\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {}\n ): Promise<ApiResponse<T>> {\n try {\n const url = `${this.baseUrl}${endpoint}`;\n\n const headers = {\n \"Content-Type\": \"application/json\",\n \"x-business-key\": this.businessKey,\n ...options.headers,\n };\n\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n let data: unknown;\n const contentType = response.headers.get(\"Content-Type\");\n if (contentType?.includes(\"application/json\")) {\n data = await response.json();\n } else {\n data = await response.text();\n }\n\n if (!response.ok) {\n return {\n error:\n (data as { error?: string })?.error || \"An unknown error occurred\",\n status: response.status,\n };\n }\n\n return {\n data: data as T,\n status: response.status,\n };\n } catch (error) {\n return {\n error: error instanceof Error ? error.message : \"Network error\",\n status: 500,\n };\n }\n }\n\n // Comparison Images\n async getComparisons(): Promise<\n ApiResponse<{ comparisons: ComparisonImage[] }>\n > {\n return this.request<{ comparisons: ComparisonImage[] }>(\n \"/business/comparisons\"\n );\n }\n\n // Showcase Images\n async getShowcases(): Promise<ApiResponse<{ showcases: ShowcaseImage[] }>> {\n return this.request<{ showcases: ShowcaseImage[] }>(\"/business/showcases\");\n }\n\n // Quick Quotes\n async getQuickQuotes(): Promise<ApiResponse<{ quotes: QuickQuote[] }>> {\n return this.request<{ quotes: QuickQuote[] }>(\"/business/quick-quotes\");\n }\n\n // Contact\n async contact(data: ContactData): Promise<ApiResponse<ContactResponse>> {\n return this.request<ContactResponse>(\"/business/contact\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n }\n}\n\n// Export types for consumers\nexport type { ApiResponse, ContactData, ContactResponse };\n"
6
6
  ],
7
- "mappings": "AAyDO,MAAM,CAAiB,CACpB,QAAU,gCACV,YAER,WAAW,CAAC,EAAqB,CAC/B,KAAK,YAAc,OAGP,QAAU,CACtB,EACA,EAAuB,CAAC,EACC,CACzB,GAAI,CACF,IAAM,EAAM,GAAG,KAAK,UAAU,IAExB,EAAU,CACd,eAAgB,mBAChB,iBAAkB,KAAK,eACpB,EAAQ,OACb,EAEM,EAAW,MAAM,MAAM,EAAK,IAC7B,EACH,SACF,CAAC,EAEG,EAEJ,GADoB,EAAS,QAAQ,IAAI,cAAc,GACtC,SAAS,kBAAkB,EAC1C,EAAO,MAAM,EAAS,KAAK,EAE3B,OAAO,MAAM,EAAS,KAAK,EAG7B,IAAK,EAAS,GACZ,MAAO,CACL,MACG,GAA6B,OAAS,4BACzC,OAAQ,EAAS,MACnB,EAGF,MAAO,CACL,KAAM,EACN,OAAQ,EAAS,MACnB,EACA,MAAO,EAAO,CACd,MAAO,CACL,MAAO,aAAiB,MAAQ,EAAM,QAAU,gBAChD,OAAQ,GACV,QAKE,eAAc,EAElB,CACA,OAAO,KAAK,QACV,uBACF,OAII,aAAY,EAAyD,CACzE,OAAO,KAAK,QAAwC,qBAAqB,OAIrE,eAAc,EAAmD,CACrE,OAAO,KAAK,QAAkC,wBAAwB,OAGlE,iBAAgB,CACpB,EACkC,CAClC,OAAO,KAAK,QAAoB,yBAA0B,CACxD,OAAQ,OACR,KAAM,KAAK,UAAU,CAAI,CAC3B,CAAC,OAGG,iBAAgB,CACpB,EACA,EACkC,CACl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AAI,CAC3B,CAAC,EAEL",
8
+ "debugId": "7DE63FC008843B0364756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagesolver/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Official SDK for PageSolver API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",