@combeenation/custom-code-sdk 0.0.1-alpha1

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.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # TODO HAR - Update readme + add docs or at least create YT ticket
2
+
3
+ # Custom code sdk
4
+
5
+ This repository contains utils for creating Combeenation configurators with custom code implementation.
6
+
7
+ ## Documentation
8
+
9
+ For more detailed documentation see https://custom-code.docs.combeenation.com/
10
+
11
+ ## Installation
12
+
13
+ The custom code sdk is available as npm package.
14
+
15
+ ```
16
+ npm install @combeenation/custom-code-sdk
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ The custom code sdk package contains functionalities for interacting with a Combeenation configurator, such as:
22
+
23
+ - manipulating components and controls
24
+ - utilize the 3D Viewer API
25
+ - Combeenation (based on Babylon.js)
26
+ - Shapediver
27
+ - general configurator tasks (eg: customized checkout, resource upload,...)
28
+
29
+ All these functionalities can be found inside dedicated modules or component objects.<br>
30
+ For example, when manipulating a component input just import the component in your code and call the desired method.
31
+
32
+ ```
33
+ // See section below on how to retrieve those typings
34
+ import { MyComponent } from './typings/cfgr-defs.generated';
35
+ MyComponent.setInput(newCmpValue);
36
+ ```
37
+
38
+ Or to add a custom click event to a control:
39
+
40
+ ```
41
+ CtrlUtils.onCtrlClicked(CtrlNames.JS_CheckoutBtn, () => {
42
+ console.log('button clicked');
43
+ });
44
+ ```
45
+
46
+ ## Typings
47
+
48
+ ### Components
49
+
50
+ To easily interact with components of your editor we provide a dedicated "definitions file".
51
+ In your configurator editor (draft) you can download the file `cfgr-defs.generated.ts` in the components menu.
52
+ Simply paste it in your project and you're ready to go.
53
+
54
+ ### Configurator
55
+
56
+ The package also contains various TS typings which are specific to our configurators.<br>
57
+ First there are the typings for all available util methods provided by this repo.<br>
58
+ These typings are prefixed with `Cbn.CustomCode`.
59
+
60
+ Furthermore the package also provides typings for "publicly" available Combeenation system code.<br>
61
+ The system code is present in every configurator and can be consumed/used by custom code.
62
+
63
+ These system code typings consists of two parts:
64
+
65
+ - Combeenation system code typings, prefixed with `Cbn`
66
+ - Typings for third party libraries, such as `jQuery`
67
+
68
+ Keep in mind that there can be differences between the third party typings and the code that is actually used in the configurator.<br>
69
+ For example at the time of writing, `jQuery` typings came in version `3.3.0` whilst we're actually using `3.1.0` in the system code.<br>
70
+ There shouldn't be any major differences regarding the API of those 2 versions but still they can be slightly different.
71
+
72
+ What does this mean for the consumer?<br>
73
+ Take good care when using third party library typings in your custom code and don't blindly trust auto completion & linting in the IDE here.