@threekit-tools/treble 0.0.91 → 0.0.92

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 (165) hide show
  1. package/dist/Treble/Treble.d.ts +1 -1
  2. package/dist/Treble/snapshot.d.ts +22 -0
  3. package/dist/Treble/snapshot.js +247 -0
  4. package/dist/Treble/snapshots.d.ts +1 -1
  5. package/dist/components/ThreekitProvider/index.js +3 -2
  6. package/dist/connection.d.ts +4 -1
  7. package/dist/connection.js +16 -53
  8. package/dist/hooks/useAttribute/index.js +1 -5
  9. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  10. package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
  11. package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
  12. package/dist/hooks/useSpaces/SpacesState.d.ts +164 -0
  13. package/dist/hooks/useSpaces/SpacesState.js +1751 -0
  14. package/dist/hooks/useSpaces/constants.d.ts +64 -0
  15. package/dist/hooks/useSpaces/constants.js +109 -0
  16. package/dist/hooks/useSpaces/dataHandlers.d.ts +20 -0
  17. package/dist/hooks/useSpaces/dataHandlers.js +254 -0
  18. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
  19. package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
  20. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
  21. package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
  22. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
  23. package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
  24. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
  25. package/dist/hooks/useSpaces/draw/drawDoors.js +99 -0
  26. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
  27. package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
  28. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
  29. package/dist/hooks/useSpaces/draw/drawGrid.js +33 -0
  30. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
  31. package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
  32. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
  33. package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
  34. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
  35. package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
  36. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +10 -0
  37. package/dist/hooks/useSpaces/draw/drawWalls.js +88 -0
  38. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
  39. package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
  40. package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
  41. package/dist/hooks/useSpaces/draw/index.js +129 -0
  42. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
  43. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
  44. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
  45. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
  46. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
  47. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
  48. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
  49. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
  50. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
  51. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
  52. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
  53. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
  54. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
  55. package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
  56. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
  57. package/dist/hooks/useSpaces/geometry/findLoops.js +117 -0
  58. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
  59. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
  60. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
  61. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
  62. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
  63. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
  64. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
  65. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
  66. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
  67. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
  68. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
  69. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
  70. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
  71. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
  72. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
  73. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
  74. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
  75. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
  76. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
  77. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
  78. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
  79. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
  80. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
  81. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
  82. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
  83. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
  84. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
  85. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
  86. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
  87. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
  88. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
  89. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
  90. package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
  91. package/dist/hooks/useSpaces/geometry/index.js +64 -0
  92. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
  93. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
  94. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
  95. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
  96. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
  97. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
  98. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
  99. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
  100. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
  101. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
  102. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
  103. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
  104. package/dist/hooks/useSpaces/index.d.ts +82 -0
  105. package/dist/hooks/useSpaces/index.js +482 -0
  106. package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
  107. package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
  108. package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
  109. package/dist/hooks/useSpaces/themes/default.js +96 -0
  110. package/dist/hooks/useSpaces/themes/index.d.ts +11 -0
  111. package/dist/hooks/useSpaces/themes/index.js +21 -0
  112. package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
  113. package/dist/hooks/useSpaces/themes/light.js +96 -0
  114. package/dist/hooks/useSpaces/types.d.ts +339 -0
  115. package/dist/hooks/useSpaces/types.js +54 -0
  116. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
  117. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
  118. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
  119. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
  120. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
  121. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
  122. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
  123. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
  124. package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
  125. package/dist/hooks/useSpaces/validators/index.js +40 -0
  126. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
  127. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
  128. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
  129. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
  130. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
  131. package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
  132. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
  133. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
  134. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
  135. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
  136. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
  137. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
  138. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
  139. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
  140. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
  141. package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
  142. package/dist/hooks/useSpaces/validators/messaging.d.ts +8 -0
  143. package/dist/hooks/useSpaces/validators/messaging.js +18 -0
  144. package/dist/icons/Player3D.d.ts +3 -0
  145. package/dist/icons/Player3D.js +21 -0
  146. package/dist/icons/Ruler copy.d.ts +3 -0
  147. package/dist/icons/Ruler copy.js +22 -0
  148. package/dist/icons/RulerBlank.d.ts +3 -0
  149. package/dist/icons/RulerBlank.js +25 -0
  150. package/dist/icons/RulerDetailed copy.d.ts +3 -0
  151. package/dist/icons/RulerDetailed copy.js +27 -0
  152. package/dist/icons/RulerDetailed.d.ts +3 -0
  153. package/dist/icons/RulerDetailed.js +27 -0
  154. package/dist/icons/types.d.ts +1 -1
  155. package/dist/store/attributes.d.ts +1 -1
  156. package/dist/store/index.d.ts +10 -31
  157. package/dist/store/spaces.d.ts +47 -0
  158. package/dist/store/spaces.js +197 -0
  159. package/dist/store/treble.d.ts +3 -1
  160. package/dist/store/treble.js +45 -30
  161. package/dist/store/wishlist.d.ts +20 -2
  162. package/dist/types.d.ts +12 -3
  163. package/package.json +2 -1
  164. package/dist/hooks/useSpaces/Canvas.d.ts +0 -37
  165. package/dist/hooks/useSpaces/Canvas.js +0 -199
