@revova/hydrogen 1.0.1 → 1.1.0
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 +87 -124
- package/dist/index.cjs +1139 -853
- package/dist/index.d.cts +52 -61
- package/dist/index.d.ts +52 -61
- package/dist/index.js +1112 -826
- package/dist/styles.css +629 -0
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -152,34 +152,30 @@ type HelpfulVoteResponse = {
|
|
|
152
152
|
};
|
|
153
153
|
type SortKey = 'recent' | 'helpful' | 'rating_high' | 'rating_low';
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
* storeDomain shorthand. Provide exactly one of the two.
|
|
155
|
+
* Credentials required by every public component and hook.
|
|
157
156
|
*
|
|
158
157
|
* @example
|
|
159
|
-
*
|
|
160
|
-
*
|
|
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
|
+
* };
|
|
161
163
|
*
|
|
162
|
-
*
|
|
163
|
-
* // shorthand (Hydrogen-friendly)
|
|
164
|
-
* storeDomain={env.PUBLIC_STORE_DOMAIN}
|
|
164
|
+
* <ReviewWidget {...creds} productId={product.id} />
|
|
165
165
|
*/
|
|
166
|
-
type
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
type UseReviewsOptions = {
|
|
174
|
-
proxyUrl: string;
|
|
166
|
+
type ApiProps = {
|
|
167
|
+
apiUrl: string;
|
|
168
|
+
shop: string;
|
|
169
|
+
apiToken: string;
|
|
170
|
+
};
|
|
171
|
+
type UseReviewsOptions = ApiProps & {
|
|
175
172
|
productId: string;
|
|
176
173
|
page?: number;
|
|
177
174
|
limit?: number;
|
|
178
175
|
sort?: SortKey;
|
|
179
176
|
locale?: string;
|
|
180
177
|
};
|
|
181
|
-
type UseWidgetGlobalsOptions = {
|
|
182
|
-
proxyUrl: string;
|
|
178
|
+
type UseWidgetGlobalsOptions = ApiProps & {
|
|
183
179
|
limit?: number;
|
|
184
180
|
};
|
|
185
181
|
type QnAAnswer = {
|
|
@@ -224,88 +220,90 @@ type SubmitAnswerPayload = {
|
|
|
224
220
|
body: string;
|
|
225
221
|
isAnonymous?: boolean;
|
|
226
222
|
};
|
|
227
|
-
type UseQnAOptions = {
|
|
228
|
-
proxyUrl: string;
|
|
223
|
+
type UseQnAOptions = ApiProps & {
|
|
229
224
|
productId: string;
|
|
230
225
|
page?: number;
|
|
231
226
|
sort?: 'recent' | 'helpful';
|
|
232
227
|
};
|
|
233
228
|
|
|
234
|
-
type ReviewWidgetProps =
|
|
229
|
+
type ReviewWidgetProps = ApiProps & {
|
|
235
230
|
productId: string;
|
|
231
|
+
productTitle?: string;
|
|
232
|
+
productImage?: string;
|
|
236
233
|
locale?: string;
|
|
237
234
|
pageSize?: number;
|
|
238
235
|
showForm?: boolean;
|
|
239
236
|
starColor?: string;
|
|
240
237
|
className?: string;
|
|
241
238
|
};
|
|
242
|
-
declare function ReviewWidget({
|
|
239
|
+
declare function ReviewWidget({ apiUrl, shop, apiToken, productId, productTitle, productImage, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
243
240
|
|
|
244
|
-
type ReviewFormProps =
|
|
241
|
+
type ReviewFormProps = ApiProps & {
|
|
245
242
|
productId: string;
|
|
246
243
|
form: ResolvedForm;
|
|
247
244
|
onSuccess?: () => void;
|
|
248
245
|
className?: string;
|
|
249
246
|
};
|
|
250
|
-
declare function ReviewForm({
|
|
247
|
+
declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
|
|
251
248
|
|
|
252
|
-
type ReviewCountProps =
|
|
249
|
+
type ReviewCountProps = ApiProps & {
|
|
253
250
|
starColor?: string;
|
|
254
251
|
starSize?: number;
|
|
255
252
|
className?: string;
|
|
256
253
|
};
|
|
257
|
-
declare function ReviewCount({
|
|
254
|
+
declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
|
|
258
255
|
|
|
259
256
|
type StarRatingProps = {
|
|
260
257
|
rating: number;
|
|
261
258
|
max?: number;
|
|
262
|
-
size?: number
|
|
263
|
-
color?: string
|
|
264
|
-
|
|
259
|
+
size?: number;
|
|
260
|
+
color?: string;
|
|
261
|
+
emptyColor?: string;
|
|
262
|
+
className?: string;
|
|
265
263
|
};
|
|
266
|
-
declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
|
|
264
|
+
declare function StarRating({ rating, max, size, color, emptyColor, className, }: StarRatingProps): React.JSX.Element;
|
|
267
265
|
|
|
268
|
-
type ReviewCarouselProps =
|
|
266
|
+
type ReviewCarouselProps = ApiProps & {
|
|
269
267
|
limit?: number;
|
|
270
268
|
autoPlay?: boolean;
|
|
271
269
|
intervalMs?: number;
|
|
272
270
|
starColor?: string;
|
|
273
271
|
className?: string;
|
|
274
272
|
};
|
|
275
|
-
declare function ReviewCarousel({
|
|
273
|
+
declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
|
|
276
274
|
|
|
277
|
-
type ReviewGalleryProps =
|
|
275
|
+
type ReviewGalleryProps = ApiProps & {
|
|
278
276
|
limit?: number;
|
|
279
277
|
columns?: number;
|
|
280
278
|
starColor?: string;
|
|
281
279
|
className?: string;
|
|
282
280
|
};
|
|
283
|
-
declare function ReviewGallery({
|
|
281
|
+
declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
|
|
284
282
|
|
|
285
|
-
type QnAWidgetProps =
|
|
283
|
+
type QnAWidgetProps = ApiProps & {
|
|
286
284
|
productId: string;
|
|
287
285
|
className?: string;
|
|
288
286
|
};
|
|
289
|
-
declare function QnAWidget({
|
|
287
|
+
declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
|
|
290
288
|
|
|
291
|
-
type SocialProofPopupProps =
|
|
289
|
+
type SocialProofPopupProps = ApiProps & {
|
|
292
290
|
position?: 'bottom-left' | 'bottom-right';
|
|
293
291
|
intervalMs?: number;
|
|
294
292
|
displayMs?: number;
|
|
295
293
|
starColor?: string;
|
|
296
294
|
className?: string;
|
|
297
295
|
};
|
|
298
|
-
declare function SocialProofPopup({
|
|
296
|
+
declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
|
|
299
297
|
|
|
300
|
-
type ReviewTickerProps =
|
|
298
|
+
type ReviewTickerProps = ApiProps & {
|
|
301
299
|
limit?: number;
|
|
302
300
|
speedSeconds?: number;
|
|
303
301
|
starColor?: string;
|
|
304
302
|
className?: string;
|
|
305
303
|
};
|
|
306
|
-
declare function ReviewTicker({
|
|
304
|
+
declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
|
|
307
305
|
|
|
308
|
-
type FloatingReviewsTabProps =
|
|
306
|
+
type FloatingReviewsTabProps = ApiProps & {
|
|
309
307
|
label?: string;
|
|
310
308
|
position?: 'left' | 'right';
|
|
311
309
|
color?: string;
|
|
@@ -313,28 +311,25 @@ type FloatingReviewsTabProps = ProxyProps & {
|
|
|
313
311
|
starColor?: string;
|
|
314
312
|
className?: string;
|
|
315
313
|
};
|
|
316
|
-
declare function FloatingReviewsTab({
|
|
314
|
+
declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
|
|
317
315
|
|
|
318
|
-
type TrustBadgeProps =
|
|
316
|
+
type TrustBadgeProps = ApiProps & {
|
|
319
317
|
style?: 'inline' | 'pill' | 'card';
|
|
320
318
|
starColor?: string;
|
|
321
319
|
className?: string;
|
|
322
320
|
};
|
|
323
|
-
declare function TrustBadge({
|
|
321
|
+
declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
|
|
324
322
|
|
|
325
|
-
type FloatingReviewButtonProps =
|
|
323
|
+
type FloatingReviewButtonProps = ApiProps & {
|
|
326
324
|
productId: string;
|
|
327
325
|
text?: string;
|
|
328
326
|
color?: string;
|
|
329
327
|
position?: 'bottom-left' | 'bottom-right';
|
|
330
328
|
className?: string;
|
|
331
329
|
};
|
|
332
|
-
declare function FloatingReviewButton({
|
|
330
|
+
declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
|
|
333
331
|
|
|
334
|
-
declare function
|
|
335
|
-
proxyUrl?: string | undefined;
|
|
336
|
-
storeDomain?: string | undefined;
|
|
337
|
-
}): string;
|
|
332
|
+
declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
|
|
338
333
|
|
|
339
334
|
type State$3 = {
|
|
340
335
|
data: ReviewsResponse | null;
|
|
@@ -348,14 +343,14 @@ type UseReviewsReturn = State$3 & {
|
|
|
348
343
|
currentPage: number;
|
|
349
344
|
currentSort: SortKey;
|
|
350
345
|
};
|
|
351
|
-
declare function useReviews({
|
|
346
|
+
declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
|
|
352
347
|
|
|
353
348
|
type State$2 = {
|
|
354
349
|
data: WidgetGlobalsResponse | null;
|
|
355
350
|
loading: boolean;
|
|
356
351
|
error: Error | null;
|
|
357
352
|
};
|
|
358
|
-
declare function useWidgetGlobals({
|
|
353
|
+
declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
|
|
359
354
|
|
|
360
355
|
type SubmitState$1 = {
|
|
361
356
|
submitting: boolean;
|
|
@@ -367,14 +362,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
|
|
|
367
362
|
submit: (payload: SubmitReviewPayload) => Promise<void>;
|
|
368
363
|
reset: () => void;
|
|
369
364
|
};
|
|
370
|
-
declare function useSubmitReview(
|
|
365
|
+
declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
|
|
371
366
|
|
|
372
367
|
type UseHelpfulVoteReturn = {
|
|
373
368
|
vote: (payload: HelpfulVotePayload) => Promise<void>;
|
|
374
369
|
loading: boolean;
|
|
375
370
|
voted: boolean;
|
|
376
371
|
};
|
|
377
|
-
declare function useHelpfulVote(
|
|
372
|
+
declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
|
|
378
373
|
|
|
379
374
|
type State$1 = {
|
|
380
375
|
data: QnAResponse | null;
|
|
@@ -395,17 +390,13 @@ type UseQnAReturn = State$1 & {
|
|
|
395
390
|
submitState: SubmitState;
|
|
396
391
|
resetSubmit: () => void;
|
|
397
392
|
};
|
|
398
|
-
declare function useQnA({
|
|
393
|
+
declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
|
|
399
394
|
|
|
400
395
|
type State = {
|
|
401
396
|
form: ResolvedForm | null;
|
|
402
397
|
loading: boolean;
|
|
403
398
|
error: Error | null;
|
|
404
399
|
};
|
|
405
|
-
|
|
406
|
-
* Fetches the resolved form for a product without loading any reviews.
|
|
407
|
-
* Uses the reviews proxy with limit=1 and extracts only the form field.
|
|
408
|
-
*/
|
|
409
|
-
declare function useForm(proxyUrl: string, productId: string): State;
|
|
400
|
+
declare function useForm(creds: ApiProps, productId: string): State;
|
|
410
401
|
|
|
411
|
-
export { type AdminReply, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type
|
|
402
|
+
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
|
@@ -152,34 +152,30 @@ type HelpfulVoteResponse = {
|
|
|
152
152
|
};
|
|
153
153
|
type SortKey = 'recent' | 'helpful' | 'rating_high' | 'rating_low';
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
* storeDomain shorthand. Provide exactly one of the two.
|
|
155
|
+
* Credentials required by every public component and hook.
|
|
157
156
|
*
|
|
158
157
|
* @example
|
|
159
|
-
*
|
|
160
|
-
*
|
|
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
|
+
* };
|
|
161
163
|
*
|
|
162
|
-
*
|
|
163
|
-
* // shorthand (Hydrogen-friendly)
|
|
164
|
-
* storeDomain={env.PUBLIC_STORE_DOMAIN}
|
|
164
|
+
* <ReviewWidget {...creds} productId={product.id} />
|
|
165
165
|
*/
|
|
166
|
-
type
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
type UseReviewsOptions = {
|
|
174
|
-
proxyUrl: string;
|
|
166
|
+
type ApiProps = {
|
|
167
|
+
apiUrl: string;
|
|
168
|
+
shop: string;
|
|
169
|
+
apiToken: string;
|
|
170
|
+
};
|
|
171
|
+
type UseReviewsOptions = ApiProps & {
|
|
175
172
|
productId: string;
|
|
176
173
|
page?: number;
|
|
177
174
|
limit?: number;
|
|
178
175
|
sort?: SortKey;
|
|
179
176
|
locale?: string;
|
|
180
177
|
};
|
|
181
|
-
type UseWidgetGlobalsOptions = {
|
|
182
|
-
proxyUrl: string;
|
|
178
|
+
type UseWidgetGlobalsOptions = ApiProps & {
|
|
183
179
|
limit?: number;
|
|
184
180
|
};
|
|
185
181
|
type QnAAnswer = {
|
|
@@ -224,88 +220,90 @@ type SubmitAnswerPayload = {
|
|
|
224
220
|
body: string;
|
|
225
221
|
isAnonymous?: boolean;
|
|
226
222
|
};
|
|
227
|
-
type UseQnAOptions = {
|
|
228
|
-
proxyUrl: string;
|
|
223
|
+
type UseQnAOptions = ApiProps & {
|
|
229
224
|
productId: string;
|
|
230
225
|
page?: number;
|
|
231
226
|
sort?: 'recent' | 'helpful';
|
|
232
227
|
};
|
|
233
228
|
|
|
234
|
-
type ReviewWidgetProps =
|
|
229
|
+
type ReviewWidgetProps = ApiProps & {
|
|
235
230
|
productId: string;
|
|
231
|
+
productTitle?: string;
|
|
232
|
+
productImage?: string;
|
|
236
233
|
locale?: string;
|
|
237
234
|
pageSize?: number;
|
|
238
235
|
showForm?: boolean;
|
|
239
236
|
starColor?: string;
|
|
240
237
|
className?: string;
|
|
241
238
|
};
|
|
242
|
-
declare function ReviewWidget({
|
|
239
|
+
declare function ReviewWidget({ apiUrl, shop, apiToken, productId, productTitle, productImage, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
|
|
243
240
|
|
|
244
|
-
type ReviewFormProps =
|
|
241
|
+
type ReviewFormProps = ApiProps & {
|
|
245
242
|
productId: string;
|
|
246
243
|
form: ResolvedForm;
|
|
247
244
|
onSuccess?: () => void;
|
|
248
245
|
className?: string;
|
|
249
246
|
};
|
|
250
|
-
declare function ReviewForm({
|
|
247
|
+
declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
|
|
251
248
|
|
|
252
|
-
type ReviewCountProps =
|
|
249
|
+
type ReviewCountProps = ApiProps & {
|
|
253
250
|
starColor?: string;
|
|
254
251
|
starSize?: number;
|
|
255
252
|
className?: string;
|
|
256
253
|
};
|
|
257
|
-
declare function ReviewCount({
|
|
254
|
+
declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
|
|
258
255
|
|
|
259
256
|
type StarRatingProps = {
|
|
260
257
|
rating: number;
|
|
261
258
|
max?: number;
|
|
262
|
-
size?: number
|
|
263
|
-
color?: string
|
|
264
|
-
|
|
259
|
+
size?: number;
|
|
260
|
+
color?: string;
|
|
261
|
+
emptyColor?: string;
|
|
262
|
+
className?: string;
|
|
265
263
|
};
|
|
266
|
-
declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
|
|
264
|
+
declare function StarRating({ rating, max, size, color, emptyColor, className, }: StarRatingProps): React.JSX.Element;
|
|
267
265
|
|
|
268
|
-
type ReviewCarouselProps =
|
|
266
|
+
type ReviewCarouselProps = ApiProps & {
|
|
269
267
|
limit?: number;
|
|
270
268
|
autoPlay?: boolean;
|
|
271
269
|
intervalMs?: number;
|
|
272
270
|
starColor?: string;
|
|
273
271
|
className?: string;
|
|
274
272
|
};
|
|
275
|
-
declare function ReviewCarousel({
|
|
273
|
+
declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
|
|
276
274
|
|
|
277
|
-
type ReviewGalleryProps =
|
|
275
|
+
type ReviewGalleryProps = ApiProps & {
|
|
278
276
|
limit?: number;
|
|
279
277
|
columns?: number;
|
|
280
278
|
starColor?: string;
|
|
281
279
|
className?: string;
|
|
282
280
|
};
|
|
283
|
-
declare function ReviewGallery({
|
|
281
|
+
declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
|
|
284
282
|
|
|
285
|
-
type QnAWidgetProps =
|
|
283
|
+
type QnAWidgetProps = ApiProps & {
|
|
286
284
|
productId: string;
|
|
287
285
|
className?: string;
|
|
288
286
|
};
|
|
289
|
-
declare function QnAWidget({
|
|
287
|
+
declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
|
|
290
288
|
|
|
291
|
-
type SocialProofPopupProps =
|
|
289
|
+
type SocialProofPopupProps = ApiProps & {
|
|
292
290
|
position?: 'bottom-left' | 'bottom-right';
|
|
293
291
|
intervalMs?: number;
|
|
294
292
|
displayMs?: number;
|
|
295
293
|
starColor?: string;
|
|
296
294
|
className?: string;
|
|
297
295
|
};
|
|
298
|
-
declare function SocialProofPopup({
|
|
296
|
+
declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
|
|
299
297
|
|
|
300
|
-
type ReviewTickerProps =
|
|
298
|
+
type ReviewTickerProps = ApiProps & {
|
|
301
299
|
limit?: number;
|
|
302
300
|
speedSeconds?: number;
|
|
303
301
|
starColor?: string;
|
|
304
302
|
className?: string;
|
|
305
303
|
};
|
|
306
|
-
declare function ReviewTicker({
|
|
304
|
+
declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
|
|
307
305
|
|
|
308
|
-
type FloatingReviewsTabProps =
|
|
306
|
+
type FloatingReviewsTabProps = ApiProps & {
|
|
309
307
|
label?: string;
|
|
310
308
|
position?: 'left' | 'right';
|
|
311
309
|
color?: string;
|
|
@@ -313,28 +311,25 @@ type FloatingReviewsTabProps = ProxyProps & {
|
|
|
313
311
|
starColor?: string;
|
|
314
312
|
className?: string;
|
|
315
313
|
};
|
|
316
|
-
declare function FloatingReviewsTab({
|
|
314
|
+
declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
|
|
317
315
|
|
|
318
|
-
type TrustBadgeProps =
|
|
316
|
+
type TrustBadgeProps = ApiProps & {
|
|
319
317
|
style?: 'inline' | 'pill' | 'card';
|
|
320
318
|
starColor?: string;
|
|
321
319
|
className?: string;
|
|
322
320
|
};
|
|
323
|
-
declare function TrustBadge({
|
|
321
|
+
declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
|
|
324
322
|
|
|
325
|
-
type FloatingReviewButtonProps =
|
|
323
|
+
type FloatingReviewButtonProps = ApiProps & {
|
|
326
324
|
productId: string;
|
|
327
325
|
text?: string;
|
|
328
326
|
color?: string;
|
|
329
327
|
position?: 'bottom-left' | 'bottom-right';
|
|
330
328
|
className?: string;
|
|
331
329
|
};
|
|
332
|
-
declare function FloatingReviewButton({
|
|
330
|
+
declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
|
|
333
331
|
|
|
334
|
-
declare function
|
|
335
|
-
proxyUrl?: string | undefined;
|
|
336
|
-
storeDomain?: string | undefined;
|
|
337
|
-
}): string;
|
|
332
|
+
declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
|
|
338
333
|
|
|
339
334
|
type State$3 = {
|
|
340
335
|
data: ReviewsResponse | null;
|
|
@@ -348,14 +343,14 @@ type UseReviewsReturn = State$3 & {
|
|
|
348
343
|
currentPage: number;
|
|
349
344
|
currentSort: SortKey;
|
|
350
345
|
};
|
|
351
|
-
declare function useReviews({
|
|
346
|
+
declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
|
|
352
347
|
|
|
353
348
|
type State$2 = {
|
|
354
349
|
data: WidgetGlobalsResponse | null;
|
|
355
350
|
loading: boolean;
|
|
356
351
|
error: Error | null;
|
|
357
352
|
};
|
|
358
|
-
declare function useWidgetGlobals({
|
|
353
|
+
declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
|
|
359
354
|
|
|
360
355
|
type SubmitState$1 = {
|
|
361
356
|
submitting: boolean;
|
|
@@ -367,14 +362,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
|
|
|
367
362
|
submit: (payload: SubmitReviewPayload) => Promise<void>;
|
|
368
363
|
reset: () => void;
|
|
369
364
|
};
|
|
370
|
-
declare function useSubmitReview(
|
|
365
|
+
declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
|
|
371
366
|
|
|
372
367
|
type UseHelpfulVoteReturn = {
|
|
373
368
|
vote: (payload: HelpfulVotePayload) => Promise<void>;
|
|
374
369
|
loading: boolean;
|
|
375
370
|
voted: boolean;
|
|
376
371
|
};
|
|
377
|
-
declare function useHelpfulVote(
|
|
372
|
+
declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
|
|
378
373
|
|
|
379
374
|
type State$1 = {
|
|
380
375
|
data: QnAResponse | null;
|
|
@@ -395,17 +390,13 @@ type UseQnAReturn = State$1 & {
|
|
|
395
390
|
submitState: SubmitState;
|
|
396
391
|
resetSubmit: () => void;
|
|
397
392
|
};
|
|
398
|
-
declare function useQnA({
|
|
393
|
+
declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
|
|
399
394
|
|
|
400
395
|
type State = {
|
|
401
396
|
form: ResolvedForm | null;
|
|
402
397
|
loading: boolean;
|
|
403
398
|
error: Error | null;
|
|
404
399
|
};
|
|
405
|
-
|
|
406
|
-
* Fetches the resolved form for a product without loading any reviews.
|
|
407
|
-
* Uses the reviews proxy with limit=1 and extracts only the form field.
|
|
408
|
-
*/
|
|
409
|
-
declare function useForm(proxyUrl: string, productId: string): State;
|
|
400
|
+
declare function useForm(creds: ApiProps, productId: string): State;
|
|
410
401
|
|
|
411
|
-
export { type AdminReply, type AttributeRating, FloatingReviewButton, FloatingReviewsTab, type FormField, type GlobalReview, type HelpfulVotePayload, type HelpfulVoteResponse, type ProductQuestion, type
|
|
402
|
+
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 };
|