@threekit-tools/treble 0.0.92-next-01 → 0.0.93

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 (297) hide show
  1. package/dist/Treble/Treble.d.ts +2 -2
  2. package/dist/Treble/Treble.js +6 -5
  3. package/dist/Treble/index.d.ts +1 -1
  4. package/dist/Treble/index.js +1 -1
  5. package/dist/Treble/{snapshot.d.ts → snapshots.d.ts} +1 -1
  6. package/dist/Treble/{snapshot.js → snapshots.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.d.ts +1 -0
  10. package/dist/api/{products.js → assets.js} +12 -33
  11. package/dist/api/catalog.js +1 -1
  12. package/dist/api/configurations.d.ts +1 -0
  13. package/dist/api/configurations.js +10 -3
  14. package/dist/api/datatables.js +1 -1
  15. package/dist/api/index.d.ts +2 -2
  16. package/dist/api/index.js +2 -2
  17. package/dist/api/orders.js +1 -1
  18. package/dist/api/price.js +1 -1
  19. package/dist/components/AttributeTitle/index.d.ts +2 -2
  20. package/dist/components/AttributeValue/index.d.ts +2 -2
  21. package/dist/components/BreatheAnimation/index.js +1 -1
  22. package/dist/components/Button/index.d.ts +3 -3
  23. package/dist/components/Cards/index.d.ts +3 -3
  24. package/dist/components/DevTools/index.d.ts +2 -2
  25. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  26. package/dist/components/DraggableHint/index.d.ts +2 -2
  27. package/dist/components/Dropdown/index.d.ts +3 -3
  28. package/dist/components/FlatForm/index.d.ts +2 -2
  29. package/dist/components/FormComponentDescription/index.d.ts +1 -1
  30. package/dist/components/FormComponentTitle/index.d.ts +1 -1
  31. package/dist/components/Player/index.d.ts +9 -9
  32. package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
  33. package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
  34. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  35. package/dist/components/ProductDescription/index.d.ts +3 -3
  36. package/dist/components/ProductName/index.d.ts +3 -3
  37. package/dist/components/Share/index.d.ts +2 -2
  38. package/dist/components/Share/index.js +1 -1
  39. package/dist/components/Share/share.styles.d.ts +1 -1
  40. package/dist/components/Snapshots/index.d.ts +2 -2
  41. package/dist/components/Strips/index.d.ts +3 -3
  42. package/dist/components/Swatch/index.d.ts +3 -3
  43. package/dist/components/Switch/index.d.ts +3 -3
  44. package/dist/components/TextInput/index.d.ts +3 -3
  45. package/dist/components/ThreekitProvider/index.d.ts +6 -3
  46. package/dist/components/ThreekitProvider/index.js +27 -2
  47. package/dist/components/Tiles/index.d.ts +3 -3
  48. package/dist/components/TilesGroup/index.d.ts +3 -3
  49. package/dist/components/TotalPrice/index.d.ts +3 -3
  50. package/dist/components/TrebleApp/index.d.ts +3 -3
  51. package/dist/components/TurntableAnimation/index.js +1 -1
  52. package/dist/components/Upload/index.d.ts +3 -3
  53. package/dist/components/Upload/index.js +1 -1
  54. package/dist/components/UploadArea/index.d.ts +3 -3
  55. package/dist/components/UploadArea/index.js +1 -1
  56. package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
  57. package/dist/components/Wishlist/index.d.ts +4 -4
  58. package/dist/components/Wishlist/index.js +1 -1
  59. package/dist/components/Zoom/index.d.ts +6 -6
  60. package/dist/components/containers/formInputContainer.d.ts +2 -2
  61. package/dist/components/formComponents.d.ts +6 -6
  62. package/dist/components/message/index.d.ts +1 -1
  63. package/dist/constants.d.ts +6 -6
  64. package/dist/hooks/useAttribute/index.d.ts +4 -4
  65. package/dist/hooks/useAttribute/index.js +3 -3
  66. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  67. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  68. package/dist/hooks/useConfigurator/index.js +3 -5
  69. package/dist/hooks/useDevTools/index.d.ts +1 -1
  70. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  71. package/dist/hooks/useNestedConfigurator/index.js +5 -4
  72. package/dist/hooks/usePlayer/index.d.ts +1 -1
  73. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  74. package/dist/hooks/useProductCache/index.js +1 -1
  75. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  76. package/dist/hooks/useResetProduct/index.js +1 -1
  77. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +95 -0
  78. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1237 -0
  79. package/dist/hooks/useRoomBuilder/constants.d.ts +41 -0
  80. package/dist/hooks/useRoomBuilder/constants.js +48 -0
  81. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +18 -0
  82. package/dist/hooks/useRoomBuilder/dataHandlers.js +187 -0
  83. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  84. package/dist/hooks/useRoomBuilder/draw.js +573 -0
  85. package/dist/hooks/useRoomBuilder/findLoops.d.ts +5 -0
  86. package/dist/hooks/{useSpaces/geometry → useRoomBuilder}/findLoops.js +13 -31
  87. package/dist/hooks/useRoomBuilder/geometry.d.ts +33 -0
  88. package/dist/hooks/useRoomBuilder/geometry.js +325 -0
  89. package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
  90. package/dist/hooks/useRoomBuilder/index.js +303 -0
  91. package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.js +1 -1
  92. package/dist/hooks/{useSpaces/themes/index.d.ts → useRoomBuilder/themes.d.ts} +4 -3
  93. package/dist/hooks/useRoomBuilder/themes.js +273 -0
  94. package/dist/hooks/useRoomBuilder/types.d.ts +238 -0
  95. package/dist/hooks/useRoomBuilder/types.js +36 -0
  96. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  97. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  98. package/dist/hooks/useShare/index.d.ts +1 -1
  99. package/dist/hooks/useShare/index.js +4 -2
  100. package/dist/hooks/useSingleAnimation/index.js +1 -1
  101. package/dist/hooks/useWishlist/index.d.ts +1 -1
  102. package/dist/hooks/useZoom/index.d.ts +1 -1
  103. package/dist/http/assets.d.ts +2 -0
  104. package/dist/http/assets.js +16 -0
  105. package/dist/http/index.d.ts +2 -2
  106. package/dist/http/index.js +2 -2
  107. package/dist/http/orders.d.ts +1 -1
  108. package/dist/icons/Draw.js +3 -3
  109. package/dist/icons/Spinner.d.ts +2 -2
  110. package/dist/icons/Window.js +4 -4
  111. package/dist/icons/index.js +0 -28
  112. package/dist/icons/types.d.ts +1 -1
  113. package/dist/index.d.ts +2 -17
  114. package/dist/index.js +5 -35
  115. package/dist/store/attributes.d.ts +4 -5
  116. package/dist/store/attributes.js +2 -4
  117. package/dist/store/index.d.ts +6 -13
  118. package/dist/store/index.js +1 -3
  119. package/dist/store/price.d.ts +1 -1
  120. package/dist/store/price.js +1 -1
  121. package/dist/store/product.d.ts +2 -2
  122. package/dist/store/product.js +8 -5
  123. package/dist/store/translations.d.ts +10 -8
  124. package/dist/store/translations.js +39 -19
  125. package/dist/store/treble.d.ts +2 -2
  126. package/dist/store/treble.js +22 -15
  127. package/dist/store/wishlist.d.ts +2 -2
  128. package/dist/store/wishlist.js +1 -1
  129. package/dist/types.d.ts +19 -20
  130. package/dist/types.js +9 -9
  131. package/dist/utils.d.ts +2 -6
  132. package/dist/utils.js +5 -12
  133. package/package.json +1 -2
  134. package/dist/api/products.d.ts +0 -4
  135. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  136. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  137. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -177
  138. package/dist/hooks/useSpaces/SpacesState.js +0 -1814
  139. package/dist/hooks/useSpaces/constants.d.ts +0 -79
  140. package/dist/hooks/useSpaces/constants.js +0 -130
  141. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -38
  142. package/dist/hooks/useSpaces/dataHandlers.js +0 -407
  143. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  144. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  145. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  146. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  147. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  148. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  149. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  150. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  151. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  152. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  153. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  154. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -36
  155. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  156. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  157. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  158. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  159. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  160. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  161. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -11
  162. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -90
  163. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  164. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  165. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  166. package/dist/hooks/useSpaces/draw/index.js +0 -129
  167. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  168. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  169. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  170. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  171. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  172. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  173. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  174. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  175. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  176. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  177. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  178. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  179. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  180. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  181. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  182. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  183. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  184. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  185. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  186. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  187. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  188. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  189. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  190. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  191. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  192. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  193. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  194. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  195. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  196. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  197. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  198. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  199. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  200. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  201. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  202. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  203. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  204. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  205. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  206. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  207. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  208. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  209. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  210. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  211. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  212. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  213. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  214. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  215. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  216. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  217. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  218. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  219. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  220. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  221. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  222. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  223. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  224. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  225. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  226. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  227. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  228. package/dist/hooks/useSpaces/index.d.ts +0 -95
  229. package/dist/hooks/useSpaces/index.js +0 -557
  230. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  231. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  232. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  233. package/dist/hooks/useSpaces/themes/default.js +0 -96
  234. package/dist/hooks/useSpaces/themes/index.js +0 -21
  235. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  236. package/dist/hooks/useSpaces/themes/light.js +0 -96
  237. package/dist/hooks/useSpaces/types.d.ts +0 -378
  238. package/dist/hooks/useSpaces/types.js +0 -54
  239. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  240. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  241. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  242. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  243. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  244. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  245. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  246. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  247. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  248. package/dist/hooks/useSpaces/validators/index.js +0 -40
  249. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  250. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  251. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  252. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  253. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  254. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  255. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  256. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  257. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  258. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  259. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  260. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  261. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  262. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  263. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  264. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  265. package/dist/http/products.d.ts +0 -1
  266. package/dist/http/products.js +0 -12
  267. package/dist/icons/AngleSnapping.d.ts +0 -3
  268. package/dist/icons/AngleSnapping.js +0 -28
  269. package/dist/icons/Boundary.d.ts +0 -3
  270. package/dist/icons/Boundary.js +0 -21
  271. package/dist/icons/Center.d.ts +0 -3
  272. package/dist/icons/Center.js +0 -24
  273. package/dist/icons/GridSnapping.d.ts +0 -3
  274. package/dist/icons/GridSnapping.js +0 -28
  275. package/dist/icons/LayoutAlt.d.ts +0 -3
  276. package/dist/icons/LayoutAlt.js +0 -21
  277. package/dist/icons/Magnet.d.ts +0 -3
  278. package/dist/icons/Magnet.js +0 -27
  279. package/dist/icons/Player3D.d.ts +0 -3
  280. package/dist/icons/Player3D.js +0 -21
  281. package/dist/icons/RulerBlank.d.ts +0 -3
  282. package/dist/icons/RulerBlank.js +0 -25
  283. package/dist/icons/RulerDetailed.d.ts +0 -3
  284. package/dist/icons/RulerDetailed.js +0 -27
  285. package/dist/icons/Save.d.ts +0 -3
  286. package/dist/icons/Save.js +0 -21
  287. package/dist/icons/UnitCm.d.ts +0 -3
  288. package/dist/icons/UnitCm.js +0 -22
  289. package/dist/icons/UnitFeet.d.ts +0 -3
  290. package/dist/icons/UnitFeet.js +0 -22
  291. package/dist/icons/UnitInch.d.ts +0 -3
  292. package/dist/icons/UnitInch.js +0 -22
  293. package/dist/icons/UnitMeter.d.ts +0 -3
  294. package/dist/icons/UnitMeter.js +0 -21
  295. package/dist/store/spaces.d.ts +0 -74
  296. package/dist/store/spaces.js +0 -354
  297. /package/dist/hooks/{useSpaces/validators → useRoomBuilder}/messaging.d.ts +0 -0
@@ -1,12 +1,14 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
- import { ITranslationMap } from '../api/products';
2
+ import { ITranslationsMap } from '../http/assets';
3
3
  export interface TranslationsState {
4
- language: string | undefined;
4
+ locale: string | undefined;
5
+ translationsMap: ITranslationsMap;
5
6
  }
6
- export declare let TRANSLATIONS: undefined | ITranslationMap;
7
- export declare const setLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
8
- export declare const initTranslations: (language?: string) => (dispatch: ThreekitDispatch) => Promise<void>;
9
- declare const reducer: import("redux").Reducer<TranslationsState, import("redux").AnyAction>;
10
- export declare const getLanguage: (state: RootState) => undefined | string;
11
- export declare const getLanguageOptions: (state: RootState) => Array<string>;
7
+ export declare const setLocale: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
8
+ export declare const setTranslationsMap: import("@reduxjs/toolkit").ActionCreatorWithPayload<ITranslationsMap, string>;
9
+ export declare const initTranslations: (locale?: string) => (dispatch: ThreekitDispatch) => Promise<void>;
10
+ declare const reducer: import("redux").Reducer<TranslationsState>;
11
+ export declare const getLocale: (state: RootState) => undefined | string;
12
+ export declare const getTranslations: (state: RootState) => ITranslationsMap;
13
+ export declare const setTranslationForLocale: (locale: string | null) => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
12
14
  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 (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) 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]) {
@@ -39,44 +39,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.getLanguageOptions = exports.getLanguage = exports.initTranslations = exports.setLanguage = exports.TRANSLATIONS = void 0;
42
+ exports.setTranslationForLocale = exports.getTranslations = exports.getLocale = exports.initTranslations = exports.setTranslationsMap = exports.setLocale = void 0;
43
43
  var toolkit_1 = require("@reduxjs/toolkit");
44
44
  var api_1 = __importDefault(require("../api"));
45
- exports.setLanguage = (0, toolkit_1.createAction)('treble/translations/set-language');
46
- var initTranslations = function (language) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
45
+ exports.setLocale = (0, toolkit_1.createAction)('treble/translations/set-locale');
46
+ exports.setTranslationsMap = (0, toolkit_1.createAction)('treble/translations/set-translations-map');
47
+ var initTranslations = function (locale) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
48
+ var translations;
47
49
  return __generator(this, function (_a) {
48
50
  switch (_a.label) {
49
- case 0: return [4, api_1.default.products.fetchTranslations()];
51
+ case 0:
52
+ if (!locale)
53
+ return [2];
54
+ return [4, api_1.default.assets.fetchTranslations(locale)];
50
55
  case 1:
51
- exports.TRANSLATIONS = _a.sent();
52
- if (language)
53
- dispatch((0, exports.setLanguage)(language));
56
+ translations = _a.sent();
57
+ dispatch((0, exports.setLocale)(locale));
58
+ dispatch((0, exports.setTranslationsMap)(translations));
54
59
  return [2];
55
60
  }
56
61
  });
57
62
  }); }; };
