@ikas/storefront 0.0.90 → 0.0.92
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextRouter } from "next/router";
|
|
2
2
|
import { IkasThemePage, IkasThemePageComponent, IkasTheme, IkasThemeComponent } from "../../models/index";
|
|
3
3
|
import { IkasPageDataProvider } from "../../utils/index";
|
|
4
|
+
import { IkasThemePageSpecification } from "../../models/theme/page/index";
|
|
4
5
|
export default class PageViewModel {
|
|
5
6
|
theme?: IkasTheme | null;
|
|
6
7
|
page?: IkasThemePage | null;
|
|
@@ -14,6 +15,8 @@ export default class PageViewModel {
|
|
|
14
15
|
pageDataProvider?: IkasPageDataProvider | null;
|
|
15
16
|
router: NextRouter;
|
|
16
17
|
constructor(router: NextRouter);
|
|
18
|
+
get specification(): IkasThemePageSpecification | undefined;
|
|
19
|
+
get pageComponents(): IkasThemePageComponent[];
|
|
17
20
|
get selectedPageComponent(): IkasThemePageComponent | undefined;
|
|
18
21
|
get selectedComponent(): IkasThemeComponent | undefined;
|
|
19
22
|
startMessaging: () => void;
|
package/build/index.es.js
CHANGED
|
@@ -11817,6 +11817,36 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11817
11817
|
enumerable: false,
|
|
11818
11818
|
configurable: true
|
|
11819
11819
|
});
|
|
11820
|
+
Object.defineProperty(IkasPageDataProvider.prototype, "specification", {
|
|
11821
|
+
get: function () {
|
|
11822
|
+
var _this = this;
|
|
11823
|
+
var _a, _b, _c;
|
|
11824
|
+
var selectedPage = this.page;
|
|
11825
|
+
var specification;
|
|
11826
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.PRODUCT) {
|
|
11827
|
+
specification = (_a = selectedPage.specifications) === null || _a === void 0 ? void 0 : _a.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.product.id); });
|
|
11828
|
+
}
|
|
11829
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.CATEGORY) {
|
|
11830
|
+
specification = (_b = selectedPage.specifications) === null || _b === void 0 ? void 0 : _b.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.id); });
|
|
11831
|
+
}
|
|
11832
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.BRAND) {
|
|
11833
|
+
specification = (_c = selectedPage.specifications) === null || _c === void 0 ? void 0 : _c.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.id); });
|
|
11834
|
+
}
|
|
11835
|
+
return specification;
|
|
11836
|
+
},
|
|
11837
|
+
enumerable: false,
|
|
11838
|
+
configurable: true
|
|
11839
|
+
});
|
|
11840
|
+
Object.defineProperty(IkasPageDataProvider.prototype, "pageComponents", {
|
|
11841
|
+
get: function () {
|
|
11842
|
+
var _a;
|
|
11843
|
+
if (this.specification)
|
|
11844
|
+
return this.specification.components;
|
|
11845
|
+
return ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components) || [];
|
|
11846
|
+
},
|
|
11847
|
+
enumerable: false,
|
|
11848
|
+
configurable: true
|
|
11849
|
+
});
|
|
11820
11850
|
Object.defineProperty(IkasPageDataProvider.prototype, "isStaticPage", {
|
|
11821
11851
|
get: function () {
|
|
11822
11852
|
var staticPageTypes = [
|
|
@@ -11865,7 +11895,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11865
11895
|
case 3:
|
|
11866
11896
|
_b.sent();
|
|
11867
11897
|
_a = this;
|
|
11868
|
-
return [4 /*yield*/, Promise.all(this.
|
|
11898
|
+
return [4 /*yield*/, Promise.all(this.pageComponents.map(function (pageComponent) {
|
|
11869
11899
|
return _this.getPageComponentPropValues(pageComponent);
|
|
11870
11900
|
}))];
|
|
11871
11901
|
case 4:
|
|
@@ -20000,10 +20030,23 @@ var IkasThemePage = /** @class */ (function () {
|
|
|
20000
20030
|
this.components = data.components
|
|
20001
20031
|
? data.components.map(function (c) { return new IkasThemePageComponent(c); })
|
|
20002
20032
|
: [];
|
|
20033
|
+
this.specifications = data.specifications
|
|
20034
|
+
? data.specifications.map(function (s) { return new IkasThemePageSpecification(s); })
|
|
20035
|
+
: null;
|
|
20003
20036
|
makeAutoObservable(this);
|
|
20004
20037
|
}
|
|
20005
20038
|
return IkasThemePage;
|
|
20006
20039
|
}());
|
|
20040
|
+
var IkasThemePageSpecification = /** @class */ (function () {
|
|
20041
|
+
function IkasThemePageSpecification(data) {
|
|
20042
|
+
this.id = data.id || "";
|
|
20043
|
+
this.components = data.components
|
|
20044
|
+
? data.components.map(function (c) { return new IkasThemePageComponent(c); })
|
|
20045
|
+
: [];
|
|
20046
|
+
makeAutoObservable(this);
|
|
20047
|
+
}
|
|
20048
|
+
return IkasThemePageSpecification;
|
|
20049
|
+
}());
|
|
20007
20050
|
var IkasThemePageType;
|
|
20008
20051
|
(function (IkasThemePageType) {
|
|
20009
20052
|
IkasThemePageType["INDEX"] = "INDEX";
|
|
@@ -26750,12 +26793,12 @@ var CreditCardForm = observer(function (_a) {
|
|
|
26750
26793
|
});
|
|
26751
26794
|
return (createElement("div", null,
|
|
26752
26795
|
createElement("div", { className: styles$2.RowPB },
|
|
26753
|
-
createElement(FormItem, { type: FormItemType.TEXT, label: "Kart numarası", value: cardData.cardNumber, onChange: vm.onCardNumberChange, errorText: "Geçerli bir kart numarası girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardNumber })),
|
|
26796
|
+
createElement(FormItem, { autocomplete: "cc-number", type: FormItemType.TEXT, label: "Kart numarası", value: cardData.cardNumber, onChange: vm.onCardNumberChange, errorText: "Geçerli bir kart numarası girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardNumber })),
|
|
26754
26797
|
createElement("div", { className: styles$2.RowPB },
|
|
26755
|
-
createElement(FormItem, { type: FormItemType.TEXT, label: "Karttaki ad", value: cardData.cardHolderName, onChange: vm.onCardHolderNameChange, errorText: "Ad soyad girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardHolderName })),
|
|
26798
|
+
createElement(FormItem, { autocomplete: "cc-name", type: FormItemType.TEXT, label: "Karttaki ad", value: cardData.cardHolderName, onChange: vm.onCardHolderNameChange, errorText: "Ad soyad girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardHolderName })),
|
|
26756
26799
|
createElement("div", { className: [commonStyles.Grid, commonStyles.Grid2].join(" ") },
|
|
26757
|
-
createElement(FormItem, { type: FormItemType.TEXT, label: "Son kullanma tarihi (AA/YY)", value: cardData.expirationDate, onChange: vm.onExpirationDateChange, errorText: "Geçerli bir tarih girin", hasError: vm.isErrorsVisible && !cardData.validationResult.expirationDate }),
|
|
26758
|
-
createElement(FormItem, { type: FormItemType.TEXT, label: "Güvenlik kodu", value: cardData.cvv, onChange: vm.onCvcChange, errorText: "Geçerli bir güvenlik kodu girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cvv })),
|
|
26800
|
+
createElement(FormItem, { autocomplete: "cc-exp", type: FormItemType.TEXT, label: "Son kullanma tarihi (AA/YY)", value: cardData.expirationDate, onChange: vm.onExpirationDateChange, errorText: "Geçerli bir tarih girin", hasError: vm.isErrorsVisible && !cardData.validationResult.expirationDate }),
|
|
26801
|
+
createElement(FormItem, { autocomplete: "cc-csc", type: FormItemType.TEXT, label: "Güvenlik kodu", value: cardData.cvv, onChange: vm.onCvcChange, errorText: "Geçerli bir güvenlik kodu girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cvv })),
|
|
26759
26802
|
createElement("div", { style: { marginTop: "0.4em" } },
|
|
26760
26803
|
createElement(Checkbox, { value: cardData.threeDSecure, onChange: onThreeDSecureChange, label: "3D Secure kullan" }))));
|
|
26761
26804
|
});
|
|
@@ -27996,7 +28039,10 @@ var PageViewModel = /** @class */ (function () {
|
|
|
27996
28039
|
}); };
|
|
27997
28040
|
this.handleUpdatePageComponentOrder = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
27998
28041
|
return __generator(this, function (_a) {
|
|
27999
|
-
this.
|
|
28042
|
+
if (this.specification)
|
|
28043
|
+
this.specification.components = data.pageComponents.map(function (c) { return new IkasThemePageComponent(c); });
|
|
28044
|
+
else
|
|
28045
|
+
this.page.components = data.pageComponents.map(function (c) { return new IkasThemePageComponent(c); });
|
|
28000
28046
|
return [2 /*return*/];
|
|
28001
28047
|
});
|
|
28002
28048
|
}); };
|
|
@@ -28010,8 +28056,13 @@ var PageViewModel = /** @class */ (function () {
|
|
|
28010
28056
|
if ((_a = _this.theme) === null || _a === void 0 ? void 0 : _a.components) {
|
|
28011
28057
|
_this.theme.components = _this.theme.components.filter(function (c) { return c.id !== data.componentId; });
|
|
28012
28058
|
}
|
|
28013
|
-
|
|
28014
|
-
|
|
28059
|
+
var newPageComponents = _this.pageComponents.filter(function (pC) { return pC.componentId !== data.componentId; }) ||
|
|
28060
|
+
[];
|
|
28061
|
+
if (_this.specification && _this.specification.components) {
|
|
28062
|
+
_this.specification.components = newPageComponents;
|
|
28063
|
+
}
|
|
28064
|
+
if (!_this.specification && ((_b = _this.page) === null || _b === void 0 ? void 0 : _b.components)) {
|
|
28065
|
+
_this.page.components = newPageComponents;
|
|
28015
28066
|
}
|
|
28016
28067
|
};
|
|
28017
28068
|
this.handleUpdateComponent = function (data) {
|
|
@@ -28022,31 +28073,32 @@ var PageViewModel = /** @class */ (function () {
|
|
|
28022
28073
|
this.handleAddNewPageComponent = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
28023
28074
|
var pageComponent, pageComponentPropValues;
|
|
28024
28075
|
var _this = this;
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
switch (_b.label) {
|
|
28076
|
+
return __generator(this, function (_a) {
|
|
28077
|
+
switch (_a.label) {
|
|
28028
28078
|
case 0:
|
|
28029
28079
|
pageComponent = new IkasThemePageComponent(data.pageComponent);
|
|
28030
|
-
if (
|
|
28080
|
+
if (this.pageComponents.some(function (pc) { return pc.id === pageComponent.id; }))
|
|
28031
28081
|
return [2 /*return*/];
|
|
28032
28082
|
return [4 /*yield*/, this.pageDataProvider.getPageComponentPropValues(pageComponent)];
|
|
28033
28083
|
case 1:
|
|
28034
|
-
pageComponentPropValues =
|
|
28084
|
+
pageComponentPropValues = _a.sent();
|
|
28035
28085
|
runInAction(function () {
|
|
28036
|
-
var _a;
|
|
28037
28086
|
var customDataProps = pageComponentPropValues.component.props.filter(function (p) { return p.type === IkasThemeComponentPropType.CUSTOM; });
|
|
28038
28087
|
customDataProps.forEach(function (customDataProp) {
|
|
28039
28088
|
IkasPageDataProvider.initCustomDataPropValue(customDataProp, pageComponentPropValues.propValues[customDataProp.name], pageComponentPropValues, _this.router, true);
|
|
28040
28089
|
});
|
|
28041
28090
|
_this.pageDataProvider.pageComponentPropValues.push(pageComponentPropValues);
|
|
28042
|
-
|
|
28091
|
+
_this.pageComponents.push(pageComponent);
|
|
28043
28092
|
});
|
|
28044
28093
|
return [2 /*return*/];
|
|
28045
28094
|
}
|
|
28046
28095
|
});
|
|
28047
28096
|
}); };
|
|
28048
28097
|
this.handleDeletePageComponent = function (data) {
|
|
28049
|
-
|
|
28098
|
+
if (_this.specification)
|
|
28099
|
+
_this.specification.components = _this.pageComponents.filter(function (pc) { return pc.id !== data.pageComponentId; });
|
|
28100
|
+
else
|
|
28101
|
+
_this.page.components = _this.pageComponents.filter(function (pc) { return pc.id !== data.pageComponentId; });
|
|
28050
28102
|
};
|
|
28051
28103
|
this.handleSetSelectedComponent = function (data) {
|
|
28052
28104
|
_this.selectedPageComponentId = data.componentId;
|
|
@@ -28075,11 +28127,40 @@ var PageViewModel = /** @class */ (function () {
|
|
|
28075
28127
|
makeAutoObservable(this);
|
|
28076
28128
|
this.startMessaging();
|
|
28077
28129
|
}
|
|
28078
|
-
Object.defineProperty(PageViewModel.prototype, "
|
|
28130
|
+
Object.defineProperty(PageViewModel.prototype, "specification", {
|
|
28079
28131
|
get: function () {
|
|
28080
28132
|
var _this = this;
|
|
28133
|
+
var _a, _b, _c;
|
|
28134
|
+
var selectedPage = this.page;
|
|
28135
|
+
var specification;
|
|
28136
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.PRODUCT) {
|
|
28137
|
+
specification = (_a = selectedPage.specifications) === null || _a === void 0 ? void 0 : _a.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.productId); });
|
|
28138
|
+
}
|
|
28139
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.CATEGORY) {
|
|
28140
|
+
specification = (_b = selectedPage.specifications) === null || _b === void 0 ? void 0 : _b.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.categoryId); });
|
|
28141
|
+
}
|
|
28142
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.BRAND) {
|
|
28143
|
+
specification = (_c = selectedPage.specifications) === null || _c === void 0 ? void 0 : _c.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.brandId); });
|
|
28144
|
+
}
|
|
28145
|
+
return specification;
|
|
28146
|
+
},
|
|
28147
|
+
enumerable: false,
|
|
28148
|
+
configurable: true
|
|
28149
|
+
});
|
|
28150
|
+
Object.defineProperty(PageViewModel.prototype, "pageComponents", {
|
|
28151
|
+
get: function () {
|
|
28081
28152
|
var _a;
|
|
28082
|
-
|
|
28153
|
+
if (this.specification)
|
|
28154
|
+
return this.specification.components;
|
|
28155
|
+
return ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components) || [];
|
|
28156
|
+
},
|
|
28157
|
+
enumerable: false,
|
|
28158
|
+
configurable: true
|
|
28159
|
+
});
|
|
28160
|
+
Object.defineProperty(PageViewModel.prototype, "selectedPageComponent", {
|
|
28161
|
+
get: function () {
|
|
28162
|
+
var _this = this;
|
|
28163
|
+
return this.pageComponents.find(function (pc) { return pc.id === _this.selectedPageComponentId; });
|
|
28083
28164
|
},
|
|
28084
28165
|
enumerable: false,
|
|
28085
28166
|
configurable: true
|
|
@@ -28184,9 +28265,9 @@ var IkasPageEditor = observer(function () {
|
|
|
28184
28265
|
var vm = useState(function () { return new PageViewModel(router); })[0];
|
|
28185
28266
|
if (vm.isLoading)
|
|
28186
28267
|
return null;
|
|
28187
|
-
var headerPageComponent = (_a = vm.
|
|
28188
|
-
var footerPageComponent = (_b = vm.
|
|
28189
|
-
var others = (_c = vm.
|
|
28268
|
+
var headerPageComponent = (_a = vm.pageComponents) === null || _a === void 0 ? void 0 : _a.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id); });
|
|
28269
|
+
var footerPageComponent = (_b = vm.pageComponents) === null || _b === void 0 ? void 0 : _b.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.footerComponent) === null || _b === void 0 ? void 0 : _b.id); });
|
|
28270
|
+
var others = (_c = vm.pageComponents) === null || _c === void 0 ? void 0 : _c.filter(function (pc) {
|
|
28190
28271
|
var _a, _b, _c, _d;
|
|
28191
28272
|
return pc.componentId !== ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id) &&
|
|
28192
28273
|
pc.componentId !== ((_d = (_c = vm.theme) === null || _c === void 0 ? void 0 : _c.footerComponent) === null || _d === void 0 ? void 0 : _d.id);
|
package/build/index.js
CHANGED
|
@@ -11831,6 +11831,36 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11831
11831
|
enumerable: false,
|
|
11832
11832
|
configurable: true
|
|
11833
11833
|
});
|
|
11834
|
+
Object.defineProperty(IkasPageDataProvider.prototype, "specification", {
|
|
11835
|
+
get: function () {
|
|
11836
|
+
var _this = this;
|
|
11837
|
+
var _a, _b, _c;
|
|
11838
|
+
var selectedPage = this.page;
|
|
11839
|
+
var specification;
|
|
11840
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.PRODUCT) {
|
|
11841
|
+
specification = (_a = selectedPage.specifications) === null || _a === void 0 ? void 0 : _a.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.product.id); });
|
|
11842
|
+
}
|
|
11843
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.CATEGORY) {
|
|
11844
|
+
specification = (_b = selectedPage.specifications) === null || _b === void 0 ? void 0 : _b.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.id); });
|
|
11845
|
+
}
|
|
11846
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.BRAND) {
|
|
11847
|
+
specification = (_c = selectedPage.specifications) === null || _c === void 0 ? void 0 : _c.find(function (s) { var _a; return s.id === ((_a = _this.pageSpecificData) === null || _a === void 0 ? void 0 : _a.id); });
|
|
11848
|
+
}
|
|
11849
|
+
return specification;
|
|
11850
|
+
},
|
|
11851
|
+
enumerable: false,
|
|
11852
|
+
configurable: true
|
|
11853
|
+
});
|
|
11854
|
+
Object.defineProperty(IkasPageDataProvider.prototype, "pageComponents", {
|
|
11855
|
+
get: function () {
|
|
11856
|
+
var _a;
|
|
11857
|
+
if (this.specification)
|
|
11858
|
+
return this.specification.components;
|
|
11859
|
+
return ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components) || [];
|
|
11860
|
+
},
|
|
11861
|
+
enumerable: false,
|
|
11862
|
+
configurable: true
|
|
11863
|
+
});
|
|
11834
11864
|
Object.defineProperty(IkasPageDataProvider.prototype, "isStaticPage", {
|
|
11835
11865
|
get: function () {
|
|
11836
11866
|
var staticPageTypes = [
|
|
@@ -11879,7 +11909,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11879
11909
|
case 3:
|
|
11880
11910
|
_b.sent();
|
|
11881
11911
|
_a = this;
|
|
11882
|
-
return [4 /*yield*/, Promise.all(this.
|
|
11912
|
+
return [4 /*yield*/, Promise.all(this.pageComponents.map(function (pageComponent) {
|
|
11883
11913
|
return _this.getPageComponentPropValues(pageComponent);
|
|
11884
11914
|
}))];
|
|
11885
11915
|
case 4:
|
|
@@ -19988,10 +20018,23 @@ var IkasThemePage = /** @class */ (function () {
|
|
|
19988
20018
|
this.components = data.components
|
|
19989
20019
|
? data.components.map(function (c) { return new IkasThemePageComponent(c); })
|
|
19990
20020
|
: [];
|
|
20021
|
+
this.specifications = data.specifications
|
|
20022
|
+
? data.specifications.map(function (s) { return new IkasThemePageSpecification(s); })
|
|
20023
|
+
: null;
|
|
19991
20024
|
mobx.makeAutoObservable(this);
|
|
19992
20025
|
}
|
|
19993
20026
|
return IkasThemePage;
|
|
19994
20027
|
}());
|
|
20028
|
+
var IkasThemePageSpecification = /** @class */ (function () {
|
|
20029
|
+
function IkasThemePageSpecification(data) {
|
|
20030
|
+
this.id = data.id || "";
|
|
20031
|
+
this.components = data.components
|
|
20032
|
+
? data.components.map(function (c) { return new IkasThemePageComponent(c); })
|
|
20033
|
+
: [];
|
|
20034
|
+
mobx.makeAutoObservable(this);
|
|
20035
|
+
}
|
|
20036
|
+
return IkasThemePageSpecification;
|
|
20037
|
+
}());
|
|
19995
20038
|
(function (IkasThemePageType) {
|
|
19996
20039
|
IkasThemePageType["INDEX"] = "INDEX";
|
|
19997
20040
|
IkasThemePageType["CATEGORY"] = "CATEGORY";
|
|
@@ -26729,12 +26772,12 @@ var CreditCardForm = mobxReactLite.observer(function (_a) {
|
|
|
26729
26772
|
});
|
|
26730
26773
|
return (React.createElement("div", null,
|
|
26731
26774
|
React.createElement("div", { className: styles$2.RowPB },
|
|
26732
|
-
React.createElement(FormItem, { type: FormItemType.TEXT, label: "Kart numarası", value: cardData.cardNumber, onChange: vm.onCardNumberChange, errorText: "Geçerli bir kart numarası girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardNumber })),
|
|
26775
|
+
React.createElement(FormItem, { autocomplete: "cc-number", type: FormItemType.TEXT, label: "Kart numarası", value: cardData.cardNumber, onChange: vm.onCardNumberChange, errorText: "Geçerli bir kart numarası girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardNumber })),
|
|
26733
26776
|
React.createElement("div", { className: styles$2.RowPB },
|
|
26734
|
-
React.createElement(FormItem, { type: FormItemType.TEXT, label: "Karttaki ad", value: cardData.cardHolderName, onChange: vm.onCardHolderNameChange, errorText: "Ad soyad girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardHolderName })),
|
|
26777
|
+
React.createElement(FormItem, { autocomplete: "cc-name", type: FormItemType.TEXT, label: "Karttaki ad", value: cardData.cardHolderName, onChange: vm.onCardHolderNameChange, errorText: "Ad soyad girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cardHolderName })),
|
|
26735
26778
|
React.createElement("div", { className: [commonStyles.Grid, commonStyles.Grid2].join(" ") },
|
|
26736
|
-
React.createElement(FormItem, { type: FormItemType.TEXT, label: "Son kullanma tarihi (AA/YY)", value: cardData.expirationDate, onChange: vm.onExpirationDateChange, errorText: "Geçerli bir tarih girin", hasError: vm.isErrorsVisible && !cardData.validationResult.expirationDate }),
|
|
26737
|
-
React.createElement(FormItem, { type: FormItemType.TEXT, label: "Güvenlik kodu", value: cardData.cvv, onChange: vm.onCvcChange, errorText: "Geçerli bir güvenlik kodu girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cvv })),
|
|
26779
|
+
React.createElement(FormItem, { autocomplete: "cc-exp", type: FormItemType.TEXT, label: "Son kullanma tarihi (AA/YY)", value: cardData.expirationDate, onChange: vm.onExpirationDateChange, errorText: "Geçerli bir tarih girin", hasError: vm.isErrorsVisible && !cardData.validationResult.expirationDate }),
|
|
26780
|
+
React.createElement(FormItem, { autocomplete: "cc-csc", type: FormItemType.TEXT, label: "Güvenlik kodu", value: cardData.cvv, onChange: vm.onCvcChange, errorText: "Geçerli bir güvenlik kodu girin", hasError: vm.isErrorsVisible && !cardData.validationResult.cvv })),
|
|
26738
26781
|
React.createElement("div", { style: { marginTop: "0.4em" } },
|
|
26739
26782
|
React.createElement(Checkbox, { value: cardData.threeDSecure, onChange: onThreeDSecureChange, label: "3D Secure kullan" }))));
|
|
26740
26783
|
});
|
|
@@ -27975,7 +28018,10 @@ var PageViewModel = /** @class */ (function () {
|
|
|
27975
28018
|
}); };
|
|
27976
28019
|
this.handleUpdatePageComponentOrder = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
27977
28020
|
return __generator(this, function (_a) {
|
|
27978
|
-
this.
|
|
28021
|
+
if (this.specification)
|
|
28022
|
+
this.specification.components = data.pageComponents.map(function (c) { return new IkasThemePageComponent(c); });
|
|
28023
|
+
else
|
|
28024
|
+
this.page.components = data.pageComponents.map(function (c) { return new IkasThemePageComponent(c); });
|
|
27979
28025
|
return [2 /*return*/];
|
|
27980
28026
|
});
|
|
27981
28027
|
}); };
|
|
@@ -27989,8 +28035,13 @@ var PageViewModel = /** @class */ (function () {
|
|
|
27989
28035
|
if ((_a = _this.theme) === null || _a === void 0 ? void 0 : _a.components) {
|
|
27990
28036
|
_this.theme.components = _this.theme.components.filter(function (c) { return c.id !== data.componentId; });
|
|
27991
28037
|
}
|
|
27992
|
-
|
|
27993
|
-
|
|
28038
|
+
var newPageComponents = _this.pageComponents.filter(function (pC) { return pC.componentId !== data.componentId; }) ||
|
|
28039
|
+
[];
|
|
28040
|
+
if (_this.specification && _this.specification.components) {
|
|
28041
|
+
_this.specification.components = newPageComponents;
|
|
28042
|
+
}
|
|
28043
|
+
if (!_this.specification && ((_b = _this.page) === null || _b === void 0 ? void 0 : _b.components)) {
|
|
28044
|
+
_this.page.components = newPageComponents;
|
|
27994
28045
|
}
|
|
27995
28046
|
};
|
|
27996
28047
|
this.handleUpdateComponent = function (data) {
|
|
@@ -28001,31 +28052,32 @@ var PageViewModel = /** @class */ (function () {
|
|
|
28001
28052
|
this.handleAddNewPageComponent = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
28002
28053
|
var pageComponent, pageComponentPropValues;
|
|
28003
28054
|
var _this = this;
|
|
28004
|
-
|
|
28005
|
-
|
|
28006
|
-
switch (_b.label) {
|
|
28055
|
+
return __generator(this, function (_a) {
|
|
28056
|
+
switch (_a.label) {
|
|
28007
28057
|
case 0:
|
|
28008
28058
|
pageComponent = new IkasThemePageComponent(data.pageComponent);
|
|
28009
|
-
if (
|
|
28059
|
+
if (this.pageComponents.some(function (pc) { return pc.id === pageComponent.id; }))
|
|
28010
28060
|
return [2 /*return*/];
|
|
28011
28061
|
return [4 /*yield*/, this.pageDataProvider.getPageComponentPropValues(pageComponent)];
|
|
28012
28062
|
case 1:
|
|
28013
|
-
pageComponentPropValues =
|
|
28063
|
+
pageComponentPropValues = _a.sent();
|
|
28014
28064
|
mobx.runInAction(function () {
|
|
28015
|
-
var _a;
|
|
28016
28065
|
var customDataProps = pageComponentPropValues.component.props.filter(function (p) { return p.type === exports.IkasThemeComponentPropType.CUSTOM; });
|
|
28017
28066
|
customDataProps.forEach(function (customDataProp) {
|
|
28018
28067
|
IkasPageDataProvider.initCustomDataPropValue(customDataProp, pageComponentPropValues.propValues[customDataProp.name], pageComponentPropValues, _this.router, true);
|
|
28019
28068
|
});
|
|
28020
28069
|
_this.pageDataProvider.pageComponentPropValues.push(pageComponentPropValues);
|
|
28021
|
-
|
|
28070
|
+
_this.pageComponents.push(pageComponent);
|
|
28022
28071
|
});
|
|
28023
28072
|
return [2 /*return*/];
|
|
28024
28073
|
}
|
|
28025
28074
|
});
|
|
28026
28075
|
}); };
|
|
28027
28076
|
this.handleDeletePageComponent = function (data) {
|
|
28028
|
-
|
|
28077
|
+
if (_this.specification)
|
|
28078
|
+
_this.specification.components = _this.pageComponents.filter(function (pc) { return pc.id !== data.pageComponentId; });
|
|
28079
|
+
else
|
|
28080
|
+
_this.page.components = _this.pageComponents.filter(function (pc) { return pc.id !== data.pageComponentId; });
|
|
28029
28081
|
};
|
|
28030
28082
|
this.handleSetSelectedComponent = function (data) {
|
|
28031
28083
|
_this.selectedPageComponentId = data.componentId;
|
|
@@ -28054,11 +28106,40 @@ var PageViewModel = /** @class */ (function () {
|
|
|
28054
28106
|
mobx.makeAutoObservable(this);
|
|
28055
28107
|
this.startMessaging();
|
|
28056
28108
|
}
|
|
28057
|
-
Object.defineProperty(PageViewModel.prototype, "
|
|
28109
|
+
Object.defineProperty(PageViewModel.prototype, "specification", {
|
|
28058
28110
|
get: function () {
|
|
28059
28111
|
var _this = this;
|
|
28112
|
+
var _a, _b, _c;
|
|
28113
|
+
var selectedPage = this.page;
|
|
28114
|
+
var specification;
|
|
28115
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.PRODUCT) {
|
|
28116
|
+
specification = (_a = selectedPage.specifications) === null || _a === void 0 ? void 0 : _a.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.productId); });
|
|
28117
|
+
}
|
|
28118
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.CATEGORY) {
|
|
28119
|
+
specification = (_b = selectedPage.specifications) === null || _b === void 0 ? void 0 : _b.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.categoryId); });
|
|
28120
|
+
}
|
|
28121
|
+
if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === exports.IkasThemePageType.BRAND) {
|
|
28122
|
+
specification = (_c = selectedPage.specifications) === null || _c === void 0 ? void 0 : _c.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.brandId); });
|
|
28123
|
+
}
|
|
28124
|
+
return specification;
|
|
28125
|
+
},
|
|
28126
|
+
enumerable: false,
|
|
28127
|
+
configurable: true
|
|
28128
|
+
});
|
|
28129
|
+
Object.defineProperty(PageViewModel.prototype, "pageComponents", {
|
|
28130
|
+
get: function () {
|
|
28060
28131
|
var _a;
|
|
28061
|
-
|
|
28132
|
+
if (this.specification)
|
|
28133
|
+
return this.specification.components;
|
|
28134
|
+
return ((_a = this.page) === null || _a === void 0 ? void 0 : _a.components) || [];
|
|
28135
|
+
},
|
|
28136
|
+
enumerable: false,
|
|
28137
|
+
configurable: true
|
|
28138
|
+
});
|
|
28139
|
+
Object.defineProperty(PageViewModel.prototype, "selectedPageComponent", {
|
|
28140
|
+
get: function () {
|
|
28141
|
+
var _this = this;
|
|
28142
|
+
return this.pageComponents.find(function (pc) { return pc.id === _this.selectedPageComponentId; });
|
|
28062
28143
|
},
|
|
28063
28144
|
enumerable: false,
|
|
28064
28145
|
configurable: true
|
|
@@ -28163,9 +28244,9 @@ var IkasPageEditor = mobxReactLite.observer(function () {
|
|
|
28163
28244
|
var vm = React.useState(function () { return new PageViewModel(router$1); })[0];
|
|
28164
28245
|
if (vm.isLoading)
|
|
28165
28246
|
return null;
|
|
28166
|
-
var headerPageComponent = (_a = vm.
|
|
28167
|
-
var footerPageComponent = (_b = vm.
|
|
28168
|
-
var others = (_c = vm.
|
|
28247
|
+
var headerPageComponent = (_a = vm.pageComponents) === null || _a === void 0 ? void 0 : _a.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id); });
|
|
28248
|
+
var footerPageComponent = (_b = vm.pageComponents) === null || _b === void 0 ? void 0 : _b.find(function (pc) { var _a, _b; return pc.componentId === ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.footerComponent) === null || _b === void 0 ? void 0 : _b.id); });
|
|
28249
|
+
var others = (_c = vm.pageComponents) === null || _c === void 0 ? void 0 : _c.filter(function (pc) {
|
|
28169
28250
|
var _a, _b, _c, _d;
|
|
28170
28251
|
return pc.componentId !== ((_b = (_a = vm.theme) === null || _a === void 0 ? void 0 : _a.headerComponent) === null || _b === void 0 ? void 0 : _b.id) &&
|
|
28171
28252
|
pc.componentId !== ((_d = (_c = vm.theme) === null || _c === void 0 ? void 0 : _c.footerComponent) === null || _d === void 0 ? void 0 : _d.id);
|
|
@@ -7,8 +7,14 @@ export declare class IkasThemePage {
|
|
|
7
7
|
pageTitle: string | null;
|
|
8
8
|
description: string | null;
|
|
9
9
|
components: IkasThemePageComponent[];
|
|
10
|
+
specifications: IkasThemePageSpecification[] | null;
|
|
10
11
|
constructor(data: Partial<IkasThemePage>);
|
|
11
12
|
}
|
|
13
|
+
export declare class IkasThemePageSpecification {
|
|
14
|
+
id: string;
|
|
15
|
+
components: IkasThemePageComponent[];
|
|
16
|
+
constructor(data: Partial<IkasThemePageSpecification>);
|
|
17
|
+
}
|
|
12
18
|
export declare enum IkasThemePageType {
|
|
13
19
|
INDEX = "INDEX",
|
|
14
20
|
CATEGORY = "CATEGORY",
|
|
@@ -4,6 +4,7 @@ import { IkasProductListParams } from "../../models/ui/product-list/index";
|
|
|
4
4
|
import { IkasNavigationLink } from "../../models/ui/navigation-link/index";
|
|
5
5
|
import { IkasCategoryListParams } from "../../models/ui/category-list/index";
|
|
6
6
|
import { CustomDataValue } from "./prop-value/custom";
|
|
7
|
+
import { IkasThemePageSpecification } from "../../models/theme/page/index";
|
|
7
8
|
export declare class IkasPageDataProvider {
|
|
8
9
|
theme: IkasTheme;
|
|
9
10
|
pageType?: IkasThemePageType | null;
|
|
@@ -21,6 +22,8 @@ export declare class IkasPageDataProvider {
|
|
|
21
22
|
merchantSettings: string | null;
|
|
22
23
|
};
|
|
23
24
|
};
|
|
25
|
+
get specification(): IkasThemePageSpecification | undefined;
|
|
26
|
+
get pageComponents(): IkasThemePageComponent[];
|
|
24
27
|
get isStaticPage(): boolean | null | undefined;
|
|
25
28
|
getMerchantSettings(): Promise<void>;
|
|
26
29
|
getPageData(): Promise<void>;
|