zakeke-configurator-react 0.0.135 → 0.0.137
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.
|
@@ -22,6 +22,24 @@ interface CurrentCompositionInfo {
|
|
|
22
22
|
compositionName: string | null;
|
|
23
23
|
compositionTags: string[] | null;
|
|
24
24
|
}
|
|
25
|
+
interface StaticTranslation {
|
|
26
|
+
original: string;
|
|
27
|
+
localization: string;
|
|
28
|
+
lcid: number;
|
|
29
|
+
}
|
|
30
|
+
interface DynamicTranslation {
|
|
31
|
+
original: string;
|
|
32
|
+
localization: string;
|
|
33
|
+
lcid: number;
|
|
34
|
+
}
|
|
35
|
+
export interface Translations {
|
|
36
|
+
statics: StaticTranslation[];
|
|
37
|
+
dynamics: DynamicTranslation[];
|
|
38
|
+
}
|
|
39
|
+
export interface PublicTranslations {
|
|
40
|
+
statics: Map<string, string>;
|
|
41
|
+
dynamics: Map<string, string>;
|
|
42
|
+
}
|
|
25
43
|
export declare class ZakekeEnvironment {
|
|
26
44
|
private token;
|
|
27
45
|
private platformAttributesSelection;
|
|
@@ -83,6 +101,8 @@ export declare class ZakekeEnvironment {
|
|
|
83
101
|
isExplodedMode: boolean;
|
|
84
102
|
isAssetsLoading: boolean;
|
|
85
103
|
extensionFields: ExtensionFields[];
|
|
104
|
+
private translations;
|
|
105
|
+
publicTranslations: PublicTranslations | null;
|
|
86
106
|
useLegacyScreenshot: boolean;
|
|
87
107
|
get isFullscreenMode(): boolean;
|
|
88
108
|
get isViewerReady(): boolean;
|
|
@@ -96,6 +116,7 @@ export declare class ZakekeEnvironment {
|
|
|
96
116
|
private getSettings;
|
|
97
117
|
private getSellerSetting;
|
|
98
118
|
createQuote: (formData: any) => Promise<any>;
|
|
119
|
+
private getTranslations;
|
|
99
120
|
private loadLocalization;
|
|
100
121
|
private loadScript;
|
|
101
122
|
setCopyrightMessageAccepted: (copyrightMandatoryCheckbox: boolean) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventMessage, FontFamily, Group, Item, OnBeforeSendDataToParent, Product, Template } from "..";
|
|
1
|
+
import { EventMessage, FontFamily, Group, Item, OnBeforeSendDataToParent, Product, PublicTranslations, Template } from "..";
|
|
2
2
|
import { FocusAttributesEventListener } from "../../../../3D/src";
|
|
3
3
|
import { Camera, Image, ImageMacroCategory, ProductQuantityRule, SellerSettings, TemplateUploadRestrictictions } from "../models";
|
|
4
4
|
import { AppState } from "./state";
|
|
@@ -56,6 +56,7 @@ export interface ProviderValue {
|
|
|
56
56
|
compositionName: string | null;
|
|
57
57
|
compositionTags: string[] | null;
|
|
58
58
|
} | null;
|
|
59
|
+
publicTranslations: PublicTranslations | null;
|
|
59
60
|
selectOption: (optionId: number) => void;
|
|
60
61
|
internalAppendViewer: (container: HTMLElement) => void;
|
|
61
62
|
designUpdate: () => void;
|
package/dist/index.js
CHANGED
|
@@ -25010,6 +25010,11 @@ class ZakekeEnvironment {
|
|
|
25010
25010
|
this.isExplodedMode = false;
|
|
25011
25011
|
this.isAssetsLoading = false;
|
|
25012
25012
|
this.extensionFields = [];
|
|
25013
|
+
this.translations = {
|
|
25014
|
+
statics: [],
|
|
25015
|
+
dynamics: []
|
|
25016
|
+
};
|
|
25017
|
+
this.publicTranslations = null;
|
|
25013
25018
|
this.useLegacyScreenshot = false;
|
|
25014
25019
|
this.eventMessages = null;
|
|
25015
25020
|
this.parseParameters = (parameters) => {
|
|
@@ -25264,6 +25269,28 @@ class ZakekeEnvironment {
|
|
|
25264
25269
|
const quoteCreated = (yield _api__WEBPACK_IMPORTED_MODULE_4__.axiosApi.post(Zakeke.config.baseApiUrl + "quotes", quote)).data;
|
|
25265
25270
|
return quoteCreated;
|
|
25266
25271
|
});
|
|
25272
|
+
this.getTranslations = () => __awaiter(this, void 0, void 0, function* () {
|
|
25273
|
+
try {
|
|
25274
|
+
var url = Zakeke.config.baseApiUrl + "SellerLocalizations/customizer-localizations";
|
|
25275
|
+
const response = yield $.ajax({
|
|
25276
|
+
url: url,
|
|
25277
|
+
data: JSON.stringify({}),
|
|
25278
|
+
method: "GET",
|
|
25279
|
+
contentType: "application/json",
|
|
25280
|
+
dataType: "json"
|
|
25281
|
+
});
|
|
25282
|
+
if (response != null) {
|
|
25283
|
+
console.log(`getTranslations response is OK: ${JSON.stringify(response)}`);
|
|
25284
|
+
return response;
|
|
25285
|
+
}
|
|
25286
|
+
else {
|
|
25287
|
+
console.log('getTranslations response is empty');
|
|
25288
|
+
}
|
|
25289
|
+
}
|
|
25290
|
+
catch (e) {
|
|
25291
|
+
console.error(e);
|
|
25292
|
+
}
|
|
25293
|
+
});
|
|
25267
25294
|
this.loadLocalization = () => __awaiter(this, void 0, void 0, function* () {
|
|
25268
25295
|
let lang = this.culture;
|
|
25269
25296
|
// Try zh-TW
|
|
@@ -25300,6 +25327,14 @@ class ZakekeEnvironment {
|
|
|
25300
25327
|
this.copyrightMessageLocalStorageKey = this.settings.userID + "_copyright_accepted";
|
|
25301
25328
|
this.eventMessages = this.settings.eventMessages.map(message => ___WEBPACK_IMPORTED_MODULE_1__.EventMessage.fromMessage(message));
|
|
25302
25329
|
this.trigger("change");
|
|
25330
|
+
this.translations = yield this.getTranslations();
|
|
25331
|
+
const staticTranslations = new Map(this.translations.statics.map(staticTranslation => [staticTranslation.original, staticTranslation.localization]));
|
|
25332
|
+
const dynamicTranslations = new Map(this.translations.dynamics.map(staticTranslation => [staticTranslation.original, staticTranslation.localization]));
|
|
25333
|
+
this.publicTranslations = {
|
|
25334
|
+
statics: staticTranslations,
|
|
25335
|
+
dynamics: dynamicTranslations
|
|
25336
|
+
};
|
|
25337
|
+
this.trigger("change");
|
|
25303
25338
|
const composerModels = yield this.getComposerModels();
|
|
25304
25339
|
this.zkScene = composerModels.get('scene');
|
|
25305
25340
|
this.zkProduct = composerModels.get('model');
|
|
@@ -28495,6 +28530,7 @@ const createProviderValue = (state, dispatch) => {
|
|
|
28495
28530
|
templates: state.environment.templates,
|
|
28496
28531
|
currentTemplate: state.environment.currentTemplate,
|
|
28497
28532
|
isViewerReady: state.environment.isViewerReady,
|
|
28533
|
+
publicTranslations: state.environment.publicTranslations,
|
|
28498
28534
|
items: state.environment.getDesignItemsInfo(),
|
|
28499
28535
|
productName: state.environment.productName,
|
|
28500
28536
|
productCode: state.environment.productCode,
|
|
@@ -30959,7 +30995,7 @@ module.exports = function spread(callback) {
|
|
|
30959
30995
|
|
|
30960
30996
|
|
|
30961
30997
|
var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
|
|
30962
|
-
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
|
|
30998
|
+
var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/axios/node_modules/is-buffer/index.js");
|
|
30963
30999
|
|
|
30964
31000
|
/*global toString:true*/
|
|
30965
31001
|
|
|
@@ -31257,6 +31293,25 @@ module.exports = {
|
|
|
31257
31293
|
|
|
31258
31294
|
/***/ }),
|
|
31259
31295
|
|
|
31296
|
+
/***/ "./node_modules/axios/node_modules/is-buffer/index.js":
|
|
31297
|
+
/*!************************************************************!*\
|
|
31298
|
+
!*** ./node_modules/axios/node_modules/is-buffer/index.js ***!
|
|
31299
|
+
\************************************************************/
|
|
31300
|
+
/***/ ((module) => {
|
|
31301
|
+
|
|
31302
|
+
/*!
|
|
31303
|
+
* Determine if an object is a Buffer
|
|
31304
|
+
*
|
|
31305
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
31306
|
+
* @license MIT
|
|
31307
|
+
*/
|
|
31308
|
+
|
|
31309
|
+
module.exports = function isBuffer(obj) {
|
|
31310
|
+
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
|
|
31311
|
+
};
|
|
31312
|
+
|
|
31313
|
+
/***/ }),
|
|
31314
|
+
|
|
31260
31315
|
/***/ "./node_modules/call-bind/callBound.js":
|
|
31261
31316
|
/*!*********************************************!*\
|
|
31262
31317
|
!*** ./node_modules/call-bind/callBound.js ***!
|
|
@@ -31460,6 +31515,8 @@ var INTRINSICS = {
|
|
|
31460
31515
|
'%AsyncIteratorPrototype%': needsEval,
|
|
31461
31516
|
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
|
31462
31517
|
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
|
31518
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
|
|
31519
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
|
|
31463
31520
|
'%Boolean%': Boolean,
|
|
31464
31521
|
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
|
31465
31522
|
'%Date%': Date,
|
|
@@ -31515,6 +31572,13 @@ var INTRINSICS = {
|
|
|
31515
31572
|
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
31516
31573
|
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
31517
31574
|
};
|
|
31575
|
+
try {
|
|
31576
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
31577
|
+
} catch (e) {
|
|
31578
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
31579
|
+
var errorProto = getProto(getProto(e));
|
|
31580
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
31581
|
+
}
|
|
31518
31582
|
var doEval = function doEval(name) {
|
|
31519
31583
|
var value;
|
|
31520
31584
|
if (name === '%AsyncFunction%') {
|
|
@@ -31822,25 +31886,6 @@ module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
|
31822
31886
|
|
|
31823
31887
|
/***/ }),
|
|
31824
31888
|
|
|
31825
|
-
/***/ "./node_modules/is-buffer/index.js":
|
|
31826
|
-
/*!*****************************************!*\
|
|
31827
|
-
!*** ./node_modules/is-buffer/index.js ***!
|
|
31828
|
-
\*****************************************/
|
|
31829
|
-
/***/ ((module) => {
|
|
31830
|
-
|
|
31831
|
-
/*!
|
|
31832
|
-
* Determine if an object is a Buffer
|
|
31833
|
-
*
|
|
31834
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
31835
|
-
* @license MIT
|
|
31836
|
-
*/
|
|
31837
|
-
|
|
31838
|
-
module.exports = function isBuffer(obj) {
|
|
31839
|
-
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
|
|
31840
|
-
};
|
|
31841
|
-
|
|
31842
|
-
/***/ }),
|
|
31843
|
-
|
|
31844
31889
|
/***/ "./node_modules/lodash/lodash.js":
|
|
31845
31890
|
/*!***************************************!*\
|
|
31846
31891
|
!*** ./node_modules/lodash/lodash.js ***!
|
|
@@ -41513,16 +41558,20 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
41513
41558
|
}
|
|
41514
41559
|
if (isMap(obj)) {
|
|
41515
41560
|
var mapParts = [];
|
|
41516
|
-
|
|
41517
|
-
|
|
41518
|
-
|
|
41561
|
+
if (mapForEach) {
|
|
41562
|
+
mapForEach.call(obj, function (value, key) {
|
|
41563
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
41564
|
+
});
|
|
41565
|
+
}
|
|
41519
41566
|
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
41520
41567
|
}
|
|
41521
41568
|
if (isSet(obj)) {
|
|
41522
41569
|
var setParts = [];
|
|
41523
|
-
|
|
41524
|
-
|
|
41525
|
-
|
|
41570
|
+
if (setForEach) {
|
|
41571
|
+
setForEach.call(obj, function (value) {
|
|
41572
|
+
setParts.push(inspect(value, obj));
|
|
41573
|
+
});
|
|
41574
|
+
}
|
|
41526
41575
|
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
41527
41576
|
}
|
|
41528
41577
|
if (isWeakMap(obj)) {
|