@weareconceptstudio/account 0.6.2 → 0.6.4

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.
@@ -6,6 +6,5 @@ export declare const balanceFields: {
6
6
  };
7
7
  fieldProps: {
8
8
  placeholder: string;
9
- type: string;
10
9
  };
11
10
  }[];
@@ -1,13 +1,12 @@
1
1
  export const balanceFields = [
2
2
  {
3
- fieldType: 'input',
3
+ fieldType: 'number',
4
4
  labelProps: {
5
5
  name: 'balance',
6
6
  errorKey: 'account.balance_promotions.balance',
7
7
  },
8
8
  fieldProps: {
9
9
  placeholder: 'account.balance_promotions.balancePlaceholder',
10
- type: 'number',
11
10
  },
12
11
  },
13
12
  ];
@@ -1,5 +1,7 @@
1
1
  export default AppliedPromotion;
2
- declare function AppliedPromotion({ name }: {
2
+ declare function AppliedPromotion({ name, onClick, isExcluded }: {
3
3
  name: any;
4
+ onClick: any;
5
+ isExcluded?: boolean;
4
6
  }): React.JSX.Element;
5
7
  import React from 'react';
@@ -1,11 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Text } from '@weareconceptstudio/core';
3
- const AppliedPromotion = ({ name }) => {
3
+ const AppliedPromotion = ({ name, onClick, isExcluded = false }) => {
4
4
  return (React.createElement("div", { className: `promo-code-success-block` },
5
5
  React.createElement(Text, { className: 'account-p account-p4 account-primary-color2 account-font-medium promo-code-success-text' }, name),
6
- React.createElement(Text, { text: 'account.general_actions.remove', className: 'account-p account-p4 account-primary-color2 account-font-medium promo-code-remove-text', onClick: () => {
7
- // promotionHandler(null);
8
- // setDisable(false);
9
- } })));
6
+ React.createElement(Text, { text: isExcluded ? 'account.general_actions.restore' : 'account.general_actions.remove', className: 'account-p account-p4 account-primary-color2 account-font-medium promo-code-remove-text', onClick: onClick })));
10
7
  };
11
8
  export default AppliedPromotion;
@@ -8,16 +8,13 @@ import { promoCodeFields } from './utils';
8
8
  //* Style
9
9
  import PromoCodeCompStyle from './style';
10
10
  const PromoCodeComp = () => {
11
- const { itemsCount, usePromotion, appliedPromotions, fillCart } = useCart();
12
- const handlePromotion = (promotion) => {
13
- fillCart('usePromotion', promotion);
14
- };
11
+ const { itemsCount, appliedPromotions, fillCart, togglePromotion, checkoutData } = useCart();
15
12
  const onFinish = (values) => {
16
- handlePromotion(values.promo_code);
13
+ fillCart('promotion_code', values?.promo_code || null);
17
14
  };
18
15
  const promotions = useMemo(() => {
19
- return appliedPromotions?.map((promotion, index) => (React.createElement(AppliedPromotion, { key: index, ...promotion })));
20
- }, [appliedPromotions]);
16
+ return appliedPromotions?.map((promotion) => (React.createElement(AppliedPromotion, { key: promotion.id, ...promotion, isExcluded: checkoutData?.excludedPromotions?.includes(promotion.id), onClick: () => (promotion.is_manual ? onFinish(null) : togglePromotion({ promotionId: promotion.id })) })));
17
+ }, [appliedPromotions, checkoutData.excludedPromotions]);
21
18
  return (React.createElement(PromoCodeCompStyle, { className: `collapse-distance ${itemsCount ? '' : 'disable'}` },
22
19
  React.createElement(CollapseItem, { status: appliedPromotions?.length ? 'open' : 'close', title: React.createElement(React.Fragment, null,
23
20
  React.createElement("div", { className: 'inner-wrapper-icon' },
@@ -26,9 +23,9 @@ const PromoCodeComp = () => {
26
23
  React.createElement("path", { d: 'M6 12L6 0', stroke: 'black', strokeWidth: '2' }))),
27
24
  React.createElement(Text, { className: 'account-p account-p4 account-primary-color1 account-font-medium promo-code-text', text: 'account.balance_promotions.gotPromotionCode' })), description: React.createElement(React.Fragment, null,
28
25
  promotions,
29
- usePromotion ? (React.createElement(AppliedPromotion, { name: usePromotion, onClick: () => handlePromotion(null) })) : (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
26
+ !checkoutData.promotion_code ? (React.createElement(FormBuilder, { onSubmit: onFinish, fields: promoCodeFields, className: `promo-code-block`, formOptions: {
30
27
  className: 'promo-code-container',
31
28
  } },
32
- React.createElement(AccountButton, { type: 'submit', btnType: `promo-code-version`, text: `account.general_actions.add` })))) })));
29
+ React.createElement(AccountButton, { type: 'submit', btnType: `promo-code-version`, text: `account.general_actions.add` }))) : null) })));
33
30
  };