58
63
  exports.initTranslations = initTranslations;
59
64
  var initialState = {
60
- language: undefined,
65
+ locale: undefined,
66
+ translationsMap: {},
61
67
  };
62
68
  var reducer = (0, toolkit_1.createSlice)({
63
69
  name: 'translations',
64
70
  initialState: initialState,
65
71
  extraReducers: function (builder) {
66
- builder.addCase(exports.setLanguage, function (state, action) {
67
- state.language = action.payload;
72
+ builder
73
+ .addCase(exports.setLocale, function (state, action) {
74
+ state.locale = action.payload;
75
+ })
76
+ .addCase(exports.setTranslationsMap, function (state, action) {
77
+ state.translationsMap = action.payload;
68
78
  });
69
79
  },
70
80
  reducers: {},
71
81
  }).reducer;
72
- var getLanguage = function (state) {
73
- return state.translations.language;
82
+ var getLocale = function (state) {
83
+ return state.translations.locale;
74
84
  };
75
- exports.getLanguage = getLanguage;
76
- var getLanguageOptions = function (state) {
77
- if (!state.treble.isThreekitInitialized || !exports.TRANSLATIONS)
78
- return [];
79
- return Object.keys(Object.values(exports.TRANSLATIONS)[0]);
85
+ exports.getLocale = getLocale;
86
+ var getTranslations = function (state) {
87
+ return state.translations.translationsMap;
80
88
  };
81
- exports.getLanguageOptions = getLanguageOptions;
89
+ exports.getTranslations = getTranslations;
90
+ var setTranslationForLocale = function (locale) {
91
+ return function (dispatch, getState) {
92
+ if (!locale) {
93
+ dispatch((0, exports.setLocale)(undefined));
94
+ dispatch((0, exports.setTranslationsMap)({}));
95
+ }
96
+ if (locale === getState().translations.locale)
97
+ return;
98
+ dispatch((0, exports.initTranslations)(locale !== null && locale !== void 0 ? locale : undefined));
99
+ };
100
+ };
101
+ exports.setTranslationForLocale = setTranslationForLocale;
82
102
  exports.default = reducer;
@@ -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, import("redux").AnyAction>;
59
+ declare const reducer: import("redux").Reducer<TrebleState>;
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<string>;
69
+ export declare const unloadPlayer: () => (dispatch: ThreekitDispatch) => Promise<void>;
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 (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) 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,6 +203,7 @@ var initPlayer = function (config) {
203
203
  orgId: orgId,
204
204
  }),
205
205
  };
206
+ dispatch((0, exports.setThreekitInitialized)(true));
206
207
  dispatch((0, exports.setPlayerLoading)(false));
207
208
  dispatch((0, exports.updateLoadingProgress)(1));
208
209
  dispatch((0, exports.setPlayerInteraction)(true));
@@ -262,7 +263,7 @@ var initPlayer = function (config) {
262
263
  exports.initPlayer = initPlayer;
263
264
  var launch = function (launchConfig) {
264
265
  return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
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;
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;
266
267
  var _b, _c, _d, _e, _f, _g, _h, _j;
267
268
  return __generator(this, function (_k) {
268
269
  switch (_k.label) {
@@ -333,7 +334,7 @@ var launch = function (launchConfig) {
333
334
  ? undefined
334
335
  : (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.assetId) || assetIdRaw;
335
336
  threekitDomainRaw = envCredentials.threekitDomain || "".concat(threekitEnv, ".threekit.com");
336
- authToken = envCredentials.publicToken, playerScriptUrl = envCredentials.playerScriptUrl;
337
+ authToken = envCredentials.publicToken;
337
338
  if (playerConfig.elementId) {
338
339
  el = document.getElementById(playerConfig.elementId);
339
340
  if (el)
@@ -372,8 +373,7 @@ var launch = function (launchConfig) {
372
373
  throw new Error('missing assetId and customId');
373
374
  return [4, new Promise(function (resolve) {
374
375
  var script = document.createElement('script');
375
- script.src =
376
- playerScriptUrl || "".concat(threekitDomain, "/app/js/threekit-player-bundle.js");
376
+ script.src = "".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,21 +403,28 @@ 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));
407
406
  return [2];
408
407
  }
409
408
  });
410
409
  }); };
411
410
  };
412
411
  exports.launch = launch;
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
- };
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
+ }); }; };
421
428
  exports.unloadPlayer = unloadPlayer;
