@pagesolver/sdk 1.1.0 → 1.2.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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface ComparisonImage {
2
2
  id: string;
3
- businessId: string;
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
- businessId: string;
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
- businessId: string;
20
+ clientId: number;
21
21
  parentId: string | null;
22
22
  name: string;
23
23
  description: string | null;
@@ -37,8 +37,8 @@ interface ContactResponse {
37
37
  }
38
38
  export declare class PageSolverClient {
39
39
  private baseUrl;
40
- private businessKey;
41
- constructor(businessKey: string);
40
+ private clientKey;
41
+ constructor(clientKey: string);
42
42
  private request;
43
43
  getComparisons(): Promise<ComparisonImage[]>;
44
44
  getShowcases(): Promise<ShowcaseImage[]>;
@@ -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,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAA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C;CAOnD;AAGD,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- class i{baseUrl="https://pagesolver.com/api/v1";businessKey;constructor(e){this.businessKey=e}async request(e,n={}){try{let t=`${this.baseUrl}${e}`,o={"Content-Type":"application/json","x-business-key":this.businessKey,...n.headers},s=await fetch(t,{...n,headers:o}),r;if(s.headers.get("Content-Type")?.includes("application/json"))r=await s.json();else r=await s.text();if(!s.ok){let a=r?.error||"An unknown error occurred";throw new Error(`API Error (${s.status}): ${a}`)}return r}catch(t){if(t instanceof Error)throw t;throw new Error("Network error occurred")}}async getComparisons(){return(await this.request("/business/comparisons")).comparisons}async getShowcases(){return(await this.request("/business/showcases")).showcases}async getQuickQuotes(){return(await this.request("/business/quick-quotes")).quotes}async contact(e){return(await this.request("/business/contact",{method:"POST",body:JSON.stringify(e)})).success}}export{i as PageSolverClient};
1
+ class i{baseUrl="https://pagesolver.com/api/v1";clientKey;constructor(e){this.clientKey=e}async request(e,n={}){try{let s=`${this.baseUrl}${e}`,o={"Content-Type":"application/json","x-client-key":this.clientKey,...n.headers},t=await fetch(s,{...n,headers:o}),r;if(t.headers.get("Content-Type")?.includes("application/json"))r=await t.json();else r=await t.text();if(!t.ok){let a=r?.error||"An unknown error occurred";throw new Error(`API Error (${t.status}): ${a}`)}return r}catch(s){if(s instanceof Error)throw s;throw new Error("Network error occurred")}}async getComparisons(){return(await this.request("/business/comparisons")).comparisons}async getShowcases(){return(await this.request("/business/showcases")).showcases}async getQuickQuotes(){return(await this.request("/business/quick-quotes")).quotes}async contact(e){return(await this.request("/business/contact",{method:"POST",body:JSON.stringify(e)})).success}}export{i as PageSolverClient};
2
2
 
3
- //# debugId=BD13C04526AB4A5864756E2164756E21
3
+ //# debugId=70BDE78DFE427A1064756E2164756E21
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\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"
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 clientKey: string;\n\n constructor(clientKey: string) {\n this.clientKey = clientKey;\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-client-key\": this.clientKey,\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
- "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,i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CAAI,CAC3B,CAAC,GACe,QAEpB",
8
+ "debugId": "70BDE78DFE427A1064756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagesolver/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Official SDK for PageSolver API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",