@nosto/nosto-react 2.0.0 → 2.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.ts +26 -4
- package/dist/index.es.js +532 -536
- package/dist/index.umd.js +9 -9
- package/package.json +8 -19
- package/src/components/NostoPlacement.tsx +0 -2
- package/src/components/NostoProvider.tsx +21 -77
- package/src/components/index.ts +1 -1
- package/src/context.ts +2 -2
- package/src/hooks/index.ts +2 -1
- package/src/hooks/scriptLoader.ts +30 -0
- package/src/hooks/useLoadClientScript.ts +84 -0
- package/src/hooks/useNostoApi.ts +2 -2
- package/src/hooks/useNostoContext.ts +1 -7
- package/src/hooks/useRenderCampaigns.tsx +2 -3
- package/src/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from 'react';
|
|
2
|
-
import { default as default_2 } from 'react';
|
|
3
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
4
|
|
|
5
5
|
declare type AnyFunction = (...args: unknown[]) => unknown;
|
|
6
6
|
|
|
@@ -291,7 +291,7 @@ export declare function NostoProvider(props: NostoProviderProps): JSX_2.Element;
|
|
|
291
291
|
/**
|
|
292
292
|
* @group Components
|
|
293
293
|
*/
|
|
294
|
-
declare interface NostoProviderProps {
|
|
294
|
+
export declare interface NostoProviderProps {
|
|
295
295
|
/**
|
|
296
296
|
* Indicates merchant id
|
|
297
297
|
*/
|
|
@@ -307,7 +307,7 @@ declare interface NostoProviderProps {
|
|
|
307
307
|
/**
|
|
308
308
|
* children
|
|
309
309
|
*/
|
|
310
|
-
children:
|
|
310
|
+
children: ReactElement | ReactElement[];
|
|
311
311
|
/**
|
|
312
312
|
* Indicates if merchant uses multiple currencies
|
|
313
313
|
*/
|
|
@@ -323,6 +323,14 @@ declare interface NostoProviderProps {
|
|
|
323
323
|
language?: string;
|
|
324
324
|
marketId?: string | number;
|
|
325
325
|
};
|
|
326
|
+
/**
|
|
327
|
+
* Load nosto script (should be false if loading the script outside of nosto-react)
|
|
328
|
+
*/
|
|
329
|
+
loadScript?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Custom script loader
|
|
332
|
+
*/
|
|
333
|
+
scriptLoader?: (scriptSrc: string, options?: ScriptLoadOptions) => Promise<void>;
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
/**
|
|
@@ -481,7 +489,7 @@ export declare interface Recommendation {
|
|
|
481
489
|
params: unknown;
|
|
482
490
|
}
|
|
483
491
|
|
|
484
|
-
declare type RecommendationComponent =
|
|
492
|
+
declare type RecommendationComponent = ReactElement<{
|
|
485
493
|
nostoRecommendation: Recommendation;
|
|
486
494
|
}>;
|
|
487
495
|
|
|
@@ -490,6 +498,20 @@ declare type RecommendationComponent = React.ReactElement<{
|
|
|
490
498
|
*/
|
|
491
499
|
declare type RenderMode = "HTML" | "SIMPLE" | "JSON_170x170" | "JSON_100_X_100" | "JSON_90x70" | "JSON_50x50" | "JSON_30x30" | "JSON_100x140" | "JSON_200x200" | "JSON_400x400" | "JSON_750x750" | "JSON_10_MAX_SQUARE" | "JSON_200x200_SQUARE" | "JSON_400x400_SQUARE" | "JSON_750x750_SQUARE" | "JSON_ORIGINAL" | "VERSION_SOURCE";
|
|
492
500
|
|
|
501
|
+
/**
|
|
502
|
+
* @group Types
|
|
503
|
+
*/
|
|
504
|
+
export declare type ScriptLoadOptions = {
|
|
505
|
+
/**
|
|
506
|
+
* Indicates the position of the script, default is "body"
|
|
507
|
+
*/
|
|
508
|
+
position?: "head" | "body";
|
|
509
|
+
/**
|
|
510
|
+
* Indicates the attributes of the script element
|
|
511
|
+
*/
|
|
512
|
+
attributes?: Record<string, string>;
|
|
513
|
+
};
|
|
514
|
+
|
|
493
515
|
declare interface Sku {
|
|
494
516
|
availability: string;
|
|
495
517
|
custom_fields: {
|