422
429
  var reloadPlayer = function (config) {
423
430
  return function (dispatch, getState) { return __awaiter(void 0, void 0, void 0, function () {
@@ -454,7 +461,7 @@ var reloadPlayer = function (config) {
454
461
  playerConfig = Object.assign({}, constants_1.DEFAULT_PLAYER_CONFIG, trebleConfig.player);
455
462
  el = document.getElementById(state.treble.playerElId);
456
463
  if (!state.treble.isThreekitInitialized) return [3, 6];
457
- return [4, dispatch(exports.unloadPlayer)];
464
+ return [4, dispatch((0, exports.unloadPlayer)())];
458
465
  case 5:
459
466
  _a.sent();
460
467
  _a.label = 6;
@@ -1,7 +1,7 @@
1
1
  import { RootState, ThreekitDispatch } from './index';
2
2
  import { WishlistArray } from '../Treble';
3
3
  import { ISaveConfiguration } from '../api/configurations';
4
- export declare type WishlistState = WishlistArray;
4
+ export type WishlistState = WishlistArray;
5
5
  export declare const refreshWishlist: import("@reduxjs/toolkit").AsyncThunk<import("../http/configurations").IConfigurationResponse[], void, {
6
6
  state?: unknown;
7
7
  dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
@@ -24,7 +24,7 @@ export declare const addToWishlist: import("@reduxjs/toolkit").AsyncThunk<import
24
24
  }>;
25
25
  export declare const clearWishlist: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], import("../http/configurations").IConfigurationResponse[], "treble/wishlist/clear", never, never>;
26
26
  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, import("redux").AnyAction>;
27
+ declare const reducer: import("redux").Reducer<WishlistArray>;
28
28
  export declare const getWishlist: (state: RootState) => WishlistArray;
29
29
  export declare const resumeFromWishlist: (idx: number) => (_: ThreekitDispatch, getState: () => RootState) => void;
30
30
  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 (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) 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 declare type IMetadata = Record<string, string | number | null>;
49
+ export 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 declare type ISceneQuery = ISceneQueryNode | ISceneQueryTransform | string;
82
+ export 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 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>;
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>;
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 declare type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
- export declare type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
- export declare type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
138
+ export type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
139
+ export type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
140
+ export 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 declare type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
- export declare type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
- export declare type IAttributeArray = IAttributeArrayBase<Pick<IConfigurationArrayValue, 'assetId'>>;
170
+ export type IDisplayAttributeArray = IAttributeArrayBase<IDisplayAttributeArrayValue>;
171
+ export type IHydratedAttributeArray = IAttributeArrayBase<IHydratedAttributeArrayValue>;
172
+ export 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 declare type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
- export declare type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
- export declare type IAttributeString = IAttributeStringBase<string>;
188
+ export type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
189
+ export type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
190
+ export 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 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;
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;
207
207
  export interface ICoordinates {
208
208
  x: number;
209
209
  y: number;
@@ -280,14 +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: Array<string | number | Array<string | number>>) => IThreekitConfigurator | undefined;
283
+ getNestedConfigurator: (path: string | Array<string | number>) => IThreekitConfigurator | undefined;
284
284
  getFullConfiguration: (options?: {
285
285
  resolve?: boolean;
286
286
  hydrate?: boolean;
287
287
  }) => IConfiguration;
288
288
  setFullConfiguration: (configuration: IConfiguration) => Promise<void>;
289
289
  on: (eventName: string, callback: () => void) => void;
290
- clone: () => Promise<IThreekitConfigurator>;
291
290
  }
292
291
  export interface IThreekitScene {
293
292
  PHASES: {
@@ -328,6 +327,7 @@ export interface IThreekitPlayer {
328
327
  unload: () => Promise<string>;
329
328
  uploadImage: (image: File) => Promise<string>;
330
329
  cacheParameters: ICacheParameters;
330
+ sessionId: string;
331
331
  }
332
332
  export interface IThreekitPrivateConfigurator extends IThreekitConfigurator {
333
333
  name: string;
@@ -395,7 +395,6 @@ export interface ICredential {
395
395
  publicToken: string;
396
396
  publishStage?: string;
397
397
  threekitDomain?: string;
398
- playerScriptUrl?: string;
399
398
  }
400
399
  export interface ICredentials extends Record<string, ICredential> {
401
400
  }
package/dist/types.js CHANGED
@@ -6,17 +6,17 @@ var SCENE_PHASES;
6
6
  SCENE_PHASES["LOADED"] = "loaded";
7
7
  SCENE_PHASES["PRELOADED"] = "preloaded";
8
8
  SCENE_PHASES["RENDERED"] = "rendered";
9
- })(SCENE_PHASES = exports.SCENE_PHASES || (exports.SCENE_PHASES = {}));
9
+ })(SCENE_PHASES || (exports.SCENE_PHASES = SCENE_PHASES = {}));
10
10
  var PRIVATE_APIS;
11
11
  (function (PRIVATE_APIS) {
12
12
  PRIVATE_APIS["SCENE"] = "scene";
13
13
  PRIVATE_APIS["PLAYER"] = "player";
14
- })(PRIVATE_APIS = exports.PRIVATE_APIS || (exports.PRIVATE_APIS = {}));
14
+ })(PRIVATE_APIS || (exports.PRIVATE_APIS = PRIVATE_APIS = {}));
15
15
  var DISPLAY_OPTIONS;
