@threekit-tools/treble 0.0.82 → 0.0.83

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 (83) hide show
  1. package/dist/Treble/Snapshots.js +31 -32
  2. package/dist/Treble/Treble.js +3 -4
  3. package/dist/Treble/Wishlist.js +8 -8
  4. package/dist/api/catalog.js +6 -6
  5. package/dist/api/configurations.js +3 -3
  6. package/dist/api/datatables.js +5 -5
  7. package/dist/api/orders.js +12 -12
  8. package/dist/api/price.js +2 -2
  9. package/dist/api/products.js +2 -2
  10. package/dist/components/Accordion/index.js +1 -6
  11. package/dist/components/AttributeTitle/index.d.ts +0 -9
  12. package/dist/components/AttributeTitle/index.js +0 -9
  13. package/dist/components/AttributeValue/index.d.ts +0 -6
  14. package/dist/components/AttributeValue/index.js +0 -6
  15. package/dist/components/Button/index.d.ts +0 -27
  16. package/dist/components/Button/index.js +0 -27
  17. package/dist/components/Cards/index.d.ts +0 -54
  18. package/dist/components/Cards/index.js +0 -57
  19. package/dist/components/Drawer/index.js +0 -13
  20. package/dist/components/Dropdown/index.d.ts +0 -58
  21. package/dist/components/Dropdown/index.js +1 -66
  22. package/dist/components/FlatForm/index.d.ts +0 -21
  23. package/dist/components/FlatForm/index.js +0 -21
  24. package/dist/components/Modal/index.js +0 -13
  25. package/dist/components/PortalToElement/index.js +0 -8
  26. package/dist/components/ProductDescription/index.d.ts +0 -6
  27. package/dist/components/ProductDescription/index.js +0 -6
  28. package/dist/components/ProductName/index.d.ts +0 -9
  29. package/dist/components/ProductName/index.js +0 -9
  30. package/dist/components/Share/index.d.ts +0 -12
  31. package/dist/components/Share/index.js +0 -12
  32. package/dist/components/Snapshots/index.d.ts +0 -8
  33. package/dist/components/Snapshots/index.js +0 -8
  34. package/dist/components/Strips/index.d.ts +0 -54
  35. package/dist/components/Strips/index.js +0 -57
  36. package/dist/components/Swatch/index.d.ts +0 -63
  37. package/dist/components/Swatch/index.js +0 -66
  38. package/dist/components/Switch/index.d.ts +0 -33
  39. package/dist/components/Switch/index.js +0 -36
  40. package/dist/components/TextInput/index.js +0 -1
  41. package/dist/components/Tiles/index.d.ts +0 -28
  42. package/dist/components/Tiles/index.js +0 -30
  43. package/dist/components/TilesGroup/index.d.ts +0 -25
  44. package/dist/components/TilesGroup/index.js +0 -27
  45. package/dist/components/TotalPrice/index.d.ts +0 -6
  46. package/dist/components/TotalPrice/index.js +0 -6
  47. package/dist/components/Upload/index.js +5 -6
  48. package/dist/components/UploadArea/index.js +4 -5
  49. package/dist/components/Wishlist/index.d.ts +1 -4
  50. package/dist/components/Wishlist/index.js +2 -5
  51. package/dist/components/Zoom/index.d.ts +1 -18
  52. package/dist/components/Zoom/index.js +0 -17
  53. package/dist/components/formComponents.js +0 -2
  54. package/dist/components/message/index.d.ts +0 -9
  55. package/dist/components/message/index.js +0 -9
  56. package/dist/connection.js +2 -2
  57. package/dist/constants.d.ts +0 -27
  58. package/dist/constants.js +0 -36
  59. package/dist/hooks/useAttribute/index.js +6 -6
  60. package/dist/hooks/useConfigurationLoader/index.js +5 -5
  61. package/dist/hooks/useNestedConfigurator/index.js +2 -2
  62. package/dist/hooks/useShare/index.js +3 -3
  63. package/dist/hooks/useSingleAnimation/index.js +5 -11
  64. package/dist/http/datatables.js +0 -1
  65. package/dist/icons/index.d.ts +0 -41
  66. package/dist/icons/index.js +0 -42
  67. package/dist/index.d.ts +42 -3
  68. package/dist/index.js +84 -30
  69. package/dist/store/attributes.d.ts +0 -12
  70. package/dist/store/attributes.js +2 -15
  71. package/dist/store/price.d.ts +0 -12
  72. package/dist/store/price.js +2 -16
  73. package/dist/store/product.d.ts +2 -17
  74. package/dist/store/product.js +23 -37
  75. package/dist/store/translations.d.ts +0 -12
  76. package/dist/store/translations.js +2 -12
  77. package/dist/store/treble.d.ts +0 -15
  78. package/dist/store/treble.js +31 -66
  79. package/dist/store/wishlist.d.ts +0 -12
  80. package/dist/store/wishlist.js +4 -17
  81. package/dist/types.d.ts +0 -34
  82. package/dist/utils.js +3 -12
  83. package/package.json +16 -4