34
31
  export default PromoCodeComp;
@@ -8,7 +8,7 @@ export const useAddressContext = () => {
8
8
  };
9
9
  export const AddressProvider = ({ addressType, addressFormFields = [], useUser, children }) => {
10
10
  const { isLoggedIn } = useUser();
11
- const { fillCheckoutData, fillCart, isCheckoutPage } = useCart();
11
+ const { fillCheckoutData, fillCart, isCheckoutPage, checkoutData } = useCart();
12
12
  const [addressLoading, setAddressLoading] = useState(false);
13
13
  const [addresses, setAddresses] = useState(addressType ? { billing: [], shipping: [] } : []);
14
14
  const [selectedAddresses, setSelectedAddresses] = useState(addressType ? { billing: {}, shipping: {} } : {});
@@ -35,6 +35,14 @@ export const AddressProvider = ({ addressType, addressFormFields = [], useUser,
35
35
  });
36
36
  }
37
37
  }, [isLoggedIn]);
38
+ useEffect(() => {
39
+ if (checkoutData?.addressId) {
40
+ let storageSelectedAddress = addresses.find((item) => item.id == checkoutData.addressId);
41
+ if (storageSelectedAddress) {
42
+ setSelectedAddresses(storageSelectedAddress);
43
+ }
44
+ }
45
+ }, [checkoutData?.addressId, addresses]);
38
46
  const createAddress = async ({ data, type }) => {
39
47
  return await api.post('addresses', data).then((res) => {
40
48
  if (addressType) {
@@ -48,14 +48,7 @@ const Item = memo(({ data, remove, select, isLast, actions, isCheckout }) => {
48
48
  React.createElement("div", { className: `flex-end-wrap` }, (data.sale_total || data.product.discount) && !data.is_gift ? (React.createElement("div", null,
49
49
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right cart-sale-total`, text: handlePriceCheckFunc(data.sale_total, currency) }),
50
50
  React.createElement("div", { className: 'wrapper-discount' },
51
- data.product.discount ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text` },
52
- data.product.discount.value,
53
- data.product.discount.type === 'percentage' ? '%' : ` ${currency}`,
54
- "\u00A0",
55
- React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
56
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2` }, data.is_gift ? (React.createElement(React.Fragment, null,
57
- handlePriceCheckFunc(0, currency),
58
- React.createElement("span", { className: 'gift-name-text' }, data.appliedPromotion.name))) : (handlePriceCheckFunc(data.total, currency))))),
51
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right cart-total1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right cart-total2` }, handlePriceCheckFunc(data.total, currency)))),
59
52
  React.createElement("div", { className: `favorite-and-remove-wrap` }, remove && !data.is_gift && (React.createElement("div", { className: `remove-btn-wrap` },
60
53
  React.createElement(AccountButton, { btnType: `green-small-text`, className: 'cart-remove-btn', text: 'account.general_actions.remove', onClick: () => actions.delete({ productId: data.product.id }) }))))))),
61
54
  isLast ? React.createElement("div", { className: 'line' }) : null)) : null;