16
16
  (function (DISPLAY_OPTIONS) {
17
17
  DISPLAY_OPTIONS["WEBGL"] = "webgl";
18
18
  DISPLAY_OPTIONS["IMAGE"] = "image";
19
- })(DISPLAY_OPTIONS = exports.DISPLAY_OPTIONS || (exports.DISPLAY_OPTIONS = {}));
19
+ })(DISPLAY_OPTIONS || (exports.DISPLAY_OPTIONS = DISPLAY_OPTIONS = {}));
20
20
  var ATTRIBUTE_TYPES;
21
21
  (function (ATTRIBUTE_TYPES) {
22
22
  ATTRIBUTE_TYPES["STRING"] = "String";
@@ -25,28 +25,28 @@ var ATTRIBUTE_TYPES;
25
25
  ATTRIBUTE_TYPES["NUMBER"] = "Number";
26
26
  ATTRIBUTE_TYPES["BOOLEAN"] = "Boolean";
27
27
  ATTRIBUTE_TYPES["ARRAY"] = "Array";
28
- })(ATTRIBUTE_TYPES = exports.ATTRIBUTE_TYPES || (exports.ATTRIBUTE_TYPES = {}));
28
+ })(ATTRIBUTE_TYPES || (exports.ATTRIBUTE_TYPES = ATTRIBUTE_TYPES = {}));
29
29
  var ASSET_TYPES;
