@threekit-tools/treble 0.0.10-alpha.14 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +163 -156
  2. package/dist/Treble/Snapshots.d.ts +28 -0
  3. package/dist/Treble/Snapshots.js +280 -0
  4. package/dist/Treble/Treble.d.ts +9 -27
  5. package/dist/Treble/Treble.js +34 -350
  6. package/dist/Treble/Wishlist.d.ts +18 -0
  7. package/dist/Treble/Wishlist.js +137 -0
  8. package/dist/Treble/index.d.ts +2 -0
  9. package/dist/Treble/index.js +2 -0
  10. package/dist/components/Accordion/accordion.styles.d.ts +5 -0
  11. package/dist/components/Accordion/accordion.styles.js +13 -0
  12. package/dist/components/Accordion/index.d.ts +14 -0
  13. package/dist/components/Accordion/index.js +63 -0
  14. package/dist/components/Cards/index.d.ts +2 -2
  15. package/dist/components/Drawer/index.js +0 -1
  16. package/dist/components/Dropdown/dropdown.styles.js +1 -3
  17. package/dist/components/Dropdown/index.d.ts +2 -2
  18. package/dist/components/FormComponentDescription/index.js +1 -1
  19. package/dist/components/Modal/index.js +3 -1
  20. package/dist/components/Share/index.d.ts +37 -0
  21. package/dist/components/Share/index.js +51 -0
  22. package/dist/components/Strips/index.d.ts +2 -2
  23. package/dist/components/Strips/index.js +1 -1
  24. package/dist/components/Swatch/index.d.ts +2 -2
  25. package/dist/components/Tabs/index.d.ts +14 -0
  26. package/dist/components/Tabs/index.js +53 -0
  27. package/dist/components/Tabs/tabs.styles.d.ts +8 -0
  28. package/dist/components/Tabs/tabs.styles.js +20 -0
  29. package/dist/components/ThreekitProvider/index.d.ts +11 -2
  30. package/dist/components/ThreekitProvider/index.js +3 -3
  31. package/dist/components/Tiles/index.d.ts +2 -2
  32. package/dist/components/TilesGroup/index.d.ts +2 -2
  33. package/dist/components/containers/formInputContainer.d.ts +1 -1
  34. package/dist/hooks/useShare/index.d.ts +3 -0
  35. package/dist/hooks/useShare/index.js +71 -0
  36. package/dist/hooks/useWishlist/index.d.ts +2 -3
  37. package/dist/index.d.ts +5 -1
  38. package/dist/index.js +9 -1
  39. package/dist/store/threekit.d.ts +5 -5
  40. package/dist/store/threekit.js +7 -6
  41. package/dist/threekit.d.ts +2 -0
  42. package/package.json +7 -5
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  **All you need to build a Web Experience for your Threekit Configurator.**
4
4
 
5
+ ## Overview
6
+
5
7
  The **Treble Design System** is a feature-rich React library of components, hooks, and added functionality needed to build an intuitive and engaging web experience for a Threekit Configurator.
6
8
 
7
9
  We have everything you need to get started!
@@ -16,6 +18,7 @@ We have everything you need to get started!
16
18
  ## Table of Contents
17
19
 
