@pagesolver/sdk 1.3.1 → 1.3.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/README.md +61 -113
- package/dist/types.d.ts +1 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,28 +27,23 @@ console.log(comparisons); // ComparisonImage[]
|
|
|
27
27
|
const showcases = await client.getShowcases();
|
|
28
28
|
console.log(showcases); // ShowcaseImage[]
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
// Google Business Profile data
|
|
31
|
+
const reviews = await client.getGoogleReviews();
|
|
32
|
+
const hours = await client.getGoogleHours();
|
|
33
33
|
|
|
34
|
-
//
|
|
35
|
-
const
|
|
34
|
+
// Latest social posts
|
|
35
|
+
const instagram = await client.getInstagramPosts();
|
|
36
|
+
const facebook = await client.getFacebookPosts();
|
|
37
|
+
|
|
38
|
+
// Smart contact submissions (any flat JSON payload works)
|
|
39
|
+
const contact = await client.contact({
|
|
36
40
|
name: "John Doe",
|
|
37
41
|
email: "john@example.com",
|
|
38
|
-
|
|
42
|
+
service: "Detailing",
|
|
43
|
+
requested_date: "2025-03-10",
|
|
39
44
|
});
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
console.log("Contact form sent successfully!");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Error handling with try/catch
|
|
46
|
-
try {
|
|
47
|
-
const comparisons = await client.getComparisons();
|
|
48
|
-
console.log(`Found ${comparisons.length} comparisons`);
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.error("Failed to get comparisons:", error.message);
|
|
51
|
-
}
|
|
46
|
+
console.log(contact.success, contact.contactId);
|
|
52
47
|
```
|
|
53
48
|
|
|
54
49
|
## API Reference
|
|
@@ -65,129 +60,82 @@ new PageSolverClient(businessKey: string)
|
|
|
65
60
|
|
|
66
61
|
#### Methods
|
|
67
62
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
##### `getShowcases()`
|
|
63
|
+
| Method | Description | Return Type |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `getComparisons()` | Fetch before/after comparison images | `ComparisonImage[]` |
|
|
66
|
+
| `getShowcases()` | Fetch showcase gallery images | `ShowcaseImage[]` |
|
|
67
|
+
| `getGoogleReviews()` | Fetch Google Business Profile reviews + metadata | `GoogleReviewsResponse` |
|
|
68
|
+
| `getGoogleHours()` | Fetch Google Business Profile opening hours | `GoogleHoursResponse` |
|
|
69
|
+
| `getInstagramPosts()` | Fetch recent Instagram posts (requires connected account) | `SocialMediaResponse` |
|
|
70
|
+
| `getFacebookPosts()` | Fetch recent Facebook posts (requires connected account) | `SocialMediaResponse` |
|
|
71
|
+
| `contact(data)` | Submit a contact form payload (flat JSON object) | `ContactResponse`
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
All methods throw an `Error` when the API responds with a non-2xx status, so wrap calls in `try/catch` if you want to handle failures gracefully.
|
|
80
74
|
|
|
81
75
|
```typescript
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Retrieves all quick quotes for your business.
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
const quotes = await client.getQuickQuotes();
|
|
92
|
-
// Returns: QuickQuote[]
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
##### `contact(data: ContactData)`
|
|
96
|
-
|
|
97
|
-
Sends a contact form submission.
|
|
76
|
+
try {
|
|
77
|
+
const comparisons = await client.getComparisons();
|
|
78
|
+
console.log(`Found ${comparisons.length} comparisons`);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error("Failed to load comparisons", error);
|
|
81
|
+
}
|
|
98
82
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
83
|
+
const contact = await client.contact({
|
|
84
|
+
name: "Fresh & Clean",
|
|
85
|
+
phone: "+1 555-0100",
|
|
86
|
+
message: "Need a quote",
|
|
87
|
+
source: "website-landing",
|
|
88
|
+
budget: 250,
|
|
105
89
|
});
|
|
106
|
-
|
|
90
|
+
|
|
91
|
+
console.log(contact.message); // "Contact submission received successfully"
|
|
107
92
|
```
|
|
108
93
|
|
|
109
94
|
## Types
|
|
110
95
|
|
|
111
|
-
###
|
|
96
|
+
### Notable Types
|
|
112
97
|
|
|
113
98
|
```typescript
|
|
114
99
|
interface ComparisonImage {
|
|
115
100
|
id: string;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
description: string | null;
|
|
120
|
-
createdAt: Date;
|
|
101
|
+
business_id: number;
|
|
102
|
+
before_url: string;
|
|
103
|
+
after_url: string;
|
|
121
104
|
title: string;
|
|
105
|
+
description: string | null;
|
|
106
|
+
updated_at: string;
|
|
107
|
+
created_at: string;
|
|
122
108
|
}
|
|
123
|
-
```
|
|
124
109
|
|
|
125
|
-
### ShowcaseImage
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
110
|
interface ShowcaseImage {
|
|
129
111
|
id: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
createdAt: Date;
|
|
133
|
-
description: string | null;
|
|
112
|
+
business_id: number;
|
|
113
|
+
image_url: string[];
|
|
134
114
|
title: string;
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### QuickQuote
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
interface QuickQuote {
|
|
142
|
-
id: string;
|
|
143
|
-
businessId: string;
|
|
144
|
-
parentId: string | null;
|
|
145
|
-
name: string;
|
|
146
115
|
description: string | null;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
createdAt: Date;
|
|
150
|
-
updatedAt: Date;
|
|
116
|
+
updated_at: string;
|
|
117
|
+
created_at: string;
|
|
151
118
|
}
|
|
152
|
-
```
|
|
153
119
|
|
|
154
|
-
|
|
120
|
+
type ContactData = Record<string, unknown>; // any flat key/value payload
|
|
155
121
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
phone?: string;
|
|
161
|
-
message?: string;
|
|
122
|
+
interface ContactResponse {
|
|
123
|
+
success: boolean;
|
|
124
|
+
message: string;
|
|
125
|
+
contactId: string | null;
|
|
162
126
|
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### ApiResponse
|
|
166
127
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
128
|
+
interface GoogleReviewsResponse {
|
|
129
|
+
business: BusinessInfo; // includes id, name, optional website/phone
|
|
130
|
+
rating: number | null;
|
|
131
|
+
totalReviews: number;
|
|
132
|
+
reviews: GoogleReview[];
|
|
172
133
|
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Error Handling
|
|
176
|
-
|
|
177
|
-
All methods return an `ApiResponse<T>` object that contains either:
|
|
178
|
-
|
|
179
|
-
- `data`: The successful response data
|
|
180
|
-
- `error`: An error message if the request failed
|
|
181
|
-
- `status`: HTTP status code
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
const result = await client.getComparisons();
|
|
185
134
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
console.log("Success:", result.data);
|
|
135
|
+
interface SocialMediaResponse {
|
|
136
|
+
business: BusinessInfo;
|
|
137
|
+
posts: FacebookPost[] | InstagramPost[];
|
|
138
|
+
platform: "facebook" | "instagram";
|
|
191
139
|
}
|
|
192
140
|
```
|
|
193
141
|
|
package/dist/types.d.ts
CHANGED
|
@@ -30,12 +30,7 @@ export interface ShowcaseImage {
|
|
|
30
30
|
export interface ShowcasesResponse {
|
|
31
31
|
showcases: ShowcaseImage[];
|
|
32
32
|
}
|
|
33
|
-
export
|
|
34
|
-
name: string;
|
|
35
|
-
email: string;
|
|
36
|
-
phone?: string;
|
|
37
|
-
message?: string;
|
|
38
|
-
}
|
|
33
|
+
export type ContactData = Record<string, unknown>;
|
|
39
34
|
export interface ContactResponse {
|
|
40
35
|
success: boolean;
|
|
41
36
|
message: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAGD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;AAGD,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"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