@@ -35,9 +35,7 @@ const ItemMobile = memo(({ data, select, isCheckout }) => {
35
35
  data.product.discount.type === 'percentage' ? '%' : ` ${currency}`,
36
36
  "\u00A0",
37
37
  React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
38
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through mobile-total-price price-discount`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-total-price2` }, data.is_gift ? (React.createElement(React.Fragment, null,
39
- handlePriceCheckFunc(0, currency),
40
- React.createElement("span", { className: 'gift-name-text' }, data.appliedPromotion.name))) : (handlePriceCheckFunc(data.total, currency)))),
38
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through mobile-total-price price-discount`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-total-price2` }, handlePriceCheckFunc(data.total, currency))),
41
39
  select && !data.is_gift ? (React.createElement("div", { className: `inner-container` }, !data.product.out_of_stock ? (React.createElement(AccountCounter, { productId: data.product.id })) : (React.createElement("div", { className: `in-block` },
42
40
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: 'account.general_actions.outOfStock' }))))) : data.is_gift && !isCheckout ? (React.createElement("div", { className: 'wrapper-gift-button' }, checkoutData.gifts.find((item) => item.promotionId == data.appliedPromotion.id && item.productId == data.product.id)?.qty !== 0 ? (React.createElement(AccountCounter, { maxQty: data?.qty, productId: data.product.id, promotionId: data.appliedPromotion.id, isGift: data.is_gift, qty: checkoutData.gifts.find((item) => item.promotionId == data.appliedPromotion.id && item.productId == data.product.id)?.qty })) : (React.createElement(AccountButton, { className: `capitalize button-gift`, text: 'account.general_actions.restore', onClick: () => setGifts({ promotionId: data.appliedPromotion.id, productId: data.product.id, qty: data?.qty }) })))) : (React.createElement("div", { className: `in-block` },
43
41
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 mobile-quantity-with-symbol2` },
@@ -14,6 +14,8 @@ interface CheckoutData {
14
14
  qty: number;
15
15
  }[];
16
16
  card_id: number | null;
17
+ excludedPromotions: any[];
18
+ promotion_code: string | null;
17
19
  }
18
20
  interface CartState {
19
21
  itemsCount: number;
@@ -29,8 +31,8 @@ interface CartState {
29
31
  giftThresholdRemaining: number | null;
30
32
  useBalance: number | string | null;
31
33
  discount: number | null;
32
- usePromotion?: string | null;
33
34
  appliedPromotions: any[];
35
+ promotion_code: string | null;
34
36
  }
35
37
  interface CartContextType extends CartState {
36
38
  getCart: (params?: Record<string, any>) => Promise<void>;
@@ -40,6 +42,7 @@ interface CartContextType extends CartState {
40
42
  productId: number;
41
43
  }) => Promise<void>;
42
44
  clearCart: () => Promise<void>;
45
+ resetCart: () => void;
43
46
  reorder: (orderId: number) => Promise<void>;
44
47
  mergeCart: () => Promise<void>;
45
48
  checkoutData: CheckoutData;
@@ -52,6 +55,9 @@ interface CartContextType extends CartState {
52
55
  qty: number;
53
56
  productId: number;
54
57
  }) => void;
58
+ togglePromotion: ({ promotionId }: {
59
+ promotionId: any;
60
+ }) => void;
55
61
  checkoutBtnDisabled: boolean;
56
62
  isCheckoutPage: boolean;
57
63
  }
@@ -21,6 +21,7 @@ export const CartProvider = ({ useUser, children }) => {
21
21
  hasFreeGift: null,
22
22
  giftThresholdRemaining: null,
23
23
  useBalance: null,
24
+ promotion_code: null,
24
25
  discount: null,
25
26
  appliedPromotions: [],
26
27
  });
@@ -31,6 +32,8 @@ export const CartProvider = ({ useUser, children }) => {
31
32
  paymentType: user?.payment_method || 'cash_on_delivery',
32
33
  gifts: [],
33
34
  card_id: null,
35
+ excludedPromotions: [],
36
+ promotion_code: null
34
37
  };
35
38
  const [checkoutData, setCheckoutData] = useState(initialCheckoutData);
36
39
  const checkoutDataRef = useRef(checkoutData);
@@ -45,8 +48,16 @@ export const CartProvider = ({ useUser, children }) => {
45
48
  return cookieCart ? JSON.parse(cookieCart) : [];
46
49
  };
47
50
  const setResourceDecorator = (data) => {
48
- setCartState((prev) => ({ ...prev, ...data, loading: false }));
49
- setCheckoutData((prev) => ({ ...prev, useBalance: data.useBalance }));
51
+ setCartState((prev) => ({
52
+ ...prev,
53
+ ...data,
54
+ loading: false
55
+ }));
56
+ setCheckoutData((prev) => ({
57
+ ...prev,
58
+ useBalance: data.useBalance,
59
+ promotion_code: data.promotion_code
60
+ }));
50
61
  };
51
62
  const isCheckoutPage = useMemo(() => {
52
63
  return window.location.href.includes('checkout');
@@ -58,7 +69,7 @@ export const CartProvider = ({ useUser, children }) => {
58
69
  return isCheckoutPage || isCartPage ? 'cart' : 'cart-summary';
59
70
  }, [isCheckoutPage, isCartPage]);
60
71
  const getCart = async (params = {}) => {
61
- let newParams = { ...cleanObject(params), ...cleanObject(checkoutDataRef.current), cartResourceType };
72
+ let newParams = { ...cleanObject(checkoutDataRef.current), ...params, cartResourceType };
62
73
  if (isLoggedIn) {
63
74
  const { data } = await api.get({ url: 'cart', lang: selectedLang, params: newParams });
64
75
  setResourceDecorator(data);
@@ -109,8 +120,22 @@ export const CartProvider = ({ useUser, children }) => {
109
120
  setResourceDecorator(data);
110
121
  }
111
122
  };
112
- const clearCart = async () => {
123
+ // TODO: check this
124
+ const resetCart = async () => {
113
125
  sessionStorage.clear();
126
+ removeCookie('cart');
127
+ setCheckoutData({
128
+ addressId: null,
129
+ useBalance: null,
130
+ note: '',
131
+ paymentType: user?.payment_method || 'cash_on_delivery',
132
+ gifts: [],
133
+ card_id: null,
134
+ excludedPromotions: [],
135
+ promotion_code: null
136
+ });
137
+ };
138
+ const clearCart = async () => {
114
139
  if (isLoggedIn) {
115
140
  const { data } = await api.post('clear-cart');
116
141
  setResourceDecorator(data);
@@ -156,6 +181,21 @@ export const CartProvider = ({ useUser, children }) => {
156
181
  ],
157
182
  }));
158
183
  }, []);
184
+ const togglePromotion = ({ promotionId }) => {
185
+ setCheckoutData((prev) => {
186
+ const excludedPromotions = prev.excludedPromotions;
187
+ const index = excludedPromotions.indexOf(promotionId);
188
+ if (index > -1) {
189
+ excludedPromotions.splice(index, 1);
190
+ }
191
+ else {
192
+ excludedPromotions.push(promotionId);
193
+ }
194
+ const updatedData = { ...prev, excludedPromotions };
195
+ getCart(updatedData);
196
+ return updatedData;
197
+ });
198
+ };
159
199
  const checkoutBtnDisabled = useMemo(() => {
160
200
  let isDisabled = false;
161
201
  if (isCheckoutPage && isNumeric(checkoutData.paymentType)) {
@@ -188,7 +228,7 @@ export const CartProvider = ({ useUser, children }) => {
188
228
  const handleCheckout = async () => {
189
229
  let data = cleanObject({ ...checkoutData });
190
230
  //! Check gift
191
- if (!data.gifts.length)
231
+ if (!data.gifts?.length)
192
232
  delete data.gifts;
193
233
  if (isNumeric(checkoutData.paymentType)) {
194
234
  data.paymentType = 'credit_card';
@@ -198,6 +238,7 @@ export const CartProvider = ({ useUser, children }) => {
198
238
  data.card_id = 0;
199
239
  }
200
240
  return await api.post('checkout', data).then((res) => {
241
+ resetCart();
201
242
  if (res.redirect_url) {
202
243
  window.location.href = res.redirect_url;
203
244
  }
@@ -227,11 +268,13 @@ export const CartProvider = ({ useUser, children }) => {
227
268
  clearCart,
228
269
  reorder,
229
270
  mergeCart,
271
+ resetCart,
230
272
  setCheckoutData,
231
273
  fillCheckoutData,
232
274
  handleCheckout,
233
275
  fillCart,
234
276
  setGifts,
277
+ togglePromotion,
235
278
  checkoutBtnDisabled,
236
279
  isCheckoutPage,
237
280
  } },
@@ -11,9 +11,9 @@ import { useCart } from '../../cart';
11
11
  const ThankYouTemplate = ({ orderNumber, thankIcon }) => {
12
12
  const { shopUrl } = useAccountContext();
13
13
  const { translate } = useTranslation();
14
- const { clearCart } = useCart();
14
+ const { resetCart } = useCart();
15
15
  useEffect(() => {
16
- clearCart();
16
+ resetCart();
17
17
  }, []);
18
18
  return (React.createElement(Page, { className: 'thank-you-message use-account' },
19
19
  React.createElement(ThankYouMessageStyle, null,
@@ -26,29 +26,22 @@ const Item = memo(({ data }) => {
26
26
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data.product.short_info_2 }))) : null)),
27
27
  React.createElement("div", { className: `col-item tl-col-2` },
28
28
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data?.qty })),
29
- React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, (data.sale_price || data.product?.discount) && !data.is_gift ? (React.createElement("div", null,
29
+ React.createElement("div", { className: `col-item tl-col-3 col-item-3 nowrap` }, data.sale_price && !data.is_gift ? (React.createElement("div", null,
30
30
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right order-sale-price`, text: handlePriceCheckFunc(data.sale_price, currency) }),
31
31
  React.createElement("div", { className: 'wrapper-discount' },
32
- data.product?.discount ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text` },
33
- data.product.discount,
34
- data.product?.discount_type === 'percentage' ? '%' : ` ${currency}`,
32
+ data.appliedPromotion ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text` },
33
+ data.appliedPromotion.value,
34
+ data.appliedPromotion.type === 'percentage' ? '%' : ` ${currency}`,
35
35
  "\u00A0",