30
30
  (function (ASSET_TYPES) {
31
31
  ASSET_TYPES["UPLOAD"] = "upload";
32
32
  ASSET_TYPES["ITEM"] = "item";
33
- })(ASSET_TYPES = exports.ASSET_TYPES || (exports.ASSET_TYPES = {}));
33
+ })(ASSET_TYPES || (exports.ASSET_TYPES = ASSET_TYPES = {}));
34
34
  var PLUG_TYPES;
35
35
  (function (PLUG_TYPES) {
36
36
  PLUG_TYPES["PROXY"] = "Proxy";
37
37
  PLUG_TYPES["TRANSFORM"] = "Transform";
38
- })(PLUG_TYPES = exports.PLUG_TYPES || (exports.PLUG_TYPES = {}));
38
+ })(PLUG_TYPES || (exports.PLUG_TYPES = PLUG_TYPES = {}));
39
39
  var TRANSFORM_PROPERTY_TYPES;
40
40
  (function (TRANSFORM_PROPERTY_TYPES) {
41
41
  TRANSFORM_PROPERTY_TYPES["ROTATION"] = "rotation";
42
42
  TRANSFORM_PROPERTY_TYPES["TRANSLATION"] = "translation";
43
43
  TRANSFORM_PROPERTY_TYPES["SCALE"] = "scale";
44
- })(TRANSFORM_PROPERTY_TYPES = exports.TRANSFORM_PROPERTY_TYPES || (exports.TRANSFORM_PROPERTY_TYPES = {}));
44
+ })(TRANSFORM_PROPERTY_TYPES || (exports.TRANSFORM_PROPERTY_TYPES = TRANSFORM_PROPERTY_TYPES = {}));
45
45
  var SNAPSHOT_FORMATS;
46
46
  (function (SNAPSHOT_FORMATS) {
47
47
  SNAPSHOT_FORMATS["JPG"] = "jpg";
48
48
  SNAPSHOT_FORMATS["PNG"] = "png";
49
- })(SNAPSHOT_FORMATS = exports.SNAPSHOT_FORMATS || (exports.SNAPSHOT_FORMATS = {}));
49
+ })(SNAPSHOT_FORMATS || (exports.SNAPSHOT_FORMATS = SNAPSHOT_FORMATS = {}));
50
50
  var SNAPSHOT_OUTPUTS;
51
51
  (function (SNAPSHOT_OUTPUTS) {
52
52
  SNAPSHOT_OUTPUTS["URL"] = "url";
@@ -54,4 +54,4 @@ var SNAPSHOT_OUTPUTS;
54
54
  SNAPSHOT_OUTPUTS["DATA_URL"] = "dataUrl";
55
55
  SNAPSHOT_OUTPUTS["BLOB"] = "blob";
56
56
  SNAPSHOT_OUTPUTS["FILE"] = "file";
57
- })(SNAPSHOT_OUTPUTS = exports.SNAPSHOT_OUTPUTS || (exports.SNAPSHOT_OUTPUTS = {}));
57
+ })(SNAPSHOT_OUTPUTS || (exports.SNAPSHOT_OUTPUTS = SNAPSHOT_OUTPUTS = {}));
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IThreekitCamera, IConfigurationColor, ICoordinates, IQuaternion, IThreekitDisplayAttribute, ISetConfiguration, IHydratedAttribute } from './types';
2
2
  import { ITrebleConfig, ATTRIBUTE_TYPES } from './types';
3
3
  import { RawAttributeValue } from './hooks/useAttribute';
4
- import { ITranslationMap } from './api/products';
4
+ import { ITranslationsMap } from './http/assets';
5
5
  interface ICameraPosition {
6
6
  position: ICoordinates;
7
7
  quaternion: IQuaternion;
@@ -48,11 +48,7 @@ export declare const downloadSnapshot: (snapshot: string, filename: string) => P
48
48
  export declare const copyToClipboard: (data: string | Record<string, string | number | boolean>) => void;
49
49
  export declare const easeInOutCubic: (val: number) => number;
50
50
  export declare const metadataValueToObject: (data: string) => Record<string, string | number>;
51
- export declare const hydrateAttribute: (data: [
52
- Record<string, IThreekitDisplayAttribute>,
53
- undefined | ITranslationMap,
54
- undefined | string
55
- ], optionSelectionHandler: (config: ISetConfiguration) => Promise<void>) => Record<string, IHydratedAttribute>;
51
+ export declare const hydrateAttribute: (data: [Record<string, IThreekitDisplayAttribute>, ITranslationsMap], optionSelectionHandler: (config: ISetConfiguration) => Promise<void>) => Record<string, IHydratedAttribute>;
56
52
  export declare const selectionToConfiguration: (value: RawAttributeValue, attributeType: ATTRIBUTE_TYPES) => string | number | boolean | File | IConfigurationColor | {
57
53
  assetId: RawAttributeValue;
58
54
  } | undefined;
package/dist/utils.js CHANGED
@@ -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 (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) 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]) {
@@ -304,24 +304,19 @@ var metadataValueToObject = function (data) {
304
304
  };
305
305
  exports.metadataValueToObject = metadataValueToObject;
306
306
  var hydrateAttribute = function (data, optionSelectionHandler) {
307
- var attributes = data[0], translations = data[1], language = data[2];
308
- var hasTranslation = !!language && !!translations;
307
+ var attributes = data[0], translations = data[1];
309
308
  return Object.values(attributes).reduce(function (output, attribute) {
310
309
  var _a;
311
310
  var _b;
312
311
  return Object.assign(output, (_a = {},
313
312
  _a[attribute.name] = Object.assign({}, attribute, {
314
- label: hasTranslation
315
- ? ((_b = translations === null || translations === void 0 ? void 0 : translations[attribute.name]) === null || _b === void 0 ? void 0 : _b[language]) || attribute.name
316
- : attribute.name,
313
+ label: (_b = translations[attribute.name]) !== null && _b !== void 0 ? _b : attribute.name,
317
314
  }, attribute.type === 'String'
318
315
  ? {
319
316
  values: attribute.values.map(function (el) {
320
317
  var _a;
321
318
  return Object.assign({}, el, {
322
- label: hasTranslation
323
- ? ((_a = translations === null || translations === void 0 ? void 0 : translations[el.label]) === null || _a === void 0 ? void 0 : _a[language]) || el.label
324
- : el.label,
319
+ label: (_a = translations[el.label]) !== null && _a !== void 0 ? _a : el.label,
325
320
  handleSelect: function () {
326
321
  var _a;
327
322
  return optionSelectionHandler((_a = {},
@@ -337,9 +332,7 @@ var hydrateAttribute = function (data, optionSelectionHandler) {
337
332
  values: attribute.values.map(function (el) {
338
333
  var _a;
339
334
  return Object.assign({}, el, {
340
- label: hasTranslation
341
- ? ((_a = translations === null || translations === void 0 ? void 0 : translations[el.name]) === null || _a === void 0 ? void 0 : _a[language]) || el.name
342
- : el.name,
335
+ label: (_a = translations[el.name]) !== null && _a !== void 0 ? _a : el.name,
343
336
  handleSelect: function () {
344
337
  var _a;
345
338
  return optionSelectionHandler((_a = {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.92-next-01",
3
+ "version": "0.0.93",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -46,7 +46,6 @@
46
46
  "axios": "^0.22.0",
47
47
  "chokidar": "^3.5.3",
48
48
  "live-server": "^1.2.2",
49
- "joi": "^17.10.0",
50
49
  "react-redux": "^7.2.6",
51
50
  "redux": "^4.1.2",
52
51
  "redux-logger": "^3.0.6",
@@ -1,4 +0,0 @@
1
- declare type ITranslation = Record<string, string | undefined>;
2
- export declare type ITranslationMap = Record<string, ITranslation>;
3
- export declare const fetchTranslations: () => Promise<ITranslationMap>;
4
- export {};
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ICoordinate2D } from './types';
3
- interface ISpacesLayout {
4
- loops?: Array<ICoordinate2D[]>;
5
- size?: number;
6
- color?: string;
7
- padding?: number;
8
- strokeWidth?: number;
9
- }
10
- export default function SpacesLayout(props: ISpacesLayout): JSX.Element;
11
- export {};
@@ -1,74 +0,0 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var react_1 = __importDefault(require("react"));
18
- function SpacesLayout(props) {
19
- var loops = props.loops;
20
- var size = props.size || 20;
21
- var padding = props.padding || 2;
22
- var strokeWidth = props.strokeWidth || 2;
23
- if (!(loops === null || loops === void 0 ? void 0 : loops.length))
24
- return react_1.default.createElement(react_1.default.Fragment, null);
25
- var _a = loops.reduce(function (output, loop, i) {
26
- loop.forEach(function (_a, j) {
27
- var x = _a[0], y = _a[1];
28
- if (!i && !j) {
29
- output = {
30
- xMin: x,
31
- yMin: y,
32
- xMax: x,
33
- yMax: y,
34
- };
35
- }
36
- else {
37
- if (x < output.xMin)
38
- output.xMin = x;
39
- else if (x > output.xMax)
40
- output.xMax = x;
41
- if (y < output.yMin)
42
- output.yMin = y;
43
- else if (y > output.yMax)
44
- output.yMax = y;
45
- }
46
- });
47
- return output;
48
- }, {
49
- xMin: 0,
50
- yMin: 0,
51
- xMax: 0,
52
- yMax: 0,
53
- }), xMin = _a.xMin, yMin = _a.yMin, xMax = _a.xMax, yMax = _a.yMax;
54
- var xSpan = xMax - xMin;
55
- var ySpan = yMax - yMin;
56
- var xCenter = xMin + xSpan / 2;
57
- var yCenter = yMin + ySpan / 2;
58
- var scaleFactor = (size - 2 * padding) / Math.max(xSpan, ySpan);
59
- var translate = [
60
- xCenter * scaleFactor - size / 2,
61
- yCenter * scaleFactor - size / 2,
62
- ];
63
- return (react_1.default.createElement("svg", __assign({ width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props), loops.map(function (loop, i) {
64
- var path = loop
65
- .map(function (point, i) {
66
- var x = point[0] * scaleFactor - translate[0];
67
- var y = point[1] * scaleFactor - translate[1];
68
- return (!i ? 'M ' : 'L ') + x + ' ' + y;
69
- })
70
- .join(' ') + ' Z';
71
- return (react_1.default.createElement("path", { key: "path-".concat(i), d: path, stroke: props.color, strokeWidth: strokeWidth }));
72
- })));
73
- }
74
- exports.default = SpacesLayout;