@nosto/nosto-react 2.2.2 → 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.
- package/LICENSE +1 -1
- package/dist/index.d.ts +12 -177
- package/dist/index.es.js +197 -164
- package/dist/index.umd.js +1 -1
- package/package.json +20 -17
- package/src/components/NostoProvider.tsx +2 -1
- package/src/context.ts +2 -1
- package/src/hooks/useLoadClientScript.ts +17 -13
- package/src/hooks/useNostoApi.ts +4 -3
- package/src/hooks/useNostoOrder.tsx +1 -1
- package/src/hooks/useNostoProduct.tsx +11 -5
- package/src/hooks/useNostoSession.tsx +3 -2
- package/src/hooks/useRenderCampaigns.tsx +6 -3
- package/src/index.ts +2 -1
- package/src/types.ts +1 -965
- package/src/components/helpers.ts +0 -3
package/LICENSE
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,57 +1,19 @@
|
|
|
1
|
+
import { Cart } from '@nosto/nosto-js/client';
|
|
1
2
|
import { Context } from 'react';
|
|
3
|
+
import { PushedCustomer as Customer } from '@nosto/nosto-js/client';
|
|
2
4
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
|
+
import { WebsiteOrder as Order } from '@nosto/nosto-js/client';
|
|
6
|
+
import { Product } from '@nosto/nosto-js/client';
|
|
7
|
+
import { PushedProduct } from '@nosto/nosto-js/client';
|
|
3
8
|
import { ReactElement } from 'react';
|
|
4
9
|
import { ReactNode } from 'react';
|
|
10
|
+
import { RenderMode } from '@nosto/nosto-js/client';
|
|
5
11
|
|
|
6
12
|
declare type AnyFunction = (...args: unknown[]) => unknown;
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
* @group Types
|
|
10
|
-
*/
|
|
11
|
-
export declare interface Cart {
|
|
12
|
-
hcid?: string;
|
|
13
|
-
items: CartItem[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @group Types
|
|
18
|
-
*/
|
|
19
|
-
declare interface CartItem {
|
|
20
|
-
name: string;
|
|
21
|
-
price_currency_code: string;
|
|
22
|
-
product_id: string;
|
|
23
|
-
quantity: number;
|
|
24
|
-
sku_id?: string;
|
|
25
|
-
unit_price: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @group Types
|
|
30
|
-
*/
|
|
31
|
-
declare interface ConversionItem {
|
|
32
|
-
name: string;
|
|
33
|
-
price_currency_code: string;
|
|
34
|
-
product_id: string;
|
|
35
|
-
quantity?: number;
|
|
36
|
-
sku_id?: string;
|
|
37
|
-
unit_price?: number;
|
|
38
|
-
}
|
|
14
|
+
export { Cart }
|
|
39
15
|
|
|
40
|
-
|
|
41
|
-
* @group Types
|
|
42
|
-
*/
|
|
43
|
-
export declare interface Customer {
|
|
44
|
-
customer_reference?: string;
|
|
45
|
-
email: string;
|
|
46
|
-
first_name: string;
|
|
47
|
-
hcid?: string;
|
|
48
|
-
last_name: string;
|
|
49
|
-
newsletter?: boolean;
|
|
50
|
-
order_number?: string;
|
|
51
|
-
source?: string;
|
|
52
|
-
source_id?: string;
|
|
53
|
-
type?: string;
|
|
54
|
-
}
|
|
16
|
+
export { Customer }
|
|
55
17
|
|
|
56
18
|
/**
|
|
57
19
|
* You can personalise your cart and checkout pages by using the `Nosto404` component.
|
|
@@ -302,6 +264,7 @@ export declare function NostoProduct(props: NostoProductProps): null;
|
|
|
302
264
|
*/
|
|
303
265
|
export declare type NostoProductProps = {
|
|
304
266
|
product: string;
|
|
267
|
+
reference?: string;
|
|
305
268
|
tagging?: Product;
|
|
306
269
|
placements?: string[];
|
|
307
270
|
};
|
|
@@ -427,105 +390,9 @@ export declare type NostoSessionProps = {
|
|
|
427
390
|
customer?: Customer | ToCamelCase<Customer>;
|
|
428
391
|
};
|
|
429
392
|
|
|
430
|
-
|
|
431
|
-
inventory_level?: number;
|
|
432
|
-
}
|
|
393
|
+
export { Order }
|
|
433
394
|
|
|
434
|
-
|
|
435
|
-
availability: string;
|
|
436
|
-
available: boolean;
|
|
437
|
-
discounted: boolean;
|
|
438
|
-
list_price?: number;
|
|
439
|
-
price: number;
|
|
440
|
-
price_currency_code: string;
|
|
441
|
-
price_text?: string;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* @group Types
|
|
446
|
-
*/
|
|
447
|
-
export declare interface Order {
|
|
448
|
-
created_at?: Date;
|
|
449
|
-
external_order_ref: string;
|
|
450
|
-
info?: OrderCustomer;
|
|
451
|
-
items: ConversionItem[];
|
|
452
|
-
order_status?: string;
|
|
453
|
-
order_status_label?: string;
|
|
454
|
-
payment_provider: string;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* @group Types
|
|
459
|
-
*/
|
|
460
|
-
declare interface OrderCustomer {
|
|
461
|
-
country: string;
|
|
462
|
-
email?: string;
|
|
463
|
-
first_name?: string;
|
|
464
|
-
last_name?: string;
|
|
465
|
-
newsletter: string;
|
|
466
|
-
order_number: string;
|
|
467
|
-
phone: string;
|
|
468
|
-
post_code: string;
|
|
469
|
-
type: string;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* @group Types
|
|
474
|
-
*/
|
|
475
|
-
export declare type Product = {
|
|
476
|
-
product_id: string;
|
|
477
|
-
selected_sku_id?: string;
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
declare interface PushedProduct {
|
|
481
|
-
age_group?: string;
|
|
482
|
-
alternate_image_urls: string[];
|
|
483
|
-
availability: string;
|
|
484
|
-
brand?: string;
|
|
485
|
-
category: string[];
|
|
486
|
-
category_id: string[];
|
|
487
|
-
condition?: string;
|
|
488
|
-
custom_fields: {
|
|
489
|
-
[index: string]: string;
|
|
490
|
-
};
|
|
491
|
-
date_published?: Date;
|
|
492
|
-
description?: string;
|
|
493
|
-
gender?: string;
|
|
494
|
-
google_category?: string;
|
|
495
|
-
gtin?: string;
|
|
496
|
-
image_url?: string;
|
|
497
|
-
inventory_level?: number;
|
|
498
|
-
list_price?: number;
|
|
499
|
-
name: string;
|
|
500
|
-
parent_category_id: string[];
|
|
501
|
-
price: number;
|
|
502
|
-
price_currency_code: string;
|
|
503
|
-
product_id: string;
|
|
504
|
-
rating_value?: number;
|
|
505
|
-
review_count?: number;
|
|
506
|
-
skus: PushedProductSKU[];
|
|
507
|
-
source_updated?: Date;
|
|
508
|
-
supplier_cost?: number;
|
|
509
|
-
tags1: string[];
|
|
510
|
-
tags2: string[];
|
|
511
|
-
tags3: string[];
|
|
512
|
-
thumb_url?: string;
|
|
513
|
-
unit_pricing_base_measure?: number;
|
|
514
|
-
unit_pricing_measure?: number;
|
|
515
|
-
unit_pricing_unit?: string;
|
|
516
|
-
update_received?: Date;
|
|
517
|
-
url: string;
|
|
518
|
-
variation_id?: string;
|
|
519
|
-
variations: {
|
|
520
|
-
[index: string]: PushedVariation;
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
declare interface PushedProductSKU extends NostoSku {
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
declare interface PushedVariation extends NostoVariant {
|
|
528
|
-
}
|
|
395
|
+
export { Product }
|
|
529
396
|
|
|
530
397
|
/**
|
|
531
398
|
* @group Types
|
|
@@ -544,11 +411,6 @@ declare type RecommendationComponent = ReactElement<{
|
|
|
544
411
|
nostoRecommendation: Recommendation;
|
|
545
412
|
}>;
|
|
546
413
|
|
|
547
|
-
/**
|
|
548
|
-
* @group Types
|
|
549
|
-
*/
|
|
550
|
-
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";
|
|
551
|
-
|
|
552
414
|
/**
|
|
553
415
|
* @group Types
|
|
554
416
|
*/
|
|
@@ -563,20 +425,6 @@ export declare type ScriptLoadOptions = {
|
|
|
563
425
|
attributes?: Record<string, string>;
|
|
564
426
|
};
|
|
565
427
|
|
|
566
|
-
declare interface Sku {
|
|
567
|
-
availability: string;
|
|
568
|
-
custom_fields: {
|
|
569
|
-
[index: string]: string;
|
|
570
|
-
};
|
|
571
|
-
gtin?: string;
|
|
572
|
-
id: string;
|
|
573
|
-
image_url?: string;
|
|
574
|
-
list_price?: number;
|
|
575
|
-
name: string;
|
|
576
|
-
price: number;
|
|
577
|
-
url?: string;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
428
|
declare type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
|
|
581
429
|
|
|
582
430
|
declare type ToCamelCase<T> = T extends (infer U)[] ? ToCamelCase<U>[] : T extends Date ? T : T extends object ? {
|
|
@@ -637,7 +485,7 @@ export declare function useNostoOther(props?: NostoOtherProps): void;
|
|
|
637
485
|
*
|
|
638
486
|
* @group Hooks
|
|
639
487
|
*/
|
|
640
|
-
export declare function useNostoProduct({ product, tagging, placements }: NostoProductProps): void;
|
|
488
|
+
export declare function useNostoProduct({ product, tagging, placements, reference }: NostoProductProps): void;
|
|
641
489
|
|
|
642
490
|
/**
|
|
643
491
|
* You can personalise your search pages by using the useNostoSearch hook.
|
|
@@ -654,16 +502,3 @@ export declare function useNostoSearch({ query, placements }: NostoSearchProps):
|
|
|
654
502
|
export declare function useNostoSession({ cart, customer }?: NostoSessionProps): void;
|
|
655
503
|
|
|
656
504
|
export { }
|
|
657
|
-
|
|
658
|
-
declare global {
|
|
659
|
-
interface Window {
|
|
660
|
-
nosto?: {
|
|
661
|
-
reload(settings: unknown): void;
|
|
662
|
-
};
|
|
663
|
-
nostojs: {
|
|
664
|
-
(callback: (api: NostoClient) => void): void;
|
|
665
|
-
q?: unknown[];
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|