@revova/hydrogen 1.0.0 → 1.0.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 +136 -88
- package/dist/index.cjs +102 -117
- package/dist/index.d.cts +59 -58
- package/dist/index.d.ts +59 -58
- package/dist/index.js +101 -117
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type ReviewWidgetProps = {
|
|
4
|
-
proxyUrl: string;
|
|
5
|
-
productId: string;
|
|
6
|
-
locale?: string;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
showForm?: boolean;
|
|
9
|
-
starColor?: string;
|
|
10
|
-
className?: string;
|
|
11
|
-
};
|
|
12
|
-
declare function ReviewWidget({ proxyUrl, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
13
|
-
|
|
14
3
|
type ReviewMedia = {
|
|
15
4
|
url: string;
|
|
16
5
|
mimeType: string;
|
|
@@ -162,16 +151,31 @@ type HelpfulVoteResponse = {
|
|
|
162
151
|
helpfulCount: number;
|
|
163
152
|
};
|
|
164
153
|
type SortKey = 'recent' | 'helpful' | 'rating_high' | 'rating_low';
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Credentials required by every public component and hook.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* const creds = {
|
|
159
|
+
* apiUrl: env.PUBLIC_REVOVA_API_URL, // e.g. "https://yourapp.trycloudflare.com"
|
|
160
|
+
* shop: env.PUBLIC_STORE_DOMAIN, // e.g. "yourstore.myshopify.com"
|
|
161
|
+
* apiToken: env.PUBLIC_REVOVA_API_TOKEN, // Bearer token
|
|
162
|
+
* };
|
|
163
|
+
*
|
|
164
|
+
* <ReviewWidget {...creds} productId={product.id} />
|
|
165
|
+
*/
|
|
166
|
+
type ApiProps = {
|
|
167
|
+
apiUrl: string;
|
|
168
|
+
shop: string;
|
|
169
|
+
apiToken: string;
|
|
170
|
+
};
|
|
171
|
+
type UseReviewsOptions = ApiProps & {
|
|
167
172
|
productId: string;
|
|
168
173
|
page?: number;
|
|
169
174
|
limit?: number;
|
|
170
175
|
sort?: SortKey;
|
|
171
176
|
locale?: string;
|
|
172
177
|
};
|
|
173
|
-
type UseWidgetGlobalsOptions = {
|
|
174
|
-
proxyUrl: string;
|
|
178
|
+
type UseWidgetGlobalsOptions = ApiProps & {
|
|
175
179
|
limit?: number;
|
|
176
180
|
};
|
|
177
181
|
type QnAAnswer = {
|
|
@@ -216,29 +220,36 @@ type SubmitAnswerPayload = {
|
|
|
216
220
|
body: string;
|
|
217
221
|
isAnonymous?: boolean;
|
|
218
222
|
};
|
|
219
|
-
type UseQnAOptions = {
|
|
220
|
-
proxyUrl: string;
|
|
223
|
+
type UseQnAOptions = ApiProps & {
|
|
221
224
|
productId: string;
|
|
222
225
|
page?: number;
|
|
223
226
|
sort?: 'recent' | 'helpful';
|
|
224
227
|
};
|
|
225
228
|
|
|
226
|
-
type
|
|
227
|
-
|
|
229
|
+
type ReviewWidgetProps = ApiProps & {
|
|
230
|
+
productId: string;
|
|
231
|
+
locale?: string;
|
|
232
|
+
pageSize?: number;
|
|
233
|
+
showForm?: boolean;
|
|
234
|
+
starColor?: string;
|
|
235
|
+
className?: string;
|
|
236
|
+
};
|
|
237
|
+
declare function ReviewWidget({ apiUrl, shop, apiToken, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
238
|
+
|
|
239
|
+
type ReviewFormProps = ApiProps & {
|
|
228
240
|
productId: string;
|
|
229
241
|
form: ResolvedForm;
|
|
230
242
|
onSuccess?: () => void;
|
|
231
243
|
className?: string;
|
|
232
244
|
};
|
|
233
|
-
declare function ReviewForm({
|
|
245
|
+
declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
|
|
234
246
|
|
|
235
|
-
type ReviewCountProps = {
|
|
236
|
-
proxyUrl: string;
|
|
247
|
+
type ReviewCountProps = ApiProps & {
|
|
237
248
|
starColor?: string;
|
|
238
249
|
starSize?: number;
|
|
239
250
|
className?: string;
|
|
240
251
|
};
|
|
241
|
-
declare function ReviewCount({
|
|
252
|
+
declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
|
|
242
253
|
|
|
243
254
|
type StarRatingProps = {
|
|
244
255
|
rating: number;
|
|
@@ -249,53 +260,47 @@ type StarRatingProps = {
|
|
|
249
260
|
};
|
|
250
261
|
declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
|
|
251
262
|
|
|
252
|
-
type ReviewCarouselProps = {
|
|
253
|
-
proxyUrl: string;
|
|
263
|
+
type ReviewCarouselProps = ApiProps & {
|
|
254
264
|
limit?: number;
|
|
255
265
|
autoPlay?: boolean;
|
|
256
266
|
intervalMs?: number;
|
|
257
267
|
starColor?: string;
|
|
258
268
|
className?: string;
|
|
259
269
|
};
|
|
260
|
-
declare function ReviewCarousel({
|
|
270
|
+
declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
|
|
261
271
|
|
|
262
|
-
type ReviewGalleryProps = {
|
|
263
|
-
proxyUrl: string;
|
|
272
|
+
type ReviewGalleryProps = ApiProps & {
|
|
264
273
|
limit?: number;
|
|
265
274
|
columns?: number;
|
|
266
275
|
starColor?: string;
|
|
267
276
|
className?: string;
|
|
268
277
|
};
|
|
269
|
-
declare function ReviewGallery({
|
|
278
|
+
declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
|
|
270
279
|
|
|
271
|
-
type QnAWidgetProps = {
|
|
272
|
-
proxyUrl: string;
|
|
280
|
+
type QnAWidgetProps = ApiProps & {
|
|
273
281
|
productId: string;
|
|
274
282
|
className?: string;
|
|
275
283
|
};
|
|
276
|
-
declare function QnAWidget({
|
|
284
|
+
declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
|
|
277
285
|
|
|
278
|
-
type SocialProofPopupProps = {
|
|
279
|
-
proxyUrl: string;
|
|
286
|
+
type SocialProofPopupProps = ApiProps & {
|
|
280
287
|
position?: 'bottom-left' | 'bottom-right';
|
|
281
288
|
intervalMs?: number;
|
|
282
289
|
displayMs?: number;
|
|
283
290
|
starColor?: string;
|
|
284
291
|
className?: string;
|
|
285
292
|
};
|
|
286
|
-
declare function SocialProofPopup({
|
|
293
|
+
declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
|
|
287
294
|
|
|
288
|
-
type ReviewTickerProps = {
|
|
289
|
-
proxyUrl: string;
|
|
295
|
+
type ReviewTickerProps = ApiProps & {
|
|
290
296
|
limit?: number;
|
|
291
297
|
speedSeconds?: number;
|
|
292
298
|
starColor?: string;
|
|
293
299
|
className?: string;
|
|
294
300
|
};
|
|
295
|
-
declare function ReviewTicker({
|
|
301
|
+
declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
|
|
296
302
|
|
|
297
|
-
type FloatingReviewsTabProps = {
|
|
298
|
-
proxyUrl: string;
|
|
303
|
+
type FloatingReviewsTabProps = ApiProps & {
|
|
299
304
|
label?: string;
|
|
300
305
|
position?: 'left' | 'right';
|
|
301
306
|
color?: string;
|
|
@@ -303,25 +308,25 @@ type FloatingReviewsTabProps = {
|
|
|
303
308
|
starColor?: string;
|
|
304
309
|
className?: string;
|
|
305
310
|
};
|
|
306
|
-
declare function FloatingReviewsTab({
|
|
311
|
+
declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
|
|
307
312
|
|
|
308
|
-
type TrustBadgeProps = {
|
|
309
|
-
proxyUrl: string;
|
|
313
|
+
type TrustBadgeProps = ApiProps & {
|
|
310
314
|
style?: 'inline' | 'pill' | 'card';
|
|
311
315
|
starColor?: string;
|
|
312
316
|
className?: string;
|
|
313
317
|
};
|
|
314
|
-
declare function TrustBadge({
|
|
318
|
+
declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
|
|
315
319
|
|
|
316
|
-
type FloatingReviewButtonProps = {
|
|
317
|
-
proxyUrl: string;
|
|
320
|
+
type FloatingReviewButtonProps = ApiProps & {
|
|
318
321
|
productId: string;
|
|
319
322
|
text?: string;
|
|
320
323
|
color?: string;
|
|
321
324
|
position?: 'bottom-left' | 'bottom-right';
|
|
322
325
|
className?: string;
|
|
323
326
|
};
|
|
324
|
-
declare function FloatingReviewButton({
|
|
327
|
+
declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
|
|
328
|
+
|
|
329
|
+
declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
|
|
325
330
|
|
|
326
331
|
type State$3 = {
|
|
327
332
|
data: ReviewsResponse | null;
|
|
@@ -335,14 +340,14 @@ type UseReviewsReturn = State$3 & {
|
|
|
335
340
|
currentPage: number;
|
|
336
341
|
currentSort: SortKey;
|
|
337
342
|
};
|
|
338
|
-
declare function useReviews({
|
|
343
|
+
declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
|
|
339
344
|
|
|
340
345
|
type State$2 = {
|
|
341
346
|
data: WidgetGlobalsResponse | null;
|
|
342
347
|
loading: boolean;
|
|
343
348
|
error: Error | null;
|
|
344
349
|
};
|
|
345
|
-
declare function useWidgetGlobals({
|
|
350
|
+
declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
|
|
346
351
|
|
|
347
352
|
type SubmitState$1 = {
|
|
348
353
|
submitting: boolean;
|
|
@@ -354,14 +359,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
|
|
|
354
359
|
submit: (payload: SubmitReviewPayload) => Promise<void>;
|
|
355
360
|
reset: () => void;
|
|
356
361
|
};
|
|
357
|
-
declare function useSubmitReview(
|
|
362
|
+
declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
|
|
358
363
|
|
|
359
364
|
type UseHelpfulVoteReturn = {
|
|
360
365
|
vote: (payload: HelpfulVotePayload) => Promise<void>;
|
|
361
366
|
loading: boolean;
|
|
362
367
|
voted: boolean;
|
|
363
368
|
};
|
|
364
|
-
declare function useHelpfulVote(
|
|
369
|
+
declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
|
|
365
370
|
|
|
366
371
|
type State$1 = {
|
|
367
372
|
data: QnAResponse | null;
|
|
@@ -382,17 +387,13 @@ type UseQnAReturn = State$1 & {
|
|
|
382
387
|
submitState: SubmitState;
|
|
383
388
|
resetSubmit: () => void;
|
|
384
389
|
};
|
|
385
|
-
declare function useQnA({
|
|
390
|
+
declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
|
|
386
391
|
|
|
387
392
|
type State = {
|
|
388
393
|
form: ResolvedForm | null;
|
|
389
394
|
loading: boolean;
|
|
390
395
|
error: Error | null;
|
|
391
396
|
};
|
|
392
|
-
|
|
393
|
-
* Fetches the resolved form for a product without loading any reviews.
|
|
394
|
-
* Uses the reviews proxy with limit=1 and extracts only the form field.
|
|
395
|
-
*/
|
|
396
|
-
declare function useForm(proxyUrl: string, productId: string): State;
|
|
397
|
+
declare function useForm(creds: ApiProps, productId: string): State;
|
|
397
398
|
|
|
398
|
-
export { type AdminReply, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type QnAAnswer, type QnAPagination, type QnAResponse, QnAWidget, type ResolvedForm, type Review, ReviewCarousel, ReviewCount, type ReviewFieldAnswer, ReviewForm, ReviewGallery, type ReviewMedia, ReviewTicker, ReviewWidget, type ReviewsPagination, type ReviewsResponse, type ShopStats, SocialProofPopup, type SortKey, StarRating, type SubmitAnswerPayload, type SubmitQuestionPayload, type SubmitReviewPayload, type SubmitReviewResponse, TrustBadge, type UseQnAOptions, type UseReviewsOptions, type UseWidgetGlobalsOptions, type WidgetConfig, type WidgetGlobalsResponse, type WidgetTheme, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
|
|
399
|
+
export { type AdminReply, type ApiProps, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type QnAAnswer, type QnAPagination, type QnAResponse, QnAWidget, type ResolvedForm, type Review, ReviewCarousel, ReviewCount, type ReviewFieldAnswer, ReviewForm, ReviewGallery, type ReviewMedia, ReviewTicker, ReviewWidget, type ReviewsPagination, type ReviewsResponse, type ShopStats, SocialProofPopup, type SortKey, StarRating, type SubmitAnswerPayload, type SubmitQuestionPayload, type SubmitReviewPayload, type SubmitReviewResponse, TrustBadge, type UseQnAOptions, type UseReviewsOptions, type UseWidgetGlobalsOptions, type WidgetConfig, type WidgetGlobalsResponse, type WidgetTheme, apiFetch, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type ReviewWidgetProps = {
|
|
4
|
-
proxyUrl: string;
|
|
5
|
-
productId: string;
|
|
6
|
-
locale?: string;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
showForm?: boolean;
|
|
9
|
-
starColor?: string;
|
|
10
|
-
className?: string;
|
|
11
|
-
};
|
|
12
|
-
declare function ReviewWidget({ proxyUrl, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
13
|
-
|
|
14
3
|
type ReviewMedia = {
|
|
15
4
|
url: string;
|
|
16
5
|
mimeType: string;
|
|
@@ -162,16 +151,31 @@ type HelpfulVoteResponse = {
|
|
|
162
151
|
helpfulCount: number;
|
|
163
152
|
};
|
|
164
153
|
type SortKey = 'recent' | 'helpful' | 'rating_high' | 'rating_low';
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Credentials required by every public component and hook.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* const creds = {
|
|
159
|
+
* apiUrl: env.PUBLIC_REVOVA_API_URL, // e.g. "https://yourapp.trycloudflare.com"
|
|
160
|
+
* shop: env.PUBLIC_STORE_DOMAIN, // e.g. "yourstore.myshopify.com"
|
|
161
|
+
* apiToken: env.PUBLIC_REVOVA_API_TOKEN, // Bearer token
|
|
162
|
+
* };
|
|
163
|
+
*
|
|
164
|
+
* <ReviewWidget {...creds} productId={product.id} />
|
|
165
|
+
*/
|
|
166
|
+
type ApiProps = {
|
|
167
|
+
apiUrl: string;
|
|
168
|
+
shop: string;
|
|
169
|
+
apiToken: string;
|
|
170
|
+
};
|
|
171
|
+
type UseReviewsOptions = ApiProps & {
|
|
167
172
|
productId: string;
|
|
168
173
|
page?: number;
|
|
169
174
|
limit?: number;
|
|
170
175
|
sort?: SortKey;
|
|
171
176
|
locale?: string;
|
|
172
177
|
};
|
|
173
|
-
type UseWidgetGlobalsOptions = {
|
|
174
|
-
proxyUrl: string;
|
|
178
|
+
type UseWidgetGlobalsOptions = ApiProps & {
|
|
175
179
|
limit?: number;
|
|
176
180
|
};
|
|
177
181
|
type QnAAnswer = {
|
|
@@ -216,29 +220,36 @@ type SubmitAnswerPayload = {
|
|
|
216
220
|
body: string;
|
|
217
221
|
isAnonymous?: boolean;
|
|
218
222
|
};
|
|
219
|
-
type UseQnAOptions = {
|
|
220
|
-
proxyUrl: string;
|
|
223
|
+
type UseQnAOptions = ApiProps & {
|
|
221
224
|
productId: string;
|
|
222
225
|
page?: number;
|
|
223
226
|
sort?: 'recent' | 'helpful';
|
|
224
227
|
};
|
|
225
228
|
|
|
226
|
-
type
|
|
227
|
-
|
|
229
|
+
type ReviewWidgetProps = ApiProps & {
|
|
230
|
+
productId: string;
|
|
231
|
+
locale?: string;
|
|
232
|
+
pageSize?: number;
|
|
233
|
+
showForm?: boolean;
|
|
234
|
+
starColor?: string;
|
|
235
|
+
className?: string;
|
|
236
|
+
};
|
|
237
|
+
declare function ReviewWidget({ apiUrl, shop, apiToken, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
238
|
+
|
|
239
|
+
type ReviewFormProps = ApiProps & {
|
|
228
240
|
productId: string;
|
|
229
241
|
form: ResolvedForm;
|
|
230
242
|
onSuccess?: () => void;
|
|
231
243
|
className?: string;
|
|
232
244
|
};
|
|
233
|
-
declare function ReviewForm({
|
|
245
|
+
declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
|
|
234
246
|
|
|
235
|
-
type ReviewCountProps = {
|
|
236
|
-
proxyUrl: string;
|
|
247
|
+
type ReviewCountProps = ApiProps & {
|
|
237
248
|
starColor?: string;
|
|
238
249
|
starSize?: number;
|
|
239
250
|
className?: string;
|
|
240
251
|
};
|
|
241
|
-
declare function ReviewCount({
|
|
252
|
+
declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
|
|
242
253
|
|
|
243
254
|
type StarRatingProps = {
|
|
244
255
|
rating: number;
|
|
@@ -249,53 +260,47 @@ type StarRatingProps = {
|
|
|
249
260
|
};
|
|
250
261
|
declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
|
|
251
262
|
|
|
252
|
-
type ReviewCarouselProps = {
|
|
253
|
-
proxyUrl: string;
|
|
263
|
+
type ReviewCarouselProps = ApiProps & {
|
|
254
264
|
limit?: number;
|
|
255
265
|
autoPlay?: boolean;
|
|
256
266
|
intervalMs?: number;
|
|
257
267
|
starColor?: string;
|
|
258
268
|
className?: string;
|
|
259
269
|
};
|
|
260
|
-
declare function ReviewCarousel({
|
|
270
|
+
declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
|
|
261
271
|
|
|
262
|
-
type ReviewGalleryProps = {
|
|
263
|
-
proxyUrl: string;
|
|
272
|
+
type ReviewGalleryProps = ApiProps & {
|
|
264
273
|
limit?: number;
|
|
265
274
|
columns?: number;
|
|
266
275
|
starColor?: string;
|
|
267
276
|
className?: string;
|
|
268
277
|
};
|
|
269
|
-
declare function ReviewGallery({
|
|
278
|
+
declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
|
|
270
279
|
|
|
271
|
-
type QnAWidgetProps = {
|
|
272
|
-
proxyUrl: string;
|
|
280
|
+
type QnAWidgetProps = ApiProps & {
|
|
273
281
|
productId: string;
|
|
274
282
|
className?: string;
|
|
275
283
|
};
|
|
276
|
-
declare function QnAWidget({
|
|
284
|
+
declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
|
|
277
285
|
|
|
278
|
-
type SocialProofPopupProps = {
|
|
279
|
-
proxyUrl: string;
|
|
286
|
+
type SocialProofPopupProps = ApiProps & {
|
|
280
287
|
position?: 'bottom-left' | 'bottom-right';
|
|
281
288
|
intervalMs?: number;
|
|
282
289
|
displayMs?: number;
|
|
283
290
|
starColor?: string;
|
|
284
291
|
className?: string;
|
|
285
292
|
};
|
|
286
|
-
declare function SocialProofPopup({
|
|
293
|
+
declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
|
|
287
294
|
|
|
288
|
-
type ReviewTickerProps = {
|
|
289
|
-
proxyUrl: string;
|
|
295
|
+
type ReviewTickerProps = ApiProps & {
|
|
290
296
|
limit?: number;
|
|
291
297
|
speedSeconds?: number;
|
|
292
298
|
starColor?: string;
|
|
293
299
|
className?: string;
|
|
294
300
|
};
|
|
295
|
-
declare function ReviewTicker({
|
|
301
|
+
declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
|
|
296
302
|
|
|
297
|
-
type FloatingReviewsTabProps = {
|
|
298
|
-
proxyUrl: string;
|
|
303
|
+
type FloatingReviewsTabProps = ApiProps & {
|
|
299
304
|
label?: string;
|
|
300
305
|
position?: 'left' | 'right';
|
|
301
306
|
color?: string;
|
|
@@ -303,25 +308,25 @@ type FloatingReviewsTabProps = {
|
|
|
303
308
|
starColor?: string;
|
|
304
309
|
className?: string;
|
|
305
310
|
};
|
|
306
|
-
declare function FloatingReviewsTab({
|
|
311
|
+
declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
|
|
307
312
|
|
|
308
|
-
type TrustBadgeProps = {
|
|
309
|
-
proxyUrl: string;
|
|
313
|
+
type TrustBadgeProps = ApiProps & {
|
|
310
314
|
style?: 'inline' | 'pill' | 'card';
|
|
311
315
|
starColor?: string;
|
|
312
316
|
className?: string;
|
|
313
317
|
};
|
|
314
|
-
declare function TrustBadge({
|
|
318
|
+
declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
|
|
315
319
|
|
|
316
|
-
type FloatingReviewButtonProps = {
|
|
317
|
-
proxyUrl: string;
|
|
320
|
+
type FloatingReviewButtonProps = ApiProps & {
|
|
318
321
|
productId: string;
|
|
319
322
|
text?: string;
|
|
320
323
|
color?: string;
|
|
321
324
|
position?: 'bottom-left' | 'bottom-right';
|
|
322
325
|
className?: string;
|
|
323
326
|
};
|
|
324
|
-
declare function FloatingReviewButton({
|
|
327
|
+
declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
|
|
328
|
+
|
|
329
|
+
declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
|
|
325
330
|
|
|
326
331
|
type State$3 = {
|
|
327
332
|
data: ReviewsResponse | null;
|
|
@@ -335,14 +340,14 @@ type UseReviewsReturn = State$3 & {
|
|
|
335
340
|
currentPage: number;
|
|
336
341
|
currentSort: SortKey;
|
|
337
342
|
};
|
|
338
|
-
declare function useReviews({
|
|
343
|
+
declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
|
|
339
344
|
|
|
340
345
|
type State$2 = {
|
|
341
346
|
data: WidgetGlobalsResponse | null;
|
|
342
347
|
loading: boolean;
|
|
343
348
|
error: Error | null;
|
|
344
349
|
};
|
|
345
|
-
declare function useWidgetGlobals({
|
|
350
|
+
declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
|
|
346
351
|
|
|
347
352
|
type SubmitState$1 = {
|
|
348
353
|
submitting: boolean;
|
|
@@ -354,14 +359,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
|
|
|
354
359
|
submit: (payload: SubmitReviewPayload) => Promise<void>;
|
|
355
360
|
reset: () => void;
|
|
356
361
|
};
|
|
357
|
-
declare function useSubmitReview(
|
|
362
|
+
declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
|
|
358
363
|
|
|
359
364
|
type UseHelpfulVoteReturn = {
|
|
360
365
|
vote: (payload: HelpfulVotePayload) => Promise<void>;
|
|
361
366
|
loading: boolean;
|
|
362
367
|
voted: boolean;
|
|
363
368
|
};
|
|
364
|
-
declare function useHelpfulVote(
|
|
369
|
+
declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
|
|
365
370
|
|
|
366
371
|
type State$1 = {
|
|
367
372
|
data: QnAResponse | null;
|
|
@@ -382,17 +387,13 @@ type UseQnAReturn = State$1 & {
|
|
|
382
387
|
submitState: SubmitState;
|
|
383
388
|
resetSubmit: () => void;
|
|
384
389
|
};
|
|
385
|
-
declare function useQnA({
|
|
390
|
+
declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
|
|
386
391
|
|
|
387
392
|
type State = {
|
|
388
393
|
form: ResolvedForm | null;
|
|
389
394
|
loading: boolean;
|
|
390
395
|
error: Error | null;
|
|
391
396
|
};
|
|
392
|
-
|
|
393
|
-
* Fetches the resolved form for a product without loading any reviews.
|
|
394
|
-
* Uses the reviews proxy with limit=1 and extracts only the form field.
|
|
395
|
-
*/
|
|
396
|
-
declare function useForm(proxyUrl: string, productId: string): State;
|
|
397
|
+
declare function useForm(creds: ApiProps, productId: string): State;
|
|
397
398
|
|
|
398
|
-
export { type AdminReply, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type QnAAnswer, type QnAPagination, type QnAResponse, QnAWidget, type ResolvedForm, type Review, ReviewCarousel, ReviewCount, type ReviewFieldAnswer, ReviewForm, ReviewGallery, type ReviewMedia, ReviewTicker, ReviewWidget, type ReviewsPagination, type ReviewsResponse, type ShopStats, SocialProofPopup, type SortKey, StarRating, type SubmitAnswerPayload, type SubmitQuestionPayload, type SubmitReviewPayload, type SubmitReviewResponse, TrustBadge, type UseQnAOptions, type UseReviewsOptions, type UseWidgetGlobalsOptions, type WidgetConfig, type WidgetGlobalsResponse, type WidgetTheme, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
|
|
399
|
+
export { type AdminReply, type ApiProps, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type QnAAnswer, type QnAPagination, type QnAResponse, QnAWidget, type ResolvedForm, type Review, ReviewCarousel, ReviewCount, type ReviewFieldAnswer, ReviewForm, ReviewGallery, type ReviewMedia, ReviewTicker, ReviewWidget, type ReviewsPagination, type ReviewsResponse, type ShopStats, SocialProofPopup, type SortKey, StarRating, type SubmitAnswerPayload, type SubmitQuestionPayload, type SubmitReviewPayload, type SubmitReviewResponse, TrustBadge, type UseQnAOptions, type UseReviewsOptions, type UseWidgetGlobalsOptions, type WidgetConfig, type WidgetGlobalsResponse, type WidgetTheme, apiFetch, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
|