@threekit-tools/treble 0.0.94 → 0.0.95-next-01

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 (284) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +3 -3
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/Treble/{snapshots.d.ts → snapshot.d.ts} +1 -1
  6. package/dist/Treble/{snapshots.js → snapshot.js} +1 -1
  7. package/dist/Treble/wishlist.d.ts +1 -1
  8. package/dist/Treble/wishlist.js +1 -1
  9. package/dist/api/assets.js +1 -1
  10. package/dist/api/catalog.js +1 -1
  11. package/dist/api/configurations.js +1 -1
  12. package/dist/api/datatables.js +1 -1
  13. package/dist/api/orders.js +1 -1
  14. package/dist/api/price.js +1 -1
  15. package/dist/components/AttributeTitle/index.d.ts +2 -2
  16. package/dist/components/AttributeValue/index.d.ts +2 -2
  17. package/dist/components/BreatheAnimation/index.js +1 -1
  18. package/dist/components/Button/index.d.ts +3 -3
  19. package/dist/components/Cards/index.d.ts +3 -3
  20. package/dist/components/DevTools/index.d.ts +2 -2
  21. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  22. package/dist/components/DraggableHint/index.d.ts +2 -2
  23. package/dist/components/Dropdown/index.d.ts +3 -3
  24. package/dist/components/FlatForm/index.d.ts +2 -2
  25. package/dist/components/FormComponentDescription/index.d.ts +1 -1
  26. package/dist/components/FormComponentTitle/index.d.ts +1 -1
  27. package/dist/components/Player/index.d.ts +9 -9
  28. package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
  29. package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
  30. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  31. package/dist/components/ProductDescription/index.d.ts +3 -3
  32. package/dist/components/ProductName/index.d.ts +3 -3
  33. package/dist/components/Share/index.d.ts +2 -2
  34. package/dist/components/Share/index.js +1 -1
  35. package/dist/components/Share/share.styles.d.ts +1 -1
  36. package/dist/components/Snapshots/index.d.ts +2 -2
  37. package/dist/components/Strips/index.d.ts +3 -3
  38. package/dist/components/Swatch/index.d.ts +3 -3
  39. package/dist/components/Switch/index.d.ts +3 -3
  40. package/dist/components/TextInput/index.d.ts +3 -3
  41. package/dist/components/ThreekitProvider/index.d.ts +1 -1
  42. package/dist/components/Tiles/index.d.ts +3 -3
  43. package/dist/components/TilesGroup/index.d.ts +3 -3
  44. package/dist/components/TotalPrice/index.d.ts +3 -3
  45. package/dist/components/TrebleApp/index.d.ts +3 -3
  46. package/dist/components/TurntableAnimation/index.js +1 -1
  47. package/dist/components/Upload/index.d.ts +3 -3
  48. package/dist/components/Upload/index.js +1 -1
  49. package/dist/components/UploadArea/index.d.ts +3 -3
  50. package/dist/components/UploadArea/index.js +1 -1
  51. package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
  52. package/dist/components/Wishlist/index.d.ts +4 -4
  53. package/dist/components/Wishlist/index.js +1 -1
  54. package/dist/components/Zoom/index.d.ts +6 -6
  55. package/dist/components/containers/formInputContainer.d.ts +2 -2
  56. package/dist/components/formComponents.d.ts +6 -6
  57. package/dist/components/message/index.d.ts +1 -1
  58. package/dist/constants.d.ts +6 -6
  59. package/dist/hooks/useAttribute/index.d.ts +4 -4
  60. package/dist/hooks/useAttribute/index.js +1 -1
  61. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  62. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  63. package/dist/hooks/useDevTools/index.d.ts +1 -1
  64. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  65. package/dist/hooks/useNestedConfigurator/index.js +3 -4
  66. package/dist/hooks/usePlayer/index.d.ts +1 -1
  67. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  68. package/dist/hooks/useProductCache/index.js +1 -1
  69. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  70. package/dist/hooks/useResetProduct/index.js +1 -1
  71. package/dist/hooks/useShare/index.d.ts +1 -1
  72. package/dist/hooks/useShare/index.js +1 -1
  73. package/dist/hooks/useSingleAnimation/index.js +1 -1
  74. package/dist/hooks/useSpaces/SpacesLayout.d.ts +11 -0
  75. package/dist/hooks/useSpaces/SpacesLayout.js +74 -0
  76. package/dist/hooks/useSpaces/SpacesState.d.ts +177 -0
  77. package/dist/hooks/useSpaces/SpacesState.js +1816 -0
  78. package/dist/hooks/useSpaces/constants.d.ts +79 -0
  79. package/dist/hooks/useSpaces/constants.js +130 -0
  80. package/dist/hooks/useSpaces/dataHandlers.d.ts +38 -0
  81. package/dist/hooks/useSpaces/dataHandlers.js +411 -0
  82. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +2 -0
  83. package/dist/hooks/useSpaces/draw/clearCanvas.js +9 -0
  84. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +2 -0
  85. package/dist/hooks/useSpaces/draw/drawBackground.js +12 -0
  86. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +3 -0
  87. package/dist/hooks/useSpaces/draw/drawDimensions.js +53 -0
  88. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +9 -0
  89. package/dist/hooks/useSpaces/draw/drawDoors.js +99 -0
  90. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +3 -0
  91. package/dist/hooks/useSpaces/draw/drawFloor.js +36 -0
  92. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +3 -0
  93. package/dist/hooks/useSpaces/draw/drawGrid.js +36 -0
  94. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +3 -0
  95. package/dist/hooks/useSpaces/draw/drawGuides.js +23 -0
  96. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +9 -0
  97. package/dist/hooks/useSpaces/draw/drawOpenings.js +72 -0
  98. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +8 -0
  99. package/dist/hooks/useSpaces/draw/drawVertices.js +61 -0
  100. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +11 -0
  101. package/dist/hooks/useSpaces/draw/drawWalls.js +90 -0
  102. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +9 -0
  103. package/dist/hooks/useSpaces/draw/drawWindows.js +82 -0
  104. package/dist/hooks/useSpaces/draw/index.d.ts +11 -0
  105. package/dist/hooks/useSpaces/draw/index.js +129 -0
  106. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +3 -0
  107. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +13 -0
  108. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +3 -0
  109. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +17 -0
  110. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +3 -0
  111. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +8 -0
  112. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +3 -0
  113. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +11 -0
  114. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +3 -0
  115. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +13 -0
  116. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +2 -0
  117. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +16 -0
  118. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +2 -0
  119. package/dist/hooks/useSpaces/geometry/euclideanMod.js +6 -0
  120. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +6 -0
  121. package/dist/hooks/{useRoomBuilder → useSpaces/geometry}/findLoops.js +31 -13
  122. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +6 -0
  123. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +23 -0
  124. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +3 -0
  125. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +7 -0
  126. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +3 -0
  127. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +17 -0
  128. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +3 -0
  129. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +10 -0
  130. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +3 -0
  131. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +7 -0
  132. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +3 -0
  133. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +17 -0
  134. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +3 -0
  135. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +11 -0
  136. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +3 -0
  137. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +43 -0
  138. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +3 -0
  139. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +9 -0
  140. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +3 -0
  141. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +20 -0
  142. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +3 -0
  143. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +11 -0
  144. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +3 -0
  145. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +15 -0
  146. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +3 -0
  147. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +16 -0
  148. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +6 -0
  149. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +17 -0
  150. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +3 -0
  151. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +9 -0
  152. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +3 -0
  153. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +12 -0
  154. package/dist/hooks/useSpaces/geometry/index.d.ts +30 -0
  155. package/dist/hooks/useSpaces/geometry/index.js +64 -0
  156. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +3 -0
  157. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +21 -0
  158. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +3 -0
  159. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +25 -0
  160. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +3 -0
  161. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +11 -0
  162. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +3 -0
  163. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +12 -0
  164. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +3 -0
  165. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +9 -0
  166. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +3 -0
  167. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +28 -0
  168. package/dist/hooks/useSpaces/index.d.ts +95 -0
  169. package/dist/hooks/useSpaces/index.js +625 -0
  170. package/dist/hooks/useSpaces/themes/blueprint.d.ts +3 -0
  171. package/dist/hooks/useSpaces/themes/blueprint.js +96 -0
  172. package/dist/hooks/useSpaces/themes/default.d.ts +3 -0
  173. package/dist/hooks/useSpaces/themes/default.js +96 -0
  174. package/dist/hooks/{useRoomBuilder/themes.d.ts → useSpaces/themes/index.d.ts} +3 -4
  175. package/dist/hooks/useSpaces/themes/index.js +21 -0
  176. package/dist/hooks/useSpaces/themes/light.d.ts +3 -0
  177. package/dist/hooks/useSpaces/themes/light.js +96 -0
  178. package/dist/hooks/useSpaces/types.d.ts +378 -0
  179. package/dist/hooks/useSpaces/types.js +54 -0
  180. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +3 -0
  181. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +61 -0
  182. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +3 -0
  183. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +42 -0
  184. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +3 -0
  185. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +52 -0
  186. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +3 -0
  187. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +37 -0
  188. package/dist/hooks/useSpaces/validators/index.d.ts +15 -0
  189. package/dist/hooks/useSpaces/validators/index.js +40 -0
  190. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +3 -0
  191. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +31 -0
  192. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +3 -0
  193. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +19 -0
  194. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +3 -0
  195. package/dist/hooks/useSpaces/validators/isLineTooShort.js +26 -0
  196. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +4 -0
  197. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +19 -0
  198. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +3 -0
  199. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +19 -0
  200. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +3 -0
  201. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +41 -0
  202. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +3 -0
  203. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +54 -0
  204. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +3 -0
  205. package/dist/hooks/useSpaces/validators/isWallTooShort.js +10 -0
  206. package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.js +1 -1
  207. package/dist/hooks/useWishlist/index.d.ts +1 -1
  208. package/dist/hooks/useZoom/index.d.ts +1 -1
  209. package/dist/http/assets.d.ts +1 -1
  210. package/dist/http/orders.d.ts +1 -1
  211. package/dist/icons/AngleSnapping.d.ts +3 -0
  212. package/dist/icons/AngleSnapping.js +28 -0
  213. package/dist/icons/Boundary.d.ts +3 -0
  214. package/dist/icons/Boundary.js +21 -0
  215. package/dist/icons/Center.d.ts +3 -0
  216. package/dist/icons/Center.js +24 -0
  217. package/dist/icons/Draw.js +3 -3
  218. package/dist/icons/GridSnapping.d.ts +3 -0
  219. package/dist/icons/GridSnapping.js +28 -0
  220. package/dist/icons/LayoutAlt.d.ts +3 -0
  221. package/dist/icons/LayoutAlt.js +21 -0
  222. package/dist/icons/Magnet.d.ts +3 -0
  223. package/dist/icons/Magnet.js +27 -0
  224. package/dist/icons/Player3D.d.ts +3 -0
  225. package/dist/icons/Player3D.js +21 -0
  226. package/dist/icons/RulerBlank.d.ts +3 -0
  227. package/dist/icons/RulerBlank.js +25 -0
  228. package/dist/icons/RulerDetailed.d.ts +3 -0
  229. package/dist/icons/RulerDetailed.js +27 -0
  230. package/dist/icons/Save.d.ts +3 -0
  231. package/dist/icons/Save.js +21 -0
  232. package/dist/icons/Spinner.d.ts +2 -2
  233. package/dist/icons/UnitCm.d.ts +3 -0
  234. package/dist/icons/UnitCm.js +22 -0
  235. package/dist/icons/UnitFeet.d.ts +3 -0
  236. package/dist/icons/UnitFeet.js +22 -0
  237. package/dist/icons/UnitInch.d.ts +3 -0
  238. package/dist/icons/UnitInch.js +22 -0
  239. package/dist/icons/UnitMeter.d.ts +3 -0
  240. package/dist/icons/UnitMeter.js +21 -0
  241. package/dist/icons/Window.js +4 -4
  242. package/dist/icons/index.js +28 -0
  243. package/dist/index.d.ts +17 -2
  244. package/dist/index.js +35 -5
  245. package/dist/store/attributes.d.ts +4 -3
  246. package/dist/store/attributes.js +1 -1
  247. package/dist/store/index.d.ts +43 -12
  248. package/dist/store/index.js +3 -1
  249. package/dist/store/price.d.ts +1 -1
  250. package/dist/store/price.js +1 -1
  251. package/dist/store/product.d.ts +2 -2
  252. package/dist/store/product.js +5 -8
  253. package/dist/store/spaces.d.ts +74 -0
  254. package/dist/store/spaces.js +354 -0
  255. package/dist/store/translations.d.ts +1 -1
  256. package/dist/store/translations.js +1 -1
  257. package/dist/store/treble.d.ts +2 -2
  258. package/dist/store/treble.js +15 -22
  259. package/dist/store/wishlist.d.ts +4 -22
  260. package/dist/store/wishlist.js +1 -1
  261. package/dist/types.d.ts +20 -18
  262. package/dist/types.js +9 -9
  263. package/dist/utils.d.ts +2 -2
  264. package/dist/utils.js +3 -3
  265. package/package.json +1 -1
  266. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +0 -95
  267. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +0 -1237
  268. package/dist/hooks/useRoomBuilder/constants.d.ts +0 -41
  269. package/dist/hooks/useRoomBuilder/constants.js +0 -48
  270. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +0 -18
  271. package/dist/hooks/useRoomBuilder/dataHandlers.js +0 -187
  272. package/dist/hooks/useRoomBuilder/draw.d.ts +0 -55
  273. package/dist/hooks/useRoomBuilder/draw.js +0 -573
  274. package/dist/hooks/useRoomBuilder/findLoops.d.ts +0 -5
  275. package/dist/hooks/useRoomBuilder/geometry.d.ts +0 -33
  276. package/dist/hooks/useRoomBuilder/geometry.js +0 -325
  277. package/dist/hooks/useRoomBuilder/index.d.ts +0 -40
  278. package/dist/hooks/useRoomBuilder/index.js +0 -303
  279. package/dist/hooks/useRoomBuilder/themes.js +0 -273
  280. package/dist/hooks/useRoomBuilder/types.d.ts +0 -238
  281. package/dist/hooks/useRoomBuilder/types.js +0 -36
  282. package/dist/hooks/useRoomBuilder/validators.d.ts +0 -36
  283. package/dist/hooks/useRoomBuilder/validators.js +0 -362
  284. /package/dist/hooks/{useRoomBuilder → useSpaces/validators}/messaging.d.ts +0 -0
