@nosto/nosto-react 2.2.1 → 2.3.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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.d.ts +23 -192
  3. package/dist/index.es.js +249 -221
  4. package/dist/index.umd.js +1 -1
  5. package/package.json +20 -17
  6. package/src/components/Nosto404.tsx +2 -25
  7. package/src/components/NostoCategory.tsx +2 -30
  8. package/src/components/NostoCheckout.tsx +2 -25
  9. package/src/components/NostoHome.tsx +2 -26
  10. package/src/components/NostoOrder.tsx +2 -33
  11. package/src/components/NostoOther.tsx +2 -25
  12. package/src/components/NostoPlacement.tsx +1 -1
  13. package/src/components/NostoProduct.tsx +2 -32
  14. package/src/components/NostoProvider.tsx +5 -9
  15. package/src/components/NostoSearch.tsx +2 -30
  16. package/src/components/NostoSession.tsx +2 -42
  17. package/src/context.ts +2 -2
  18. package/src/hooks/scriptLoader.ts +4 -4
  19. package/src/hooks/useDeepCompareEffect.ts +1 -4
  20. package/src/hooks/useLoadClientScript.ts +26 -17
  21. package/src/hooks/useNosto404.tsx +25 -0
  22. package/src/hooks/useNostoApi.ts +4 -7
  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 +43 -0
  30. package/src/hooks/useNostoSearch.tsx +31 -0
  31. package/src/hooks/useNostoSession.tsx +34 -0
  32. package/src/hooks/useRenderCampaigns.tsx +12 -9
  33. package/src/index.ts +23 -3
  34. package/src/types.ts +1 -923
  35. package/src/utils/types.ts +5 -3
  36. package/src/components/helpers.ts +0 -3
  37. package/src/components/index.ts +0 -11
  38. package/src/hooks/index.ts +0 -5
@@ -5,7 +5,8 @@ type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}`
5
5
  // Recursive type to apply the conversion to all keys in an object type
6
6
  export type ToCamelCase<T> = T extends (infer U)[]
7
7
  ? ToCamelCase<U>[]
8
- : T extends Date ? T
8
+ : T extends Date
9
+ ? T
9
10
  : T extends object
10
11
  ? {
11
12
  [K in keyof T as SnakeToCamelCase<K & string>]: ToCamelCase<T[K]>
@@ -21,9 +22,10 @@ type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}`
21
22
  // Recursive type to apply the conversion to all keys in an object type
22
23
  export type ToSnakeCase<T> = T extends (infer U)[]
23
24
  ? ToSnakeCase<U>[]
24
- : T extends Date ? T
25
+ : T extends Date
26
+ ? T
25
27
  : T extends object
26
28
  ? {
27
29
  [K in keyof T as CamelToSnakeCase<K & string>]: ToSnakeCase<T[K]>
28
30
  }
29
- : T
31
+ : T
@@ -1,3 +0,0 @@
1
- export function isNostoLoaded() {
2
- return typeof window.nosto !== "undefined"
3
- }
@@ -1,11 +0,0 @@
1
- export { default as Nosto404, useNosto404, type Nosto404Props } from "./Nosto404"
2
- export { default as NostoOther, useNostoOther, type NostoOtherProps } from "./NostoOther"
3
- export { default as NostoCheckout, useNostoCheckout, type NostoCheckoutProps } from "./NostoCheckout"
4
- export { default as NostoProduct, useNostoProduct, type NostoProductProps } from "./NostoProduct"
5
- export { default as NostoCategory, useNostoCategory, type NostoCategoryProps } from "./NostoCategory"
6
- export { default as NostoSearch, useNostoSearch, type NostoSearchProps } from "./NostoSearch"
7
- export { default as NostoOrder, useNostoOrder, type NostoOrderProps } from "./NostoOrder"
8
- export { default as NostoHome, useNostoHome, type NostoHomeProps } from "./NostoHome"
9
- export { default as NostoPlacement, type NostoPlacementProps } from "./NostoPlacement"
10
- export { default as NostoProvider, type NostoProviderProps } from "./NostoProvider"
11
- export { default as NostoSession, useNostoSession, type NostoSessionProps } from "./NostoSession"
@@ -1,5 +0,0 @@
1
- export { useDeepCompareEffect } from "./useDeepCompareEffect"
2
- export { useNostoApi } from "./useNostoApi"
3
- export { useNostoContext } from "./useNostoContext"
4
- export { useRenderCampaigns } from "./useRenderCampaigns"
5
- export { useLoadClientScript } from "./useLoadClientScript"