Skip to content

Commit c809865

Browse files
committed
feat: add initialProducts and initialProductsMode options
1 parent 2ed5cfe commit c809865

File tree

5 files changed

+33
-19
lines changed

5 files changed

+33
-19
lines changed

docs/API.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,19 @@ new Display($('#element'), options)
5757

5858
`options` is an Object which can take the following values:
5959

60-
| option name | default | description |
61-
| ------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
62-
| displayid _or_ url | | **Required.** Either the id or the url of the nfinite Display. |
63-
| token | | **Required.** Token generated in my.nfinite.app (in the service user section). |
64-
| productcode | | Load scenes where the product is visible (identified by its code). Only available for "Product Focus" |
65-
| responsive | `true` (if no width and height set) | Resize according to its parent element, this parameter is incompatible with `height` and `width` parameters |
66-
| height | | The exact height of the Display. Defaults to the height of the largest available version of the Display. |
67-
| width | | The exact width of the Display. Defaults to the width of the largest available version of the Display. |
68-
| displayUrl | `https://display.nfinite.app` | Override the generated base url for the Display (useful in development mode). |
69-
| oembedUrl | `https://display.nfinite.app/api/oembed` | Override the generated base url for oembed api (useful in development mode). |
70-
| language | default language set in my.nfinite.app | One of the defined language in my.nfinite.app (in the platform section). |
60+
| option name | default | description |
61+
| --------------------------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
62+
| displayid _or_ url | | **Required.** Either the id or the url of the nfinite Display. |
63+
| token | | **Required.** Token generated in my.nfinite.app (in the service user section). |
64+
| productcode | | Load scenes where the product is visible (identified by its code). Only available for "Product Focus" |
65+
| responsive | `true` (if no width and height set) | Resize according to its parent element, this parameter is incompatible with `height` and `width` parameters |
66+
| height | | The exact height of the Display. Defaults to the height of the largest available version of the Display. |
67+
| width | | The exact width of the Display. Defaults to the width of the largest available version of the Display. |
68+
| displayUrl | `https://display.nfinite.app` | Override the generated base url for the Display (useful in development mode). |
69+
| oembedUrl | `https://display.nfinite.app/api/oembed` | Override the generated base url for oembed api (useful in development mode). |
70+
| language | default language set in my.nfinite.app | One of the defined language in my.nfinite.app (in the platform section). |
71+
| initialProducts ![infinite] ![beta] | | Permit to set some product codes as default in the Display |
72+
| initialProductsMode ![infinite] ![beta] | `default` | Permit to choose the mode to display products not set in `initialProducts` |
7173

7274
e.g.:
7375

docs/REACT_INTEGRATION.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ function App() {
4646

4747
### Infinite props
4848

49-
| props name | default | description |
50-
| ------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
51-
| onChangeProduct | | Callback on scene change, it receives the an object with the `prevProduct` and the `nextProduct` as argument |
52-
| onChangeScene | | Callback on scene change, it receives the `new scene` as argument (it will also be triggered at the load of the scene) |
53-
| onLoadScene | | Callback on scene load, it receives the `initial scene` as argument |
54-
| onProductClick ![beta] | | Callback on product CTA click, it receives the `product` as argument |
55-
| onChangeSelectedProductLocation | | Callback when a location is opened (marker clicked) or closed, it receives the `currentProduct` as argument (or nothing when closed) |
49+
| props name | default | description |
50+
| ------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
51+
| initialProducts ![beta] | | Permit to set some product codes as default in the Display |
52+
| initialProductsMode ![beta] | `default` | Permit to choose the mode to display products not set in `initialProducts` |
53+
| onChangeProduct | | Callback on scene change, it receives the an object with the `prevProduct` and the `nextProduct` as argument |
54+
| onChangeScene | | Callback on scene change, it receives the `new scene` as argument (it will also be triggered at the load of the scene) |
55+
| onLoadScene | | Callback on scene load, it receives the `initial scene` as argument |
56+
| onProductClick ![beta] | | Callback on product CTA click, it receives the `product` as argument |
57+
| onChangeSelectedProductLocation | | Callback when a location is opened (marker clicked) or closed, it receives the `currentProduct` as argument (or nothing when closed) |
5658

5759
### Produt focus props
5860

packages/display-js/src/lib/embed.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const oEmbedParameters = [
1515
'oembed-url',
1616
'language',
1717
'token',
18-
'no-cache',
18+
'initialProductsMode',
19+
'initialProducts',
1920
]
2021

2122
/**

packages/display-react/src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function Display(
5050
onChangeSelectedProductLocation,
5151
onChangeProduct,
5252
language,
53+
initialProductsMode,
54+
initialProducts,
5355
},
5456
controller,
5557
) {

packages/display-react/types/index.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export enum Language {
1515
EN_US = 'en-US',
1616
}
1717

18+
export enum initialProductsMode {
19+
RANDOM = 'random',
20+
DEFAULT = 'default',
21+
}
22+
1823
type Product = {
1924
id: string;
2025
code: string;
@@ -38,6 +43,8 @@ type DisplayBaseProps = {
3843
onChangeProduct?: onChangeProduct;
3944
onChangeSelectedProductLocation?: onChangeSelectedProductLocation;
4045
language?: Language;
46+
initialProductsMode: initialProductsMode;
47+
initialProducts: string[]
4148
};
4249

4350
export type DisplayIdProps = {

0 commit comments

Comments
 (0)