@threekit-tools/treble 0.0.83 → 0.0.84

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 (46) hide show
  1. package/dist/Treble/Treble.d.ts +9 -3
  2. package/dist/Treble/Treble.js +37 -7
  3. package/dist/Treble/index.d.ts +2 -2
  4. package/dist/Treble/index.js +2 -2
  5. package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
  6. package/dist/Treble/snapshots.js +247 -0
  7. package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
  8. package/dist/Treble/wishlist.js +135 -0
  9. package/dist/api/orders.d.ts +5 -7
  10. package/dist/components/AttributeValue/index.js +2 -2
  11. package/dist/components/Cards/index.d.ts +2 -1
  12. package/dist/components/Cards/index.js +3 -3
  13. package/dist/components/Dropdown/index.d.ts +2 -1
  14. package/dist/components/Dropdown/index.js +3 -3
  15. package/dist/components/FlatForm/index.js +5 -3
  16. package/dist/components/Player/index.d.ts +1 -1
  17. package/dist/components/Strips/index.d.ts +2 -1
  18. package/dist/components/Strips/index.js +3 -3
  19. package/dist/components/Swatch/index.d.ts +2 -1
  20. package/dist/components/Swatch/index.js +3 -3
  21. package/dist/components/Switch/index.d.ts +2 -1
  22. package/dist/components/Switch/index.js +2 -2
  23. package/dist/components/TextInput/index.d.ts +2 -1
  24. package/dist/components/TextInput/index.js +2 -2
  25. package/dist/components/Tiles/index.d.ts +2 -1
  26. package/dist/components/Tiles/index.js +3 -3
  27. package/dist/components/TilesGroup/index.d.ts +2 -1
  28. package/dist/components/TilesGroup/index.js +3 -3
  29. package/dist/components/Upload/index.d.ts +2 -1
  30. package/dist/components/Upload/index.js +2 -2
  31. package/dist/components/UploadArea/index.d.ts +2 -1
  32. package/dist/components/UploadArea/index.js +2 -2
  33. package/dist/components/formComponents.d.ts +12 -0
  34. package/dist/components/formComponents.js +5 -5
  35. package/dist/constants.d.ts +0 -22
  36. package/dist/constants.js +1 -23
  37. package/dist/hooks/useSingleAnimation/index.js +15 -14
  38. package/dist/http/orders.d.ts +6 -8
  39. package/dist/store/product.js +3 -1
  40. package/dist/types.d.ts +71 -24
  41. package/dist/types.js +54 -0
  42. package/dist/utils.d.ts +2 -2
  43. package/dist/utils.js +5 -4
  44. package/package.json +1 -1
  45. package/dist/Treble/Snapshots.js +0 -250
  46. package/dist/Treble/Wishlist.js +0 -136
@@ -1,136 +0,0 @@
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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
- if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
43
- }
44
- }
45
- return to.concat(ar || Array.prototype.slice.call(from));
46
- };
47
- var __importDefault = (this && this.__importDefault) || function (mod) {
48
- return (mod && mod.__esModule) ? mod : { "default": mod };
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- var api_1 = __importDefault(require("../api"));
52
- var constants_1 = require("../constants");
53
- var wishlistData;
54
- var Wishlist = (function () {
55
- function Wishlist(orgId) {
56
- var _this = this;
57
- this.getWishlist = function () { return __awaiter(_this, void 0, void 0, function () {
58
- var wishlistListStr, wishlistList, wishlistDataRaw;
59
- return __generator(this, function (_a) {
60
- switch (_a.label) {
61
- case 0:
62
- if (wishlistData)
63
- return [2, wishlistData];
64
- wishlistListStr = localStorage.getItem(this._wishlistKey);
65
- wishlistList = JSON.parse(wishlistListStr || '[]');
66
- return [4, Promise.all(wishlistList.map(function (el) { return api_1.default.configurations.fetch(el); }))];
67
- case 1:
68
- wishlistDataRaw = _a.sent();
69
- wishlistData = wishlistDataRaw.map(function (el) { return el.data; });
70
- return [2, wishlistData];
71
- }
72
- });
73
- }); };
74
- this.addItem = function () { return __awaiter(_this, void 0, void 0, function () {
75
- var thumbnails, savedConfiguration, wishlistListStr, wishlistList;
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
78
- case 0:
79
- if (!wishlistData) {
80
- wishlistData = [];
81
- localStorage.setItem(this._wishlistKey, JSON.stringify([]));
82
- }
83
- return [4, window.threekit.treble.takeSnapshots(undefined, {
84
- output: 'file',
85
- filename: 'thumbnail',
86
- })];
87
- case 1:
88
- thumbnails = (_a.sent());
89
- return [4, window.threekit.treble.saveConfiguration({
90
- attachments: { thumbnail: thumbnails[0] },
91
- })];
92
- case 2:
93
- savedConfiguration = _a.sent();
94
- if (!savedConfiguration)
95
- return [2, wishlistData];
96
- wishlistData = __spreadArray(__spreadArray([], wishlistData, true), [savedConfiguration], false);
97
- wishlistListStr = localStorage.getItem(this._wishlistKey);
98
- wishlistList = JSON.parse(wishlistListStr || '[]');
99
- wishlistList.push(savedConfiguration.shortId);
100
- localStorage.setItem(this._wishlistKey, JSON.stringify(wishlistList));
101
- return [2, this.getWishlist()];
102
- }
103
- });
104
- }); };
105
- this.removeItemByIdx = function (idx) {
106
- if (!(wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length)) {
107
- wishlistData = [];
108
- localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
109
- return wishlistData;
110
- }
111
- if (idx > (wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length) - 1)
112
- return wishlistData;
113
- var updatedWishlist = __spreadArray([], wishlistData, true);
114
- updatedWishlist.splice(idx, 1);
115
- wishlistData = updatedWishlist;
116
- var wishlistListStr = localStorage.getItem(_this._wishlistKey);
117
- var wishlistList = JSON.parse(wishlistListStr || '[]');
118
- wishlistList.splice(idx, 1);
119
- localStorage.setItem(_this._wishlistKey, JSON.stringify(wishlistList));
120
- return wishlistData;
121
- };
122
- this.clearWishlist = function () {
123
- wishlistData = [];
124
- localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
125
- return wishlistData;
126
- };
127
- this._wishlistKey = "".concat(constants_1.WISHLIST_LOCALSTORAGE_KEY, "_").concat(orgId);
128
- this.getWishlist();
129
- return this;
130
- }
131
- return Wishlist;
132
- }());
133
- function createWishlist(orgId) {
134
- return new Wishlist(orgId);
135
- }
136
- exports.default = createWishlist;