18
20
  - [Treble React](#treble-react)
21
+ - [Overview](#overview)
19
22
  - [Table of Contents](#table-of-contents)
20
23
  - [Getting Started](#getting-started)
21
24
  - [Installation](#installation)
@@ -70,21 +73,23 @@ A basic app will include the **Threekit Provider**, to connect our components to
70
73
  To get started you can copy the code from below, populating the values in the `threekitConfig` object.
71
74
 
72
75
  ```js
73
- import { ThreekitProvider, Player, FlatForm } from '@threekit-tools/treble'
76
+ import { ThreekitProvider, Player, FlatForm } from '@threekit-tools/treble';
74
77
 
75
78
  const threekitConfig = {
76
- preview: {
77
- orgId: '',
78
- assetId: '',
79
- publicToken: '',
79
+ credentials: {
80
+ preview: {
81
+ orgId: '',
82
+ assetId: '',
83
+ publicToken: '',
84
+ },
80
85
  },
81
- }
86
+ };
82
87
 
83
- const threekitEnv = 'preview'
88
+ const threekitEnv = 'preview';
84
89
 
85
90
  const ThreekitApp = () => {
86
91
  return (
87
- <ThreekitProvider config={threekitConfig} threekitEnv={threekitEnv}>
92
+ <ThreekitProvider {...threekitConfig} threekitEnv={threekitEnv}>
88
93
  <div
89
94
  style={{
90
95
  height: '100vh',
@@ -99,8 +104,8 @@ const ThreekitApp = () => {
99
104
  <FlatForm />
100
105
  </div>
101
106
  </ThreekitProvider>
102
- )
103
- }
107
+ );
108
+ };
104
109
  ```
105
110
 
106
111
  ## Components
@@ -112,11 +117,11 @@ The `<ThreekitProvider />` initializes the Threekit API used by the various comp
112
117
  The Threekit Provider requires the a config object, which includes all the credentials related a the project.
113
118
 
114
119
  ```jsx
115
- import React from 'react'
116
- import ReactDOM from 'react-dom'
120
+ import React from 'react';
121
+ import ReactDOM from 'react-dom';
117
122
 
118
- import { ThreekitProvider } from '@threekit-tools/treble'
119
- import App from './App'
123
+ import { ThreekitProvider } from '@threekit-tools/treble';
124
+ import App from './App';
120
125
 
121
126
  const config = {
122
127
  // The environment specific credentials should be placed
@@ -138,16 +143,16 @@ const config = {
138
143
  showShare: true,
139
144
  // We can pass overwrites to the default theme
140
145
  theme: { primaryColor: '#54AA54' },
141
- }
146
+ };
142
147
 
143
- const threekitEnv = 'preview'
148
+ const threekitEnv = 'preview';
144
149
 
145
150
  ReactDOM.render(
146
151
  <ThreekitProvider config={config} threekitEnv={threekitEnv}>
147
152
  <App /> // All Threekit related code goes here
148
153
  </ThreekitProvider>,
149
154
  document.getElementById('root')
150
- )
155
+ );
151
156
  ```
152
157
 
153
158
  **Threekit Provider Props**
@@ -157,7 +162,7 @@ The Threekit Provider takes two props:
157
162
  The `threekitEnv` sets which Threekit environment, `preview | admin-fts`, to use when running the app. It defaults to the **preview** environment.
158
163
 
159
164
  ```js
160
- const threekitEnv = 'admin-fts'
165
+ const threekitEnv = 'admin-fts';
161
166
  ```
162
167
 
163
168
  A `config` object including the **Threekit environment credentials**, the **Player API initialization parameters** and any **theme** overrides.
@@ -179,50 +184,52 @@ const threekitEnvironmentCredentials = {
179
184
  // (optional): The Asset Id of the Stage you wish to initialize in the
180
185
  // Threekit Player
181
186
  stageId: '',
182
- }
187
+ };
183
188
  ```
184
189
 
185
190
  The **Player API initialization parameters** should be added directly to the `config` object. More information about parameters can be found here: [Embedding the Threekit Player](https://community.threekit.com/hc/en-us/articles/4406068353307-Embedding-the-Threekit-Player).
186
191
 
187
192
  ```js
188
193
  const threekitConfig = {
189
- // (optional): determines whether to use the 3D Player (webgl) or
190
- // the 2D Player (image).
191
- display: 'webgl' | 'image',
192
- // The caching options for the player. It contains the maxAge
193
- // and scope for assets caching.
194
- cache,
195
- // (optional): Determines if we render the default Threekit
196
- // configurator.
197
- showConfigurator: true | false,
198
- // (optional): An override for the configuration to initialize
199
- // our asset with.
200
- initialConfiguration: {},
201
- // (optional): parameter to display a snapshot while the player
202
- // is loading. Default value is false
203
- showLoadingThumbnail: true | false,
204
- // (optional): Determines if we show the progress bar during
205
- // load. Default value is true.
206
- showLoadingProgress: true | false,
207
- // Takes a callback as its value. The callback's only argument
208
- // is a number, representing the progress ratio ( from 0.0
209
- // to 1.0 ). The callback will be called whenever the loading
210
- // progresses. The progress ratio is only approximate.
211
- onLoadingProgress: (progress) =>
212
- console.log(`Progress ${parseInt(progress * 100)}`),
213
- // (optional): Parameter to show/hide the built-in AR Button.
214
- // Default value is false.
215
- showAR,
216
- // (optional): Parameter to show/hide the built-in Share
217
- // Button. Default value is false.
218
- showShare,
219
- // (optional): toggles vertical orbit on mobile devices on or
220
- // off. Default value is false.
221
- allowMobileVerticalOrbit: true | false,
222
- // (optional): Override organization's compression setting for
223
- // renders in 2D player.
224
- compression,
225
- }
194
+ playerConfig: {
195
+ // (optional): determines whether to use the 3D Player (webgl) or
196
+ // the 2D Player (image).
197
+ display: 'webgl' | 'image',
198
+ // The caching options for the player. It contains the maxAge
199
+ // and scope for assets caching.
200
+ cache,
201
+ // (optional): Determines if we render the default Threekit
202
+ // configurator.
203
+ showConfigurator: true | false,
204
+ // (optional): An override for the configuration to initialize
205
+ // our asset with.
206
+ initialConfiguration: {},
207
+ // (optional): parameter to display a snapshot while the player
208
+ // is loading. Default value is false
209
+ showLoadingThumbnail: true | false,
210
+ // (optional): Determines if we show the progress bar during
211
+ // load. Default value is true.
212
+ showLoadingProgress: true | false,
213
+ // Takes a callback as its value. The callback's only argument
214
+ // is a number, representing the progress ratio ( from 0.0
215
+ // to 1.0 ). The callback will be called whenever the loading
216
+ // progresses. The progress ratio is only approximate.
217
+ onLoadingProgress: progress =>
218
+ console.log(`Progress ${parseInt(progress * 100)}`),
219
+ // (optional): Parameter to show/hide the built-in AR Button.
220
+ // Default value is false.
221
+ showAR,
222
+ // (optional): Parameter to show/hide the built-in Share
223
+ // Button. Default value is false.
224
+ showShare,
225
+ // (optional): toggles vertical orbit on mobile devices on or
226
+ // off. Default value is false.
227
+ allowMobileVerticalOrbit: true | false,
228
+ // (optional): Override organization's compression setting for
229
+ // renders in 2D player.
230
+ compression,
231
+ },
232
+ };
226
233
  ```
227
234
 
228
235
  The **theme** is used to style all the component available in the Treble library. You can override any of the default values by passing in your own value for a parameter into the theme object. The default values for the theme are:
@@ -245,7 +252,7 @@ const theme = {
245
252
  '0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);',
246
253
  widgetSize: '36px',
247
254
  fontFamily: '"Open Sans", sans-serif',
248
- }
255
+ };
249
256
  ```
250
257
 
251
258
  ### Player
@@ -253,16 +260,16 @@ const theme = {
253
260
  The `<Player />` component renders the **Threekit Player**.
254
261
 
255
262
  ```jsx
256
- import { ThreekitProvider, Player } from '@threekit-tools/treble'
257
- import threekitConfig from './threekit.config.js'
263
+ import { ThreekitProvider, Player } from '@threekit-tools/treble';
264
+ import threekitConfig from './threekit.config.js';
258
265
 
259
266
  const ThreekitApp = () => {
260
267
  return (
261
- <ThreekitProvider config={threekitConfig}>
268
+ <ThreekitProvider {...threekitConfig}>
262
269
  <Player />
263
270
  </ThreekitProvider>
264
- )
265
- }
271
+ );
272
+ };
266
273
  ```
267
274
 
268
275
  **Player Widgets**
@@ -270,16 +277,16 @@ const ThreekitApp = () => {
270
277
  The Player Component also comes with **widget containers** that can be used to position widgets or any component in pre-defined locations around the player.
271
278
 
272
279
  ```jsx
273
- import { ThreekitProvider, Player } from '@threekit-tools/treble'
274
- import threekitConfig from './threekit.config.js'
280
+ import { ThreekitProvider, Player } from '@threekit-tools/treble';
281
+ import threekitConfig from './threekit.config.js';
275
282
 
276
283
  // We can separate out the widget container component
277
284
  // or use the component directly from the Player component
278
- const { TopRightWidgets } = Player
285
+ const { TopRightWidgets } = Player;
279
286
 
280
287
  const ThreekitApp = () => {
281
288
  return (
282
- <ThreekitProvider config={threekitConfig}>
289
+ <ThreekitProvider {...threekitConfig}>
283
290
  <Player>
284
291
  <TopRightWidgets>
285
292
  <div>This will show up in the top-right of the player</div>
@@ -290,8 +297,8 @@ const ThreekitApp = () => {
290
297
  </Player.BottomRightWidgets>
291
298
  </Player>
292
299
  </ThreekitProvider>
293
- )
294
- }
300
+ );
301
+ };
295
302
  ```
296
303
 
297
304
  ### Forms
@@ -303,16 +310,16 @@ Forms can be used to render out complete configurators as a single component.
303
310
  The `<FlatForm>` component is used to render out the configurator for the initialized asset.
304
311
 
305
312
  ```jsx
306
- import { ThreekitProvider, FlatForm } from '@threekit-tools/treble'
307
- import threekitConfig from './threekit.config.js'
313
+ import { ThreekitProvider, FlatForm } from '@threekit-tools/treble';
314
+ import threekitConfig from './threekit.config.js';
308
315
 
309
316
  const App = () => {
310
317
  return (
311
- <ThreekitProvider config={threekitConfig}>
318
+ <ThreekitProvider {...threekitConfig}>
312
319
  <FlatForm />
313
320
  </ThreekitProvider>
314
- )
315
- }
321
+ );
322
+ };
316
323
  ```
317
324
 
318
325
  **Flat Form Props**
@@ -336,7 +343,7 @@ const flatFormProps = {
336
343
  // This will prevent 'Attribute 2' from being rendered.
337
344
  'Attribute 2': undefined,
338
345
  },
339
- }
346
+ };
340
347
  ```
341
348
 
342
349
  The `Flat Form` can take a prop of **`attributes`** that allow us to specify, which component to use for an attribute or if we want to hide any attributes.
@@ -349,8 +356,8 @@ We can also specify the horizontal alignment for the title by passing in one of
349
356
  By default the Form will not render reserved attributes. This can be controlled/over-written by using the prop **`includeReservedAttributes={false}`**.
350
357
 
351
358
  ```jsx
352
- import { ThreekitProvider, FlatForm } from '@threekit-tools/treble'
353
- import threekitConfig from './threekit.config.js'
359
+ import { ThreekitProvider, FlatForm } from '@threekit-tools/treble';
360
+ import threekitConfig from './threekit.config.js';
354
361
 
355
362
  const App = () => {
356
363
  const attributes = {
@@ -358,14 +365,14 @@ const App = () => {
358
365
  'Attribute 1': { component: 'swatch' },
359
366
  // This will prevent 'Attribute 2' from being rendered.
360
367
  'Attribute 2': undefined,
361
- }
368
+ };
362
369
 
363
370
  return (
364
- <ThreekitProvider config={threekitConfig}>
371
+ <ThreekitProvider {...threekitConfig}>
365
372
  <FlatForm attributes={attributes} />
366
373
  </ThreekitProvider>
367
- )
368
- }
374
+ );
375
+ };
369
376
  ```
370
377
 
371
378
  ### Widgets
@@ -379,7 +386,7 @@ All the widgets are designed to be buttons that can be placed on and around the
379
386
  The `<Snapshots />` is a button that will trigger the `window.threekit.treble.takeSnapshot()` when pressed and download the specified snapshots.
380
387
 
381
388
  ```js
382
- import { ThreekitProvider, Player, Snapshots } from '@threekit-tools/treble'
389
+ import { ThreekitProvider, Player, Snapshots } from '@threekit-tools/treble';
383
390
 
384
391
  const Component = () => {
385
392
  return (
@@ -393,8 +400,8 @@ const Component = () => {
393
400
  </Player.TopRightWidgets>
394
401
  </Player>
395
402
  </ThreekitProvider>
396
- )
397
- }
403
+ );
404
+ };
398
405
  ```
399
406
 
400
407
  The Snapshot takes two props: `camerasList` and `snapshotsConfig`.
@@ -407,7 +414,7 @@ The `snapshotConfig` allows us to define the following values:
407
414
  const snapshotsConfig = {
408
415
  format: 'png' | 'jpeg',
409
416
  filename: 'snapshot-filename',
410
- }
417
+ };
411
418
  ```