@@ -1,79 +1,58 @@
1
1
  import { TypedUseSelectorHook } from 'react-redux';
2
2
  import { Reducer } from 'redux';
3
- declare const store: import("@reduxjs/toolkit").EnhancedStore<{
3
+ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
4
4
  treble: import("./treble").TrebleState;
5
5
  product: import("./product").ProductState;
6
6
  attributes: import("./attributes").AttributesState;
7
7
  translations: import("./translations").TranslationsState;
8
8
  wishlist: import("../Treble").WishlistArray;
9
9
  price: import("./price").PriceState;
10
- }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<import("redux-thunk").ThunkMiddleware<{
10
+ }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<{
11
11
  treble: import("./treble").TrebleState;
12
12
  product: import("./product").ProductState;
13
13
  attributes: import("./attributes").AttributesState;
14
14
  translations: import("./translations").TranslationsState;
15
15
  wishlist: import("../Treble").WishlistArray;
16
16
  price: import("./price").PriceState;
17
- }, import("redux").AnyAction, null> | import("redux-thunk").ThunkMiddleware<{
17
+ }, import("redux").AnyAction, undefined>]> | import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<{
18
18
  treble: import("./treble").TrebleState;
19
19
  product: import("./product").ProductState;
20
20
  attributes: import("./attributes").AttributesState;
21
21
  translations: import("./translations").TranslationsState;
22
22
  wishlist: import("../Treble").WishlistArray;
23
23
  price: import("./price").PriceState;
24
- }, import("redux").AnyAction, undefined> | import("redux").Middleware<{}, {
24
+ }, import("redux").AnyAction, undefined>, import("redux").Middleware<{}, any, import("redux").Dispatch<import("redux").AnyAction>>]>>;
25
+ export declare const createStore: (reducer?: Record<string, Reducer>) => import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<{
25
26
  treble: import("./treble").TrebleState;
26
27
  product: import("./product").ProductState;
27
28
  attributes: import("./attributes").AttributesState;
28
29
  translations: import("./translations").TranslationsState;
29
30
  wishlist: import("../Treble").WishlistArray;
30
31
  price: import("./price").PriceState;
31
- }, import("redux").Dispatch<import("redux").AnyAction>>>>;
32
- export declare const createStore: (reducer?: Record<string, Reducer>) => import("@reduxjs/toolkit").EnhancedStore<{
32
+ }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<{
33
33
  treble: import("./treble").TrebleState;
34
34
  product: import("./product").ProductState;
35
35
  attributes: import("./attributes").AttributesState;
36
36
  translations: import("./translations").TranslationsState;
37
37
  wishlist: import("../Treble").WishlistArray;
38
38
  price: import("./price").PriceState;
39
- }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<import("redux-thunk").ThunkMiddleware<{
39
+ }, import("redux").AnyAction, undefined>]> | import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<{
40
40
  treble: import("./treble").TrebleState;
41
41
  product: import("./product").ProductState;
42
42
  attributes: import("./attributes").AttributesState;
43
43
  translations: import("./translations").TranslationsState;
44
44
  wishlist: import("../Treble").WishlistArray;
45
45
  price: import("./price").PriceState;
46
- }, import("redux").AnyAction, null> | import("redux-thunk").ThunkMiddleware<{
47
- treble: import("./treble").TrebleState;
48
- product: import("./product").ProductState;
49
- attributes: import("./attributes").AttributesState;
50
- translations: import("./translations").TranslationsState;
51
- wishlist: import("../Treble").WishlistArray;
52
- price: import("./price").PriceState;
53
- }, import("redux").AnyAction, undefined> | import("redux").Middleware<{}, {
54
- treble: import("./treble").TrebleState;
55
- product: import("./product").ProductState;
56
- attributes: import("./attributes").AttributesState;
57
- translations: import("./translations").TranslationsState;
58
- wishlist: import("../Treble").WishlistArray;
59
- price: import("./price").PriceState;
60
- }, import("redux").Dispatch<import("redux").AnyAction>>>>;
46
+ }, import("redux").AnyAction, undefined>, import("redux").Middleware<{}, any, import("redux").Dispatch<import("redux").AnyAction>>]>>;
61
47
  export declare type RootState = ReturnType<typeof store.getState>;
