@nosto/nosto-react 2.2.0 → 2.2.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.
Files changed (37) hide show
  1. package/dist/index.d.ts +13 -16
  2. package/dist/index.es.js +257 -866
  3. package/dist/index.umd.js +1 -25
  4. package/package.json +3 -3
  5. package/src/components/Nosto404.tsx +2 -25
  6. package/src/components/NostoCategory.tsx +2 -30
  7. package/src/components/NostoCheckout.tsx +2 -25
  8. package/src/components/NostoHome.tsx +2 -26
  9. package/src/components/NostoOrder.tsx +2 -33
  10. package/src/components/NostoOther.tsx +2 -25
  11. package/src/components/NostoPlacement.tsx +1 -1
  12. package/src/components/NostoProduct.tsx +2 -32
  13. package/src/components/NostoProvider.tsx +11 -10
  14. package/src/components/NostoSearch.tsx +2 -30
  15. package/src/components/NostoSession.tsx +2 -43
  16. package/src/components/helpers.ts +2 -2
  17. package/src/context.ts +0 -1
  18. package/src/hooks/scriptLoader.ts +4 -4
  19. package/src/hooks/useDeepCompareEffect.ts +4 -7
  20. package/src/hooks/useLoadClientScript.ts +9 -4
  21. package/src/hooks/useNosto404.tsx +25 -0
  22. package/src/hooks/useNostoApi.ts +4 -11
  23. package/src/hooks/useNostoCategory.tsx +31 -0
  24. package/src/hooks/useNostoCheckout.tsx +25 -0
  25. package/src/hooks/useNostoContext.ts +2 -3
  26. package/src/hooks/useNostoHome.tsx +25 -0
  27. package/src/hooks/useNostoOrder.tsx +35 -0
  28. package/src/hooks/useNostoOther.tsx +25 -0
  29. package/src/hooks/useNostoProduct.tsx +37 -0
  30. package/src/hooks/useNostoSearch.tsx +31 -0
  31. package/src/hooks/useNostoSession.tsx +33 -0
  32. package/src/hooks/useRenderCampaigns.tsx +10 -8
  33. package/src/index.ts +21 -2
  34. package/src/types.ts +775 -733
  35. package/src/utils/types.ts +5 -3
  36. package/src/components/index.ts +0 -11
  37. package/src/hooks/index.ts +0 -5
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Context } from 'react';
2
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
  import { ReactElement } from 'react';
4
+ import { ReactNode } from 'react';
4
5
 
5
6
  declare type AnyFunction = (...args: unknown[]) => unknown;
6
7
 
@@ -12,8 +13,6 @@ export declare interface Cart {
12
13
  items: CartItem[];
13
14
  }
14
15
 
15
- declare type Cart_2 = Cart | ToCamelCase<Cart>;
16
-
17
16
  /**
18
17
  * @group Types
19
18
  */
@@ -54,8 +53,6 @@ export declare interface Customer {
54
53
  type?: string;
55
54
  }
56
55
 
57
- declare type Customer_2 = Customer | ToCamelCase<Customer>;
58
-
59
56
  /**
60
57
  * You can personalise your cart and checkout pages by using the `Nosto404` component.
61
58
  * The component does not require any props.
@@ -79,7 +76,7 @@ declare type Customer_2 = Customer | ToCamelCase<Customer>;
79
76
  export declare function Nosto404(props: Nosto404Props): null;
80
77
 
81
78
  /**
82
- * @group Components
79
+ * @group Hooks
83
80
  */
84
81
  export declare type Nosto404Props = {
85
82
  placements?: string[];
@@ -110,7 +107,7 @@ export declare type Nosto404Props = {
110
107
  export declare function NostoCategory(props: NostoCategoryProps): null;
111
108
 
112
109
  /**
113
- * @group Components
110
+ * @group Hooks
114
111
  */
115
112
  export declare type NostoCategoryProps = {
116
113
  category: string;
@@ -139,7 +136,7 @@ export declare type NostoCategoryProps = {
139
136
  export declare function NostoCheckout(props: NostoCheckoutProps): null;
140
137
 
141
138
  /**
142
- * @group Components
139
+ * @group Hooks
143
140
  */
144
141
  export declare type NostoCheckoutProps = {
145
142
  placements?: string[];
@@ -188,7 +185,7 @@ export declare interface NostoContextType {
188
185
  export declare function NostoHome(props: NostoHomeProps): null;
189
186
 
190
187
  /**
191
- * @group Components
188
+ * @group Hooks
192
189
  */
193
190
  export declare type NostoHomeProps = {
194
191
  placements?: string[];
@@ -216,10 +213,10 @@ export declare type NostoHomeProps = {
216
213
  export declare function NostoOrder(props: NostoOrderProps): null;
217
214
 
218
215
  /**
219
- * @group Components
216
+ * @group Hooks
220
217
  */
221
218
  export declare type NostoOrderProps = {
222
- order: Order;
219
+ order: Order | ToCamelCase<Order>;
223
220
  placements?: string[];
224
221
  };
225
222
 
@@ -245,7 +242,7 @@ export declare type NostoOrderProps = {
245
242
  export declare function NostoOther(props: NostoOtherProps): null;
246
243
 
247
244
  /**
248
- * @group Components
245
+ * @group Hooks
249
246
  */
250
247
  export declare type NostoOtherProps = {
251
248
  placements?: string[];
@@ -301,7 +298,7 @@ export declare type NostoPlacementProps = {
301
298
  export declare function NostoProduct(props: NostoProductProps): null;
302
299
 
303
300
  /**
304
- * @group Components
301
+ * @group Hooks
305
302
  */
306
303
  export declare type NostoProductProps = {
307
304
  product: string;
@@ -351,7 +348,7 @@ export declare interface NostoProviderProps {
351
348
  /**
352
349
  * children
353
350
  */
354
- children: ReactElement | ReactElement[];
351
+ children: ReactNode | ReactNode[];
355
352
  /**
356
353
  * Indicates if merchant uses multiple currencies
357
354
  */
@@ -423,11 +420,11 @@ export declare type NostoSearchProps = {
423
420
  export declare function NostoSession(props?: NostoSessionProps): null;
424
421
 
425
422
  /**
426
- * @group Components
423
+ * @group Hooks
427
424
  */
428
425
  export declare type NostoSessionProps = {
429
- cart?: Cart_2;
430
- customer?: Customer_2;
426
+ cart?: Cart | ToCamelCase<Cart>;
427
+ customer?: Customer | ToCamelCase<Customer>;
431
428
  };
432
429
 
433
430
  declare interface NostoSku extends Sku {