@ikas/storefront 0.1.20 → 0.1.22-alpha.1
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface addCouponCodeToCheckout_addCouponCodeToCheckout {
|
|
2
|
+
__typename: "Checkout";
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface addCouponCodeToCheckout {
|
|
6
|
+
addCouponCodeToCheckout: addCouponCodeToCheckout_addCouponCodeToCheckout;
|
|
7
|
+
}
|
|
8
|
+
export interface addCouponCodeToCheckoutVariables {
|
|
9
|
+
checkoutId: string;
|
|
10
|
+
couponCode: string;
|
|
11
|
+
}
|
|
@@ -14,6 +14,7 @@ export declare class IkasCheckoutAPI {
|
|
|
14
14
|
static retrieveInstallmentInfo(input: IkasInstallmentInfoInput): Promise<IkasInstallmentInfo | undefined>;
|
|
15
15
|
static checkStocks(lines: CheckStocksLineInput[], stockLocationIdList: string[]): Promise<CheckStocksTypes.checkStocks_checkStocks | undefined>;
|
|
16
16
|
static listCheckoutSettings(): Promise<IkasCheckoutSettings[] | undefined>;
|
|
17
|
+
static addCouponCodeToCheckout(checkoutId: string, couponCode: string): Promise<true | undefined>;
|
|
17
18
|
}
|
|
18
19
|
declare type CheckStocksLineInput = {
|
|
19
20
|
quantity: number;
|
package/build/index.css
CHANGED
|
@@ -980,28 +980,6 @@
|
|
|
980
980
|
color: var(--checkout-secondary-text-color);
|
|
981
981
|
text-decoration: line-through;
|
|
982
982
|
margin-right: 8px; }
|
|
983
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP {
|
|
984
|
-
margin-left: 8px;
|
|
985
|
-
position: relative;
|
|
986
|
-
display: flex;
|
|
987
|
-
align-items: center;
|
|
988
|
-
justify-content: center; }
|
|
989
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP:hover .style-module_DiscountTooltip__2hO7z {
|
|
990
|
-
display: block; }
|
|
991
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z {
|
|
992
|
-
display: none;
|
|
993
|
-
position: absolute;
|
|
994
|
-
bottom: 120%;
|
|
995
|
-
margin: auto;
|
|
996
|
-
padding: 12px;
|
|
997
|
-
border-radius: 4px;
|
|
998
|
-
background-color: white;
|
|
999
|
-
box-shadow: 0px 4px 20px rgba(110, 113, 117, 0.12);
|
|
1000
|
-
width: 200px; }
|
|
1001
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z .style-module_DiscountAdjustment__3QUlC {
|
|
1002
|
-
margin-bottom: 4px; }
|
|
1003
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z .style-module_DiscountAdjustment__3QUlC:last-of-type {
|
|
1004
|
-
margin-bottom: 0; }
|
|
1005
983
|
|
|
1006
984
|
.style-module_TooltipContainer__1IW8v {
|
|
1007
985
|
width: 16px;
|
package/build/index.es.css
CHANGED
|
@@ -980,28 +980,6 @@
|
|
|
980
980
|
color: var(--checkout-secondary-text-color);
|
|
981
981
|
text-decoration: line-through;
|
|
982
982
|
margin-right: 8px; }
|
|
983
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP {
|
|
984
|
-
margin-left: 8px;
|
|
985
|
-
position: relative;
|
|
986
|
-
display: flex;
|
|
987
|
-
align-items: center;
|
|
988
|
-
justify-content: center; }
|
|
989
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP:hover .style-module_DiscountTooltip__2hO7z {
|
|
990
|
-
display: block; }
|
|
991
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z {
|
|
992
|
-
display: none;
|
|
993
|
-
position: absolute;
|
|
994
|
-
bottom: 120%;
|
|
995
|
-
margin: auto;
|
|
996
|
-
padding: 12px;
|
|
997
|
-
border-radius: 4px;
|
|
998
|
-
background-color: white;
|
|
999
|
-
box-shadow: 0px 4px 20px rgba(110, 113, 117, 0.12);
|
|
1000
|
-
width: 200px; }
|
|
1001
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z .style-module_DiscountAdjustment__3QUlC {
|
|
1002
|
-
margin-bottom: 4px; }
|
|
1003
|
-
.style-module_CheckoutItem__2JjSt .style-module_Price__1Vw31 .style-module_DiscountIcon__39hOP .style-module_DiscountTooltip__2hO7z .style-module_DiscountAdjustment__3QUlC:last-of-type {
|
|
1004
|
-
margin-bottom: 0; }
|
|
1005
983
|
|
|
1006
984
|
.style-module_TooltipContainer__1IW8v {
|
|
1007
985
|
width: 16px;
|
package/build/index.es.js
CHANGED
|
@@ -23843,26 +23843,32 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
23843
23843
|
});
|
|
23844
23844
|
}); };
|
|
23845
23845
|
this.onCouponCodeApply = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23846
|
-
var newCheckout, oldCheckout;
|
|
23846
|
+
var isCouponSaveSuccess, newCheckout, oldCheckout;
|
|
23847
23847
|
return __generator(this, function (_a) {
|
|
23848
23848
|
switch (_a.label) {
|
|
23849
23849
|
case 0:
|
|
23850
|
-
|
|
23851
|
-
|
|
23850
|
+
if (!this.checkout.couponCode)
|
|
23851
|
+
return [2 /*return*/];
|
|
23852
|
+
_a.label = 1;
|
|
23852
23853
|
case 1:
|
|
23853
|
-
_a.
|
|
23854
|
-
return [4 /*yield*/, IkasCheckoutAPI.
|
|
23854
|
+
_a.trys.push([1, 5, , 6]);
|
|
23855
|
+
return [4 /*yield*/, IkasCheckoutAPI.addCouponCodeToCheckout(this.checkout.id, this.checkout.couponCode)];
|
|
23855
23856
|
case 2:
|
|
23857
|
+
isCouponSaveSuccess = _a.sent();
|
|
23858
|
+
if (!isCouponSaveSuccess) return [3 /*break*/, 4];
|
|
23859
|
+
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(this.checkout.id)];
|
|
23860
|
+
case 3:
|
|
23856
23861
|
newCheckout = _a.sent();
|
|
23857
23862
|
if (newCheckout) {
|
|
23858
23863
|
oldCheckout = this.checkout;
|
|
23859
23864
|
this.checkout = new IkasCheckout(__assign(__assign({}, newCheckout), { shippingAddress: oldCheckout.shippingAddress, billingAddress: oldCheckout.billingAddress, customer: oldCheckout.customer }));
|
|
23860
23865
|
}
|
|
23861
|
-
|
|
23862
|
-
case 3
|
|
23866
|
+
_a.label = 4;
|
|
23867
|
+
case 4: return [3 /*break*/, 6];
|
|
23868
|
+
case 5:
|
|
23863
23869
|
_a.sent();
|
|
23864
|
-
return [3 /*break*/,
|
|
23865
|
-
case
|
|
23870
|
+
return [3 /*break*/, 6];
|
|
23871
|
+
case 6: return [2 /*return*/];
|
|
23866
23872
|
}
|
|
23867
23873
|
});
|
|
23868
23874
|
}); };
|
|
@@ -41662,9 +41668,41 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
41662
41668
|
});
|
|
41663
41669
|
});
|
|
41664
41670
|
};
|
|
41671
|
+
IkasCheckoutAPI.addCouponCodeToCheckout = function (checkoutId, couponCode) {
|
|
41672
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41673
|
+
var MUTATION, data;
|
|
41674
|
+
return __generator(this, function (_a) {
|
|
41675
|
+
switch (_a.label) {
|
|
41676
|
+
case 0:
|
|
41677
|
+
MUTATION = src(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n mutation addCouponCodeToCheckout(\n $checkoutId: String!\n $couponCode: String!\n ) {\n addCouponCodeToCheckout(\n checkoutId: $checkoutId\n couponCode: $couponCode\n ) {\n id\n }\n }\n "], ["\n mutation addCouponCodeToCheckout(\n $checkoutId: String!\n $couponCode: String!\n ) {\n addCouponCodeToCheckout(\n checkoutId: $checkoutId\n couponCode: $couponCode\n ) {\n id\n }\n }\n "])));
|
|
41678
|
+
_a.label = 1;
|
|
41679
|
+
case 1:
|
|
41680
|
+
_a.trys.push([1, 3, , 4]);
|
|
41681
|
+
return [4 /*yield*/, apollo
|
|
41682
|
+
.getClient()
|
|
41683
|
+
.query({
|
|
41684
|
+
query: MUTATION,
|
|
41685
|
+
variables: {
|
|
41686
|
+
checkoutId: checkoutId,
|
|
41687
|
+
couponCode: couponCode,
|
|
41688
|
+
},
|
|
41689
|
+
})];
|
|
41690
|
+
case 2:
|
|
41691
|
+
data = (_a.sent()).data;
|
|
41692
|
+
if (data && data.addCouponCodeToCheckout.id)
|
|
41693
|
+
return [2 /*return*/, true];
|
|
41694
|
+
return [3 /*break*/, 4];
|
|
41695
|
+
case 3:
|
|
41696
|
+
_a.sent();
|
|
41697
|
+
return [3 /*break*/, 4];
|
|
41698
|
+
case 4: return [2 /*return*/];
|
|
41699
|
+
}
|
|
41700
|
+
});
|
|
41701
|
+
});
|
|
41702
|
+
};
|
|
41665
41703
|
return IkasCheckoutAPI;
|
|
41666
41704
|
}());
|
|
41667
|
-
var templateObject_1$4, templateObject_2$3, templateObject_3$1, templateObject_4$1, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
41705
|
+
var templateObject_1$4, templateObject_2$3, templateObject_3$1, templateObject_4$1, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
41668
41706
|
|
|
41669
41707
|
var IkasCityAPI = /** @class */ (function () {
|
|
41670
41708
|
function IkasCityAPI() {
|
|
@@ -42162,7 +42200,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
42162
42200
|
return __generator(this, function (_b) {
|
|
42163
42201
|
switch (_b.label) {
|
|
42164
42202
|
case 0:
|
|
42165
|
-
LIST_ORDER_TRANSACTIONS = src(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "], ["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "])));
|
|
42203
|
+
LIST_ORDER_TRANSACTIONS = src(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "], ["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "])));
|
|
42166
42204
|
_b.label = 1;
|
|
42167
42205
|
case 1:
|
|
42168
42206
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -42367,7 +42405,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
42367
42405
|
};
|
|
42368
42406
|
return IkasCustomerAPI;
|
|
42369
42407
|
}());
|
|
42370
|
-
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9$1, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
42408
|
+
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
42371
42409
|
|
|
42372
42410
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
42373
42411
|
function IkasDistrictAPI() {
|
|
@@ -68376,9 +68414,6 @@ function (_React$Component) {
|
|
|
68376
68414
|
var FormItem = observer(function (props) {
|
|
68377
68415
|
var t = useTranslation().t;
|
|
68378
68416
|
var _a = useState(function () { return new FormItemViewModel(props); }), vm = _a[0], setVM = _a[1];
|
|
68379
|
-
if (props.type === FormItemType.TEL) {
|
|
68380
|
-
console.log("TEL form item.");
|
|
68381
|
-
}
|
|
68382
68417
|
useEffect(function () {
|
|
68383
68418
|
ReactTooltip.rebuild();
|
|
68384
68419
|
}, []);
|
|
@@ -68443,10 +68478,8 @@ var FormItem = observer(function (props) {
|
|
|
68443
68478
|
});
|
|
68444
68479
|
}, [props.onChange]);
|
|
68445
68480
|
useEffect(function () {
|
|
68446
|
-
console.log("currentCountry:", props.currentCountryCode);
|
|
68447
68481
|
if (!vm.country && props.currentCountryCode) {
|
|
68448
|
-
|
|
68449
|
-
vm.onPhoneChange(props.currentCountryCode);
|
|
68482
|
+
vm.onCountryChange(props.currentCountryCode);
|
|
68450
68483
|
}
|
|
68451
68484
|
}, [props.currentCountryCode]);
|
|
68452
68485
|
return (createElement("div", { className: vm.formItemStyle, style: props.style },
|
|
@@ -68454,7 +68487,7 @@ var FormItem = observer(function (props) {
|
|
|
68454
68487
|
createElement("div", { className: styles.FormItemInputWrapper },
|
|
68455
68488
|
createElement("label", { className: vm.labelStyle }, vm.label),
|
|
68456
68489
|
vm.type === FormItemType.TEXT && (createElement(Input$2, { vm: vm, autocomplete: props.autocomplete, name: props.name })),
|
|
68457
|
-
vm.type === FormItemType.TEL && (createElement(PhoneInput, { defaultCountry: props.currentCountryCode, placeholder: t("checkout-page:enterPhoneNumber"), value: vm.value ? vm.value : "", onChange: vm.onPhoneChange, international: true, addInternationalOption: false })),
|
|
68490
|
+
vm.type === FormItemType.TEL && (createElement(PhoneInput, { key: props.currentCountryCode || "1", defaultCountry: props.currentCountryCode, placeholder: t("checkout-page:enterPhoneNumber"), value: vm.value ? vm.value : "", onChange: vm.onPhoneChange, international: true, addInternationalOption: false })),
|
|
68458
68491
|
vm.type === FormItemType.TEXT_AREA && createElement(TextArea, { vm: vm }),
|
|
68459
68492
|
vm.type === FormItemType.SELECT && (createElement(Select, { vm: vm, autocomplete: props.autocomplete }))),
|
|
68460
68493
|
!!vm.hasError && (createElement("div", { className: styles.ErrorMsg }, vm.errorText || "")),
|
|
@@ -69719,16 +69752,7 @@ var InputWithButton = function (_a) {
|
|
|
69719
69752
|
};
|
|
69720
69753
|
var InputWithButton$1 = observer(InputWithButton);
|
|
69721
69754
|
|
|
69722
|
-
var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ"
|
|
69723
|
-
|
|
69724
|
-
var SVGDiscount = function (_a) {
|
|
69725
|
-
var className = _a.className;
|
|
69726
|
-
return (createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className },
|
|
69727
|
-
createElement("circle", { cx: "8", cy: "8", r: "8", fill: "#CFCED3" }),
|
|
69728
|
-
createElement("path", { d: "M10.9167 5.08301L5.08334 10.9163", stroke: "white", "stroke-linecap": "square", "stroke-linejoin": "round" }),
|
|
69729
|
-
createElement("path", { d: "M5.70832 6.75033C6.28362 6.75033 6.74999 6.28396 6.74999 5.70866C6.74999 5.13336 6.28362 4.66699 5.70832 4.66699C5.13303 4.66699 4.66666 5.13336 4.66666 5.70866C4.66666 6.28396 5.13303 6.75033 5.70832 6.75033Z", fill: "white" }),
|
|
69730
|
-
createElement("path", { d: "M10.2917 11.3333C10.867 11.3333 11.3333 10.867 11.3333 10.2917C11.3333 9.71637 10.867 9.25 10.2917 9.25C9.71637 9.25 9.25 9.71637 9.25 10.2917C9.25 10.867 9.71637 11.3333 10.2917 11.3333Z", fill: "white" })));
|
|
69731
|
-
};
|
|
69755
|
+
var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ"};
|
|
69732
69756
|
|
|
69733
69757
|
var CartItem = observer(function (_a) {
|
|
69734
69758
|
var _b, _c;
|
|
@@ -69738,6 +69762,7 @@ var CartItem = observer(function (_a) {
|
|
|
69738
69762
|
return a.appliedOrderLines &&
|
|
69739
69763
|
a.appliedOrderLines.some(function (aol) { return aol.orderLineId === cartItem.id; });
|
|
69740
69764
|
});
|
|
69765
|
+
var adjustmentTotal = (adjustments === null || adjustments === void 0 ? void 0 : adjustments.reduce(function (total, current) { return total + current.amount; }, 0)) || 0;
|
|
69741
69766
|
return (createElement("div", { className: styles$e.CheckoutItem },
|
|
69742
69767
|
createElement("div", { className: styles$e.ImageContainer },
|
|
69743
69768
|
createElement("img", { className: styles$e.Image, src: (_c = cartItem.variant.mainImage) === null || _c === void 0 ? void 0 : _c.thumbnailSrc })),
|
|
@@ -69748,11 +69773,12 @@ var CartItem = observer(function (_a) {
|
|
|
69748
69773
|
.map(function (vv) { return vv.variantValueName; })
|
|
69749
69774
|
.join(" / ")),
|
|
69750
69775
|
createElement("div", { className: styles$e.Price },
|
|
69751
|
-
!!cartItem.overridenPriceWithQuantity && (createElement("span", { className: styles$e.GrayPrice },
|
|
69752
|
-
|
|
69753
|
-
|
|
69754
|
-
|
|
69755
|
-
|
|
69776
|
+
!!cartItem.overridenPriceWithQuantity && (createElement("span", { className: styles$e.GrayPrice }, !!adjustmentTotal
|
|
69777
|
+
? formatMoney(cartItem.finalPriceWithQuantity, currencyCode)
|
|
69778
|
+
: formatMoney(cartItem.overridenPriceWithQuantity, currencyCode))),
|
|
69779
|
+
!!adjustmentTotal
|
|
69780
|
+
? formatMoney(cartItem.finalPriceWithQuantity - adjustmentTotal, currencyCode)
|
|
69781
|
+
: formatMoney(cartItem.finalPriceWithQuantity, currencyCode)))));
|
|
69756
69782
|
});
|
|
69757
69783
|
|
|
69758
69784
|
var styles$f = {"TooltipContainer":"style-module_TooltipContainer__1IW8v","Tooltip":"style-module_Tooltip__1Pxw6","TooltipArrow":"style-module_TooltipArrow__1l6q_","Top":"style-module_Top__1_7C6","Bottom":"style-module_Bottom__2qCpQ","Left":"style-module_Left__1T6gj","Right":"style-module_Right__uCMMF"};
|
package/build/index.js
CHANGED
|
@@ -23850,26 +23850,32 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
23850
23850
|
});
|
|
23851
23851
|
}); };
|
|
23852
23852
|
this.onCouponCodeApply = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
23853
|
-
var newCheckout, oldCheckout;
|
|
23853
|
+
var isCouponSaveSuccess, newCheckout, oldCheckout;
|
|
23854
23854
|
return __generator(this, function (_a) {
|
|
23855
23855
|
switch (_a.label) {
|
|
23856
23856
|
case 0:
|
|
23857
|
-
|
|
23858
|
-
|
|
23857
|
+
if (!this.checkout.couponCode)
|
|
23858
|
+
return [2 /*return*/];
|
|
23859
|
+
_a.label = 1;
|
|
23859
23860
|
case 1:
|
|
23860
|
-
_a.
|
|
23861
|
-
return [4 /*yield*/, IkasCheckoutAPI.
|
|
23861
|
+
_a.trys.push([1, 5, , 6]);
|
|
23862
|
+
return [4 /*yield*/, IkasCheckoutAPI.addCouponCodeToCheckout(this.checkout.id, this.checkout.couponCode)];
|
|
23862
23863
|
case 2:
|
|
23864
|
+
isCouponSaveSuccess = _a.sent();
|
|
23865
|
+
if (!isCouponSaveSuccess) return [3 /*break*/, 4];
|
|
23866
|
+
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(this.checkout.id)];
|
|
23867
|
+
case 3:
|
|
23863
23868
|
newCheckout = _a.sent();
|
|
23864
23869
|
if (newCheckout) {
|
|
23865
23870
|
oldCheckout = this.checkout;
|
|
23866
23871
|
this.checkout = new IkasCheckout(__assign(__assign({}, newCheckout), { shippingAddress: oldCheckout.shippingAddress, billingAddress: oldCheckout.billingAddress, customer: oldCheckout.customer }));
|
|
23867
23872
|
}
|
|
23868
|
-
|
|
23869
|
-
case 3
|
|
23873
|
+
_a.label = 4;
|
|
23874
|
+
case 4: return [3 /*break*/, 6];
|
|
23875
|
+
case 5:
|
|
23870
23876
|
_a.sent();
|
|
23871
|
-
return [3 /*break*/,
|
|
23872
|
-
case
|
|
23877
|
+
return [3 /*break*/, 6];
|
|
23878
|
+
case 6: return [2 /*return*/];
|
|
23873
23879
|
}
|
|
23874
23880
|
});
|
|
23875
23881
|
}); };
|
|
@@ -41641,9 +41647,41 @@ var IkasCheckoutAPI = /** @class */ (function () {
|
|
|
41641
41647
|
});
|
|
41642
41648
|
});
|
|
41643
41649
|
};
|
|
41650
|
+
IkasCheckoutAPI.addCouponCodeToCheckout = function (checkoutId, couponCode) {
|
|
41651
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41652
|
+
var MUTATION, data;
|
|
41653
|
+
return __generator(this, function (_a) {
|
|
41654
|
+
switch (_a.label) {
|
|
41655
|
+
case 0:
|
|
41656
|
+
MUTATION = src(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n mutation addCouponCodeToCheckout(\n $checkoutId: String!\n $couponCode: String!\n ) {\n addCouponCodeToCheckout(\n checkoutId: $checkoutId\n couponCode: $couponCode\n ) {\n id\n }\n }\n "], ["\n mutation addCouponCodeToCheckout(\n $checkoutId: String!\n $couponCode: String!\n ) {\n addCouponCodeToCheckout(\n checkoutId: $checkoutId\n couponCode: $couponCode\n ) {\n id\n }\n }\n "])));
|
|
41657
|
+
_a.label = 1;
|
|
41658
|
+
case 1:
|
|
41659
|
+
_a.trys.push([1, 3, , 4]);
|
|
41660
|
+
return [4 /*yield*/, apollo
|
|
41661
|
+
.getClient()
|
|
41662
|
+
.query({
|
|
41663
|
+
query: MUTATION,
|
|
41664
|
+
variables: {
|
|
41665
|
+
checkoutId: checkoutId,
|
|
41666
|
+
couponCode: couponCode,
|
|
41667
|
+
},
|
|
41668
|
+
})];
|
|
41669
|
+
case 2:
|
|
41670
|
+
data = (_a.sent()).data;
|
|
41671
|
+
if (data && data.addCouponCodeToCheckout.id)
|
|
41672
|
+
return [2 /*return*/, true];
|
|
41673
|
+
return [3 /*break*/, 4];
|
|
41674
|
+
case 3:
|
|
41675
|
+
_a.sent();
|
|
41676
|
+
return [3 /*break*/, 4];
|
|
41677
|
+
case 4: return [2 /*return*/];
|
|
41678
|
+
}
|
|
41679
|
+
});
|
|
41680
|
+
});
|
|
41681
|
+
};
|
|
41644
41682
|
return IkasCheckoutAPI;
|
|
41645
41683
|
}());
|
|
41646
|
-
var templateObject_1$4, templateObject_2$3, templateObject_3$1, templateObject_4$1, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
41684
|
+
var templateObject_1$4, templateObject_2$3, templateObject_3$1, templateObject_4$1, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
41647
41685
|
|
|
41648
41686
|
var IkasCityAPI = /** @class */ (function () {
|
|
41649
41687
|
function IkasCityAPI() {
|
|
@@ -42141,7 +42179,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
42141
42179
|
return __generator(this, function (_b) {
|
|
42142
42180
|
switch (_b.label) {
|
|
42143
42181
|
case 0:
|
|
42144
|
-
LIST_ORDER_TRANSACTIONS = src(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "], ["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "])));
|
|
42182
|
+
LIST_ORDER_TRANSACTIONS = src(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "], ["\n query listOrderTransactions(\n $checkoutId: StringFilterInput\n $id: StringFilterInput\n $orderId: StringFilterInput\n ) {\n listOrderTransactions(\n checkoutId: $checkoutId\n id: $id\n orderId: $orderId\n ) {\n amount\n checkoutId\n createdAt\n currencyCode\n customerId\n deleted\n error {\n code\n declineCode\n message\n }\n id\n orderId\n paymentGatewayId\n paymentGatewayName\n paymentMethod\n paymentMethodDetail {\n bankName\n binNumber\n cardAssociation\n cardFamily\n cardType\n installment {\n installmentCount\n installmentPrice\n totalPrice\n }\n lastFourDigits\n threeDSecure\n }\n processedAt\n refundReason\n status\n type\n updatedAt\n }\n }\n "])));
|
|
42145
42183
|
_b.label = 1;
|
|
42146
42184
|
case 1:
|
|
42147
42185
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -42346,7 +42384,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
42346
42384
|
};
|
|
42347
42385
|
return IkasCustomerAPI;
|
|
42348
42386
|
}());
|
|
42349
|
-
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9$1, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
42387
|
+
var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
42350
42388
|
|
|
42351
42389
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
42352
42390
|
function IkasDistrictAPI() {
|
|
@@ -68355,9 +68393,6 @@ function (_React$Component) {
|
|
|
68355
68393
|
var FormItem = mobxReactLite.observer(function (props) {
|
|
68356
68394
|
var t = useTranslation().t;
|
|
68357
68395
|
var _a = React.useState(function () { return new FormItemViewModel(props); }), vm = _a[0], setVM = _a[1];
|
|
68358
|
-
if (props.type === FormItemType.TEL) {
|
|
68359
|
-
console.log("TEL form item.");
|
|
68360
|
-
}
|
|
68361
68396
|
React.useEffect(function () {
|
|
68362
68397
|
ReactTooltip.rebuild();
|
|
68363
68398
|
}, []);
|
|
@@ -68422,10 +68457,8 @@ var FormItem = mobxReactLite.observer(function (props) {
|
|
|
68422
68457
|
});
|
|
68423
68458
|
}, [props.onChange]);
|
|
68424
68459
|
React.useEffect(function () {
|
|
68425
|
-
console.log("currentCountry:", props.currentCountryCode);
|
|
68426
68460
|
if (!vm.country && props.currentCountryCode) {
|
|
68427
|
-
|
|
68428
|
-
vm.onPhoneChange(props.currentCountryCode);
|
|
68461
|
+
vm.onCountryChange(props.currentCountryCode);
|
|
68429
68462
|
}
|
|
68430
68463
|
}, [props.currentCountryCode]);
|
|
68431
68464
|
return (React.createElement("div", { className: vm.formItemStyle, style: props.style },
|
|
@@ -68433,7 +68466,7 @@ var FormItem = mobxReactLite.observer(function (props) {
|
|
|
68433
68466
|
React.createElement("div", { className: styles.FormItemInputWrapper },
|
|
68434
68467
|
React.createElement("label", { className: vm.labelStyle }, vm.label),
|
|
68435
68468
|
vm.type === FormItemType.TEXT && (React.createElement(Input$2, { vm: vm, autocomplete: props.autocomplete, name: props.name })),
|
|
68436
|
-
vm.type === FormItemType.TEL && (React.createElement(PhoneInput, { defaultCountry: props.currentCountryCode, placeholder: t("checkout-page:enterPhoneNumber"), value: vm.value ? vm.value : "", onChange: vm.onPhoneChange, international: true, addInternationalOption: false })),
|
|
68469
|
+
vm.type === FormItemType.TEL && (React.createElement(PhoneInput, { key: props.currentCountryCode || "1", defaultCountry: props.currentCountryCode, placeholder: t("checkout-page:enterPhoneNumber"), value: vm.value ? vm.value : "", onChange: vm.onPhoneChange, international: true, addInternationalOption: false })),
|
|
68437
68470
|
vm.type === FormItemType.TEXT_AREA && React.createElement(TextArea, { vm: vm }),
|
|
68438
68471
|
vm.type === FormItemType.SELECT && (React.createElement(Select, { vm: vm, autocomplete: props.autocomplete }))),
|
|
68439
68472
|
!!vm.hasError && (React.createElement("div", { className: styles.ErrorMsg }, vm.errorText || "")),
|
|
@@ -69698,16 +69731,7 @@ var InputWithButton = function (_a) {
|
|
|
69698
69731
|
};
|
|
69699
69732
|
var InputWithButton$1 = mobxReactLite.observer(InputWithButton);
|
|
69700
69733
|
|
|
69701
|
-
var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ"
|
|
69702
|
-
|
|
69703
|
-
var SVGDiscount = function (_a) {
|
|
69704
|
-
var className = _a.className;
|
|
69705
|
-
return (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className },
|
|
69706
|
-
React.createElement("circle", { cx: "8", cy: "8", r: "8", fill: "#CFCED3" }),
|
|
69707
|
-
React.createElement("path", { d: "M10.9167 5.08301L5.08334 10.9163", stroke: "white", "stroke-linecap": "square", "stroke-linejoin": "round" }),
|
|
69708
|
-
React.createElement("path", { d: "M5.70832 6.75033C6.28362 6.75033 6.74999 6.28396 6.74999 5.70866C6.74999 5.13336 6.28362 4.66699 5.70832 4.66699C5.13303 4.66699 4.66666 5.13336 4.66666 5.70866C4.66666 6.28396 5.13303 6.75033 5.70832 6.75033Z", fill: "white" }),
|
|
69709
|
-
React.createElement("path", { d: "M10.2917 11.3333C10.867 11.3333 11.3333 10.867 11.3333 10.2917C11.3333 9.71637 10.867 9.25 10.2917 9.25C9.71637 9.25 9.25 9.71637 9.25 10.2917C9.25 10.867 9.71637 11.3333 10.2917 11.3333Z", fill: "white" })));
|
|
69710
|
-
};
|
|
69734
|
+
var styles$e = {"CheckoutItem":"style-module_CheckoutItem__2JjSt","ImageContainer":"style-module_ImageContainer__2K2RG","Image":"style-module_Image__w2Q_P","Right":"style-module_Right__2HN2l","Name":"style-module_Name__nPgw1","LightText":"style-module_LightText__2P69D","Price":"style-module_Price__1Vw31","GrayPrice":"style-module_GrayPrice__2wDyJ"};
|
|
69711
69735
|
|
|
69712
69736
|
var CartItem = mobxReactLite.observer(function (_a) {
|
|
69713
69737
|
var _b, _c;
|
|
@@ -69717,6 +69741,7 @@ var CartItem = mobxReactLite.observer(function (_a) {
|
|
|
69717
69741
|
return a.appliedOrderLines &&
|
|
69718
69742
|
a.appliedOrderLines.some(function (aol) { return aol.orderLineId === cartItem.id; });
|
|
69719
69743
|
});
|
|
69744
|
+
var adjustmentTotal = (adjustments === null || adjustments === void 0 ? void 0 : adjustments.reduce(function (total, current) { return total + current.amount; }, 0)) || 0;
|
|
69720
69745
|
return (React.createElement("div", { className: styles$e.CheckoutItem },
|
|
69721
69746
|
React.createElement("div", { className: styles$e.ImageContainer },
|
|
69722
69747
|
React.createElement("img", { className: styles$e.Image, src: (_c = cartItem.variant.mainImage) === null || _c === void 0 ? void 0 : _c.thumbnailSrc })),
|
|
@@ -69727,11 +69752,12 @@ var CartItem = mobxReactLite.observer(function (_a) {
|
|
|
69727
69752
|
.map(function (vv) { return vv.variantValueName; })
|
|
69728
69753
|
.join(" / ")),
|
|
69729
69754
|
React.createElement("div", { className: styles$e.Price },
|
|
69730
|
-
!!cartItem.overridenPriceWithQuantity && (React.createElement("span", { className: styles$e.GrayPrice },
|
|
69731
|
-
|
|
69732
|
-
|
|
69733
|
-
|
|
69734
|
-
|
|
69755
|
+
!!cartItem.overridenPriceWithQuantity && (React.createElement("span", { className: styles$e.GrayPrice }, !!adjustmentTotal
|
|
69756
|
+
? formatMoney(cartItem.finalPriceWithQuantity, currencyCode)
|
|
69757
|
+
: formatMoney(cartItem.overridenPriceWithQuantity, currencyCode))),
|
|
69758
|
+
!!adjustmentTotal
|
|
69759
|
+
? formatMoney(cartItem.finalPriceWithQuantity - adjustmentTotal, currencyCode)
|
|
69760
|
+
: formatMoney(cartItem.finalPriceWithQuantity, currencyCode)))));
|
|
69735
69761
|
});
|
|
69736
69762
|
|
|
69737
69763
|
var styles$f = {"TooltipContainer":"style-module_TooltipContainer__1IW8v","Tooltip":"style-module_Tooltip__1Pxw6","TooltipArrow":"style-module_TooltipArrow__1l6q_","Top":"style-module_Top__1_7C6","Bottom":"style-module_Bottom__2qCpQ","Left":"style-module_Left__1T6gj","Right":"style-module_Right__uCMMF"};
|