62
48
  export declare type ThreekitDispatch = typeof store.dispatch;
63
- export declare const useThreekitDispatch: () => import("redux").Dispatch<import("redux").AnyAction> & import("@reduxjs/toolkit").ThunkDispatch<{
64
- treble: import("./treble").TrebleState;
65
- product: import("./product").ProductState;
66
- attributes: import("./attributes").AttributesState;
67
- translations: import("./translations").TranslationsState;
68
- wishlist: import("../Treble").WishlistArray;
69
- price: import("./price").PriceState;
70
- }, null, import("redux").AnyAction> & import("@reduxjs/toolkit").ThunkDispatch<{
49
+ export declare const useThreekitDispatch: () => import("@reduxjs/toolkit").ThunkDispatch<{
71
50
  treble: import("./treble").TrebleState;
72
51
  product: import("./product").ProductState;
73
52
  attributes: import("./attributes").AttributesState;
74
53
  translations: import("./translations").TranslationsState;
75
54
  wishlist: import("../Treble").WishlistArray;
76
55
  price: import("./price").PriceState;
77
- }, undefined, import("redux").AnyAction>;
56
+ }, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").AnyAction>;
78
57
  export declare const useThreekitSelector: TypedUseSelectorHook<RootState>;
79
58
  export default createStore;
