@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/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
- * Every public component and hook accepts either an explicit proxyUrl or a
156
- * storeDomain shorthand. Provide exactly one of the two.
155
+ * Credentials required by every public component and hook.
157
156
  *
158
157
  * @example
159
- * // explicit
160
- * proxyUrl={`https://${env.PUBLIC_STORE_DOMAIN}/apps/revova`}
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
- * @example
163
- * // shorthand (Hydrogen-friendly)
164
- * storeDomain={env.PUBLIC_STORE_DOMAIN}
164
+ * <ReviewWidget {...creds} productId={product.id} />
165
165
  */
166
- type ProxyProps = {
167
- proxyUrl: string;
168
- storeDomain?: never;
169
- } | {
170
- storeDomain: string;
171
- proxyUrl?: never;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
247
+ declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
251
248
 
252
- type ReviewCountProps = ProxyProps & {
249
+ type ReviewCountProps = ApiProps & {
253
250
  starColor?: string;
254
251
  starSize?: number;
255
252
  className?: string;
256
253
  };
257
- declare function ReviewCount({ proxyUrl, storeDomain, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
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 | undefined;
263
- color?: string | undefined;
264
- className?: string | undefined;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
273
+ declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
276
274
 
277
- type ReviewGalleryProps = ProxyProps & {
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({ proxyUrl, storeDomain, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
281
+ declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
284
282
 
285
- type QnAWidgetProps = ProxyProps & {
283
+ type QnAWidgetProps = ApiProps & {
286
284
  productId: string;
287
285
  className?: string;
288
286
  };
289
- declare function QnAWidget({ proxyUrl, storeDomain, productId, className }: QnAWidgetProps): React.JSX.Element | null;
287
+ declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
290
288
 
291
- type SocialProofPopupProps = ProxyProps & {
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({ proxyUrl, storeDomain, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
296
+ declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
299
297
 
300
- type ReviewTickerProps = ProxyProps & {
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({ proxyUrl, storeDomain, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
304
+ declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
307
305
 
308
- type FloatingReviewsTabProps = ProxyProps & {
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({ proxyUrl, storeDomain, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
314
+ declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
317
315
 
318
- type TrustBadgeProps = ProxyProps & {
316
+ type TrustBadgeProps = ApiProps & {
319
317
  style?: 'inline' | 'pill' | 'card';
320
318
  starColor?: string;
321
319
  className?: string;
322
320
  };
323
- declare function TrustBadge({ proxyUrl, storeDomain, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
321
+ declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
324
322
 
325
- type FloatingReviewButtonProps = ProxyProps & {
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({ proxyUrl, storeDomain, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
330
+ declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
333
331
 
334
- declare function resolveProxyUrl(props: {
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({ proxyUrl, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
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({ proxyUrl, limit }: UseWidgetGlobalsOptions): State$2;
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(proxyUrl: string): UseSubmitReviewReturn;
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(proxyUrl: string): UseHelpfulVoteReturn;
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({ proxyUrl, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
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 ProxyProps, 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, resolveProxyUrl, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
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
- * Every public component and hook accepts either an explicit proxyUrl or a
156
- * storeDomain shorthand. Provide exactly one of the two.
155
+ * Credentials required by every public component and hook.
157
156
  *
158
157
  * @example
159
- * // explicit
160
- * proxyUrl={`https://${env.PUBLIC_STORE_DOMAIN}/apps/revova`}
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
- * @example
163
- * // shorthand (Hydrogen-friendly)
164
- * storeDomain={env.PUBLIC_STORE_DOMAIN}
164
+ * <ReviewWidget {...creds} productId={product.id} />
165
165
  */
166
- type ProxyProps = {
167
- proxyUrl: string;
168
- storeDomain?: never;
169
- } | {
170
- storeDomain: string;
171
- proxyUrl?: never;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
247
+ declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
251
248
 
252
- type ReviewCountProps = ProxyProps & {
249
+ type ReviewCountProps = ApiProps & {
253
250
  starColor?: string;
254
251
  starSize?: number;
255
252
  className?: string;
256
253
  };
257
- declare function ReviewCount({ proxyUrl, storeDomain, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
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 | undefined;
263
- color?: string | undefined;
264
- className?: string | undefined;
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 = ProxyProps & {
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({ proxyUrl, storeDomain, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
273
+ declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
276
274
 
277
- type ReviewGalleryProps = ProxyProps & {
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({ proxyUrl, storeDomain, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
281
+ declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
284
282
 
285
- type QnAWidgetProps = ProxyProps & {
283
+ type QnAWidgetProps = ApiProps & {
286
284
  productId: string;
287
285
  className?: string;
288
286
  };
289
- declare function QnAWidget({ proxyUrl, storeDomain, productId, className }: QnAWidgetProps): React.JSX.Element | null;
287
+ declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
290
288
 
291
- type SocialProofPopupProps = ProxyProps & {
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({ proxyUrl, storeDomain, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
296
+ declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
299
297
 
300
- type ReviewTickerProps = ProxyProps & {
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({ proxyUrl, storeDomain, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
304
+ declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
307
305
 
308
- type FloatingReviewsTabProps = ProxyProps & {
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({ proxyUrl, storeDomain, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
314
+ declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
317
315
 
318
- type TrustBadgeProps = ProxyProps & {
316
+ type TrustBadgeProps = ApiProps & {
319
317
  style?: 'inline' | 'pill' | 'card';
320
318
  starColor?: string;
321
319
  className?: string;
322
320
  };
323
- declare function TrustBadge({ proxyUrl, storeDomain, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
321
+ declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
324
322
 
325
- type FloatingReviewButtonProps = ProxyProps & {
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({ proxyUrl, storeDomain, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
330
+ declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
333
331
 
334
- declare function resolveProxyUrl(props: {
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({ proxyUrl, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
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({ proxyUrl, limit }: UseWidgetGlobalsOptions): State$2;
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(proxyUrl: string): UseSubmitReviewReturn;
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(proxyUrl: string): UseHelpfulVoteReturn;
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({ proxyUrl, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
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 ProxyProps, 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, resolveProxyUrl, useForm, useHelpfulVote, useQnA, useReviews, useSubmitReview, useWidgetGlobals };
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 };