36
36
  React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
37
37
  React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right order-price1`, text: handlePriceCheckFunc(data.price, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right order-sale-price` }, data.is_gift ? (React.createElement(React.Fragment, null,
38
38
  handlePriceCheckFunc(0, currency),
39
- React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name || 'Karlen'))) : (handlePriceCheckFunc(data.price, currency))))),
39
+ React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name))) : (handlePriceCheckFunc(data.price, currency))))),
40
40
  React.createElement("div", { className: `col-item tl-col-4 col-item-4 nowrap price-block` },
41
41
  React.createElement("div", { className: `col-item-inner-wrap` },
42
- React.createElement("div", { className: `flex-end-wrap` }, (data.sale_total || data.product?.discount) && !data.is_gift ? (React.createElement("div", null,
42
+ React.createElement("div", { className: `flex-end-wrap` }, data.sale_total && !data.is_gift ? (React.createElement("div", null,
43
43
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-secondary-color2 align-right order-sale-price`, text: handlePriceCheckFunc(data.sale_total, currency) }),
44
44
  React.createElement("div", { className: 'wrapper-discount' },
45
- data.product?.discount ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text` },
46
- data.product.discount,
47
- data.product?.discount_type === 'percentage' ? '%' : ` ${currency}`,
48
- "\u00A0",
49
- React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
50
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right order-price1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right order-sale-price` }, data.is_gift ? (React.createElement(React.Fragment, null,
51
- handlePriceCheckFunc(0, currency),
52
- React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name || 'Karlen'))) : (handlePriceCheckFunc(data.total, currency))))))))));
45
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through value align-right order-price1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 align-right order-sale-price` }, handlePriceCheckFunc(data.total, currency)))))))));
53
46
  });
