0.31.2 • Published 12 days ago

trillion-viewer v0.31.2

Weekly downloads
-
License
MIT
Repository
-
Last release
12 days ago

Trillion Viewer

This is Trillion Viewer that allow you to integrate Trillion SDK in your site. For more information please visit https://trillion.jewelry

Installing

Using npm:

npm install trillion-viewer

Using yarn:

yarn add trillion-viewer

How to use:

First of all get your API key from https://dashboard.trillion.jewelry/integration

Then you need to create an empty div element for viewer initialization. For example:

 <div id="trillion-viewer"></div>

Then, in your js code (don't forget to set your API key):

import {TrillionViewerApp} from "trillion-viewer"

const elem = document.getElementById('trillion-viewer')
const trillionViewer = new TrillionViewerApp()
trillionViewer.init(elem)
trillionViewer.setServiceActivationKey("YOUR_API_KEY_HERE")
trillionViewer.setJewelryID('demo-ring')
trillionViewer.refresh()

For typescript:

const elem = document.getElementById('trillion-viewer') as HTMLElement

Instance methods

  • trillionViewer.init() - Create viewer on the provided HTML element
  • trillionViewer.setServiceActivationKey(KEY) - Set API key for app
  • trillionViewer.refresh() - reload viewer after changing parameters
  • trillionViewer.setJewelryID(sku) - Set the id(SKU) of the jewelry to load
  • trillionViewer.getJewelryID() - Get the id(SKU) of the uploaded jewelry
  • trillionViewer.setStartSize(number) - Set the start size of the jewelry
  • trillionViewer.getStartSize() - Get the start size of the jewelry
  • trillionViewer.setZoomMin(number) - Set the minumum zoom value
  • trillionViewer.getZoomMin() - Get the minumum zoom value
  • trillionViewer.setZoomMax(number) - Set the maximum zoom value
  • trillionViewer.getZoomMax() - Get the maximum zoom value

Model configuration methods

Available colors and cuts depends on a model

trillionViewer.configuratorController.changeColor({color: '#f5f5f5', materialName: 'metal'})

change color of material. Available materials names can be retrieved from API in future

trillionViewer.configuratorController.changeCut({name: 'oval', frame: 'oval', band?: 'oval'}, RING_CUTS)

change cut of the stone. RING_CUTS - all available ring cuts, can be retrieved from API in future and band - is optional param, used where band is also changed

trillionViewer.configuratorController.engrave('text to engrave')

change engrave for a model, max length 15 symbols

trillionViewer.configuratorController.changeLetter('A', LETTERS)

change engrave for a model, max length 15 symbols LETTERS - all available letters, can be retrieved from API in future

Events

'VIEWER_LOADED_EVENT' will be fired when viewer is loaded and ready for any user interactions. Here is an example of subscription to that event

document.addEventListener('VIEWER_LOADED_EVENT', () => {
  console.log('Viewer is loaded!');
})

Using CDN to get Trillion Viewer

use this pattern: unpkg.com/:package@:version/:file

For example:

import {TrillionViewerApp} from "https://unpkg.com/trillion-viewer@0.2.17/build-lib/trillion-viewer.js"

React component

This library also provides the React component for widget.

How to use

import component:

import { TrillionViewer } from "trillion-viewer";

use somewhere in your React application:

function MyComponent() {
  return (
    <div className="MyComponent">
        <TrillionViewer jewelryId={'demo-ring'}/>
    </div>
  )
}
0.31.2

12 days ago

0.31.1

14 days ago

0.31.0

14 days ago

0.30.6

18 days ago

0.30.5

21 days ago

0.30.4

24 days ago

0.30.3

26 days ago

0.30.2

27 days ago

0.30.1

2 months ago

0.4.9

2 months ago

0.30.0

2 months ago

0.29.2

2 months ago

0.29.1

2 months ago

0.28.4

2 months ago

0.28.3

3 months ago

0.27.5

3 months ago

0.28.1

3 months ago

0.27.4

3 months ago

0.27.3

3 months ago

0.27.2

3 months ago

0.27.1

3 months ago

0.27.0

3 months ago

0.26.3

3 months ago

0.26.2

3 months ago

0.26.1

3 months ago

0.25.0

4 months ago

0.24.0

4 months ago

0.23.7

4 months ago

0.23.6

4 months ago

0.23.5

4 months ago

0.23.4

4 months ago

0.23.3

4 months ago

0.23.2

5 months ago

0.23.1

5 months ago

0.22.8

5 months ago

0.23.0

5 months ago

0.22.7

5 months ago

0.20.1

6 months ago

0.20.0

6 months ago

0.21.4

5 months ago

0.21.3

6 months ago

0.21.2

6 months ago

0.21.1

6 months ago

0.21.0

6 months ago

0.22.6

5 months ago

0.22.5

5 months ago

0.22.4

5 months ago

0.22.3

5 months ago

0.22.2

5 months ago

0.22.1

5 months ago

0.22.0

5 months ago

0.19.0

7 months ago

0.19.1

7 months ago

0.19.2

7 months ago

0.19.3

6 months ago

0.19.4

6 months ago

0.19.5

6 months ago

0.14.13

10 months ago

0.14.12

10 months ago

0.14.11

10 months ago

0.14.10

10 months ago

0.17.2

8 months ago

0.13.6

11 months ago

0.17.3

8 months ago

0.13.7

11 months ago

0.17.4

8 months ago

0.13.8

11 months ago

0.17.5

7 months ago

0.13.9

11 months ago

0.14.17

10 months ago

0.14.16

10 months ago

0.14.15

10 months ago

0.14.14

10 months ago

0.13.1

12 months ago

0.13.2

12 months ago

0.13.3

11 months ago

0.17.0

8 months ago

0.13.4

11 months ago

0.17.1

8 months ago

0.14.18

10 months ago

0.13.5

11 months ago

0.18.1

7 months ago

0.14.5

10 months ago

0.18.2

7 months ago

0.14.6

10 months ago

0.18.3

7 months ago

0.14.7

10 months ago

0.14.8

10 months ago

0.14.9

10 months ago

0.14.0

11 months ago

0.14.1

11 months ago

0.14.2

11 months ago

0.14.3

11 months ago

0.18.0

7 months ago

0.14.4

11 months ago

0.15.4

9 months ago

0.15.5

9 months ago

0.15.0

10 months ago

0.15.1

9 months ago

0.15.2

9 months ago

0.15.3

9 months ago

0.16.3

9 months ago

0.16.4

8 months ago

0.16.5

8 months ago

0.16.6

8 months ago

0.16.0

9 months ago

0.16.1

9 months ago

0.16.2

9 months ago

0.11.0

1 year ago

0.11.1

1 year ago

0.13.0

12 months ago

0.10.10

1 year ago

0.10.11

1 year ago

0.10.12

1 year ago

0.9.0

1 year ago

0.7.2

1 year ago

0.5.4

1 year ago

0.7.1

1 year ago

0.5.3

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.7.3

1 year ago

0.7.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.12.10

1 year ago

0.12.11

12 months ago

0.12.7

1 year ago

0.10.9

1 year ago

0.12.8

1 year ago

0.12.9

1 year ago

0.10.1

1 year ago

0.12.0

1 year ago

0.10.2

1 year ago

0.12.1

1 year ago

0.10.3

1 year ago

0.12.2

1 year ago

0.10.4

1 year ago

0.12.12

12 months ago

0.12.3

1 year ago

0.10.5

1 year ago

0.12.13

12 months ago

0.12.4

1 year ago

0.10.6

1 year ago

0.12.5

1 year ago

0.10.7

1 year ago

0.12.6

1 year ago

0.10.8

1 year ago

0.10.0

1 year ago

0.0.1

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.6.3

1 year ago

0.8.0

1 year ago

0.6.2

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.0.4

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.4.8

1 year ago

0.2.22

2 years ago

0.2.21

2 years ago

0.3.0

2 years ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.5.0

1 year ago

0.4.1

1 year ago

0.3.2

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.4.3

1 year ago

0.3.4

1 year ago

0.4.2

1 year ago

0.3.3

1 year ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago