@pagesolver/sdk 1.1.0 → 1.2.2
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 +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface ComparisonImage {
|
|
2
2
|
id: string;
|
|
3
|
-
|
|
3
|
+
clientId: number;
|
|
4
4
|
beforeUrl: string;
|
|
5
5
|
afterUrl: string;
|
|
6
6
|
description: string | null;
|
|
@@ -9,7 +9,7 @@ export interface ComparisonImage {
|
|
|
9
9
|
}
|
|
10
10
|
export interface ShowcaseImage {
|
|
11
11
|
id: string;
|
|
12
|
-
|
|
12
|
+
clientId: number;
|
|
13
13
|
blobUrl: string[];
|
|
14
14
|
createdAt: Date;
|
|
15
15
|
description: string | null;
|
|
@@ -17,7 +17,7 @@ export interface ShowcaseImage {
|
|
|
17
17
|
}
|
|
18
18
|
export interface QuickQuote {
|
|
19
19
|
id: string;
|
|
20
|
-
|
|
20
|
+
clientId: number;
|
|
21
21
|
parentId: string | null;
|
|
22
22
|
name: string;
|
|
23
23
|
description: string | null;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EA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.map
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"// Database schema types\nexport interface ComparisonImage {\n id: string;\n
|
|
5
|
+
"// Database schema types\nexport interface ComparisonImage {\n id: string;\n clientId: number;\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 clientId: number;\n blobUrl: string[];\n createdAt: Date;\n description: string | null;\n title: string;\n}\n\nexport interface QuickQuote {\n id: string;\n clientId: number;\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<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 const errorMessage =\n (data as { error?: string })?.error || \"An unknown error occurred\";\n throw new Error(`API Error (${response.status}): ${errorMessage}`);\n }\n\n return data as T;\n } catch (error) {\n if (error instanceof Error) {\n throw error;\n }\n throw new Error(\"Network error occurred\");\n }\n }\n\n // Comparison Images\n async getComparisons(): Promise<ComparisonImage[]> {\n const response = await this.request<{ comparisons: ComparisonImage[] }>(\n \"/business/comparisons\"\n );\n return response.comparisons;\n }\n\n // Showcase Images\n async getShowcases(): Promise<ShowcaseImage[]> {\n const response = await this.request<{ showcases: ShowcaseImage[] }>(\n \"/business/showcases\"\n );\n return response.showcases;\n }\n\n // Quick Quotes\n async getQuickQuotes(): Promise<QuickQuote[]> {\n const response = await this.request<{ quotes: QuickQuote[] }>(\n \"/business/quick-quotes\"\n );\n return response.quotes;\n }\n\n // Contact\n async contact(data: ContactData): Promise<boolean> {\n const response = await this.request<ContactResponse>(\"/business/contact\", {\n method: \"POST\",\n body: JSON.stringify(data),\n });\n return response.success;\n }\n}\n\n// Export types for consumers\nexport type { ContactData, ContactResponse };\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": "AAiDO,MAAM,CAAiB,CACpB,QAAU,gCACV,YAER,WAAW,CAAC,EAAqB,CAC/B,KAAK,YAAc,OAGP,QAAU,CACtB,EACA,EAAuB,CAAC,EACZ,CACZ,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,GAAI,CAChB,IAAM,EACH,GAA6B,OAAS,4BACzC,MAAM,IAAI,MAAM,cAAc,EAAS,YAAY,GAAc,EAGnE,OAAO,EACP,MAAO,EAAO,CACd,GAAI,aAAiB,MACnB,MAAM,EAER,MAAM,IAAI,MAAM,wBAAwB,QAKtC,eAAc,EAA+B,CAIjD,OAHiB,MAAM,KAAK,QAC1B,uBACF,GACgB,iBAIZ,aAAY,EAA6B,CAI7C,OAHiB,MAAM,KAAK,QAC1B,qBACF,GACgB,eAIZ,eAAc,EAA0B,CAI5C,OAHiB,MAAM,KAAK,QAC1B,wBACF,GACgB,YAIZ,QAAO,CAAC,EAAqC,CAKjD,OAJiB,MAAM,KAAK,QAAyB,oBAAqB,CACxE,OAAQ,OACR,KAAM,KAAK,UAAU,CAAI,CAC3B,CAAC,GACe,QAEpB",
|
|
8
8
|
"debugId": "BD13C04526AB4A5864756E2164756E21",
|