412
419
 
413
420
  **Note: These cameras must be setup to the configurator using the reserved camera attribute.**
@@ -421,7 +428,7 @@ The component is built using the useZoom hook. It provides a pair of + and - but
421
428
  It defaults to single increments changes but also accepts increment values to use instead.
422
429
 
423
430
  ```js
424
- import { ThreekitProvider, Player, Zoom } from '@threekit-tools/treble'
431
+ import { ThreekitProvider, Player, Zoom } from '@threekit-tools/treble';
425
432
 
426
433
  const Component = () => {
427
434
  return (
@@ -432,8 +439,8 @@ const Component = () => {
432
439
  </Player.MiddleRightWidgets>
433
440
  </Player>
434
441
  </ThreekitProvider>
435
- )
436
- }
442
+ );
443
+ };
437
444
  ```
438
445
 
439
446
  ### Displays
@@ -447,7 +454,7 @@ The `<ProductTitle />` component will display the value of the metadata key `_ti
447
454
  The title can also be overwritten by passing in your own title in as a prop.
448
455
 
449
456
  ```jsx
450
- import { ProductTitle } from '@threekit-tools/treble'
457
+ import { ProductTitle } from '@threekit-tools/treble';
451
458
 
452
459
  const Component = () => {
453
460
  return (
@@ -456,8 +463,8 @@ const Component = () => {
456
463
  // With a custom title
457
464
  <ProductTitle title="Custom Title" />
458
465
  </div>
459
- )
460
- }
466
+ );
467
+ };
461
468
  ```
462
469
 
463
470
  #### Product Description
@@ -469,7 +476,7 @@ The description can also be overwritten by passing in your own description in as
469
476
  It is built using the [useMetadata() hook](#use-metadata).
470
477
 
471
478
  ```jsx