@@ -0,0 +1,354 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (_) try {
52
+ 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;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
73
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
74
+ if (ar || !(i in from)) {
75
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
76
+ ar[i] = from[i];
77
+ }
78
+ }
79
+ return to.concat(ar || Array.prototype.slice.call(from));
80
+ };
81
+ var __importDefault = (this && this.__importDefault) || function (mod) {
82
+ return (mod && mod.__esModule) ? mod : { "default": mod };
83
+ };
84
+ var _a;
85
+ Object.defineProperty(exports, "__esModule", { value: true });
86
+ exports.initSpaces = exports.hydrateLayouts = exports.getWallMode = exports.getDefaults = exports.getGridSnappingEnabled = exports.getGuideSnappingEnabled = exports.getAngleSnappingEnabled = exports.getShowDimensions = exports.getTranslation = exports.getZoom = exports.getUnit = exports.getLayouts = exports.getMode = exports.getInitialized = exports.setWallModeValue = exports.setWallModeAssetIds = exports.setWallModeOptions = exports.setDefaults = exports.setGridSnappingEnabled = exports.setGuideSnappingEnabled = exports.setAngleSnappingEnabled = exports.setShowDimensions = exports.setMode = exports.setTranslation = exports.setUnit = exports.setZoom = exports.setLayouts = exports.setInitialized = void 0;
87
+ var toolkit_1 = require("@reduxjs/toolkit");
88
+ var api_1 = __importDefault(require("../api"));
89
+ var types_1 = require("../hooks/useSpaces/types");
90
+ var geometry_1 = require("../hooks/useSpaces/geometry");
91
+ var constants_1 = require("../hooks/useSpaces/constants");
92
+ var SpacesState_1 = __importDefault(require("../hooks/useSpaces/SpacesState"));
93
+ var attributes_1 = require("./attributes");
94
+ var themes_1 = __importStar(require("../hooks/useSpaces/themes"));
95
+ var dataHandlers_1 = require("../hooks/useSpaces/dataHandlers");
96
+ exports.setInitialized = (0, toolkit_1.createAction)('treble/spaces/set-initialized');
97
+ exports.setLayouts = (0, toolkit_1.createAction)('treble/spaces/set-layouts');
98
+ exports.setZoom = (0, toolkit_1.createAction)('treble/spaces/set-zoom');
99
+ exports.setUnit = (0, toolkit_1.createAction)('treble/spaces/set-unit');
100
+ exports.setTranslation = (0, toolkit_1.createAction)('treble/spaces/set-translation');
101
+ exports.setMode = (0, toolkit_1.createAction)('treble/spaces/set-mode');
102
+ exports.setShowDimensions = (0, toolkit_1.createAction)('treble/spaces/set-show-dimensions');
103
+ exports.setAngleSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-angle-snapping-enabled');
104
+ exports.setGuideSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-guide-snapping-enabled');
105
+ exports.setGridSnappingEnabled = (0, toolkit_1.createAction)('treble/spaces/set-grid-snapping-enabled');
106
+ exports.setDefaults = (0, toolkit_1.createAction)('treble/spaces/set-defaults');
107
+ exports.setWallModeOptions = (0, toolkit_1.createAction)('treble/spaces/set-wall-mode-options');
108
+ exports.setWallModeAssetIds = (0, toolkit_1.createAction)('treble/spaces/set-wall-mode-assetIds');
109
+ exports.setWallModeValue = (0, toolkit_1.createAction)('treble/spaces/set-wall-mode-value');
110
+ var initialState = {
111
+ initialized: false,
112
+ mode: types_1.IModes.SELECT,
113
+ layouts: [],
114
+ unit: types_1.IUnits.FEET,
115
+ zoom: constants_1.ZOOM_DEFAULT,
116
+ translation: constants_1.TRANSLATE_DEFAULT,
117
+ showDimensions: types_1.IDimensionOptions.DEFAULT,
118
+ angleSnappingEnabled: constants_1.ANGLE_SNAPPING_ENABLED,
119
+ guideSnappingEnabled: constants_1.GUIDE_SNAPPING_ENABLED,
120
+ gridSnappingEnabled: constants_1.GRID_SNAPPING_ENABLED,
121
+ defaults: {
122
+ walls: '',
123
+ windows: '',
124
+ openings: '',
125
+ doors: '',
126
+ doorOpeningDirection: constants_1.DoorOpeningDirections.INSIDE,
127
+ doorOrientation: constants_1.DoorOrientations.LEFT,
128
+ doorShowSwing: constants_1.DoorShowSwing.HIDE,
129
+ },
130
+ wallModeOptions: [],
131
+ wallModeAssetIds: (_a = {},
132
+ _a[constants_1.WallModes.WALL] = '',
133
+ _a[constants_1.WallModes.BOUNDARY] = '',
134
+ _a),
135
+ wallModeValue: constants_1.WallModes.WALL,
136
+ };
137
+ var reducer = (0, toolkit_1.createSlice)({
138
+ name: 'spaces',
139
+ initialState: initialState,
140
+ extraReducers: function (builder) {
141
+ builder.addCase(exports.setInitialized, function (state, action) {
142
+ return __assign(__assign({}, state), { initialized: action.payload });
143
+ });
144
+ builder.addCase(exports.setMode, function (state, action) {
145
+ return __assign(__assign({}, state), { mode: action.payload });
146
+ });
147
+ builder.addCase(exports.setLayouts, function (state, action) {
148
+ return __assign(__assign({}, state), { layouts: action.payload });
149
+ });
150
+ builder.addCase(exports.setUnit, function (state, action) {
151
+ return __assign(__assign({}, state), { unit: action.payload });
152
+ });
153
+ builder.addCase(exports.setZoom, function (state, action) {
154
+ return __assign(__assign({}, state), { zoom: action.payload });
155
+ });
156
+ builder.addCase(exports.setTranslation, function (state, action) {
157
+ return __assign(__assign({}, state), { translation: action.payload });
158
+ });
159
+ builder.addCase(exports.setShowDimensions, function (state, action) {
160
+ return __assign(__assign({}, state), { showDimensions: action.payload });
161
+ });
162
+ builder.addCase(exports.setAngleSnappingEnabled, function (state, action) {
163
+ return __assign(__assign({}, state), { angleSnappingEnabled: action.payload });
164
+ });
165
+ builder.addCase(exports.setGuideSnappingEnabled, function (state, action) {
166
+ return __assign(__assign({}, state), { guideSnappingEnabled: action.payload });
167
+ });
168
+ builder.addCase(exports.setGridSnappingEnabled, function (state, action) {
169
+ return __assign(__assign({}, state), { gridSnappingEnabled: action.payload });
170
+ });
171
+ builder.addCase(exports.setDefaults, function (state, action) {
172
+ return __assign(__assign({}, state), { defaults: action.payload });
173
+ });
174
+ builder.addCase(exports.setWallModeOptions, function (state, action) {
175
+ return __assign(__assign({}, state), { wallModeOptions: action.payload });
176
+ });
177
+ builder.addCase(exports.setWallModeValue, function (state, action) {
178
+ return __assign(__assign({}, state), { wallModeValue: action.payload });
179
+ });
180
+ builder.addCase(exports.setWallModeAssetIds, function (state, action) {
181
+ return __assign(__assign({}, state), { wallModeAssetIds: action.payload });
182
+ });
183
+ },
184
+ reducers: {},
185
+ }).reducer;
186
+ var getInitialized = function (state) { return state.spaces.initialized; };
187
+ exports.getInitialized = getInitialized;
188
+ var getMode = function (state) { return state.spaces.mode; };
189
+ exports.getMode = getMode;
190
+ var getLayouts = function (state) {
191
+ return state.spaces.layouts;
192
+ };
193
+ exports.getLayouts = getLayouts;
194
+ var getUnit = function (state) { return state.spaces.unit; };
195
+ exports.getUnit = getUnit;
196
+ var getZoom = function (state) { return state.spaces.zoom; };
197
+ exports.getZoom = getZoom;
198
+ var getTranslation = function (state) { return state.spaces.translation; };
199
+ exports.getTranslation = getTranslation;
200
+ var getShowDimensions = function (state) {
201
+ return state.spaces.showDimensions;
202
+ };
203
+ exports.getShowDimensions = getShowDimensions;
204
+ var getAngleSnappingEnabled = function (state) {
205
+ return state.spaces.angleSnappingEnabled;
206
+ };
207
+ exports.getAngleSnappingEnabled = getAngleSnappingEnabled;
208
+ var getGuideSnappingEnabled = function (state) {
209
+ return state.spaces.guideSnappingEnabled;
210
+ };
211
+ exports.getGuideSnappingEnabled = getGuideSnappingEnabled;
212
+ var getGridSnappingEnabled = function (state) {
213
+ return state.spaces.gridSnappingEnabled;
214
+ };
215
+ exports.getGridSnappingEnabled = getGridSnappingEnabled;
216
+ var getDefaults = function (state) { return state.spaces.defaults; };
217
+ exports.getDefaults = getDefaults;
218
+ var getWallMode = function (state) { return ({
219
+ options: state.spaces.wallModeOptions,
220
+ value: state.spaces.wallModeValue,
221
+ assetId: state.spaces.wallModeAssetIds[state.spaces.wallModeValue],
222
+ }); };
223
+ exports.getWallMode = getWallMode;
224
+ var hydrateLayouts = function (configurationIds, attributeMap) {
225
+ return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
226
+ var state, layoutIds, configurationResponses, prepped;
227
+ var _a;
228
+ return __generator(this, function (_b) {
229
+ switch (_b.label) {
230
+ case 0:
231
+ state = getState();
232
+ if (state.spaces.layouts.length)
233
+ return [2];
234
+ layoutIds = __spreadArray([], configurationIds, true);
235
+ if ((_a = state.product.metadata) === null || _a === void 0 ? void 0 : _a._layouts)
236
+ state.product.metadata._layouts
237
+ .split(',')
238
+ .forEach(function (id) { return layoutIds.push(id.trim()); });
239
+ return [4, Promise.all(layoutIds.map(function (configId) { return api_1.default.configurations.fetch(configId); }))];
240
+ case 1:
241
+ configurationResponses = _b.sent();
242
+ prepped = configurationResponses.map(function (response) {
243
+ var _a;
244
+ var wallsAttribute = response.data.variant[attributeMap.walls];
245
+ var walls = wallsAttribute.map(function (wallAttribute) {
246
+ var wallConfig = wallAttribute.configuration;
247
+ var wall = [
248
+ [
249
+ wallConfig[attributeMap.startX],
250
+ wallConfig[attributeMap.startZ],
251
+ ],
252
+ [
253
+ wallConfig[attributeMap.endX],
254
+ wallConfig[attributeMap.endZ],
255
+ ],
256
+ ];
257
+ return wall;
258
+ });
259
+ return {
260
+ label: ((_a = response.data.metadata) === null || _a === void 0 ? void 0 : _a.label) || 'Layout',
261
+ configuration: response.data.variant,
262
+ loop: (0, geometry_1.findLoops)(walls).inner,
263
+ };
264
+ });
265
+ dispatch((0, exports.setLayouts)(prepped));
266
+ return [2];
267
+ }
268
+ });
269
+ }); };
270
+ };
271
+ exports.hydrateLayouts = hydrateLayouts;
272
+ var initSpaces = function (initConfig) {
273
+ return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
274
+ var parameters, layoutIds, attributeNames, canvasDimensions, setPendingStatus, hasInitialized, configurator, attributeDefaults, defaults, wallModes, state, spaces, config, attributesState;
275
+ return __generator(this, function (_a) {
276
+ switch (_a.label) {
277
+ case 0:
278
+ parameters = initConfig.parameters, layoutIds = initConfig.layoutIds, attributeNames = initConfig.attributeNames, canvasDimensions = initConfig.canvasDimensions, setPendingStatus = initConfig.setPendingStatus;
279
+ hasInitialized = (0, exports.getInitialized)(getState());
280
+ if (!!hasInitialized) return [3, 3];
281
+ if (parameters.unit)
282
+ dispatch((0, exports.setUnit)(parameters.unit));
283
+ if (parameters.showDimensions)
284
+ dispatch((0, exports.setShowDimensions)(parameters.showDimensions));
285
+ if (parameters.zoomDefault)
286
+ dispatch((0, exports.setZoom)(parameters.zoomDefault));
287
+ if (parameters.translateDefault)
288
+ dispatch((0, exports.setTranslation)(parameters.translateDefault));
289
+ if (parameters.enableAngleSnapping)
290
+ dispatch((0, exports.setAngleSnappingEnabled)(parameters.enableAngleSnapping));
291
+ if (parameters.enableGridSnapping)
292
+ dispatch((0, exports.setAngleSnappingEnabled)(parameters.enableGridSnapping));
293
+ if (parameters.enableGuideSnapping)
294
+ dispatch((0, exports.setAngleSnappingEnabled)(parameters.enableGuideSnapping));
295
+ dispatch((0, exports.hydrateLayouts)(layoutIds !== null && layoutIds !== void 0 ? layoutIds : [], {
296
+ walls: attributeNames[types_1.IElements.WALL],
297
+ startX: attributeNames.wallStartX,
298
+ startZ: attributeNames.wallStartZ,
299
+ endX: attributeNames.wallEndX,
300
+ endZ: attributeNames.wallEndZ,
301
+ }));
302
+ return [4, window.threekit.configurator.clone()];
303
+ case 1:
304
+ configurator = _a.sent();
305
+ return [4, (0, dataHandlers_1.getAttributeData)(configurator, attributeNames)];
306
+ case 2:
307
+ attributeDefaults = _a.sent();
308
+ if (attributeDefaults) {
309
+ defaults = attributeDefaults.defaults, wallModes = attributeDefaults.wallModes;
310
+ dispatch((0, exports.setDefaults)(defaults));
311
+ dispatch((0, exports.setWallModeOptions)(wallModes.options));
312
+ dispatch((0, exports.setWallModeValue)(wallModes.value));
313
+ dispatch((0, exports.setWallModeAssetIds)(wallModes.assetIds));
314
+ }
315
+ dispatch((0, exports.setInitialized)(true));
316
+ _a.label = 3;
317
+ case 3:
318
+ state = getState();
319
+ spaces = state.spaces;
320
+ config = {
321
+ unit: spaces.unit,
322
+ scale: constants_1.SCALE,
323
+ snapProximity: constants_1.SNAP_PROXIMITY,
324
+ zoomMin: constants_1.ZOOM_MIN,
325
+ zoomMax: constants_1.ZOOM_MAX,
326
+ zoomDefault: spaces.zoom,
327
+ translateDefault: spaces.translation,
328
+ enableAngleSnapping: spaces.angleSnappingEnabled,
329
+ enableGuideSnapping: spaces.guideSnappingEnabled,
330
+ enableGridSnapping: spaces.gridSnappingEnabled,
331
+ showDimensions: spaces.showDimensions,
332
+ styles: parameters.theme && themes_1.default[parameters.theme]
333
+ ? themes_1.default[parameters.theme]
334
+ : themes_1.default[themes_1.IThemes.DEFAULT],
335
+ };
336
+ attributesState = (0, attributes_1.getHydrationData)(state)[0];
337
+ return [2, new SpacesState_1.default({
338
+ config: config,
339
+ attributes: attributeNames,
340
+ attributeDefaults: spaces.defaults,
341
+ attributesState: JSON.parse(JSON.stringify(attributesState)),
342
+ canvasDimensions: canvasDimensions,
343
+ wallMode: {
344
+ value: spaces.wallModeValue,
345
+ assetId: spaces.wallModeAssetIds[spaces.wallModeValue],
346
+ },
347
+ setPendingStatus: setPendingStatus,
348
+ })];
349
+ }
350
+ });
351
+ }); };
352
+ };
353
+ exports.initSpaces = initSpaces;
354
+ exports.default = reducer;
@@ -7,7 +7,7 @@ export interface TranslationsState {
7
7
  export declare const setLocale: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
8
8
  export declare const setTranslationsMap: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITranslationsMap, string>;
9
9
  export declare const initTranslations: (locale?: string) => (dispatch: ThreekitDispatch) => Promise<void>;
10
- declare const reducer: import("redux").Reducer<TranslationsState>;
10
+ declare const reducer: import("redux").Reducer<TranslationsState, import("redux").AnyAction>;
11
11
  export declare const getLocale: (state: RootState) => undefined | string;
12
12
  export declare const getTranslations: (state: RootState) => ITranslationsMap;
13
13
  export declare const setTranslationForLocale: (locale: string | null) => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) try {
18
18
  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;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -56,7 +56,7 @@ export declare const setPlayerElement: import("@reduxjs/toolkit").ActionCreatorW
56
56
  export declare const reloadTreble: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<TrebleState>, string>;
57
57
  export declare const updateLoadingProgress: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
58
58
  export declare const setPlayerInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
59
- declare const reducer: import("redux").Reducer<TrebleState>;
59
+ declare const reducer: import("redux").Reducer<TrebleState, import("redux").AnyAction>;
60
60
  export declare const getThreekitEnv: (state: RootState) => string;
61
61
  export declare const isThreekitInitialized: (state: RootState) => boolean;
62
62
  export declare const isFirstRenderComplete: (state: RootState) => boolean;
@@ -66,6 +66,6 @@ export declare const getLoadingProgress: (state: RootState) => undefined | numbe
66
66
  export declare const getPlayerInteraction: (state: RootState) => undefined | boolean;
67
67
  export declare const initPlayer: (config: IPlayerInit) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
68
68
  export declare const launch: (launchConfig?: Partial<ILaunchConfig>) => (dispatch: ThreekitDispatch) => Promise<void>;
69
- export declare const unloadPlayer: () => (dispatch: ThreekitDispatch) => Promise<void>;
69
+ export declare const unloadPlayer: (dispatch: ThreekitDispatch) => Promise<string>;
70
70
  export declare const reloadPlayer: (config: undefined | string | Pick<IReloadConfig, 'assetId' | 'stageId' | 'configurationId' | 'configuration'>) => (dispatch: ThreekitDispatch, getState: () => RootState) => Promise<void>;
71
71
  export default reducer;
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ while (_) try {
29
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
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -203,7 +203,6 @@ var initPlayer = function (config) {
203
203
  orgId: orgId,
204
204
  }),
205
205
  };
