@revova/hydrogen 1.0.1 → 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/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,14 +220,13 @@ 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;
236
231
  locale?: string;
237
232
  pageSize?: number;
@@ -239,22 +234,22 @@ type ReviewWidgetProps = ProxyProps & {
239
234
  starColor?: string;
240
235
  className?: string;
241
236
  };
242
- declare function ReviewWidget({ proxyUrl, storeDomain, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
237
+ declare function ReviewWidget({ apiUrl, shop, apiToken, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
243
238
 
244
- type ReviewFormProps = ProxyProps & {
239
+ type ReviewFormProps = ApiProps & {
245
240
  productId: string;
246
241
  form: ResolvedForm;
247
242
  onSuccess?: () => void;
248
243
  className?: string;
249
244
  };
250
- declare function ReviewForm({ proxyUrl, storeDomain, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
245
+ declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
251
246
 
252
- type ReviewCountProps = ProxyProps & {
247
+ type ReviewCountProps = ApiProps & {
253
248
  starColor?: string;
254
249
  starSize?: number;
255
250
  className?: string;
256
251
  };
257
- declare function ReviewCount({ proxyUrl, storeDomain, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
252
+ declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
258
253
 
259
254
  type StarRatingProps = {
260
255
  rating: number;
@@ -265,47 +260,47 @@ type StarRatingProps = {
265
260
  };
266
261
  declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
267
262
 
268
- type ReviewCarouselProps = ProxyProps & {
263
+ type ReviewCarouselProps = ApiProps & {
269
264
  limit?: number;
270
265
  autoPlay?: boolean;
271
266
  intervalMs?: number;
272
267
  starColor?: string;
273
268
  className?: string;
274
269
  };
275
- declare function ReviewCarousel({ proxyUrl, storeDomain, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
270
+ declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
276
271
 
277
- type ReviewGalleryProps = ProxyProps & {
272
+ type ReviewGalleryProps = ApiProps & {
278
273
  limit?: number;
279
274
  columns?: number;
280
275
  starColor?: string;
281
276
  className?: string;
282
277
  };
283
- declare function ReviewGallery({ proxyUrl, storeDomain, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
278
+ declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
284
279
 
285
- type QnAWidgetProps = ProxyProps & {
280
+ type QnAWidgetProps = ApiProps & {
286
281
  productId: string;
287
282
  className?: string;
288
283
  };
289
- declare function QnAWidget({ proxyUrl, storeDomain, productId, className }: QnAWidgetProps): React.JSX.Element | null;
284
+ declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
290
285
 
291
- type SocialProofPopupProps = ProxyProps & {
286
+ type SocialProofPopupProps = ApiProps & {
292
287
  position?: 'bottom-left' | 'bottom-right';
293
288
  intervalMs?: number;
294
289
  displayMs?: number;
295
290
  starColor?: string;
296
291
  className?: string;
297
292
  };
298
- declare function SocialProofPopup({ proxyUrl, storeDomain, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
293
+ declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
299
294
 
300
- type ReviewTickerProps = ProxyProps & {
295
+ type ReviewTickerProps = ApiProps & {
301
296
  limit?: number;
302
297
  speedSeconds?: number;
303
298
  starColor?: string;
304
299
  className?: string;
305
300
  };
306
- declare function ReviewTicker({ proxyUrl, storeDomain, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
301
+ declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
307
302
 
308
- type FloatingReviewsTabProps = ProxyProps & {
303
+ type FloatingReviewsTabProps = ApiProps & {
309
304
  label?: string;
310
305
  position?: 'left' | 'right';
311
306
  color?: string;
@@ -313,28 +308,25 @@ type FloatingReviewsTabProps = ProxyProps & {
313
308
  starColor?: string;
314
309
  className?: string;
315
310
  };
316
- declare function FloatingReviewsTab({ proxyUrl, storeDomain, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
311
+ declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
317
312
 
318
- type TrustBadgeProps = ProxyProps & {
313
+ type TrustBadgeProps = ApiProps & {
319
314
  style?: 'inline' | 'pill' | 'card';
320
315
  starColor?: string;
321
316
  className?: string;
322
317
  };
323
- declare function TrustBadge({ proxyUrl, storeDomain, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
318
+ declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
324
319
 
325
- type FloatingReviewButtonProps = ProxyProps & {
320
+ type FloatingReviewButtonProps = ApiProps & {
326
321
  productId: string;
327
322
  text?: string;
328
323
  color?: string;
329
324
  position?: 'bottom-left' | 'bottom-right';
330
325
  className?: string;
331
326
  };
332
- declare function FloatingReviewButton({ proxyUrl, storeDomain, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
327
+ declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
333
328
 
334
- declare function resolveProxyUrl(props: {
335
- proxyUrl?: string | undefined;
336
- storeDomain?: string | undefined;
337
- }): string;
329
+ declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
338
330
 
339
331
  type State$3 = {
340
332
  data: ReviewsResponse | null;
@@ -348,14 +340,14 @@ type UseReviewsReturn = State$3 & {
348
340
  currentPage: number;
349
341
  currentSort: SortKey;
350
342
  };
351
- declare function useReviews({ proxyUrl, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
343
+ declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
352
344
 
353
345
  type State$2 = {
354
346
  data: WidgetGlobalsResponse | null;
355
347
  loading: boolean;
356
348
  error: Error | null;
357
349
  };
358
- declare function useWidgetGlobals({ proxyUrl, limit }: UseWidgetGlobalsOptions): State$2;
350
+ declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
359
351
 
360
352
  type SubmitState$1 = {
361
353
  submitting: boolean;
@@ -367,14 +359,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
367
359
  submit: (payload: SubmitReviewPayload) => Promise<void>;
368
360
  reset: () => void;
369
361
  };
370
- declare function useSubmitReview(proxyUrl: string): UseSubmitReviewReturn;
362
+ declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
371
363
 
372
364
  type UseHelpfulVoteReturn = {
373
365
  vote: (payload: HelpfulVotePayload) => Promise<void>;
374
366
  loading: boolean;
375
367
  voted: boolean;
376
368
  };
377
- declare function useHelpfulVote(proxyUrl: string): UseHelpfulVoteReturn;
369
+ declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
378
370
 
379
371
  type State$1 = {
380
372
  data: QnAResponse | null;
@@ -395,17 +387,13 @@ type UseQnAReturn = State$1 & {
395
387
  submitState: SubmitState;
396
388
  resetSubmit: () => void;
397
389
  };
398
- declare function useQnA({ proxyUrl, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
390
+ declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
399
391
 
400
392
  type State = {
401
393
  form: ResolvedForm | null;
402
394
  loading: boolean;
403
395
  error: Error | null;
404
396
  };
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;
397
+ declare function useForm(creds: ApiProps, productId: string): State;
410
398
 
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 };
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
@@ -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,14 +220,13 @@ 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;
236
231
  locale?: string;
237
232
  pageSize?: number;
@@ -239,22 +234,22 @@ type ReviewWidgetProps = ProxyProps & {
239
234
  starColor?: string;
240
235
  className?: string;
241
236
  };
242
- declare function ReviewWidget({ proxyUrl, storeDomain, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
237
+ declare function ReviewWidget({ apiUrl, shop, apiToken, productId, locale, pageSize, showForm, starColor, className, }: ReviewWidgetProps): React.JSX.Element | null;
243
238
 
244
- type ReviewFormProps = ProxyProps & {
239
+ type ReviewFormProps = ApiProps & {
245
240
  productId: string;
246
241
  form: ResolvedForm;
247
242
  onSuccess?: () => void;
248
243
  className?: string;
249
244
  };
250
- declare function ReviewForm({ proxyUrl, storeDomain, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
245
+ declare function ReviewForm({ apiUrl, shop, apiToken, productId, form, onSuccess, className }: ReviewFormProps): React.JSX.Element;
251
246
 
252
- type ReviewCountProps = ProxyProps & {
247
+ type ReviewCountProps = ApiProps & {
253
248
  starColor?: string;
254
249
  starSize?: number;
255
250
  className?: string;
256
251
  };
257
- declare function ReviewCount({ proxyUrl, storeDomain, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
252
+ declare function ReviewCount({ apiUrl, shop, apiToken, starColor, starSize, className }: ReviewCountProps): React.JSX.Element | null;
258
253
 
259
254
  type StarRatingProps = {
260
255
  rating: number;
@@ -265,47 +260,47 @@ type StarRatingProps = {
265
260
  };
266
261
  declare function StarRating({ rating, max, size, color, className }: StarRatingProps): React.JSX.Element;
267
262
 
268
- type ReviewCarouselProps = ProxyProps & {
263
+ type ReviewCarouselProps = ApiProps & {
269
264
  limit?: number;
270
265
  autoPlay?: boolean;
271
266
  intervalMs?: number;
272
267
  starColor?: string;
273
268
  className?: string;
274
269
  };
275
- declare function ReviewCarousel({ proxyUrl, storeDomain, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
270
+ declare function ReviewCarousel({ apiUrl, shop, apiToken, limit, autoPlay, intervalMs, starColor, className, }: ReviewCarouselProps): React.JSX.Element | null;
276
271
 
277
- type ReviewGalleryProps = ProxyProps & {
272
+ type ReviewGalleryProps = ApiProps & {
278
273
  limit?: number;
279
274
  columns?: number;
280
275
  starColor?: string;
281
276
  className?: string;
282
277
  };
283
- declare function ReviewGallery({ proxyUrl, storeDomain, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
278
+ declare function ReviewGallery({ apiUrl, shop, apiToken, limit, columns, starColor, className, }: ReviewGalleryProps): React.JSX.Element | null;
284
279
 
285
- type QnAWidgetProps = ProxyProps & {
280
+ type QnAWidgetProps = ApiProps & {
286
281
  productId: string;
287
282
  className?: string;
288
283
  };
289
- declare function QnAWidget({ proxyUrl, storeDomain, productId, className }: QnAWidgetProps): React.JSX.Element | null;
284
+ declare function QnAWidget({ apiUrl, shop, apiToken, productId, className }: QnAWidgetProps): React.JSX.Element | null;
290
285
 
291
- type SocialProofPopupProps = ProxyProps & {
286
+ type SocialProofPopupProps = ApiProps & {
292
287
  position?: 'bottom-left' | 'bottom-right';
293
288
  intervalMs?: number;
294
289
  displayMs?: number;
295
290
  starColor?: string;
296
291
  className?: string;
297
292
  };
298
- declare function SocialProofPopup({ proxyUrl, storeDomain, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
293
+ declare function SocialProofPopup({ apiUrl, shop, apiToken, position, intervalMs, displayMs, starColor, className, }: SocialProofPopupProps): React.JSX.Element | null;
299
294
 
300
- type ReviewTickerProps = ProxyProps & {
295
+ type ReviewTickerProps = ApiProps & {
301
296
  limit?: number;
302
297
  speedSeconds?: number;
303
298
  starColor?: string;
304
299
  className?: string;
305
300
  };
306
- declare function ReviewTicker({ proxyUrl, storeDomain, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
301
+ declare function ReviewTicker({ apiUrl, shop, apiToken, limit, speedSeconds, starColor, className, }: ReviewTickerProps): React.JSX.Element | null;
307
302
 
308
- type FloatingReviewsTabProps = ProxyProps & {
303
+ type FloatingReviewsTabProps = ApiProps & {
309
304
  label?: string;
310
305
  position?: 'left' | 'right';
311
306
  color?: string;
@@ -313,28 +308,25 @@ type FloatingReviewsTabProps = ProxyProps & {
313
308
  starColor?: string;
314
309
  className?: string;
315
310
  };
316
- declare function FloatingReviewsTab({ proxyUrl, storeDomain, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
311
+ declare function FloatingReviewsTab({ apiUrl, shop, apiToken, label, position, color, limit, starColor, className, }: FloatingReviewsTabProps): React.JSX.Element;
317
312
 
318
- type TrustBadgeProps = ProxyProps & {
313
+ type TrustBadgeProps = ApiProps & {
319
314
  style?: 'inline' | 'pill' | 'card';
320
315
  starColor?: string;
321
316
  className?: string;
322
317
  };
323
- declare function TrustBadge({ proxyUrl, storeDomain, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
318
+ declare function TrustBadge({ apiUrl, shop, apiToken, style: badgeStyle, starColor, className }: TrustBadgeProps): React.JSX.Element | null;
324
319
 
325
- type FloatingReviewButtonProps = ProxyProps & {
320
+ type FloatingReviewButtonProps = ApiProps & {
326
321
  productId: string;
327
322
  text?: string;
328
323
  color?: string;
329
324
  position?: 'bottom-left' | 'bottom-right';
330
325
  className?: string;
331
326
  };
332
- declare function FloatingReviewButton({ proxyUrl, storeDomain, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
327
+ declare function FloatingReviewButton({ apiUrl, shop, apiToken, productId, text, color, position, className, }: FloatingReviewButtonProps): React.JSX.Element | null;
333
328
 
334
- declare function resolveProxyUrl(props: {
335
- proxyUrl?: string | undefined;
336
- storeDomain?: string | undefined;
337
- }): string;
329
+ declare function apiFetch({ apiUrl, shop, apiToken }: ApiProps, path: string, params?: Record<string, string>, init?: RequestInit): Promise<Response>;
338
330
 
339
331
  type State$3 = {
340
332
  data: ReviewsResponse | null;
@@ -348,14 +340,14 @@ type UseReviewsReturn = State$3 & {
348
340
  currentPage: number;
349
341
  currentSort: SortKey;
350
342
  };
351
- declare function useReviews({ proxyUrl, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
343
+ declare function useReviews({ apiUrl, shop, apiToken, productId, page: initialPage, limit, sort: initialSort, locale, }: UseReviewsOptions): UseReviewsReturn;
352
344
 
353
345
  type State$2 = {
354
346
  data: WidgetGlobalsResponse | null;
355
347
  loading: boolean;
356
348
  error: Error | null;
357
349
  };
358
- declare function useWidgetGlobals({ proxyUrl, limit }: UseWidgetGlobalsOptions): State$2;
350
+ declare function useWidgetGlobals({ apiUrl, shop, apiToken, limit }: UseWidgetGlobalsOptions): State$2;
359
351
 
360
352
  type SubmitState$1 = {
361
353
  submitting: boolean;
@@ -367,14 +359,14 @@ type UseSubmitReviewReturn = SubmitState$1 & {
367
359
  submit: (payload: SubmitReviewPayload) => Promise<void>;
368
360
  reset: () => void;
369
361
  };
370
- declare function useSubmitReview(proxyUrl: string): UseSubmitReviewReturn;
362
+ declare function useSubmitReview(creds: ApiProps): UseSubmitReviewReturn;
371
363
 
372
364
  type UseHelpfulVoteReturn = {
373
365
  vote: (payload: HelpfulVotePayload) => Promise<void>;
374
366
  loading: boolean;
375
367
  voted: boolean;
376
368
  };
377
- declare function useHelpfulVote(proxyUrl: string): UseHelpfulVoteReturn;
369
+ declare function useHelpfulVote(creds: ApiProps): UseHelpfulVoteReturn;
378
370
 
379
371
  type State$1 = {
380
372
  data: QnAResponse | null;
@@ -395,17 +387,13 @@ type UseQnAReturn = State$1 & {
395
387
  submitState: SubmitState;
396
388
  resetSubmit: () => void;
397
389
  };
398
- declare function useQnA({ proxyUrl, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
390
+ declare function useQnA({ apiUrl, shop, apiToken, productId, page: initialPage, sort }: UseQnAOptions): UseQnAReturn;
399
391
 
400
392
  type State = {
401
393
  form: ResolvedForm | null;
402
394
  loading: boolean;
403
395
  error: Error | null;
404
396
  };
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;
397
+ declare function useForm(creds: ApiProps, productId: string): State;
410
398
 
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 };
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 };