472
- import { Description } from '@threekit-tools/treble'
479
+ import { Description } from '@threekit-tools/treble';
473
480
 
474
481
  const Component = () => {
475
482
  return (
@@ -478,8 +485,8 @@ const Component = () => {
478
485
  // With a custom description
479
486
  <ProductDescription description="This is a custom description." />
480
487
  </div>
481
- )
482
- }
488
+ );
489
+ };
483
490
  ```
484
491
 
485
492
  #### Attribute Title
@@ -489,15 +496,15 @@ The `<AttributeTitle>` will display the translated attribute name of an attribut
489
496
  It is built using the [useName() hook](#use-name).
490
497
 
491
498
  ```jsx
492
- import { AttributeTitle } from '@threekit-tools/treble'
499
+ import { AttributeTitle } from '@threekit-tools/treble';
493
500
 
494
501
  const Component = () => {
495
502
  return (
496
503
  <div>
497
504
  <AttributeTitle attribute="Attribute Name" />
498
505
  </div>
499
- )
500
- }
506
+ );
507
+ };
501
508
  ```
502
509
 
503
510
  #### Attribute Value
@@ -525,15 +532,15 @@ It is built using the [usePrice() hook](#use-price).
525
532
  **Support for multiple Pricebooks and Currencies coming soon**
526
533
 
527
534
  ```jsx
