zakeke-configurator-react 0.0.55 → 0.0.59
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.
- package/dist/declarations/composer/Module/src/environment.d.ts +4 -4
- package/dist/declarations/composer/Module/src/state/boot.d.ts +3 -4
- package/dist/declarations/composer/Module/src/state/provider.d.ts +7 -2
- package/dist/declarations/composer/Module/src/state/providerValue.d.ts +1 -1
- package/dist/index.js +124 -64
- package/package.json +1 -1
|
@@ -98,7 +98,7 @@ export declare class ZakekeEnvironment {
|
|
|
98
98
|
selectOption: (optionId: number) => void;
|
|
99
99
|
focusGroup: (groupId: number) => void;
|
|
100
100
|
focusAttribute: (attributeId: number) => Promise<void>;
|
|
101
|
-
setCamera(cameraLocationId: string): void;
|
|
101
|
+
setCamera(cameraLocationId: string, onlyAngleOfView?: boolean, animate?: boolean): void;
|
|
102
102
|
getCameraByName(name: string): Zakeke.SceneCameraLocation | undefined;
|
|
103
103
|
setCameraLocation(name: string, animate?: boolean): void;
|
|
104
104
|
addToCart: (additionalProperties: Record<string, any>) => Promise<void>;
|
|
@@ -113,7 +113,7 @@ export declare class ZakekeEnvironment {
|
|
|
113
113
|
hasExplodedMode: () => boolean;
|
|
114
114
|
setBackgroundColor: (color: string) => void;
|
|
115
115
|
getCurrentSelection: () => PlatformAttributeSelection[];
|
|
116
|
-
getScreenshot: (width?: number, height?: number) => Promise<string
|
|
116
|
+
getScreenshot: (width?: number, height?: number, backgroundColor?: string | null) => Promise<string>;
|
|
117
117
|
private fireItemsChange;
|
|
118
118
|
isAreaVisible(areaId: number): boolean;
|
|
119
119
|
removeItem: (guid: string) => Promise<void>;
|
|
@@ -137,11 +137,11 @@ export declare class ZakekeEnvironment {
|
|
|
137
137
|
setCameraPivot(meshID: string): void;
|
|
138
138
|
resetCameraPivot(): void;
|
|
139
139
|
setCameraZoomEnabled(enabled: boolean): void;
|
|
140
|
-
setCameraByName(name: string): void;
|
|
140
|
+
setCameraByName(name: string, onlyAngleOfView?: boolean, animate?: boolean): void;
|
|
141
141
|
findObjectByName(name: string): BABYLON.AbstractMesh | null | undefined;
|
|
142
142
|
getPDF: () => Promise<string>;
|
|
143
143
|
private rewriteShareUrl;
|
|
144
|
-
getOnlineScreenshot: (width: number, height: number) => Promise<string>;
|
|
144
|
+
getOnlineScreenshot: (width: number, height: number, backgroundColor?: string | undefined) => Promise<string>;
|
|
145
145
|
private buildModelViewerUrl;
|
|
146
146
|
isSceneArEnabled: () => boolean;
|
|
147
147
|
private getPregeneratedARUrl;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default boot;
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
declare const Boot: FC<{}>;
|
|
3
|
+
export default Boot;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { Dispatch, FunctionComponent } from "react";
|
|
1
2
|
import { ZakekeEnvironment } from "../environment";
|
|
2
|
-
import { FunctionComponent } from "react";
|
|
3
3
|
import { ProviderValue } from "./providerValue";
|
|
4
|
+
import { AppState } from "./state";
|
|
4
5
|
declare const useZakeke: () => ProviderValue;
|
|
6
|
+
declare const useInternalState: () => {
|
|
7
|
+
state: AppState;
|
|
8
|
+
dispatch: Dispatch<any>;
|
|
9
|
+
};
|
|
5
10
|
declare const ZakekeProvider: FunctionComponent<{
|
|
6
11
|
environment: ZakekeEnvironment;
|
|
7
12
|
}>;
|
|
8
|
-
export { useZakeke, ZakekeProvider };
|
|
13
|
+
export { useZakeke, useInternalState, ZakekeProvider };
|
|
@@ -29,7 +29,7 @@ export interface ProviderValue {
|
|
|
29
29
|
loadComposition: (id: string) => Promise<void>;
|
|
30
30
|
addToCart: (additionalProperties: Record<string, any>) => Promise<void>;
|
|
31
31
|
getPDF: () => Promise<string>;
|
|
32
|
-
getOnlineScreenshot: (width: number, height: number) => Promise<string>;
|
|
32
|
+
getOnlineScreenshot: (width: number, height: number, backgroundColor?: string) => Promise<string>;
|
|
33
33
|
setCamera: (id: string) => void;
|
|
34
34
|
setCameraByName: (name: string) => void;
|
|
35
35
|
setCameraZoomEnabled: (enabled: boolean) => void;
|
package/dist/index.js
CHANGED
|
@@ -42224,12 +42224,42 @@ var ZakekeEnvironment = /** @class */ (function () {
|
|
|
42224
42224
|
this.getCurrentSelection = function () {
|
|
42225
42225
|
return lodash__WEBPACK_IMPORTED_MODULE_7___default.a.cloneDeep(_this.platformAttributesSelection);
|
|
42226
42226
|
};
|
|
42227
|
-
this.getScreenshot = function (width, height) {
|
|
42227
|
+
this.getScreenshot = function (width, height, backgroundColor) {
|
|
42228
42228
|
if (width === void 0) { width = 1024; }
|
|
42229
42229
|
if (height === void 0) { height = 1024; }
|
|
42230
|
+
if (backgroundColor === void 0) { backgroundColor = null; }
|
|
42230
42231
|
return __awaiter(_this, void 0, void 0, function () {
|
|
42232
|
+
var url;
|
|
42231
42233
|
return __generator(this, function (_a) {
|
|
42232
|
-
|
|
42234
|
+
switch (_a.label) {
|
|
42235
|
+
case 0: return [4 /*yield*/, this.viewer.getSceneContentScreenshotAsync(width, height)];
|
|
42236
|
+
case 1:
|
|
42237
|
+
url = _a.sent();
|
|
42238
|
+
if (!url)
|
|
42239
|
+
throw new Error('Failed generating screenshot');
|
|
42240
|
+
if (!backgroundColor) return [3 /*break*/, 3];
|
|
42241
|
+
return [4 /*yield*/, new Promise(function (resolve) {
|
|
42242
|
+
var img = new Image();
|
|
42243
|
+
img.onload = function () {
|
|
42244
|
+
var canvas = document.createElement("canvas");
|
|
42245
|
+
canvas.width = img.width;
|
|
42246
|
+
canvas.height = img.height;
|
|
42247
|
+
var ctx = canvas.getContext("2d");
|
|
42248
|
+
if (ctx) {
|
|
42249
|
+
ctx.fillStyle = backgroundColor;
|
|
42250
|
+
ctx.fillRect(0, 0, img.width, img.height);
|
|
42251
|
+
ctx.drawImage(img, 0, 0);
|
|
42252
|
+
url = canvas.toDataURL();
|
|
42253
|
+
resolve();
|
|
42254
|
+
}
|
|
42255
|
+
};
|
|
42256
|
+
img.src = url;
|
|
42257
|
+
})];
|
|
42258
|
+
case 2:
|
|
42259
|
+
_a.sent();
|
|
42260
|
+
_a.label = 3;
|
|
42261
|
+
case 3: return [2 /*return*/, url];
|
|
42262
|
+
}
|
|
42233
42263
|
});
|
|
42234
42264
|
});
|
|
42235
42265
|
};
|
|
@@ -42455,19 +42485,28 @@ var ZakekeEnvironment = /** @class */ (function () {
|
|
|
42455
42485
|
});
|
|
42456
42486
|
}); };
|
|
42457
42487
|
this.getPDF = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
42458
|
-
var data, pdf;
|
|
42488
|
+
var data, params, pdf;
|
|
42459
42489
|
return __generator(this, function (_a) {
|
|
42460
42490
|
switch (_a.label) {
|
|
42461
42491
|
case 0: return [4 /*yield*/, this.getScreenshot(2048, 2048)];
|
|
42462
42492
|
case 1:
|
|
42463
42493
|
data = _a.sent();
|
|
42464
|
-
|
|
42465
|
-
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
-
|
|
42469
|
-
|
|
42470
|
-
|
|
42494
|
+
params = {
|
|
42495
|
+
environment: 2,
|
|
42496
|
+
productName: this.zkProduct.get('name'),
|
|
42497
|
+
sides: [],
|
|
42498
|
+
previewImage: data,
|
|
42499
|
+
selectedOptions: this.platformAttributesSelection.filter(function (x) { return x.attributeIsEnabled && x.attributeIsEnabled; }).map(function (_a) {
|
|
42500
|
+
var attributeLabel = _a.attributeLabel, attributeCode = _a.attributeCode, optionCode = _a.optionCode, optionLabel = _a.optionLabel;
|
|
42501
|
+
return ({
|
|
42502
|
+
attributeLabel: attributeLabel,
|
|
42503
|
+
attributeCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["isPlatformCode"])(attributeCode) ? attributeCode : '',
|
|
42504
|
+
optionLabel: optionLabel,
|
|
42505
|
+
optionCode: !Object(_helpers__WEBPACK_IMPORTED_MODULE_0__["isPlatformCode"])(optionCode) ? optionCode : '',
|
|
42506
|
+
});
|
|
42507
|
+
})
|
|
42508
|
+
};
|
|
42509
|
+
return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + "previewdesigns/pdf", params, {
|
|
42471
42510
|
transformResponse: function (res) { return res; },
|
|
42472
42511
|
responseType: "text"
|
|
42473
42512
|
})];
|
|
@@ -42491,11 +42530,11 @@ var ZakekeEnvironment = /** @class */ (function () {
|
|
|
42491
42530
|
}
|
|
42492
42531
|
return url;
|
|
42493
42532
|
};
|
|
42494
|
-
this.getOnlineScreenshot = function (width, height) { return __awaiter(_this, void 0, void 0, function () {
|
|
42533
|
+
this.getOnlineScreenshot = function (width, height, backgroundColor) { return __awaiter(_this, void 0, void 0, function () {
|
|
42495
42534
|
var preview, url;
|
|
42496
42535
|
return __generator(this, function (_a) {
|
|
42497
42536
|
switch (_a.label) {
|
|
42498
|
-
case 0: return [4 /*yield*/, this.getScreenshot(width, height)];
|
|
42537
|
+
case 0: return [4 /*yield*/, this.getScreenshot(width, height, backgroundColor)];
|
|
42499
42538
|
case 1:
|
|
42500
42539
|
preview = _a.sent();
|
|
42501
42540
|
return [4 /*yield*/, _api__WEBPACK_IMPORTED_MODULE_6__["axiosApi"].post(Zakeke.config.baseApiUrl + "designs/save-share-preview", { preview: preview })];
|
|
@@ -42790,8 +42829,8 @@ var ZakekeEnvironment = /** @class */ (function () {
|
|
|
42790
42829
|
step.attributes.sort(function (a, b) { return a.displayOrder - b.displayOrder; });
|
|
42791
42830
|
return step;
|
|
42792
42831
|
};
|
|
42793
|
-
ZakekeEnvironment.prototype.setCamera = function (cameraLocationId) {
|
|
42794
|
-
this.viewer.setCameraLocation(cameraLocationId);
|
|
42832
|
+
ZakekeEnvironment.prototype.setCamera = function (cameraLocationId, onlyAngleOfView, animate) {
|
|
42833
|
+
this.viewer.setCameraLocation(cameraLocationId, onlyAngleOfView, animate);
|
|
42795
42834
|
};
|
|
42796
42835
|
ZakekeEnvironment.prototype.getCameraByName = function (name) {
|
|
42797
42836
|
var _a;
|
|
@@ -42847,11 +42886,11 @@ var ZakekeEnvironment = /** @class */ (function () {
|
|
|
42847
42886
|
ZakekeEnvironment.prototype.setCameraZoomEnabled = function (enabled) {
|
|
42848
42887
|
this.viewer.setCameraZoomEnabled(enabled);
|
|
42849
42888
|
};
|
|
42850
|
-
ZakekeEnvironment.prototype.setCameraByName = function (name) {
|
|
42889
|
+
ZakekeEnvironment.prototype.setCameraByName = function (name, onlyAngleOfView, animate) {
|
|
42851
42890
|
if (this.zkScene) {
|
|
42852
42891
|
var location_1 = this.zkScene.get("cameraLocations").find(function (x) { return x.get("name") == name; });
|
|
42853
42892
|
if (location_1)
|
|
42854
|
-
this.viewer.setCameraLocation(location_1.get("locationID"));
|
|
42893
|
+
this.viewer.setCameraLocation(location_1.get("locationID"), onlyAngleOfView, animate);
|
|
42855
42894
|
}
|
|
42856
42895
|
};
|
|
42857
42896
|
ZakekeEnvironment.prototype.findObjectByName = function (name) {
|
|
@@ -43646,7 +43685,7 @@ var ImageUploadTask = /** @class */ (function () {
|
|
|
43646
43685
|
/*!***********************!*\
|
|
43647
43686
|
!*** ./src/index.tsx ***!
|
|
43648
43687
|
\***********************/
|
|
43649
|
-
/*! exports provided: ZakekeEnvironment, ZakekeViewer, ZakekeDesigner, useZakeke, ZakekeProvider, Platform, PlatformPriceType, User, Product, ProductArea, ProductQuantityRule, Variant, ZakekeEvent, TemplateConstraints, TemplateArea, Template, TextItem, ImageItem, PlatformSettings, EventMessageType, Camera, Group, Step, AttributeType, AttributeOptionShapeType, Attribute, Option */
|
|
43688
|
+
/*! exports provided: ZakekeEnvironment, ZakekeViewer, ZakekeDesigner, useZakeke, useInternalState, ZakekeProvider, Platform, PlatformPriceType, User, Product, ProductArea, ProductQuantityRule, Variant, ZakekeEvent, TemplateConstraints, TemplateArea, Template, TextItem, ImageItem, PlatformSettings, EventMessageType, Camera, Group, Step, AttributeType, AttributeOptionShapeType, Attribute, Option */
|
|
43650
43689
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43651
43690
|
|
|
43652
43691
|
"use strict";
|
|
@@ -43663,6 +43702,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
43663
43702
|
/* harmony import */ var _state_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state/provider */ "./src/state/provider.tsx");
|
|
43664
43703
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useZakeke", function() { return _state_provider__WEBPACK_IMPORTED_MODULE_3__["useZakeke"]; });
|
|
43665
43704
|
|
|
43705
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useInternalState", function() { return _state_provider__WEBPACK_IMPORTED_MODULE_3__["useInternalState"]; });
|
|
43706
|
+
|
|
43666
43707
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ZakekeProvider", function() { return _state_provider__WEBPACK_IMPORTED_MODULE_3__["ZakekeProvider"]; });
|
|
43667
43708
|
|
|
43668
43709
|
/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models */ "./src/models.ts");
|
|
@@ -44226,10 +44267,10 @@ var Option = /** @class */ (function () {
|
|
|
44226
44267
|
|
|
44227
44268
|
/***/ }),
|
|
44228
44269
|
|
|
44229
|
-
/***/ "./src/state/boot.
|
|
44230
|
-
|
|
44231
|
-
!*** ./src/state/boot.
|
|
44232
|
-
|
|
44270
|
+
/***/ "./src/state/boot.tsx":
|
|
44271
|
+
/*!****************************!*\
|
|
44272
|
+
!*** ./src/state/boot.tsx ***!
|
|
44273
|
+
\****************************/
|
|
44233
44274
|
/*! exports provided: default */
|
|
44234
44275
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
44235
44276
|
|
|
@@ -44237,6 +44278,9 @@ var Option = /** @class */ (function () {
|
|
|
44237
44278
|
__webpack_require__.r(__webpack_exports__);
|
|
44238
44279
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! qs */ "./node_modules/qs/lib/index.js");
|
|
44239
44280
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_0__);
|
|
44281
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
|
|
44282
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
44283
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! .. */ "./src/index.tsx");
|
|
44240
44284
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
44241
44285
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
44242
44286
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -44274,46 +44318,54 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
44274
44318
|
}
|
|
44275
44319
|
};
|
|
44276
44320
|
|
|
44321
|
+
|
|
44322
|
+
|
|
44277
44323
|
// Handle boot when provider is ready
|
|
44278
|
-
var
|
|
44279
|
-
var
|
|
44280
|
-
|
|
44281
|
-
|
|
44282
|
-
|
|
44283
|
-
|
|
44284
|
-
|
|
44285
|
-
|
|
44286
|
-
|
|
44287
|
-
|
|
44288
|
-
|
|
44289
|
-
|
|
44290
|
-
|
|
44291
|
-
|
|
44292
|
-
|
|
44293
|
-
|
|
44294
|
-
|
|
44295
|
-
|
|
44296
|
-
|
|
44297
|
-
|
|
44298
|
-
|
|
44299
|
-
|
|
44300
|
-
|
|
44301
|
-
|
|
44302
|
-
|
|
44303
|
-
|
|
44304
|
-
|
|
44305
|
-
|
|
44306
|
-
|
|
44324
|
+
var Boot = function (_a) {
|
|
44325
|
+
var children = _a.children;
|
|
44326
|
+
var internalState = Object(___WEBPACK_IMPORTED_MODULE_2__["useInternalState"])();
|
|
44327
|
+
var stateRef = Object(react__WEBPACK_IMPORTED_MODULE_1__["useRef"])(internalState);
|
|
44328
|
+
stateRef.current = internalState;
|
|
44329
|
+
var boot = Object(react__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (parameters) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44330
|
+
var _a, _b, _c, _d;
|
|
44331
|
+
return __generator(this, function (_e) {
|
|
44332
|
+
switch (_e.label) {
|
|
44333
|
+
case 0:
|
|
44334
|
+
(_a = stateRef.current) === null || _a === void 0 ? void 0 : _a.dispatch({ type: 'IS_SCENE_LOADING', isLoading: true });
|
|
44335
|
+
// Register to environment changes
|
|
44336
|
+
(_b = stateRef.current) === null || _b === void 0 ? void 0 : _b.state.environment.on('change', function () { var _a; return (_a = stateRef.current) === null || _a === void 0 ? void 0 : _a.dispatch({ type: 'UPDATE' }); });
|
|
44337
|
+
return [4 /*yield*/, ((_c = stateRef.current) === null || _c === void 0 ? void 0 : _c.state.environment.boot(parameters))];
|
|
44338
|
+
case 1:
|
|
44339
|
+
_e.sent();
|
|
44340
|
+
(_d = stateRef.current) === null || _d === void 0 ? void 0 : _d.dispatch({ type: 'IS_SCENE_LOADING', isLoading: false });
|
|
44341
|
+
return [2 /*return*/];
|
|
44342
|
+
}
|
|
44343
|
+
});
|
|
44344
|
+
}); }, []);
|
|
44345
|
+
var handleMessageReceived = Object(react__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44346
|
+
var _a, _b;
|
|
44347
|
+
return __generator(this, function (_c) {
|
|
44348
|
+
if (e.data.type == "load" && !((_a = stateRef.current) === null || _a === void 0 ? void 0 : _a.state.parametersReceived)) {
|
|
44349
|
+
(_b = stateRef.current) === null || _b === void 0 ? void 0 : _b.dispatch({ type: 'PARAMETERS_RECEIVED' });
|
|
44350
|
+
boot(e.data.parameters);
|
|
44351
|
+
window.parent.postMessage({ zakekeType: "loaded" }, "*");
|
|
44352
|
+
}
|
|
44353
|
+
return [2 /*return*/];
|
|
44354
|
+
});
|
|
44355
|
+
}); }, []);
|
|
44356
|
+
Object(react__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () {
|
|
44357
|
+
var query = qs__WEBPACK_IMPORTED_MODULE_0___default.a.parse(window.location.search);
|
|
44307
44358
|
if (query && query.ecommerce && query.ecommerce == 'preview') {
|
|
44308
44359
|
boot(null);
|
|
44309
44360
|
}
|
|
44310
44361
|
else {
|
|
44311
44362
|
window.addEventListener("message", handleMessageReceived);
|
|
44312
44363
|
}
|
|
44313
|
-
return
|
|
44314
|
-
});
|
|
44315
|
-
|
|
44316
|
-
|
|
44364
|
+
return function () { return window.removeEventListener("message", handleMessageReceived); };
|
|
44365
|
+
}, []);
|
|
44366
|
+
return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_1___default.a.Fragment, null, children);
|
|
44367
|
+
};
|
|
44368
|
+
/* harmony default export */ __webpack_exports__["default"] = (Boot);
|
|
44317
44369
|
|
|
44318
44370
|
|
|
44319
44371
|
/***/ }),
|
|
@@ -44322,23 +44374,25 @@ var boot = function (state, dispatch) { return __awaiter(void 0, void 0, void 0,
|
|
|
44322
44374
|
/*!********************************!*\
|
|
44323
44375
|
!*** ./src/state/provider.tsx ***!
|
|
44324
44376
|
\********************************/
|
|
44325
|
-
/*! exports provided: useZakeke, ZakekeProvider */
|
|
44377
|
+
/*! exports provided: useZakeke, useInternalState, ZakekeProvider */
|
|
44326
44378
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
44327
44379
|
|
|
44328
44380
|
"use strict";
|
|
44329
44381
|
__webpack_require__.r(__webpack_exports__);
|
|
44330
44382
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useZakeke", function() { return useZakeke; });
|
|
44383
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useInternalState", function() { return useInternalState; });
|
|
44331
44384
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZakekeProvider", function() { return ZakekeProvider; });
|
|
44332
44385
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
|
|
44333
44386
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
44334
|
-
/* harmony import */ var
|
|
44335
|
-
/* harmony import */ var
|
|
44336
|
-
/* harmony import */ var
|
|
44387
|
+
/* harmony import */ var _boot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boot */ "./src/state/boot.tsx");
|
|
44388
|
+
/* harmony import */ var _providerValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./providerValue */ "./src/state/providerValue.ts");
|
|
44389
|
+
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reducer */ "./src/state/reducer.ts");
|
|
44337
44390
|
|
|
44338
44391
|
|
|
44339
44392
|
|
|
44340
44393
|
|
|
44341
44394
|
var context = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext(null);
|
|
44395
|
+
var internalContext = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext(null);
|
|
44342
44396
|
// Use zakeke hook
|
|
44343
44397
|
var useZakeke = function () {
|
|
44344
44398
|
var value = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(context);
|
|
@@ -44346,21 +44400,27 @@ var useZakeke = function () {
|
|
|
44346
44400
|
throw 'Corrupted Zakeke state';
|
|
44347
44401
|
return value;
|
|
44348
44402
|
};
|
|
44403
|
+
// Use zakeke hook
|
|
44404
|
+
var useInternalState = function () {
|
|
44405
|
+
var value = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(internalContext);
|
|
44406
|
+
if (!value)
|
|
44407
|
+
throw 'Corrupted Zakeke state';
|
|
44408
|
+
return value;
|
|
44409
|
+
};
|
|
44349
44410
|
// ZakekeProvider
|
|
44350
44411
|
var ZakekeProvider = function (_a) {
|
|
44351
44412
|
var environment = _a.environment, children = _a.children;
|
|
44352
|
-
var _b = Object(react__WEBPACK_IMPORTED_MODULE_0__["useReducer"])(
|
|
44413
|
+
var _b = Object(react__WEBPACK_IMPORTED_MODULE_0__["useReducer"])(_reducer__WEBPACK_IMPORTED_MODULE_3__["reducer"], {
|
|
44353
44414
|
environment: environment,
|
|
44354
44415
|
isAddToCartLoading: false,
|
|
44355
44416
|
isSceneLoading: false,
|
|
44356
44417
|
parametersReceived: false
|
|
44357
44418
|
}), state = _b[0], dispatch = _b[1];
|
|
44358
44419
|
// Create the provider value exposed to developer
|
|
44359
|
-
var value = Object(
|
|
44360
|
-
|
|
44361
|
-
|
|
44362
|
-
|
|
44363
|
-
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(context.Provider, { value: value }, children);
|
|
44420
|
+
var value = Object(_providerValue__WEBPACK_IMPORTED_MODULE_2__["createProviderValue"])(state, dispatch);
|
|
44421
|
+
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(context.Provider, { value: value },
|
|
44422
|
+
react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(internalContext.Provider, { value: { state: state, dispatch: dispatch } },
|
|
44423
|
+
react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_boot__WEBPACK_IMPORTED_MODULE_1__["default"], null, children)));
|
|
44364
44424
|
};
|
|
44365
44425
|
|
|
44366
44426
|
|