zakeke-configurator-react 0.0.115 → 0.0.116
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.
|
@@ -85,6 +85,7 @@ export declare class ZakekeEnvironment {
|
|
|
85
85
|
private getFonts;
|
|
86
86
|
private getSettings;
|
|
87
87
|
private getSellerSetting;
|
|
88
|
+
createQuote: (formData: any) => Promise<any>;
|
|
88
89
|
private loadScript;
|
|
89
90
|
boot: (parameters?: any) => Promise<void>;
|
|
90
91
|
appendViewer: (container: HTMLElement) => void;
|
|
@@ -58,6 +58,7 @@ export interface ProviderValue {
|
|
|
58
58
|
selectOption: (optionId: number) => void;
|
|
59
59
|
internalAppendViewer: (container: HTMLElement) => void;
|
|
60
60
|
designUpdate: () => void;
|
|
61
|
+
createQuote: (formData: any) => Promise<any>;
|
|
61
62
|
setTemplate: (templateId: number) => void;
|
|
62
63
|
isAreaVisible: (areaId: number) => boolean;
|
|
63
64
|
quantity: number;
|
package/dist/index.js
CHANGED
|
@@ -25185,6 +25185,23 @@ class ZakekeEnvironment {
|
|
|
25185
25185
|
resolve(sellerSetting);
|
|
25186
25186
|
}));
|
|
25187
25187
|
});
|
|
25188
|
+
// Create quote for composition
|
|
25189
|
+
this.createQuote = (formData) => __awaiter(this, void 0, void 0, function* () {
|
|
25190
|
+
var _c, _d;
|
|
25191
|
+
let quote = new _models__WEBPACK_IMPORTED_MODULE_10__.Quote();
|
|
25192
|
+
quote.formData = JSON.stringify(formData);
|
|
25193
|
+
quote.quantity = this.quantity;
|
|
25194
|
+
quote.compositionDocID = this.composition.get('docID');
|
|
25195
|
+
quote.modelPrice = (_c = yield this.integration.getPrice(this.composition, this.zkProduct, this.platformAttributesSelection, 0, 1)) !== null && _c !== void 0 ? _c : 0;
|
|
25196
|
+
quote.variantName = (_d = this.product.name) !== null && _d !== void 0 ? _d : "";
|
|
25197
|
+
try {
|
|
25198
|
+
const quoteCreated = (yield _api__WEBPACK_IMPORTED_MODULE_3__.axiosApi.post(Zakeke.config.baseApiUrl + "quotes", quote)).data;
|
|
25199
|
+
return quoteCreated;
|
|
25200
|
+
}
|
|
25201
|
+
catch (ex) {
|
|
25202
|
+
throw "Failed create quotation";
|
|
25203
|
+
}
|
|
25204
|
+
});
|
|
25188
25205
|
this.loadScript = (src) => __awaiter(this, void 0, void 0, function* () {
|
|
25189
25206
|
return new Promise((resolve, reject) => {
|
|
25190
25207
|
var script = document.createElement("script");
|
|
@@ -25194,7 +25211,7 @@ class ZakekeEnvironment {
|
|
|
25194
25211
|
});
|
|
25195
25212
|
});
|
|
25196
25213
|
this.boot = (parameters) => __awaiter(this, void 0, void 0, function* () {
|
|
25197
|
-
var
|
|
25214
|
+
var _e, _f;
|
|
25198
25215
|
this.parseParameters(parameters);
|
|
25199
25216
|
(0,_api__WEBPACK_IMPORTED_MODULE_3__.setupApi)(this.culture, this.token);
|
|
25200
25217
|
this.settings = yield this.getSettings();
|
|
@@ -25217,7 +25234,7 @@ class ZakekeEnvironment {
|
|
|
25217
25234
|
this.trigger("change");
|
|
25218
25235
|
this.zkTemplates = yield this.getTemplates();
|
|
25219
25236
|
this.templates = this.zkTemplates.map(zkTemplate => _models__WEBPACK_IMPORTED_MODULE_10__.Template.fromTemplate(zkTemplate));
|
|
25220
|
-
this.cameras = (
|
|
25237
|
+
this.cameras = (_f = (_e = this.zkScene) === null || _e === void 0 ? void 0 : _e.get('cameraLocations').map(x => _models__WEBPACK_IMPORTED_MODULE_10__.Camera.fromZkCamera(x))) !== null && _f !== void 0 ? _f : [];
|
|
25221
25238
|
this.trigger("change");
|
|
25222
25239
|
this.viewer = yield _3D_src__WEBPACK_IMPORTED_MODULE_2__.SceneViewer.createSceneViewerAsync();
|
|
25223
25240
|
this.viewer.addBeginAssetsLoadingListener(() => {
|
|
@@ -26250,10 +26267,10 @@ class ZakekeEnvironment {
|
|
|
26250
26267
|
})).data;
|
|
26251
26268
|
});
|
|
26252
26269
|
this.getPDF = () => __awaiter(this, void 0, void 0, function* () {
|
|
26253
|
-
var
|
|
26270
|
+
var _g;
|
|
26254
26271
|
const data = yield this.getScreenshot(2048, 2048);
|
|
26255
26272
|
const items = this.getDesignItemsInfo();
|
|
26256
|
-
const areas = (
|
|
26273
|
+
const areas = (_g = this.product) === null || _g === void 0 ? void 0 : _g.areas.filter(x => this.isAreaVisible(x.id)).map(x => ({
|
|
26257
26274
|
name: x.name,
|
|
26258
26275
|
textItems: items.filter(i => i.areaId == x.id && i.type === ___WEBPACK_IMPORTED_MODULE_1__.ItemType.Text)
|
|
26259
26276
|
})).filter(x => x.textItems.length > 0);
|
|
@@ -26294,8 +26311,8 @@ class ZakekeEnvironment {
|
|
|
26294
26311
|
this.getShareCompositionUrl = () => __awaiter(this, void 0, void 0, function* () {
|
|
26295
26312
|
// salvo (e riassegno dopo la creazione dello share url) l'id , per evitare problemi in caso di add to cart e edit
|
|
26296
26313
|
// in questo modo ogni composizione condivisa è sempre diversa da quella di partenza
|
|
26297
|
-
var
|
|
26298
|
-
const isDraft = (
|
|
26314
|
+
var _h;
|
|
26315
|
+
const isDraft = (_h = this.composition.get("isDraft")) !== null && _h !== void 0 ? _h : false;
|
|
26299
26316
|
this.composition.set("isDraft", false);
|
|
26300
26317
|
const docID = yield this.saveCompositionCopy();
|
|
26301
26318
|
this.composition.set("isDraft", isDraft);
|
|
@@ -26530,9 +26547,9 @@ class ZakekeEnvironment {
|
|
|
26530
26547
|
});
|
|
26531
26548
|
};
|
|
26532
26549
|
this.getDisableTextColors = () => __awaiter(this, void 0, void 0, function* () {
|
|
26533
|
-
var
|
|
26550
|
+
var _j, _k;
|
|
26534
26551
|
try {
|
|
26535
|
-
let disableTextColors = (
|
|
26552
|
+
let disableTextColors = (_k = (_j = this.zkProduct.get("printTypes").at(0).get("printTypeRestrictions")) === null || _j === void 0 ? void 0 : _j.get("disableTextColors")) !== null && _k !== void 0 ? _k : false;
|
|
26536
26553
|
return disableTextColors;
|
|
26537
26554
|
}
|
|
26538
26555
|
catch (ex) {
|
|
@@ -26541,9 +26558,9 @@ class ZakekeEnvironment {
|
|
|
26541
26558
|
}
|
|
26542
26559
|
});
|
|
26543
26560
|
this.getTextColors = () => __awaiter(this, void 0, void 0, function* () {
|
|
26544
|
-
var
|
|
26561
|
+
var _l, _m;
|
|
26545
26562
|
try {
|
|
26546
|
-
let textColors = (
|
|
26563
|
+
let textColors = (_m = (_l = this.zkProduct.get("printTypes").at(0).get("printTypeRestrictions")) === null || _l === void 0 ? void 0 : _l.get("textColors")) !== null && _m !== void 0 ? _m : [];
|
|
26547
26564
|
return textColors;
|
|
26548
26565
|
}
|
|
26549
26566
|
catch (ex) {
|
|
@@ -26552,9 +26569,9 @@ class ZakekeEnvironment {
|
|
|
26552
26569
|
}
|
|
26553
26570
|
});
|
|
26554
26571
|
this.getDefaultColor = () => __awaiter(this, void 0, void 0, function* () {
|
|
26555
|
-
var
|
|
26572
|
+
var _o, _p;
|
|
26556
26573
|
try {
|
|
26557
|
-
let defaultColor = (
|
|
26574
|
+
let defaultColor = (_p = (_o = this.zkProduct.get("printTypes").at(0).get("printTypeRestrictions")) === null || _o === void 0 ? void 0 : _o.get("defaultColor")) !== null && _p !== void 0 ? _p : '#000000';
|
|
26558
26575
|
return defaultColor;
|
|
26559
26576
|
}
|
|
26560
26577
|
catch (ex) {
|
|
@@ -26563,7 +26580,7 @@ class ZakekeEnvironment {
|
|
|
26563
26580
|
}
|
|
26564
26581
|
});
|
|
26565
26582
|
this.saveComposition = (customPreviewSize, legacyScreenshot) => __awaiter(this, void 0, void 0, function* () {
|
|
26566
|
-
var
|
|
26583
|
+
var _q, _r;
|
|
26567
26584
|
console.log("Saving...");
|
|
26568
26585
|
// Restore camera position
|
|
26569
26586
|
if (this.getCameraByName('buy_screenshot_camera'))
|
|
@@ -26572,7 +26589,7 @@ class ZakekeEnvironment {
|
|
|
26572
26589
|
this.viewer.restoreCameraState();
|
|
26573
26590
|
yield (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.sleep)(1);
|
|
26574
26591
|
// Save image
|
|
26575
|
-
const data = yield this.viewer.getSceneContentScreenshotAsync((
|
|
26592
|
+
const data = yield this.viewer.getSceneContentScreenshotAsync((_q = customPreviewSize === null || customPreviewSize === void 0 ? void 0 : customPreviewSize.customCartPreviewHeight) !== null && _q !== void 0 ? _q : this.previewWidth, (_r = customPreviewSize === null || customPreviewSize === void 0 ? void 0 : customPreviewSize.customCartPreviewWidth) !== null && _r !== void 0 ? _r : this.previewHeight, 0, this.zkCurrentTemplate, legacyScreenshot);
|
|
26576
26593
|
this.composition.set("previewImageData", data);
|
|
26577
26594
|
// Save composition
|
|
26578
26595
|
yield this.saveDesignBackbone();
|
|
@@ -26601,8 +26618,8 @@ class ZakekeEnvironment {
|
|
|
26601
26618
|
this.currentCompositionInfo.compositionTags = this.composition.get("tags");
|
|
26602
26619
|
});
|
|
26603
26620
|
this.loadSavedComposition = (docID) => __awaiter(this, void 0, void 0, function* () {
|
|
26604
|
-
var
|
|
26605
|
-
const composition = (
|
|
26621
|
+
var _s;
|
|
26622
|
+
const composition = (_s = this.savedCompositions) === null || _s === void 0 ? void 0 : _s.find(x => x.docID == docID);
|
|
26606
26623
|
if (composition)
|
|
26607
26624
|
yield this.bootstrapComposition(new MPlaza.Composition(composition));
|
|
26608
26625
|
});
|
|
@@ -27456,6 +27473,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27456
27473
|
/* harmony export */ "Product": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.Product),
|
|
27457
27474
|
/* harmony export */ "ProductArea": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.ProductArea),
|
|
27458
27475
|
/* harmony export */ "ProductQuantityRule": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.ProductQuantityRule),
|
|
27476
|
+
/* harmony export */ "Quote": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.Quote),
|
|
27459
27477
|
/* harmony export */ "QuoteRule": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.QuoteRule),
|
|
27460
27478
|
/* harmony export */ "Step": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.Step),
|
|
27461
27479
|
/* harmony export */ "Template": () => (/* reexport safe */ _models__WEBPACK_IMPORTED_MODULE_4__.Template),
|
|
@@ -27694,6 +27712,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
27694
27712
|
/* harmony export */ "Product": () => (/* binding */ Product),
|
|
27695
27713
|
/* harmony export */ "ProductArea": () => (/* binding */ ProductArea),
|
|
27696
27714
|
/* harmony export */ "ProductQuantityRule": () => (/* binding */ ProductQuantityRule),
|
|
27715
|
+
/* harmony export */ "Quote": () => (/* binding */ Quote),
|
|
27697
27716
|
/* harmony export */ "QuoteRule": () => (/* binding */ QuoteRule),
|
|
27698
27717
|
/* harmony export */ "Step": () => (/* binding */ Step),
|
|
27699
27718
|
/* harmony export */ "Template": () => (/* binding */ Template),
|
|
@@ -27757,6 +27776,13 @@ class QuoteRule {
|
|
|
27757
27776
|
this.products = quoteRule.products;
|
|
27758
27777
|
}
|
|
27759
27778
|
}
|
|
27779
|
+
class Quote {
|
|
27780
|
+
constructor() {
|
|
27781
|
+
this.statusID = 1;
|
|
27782
|
+
this.quantity = 1;
|
|
27783
|
+
this.modelPrice = 0;
|
|
27784
|
+
}
|
|
27785
|
+
}
|
|
27760
27786
|
class ProductArea {
|
|
27761
27787
|
static fromSide(modelSide) {
|
|
27762
27788
|
let area = new ProductArea();
|
|
@@ -28211,6 +28237,7 @@ const createProviderValue = (state, dispatch) => {
|
|
|
28211
28237
|
setQuantity: state.environment.setQuantity.bind(state.environment),
|
|
28212
28238
|
getImages: state.environment.getImages.bind(state.environment),
|
|
28213
28239
|
getMacroCategories: state.environment.getMacroCategories.bind(state.environment),
|
|
28240
|
+
createQuote: state.environment.createQuote,
|
|
28214
28241
|
previewOnly__setItemImageFromBase64: (guid, base64) => __awaiter(void 0, void 0, void 0, function* () { return dispatch({ type: 'SET_ITEM_IMAGE_FROM_BASE64', guid, base64 }); }),
|
|
28215
28242
|
setItemImageFromFile: (guid, file) => __awaiter(void 0, void 0, void 0, function* () { return dispatch({ type: 'SET_ITEM_IMAGE_FROM_FILE', guid, file }); }),
|
|
28216
28243
|
addItemImage: (imageId, areaId) => __awaiter(void 0, void 0, void 0, function* () { return dispatch({ type: 'ADD_ITEM_IMAGE', imageId, areaId }); }),
|