528
- import { TotalPrice } from '@threekit-tools/treble'
535
+ import { TotalPrice } from '@threekit-tools/treble';
529
536
 
530
537
  const Component = () => {
531
538
  return (
532
539
  <div>
533
540
  <TotalPrice />
534
541
  </div>
535
- )
536
- }
542
+ );
543
+ };
537
544
  ```
538
545
 
539
546
  ### Wrappers
@@ -543,7 +550,7 @@ const Component = () => {
543
550
  The `<AwaitThreekitLoad>` wrapper, is used to wrap any content that we don't want to render until the Threekit Player initialization process is complete.
544
551
 
545
552
  ```jsx
546
- import { AwaitThreekitLoad } from '@threekit-tools/treble'
553
+ import { AwaitThreekitLoad } from '@threekit-tools/treble';
547
554
 
548
555
  const Component = () => {
549
556
  return (
@@ -554,8 +561,8 @@ const Component = () => {
554
561
  intialization is complete
555
562
  </AwaitThreekitLoad>
556
563
  </div>
557
- )
558
- }
564
+ );
565
+ };
559
566
  ```
560
567
 
561
568
  #### Portal to Element
@@ -565,7 +572,7 @@ The `<PortalToElement>` wrapper can be used to place its content in any div anyw
565
572
  The wrapper requires an `elementId` prop to specify the id of the div to render its contents into. It also optionally takes a `strict` prop, which determines the behavior if the element to render the content into is not found. `strict={true}` will only render the contents in the HTML element matching the provided element ID, while `strict={false}` (default) will render out its contents as part of the regular React flow, if the specified element is not found.
566
573
 
567
574
  ```jsx
