1.0.0 • Published 2 years ago

@metahi/js-sdk v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

MetahiSDK for javascript

@metahi/js-sdk is a helper which assists you in integrating MetahiSDK into your web app.

Installation

yarn add @metahi/js-sdk

or

npm install @metahi/js-sdk

Documentation

import MetahiSDK from '@metahi/js-sdk';

First of all, you need to create a configuration object:

const metahiSDK = new MetahiSDK(options);

Options

PropertyRequiredTypeDefault valuePossible value(s)Description
partner_idrequiredStringpartner_id will be given to you upon your registration as partner. It's required to track your commission and statistics. If you don't have one, contact us
container_idrequired / optionalStringID of the parent DOM element of the module. Required if you want to use the mount method.
originoptionalStringhttps://metahi.worldhttps://metahi.devRequired to initialise the module in the specific environment.
autosizeoptionalBooleanfalsetrue, falseBy default, module will use 100% of the width and 100% of the height of the parent element. If 'true', width and height options are ignored.
widthoptionalNumberFixed module width, in pixels.
heightoptionalBooleanFixed module height, in pixels.

How to open specific page

After initializing your widget, call a method open() to open specific page or functionality

import MetahiSDK from '@metahi/js-sdk';

const metahiSDK = new MetahiSDK(options);

metahiSDK.open(name, params, query);

open() options

name = collections/collection/assets/asset params for: collection = { collectionId } for: asset = { assetId }

read more in index.ts -> screenTypes

How to change theme or branding

For now we do not allow any theme configuration via sdk initialization. You can configure your theme on partners settings page.

1.0.0

2 years ago