shoplazza-app-bridge
v1.2.0
Published
shoplazza app bridge
Downloads
109
Readme
shoplazza-app-bridge
Shoplazza App Bridge lets you embed your app directly inside the Shoplazza admin, as well as customize Shoplazza UI elements outside of your app.
Install
npm install shoplazza-app-bridge --save
Usage
// Embed App entry file
import { app } from 'shoplazza-app-bridge';
app.init();
Actions
ContextualSaveBar
The contextual save bar tells merchants their options once they have made changes to a form on the page. This component is also shown while creating a new object like a product or customer. Merchants can use this component to save or discard their work.
saveAction and discardAction type is the same with antd button type
import { contextualSaveBar } from 'shoplazza-app-bridge';
contextualSaveBar.show();
contextualSaveBar.hide();
contextualSaveBar.setSaveAction({
type: 'primary',
disabled: false,
loading: false,
text: 'Save',
onClick: () => {
// Do somethings
}
});
contextualSaveBar.setDiscardAction({
type: 'default',
disabled: false,
loading: false,
text: 'Cancel',
discardConfirmationModal: true,
onClick: () => {
// Do somethings
}
});
BackLink
The backLink action set allows you to modify back button right in the top left side of admin header.
import { backLink } from 'shoplazza-app-bridge';
backLink.setAction({
display: true,
text: 'Return app',
onClick: () => {
// Do somethings
}
});
Redirect
The Redirect action set allows you redirect to a relative path in shoplazza admin.
import { redirect } from 'shoplazza-app-bridge';
redirect('/products')
SessionToken
A session token is a mechanism that lets your embedded app authenticate the requests that it makes between the client side and your app's backend.
import { getSessionToken } from 'shoplazza-app-bridge';
getSessionToken('ExampleClientID');