568
- import { AwaitThreekitLoad } from '@threekit-tools/treble'
575
+ import { AwaitThreekitLoad } from '@threekit-tools/treble';
569
576
 
570
577
  const Component = () => {
571
578
  return (
@@ -575,8 +582,8 @@ const Component = () => {
575
582
  This content will only be rendered in a div with the id 'form-container'
576
583
  </PortalToElement>
577
584
  </div>
578
- )
579
- }
585
+ );
586
+ };
580
587
  ```
581
588
 
582
589
  ### Layouts
@@ -588,13 +595,13 @@ Layouts are design organization components that we can use to introduce structur
588
595
  A Modal is used to present an actionable pop-up to the user.
589
596
 
590
597
  ```jsx
591
- import { useState } from 'react'
592
- import { Modal } from '@threekit-tools/treble'
598
+ import { useState } from 'react';
599
+ import { Modal } from '@threekit-tools/treble';
593
600
 
594
601
  const App = () => {
595
- const [showModal, setShowModal] = useState(false)
602
+ const [showModal, setShowModal] = useState(false);
596
603
 
597
- const handleClose = () => setShowModal(false)
604
+ const handleClose = () => setShowModal(false);
598
605
 
599
606
  return (
600
607
  <Modal show={showModal} handleClose={handleClose}>
@@ -602,8 +609,8 @@ const App = () => {
602
609
  Content to be placed in the modal is added as an HTML child element.
603
610
  </div>
604
611
  </Modal>
605
- )
606
- }
612
+ );
613
+ };
607
614
  ```
608
615
 
609
616
  #### Drawer
@@ -611,13 +618,13 @@ const App = () => {
611
618
  A Drawer can be used to present an actionable slide-out drawer to the user.
612
619
 
613
620
  ```jsx
614
- import { useState } from 'react'
615
- import { Drawer } from '@threekit-tools/treble'
621
+ import { useState } from 'react';
622
+ import { Drawer } from '@threekit-tools/treble';
616
623
 