package/dist/types.d.ts CHANGED
@@ -7,9 +7,6 @@ export declare type DISPLAY_OPTIONS = 'webgl' | 'image';
7
7
  export declare type IAttributeTypes = 'String' | 'Asset' | 'Color' | 'Number' | 'Boolean';
8
8
  export declare type AssetType = 'upload' | 'item';
9
9
  export declare type IMetadata = Record<string, string | number | null>;
10
- /***************************************************
11
- * Scene
12
- **************************************************/
13
10
  export interface ISceneQuery {
14
11
  all?: boolean;
15
12
  id?: string;
@@ -41,9 +38,6 @@ export interface ISceneResult {
41
38
  name: string;
42
39
  configurator: IThreekitPrivateConfigurator;
43
40
  }
44
- /***************************************************
45
- * Configuration
46
- **************************************************/
47
41
  export interface IConfigurationAsset {
48
42
  assetId: string;
49
43
  configuration?: string;
@@ -57,11 +51,6 @@ export interface IConfigurationColor {
57
51
  export declare type IConfigurationAttribute = IConfigurationAsset | IConfigurationColor | string | number | boolean | undefined;
58
52
  export declare type IConfiguration = Record<string, IConfigurationAttribute>;
59
53
  export declare type ISetConfiguration = Record<string, IConfigurationAttribute>;
60
- /***************************************************
61
- * ATTRIBUTES
62
- *
63
- * This section covers both getAttributes() and getDisplayAttributes()
64
- **************************************************/
65
54
  interface IDisplayAttributeConfig {
66
55
  includeHidden?: boolean;
67
56
  }
@@ -72,7 +61,6 @@ interface IAttributeBase<T extends IAttributeTypes, V extends IConfigurationAttr
72
61
  value: V;
73
62
  label: string;
74
63
  }
75
- /****** ASSET TYPE ATTRIBUTE *******/
76
64
  export interface IConfigurationAssetValue {
77
65
  assetId: string;
78
66
  name: string;
@@ -101,7 +89,6 @@ export interface IAttributeAssetBase<V> extends IAttributeBase<'Asset', IConfigu
101
89
  export declare type IDisplayAttributeAsset = IAttributeAssetBase<IDisplayAttributeAssetValue>;
102
90
  export declare type IHydratedAttributeAsset = IAttributeAssetBase<IHydratedAttributeAssetValue>;
103
91
  export declare type IAttributeAsset = IAttributeAssetBase<IConfigurationAssetValue>;
104
- /****** String TYPE ATTRIBUTE *******/
105
92
  export interface IDisplayAttributeStringValue {
106
93
  label: string;
107
94
  value: string;
@@ -120,11 +107,9 @@ export interface IAttributeStringBase<V> extends IAttributeBase<'String', string
120
107
  export declare type IDisplayAttributeString = IAttributeStringBase<IDisplayAttributeStringValue>;
121
108
  export declare type IHydratedAttributeString = IAttributeStringBase<IHydratedAttributeStringValue>;
122
109
  export declare type IAttributeString = IAttributeStringBase<string>;
123
- /****** STRING TYPE ATTRIBUTE *******/
124
110
  export interface IAttributeColor extends IAttributeBase<'Color', IConfigurationColor> {
125
111
  defaultValue: IConfigurationColor;
126
112
  }
127
- /****** NUMBER TYPE ATTRIBUTE *******/
128
113
  export interface IAttributeNumber extends IAttributeBase<'Number', number> {
129
114
  defaultValue: number;
130
115
  lockToStep: boolean;
@@ -132,19 +117,12 @@ export interface IAttributeNumber extends IAttributeBase<'Number', number> {
132
117
  min?: number;
133
118
  step: number;
134
119
  }
135
- /****** NUMBER TYPE ATTRIBUTE *******/
136
120
  export interface IAttributeBoolean extends IAttributeBase<'Boolean', boolean> {
137
121
  defaultValue: boolean;
138
122
  }
139
- /****** getAttributes() *******/
140
123
  export declare type IThreekitAttribute = IAttributeAsset | IAttributeColor | IAttributeString | IAttributeNumber | IAttributeBoolean;
141
- /****** getDisplayAttributes() *******/
142
124
  export declare type IThreekitDisplayAttribute = IDisplayAttributeAsset | IDisplayAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
143
- /****** Treble Hydrated Values *******/
144
125
  export declare type IHydratedAttribute = IHydratedAttributeAsset | IHydratedAttributeString | IAttributeColor | IAttributeNumber | IAttributeBoolean;
145
- /***************************************************
146
- * Camera
147
- **************************************************/
148
126
  export interface ICoordinates {
149
127
  x: number;
150
128
  y: number;
@@ -161,9 +139,6 @@ export interface ISnapshotConfig {
161
139
  };
162
140
  }
163
141
  export declare type SNAPSHOT_FORMAT_TYPES = 'jpg' | 'png';
164
- /***************************************************
165
- * Tools
166
- **************************************************/
167
142
  export interface Node {
168
143
  name: string;
169
144
  nodeId: string;
@@ -211,9 +186,6 @@ export interface IThreekitTools {
211
186
  setTool: () => void;
212
187
  setTools: () => void;
213
188
  }
214
- /***************************************************
215
- * Threekit Api
216
- **************************************************/
217
189
  export interface IConfigurationChangeEvent {
218
190
  name: string;
219
191
  appliedConfiguration: Record<string, string>;
@@ -305,9 +277,6 @@ export interface ThreekitInitConfig {
305
277
  help?: string;
306
278
  };
307
279
  }
308
- /***************************************************
309
- * Treble Declarations
310
- **************************************************/
311
280
  export interface IFrameworkConfig {
312
281
  productsCtx: __WebpackModuleApi.RequireContext;
313
282
  }
@@ -337,9 +306,6 @@ export interface ITrebleConfig {
337
306
  treble: IFrameworkConfig;
338
307
  player: IPlayerConfig;
339
308
  }
340
- /***************************************************
341
- * Global Declaration
342
- **************************************************/
343
309
  declare global {
344
310
  interface Window {
345
311
  threekitPlayer: (arg0: ThreekitInitConfig) => Promise<IThreekitPlayer>;
package/dist/utils.js CHANGED
@@ -143,35 +143,26 @@ var shallowCompare = function (value1, value2) {
143
143
  };
144
144
  exports.shallowCompare = shallowCompare;
145
145
  var deepCompare = function (item1, item2) {
146
- // Are the items the same type
147
146
  if (typeof item1 !== typeof item2)
148
147
  return false;
149
- // If that type is Array we deepCompare each item
150
- // against its counter part
151
- // The same arrays in different orders will fail this check
152
148
  else if (Array.isArray(item1)) {
153
149
  if (item1.length !== item2.length)
154
150
  return false;
155
151
  for (var i = 0; i < item1.length; i++)
156
152
  if (!(0, exports.deepCompare)(item1[i], item2[i]))
157
153
  return false;
158
- // If they're objects...
159
154
  }
160
155
  else if (isObject(item1)) {
161
156
  var keys1 = Object.keys(item1);
162
157
  var keys2 = Object.keys(item2);
163
- // We makre sure they have the same keys...
164
158
  if (keys1.length !== keys2.length) {
165
159
  return false;
166
160
  }
167
- // and then deep compare each value
168
161
  for (var _i = 0, keys1_2 = keys1; _i < keys1_2.length; _i++) {
169
162
  var key = keys1_2[_i];
170
163
  if (!(0, exports.deepCompare)(item1[key], item2[key]))
171
164
  return false;
172
165
  }
173
- // This leaves us with literals that can be
174
- // compared directly
175
166
  }
176
167
  else if (item1 !== item2)
177
168
  return false;
@@ -280,7 +271,7 @@ var downloadSnapshot = function (snapshot, filename) { return __awaiter(void 0,
280
271
  link.addEventListener('click', clickHandler);
281
272
  document.body.appendChild(link);
282
273
  link.click();
283
- return [2 /*return*/];
274
+ return [2];
284
275
  });
285
276
  }); };
286
277
  exports.downloadSnapshot = downloadSnapshot;
@@ -409,12 +400,12 @@ var runDebugger = function () { return __awaiter(void 0, void 0, void 0, functio
409
400
  var logs;
410
401
  return __generator(this, function (_a) {
411
402
  switch (_a.label) {
412
- case 0: return [4 /*yield*/, window.threekit.treble._player.calculateLogs()];
403
+ case 0: return [4, window.threekit.treble._player.calculateLogs()];
413
404
  case 1:
414
405
  logs = _a.sent();
415
406
  if (logs.length)
416
407
  console.log("Threekit Debugger: \n", logs);
417
- return [2 /*return*/];
408
+ return [2];
418
409
  }
419
410
  });
420
411
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.82",
3
+ "version": "0.0.83",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -23,15 +23,23 @@
23
23
  },
24
24
  "scripts": {
25
25
  "start": "tsc --watch",
26
- "build": "tsc",
26
+ "build": "npm run clean && tsc",
27
27
  "clean": "rimraf dist",
28
+ "esbuild": "npm run clean && node build.js && tsc --emitDeclarationOnly --outDir dist",
28
29
  "storybook": "start-storybook -p 6006",
29
30
  "build-storybook": "build-storybook -o build",
30
31
  "lint": "eslint ./src",
32
+ "lint-staged": "lint-staged",
31
33
  "check-format": "prettier -c ./src",
32
34
  "format": "prettier --write ./src",
33
35
  "test": "jest"
34
36
  },
37
+ "lint-staged": {
38
+ "./src/**/*.{css,less,scss,html,json,jsx,js,tsx,ts}": [
39
+ "prettier --write ./src"
40
+ ],
41
+ "./src": "eslint ./src --fix"
42
+ },
35
43
  "dependencies": {
36
44
  "@reduxjs/toolkit": "^1.6.2",
37
45
  "axios": "^0.22.0",
@@ -61,14 +69,18 @@
61
69
  "babel-jest": "^27.5.1",
62
70
  "babel-loader": "^8.2.2",
63
71
  "chromatic": "^6.5.3",
72
+ "esbuild": "^0.14.48",
64
73
  "jest": "^27.5.1",
65
- "react": ">=17.0.2",
66
- "react-dom": ">=17.0.2",
74
+ "lint-staged": "^13.0.3",
67
75
  "rimraf": "^3.0.2",
68
76
  "serve": "^12.0.1",
69
77
  "themeprovider-storybook": "^1.8.0",
70
78
  "ts-jest": "^27.1.3",
71
79
  "typescript": ">=4.4.4"
72
80
  },
81
+ "peerDependencies": {
82
+ "react": ">=17.0.2",
83
+ "react-dom": ">=17.0.2"
84
+ },
73
85
  "gitHead": "2e16bcf98f81e16bb1768072fdb3968122e7966f"
74
86
  }