206
- dispatch((0, exports.setThreekitInitialized)(true));
207
206
  dispatch((0, exports.setPlayerLoading)(false));
208
207
  dispatch((0, exports.updateLoadingProgress)(1));
209
208
  dispatch((0, exports.setPlayerInteraction)(true));
@@ -263,7 +262,7 @@ var initPlayer = function (config) {
263
262
  exports.initPlayer = initPlayer;
264
263
  var launch = function (launchConfig) {
265
264
  return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
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;
265
+ var config, productId, credentials, productsRaw, products, threekitEnv, serverUrl, playerConfig, envCredentials, _a, assetIdRaw, customIdRaw, stageId, configurationId, initialConfigurationRaw, customId, assetId, threekitDomainRaw, authToken, playerScriptUrl, el, threekitDomain, initialConfiguration, updatedAssetId, params, configId, configuration;
267
266
  var _b, _c, _d, _e, _f, _g, _h, _j;
268
267
  return __generator(this, function (_k) {
269
268
  switch (_k.label) {
@@ -334,7 +333,7 @@ var launch = function (launchConfig) {
334
333
  ? undefined
335
334
  : (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
336
335
  threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
337
- authToken = envCredentials.publicToken;
336
+ authToken = envCredentials.publicToken, playerScriptUrl = envCredentials.playerScriptUrl;
338
337
  if (playerConfig.elementId) {
339
338
  el = document.getElementById(playerConfig.elementId);
340
339
  if (el)
@@ -373,7 +372,8 @@ var launch = function (launchConfig) {
373
372
  throw new Error('missing assetId and customId');
374
373
  return [4, new Promise(function (resolve) {
375
374
  var script = document.createElement('script');
376
- script.src = "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
375
+ script.src =
376
+ playerScriptUrl || "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
377
377
  script.id = 'threekit-player-bundle';
378
378
  script.onload = function () { return resolve(); };
379
379
  document.head.appendChild(script);
@@ -403,28 +403,21 @@ var launch = function (launchConfig) {
403
403
  dispatch((0, price_1.initPrice)());
404
404
  dispatch((0, price_1.updatePrice)());
405
405
  dispatch((0, wishlist_1.refreshWishlist)());
406
+ dispatch((0, exports.setThreekitInitialized)(true));
406
407
  return [2];
407
408
  }
408
409
  });
409
410
  }); };
410
411
  };
411
412
  exports.launch = launch;
412
- var unloadPlayer = function () { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
413
- return __generator(this, function (_a) {
414
- switch (_a.label) {
415
- case 0:
416
- dispatch((0, exports.setThreekitInitialized)(false));
417
- dispatch((0, exports.setPlayerLoading)(true));
418
- dispatch((0, attributes_1.setAttributes)([]));
419
- dispatch((0, product_1.setName)(''));
420
- dispatch((0, product_1.setMetadata)({}));
421
- return [4, window.threekit.player.unload()];
422
- case 1:
423
- _a.sent();
424
- return [2];
425
- }
426
- });
427
- }); }; };
413
+ var unloadPlayer = function (dispatch) {
414
+ dispatch((0, exports.setThreekitInitialized)(false));
415
+ dispatch((0, exports.setPlayerLoading)(true));
416
+ dispatch((0, attributes_1.setAttributes)([]));
417
+ dispatch((0, product_1.setName)(''));
418
+ dispatch((0, product_1.setMetadata)({}));
419
+ return window.threekit.player.unload();
420
+ };
428
421
  exports.unloadPlayer = unloadPlayer;
429
422
  var reloadPlayer = function (config) {
430
423
  return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
@@ -461,7 +454,7 @@ var reloadPlayer = function (config) {
461
454
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, trebleConfig.player);
462
455
  el = document.getElementById(state.treble.playerElId);
463
456
  if (!state.treble.isThreekitInitialized) return [3, 6];
464
- return [4, dispatch((0, exports.unloadPlayer)())];
457
+ return [4, dispatch(exports.unloadPlayer)];
465
458
  case 5:
466
459
  _a.sent();
467
460
  _a.label = 6;
@@ -1,30 +1,12 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { WishlistArray } from '../Treble';
3
3
  import { ISaveConfiguration } from '../api/configurations';
4
- export type WishlistState = WishlistArray;
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
- }>;
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">, {}>;
25
7
  export declare const clearWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/clear", never, never>;
26
8
  export declare const removeFromWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[idx: number], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/remove-item", never, never>;
27
- declare const reducer: import("redux").Reducer<WishlistArray>;
9
+ declare const reducer: import("redux").Reducer<WishlistArray, import("redux").AnyAction>;
28
10
  export declare const getWishlist: (state: RootState) => WishlistArray;
29
11
  export declare const resumeFromWishlist: (idx: number) => (_: ThreekitDispatch, getState: () => RootState) => void;
30
12
  export default reducer;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ while (_) try {
18
18
  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;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
package/dist/types.d.ts CHANGED
@@ -46,7 +46,7 @@ export declare enum SNAPSHOT_OUTPUTS {
46
46
  BLOB = "blob",
47
47
  FILE = "file"
48
48
  }
49
- export type IMetadata = Record<string, string | number | null>;
49
+ export declare type IMetadata = Record<string, string | number | null>;
50
50
  export interface ISceneQueryShared {
51
51
  all?: boolean;
52
52
  id?: string;
@@ -79,7 +79,7 @@ export interface ISceneQueryTransform extends ISceneQueryShared {
79
79
  plug: PLUG_TYPES.TRANSFORM;
80
80
  property: TRANSFORM_PROPERTY_TYPES;
81
81
  }
82
- export type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
82
+ export declare type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
83
83
  export interface ISceneResult {
84
84
  id: string;
85
85
  name: string;
@@ -97,9 +97,9 @@ export interface IConfigurationColor {
97
97
  g: number;
98
98
  b: number;
99
99
  }
100
- export type IConfigurationAttribute = IConfigurationAsset | IConfigurationArray | IConfigurationColor | string | number | boolean | undefined;
101
- export type IConfiguration = Record<string, IConfigurationAttribute>;
102
- export type ISetConfiguration = Record<string, IConfigurationAttribute>;
100
+ export declare type IConfigurationAttribute = IConfigurationAsset | IConfigurationArray | IConfigurationColor | string | number | boolean | undefined;
101
+ export declare type IConfiguration = Record<string, IConfigurationAttribute>;
102
+ export declare type ISetConfiguration = Record<string, IConfigurationAttribute>;
103
103
  interface IDisplayAttributeConfig {
104
104
  includeHidden?: boolean;
105
105
  }
@@ -135,9 +135,9 @@ export interface IAttributeAssetBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.A
135
135
  disabledValues?: Array<string>;
136
136
  values: Array<V>;
137
137
  }
138
- export type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
- export type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
- export type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
138
+ export declare type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
+ export declare type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
+ export declare type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
141
141
  export interface IConfigurationArrayValue {
142
142
  assetId: string;
143
143
  name: string;
@@ -167,9 +167,9 @@ export interface IAttributeArrayBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.A
167
167
  assetType: ASSET_TYPES;
168
168
  };
169
169
  }
170
- export type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
- export type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
- export type IAttributeArray = IAttributeArrayBase<Pick<IConfigurationArrayValue, 'assetId'>>;
170
+ export declare type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
+ export declare type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
+ export declare type IAttributeArray = IAttributeArrayBase<Pick<IConfigurationArrayValue, 'assetId'>>;
173
173
  export interface IDisplayAttributeStringValue {
174
174
  label: string;
175
175
  value: string;
@@ -185,9 +185,9 @@ export interface IAttributeStringBase<V> extends IAttributeBase<ATTRIBUTE_TYPES.
185
185
  disabledValues?: Array<string>;
186
186
  values: Array<V>;
187
187
  }
188
- export type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
- export type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
- export type IAttributeString = IAttributeStringBase<string>;
188
+ export declare type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
+ export declare type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
+ export declare type IAttributeString = IAttributeStringBase<string>;
191
191
  export interface IAttributeColor extends IAttributeBase<ATTRIBUTE_TYPES.COLOR, IConfigurationColor> {
192
192
  defaultValue: IConfigurationColor;
193
193
  }
@@ -201,9 +201,9 @@ export interface IAttributeNumber extends IAttributeBase<ATTRIBUTE_TYPES.NUMBER,
201
201
  export interface IAttributeBoolean extends IAttributeBase<ATTRIBUTE_TYPES.BOOLEAN, boolean> {
202
202
  defaultValue: boolean;
203
203
  }
204
- export type IThreekitAttribute = IAttributeAsset | IAttributeArray | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
205
- export type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeArray | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
206
- export type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeArray | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
204
+ export declare type IThreekitAttribute = IAttributeAsset | IAttributeArray | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
205
+ export declare type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeArray | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
206
+ export declare type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeArray | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
207
207
  export interface ICoordinates {
208
208
  x: number;
209
209
  y: number;
@@ -281,13 +281,14 @@ export interface IThreekitConfigurator {
281
281
  setConfiguration: (configuration: ISetConfiguration | IConfiguration) => Promise<IConfiguration>;
282
282
  getPrice: (pricebookId: string, currency: string) => number;
283
283
  getDisplayAttributes: (config?: IDisplayAttributeConfig) => Array<IThreekitDisplayAttribute>;
284
- getNestedConfigurator: (path: string | Array<string | number>) => IThreekitConfigurator | undefined;
284
+ getNestedConfigurator: (...path: Array<string | number | Array<string | number>>) => IThreekitConfigurator | undefined;
285
285
  getFullConfiguration: (options?: {
286
286
  resolve?: boolean;
287
287
  hydrate?: boolean;
288
288
  }) => IConfiguration;
289
289
  setFullConfiguration: (configuration: IConfiguration) => Promise<void>;
290
290
  on: (eventName: string, callback: () => void) => void;
291
+ clone: () => Promise<IThreekitConfigurator>;
291
292
  }
292
293
  export interface IThreekitScene {
293
294
  PHASES: {
@@ -396,6 +397,7 @@ export interface ICredential {
396
397
  publicToken: string;
397
398
  publishStage?: string;
398
399
  threekitDomain?: string;
400
+ playerScriptUrl?: string;
399
401
  }
400
402
  export interface ICredentials extends Record<string, ICredential> {
401
403
  }