Adding to project #
npm install @tipser/tipser-sdk
Usage #
Importing ##
ES6 imports syntax:import { TipserSDK } from '@tipser/tipser-sdk';
or
import { TipserSDK } from '@tipser/tipser-sdk/bare';
CommonJS syntax:
const { TipserSDK } = require('@tipser/tipser-sdk');
or
const { TipserSDK } = require('@tipser/tipser-sdk/bare);
Polyfills
Check our MIT file to check what polyfills are required sdk to work. If you prefer to handle polyfills in your project by yourself, and your target isIE11
please make sure that you include polyfills listed above, and import @tipser/tipser-sdk/bare
bundle.
Otherwise, you are most welcome to import @tipser/tipser-sdk
bundle which already includes polyfills necessary to be run in IE11
.Basic usage ##
import {TipserSDK} from '@tipser/tipser-sdk';
//...
const tipserSdk = TipserSDK(posId, {
modalUi: {
hideSimilarProducts: true
}
});
tipserSdk.openProductDialog('5ba2334a781baa0001ccdf33');
//...
Usage in Typescript project ##
tipser-sdk
package includes Typescript type definitions, so when used in Typescript project, type checking will work out of the box as well as
autocompletion features of IDEs. In case the configuration is stored in a variable, the TipserSdkConfig
type may be used as a type
of that variable.import { TipserSDK, TipserSdkConfig } from '@tipser/tipser-sdk';
//...
const tipserSdkConfig: TipserSdkConfig = {
modalUi: {
hideSimilarProducts: true
}
}
const tipserSdk = TipserSDK(posId, tipserSdkConfig);
tipserSdk.openProductDialog('5ba2334a781baa0001ccdf33');
//...
Runtime Logs in Dev Tools
Logger register himself on a topwindow
global object. It communicates with all other logger instances inside of iframes.To turn on logger, and it's all instances in other iframes, go to Dev Tools console, ensure that top window context is selected and run following command:
TipserLogger.on()
To turn off:
TipserLogger.off()
Documentation ##
https://developers.tipser.com/tipser-sdk-scriptArchitecture ###
https://docs.google.com/drawings/d/1S9LoosqgZtsQUlTncvxY75zQUckUFx3t0X0uH7F9hooPublishing new versions #
- Run
npm run create-release-pr -- $(cat ~/.git-private-token)
(.git-private-token
containes GH personal token. How to create it?) - Merge the PR on GH
- Switch to
production
locally and runyarn release
- Merge
production
back todevelop
(to sync version number in package.json)
In a less common scenario when you need to update minor or major version instead of patch version, replace
yarn release
command with one of the following commands:- npm version minor && git push --follow-tags
- npm version major && git push --follow-tags