54
47
  export default Item;
@@ -31,29 +31,22 @@ const ItemMobile = memo(({ data }) => {
31
31
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: data?.qty })),
32
32
  React.createElement("div", { className: `mobile-price-wrap nowrap` },
33
33
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `account.order_balance.price` }),
34
- (data.sale_price || data.product?.discount) && !data.is_gift ? (React.createElement(React.Fragment, null,
34
+ data.sale_price && !data.is_gift ? (React.createElement(React.Fragment, null,
35
35
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-secondary-color2 sale-price`, text: handlePriceCheckFunc(data.sale_price, currency) }),
36
36
  React.createElement("div", { className: 'wrapper-discount' },
37
- data.product?.discount ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text-mobile` },
38
- data.product.discount,
39
- data.product?.discount_type === 'percentage' ? '%' : ` ${currency}`,
37
+ data.appliedPromotion ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text-mobile` },
38
+ data.appliedPromotion.value,
39
+ data.appliedPromotion.type === 'percentage' ? '%' : ` ${currency}`,
40
40
  "\u00A0",
41
41
  React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
42
42
  React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through price1`, text: handlePriceCheckFunc(data.price, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 price2` }, data.is_gift ? (React.createElement(React.Fragment, null,
43
43
  handlePriceCheckFunc(0, currency),
44
- React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name || 'Karlen'))) : (handlePriceCheckFunc(data.price, currency))))),
44
+ React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name))) : (handlePriceCheckFunc(data.price, currency))))),
45
45
  React.createElement("div", { className: `mobile-total-price-wrap nowrap` },
46
46
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1`, text: `account.order_balance.total` }),
47
- (data.sale_total || data.product?.discount) && !data.is_gift ? (React.createElement(React.Fragment, null,
47
+ data.sale_total && !data.is_gift ? (React.createElement(React.Fragment, null,
48
48
  React.createElement(Text, { className: `account-p account-p3 account-font-medium account-secondary-color2 sale-total`, text: handlePriceCheckFunc(data.sale_total, currency) }),
49
49
  React.createElement("div", { className: 'wrapper-discount' },
50
- data.product?.discount ? (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color2 discount-text-mobile` },
51
- data.product.discount,
52
- data.product?.discount_type === 'percentage' ? '%' : ` ${currency}`,
53
- "\u00A0",
54
- React.createElement("span", { className: 'lowercase' }, translate('account.order_balance.discount')))) : null,
55
- React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through total1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 total2`, text: handlePriceCheckFunc(data.is_gift ? 0 : data.total, currency) }, data.is_gift ? (React.createElement(React.Fragment, null,
56
- handlePriceCheckFunc(0, currency),
57
- React.createElement("span", { className: 'gift-name-text' }, data?.appliedPromotion?.name || 'Karlen'))) : (handlePriceCheckFunc(data.total, currency)))))))));
50
+ React.createElement(Text, { className: `account-p account-p3 account-font-regular account-primary-color2 line-through total1`, text: handlePriceCheckFunc(data.total, currency) })))) : (React.createElement(Text, { className: `account-p account-p3 account-font-medium account-primary-color1 total2` }, handlePriceCheckFunc(data.total, currency))))))));
58
51
  });
59
52
  export default ItemMobile;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@weareconceptstudio/account",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Concept Studio Account",
5
5
  "author": "Concept Studio",
6
6
  "license": "ISC",
7
7
  "main": "dist/index.js",
8
+ "sideEffects": false,
8
9
  "files": [
9
10
  "dist"
10
11
  ],