617
624
  const App = () => {
618
- const [showDrawer, setShowDrawer] = useState(false)
625
+ const [showDrawer, setShowDrawer] = useState(false);
619
626
 
620
- const handleClose = () => setShowDrawer(false)
627
+ const handleClose = () => setShowDrawer(false);
621
628
 
622
629
  return (
623
630
  <Drawer show={showDrawer} handleClose={handleClose}>
@@ -625,8 +632,8 @@ const App = () => {
625
632
  Content to be placed in the drawer is added as an HTML child element.
626
633
  </div>
627
634
  </Drawer>
628
- )
629
- }
635
+ );
636
+ };
630
637
  ```
631
638
 
632
639
  ### Hooks
@@ -638,12 +645,12 @@ The `useAttribute` hook allows us to connect a component to an Attribute in our
638
645
  It takes the name of the attribute that you want to interact with and returns an array where the first element is the data for that attribute, as returned by the `getDisplayAttributes()` function, and the second element is a function that can be used to update the value of that attribute, by prepping and passing the value on to `setConfiguration()`.
639
646
 
640
647
  ```jsx
641
- import { useAttribute } from '@threekit-tools/treble'
648
+ import { useAttribute } from '@threekit-tools/treble';
642
649
 
643
650
  const AttributeComponent = () => {
644
- const [attribute, setAttribute] = useAttribute('Attribute Name')
651
+ const [attribute, setAttribute] = useAttribute('Attribute Name');
645
652
 
646
- const selected = attribute.value
653
+ const selected = attribute.value;
647
654
 
648
655
  return (
649
656
  <div>
@@ -656,8 +663,8 @@ const AttributeComponent = () => {
656
663
  ))}
657
664
  </div>
658
665
  </div>
659
- )
660
- }
666
+ );
667
+ };
661
668
  ```
662
669
 
663
670
  #### Use Configurator
@@ -667,44 +674,44 @@ The `useConfigurator` hook allows us to connect to all our attributes in the ini
667
674
  The hook returns an array of two items. The first item is almost identical to the value returned by `getDisplayAttributes()`. The second item is a change handler function that passes the value passed in straight through to `setConfiguration()`.
668
675
 
669
676
  ```jsx
670
- import { useConfigurator } from '@threekit-tools/treble'
677
+ import { useConfigurator } from '@threekit-tools/treble';
671
678
 
672
679
  const AttributeComponent = () => {
673
- const [attributes, setConfiguration] = useConfigurator()
674
- return <div>Attributes Component example</div>
675
- }
680
+ const [attributes, setConfiguration] = useConfigurator();
681
+ return <div>Attributes Component example</div>;
682
+ };
676
683
  ```
677
684
 
678
685
  #### Use Threekit Init Status
679
686
 
680
687
  ```jsx
681
- import { useThreekitInitStatus } from '@threekit-tools/treble'
688
+ import { useThreekitInitStatus } from '@threekit-tools/treble';
682
689
 
683
690
  const Component = () => {
684
- const hasLoaded = useThreekitInitStatus()
691
+ const hasLoaded = useThreekitInitStatus();
685
692
  return (
686
693
  <div>
687
694
  {hasLoaded ? 'Threekit API has loaded' : 'Loading in progress...'}
688
695
  </div>
689
- )
690
- }
696
+ );
697
+ };
691
698
  ```
692
699
 
693
700
  #### Use Player Loading Status
694
701
 
695
702
  ```jsx
696
- import { usePlayerLoadingStatus } from '@threekit-tools/treble'
703
+ import { usePlayerLoadingStatus } from '@threekit-tools/treble';
697
704
 
698
705
  const Component = () => {
699
- const hasLoaded = usePlayerLoadingStatus()
706
+ const hasLoaded = usePlayerLoadingStatus();
700
707
  return (
701
708
  <div>
702
709
  {hasLoaded
703
710
  ? 'Threekit Player has rendering'
704
711
  : 'Player rendering in progress...'}
705
712
  </div>
706
- )
707
- }
713
+ );
714
+ };
708
715
  ```
709
716
 
710
717
  #### Use Metadata
@@ -716,10 +723,10 @@ The hook returns an object with the metadata.
716
723
  It is used to build the [Description Display component](#description)
717
724
 
718
725
  ```jsx
