Migration guide
This page will help you through the process of migrating an existing V2 implementation to the new V3 Flipbook JavaScript API. The new V3 API contains all the features from V2 as well as new ones.
Last updated
This page will help you through the process of migrating an existing V2 implementation to the new V3 Flipbook JavaScript API. The new V3 API contains all the features from V2 as well as new ones.
Last updated
The V3 JS API comes with new functionality that could be useful to you. In addition, more functionality will be added over time, which won't be the case with V2.
Some of the new functionality in V3 include:
The ability to check the current state of paging, basket, search, and table of contents
The ability to explicitly close or open basket, search, and table of contents
The ability to retrieve the details of the flipbook via
The ability to execute a search directly via
The way the V3 JS API has been built improves both stability and general performance of commands and events. Another thing that has been particularly streamlined and improved is the initialization process.
Due to the improvements made to the initialization process, it is now much easier to work with pages containing multiple embedded flipbooks. For more on this, .
Unlike the V2 JS API, the V3 JS API can be used directly inside Custom Scripting with feature parity to when used externally. For how to get started with this, .
To migrate to the new V3 API, you will need to update the API embed script on your page. Your current embed script should look something like this:
The new embed script for V3 can be seen below:
Once you have the added the new embed script, simply remove/delete the old one from the page.
The way of initializing the API has changed a bit in V3. Instead of relying on an automatic process of detecting the iframe containing a flipbook and instantiating the API with this iframe, you will now need to instantiate the API manually by passing in the iframe and an API version as parameters.
So, where you previously may have had something like this:
Or something like this:
You will now need this instead:
Once this has been done, you can use/access API commands and events directly on the created instance
variable (FX. myApiInstance.basket.open()
).
Are you using multiple embedded flipbooks on the same page?
If you are currently using the V2 way of having multiple embedded flipbooks, you will need to update this to be done in the new V3 way, as can be seen in the link above. The V2 way is not supported in V3.
API commands generally work the same in V3 as they did in V2. They have, however, been split into more detailed categories, and some have been renamed or altered slightly. Below, you can see the V2 API commands and their V3 equivalents.
Note:
updateEventSettings
This command has been changed a bit in V3. It has been converted to be a more universal command for updating an API instance's configuration.
So, where you may have had something like this before:
You will now need something like this instead:
basketClick
is equivalent to V2's onBasketClick
and itemAdd
is equivalent to onItemAdd
.
goToPage
The location for this command has been changed. It can now be accessed with:
goToPreviousPage
The location and naming for this command has been changed. It can now be accessed with:
goToNextPage
The location for this command has been changed. It can now be accessed with:
addItem
Be aware:
The productID
property has been renamed productId
in V3.
The location and naming for this command has been changed. It can now be accessed with:
getCookieConsent
The location and naming for this command has been changed. It can now be accessed with:
updateCookieConsent
The location and naming for this command has been changed. It can now be accessed with:
Apart from this change, API events generally work the same in V3 as they did in V2. They have, however, been split into more detailed categories, and some have been renamed. Below, you can see the V2 API events and their V3 equivalents.
Note:
onPageElementClick
The location for this event has been changed. It can now be subscribed to using:
onSpreadChange
The location for this event has been changed. It can now be subscribed to using:
However, while this command is available in V3, we recommend that you consider upgrading to/using the new paging.onChange
event instead.
onBasketClick
The location and naming for this event has been changed. It can now be subscribed to using:
onItemAdd
The location and naming for this event has been changed. It can now be subscribed to using:
onCookieConsentShown
The location and naming for this event has been changed. It can now be subscribed to using:
onCookieConsentUpdate
The location and naming for this event has been changed. It can now be subscribed to using:
The change to initialization will also make it much easier to work with pages containing multiple embedded Flipbooks. For more on how to create multiple API instances on the same page,
are no longer supported with V3. Any usage of these will have to be updated.
In V3, events have been streamlined and updated to run as subscriptions. This makes it easier to add and remove these on demand. For more on this, .
are no longer supported with V3. Any usage of these will have to be updated.