@@ -0,0 +1,47 @@
1
+ import { RootState, ThreekitDispatch } from './index';
2
+ import { IConfiguration } from '../types';
3
+ import { ICoordinate2D, IDimensionOptions, IModes, IUnits } from '../hooks/useSpaces/types';
4
+ interface ILayout {
5
+ label: string;
6
+ configuration: IConfiguration;
7
+ loop: Array<ICoordinate2D[]>;
8
+ }
9
+ interface IAttributeMap {
10
+ walls: string;
11
+ startX: string;
12
+ startZ: string;
13
+ endX: string;
14
+ endZ: string;
15
+ }
16
+ export interface SpacesState {
17
+ mode: IModes;
18
+ layouts: Array<ILayout>;
19
+ unit: IUnits;
20
+ zoom: null | number;
21
+ translation: null | ICoordinate2D;
22
+ showDimensions: IDimensionOptions;
23
+ angleSnappingEnabled: boolean;
24
+ guideSnappingEnabled: boolean;
25
+ gridSnappingEnabled: boolean;
26
+ }
27
+ export declare const setLayouts: import("@reduxjs/toolkit").ActionCreatorWithPayload<ILayout[], string>;
28
+ export declare const setZoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
29
+ export declare const setUnit: import("@reduxjs/toolkit").ActionCreatorWithPayload<IUnits, string>;
30
+ export declare const setTranslation: import("@reduxjs/toolkit").ActionCreatorWithPayload<ICoordinate2D, string>;
31
+ export declare const setMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<IModes, string>;
32
+ export declare const setShowDimensions: import("@reduxjs/toolkit").ActionCreatorWithPayload<IDimensionOptions, string>;
33
+ export declare const setAngleSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
34
+ export declare const setGuideSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
35
+ export declare const setGridSnappingEnabled: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
36
+ declare const reducer: import("redux").Reducer<SpacesState, import("redux").AnyAction>;
37
+ export declare const getMode: (state: RootState) => IModes;
38
+ export declare const getLayouts: (state: RootState) => Array<ILayout>;
39
+ export declare const getUnit: (state: RootState) => IUnits;
40
+ export declare const getZoom: (state: RootState) => number | null;
41
+ export declare const getTranslation: (state: RootState) => ICoordinate2D | null;
42
+ export declare const getShowDimensions: (state: RootState) => IDimensionOptions;
43
+ export declare const getAngleSnappingEnabled: (state: RootState) => boolean;
44
+ export declare const getGuideSnappingEnabled: (state: RootState) => boolean;
45
+ export declare const getGridSnappingEnabled: (state: RootState) => boolean;
46
+ export declare const hydrateLayouts: (configurationIds: Array<string>, attributeMap: IAttributeMap) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
47
+ export default reducer;
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
+ if (ar || !(i in from)) {
52
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
+ ar[i] = from[i];
54
+ }
55
+ }
56
+ return to.concat(ar || Array.prototype.slice.call(from));
57
+ };
58
+ var __importDefault = (this && this.__importDefault) || function (mod) {
59
+ return (mod && mod.__esModule) ? mod : { "default": mod };
60
+ };
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ exports.hydrateLayouts = exports.getGridSnappingEnabled = exports.getGuideSnappingEnabled = exports.getAngleSnappingEnabled = exports.getShowDimensions = exports.getTranslation = exports.getZoom = exports.getUnit = exports.getLayouts = exports.getMode = exports.setGridSnappingEnabled = exports.setGuideSnappingEnabled = exports.setAngleSnappingEnabled = exports.setShowDimensions = exports.setMode = exports.setTranslation = exports.setUnit = exports.setZoom = exports.setLayouts = void 0;
63
+ var toolkit_1 = require("@reduxjs/toolkit");
64
+ var api_1 = __importDefault(require("../api"));
65
+ var types_1 = require("../hooks/useSpaces/types");
66
+ var geometry_1 = require("../hooks/useSpaces/geometry");
67
+ exports.setLayouts = (0, toolkit_1.createAction)('treble/spaces/set-layouts');
68
+ exports.setZoom = (0, toolkit_1.createAction)('treble/spaces/set-zoom');
69
+ exports.setUnit = (0, toolkit_1.createAction)('treble/spaces/set-unit');
70
+ exports.setTranslation = (0, toolkit_1.createAction)('treble/spaces/set-translation');
71
+ exports.setMode = (0, toolkit_1.createAction)('treble/spaces/set-mode');
72
+ exports.setShowDimensions = (0, toolkit_1.createAction)('treble/spaces/set-show-dimensions');
73
+ exports.setAngleSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-angle-snapping-enabled');
74
+ exports.setGuideSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-guide-snapping-enabled');
75
+ exports.setGridSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-grid-snapping-enabled');
76
+ var initialState = {
77
+ mode: types_1.IModes.SELECT,
78
+ layouts: [],
79
+ unit: types_1.IUnits.FEET,
80
+ zoom: null,
81
+ translation: null,
82
+ showDimensions: types_1.IDimensionOptions.DEFAULT,
83
+ angleSnappingEnabled: true,
84
+ guideSnappingEnabled: true,
85
+ gridSnappingEnabled: true,
86
+ };
87
+ var reducer = (0, toolkit_1.createSlice)({
88
+ name: 'spaces',
89
+ initialState: initialState,
90
+ extraReducers: function (builder) {
91
+ builder.addCase(exports.setMode, function (state, action) {
92
+ return __assign(__assign({}, state), { mode: action.payload });
93
+ });
94
+ builder.addCase(exports.setLayouts, function (state, action) {
95
+ return __assign(__assign({}, state), { layouts: action.payload });
96
+ });
97
+ builder.addCase(exports.setUnit, function (state, action) {
98
+ return __assign(__assign({}, state), { unit: action.payload });
99
+ });
100
+ builder.addCase(exports.setZoom, function (state, action) {
101
+ return __assign(__assign({}, state), { zoom: action.payload });
102
+ });
103
+ builder.addCase(exports.setTranslation, function (state, action) {
104
+ return __assign(__assign({}, state), { translation: action.payload });
105
+ });
106
+ builder.addCase(exports.setShowDimensions, function (state, action) {
107
+ return __assign(__assign({}, state), { showDimensions: action.payload });
108
+ });
109
+ builder.addCase(exports.setAngleSnappingEnabled, function (state, action) {
110
+ return __assign(__assign({}, state), { angleSnappingEnabled: action.payload });
111
+ });
112
+ builder.addCase(exports.setGuideSnappingEnabled, function (state, action) {
113
+ return __assign(__assign({}, state), { guideSnappingEnabled: action.payload });
114
+ });
115
+ builder.addCase(exports.setGridSnappingEnabled, function (state, action) {
116
+ return __assign(__assign({}, state), { gridSnappingEnabled: action.payload });
117
+ });
118
+ },
119
+ reducers: {},
120
+ }).reducer;
121
+ var getMode = function (state) { return state.spaces.mode; };
122
+ exports.getMode = getMode;
123
+ var getLayouts = function (state) {
124
+ return state.spaces.layouts;
125
+ };
126
+ exports.getLayouts = getLayouts;
127
+ var getUnit = function (state) { return state.spaces.unit; };
128
+ exports.getUnit = getUnit;
129
+ var getZoom = function (state) { return state.spaces.zoom; };
130
+ exports.getZoom = getZoom;
131
+ var getTranslation = function (state) { return state.spaces.translation; };
132
+ exports.getTranslation = getTranslation;
133
+ var getShowDimensions = function (state) {
134
+ return state.spaces.showDimensions;
135
+ };
136
+ exports.getShowDimensions = getShowDimensions;
137
+ var getAngleSnappingEnabled = function (state) {
138
+ return state.spaces.angleSnappingEnabled;
139
+ };
140
+ exports.getAngleSnappingEnabled = getAngleSnappingEnabled;
141
+ var getGuideSnappingEnabled = function (state) {
142
+ return state.spaces.guideSnappingEnabled;
143
+ };
144
+ exports.getGuideSnappingEnabled = getGuideSnappingEnabled;
145
+ var getGridSnappingEnabled = function (state) {
146
+ return state.spaces.gridSnappingEnabled;
147
+ };
148
+ exports.getGridSnappingEnabled = getGridSnappingEnabled;
149
+ var hydrateLayouts = function (configurationIds, attributeMap) {
150
+ return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
151
+ var state, layoutIds, configurationResponses, prepped;
152
+ var _a;
153
+ return __generator(this, function (_b) {
154
+ switch (_b.label) {
155
+ case 0:
156
+ state = getState();
157
+ if (state.spaces.layouts.length)
158
+ return [2];
159
+ layoutIds = __spreadArray([], configurationIds, true);
160
+ if ((_a = state.product.metadata) === null || _a === void 0 ? void 0 : _a._layouts)
161
+ state.product.metadata._layouts
162
+ .split(',')
163
+ .forEach(function (id) { return layoutIds.push(id.trim()); });
164
+ return [4, Promise.all(layoutIds.map(function (configId) { return api_1.default.configurations.fetch(configId); }))];
165
+ case 1:
166
+ configurationResponses = _b.sent();
167
+ prepped = configurationResponses.map(function (response) {
168
+ var _a;
169
+ var wallsAttribute = response.data.variant[attributeMap.walls];
170
+ var walls = wallsAttribute.map(function (wallAttribute) {
171
+ var wallConfig = wallAttribute.configuration;
172
+ var wall = [
173
+ [
174
+ wallConfig[attributeMap.startX],
175
+ wallConfig[attributeMap.startZ],
176
+ ],
177
+ [
178
+ wallConfig[attributeMap.endX],
179
+ wallConfig[attributeMap.endZ],
180
+ ],
181
+ ];
182
+ return wall;
183
+ });
184
+ return {
185
+ label: ((_a = response.data.metadata) === null || _a === void 0 ? void 0 : _a.label) || 'Layout',
186
+ configuration: response.data.variant,
187
+ loop: (0, geometry_1.findLoops)(walls).inner,
188
+ };
189
+ });
190
+ dispatch((0, exports.setLayouts)(prepped));
191
+ return [2];
192
+ }
193
+ });
194
+ }); };
195
+ };
196
+ exports.hydrateLayouts = hydrateLayouts;
197
+ exports.default = reducer;
@@ -3,13 +3,15 @@ import { IProject, IPlayerConfig, IThreekitDisplayAttribute, ISetConfiguration,
3
3
  export interface IPlayerInit {
4
4
  el: HTMLElement;
5
5
  authToken: string;
6
- assetId: string;
6
+ assetId?: string;
7
+ customId?: string;
7
8
  stageId?: string;
8
9
  playerConfig: IPlayerConfig;
9
10
  initialConfiguration?: IConfiguration;
10
11
  }
11
12
  export interface ILaunchConfig {
12
13
  assetId?: string;
14
+ customId?: string;
13
15
  productId: string;
14
16
  threekitEnv: string;
15
17
  serverUrl: string;
@@ -167,34 +167,32 @@ var getPlayerInteraction = function (state) {
167
167
  exports.getPlayerInteraction = getPlayerInteraction;
168
168
  var initPlayer = function (config) {
169
169
  return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
170
- var el, authToken, assetId, stageId, playerConfig, initialConfiguration, player, configurator, orgId, cacheParameters, ruleName;
171
- return __generator(this, function (_a) {
172
- switch (_a.label) {
170
+ var el, authToken, assetId, customId, stageId, playerConfig, initialConfiguration, player, configurator, _a, initializedAssetId, orgId, cacheParameters, ruleName;
171
+ return __generator(this, function (_b) {
172
+ switch (_b.label) {
173
173
  case 0:
174
- el = config.el, authToken = config.authToken, assetId = config.assetId, stageId = config.stageId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
174
+ el = config.el, authToken = config.authToken, assetId = config.assetId, customId = config.customId, stageId = config.stageId, playerConfig = config.playerConfig, initialConfiguration = config.initialConfiguration;
175
175
  dispatch((0, exports.updateLoadingProgress)(0));
176
- return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
176
+ return [4, window.threekitPlayer(__assign(__assign({ el: el, authToken: authToken, stageId: stageId, assetId: assetId, customId: customId }, playerConfig), { initialConfiguration: initialConfiguration, onLoadingProgress: function (progress) {
177
177
  var _a;
178
178
  dispatch((0, exports.updateLoadingProgress)(progress));
179
179
  (_a = playerConfig === null || playerConfig === void 0 ? void 0 : playerConfig.onLoadingProgress) === null || _a === void 0 ? void 0 : _a.call(playerConfig, progress);
180
180
  } }))];
181
181
  case 1:
182
- player = _a.sent();
182
+ player = _b.sent();
183
183
  return [4, player.getConfigurator()];
184
184
  case 2:
185
- configurator = _a.sent();
186
- orgId = player.enableApi(types_1.PRIVATE_APIS.PLAYER).orgId;
187
- connection_1.default.connect({ orgId: orgId });
185
+ configurator = _b.sent();
186
+ _a = player.enableApi(types_1.PRIVATE_APIS.PLAYER), initializedAssetId = _a.assetId, orgId = _a.orgId;
187
+ connection_1.default.connect({ assetId: initializedAssetId, orgId: orgId });
188
188
  cacheParameters = player.cacheParameters;
189
- if (cacheParameters) {
189
+ if (cacheParameters)
190
190
  connection_1.default.connect({ cacheParameters: cacheParameters });
191
- }
192
- if (window.threekit) {
191
+ if (window.threekit)
193
192
  window.threekit = Object.assign(window.threekit, {
194
193
  player: player,
195
194
  configurator: configurator,
196
195
  });
197
- }
198
196
  else
199
197
  window.threekit = {
200
198
  player: player,
@@ -231,16 +229,24 @@ var initPlayer = function (config) {
231
229
  if (window.threekit.treble._debugMode)
232
230
  (0, utils_1.runDebugger)();
233
231
  player.on('setConfiguration', function () { return __awaiter(void 0, void 0, void 0, function () {
234
- var attributes, previousAttributes, updatedAttributes;
232
+ var state, previousAttributes, attributes, configuration, updatedAttributes;
235
233
  var _a;
236
234
  return __generator(this, function (_b) {
237
235
  switch (_b.label) {
238
236
  case 0: return [4, window.threekit.treble._player.api.evaluate()];
239
237
  case 1:
240
238
  _b.sent();
241
- attributes = getState().attributes;
242
- previousAttributes = Object.values(attributes);
243
- updatedAttributes = configurator.getDisplayAttributes();
239
+ state = getState();
240
+ previousAttributes = Object.values(state.attributes);
241
+ attributes = window.threekit.configurator.getDisplayAttributes();
242
+ configuration = window.threekit.configurator.getFullConfiguration({
243
+ hydrate: true,
244
+ });
245
+ updatedAttributes = attributes.map(function (attr) {
246
+ return Object.assign({}, attr, configuration[attr.name]
247
+ ? { value: configuration[attr.name] }
248
+ : undefined);
249
+ });
244
250
  dispatch((0, attributes_1.setAttributes)(updatedAttributes));
245
251
  return [4, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
246
252
  case 2:
@@ -257,10 +263,10 @@ var initPlayer = function (config) {
257
263
  exports.initPlayer = initPlayer;
258
264
  var launch = function (launchConfig) {
259
265
  return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
260
- var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, stageId, configurationId, initialConfigurationRaw, assetId, threekitDomainRaw, authToken, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
261
- var _b, _c, _d, _e, _f, _g, _h;
262
- return __generator(this, function (_j) {
263
- switch (_j.label) {
266
+ var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, customIdRaw, stageId, configurationId, initialConfigurationRaw, customId, assetId, threekitDomainRaw, authToken, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
267
+ var _b, _c, _d, _e, _f, _g, _h, _j;
268
+ return __generator(this, function (_k) {
269
+ switch (_k.label) {
264
270
  case 0:
265
271
  if (window.threekit)
266
272
  return [2];
@@ -281,6 +287,7 @@ var launch = function (launchConfig) {
281
287
  var env = _a[0], conf = _a[1];
282
288
  var initialConfiguration;
283
289
  var assetId;
290
+ var customId;
284
291
  var stageId;
285
292
  var configurationId;
286
293
  if (typeof conf === 'string') {
@@ -294,6 +301,8 @@ var launch = function (launchConfig) {
294
301
  initialConfiguration = conf.initialConfiguration;
295
302
  if (conf.configurationId)
296
303
  configurationId = conf.configurationId;
304
+ else if (conf.customId)
305
+ customId = conf.customId;
297
306
  else if ((0, utils_1.isUuid)(conf.assetId))
298
307
  assetId = conf.assetId;
299
308
  else
@@ -302,6 +311,7 @@ var launch = function (launchConfig) {
302
311
  return Object.assign(result, (_b = {},
303
312
  _b[env] = {
304
313
  assetId: assetId,
314
+ customId: customId,
305
315
  stageId: stageId,
306
316
  configurationId: configurationId,
307
317
  initialConfiguration: initialConfiguration,
@@ -318,8 +328,11 @@ var launch = function (launchConfig) {
318
328
  serverUrl = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.serverUrl) || ((_g = config === null || config === void 0 ? void 0 : config.project) === null || _g === void 0 ? void 0 : _g.serverUrl);
319
329
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, config.player, launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.playerConfig);
320
330
  envCredentials = credentials[threekitEnv];
321
- _a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
322
- assetId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
331
+ _a = products[productId][threekitEnv] || {}, assetIdRaw = _a.assetId, customIdRaw = _a.customId, stageId = _a.stageId, configurationId = _a.configurationId, initialConfigurationRaw = _a.initialConfiguration;
332
+ customId = (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.customId) || customIdRaw;
333
+ assetId = ((_h = launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.customId) === null || _h === void 0 ? void 0 : _h.length)
334
+ ? undefined
335
+ : (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
323
336
  threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
324
337
  authToken = envCredentials.publicToken;
325
338
  if (playerConfig.elementId) {
@@ -333,6 +346,7 @@ var launch = function (launchConfig) {
333
346
  }
334
347
  connection_1.default.connect({
335
348
  authToken: authToken,
349
+ customId: customId,
336
350
  assetId: assetId,
337
351
  threekitDomain: threekitDomainRaw,
338
352
  serverUrl: serverUrl,
@@ -341,22 +355,22 @@ var launch = function (launchConfig) {
341
355
  initialConfiguration = __assign({}, initialConfigurationRaw);
342
356
  updatedAssetId = assetId;
343
357
  params = (0, utils_1.getParams)();
344
- configId = ((_h = params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]) === null || _h === void 0 ? void 0 : _h.length)
358
+ configId = ((_j = params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]) === null || _j === void 0 ? void 0 : _j.length)
345
359
  ? params[constants_1.TK_SAVED_CONFIG_PARAM_KEY]
346
360
  : configurationId;
347
361
  if (!configId) return [3, 2];
348
362
  return [4, api_1.default.configurations.fetch(configId)];
349
363
  case 1:
350
- configuration = _j.sent();
364
+ configuration = _k.sent();
351
365
  if (configuration) {
352
366
  initialConfiguration = Object.assign({}, initialConfigurationRaw, configuration.data.variant);
353
367
  connection_1.default.connect({ assetId: configuration.data.productId });
354
368
  updatedAssetId = configuration.data.productId;
355
369
  }
356
- _j.label = 2;
370
+ _k.label = 2;
357
371
  case 2:
358
- if (!updatedAssetId)
359
- return [2, console.error('missing assetId')];
372
+ if (!updatedAssetId && !customId)
373
+ throw new Error('missing assetId and customId');
360
374
  return [4, new Promise(function (resolve) {
361
375
  var script = document.createElement('script');
362
376
  script.src = "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
@@ -365,17 +379,18 @@ var launch = function (launchConfig) {
365
379
  document.head.appendChild(script);
366
380
  })];
367
381
  case 3:
368
- _j.sent();
382
+ _k.sent();
369
383
  return [4, dispatch((0, exports.initPlayer)({
370
384
  el: el,
371
385
  authToken: authToken,
372
386
  stageId: stageId,
373
387
  assetId: updatedAssetId,
388
+ customId: customId,
374
389
  playerConfig: playerConfig,
375
390
  initialConfiguration: initialConfiguration,
376
391
  }))];
377
392
  case 4:
378
- _j.sent();
393
+ _k.sent();
379
394
  document.addEventListener('treble:notification', function (e) {
380
395
  message_1.default.info(e.detail.message);
381
396
  });
@@ -2,8 +2,26 @@ import { RootState, ThreekitDispatch } from './index';
2
2
  import { WishlistArray } from '../Treble';
3
3
  import { ISaveConfiguration } from '../api/configurations';
4
4
  export declare type WishlistState = WishlistArray;
5
- export declare const refreshWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], void, {}>;
6
- export declare const addToWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], Omit<ISaveConfiguration, "configuration">, {}>;
5
+ export declare const refreshWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], void, {
6
+ state?: unknown;
7
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
8
+ extra?: unknown;
9
+ rejectValue?: unknown;
10
+ serializedErrorType?: unknown;
11
+ pendingMeta?: unknown;
12
+ fulfilledMeta?: unknown;
13
+ rejectedMeta?: unknown;
14
+ }>;
15
+ export declare const addToWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], Omit<ISaveConfiguration, "configuration">, {
16
+ state?: unknown;
17
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
18
+ extra?: unknown;
19
+ rejectValue?: unknown;
20
+ serializedErrorType?: unknown;
21
+ pendingMeta?: unknown;
22
+ fulfilledMeta?: unknown;
23
+ rejectedMeta?: unknown;
24
+ }>;
7
25
  export declare const clearWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/clear", never, never>;
8
26
  export declare const removeFromWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[idx: number], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/remove-item", never, never>;
9
27
  declare const reducer: import("redux").Reducer<WishlistArray, import("redux").AnyAction>;
package/dist/types.d.ts CHANGED
@@ -280,6 +280,13 @@ export interface IThreekitConfigurator {
280
280
  setConfiguration: (configuration: ISetConfiguration | IConfiguration) => Promise<IConfiguration>;
281
281
  getPrice: (pricebookId: string, currency: string) => number;
282
282
  getDisplayAttributes: (config?: IDisplayAttributeConfig) => Array<IThreekitDisplayAttribute>;
283
+ getNestedConfigurator: (path: string | Array<string | number>) => IThreekitConfigurator | undefined;
284
+ getFullConfiguration: (options?: {
285
+ resolve?: boolean;
286
+ hydrate?: boolean;
287
+ }) => IConfiguration;
288
+ setFullConfiguration: (configuration: IConfiguration) => Promise<void>;
289
+ on: (eventName: string, callback: () => void) => void;
283
290
  }
284
291
  export interface IThreekitScene {
285
292
  PHASES: {
@@ -318,6 +325,7 @@ export interface IThreekitPlayer {
318
325
  enableApi: <T extends PRIVATE_APIS>(api: T) => T extends PRIVATE_APIS.PLAYER ? IThreekitPrivatePlayer : any;
319
326
  snapshotAsync: (snapshotConfig: ISnapshotConfig) => Promise<string>;
320
327
  unload: () => Promise<string>;
328
+ uploadImage: (image: File) => Promise<string>;
321
329
  cacheParameters: ICacheParameters;
322
330
  }
323
331
  export interface IThreekitPrivateConfigurator extends IThreekitConfigurator {
@@ -348,7 +356,8 @@ export interface IThreekitPrivatePlayer {
348
356
  export interface ThreekitInitConfig {
349
357
  authToken: string;
350
358
  el: HTMLElement;
351
- assetId: string;
359
+ assetId?: string;
360
+ customId?: string;
352
361
  stageId?: string;
353
362
  orgId?: string;
354
363
  showConfigurator?: boolean;
@@ -388,10 +397,10 @@ export interface ICredential {
388
397
  }
389
398
  export interface ICredentials extends Record<string, ICredential> {
390
399
  }
391
- export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToken' | 'orgId' | 'assetId' | 'stageId' | 'locale'> {
400
+ export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToken' | 'orgId' | 'assetId' | 'customId' | 'stageId' | 'locale'> {
392
401
  elementId?: string;
393
402
  }
394
- export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'stageId' | 'initialConfiguration'> {
403
+ export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'customId' | 'stageId' | 'initialConfiguration'> {
395
404
  configurationId?: string;
396
405
  }
397
406
  export interface IProducts extends Record<string, string | Partial<IProduct>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -46,6 +46,7 @@
46
46
  "axios": "^0.22.0",
47
47
  "chokidar": "^3.5.3",
48
48
  "live-server": "^1.2.2",
49
+ "joi": "^17.10.0",
49
50
  "react-redux": "^7.2.6",
50
51
  "redux": "^4.1.2",
51
52
  "redux-logger": "^3.0.6",