@propeller-commerce/propeller-v2-react-ui 0.16.0 → 0.18.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
@@ -894,6 +894,13 @@ interface FavoriteListFormData {
894
894
  isDefault: boolean;
895
895
  }
896
896
  /** Options for {@link useFavorites}. */
897
+ /** What a favorite-list mutation did — see `onListChanged`. */
898
+ interface FavoriteListChange {
899
+ action: 'created' | 'updated' | 'deleted';
900
+ listId?: string | number;
901
+ name?: string;
902
+ isDefault?: boolean;
903
+ }
897
904
  interface UseFavoritesOptions {
898
905
  /** GraphQL client the hook derives its Services bundle from. */
899
906
  graphqlClient: GraphQLClient;
@@ -908,7 +915,15 @@ interface UseFavoritesOptions {
908
915
  /** Override: fires instead of the default `deleteFavoriteList` call. */
909
916
  onDelete?: (id: string) => void;
910
917
  /** Fires after any list create / update / delete completes. */
911
- onListChanged?: () => void;
918
+ /**
919
+ * Called after a list mutation succeeds.
920
+ *
921
+ * The `change` argument is optional so existing zero-argument callbacks keep
922
+ * working, but without it a host cannot tell a create from a delete — which
923
+ * makes the hook useless for analytics, audit trails or optimistic UI that
924
+ * needs to know WHAT happened rather than merely THAT something did.
925
+ */
926
+ onListChanged?: (change?: FavoriteListChange) => void;
912
927
  }
913
928
  /** State and favorite-list actions returned by {@link useFavorites}. */
914
929
  interface UseFavoritesReturn {
@@ -1412,6 +1427,9 @@ interface UseProductSearchOptions {
1412
1427
  /** Portal configuration: base category fallback plus image filters. */
1413
1428
  configuration: {
1414
1429
  baseCategoryId?: number;
1430
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1431
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1432
+ anonymousUserId?: number;
1415
1433
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
1416
1434
  imageVariantFiltersMedium?: TransformationsInput;
1417
1435
  };
@@ -1547,6 +1565,9 @@ interface UseQuickOrderOptions {
1547
1565
  imageVariantFiltersSmall?: TransformationsInput;
1548
1566
  /** Catalog root. Without it the search returns nothing — see `searchProducts`. */
1549
1567
  baseCategoryId?: number;
1568
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1569
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1570
+ anonymousUserId?: number;
1550
1571
  };
1551
1572
  /** Fires when `submit` creates a fresh cart — persist the cart id. */
1552
1573
  onCartCreated?: (cart: Cart) => void;
@@ -1659,6 +1680,9 @@ interface UseSparePartsOptions {
1659
1680
  pageSize?: number;
1660
1681
  /** Image filter config, mirroring `useProductSearch`'s `configuration`. */
1661
1682
  configuration?: {
1683
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1684
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1685
+ anonymousUserId?: number;
1662
1686
  imageSearchFiltersGrid?: unknown;
1663
1687
  imageVariantFiltersMedium?: unknown;
1664
1688
  };
@@ -1773,6 +1797,9 @@ interface UseProductSliderOptions {
1773
1797
  companyId?: number;
1774
1798
  /** Portal configuration: image search/variant filters. */
1775
1799
  configuration?: {
1800
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1801
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1802
+ anonymousUserId?: number;
1776
1803
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
1777
1804
  imageVariantFiltersMedium?: TransformationsInput;
1778
1805
  };
@@ -2779,6 +2806,13 @@ interface AddToCartEvents {
2779
2806
  declare function AddToCart(rawProps: AddToCartProps): React$1.JSX.Element;
2780
2807
  declare const _default$1: React$1.MemoExoticComponent<typeof AddToCart>;
2781
2808
 
2809
+ /** Which way the favorite toggle went — see `onFavoriteChanged`. */
2810
+ interface FavoriteChange {
2811
+ action: 'added' | 'removed';
2812
+ listId?: string | number;
2813
+ productId?: number;
2814
+ clusterId?: number;
2815
+ }
2782
2816
  interface AddToFavoriteProps {
2783
2817
  /** The initialized GraphQL Client instance. Resolved from PropellerProvider when omitted. */
2784
2818
  graphqlClient?: GraphQLClient;
@@ -2793,7 +2827,15 @@ interface AddToFavoriteProps {
2793
2827
  /** UI string overrides */
2794
2828
  labels?: Record<string, string>;
2795
2829
  /** Called after a favorite list mutation (add/remove) succeeds */
2796
- onFavoriteChanged?: () => void;
2830
+ /**
2831
+ * Called after the favorite toggle succeeds, with which way it went.
2832
+ *
2833
+ * The argument is optional so existing zero-argument callbacks keep working.
2834
+ * Without it an add and a removal are indistinguishable, so a host cannot
2835
+ * report "added to wishlist" without inventing the direction — and a
2836
+ * wishlist metric that also counts removals is worse than none.
2837
+ */
2838
+ onFavoriteChanged?: (change?: FavoriteChange) => void;
2797
2839
  }
2798
2840
  /**
2799
2841
  * Favorite toggle button for a product or cluster: opens a modal to add the
@@ -4531,8 +4573,12 @@ interface FavoriteListsProps {
4531
4573
  }) => void;
4532
4574
  /** Action function triggered when deleting a favorite list. If not provided, the default action is executed */
4533
4575
  onDelete?: (favoriteListId: string) => void;
4534
- /** Called after any list mutation (create, edit, delete) succeeds */
4535
- onListChanged?: () => void;
4576
+ /**
4577
+ * Called after any list mutation succeeds, with what it did.
4578
+ *
4579
+ * The argument is optional so existing zero-argument callbacks keep working.
4580
+ */
4581
+ onListChanged?: (change?: FavoriteListChange) => void;
4536
4582
  }
4537
4583
  /**
4538
4584
  * Lists the user's favorite lists with inline edit, delete and create-list
@@ -5418,6 +5464,9 @@ interface QuickOrderProps {
5418
5464
  * has no access to.
5419
5465
  */
5420
5466
  baseCategoryId?: number;
5467
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
5468
+ * listings exactly like the SSR seed does (PWP-942 #22). */
5469
+ anonymousUserId?: number;
5421
5470
  };
5422
5471
  /** Tax zone for price calculation. Defaults to `'NL'`. */
5423
5472
  taxZone?: string;
@@ -5440,6 +5489,12 @@ interface QuickOrderProps {
5440
5489
  parseSpreadsheet?: (file: File) => Promise<QuickOrderUploadLine[]>;
5441
5490
  /** URL to a downloadable XLSX template (shown next to the upload control). */
5442
5491
  templateUrl?: string;
5492
+ /**
5493
+ * Called when the template link is clicked. Navigation is untouched — this is
5494
+ * a notification, not a handler: a buyer fetching the template is a
5495
+ * quick-order intent signal that otherwise leaves no trace at all.
5496
+ */
5497
+ onTemplateDownload?: () => void;
5443
5498
  /** Max upload file size in bytes. Defaults to 2 MB. */
5444
5499
  maxUploadBytes?: number;
5445
5500
  /** Max rows accepted from an upload. Defaults to 500. */
@@ -6312,6 +6367,9 @@ interface ProductGridProps {
6312
6367
  */
6313
6368
  configuration?: {
6314
6369
  baseCategoryId?: number;
6370
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
6371
+ * listings exactly like the SSR seed does (PWP-942 #22). */
6372
+ anonymousUserId?: number;
6315
6373
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
6316
6374
  imageVariantFiltersMedium?: TransformationsInput;
6317
6375
  urls?: {
package/dist/index.d.ts CHANGED
@@ -894,6 +894,13 @@ interface FavoriteListFormData {
894
894
  isDefault: boolean;
895
895
  }
896
896
  /** Options for {@link useFavorites}. */
897
+ /** What a favorite-list mutation did — see `onListChanged`. */
898
+ interface FavoriteListChange {
899
+ action: 'created' | 'updated' | 'deleted';
900
+ listId?: string | number;
901
+ name?: string;
902
+ isDefault?: boolean;
903
+ }
897
904
  interface UseFavoritesOptions {
898
905
  /** GraphQL client the hook derives its Services bundle from. */
899
906
  graphqlClient: GraphQLClient;
@@ -908,7 +915,15 @@ interface UseFavoritesOptions {
908
915
  /** Override: fires instead of the default `deleteFavoriteList` call. */
909
916
  onDelete?: (id: string) => void;
910
917
  /** Fires after any list create / update / delete completes. */
911
- onListChanged?: () => void;
918
+ /**
919
+ * Called after a list mutation succeeds.
920
+ *
921
+ * The `change` argument is optional so existing zero-argument callbacks keep
922
+ * working, but without it a host cannot tell a create from a delete — which
923
+ * makes the hook useless for analytics, audit trails or optimistic UI that
924
+ * needs to know WHAT happened rather than merely THAT something did.
925
+ */
926
+ onListChanged?: (change?: FavoriteListChange) => void;
912
927
  }
913
928
  /** State and favorite-list actions returned by {@link useFavorites}. */
914
929
  interface UseFavoritesReturn {
@@ -1412,6 +1427,9 @@ interface UseProductSearchOptions {
1412
1427
  /** Portal configuration: base category fallback plus image filters. */
1413
1428
  configuration: {
1414
1429
  baseCategoryId?: number;
1430
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1431
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1432
+ anonymousUserId?: number;
1415
1433
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
1416
1434
  imageVariantFiltersMedium?: TransformationsInput;
1417
1435
  };
@@ -1547,6 +1565,9 @@ interface UseQuickOrderOptions {
1547
1565
  imageVariantFiltersSmall?: TransformationsInput;
1548
1566
  /** Catalog root. Without it the search returns nothing — see `searchProducts`. */
1549
1567
  baseCategoryId?: number;
1568
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1569
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1570
+ anonymousUserId?: number;
1550
1571
  };
1551
1572
  /** Fires when `submit` creates a fresh cart — persist the cart id. */
1552
1573
  onCartCreated?: (cart: Cart) => void;
@@ -1659,6 +1680,9 @@ interface UseSparePartsOptions {
1659
1680
  pageSize?: number;
1660
1681
  /** Image filter config, mirroring `useProductSearch`'s `configuration`. */
1661
1682
  configuration?: {
1683
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1684
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1685
+ anonymousUserId?: number;
1662
1686
  imageSearchFiltersGrid?: unknown;
1663
1687
  imageVariantFiltersMedium?: unknown;
1664
1688
  };
@@ -1773,6 +1797,9 @@ interface UseProductSliderOptions {
1773
1797
  companyId?: number;
1774
1798
  /** Portal configuration: image search/variant filters. */
1775
1799
  configuration?: {
1800
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
1801
+ * listings exactly like the SSR seed does (PWP-942 #22). */
1802
+ anonymousUserId?: number;
1776
1803
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
1777
1804
  imageVariantFiltersMedium?: TransformationsInput;
1778
1805
  };
@@ -2779,6 +2806,13 @@ interface AddToCartEvents {
2779
2806
  declare function AddToCart(rawProps: AddToCartProps): React$1.JSX.Element;
2780
2807
  declare const _default$1: React$1.MemoExoticComponent<typeof AddToCart>;
2781
2808
 
2809
+ /** Which way the favorite toggle went — see `onFavoriteChanged`. */
2810
+ interface FavoriteChange {
2811
+ action: 'added' | 'removed';
2812
+ listId?: string | number;
2813
+ productId?: number;
2814
+ clusterId?: number;
2815
+ }
2782
2816
  interface AddToFavoriteProps {
2783
2817
  /** The initialized GraphQL Client instance. Resolved from PropellerProvider when omitted. */
2784
2818
  graphqlClient?: GraphQLClient;
@@ -2793,7 +2827,15 @@ interface AddToFavoriteProps {
2793
2827
  /** UI string overrides */
2794
2828
  labels?: Record<string, string>;
2795
2829
  /** Called after a favorite list mutation (add/remove) succeeds */
2796
- onFavoriteChanged?: () => void;
2830
+ /**
2831
+ * Called after the favorite toggle succeeds, with which way it went.
2832
+ *
2833
+ * The argument is optional so existing zero-argument callbacks keep working.
2834
+ * Without it an add and a removal are indistinguishable, so a host cannot
2835
+ * report "added to wishlist" without inventing the direction — and a
2836
+ * wishlist metric that also counts removals is worse than none.
2837
+ */
2838
+ onFavoriteChanged?: (change?: FavoriteChange) => void;
2797
2839
  }
2798
2840
  /**
2799
2841
  * Favorite toggle button for a product or cluster: opens a modal to add the
@@ -4531,8 +4573,12 @@ interface FavoriteListsProps {
4531
4573
  }) => void;
4532
4574
  /** Action function triggered when deleting a favorite list. If not provided, the default action is executed */
4533
4575
  onDelete?: (favoriteListId: string) => void;
4534
- /** Called after any list mutation (create, edit, delete) succeeds */
4535
- onListChanged?: () => void;
4576
+ /**
4577
+ * Called after any list mutation succeeds, with what it did.
4578
+ *
4579
+ * The argument is optional so existing zero-argument callbacks keep working.
4580
+ */
4581
+ onListChanged?: (change?: FavoriteListChange) => void;
4536
4582
  }
4537
4583
  /**
4538
4584
  * Lists the user's favorite lists with inline edit, delete and create-list
@@ -5418,6 +5464,9 @@ interface QuickOrderProps {
5418
5464
  * has no access to.
5419
5465
  */
5420
5466
  baseCategoryId?: number;
5467
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
5468
+ * listings exactly like the SSR seed does (PWP-942 #22). */
5469
+ anonymousUserId?: number;
5421
5470
  };
5422
5471
  /** Tax zone for price calculation. Defaults to `'NL'`. */
5423
5472
  taxZone?: string;
@@ -5440,6 +5489,12 @@ interface QuickOrderProps {
5440
5489
  parseSpreadsheet?: (file: File) => Promise<QuickOrderUploadLine[]>;
5441
5490
  /** URL to a downloadable XLSX template (shown next to the upload control). */
5442
5491
  templateUrl?: string;
5492
+ /**
5493
+ * Called when the template link is clicked. Navigation is untouched — this is
5494
+ * a notification, not a handler: a buyer fetching the template is a
5495
+ * quick-order intent signal that otherwise leaves no trace at all.
5496
+ */
5497
+ onTemplateDownload?: () => void;
5443
5498
  /** Max upload file size in bytes. Defaults to 2 MB. */
5444
5499
  maxUploadBytes?: number;
5445
5500
  /** Max rows accepted from an upload. Defaults to 500. */
@@ -6312,6 +6367,9 @@ interface ProductGridProps {
6312
6367
  */
6313
6368
  configuration?: {
6314
6369
  baseCategoryId?: number;
6370
+ /** The channel's anonymous user, seeded by the host. Scopes logged-out
6371
+ * listings exactly like the SSR seed does (PWP-942 #22). */
6372
+ anonymousUserId?: number;
6315
6373
  imageSearchFiltersGrid?: MediaImageProductSearchInput;
6316
6374
  imageVariantFiltersMedium?: TransformationsInput;
6317
6375
  urls?: {