0.0.81 • Published 3 months ago

configurator-sdk v0.0.81

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

Configurator-sdk

Import the required packages and their dependencies within the <script> tag element. In this specific implementation, the following libraries have been included for support:

  • Three.js
  • GSAP
  • CurrencyFormatter

Usage

<script type="importmap">
    {
    "imports": {
        "three": "https://unpkg.com/three@0.152.2/build/three.module.js",
        "three/addons/": "https://unpkg.com/three@0.152.2/examples/jsm/"
    }
    }
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/currencyformatter.js/2.2.0/currencyFormatter.min.js"></script>
<script type="module">
    import * as THREE from "three";
    import { OrbitControls } from "three/addons/controls/OrbitControls.js";
    import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
    import { DRACOLoader } from "three/addons/loaders/DRACOLoader.js";

    window.addEventListener("DOMContentLoaded", () => {
        window.THREEJS = { THREE, OrbitControls, DRACOLoader, GLTFLoader };
        window.GSAP = { gsap };

        var script = document.createElement("script");
        script.src = "https://cdn.jsdelivr.net/npm/configurator-sdk/bundle.js";
        document.head.appendChild(script);

        script.addEventListener("load", async () => {
          await configuratorSDK.init({ apiKey: "f7785af7ec2307fc021135889e396191"})
        })
    });
</script>

Embed Custom element

To integrate and display custom elements generated by the configurator-sdk package, you can utilize the web component. To render this custom element within your HTML page, simply include it within the tag

<product-element productId="8b326565-e3c1-4188-a092-180e78593e6c"></product-element>

Methods

getProductPrice

Description: The getProductPrice method is used to retrieve the price amount of a product from the loaded model. This method returns the price amount in the selected currency.

Usage:

configuratorSDK.getProductPrice()

Note:

  • Ensure that the model is loaded before calling this method to obtain accurate pricing information.

Example:

configuratorSDK.getProductPrice()
=> {price: {DKK: 13910.40}}   //DKK - selected currency

getProductImages

Description: The getProductImages method is used to retrieve product images that can be previewed on the user site. This method returns an array of image URLs representing the product from the loaded model.

Usage:

configuratorSDK.getProductImages()

Note:

  • Ensure that the model is loaded before calling this method to obtain product images.

Example:

configuratorSDK.getProductImages()
=> {productImages: [....]}

addToCart

Description: The addToCart method is used to retrieve productInfo, price, current product attributes value and product images that can be rendered in the add to cart screen in the user site.

Usage:

configuratorSDK.getProductImages()

Note:

  • Ensure that the model is loaded before calling this method to obtain product details.

Example:

configuratorSDK.addToCart()
=> {product: {..}, price:{..}, attributes:{..}, productImages: []}

setLocale

Description: The setLocale method is used to set language in the user site.

Usage:

configuratorSDK.setLocale("dk")

params:
locale - String // "dk", "en"

Example:

await configuratorSDK.setLocale("dk")
0.0.80

3 months ago

0.0.81

3 months ago

0.0.79

4 months ago

0.0.78

4 months ago

0.0.75

4 months ago

0.0.76

4 months ago

0.0.77

4 months ago

0.0.73

4 months ago

0.0.74

4 months ago

0.0.71

4 months ago

0.0.72

4 months ago

0.0.70

4 months ago

0.0.69

4 months ago

0.0.67

4 months ago

0.0.68

4 months ago

0.0.66

4 months ago

0.0.62

5 months ago

0.0.63

5 months ago

0.0.64

5 months ago

0.0.65

5 months ago

0.0.61

5 months ago

0.0.60

5 months ago

0.0.59

5 months ago

0.0.56

5 months ago

0.0.57

5 months ago

0.0.58

5 months ago

0.0.52

5 months ago

0.0.53

5 months ago

0.0.54

5 months ago

0.0.55

5 months ago

0.0.51

5 months ago

0.0.50

5 months ago

0.0.44

5 months ago

0.0.45

5 months ago

0.0.46

5 months ago

0.0.47

5 months ago

0.0.48

5 months ago

0.0.49

5 months ago

0.0.43

5 months ago

0.0.42

5 months ago

0.0.41

5 months ago

0.0.40

5 months ago

0.0.39

5 months ago

0.0.38

5 months ago

0.0.37

5 months ago

0.0.36

5 months ago

0.0.35

5 months ago

0.0.34

5 months ago

0.0.33

6 months ago

0.0.32

6 months ago

0.0.31

6 months ago

0.0.30

6 months ago

0.0.29

7 months ago

0.0.28

7 months ago

0.0.27

7 months ago

0.0.26

7 months ago

0.0.25

7 months ago

0.0.24

7 months ago

0.0.23

7 months ago

0.0.22

7 months ago

0.0.21

7 months ago

0.0.20

7 months ago

0.0.19

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

8 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago