@threekit-tools/treble 0.0.87 → 0.0.89-next-001

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 (145) hide show
  1. package/dist/Treble/Treble.d.ts +2 -5
  2. package/dist/Treble/Treble.js +1 -7
  3. package/dist/components/AttributeValue/index.js +2 -0
  4. package/dist/components/Wishlist/index.d.ts +1 -1
  5. package/dist/components/Zoom/index.d.ts +1 -1
  6. package/dist/components/containers/formInputContainer.d.ts +1 -1
  7. package/dist/connection.d.ts +4 -0
  8. package/dist/connection.js +3 -0
  9. package/dist/hooks/useProductCache/index.d.ts +2 -1
  10. package/dist/hooks/useProductCache/index.js +43 -1
  11. package/dist/hooks/useResetProduct/index.d.ts +3 -0
  12. package/dist/hooks/useResetProduct/index.js +55 -0
  13. package/dist/hooks/useRoomBuilder/RoomBuilderState.d.ts +93 -0
  14. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1207 -0
  15. package/dist/hooks/useRoomBuilder/constants.d.ts +33 -0
  16. package/dist/hooks/useRoomBuilder/constants.js +40 -0
  17. package/dist/hooks/useRoomBuilder/dataHandlers.d.ts +15 -0
  18. package/dist/hooks/useRoomBuilder/dataHandlers.js +177 -0
  19. package/dist/hooks/useRoomBuilder/draw.d.ts +55 -0
  20. package/dist/hooks/useRoomBuilder/draw.js +551 -0
  21. package/dist/hooks/useRoomBuilder/geometry.d.ts +43 -0
  22. package/dist/hooks/useRoomBuilder/geometry.js +462 -0
  23. package/dist/hooks/useRoomBuilder/index.d.ts +40 -0
  24. package/dist/hooks/useRoomBuilder/index.js +299 -0
  25. package/dist/hooks/useRoomBuilder/messaging.d.ts +8 -0
  26. package/dist/hooks/useRoomBuilder/messaging.js +13 -0
  27. package/dist/hooks/useRoomBuilder/themes.d.ts +12 -0
  28. package/dist/hooks/useRoomBuilder/themes.js +270 -0
  29. package/dist/hooks/useRoomBuilder/types.d.ts +232 -0
  30. package/dist/hooks/useRoomBuilder/types.js +36 -0
  31. package/dist/hooks/useRoomBuilder/validators.d.ts +36 -0
  32. package/dist/hooks/useRoomBuilder/validators.js +362 -0
  33. package/dist/http/request.js +4 -1
  34. package/dist/icons/Add.d.ts +1 -1
  35. package/dist/icons/Add.js +3 -3
  36. package/dist/icons/Angle.d.ts +3 -0
  37. package/dist/icons/Angle.js +21 -0
  38. package/dist/icons/ArrowLeft.d.ts +1 -1
  39. package/dist/icons/ArrowLeft.js +3 -3
  40. package/dist/icons/ArrowRight.d.ts +1 -1
  41. package/dist/icons/ArrowRight.js +3 -3
  42. package/dist/icons/Camera.d.ts +1 -1
  43. package/dist/icons/Camera.js +3 -3
  44. package/dist/icons/CaretDown.d.ts +1 -1
  45. package/dist/icons/CaretDown.js +3 -3
  46. package/dist/icons/CaretLeft.d.ts +1 -1
  47. package/dist/icons/CaretLeft.js +3 -3
  48. package/dist/icons/CaretRight.d.ts +1 -1
  49. package/dist/icons/CaretRight.js +3 -3
  50. package/dist/icons/CaretUp.d.ts +1 -1
  51. package/dist/icons/CaretUp.js +3 -3
  52. package/dist/icons/Cart.d.ts +1 -1
  53. package/dist/icons/Cart.js +3 -3
  54. package/dist/icons/Checkmate.d.ts +1 -1
  55. package/dist/icons/Checkmate.js +3 -3
  56. package/dist/icons/Clipboard.d.ts +1 -1
  57. package/dist/icons/Clipboard.js +3 -3
  58. package/dist/icons/ColorPicker.d.ts +1 -1
  59. package/dist/icons/ColorPicker.js +3 -3
  60. package/dist/icons/Copy.d.ts +1 -1
  61. package/dist/icons/Copy.js +3 -3
  62. package/dist/icons/Cursor.d.ts +3 -0
  63. package/dist/icons/Cursor.js +21 -0
  64. package/dist/icons/Delete.d.ts +1 -1
  65. package/dist/icons/Delete.js +3 -3
  66. package/dist/icons/Door.d.ts +3 -0
  67. package/dist/icons/Door.js +22 -0
  68. package/dist/icons/DoubleCaretLeft.d.ts +1 -1
  69. package/dist/icons/DoubleCaretLeft.js +3 -3
  70. package/dist/icons/DoubleCaretRight.d.ts +1 -1
  71. package/dist/icons/DoubleCaretRight.js +3 -3
  72. package/dist/icons/Download.d.ts +1 -1
  73. package/dist/icons/Download.js +3 -3
  74. package/dist/icons/Drag.d.ts +1 -1
  75. package/dist/icons/Drag.js +3 -3
  76. package/dist/icons/Draggable.d.ts +1 -1
  77. package/dist/icons/Draggable.js +3 -3
  78. package/dist/icons/Edit.d.ts +1 -1
  79. package/dist/icons/Edit.js +3 -3
  80. package/dist/icons/Heart.d.ts +1 -1
  81. package/dist/icons/Heart.js +3 -3
  82. package/dist/icons/Image.d.ts +1 -1
  83. package/dist/icons/Image.js +3 -3
  84. package/dist/icons/Info.d.ts +1 -1
  85. package/dist/icons/Info.js +3 -3
  86. package/dist/icons/Layout.d.ts +3 -0
  87. package/dist/icons/Layout.js +21 -0
  88. package/dist/icons/Mail.d.ts +1 -1
  89. package/dist/icons/Mail.js +3 -3
  90. package/dist/icons/Menu.d.ts +1 -1
  91. package/dist/icons/Menu.js +3 -3
  92. package/dist/icons/More.d.ts +1 -1
  93. package/dist/icons/More.js +3 -3
  94. package/dist/icons/NewWindow.d.ts +1 -1
  95. package/dist/icons/NewWindow.js +3 -3
  96. package/dist/icons/Opening.d.ts +3 -0
  97. package/dist/icons/Opening.js +21 -0
  98. package/dist/icons/Pause.d.ts +1 -1
  99. package/dist/icons/Pause.js +3 -3
  100. package/dist/icons/Play.d.ts +1 -1
  101. package/dist/icons/Play.js +3 -3
  102. package/dist/icons/Redo.d.ts +1 -1
  103. package/dist/icons/Redo.js +3 -3
  104. package/dist/icons/Remove.d.ts +1 -1
  105. package/dist/icons/Remove.js +3 -3
  106. package/dist/icons/Ruler.d.ts +1 -1
  107. package/dist/icons/Ruler.js +3 -3
  108. package/dist/icons/Search.d.ts +1 -1
  109. package/dist/icons/Search.js +3 -3
  110. package/dist/icons/Settings.d.ts +1 -1
  111. package/dist/icons/Settings.js +3 -3
  112. package/dist/icons/Share.d.ts +1 -1
  113. package/dist/icons/Share.js +3 -3
  114. package/dist/icons/Switch.d.ts +1 -1
  115. package/dist/icons/Switch.js +3 -3
  116. package/dist/icons/Tag.d.ts +1 -1
  117. package/dist/icons/Tag.js +3 -3
  118. package/dist/icons/TrashCan.d.ts +3 -0
  119. package/dist/icons/TrashCan.js +21 -0
  120. package/dist/icons/TrashCanAlt.d.ts +3 -0
  121. package/dist/icons/TrashCanAlt.js +21 -0
  122. package/dist/icons/Undo.d.ts +1 -1
  123. package/dist/icons/Undo.js +3 -3
  124. package/dist/icons/Wall.d.ts +3 -0
  125. package/dist/icons/Wall.js +21 -0
  126. package/dist/icons/Window.d.ts +3 -0
  127. package/dist/icons/Window.js +22 -0
  128. package/dist/icons/Wishlist.d.ts +1 -1
  129. package/dist/icons/Wishlist.js +3 -3
  130. package/dist/icons/ZoomIn.d.ts +1 -1
  131. package/dist/icons/ZoomIn.js +3 -3
  132. package/dist/icons/ZoomOut.d.ts +1 -1
  133. package/dist/icons/ZoomOut.js +3 -3
  134. package/dist/icons/index.d.ts +2 -6
  135. package/dist/icons/index.js +18 -0
  136. package/dist/icons/types.d.ts +7 -0
  137. package/dist/icons/types.js +2 -0
  138. package/dist/index.d.ts +11 -1
  139. package/dist/index.js +23 -2
  140. package/dist/store/product.d.ts +5 -4
  141. package/dist/store/product.js +43 -26
  142. package/dist/store/treble.js +6 -3
  143. package/dist/types.d.ts +47 -7
  144. package/dist/types.js +1 -0
  145. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import threekitAPI from '../api';
2
- import { IThreekitPlayer, IThreekitPrivatePlayer, IConfiguration, ISetConfiguration, IThreekitPrivateConfigurator } from '../types';
2
+ import { IThreekitPlayer, IThreekitPrivatePlayer, IThreekitPrivateConfigurator } from '../types';
3
3
  import { IWishlist } from './wishlist';
4
4
  import snapshots from './snapshots';
5
5
  import { ISaveConfiguration } from '../api/configurations';
@@ -8,7 +8,6 @@ import { ICartItem } from '../http/orders';
8
8
  interface ITreble {
9
9
  player: IThreekitPlayer;
10
10
  orgId: string;
11
- initialConfiguration: IConfiguration;
12
11
  }
13
12
  interface IEmailShareCredentials {
14
13
  to: string;
@@ -22,11 +21,10 @@ declare class Treble {
22
21
  _api: typeof threekitAPI;
23
22
  _player: IThreekitPrivatePlayer;
24
23
  wishlist: IWishlist;
25
- private _initialConfiguration;
26
24
  private _snapshots;
27
25
  takeSnapshots: typeof snapshots['takeSnapshots'];
28
26
  _debugMode: boolean;
29
- constructor({ player, orgId, initialConfiguration }: ITreble);
27
+ constructor({ player, orgId }: ITreble);
30
28
  createOrder: (order?: IOrder) => Promise<import("../http/orders").IOrderResponse>;
31
29
  saveConfiguration: (config?: Partial<Omit<ISaveConfiguration, 'configuration'>>) => Promise<{
32
30
  resumableUrl: string;
@@ -34,7 +32,6 @@ declare class Treble {
34
32
  thumbnail: string;
35
33
  }>;
36
34
  getNestedConfigurator: (address: string | Array<string>) => undefined | IThreekitPrivateConfigurator;
37
- resetConfiguration: (configuration?: ISetConfiguration) => void;
38
35
  sendEmail: (credentials: IEmailShareCredentials, templateData: Record<string, any>) => Promise<import("../http/server").IPostEmailResponse>;
39
36
  }
40
37
  export default Treble;
@@ -48,7 +48,7 @@ var wishlist_1 = __importDefault(require("./wishlist"));
48
48
  var snapshots_1 = __importDefault(require("./snapshots"));
49
49
  var Treble = (function () {
50
50
  function Treble(_a) {
51
- var player = _a.player, orgId = _a.orgId, initialConfiguration = _a.initialConfiguration;
51
+ var player = _a.player, orgId = _a.orgId;
52
52
  var _this = this;
53
53
  this.createOrder = function (order) { return __awaiter(_this, void 0, void 0, function () {
54
54
  var updatedOrder, configuration, response;
@@ -129,11 +129,6 @@ var Treble = (function () {
129
129
  })) === null || _a === void 0 ? void 0 : _a.configurator;
130
130
  }, player.getConfigurator());
131
131
  };
132
- this.resetConfiguration = function (configuration) {
133
- var initialConfiguration = JSON.parse(_this._initialConfiguration);
134
- var updateConfiguration = Object.assign(initialConfiguration, configuration);
135
- window.threekit.configurator.setConfiguration(updateConfiguration);
136
- };
137
132
  this.sendEmail = function (credentials, templateData) {
138
133
  if (!credentials)
139
134
  throw new Error('sendEmail is missing credentials object');
@@ -155,7 +150,6 @@ var Treble = (function () {
155
150
  this._snapshots = snapshots_1.default;
156
151
  this.takeSnapshots = this._snapshots.takeSnapshots;
157
152
  this._player = player.enableApi(types_1.PRIVATE_APIS.PLAYER);
158
- this._initialConfiguration = JSON.stringify(initialConfiguration);
159
153
  this._debugMode = constants_1.TREBLE_DEBUG;
160
154
  }
161
155
  return Treble;
@@ -17,6 +17,8 @@ var AttributeValue = function (props) {
17
17
  if (!attributeData)
18
18
  return null;
19
19
  var value;
20
+ if (attributeData.type === types_1.ATTRIBUTE_TYPES.ARRAY)
21
+ return null;
20
22
  if (attributeData.type === types_1.ATTRIBUTE_TYPES.ASSET) {
21
23
  var assetAttribute_1 = attributeData;
22
24
  if (!((_a = assetAttribute_1.value) === null || _a === void 0 ? void 0 : _a.assetId))
@@ -27,6 +27,6 @@ export declare const Wishlist: {
27
27
  type: string;
28
28
  };
29
29
  componentName: string;
30
- Icon: import("../../icons").IIcon;
30
+ Icon: import("../../icons/types").IIcon;
31
31
  };
32
32
  export default Wishlist;
@@ -29,7 +29,7 @@ export declare const Zoom: {
29
29
  type: string;
30
30
  };
31
31
  componentName: string;
32
- Icon: import("../../icons").IIcon;
32
+ Icon: import("../../icons/types").IIcon;
33
33
  ZoomOut: (props: ZoomComponentProps) => JSX.Element | null;
34
34
  ZoomIn: (props: ZoomComponentProps) => JSX.Element | null;
35
35
  };
@@ -41,7 +41,7 @@ interface IHydrateAttributeConfig {
41
41
  sort?: string;
42
42
  }
43
43
  export declare const hydrateAttributeForComponent: (attribute: IHydratedAttribute, config: IHydrateAttributeConfig) => {
44
- selected: string | number | boolean | import("../../types").IConfigurationAsset | import("../../types").IConfigurationColor;
44
+ selected: string | number | boolean | import("../../types").IConfigurationAsset | import("../../types").IConfigurationArray | import("../../types").IConfigurationColor;
45
45
  options: {
46
46
  name: string;
47
47
  handleSelect: () => Promise<void>;
@@ -1,9 +1,11 @@
1
+ import { ICacheParameters } from './types';
1
2
  export interface IConnectionConfig {
2
3
  authToken?: string;
3
4
  orgId?: string;
4
5
  assetId?: string;
5
6
  threekitDomain?: string;
6
7
  serverUrl?: string;
8
+ cacheParameters?: ICacheParameters;
7
9
  }
8
10
  export declare class ThreekitConnection {
9
11
  _authToken: string;
@@ -11,6 +13,7 @@ export declare class ThreekitConnection {
11
13
  _assetId: string;
12
14
  _threekitDomain: string;
13
15
  _serverUrl: string;
16
+ _cacheParameters?: ICacheParameters;
14
17
  constructor();
15
18
  connect(config: IConnectionConfig): Promise<void>;
16
19
  getConnection(): {
@@ -19,6 +22,7 @@ export declare class ThreekitConnection {
19
22
  assetId: string;
20
23
  threekitDomain: string;
21
24
  serverUrl: string;
25
+ cacheParameters: ICacheParameters | undefined;
22
26
  };
23
27
  }
24
28
  declare const _default: ThreekitConnection;
@@ -58,6 +58,8 @@ var ThreekitConnection = (function () {
58
58
  this._serverUrl = config.serverUrl;
59
59
  if (config.threekitDomain)
60
60
  this._threekitDomain = "https://".concat(config.threekitDomain);
61
+ if (config.cacheParameters)
62
+ this._cacheParameters = config.cacheParameters;
61
63
  return [2];
62
64
  });
63
65
  });
@@ -72,6 +74,7 @@ var ThreekitConnection = (function () {
72
74
  assetId: this._assetId,
73
75
  threekitDomain: this._threekitDomain,
74
76
  serverUrl: this._serverUrl,
77
+ cacheParameters: this._cacheParameters,
75
78
  };
76
79
  };
77
80
  return ThreekitConnection;
@@ -1,6 +1,6 @@
1
1
  import { CachedProduct, LoadProductConfig } from '../../store/product';
2
2
  import { IReloadConfig } from '../../store/treble';
3
- interface HydratedCacheProduct extends Pick<CachedProduct, 'name' | 'label' | 'thumbnail'> {
3
+ interface HydratedCacheProduct extends Pick<CachedProduct, 'id' | 'name' | 'label' | 'thumbnail'> {
4
4
  selected: boolean;
5
5
  handleSelect: () => Promise<void>;
6
6
  handleRemove: () => Promise<void>;
@@ -14,6 +14,7 @@ interface UseProductCache {
14
14
  cache: Array<HydratedCacheProduct>;
15
15
  products: Array<ISelectableProduct>;
16
16
  onLoadNewProduct: (config?: string | IReloadConfig) => Promise<void>;
17
+ onResetProduct: () => Promise<void>;
17
18
  }
18
19
  declare const useProductCache: () => UseProductCache;
19
20
  export default useProductCache;
@@ -1,4 +1,40 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  var product_1 = require("../../store/product");
4
40
  var store_1 = require("../../store");
@@ -9,6 +45,12 @@ var useProductCache = function () {
9
45
  var onLoadNewProduct = function (config) {
10
46
  return dispatch((0, product_1.loadNewProduct)(config));
11
47
  };
48
+ var onResetProduct = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0: return [4, dispatch((0, product_1.resetProductConfiguration)())];
51
+ case 1: return [2, _a.sent()];
52
+ }
53
+ }); }); };
12
54
  var hydratedCache = cache.map(function (el, i) {
13
55
  return Object.assign({}, el, {
14
56
  selected: activeProductIdx === i,
@@ -25,6 +67,6 @@ var useProductCache = function () {
25
67
  return dispatch((0, product_1.loadProduct)(prod, config));
26
68
  },
27
69
  }); });
28
- return { cache: hydratedCache, products: products, onLoadNewProduct: onLoadNewProduct };
70
+ return { cache: hydratedCache, products: products, onLoadNewProduct: onLoadNewProduct, onResetProduct: onResetProduct };
29
71
  };
30
72
  exports.default = useProductCache;
@@ -0,0 +1,3 @@
1
+ declare type UseShareHook = undefined | (() => Promise<void>);
2
+ declare const useResetProduct: () => UseShareHook;
3
+ export default useResetProduct;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var store_1 = require("../../store");
40
+ var treble_1 = require("../../store/treble");
41
+ var product_1 = require("../../store/product");
42
+ var useResetProduct = function () {
43
+ var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
44
+ var dispatch = (0, store_1.useThreekitDispatch)();
45
+ if (!isLoaded)
46
+ return undefined;
47
+ var handleReset = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0: return [4, dispatch((0, product_1.resetProductConfiguration)())];
50
+ case 1: return [2, _a.sent()];
51
+ }
52
+ }); }); };
53
+ return handleReset;
54
+ };
55
+ exports.default = useResetProduct;
@@ -0,0 +1,93 @@
1
+ import { IWalls, IVerticesState, ICoordinate2D, IFeature, IFeatures, ICoordinatesLine, IRoomBuilderStateProps, IElementAddress, IFeatureName, IVertex, IFeaturesHydrated, IElementUi, IElementName, IActiveElement } from './types';
2
+ import type { IHydratedAttribute } from '../../types';
3
+ export declare class RoomBuilderState {
4
+ private _config;
5
+ private _attributesState;
6
+ private _newWall;
7
+ private _activeElement;
8
+ private _selectedElement;
9
+ private _highlightedElement;
10
+ private _errorElement;
11
+ private _showDimensions;
12
+ private _angleSnappingEnabled;
13
+ private _state;
14
+ constructor(config: IRoomBuilderStateProps);
15
+ get walls(): IWalls;
16
+ set walls(walls: IWalls);
17
+ get wallCount(): number;
18
+ get wallLines(): ICoordinatesLine[];
19
+ get vertices(): IVerticesState;
20
+ set vertices(vertices: IVerticesState);
21
+ get verticesList(): Array<IVertex>;
22
+ get features(): IFeatures;
23
+ set features(features: IFeatures);
24
+ get getHydratedFeatures(): undefined | IFeaturesHydrated;
25
+ get featureCount(): number;
26
+ get activeElement(): IActiveElement | null;
27
+ get selectedElement(): null | IElementAddress;
28
+ set selectedElement(element: null | IElementAddress);
29
+ get showDimensions(): boolean;
30
+ set showDimensions(val: boolean);
31
+ get angleSnappingEnabled(): boolean;
32
+ set angleSnappingEnabled(val: boolean);
33
+ get enclosedSpaces(): ICoordinatesLine[][];
34
+ private getWall;
35
+ private addWall;
36
+ private addWalls;
37
+ private updateWall;
38
+ private getWallConnectionCount;
39
+ private getWallConnectionsHydrated;
40
+ private getWallDimensions;
41
+ private getWallDetailedDimensions;
42
+ private getAllWallDimensions;
43
+ private shiftAllFeaturesOnWall;
44
+ private addFeatureToWall;
45
+ private removeFeatureFromWall;
46
+ private splitWall;
47
+ deleteWall(index: number): void;
48
+ private getFirstVacantLocation;
49
+ getWallUiAnchorPoint(index: number): undefined | ICoordinate2D;
50
+ private getVertex;
51
+ private getWallsConnectedToVertex;
52
+ private repositionVertex;
53
+ private getFeatureType;
54
+ private setFeatureType;
55
+ private getFeature;
56
+ private updateFeature;
57
+ private repositionFeature;
58
+ addFeature(type: IFeatureName, feature: Omit<IFeature, 'path' | 'connectedTo' | 'offset'> & {
59
+ offset?: number;
60
+ }, addToWallIndex?: number): void;
61
+ deleteFeature(type: IFeatureName, index: number): void;
62
+ private getHydratedFeature;
63
+ getFeatureUiAnchorPoint(type: IFeatureName, index: number): undefined | ICoordinate2D;
64
+ deleteElement(type: IElementName, index: number): void;
65
+ private getVertexInProximity;
66
+ private getWallInProximity;
67
+ private snapPointToVertex;
68
+ private snapPointToWall;
69
+ private snapPointToAbsoluteAngle;
70
+ private snapVertexToAbsoluteAngle;
71
+ private getFeatureAtPoint;
72
+ private getElementAtPoint;
73
+ getClickedElement(point: ICoordinate2D): undefined | IElementUi;
74
+ private getPointProximity;
75
+ private reevaluateFeatureConnections;
76
+ private pushStateToConfigurator;
77
+ setAttributesToState(attributes?: Record<string, IHydratedAttribute>): void;
78
+ deleteAll(): void;
79
+ private resetInternalState;
80
+ highlightElementIfInProximity(canvas: HTMLCanvasElement, point: ICoordinate2D): void;
81
+ startDrawNewWall(startPoint: ICoordinate2D): void;
82
+ drawNewWall(canvas: HTMLCanvasElement, endPoint: ICoordinate2D): void;
83
+ finishDrawNewWall(canvas: HTMLCanvasElement, assetId: string): Promise<void>;
84
+ private moveActiveVertex;
85
+ private finishMoveActiveVertex;
86
+ private moveActiveFeature;
87
+ private finishMoveActiveFeature;
88
+ selectElementIfInProximity(canvas: HTMLCanvasElement, point: ICoordinate2D): void;
89
+ moveActiveElement(canvas: HTMLCanvasElement, moveToPoint: ICoordinate2D): void;
90
+ finishMoveActiveElement(canvas: HTMLCanvasElement): void;
91
+ drawRoom(canvas: HTMLCanvasElement | null): void;
92
+ }
93
+ export default RoomBuilderState;