719
- import { useMetadata } from '@threekit-tools/treble'
726
+ import { useMetadata } from '@threekit-tools/treble';
720
727
 
721
728
  const MetadataComponent = () => {
722
- const metadata = useMetadata()
729
+ const metadata = useMetadata();
723
730
  return (
724
731
  <div>
725
732
  {Object.entries(metadata).map(([key, value], i) => (
@@ -728,8 +735,8 @@ const MetadataComponent = () => {
728
735
  </div>
729
736
  ))}
730
737
  </div>
731
- )
732
- }
738
+ );
739
+ };
733
740
  ```
734
741
 
735
742
  #### Use Name
@@ -741,12 +748,12 @@ The hook a single string value.
741
748
  It is used to build the [Title Display component](#title)
742
749
 
743
750
  ```jsx
744
- import { useName } from '@threekit-tools/treble'
751
+ import { useName } from '@threekit-tools/treble';
745
752
 
746
753
  const TitleComponent = () => {
747
- const name = useName()
748
- return <div>{name}</div>
749
- }
754
+ const name = useName();
755
+ return <div>{name}</div>;
756
+ };
750
757
  ```
751
758
 
752
759
  #### Use Price
@@ -754,12 +761,12 @@ const TitleComponent = () => {
754
761
  The `usePrice` hook provides the total price of the current configuration calculated based on the pricing set on the Threekit Platform.
755
762
 
756
763
  ```jsx
757
- import { usePrice } from '@threekit-tools/treble'
764
+ import { usePrice } from '@threekit-tools/treble';
758
765
 
759
766
  const PriceComponent = () => {
760
- const price = usePrice()
761
- return <div>${price}</div>
762
- }
767
+ const price = usePrice();
768
+ return <div>${price}</div>;
769
+ };
763
770
  ```
764
771
 
765
772
  #### Use Snapshot
@@ -767,19 +774,19 @@ const PriceComponent = () => {
767
774
  The `useSnapshot` should provides functionality to takeSnapshots of the view in the Threekit Player.
768
775
 
769
776
  ```jsx
770
- import { useSnapshot } from '@threekit-tools/treble'
777
+ import { useSnapshot } from '@threekit-tools/treble';
771
778
 
772
779
  const SnapshotComponent = () => {
773
- const takeSnapshots = useSnapshot()
780
+ const takeSnapshots = useSnapshot();
774
781
 
775
782
  const handleClickSnapshot = () => {
776
- takeSnapshots(undefined, { output: 'download' })
777
- }
783
+ takeSnapshots(undefined, { output: 'download' });
784
+ };
778
785
 
779
786
  return (
780
787
  <button onClick={() => handleClickSnapshot()}>Download Snapshot</button>
781
- )
782
- }
788
+ );
789
+ };
783
790
  ```
784
791
 
785
792
  #### Use Zoom
@@ -793,10 +800,10 @@ The default increment value is `1`.
793
800
  It is used to build the [Zoom Widget](#zoom).
794
801
 
795
802
  ```jsx
796
- import { useZoom } from '@threekit-tools/treble'
803
+ import { useZoom } from '@threekit-tools/treble';
797
804
 
798
805
  const ZoomComponent = () => {
799
- const [zoomIn, zoomOut] = useZoom()
806
+ const [zoomIn, zoomOut] = useZoom();
800
807
  return (
801
808
  <div>
802
809
  // Changes zoom by +1
@@ -804,6 +811,6 @@ const ZoomComponent = () => {
804
811
  // Changes zoom -3
805
812
  <button onClick={() => zoomOut(3)}>Zoom Out</button>
806
813
  </div>
807
- )
808
- }
814
+ );
815
+ };
809
816
  ```