@ikas/loyalty-widget-renderer 1.0.0-alpha.66 → 1.0.0-alpha.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./models/loyalty-widget";
2
2
  export * from "./models/loyalty-widget/types";
3
3
  export * from "./models/loyalty-widget/header";
4
4
  export * from "./models/loyalty-widget/header/header-background";
5
+ export * from "./models/loyalty-widget/translations";
5
6
  export * from "./models/image";
6
7
  export * from "./models/button";
7
8
  export * from "./models/loyalty-customer-info";
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export{LoyaltyWidget}from"./models/loyalty-widget/index.js";export{BadgeIconTypeEnum,HeaderBackgroundTypeEnum,ImageTypeEnum,LoyaltyWidgetLayoutTypeEnum,WidgetIconTypeEnum,WidgetPositionEnum}from"./models/loyalty-widget/types/index.js";export{LoyaltyWidgetHeader}from"./models/loyalty-widget/header/index.js";export{LoyaltyWidgetHeaderBackground}from"./models/loyalty-widget/header/header-background/index.js";export{IMAGE_SIZE,LoyaltyWidgetImage}from"./models/image/index.js";export{LoyaltyWidgetButton}from"./models/button/index.js";export{CampaignTypeEnum,CartLoyaltyLineData,LoyaltyCustomerInfo,LoyaltyProgramTier,LoyaltyProgramTierTranslation,OrderAmountTypeEnum}from"./models/loyalty-customer-info/index.js";export{LoyaltyProgramPointHistory}from"./models/loyalty-program-point-history/index.js";export{LoyaltyProgramDiscountSettings,LoyaltyProgramSpendingMethod}from"./models/loyalty-program-spending-method/index.js";export{LoyaltyProgramEarningMethod,LoyaltyProgramEarningMethodOrderSettings,LoyaltyProgramEarningMethodProductSettings}from"./models/loyalty-program-earning-method/index.js";export{LoyaltyWidgetSettings}from"./models/loyalty-widget/settings/index.js";export{LoyaltyWidgetViewModel}from"./models/index.js";export{EarningMethodTypeEnum,LoyaltyProgramFilterTypeEnum,LoyaltyProgramMethodSpendingTypeEnum,LoyaltyProgramPointEarningTypeEnum,LoyaltyProgramPointHistoryTypeEnum,LoyaltyWidgetScreenTypeEnum,PeriodTypeEnum,WidgetMode}from"./models/types/index.js";export{BadgeLevel1}from"./assets/badgeLevel1.js";export{BadgeLevel2}from"./assets/badgeLevel2.js";export{BadgeLevel3}from"./assets/badgeLevel3.js";export{BadgeLevel4}from"./assets/badgeLevel4.js";export{XClose}from"./assets/icons/x-close.js";export{CheckCircleFill}from"./assets/icons/check-circle-fill.js";export{ChevronLeft}from"./assets/icons/chevron-left.js";export{Check}from"./assets/icons/check.js";export{ArrowRight}from"./assets/icons/arrow-right.js";export{CheckCircle}from"./assets/icons/check-circle.js";export{BubbleChatDone}from"./assets/widget-icons/normal/bubbleChatDone.js";export{CommentAdd01}from"./assets/widget-icons/normal/commentAdd01.js";export{CouponPercent}from"./assets/widget-icons/normal/couponPercent.js";export{DiscountTag02}from"./assets/widget-icons/normal/discountTag02.js";export{Gift}from"./assets/widget-icons/normal/gift.js";export{MoneyAdd01}from"./assets/widget-icons/normal/moneyAdd01.js";export{PackageDelivered}from"./assets/widget-icons/normal/packageDelivered.js";export{SaveMoneyDollar}from"./assets/widget-icons/normal/saveMoneyDollar.js";export{ShoppingBasketAdd02}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";export{UserAdd01}from"./assets/widget-icons/normal/userAdd01.js";export{InformationCircle}from"./assets/widget-icons/normal/informationCircle.js";export{UsersIllustration}from"./assets/widget-icons/illustraions/usersIllustration.js";export{BubbleChatIllustration}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";export{ApprovedChatIllustration}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";export{TshirtIllustration}from"./assets/widget-icons/illustraions/tshirtIllustration.js";export{Medal}from"./assets/widget-icons/illustraions/medal.js";export{GiftIllustration}from"./assets/widget-icons/illustraions/giftIllustration.js";export{ShippingBox}from"./assets/widget-icons/illustraions/shippingBox.js";export{BigSaleMedal}from"./assets/widget-icons/illustraions/bigSaleMedal.js";export{ShoppingCartIllustration}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";export{InformationCircleIllustration}from"./assets/widget-icons/illustraions/informationCircleIllustration.js";export{CheckFillIllustration}from"./assets/widget-icons/illustraions/check-fill.js";export{default as LoyaltyWidgetRenderer}from"./renderer/index.js";
1
+ export{LoyaltyWidget}from"./models/loyalty-widget/index.js";export{BadgeIconTypeEnum,HeaderBackgroundTypeEnum,ImageTypeEnum,LoyaltyWidgetLayoutTypeEnum,WidgetIconTypeEnum,WidgetPositionEnum}from"./models/loyalty-widget/types/index.js";export{LoyaltyWidgetHeader}from"./models/loyalty-widget/header/index.js";export{LoyaltyWidgetHeaderBackground}from"./models/loyalty-widget/header/header-background/index.js";export{LoyaltyWidgetTranslations}from"./models/loyalty-widget/translations.js";export{IMAGE_SIZE,LoyaltyWidgetImage}from"./models/image/index.js";export{LoyaltyWidgetButton}from"./models/button/index.js";export{CampaignTypeEnum,CartLoyaltyLineData,LoyaltyCustomerInfo,LoyaltyProgramTier,LoyaltyProgramTierTranslation,OrderAmountTypeEnum}from"./models/loyalty-customer-info/index.js";export{LoyaltyProgramPointHistory}from"./models/loyalty-program-point-history/index.js";export{LoyaltyProgramDiscountSettings,LoyaltyProgramSpendingMethod}from"./models/loyalty-program-spending-method/index.js";export{LoyaltyProgramEarningMethod,LoyaltyProgramEarningMethodOrderSettings,LoyaltyProgramEarningMethodProductSettings}from"./models/loyalty-program-earning-method/index.js";export{LoyaltyWidgetSettings}from"./models/loyalty-widget/settings/index.js";export{LoyaltyWidgetViewModel}from"./models/index.js";export{EarningMethodTypeEnum,LoyaltyProgramFilterTypeEnum,LoyaltyProgramMethodSpendingTypeEnum,LoyaltyProgramPointEarningTypeEnum,LoyaltyProgramPointHistoryTypeEnum,LoyaltyWidgetScreenTypeEnum,PeriodTypeEnum,WidgetMode}from"./models/types/index.js";export{BadgeLevel1}from"./assets/badgeLevel1.js";export{BadgeLevel2}from"./assets/badgeLevel2.js";export{BadgeLevel3}from"./assets/badgeLevel3.js";export{BadgeLevel4}from"./assets/badgeLevel4.js";export{XClose}from"./assets/icons/x-close.js";export{CheckCircleFill}from"./assets/icons/check-circle-fill.js";export{ChevronLeft}from"./assets/icons/chevron-left.js";export{Check}from"./assets/icons/check.js";export{ArrowRight}from"./assets/icons/arrow-right.js";export{CheckCircle}from"./assets/icons/check-circle.js";export{BubbleChatDone}from"./assets/widget-icons/normal/bubbleChatDone.js";export{CommentAdd01}from"./assets/widget-icons/normal/commentAdd01.js";export{CouponPercent}from"./assets/widget-icons/normal/couponPercent.js";export{DiscountTag02}from"./assets/widget-icons/normal/discountTag02.js";export{Gift}from"./assets/widget-icons/normal/gift.js";export{MoneyAdd01}from"./assets/widget-icons/normal/moneyAdd01.js";export{PackageDelivered}from"./assets/widget-icons/normal/packageDelivered.js";export{SaveMoneyDollar}from"./assets/widget-icons/normal/saveMoneyDollar.js";export{ShoppingBasketAdd02}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";export{UserAdd01}from"./assets/widget-icons/normal/userAdd01.js";export{InformationCircle}from"./assets/widget-icons/normal/informationCircle.js";export{UsersIllustration}from"./assets/widget-icons/illustraions/usersIllustration.js";export{BubbleChatIllustration}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";export{ApprovedChatIllustration}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";export{TshirtIllustration}from"./assets/widget-icons/illustraions/tshirtIllustration.js";export{Medal}from"./assets/widget-icons/illustraions/medal.js";export{GiftIllustration}from"./assets/widget-icons/illustraions/giftIllustration.js";export{ShippingBox}from"./assets/widget-icons/illustraions/shippingBox.js";export{BigSaleMedal}from"./assets/widget-icons/illustraions/bigSaleMedal.js";export{ShoppingCartIllustration}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";export{InformationCircleIllustration}from"./assets/widget-icons/illustraions/informationCircleIllustration.js";export{CheckFillIllustration}from"./assets/widget-icons/illustraions/check-fill.js";export{default as LoyaltyWidgetRenderer}from"./renderer/index.js";
@@ -19,7 +19,6 @@ export declare class LoyaltyWidgetViewModel {
19
19
  merchantId: string;
20
20
  storeUrl: string;
21
21
  currency: string;
22
- locale: string;
23
22
  isPreviewMode: boolean;
24
23
  user: LoyaltyCustomerInfo | null;
25
24
  categories: Category[] | null;
@@ -31,7 +30,7 @@ export declare class LoyaltyWidgetViewModel {
31
30
  tiers: LoyaltyProgramTier[];
32
31
  pointHistory: LoyaltyProgramPointHistory[];
33
32
  callbacks?: LoyaltyWidgetCallbacks;
34
- constructor(data: Partial<LoyaltyWidgetViewModel> | undefined, cdnURL: string, merchantId: string, currency: string, locale: string, storeURL?: string | null, isPreviewMode?: boolean, callbacks?: LoyaltyWidgetCallbacks);
33
+ constructor(data: Partial<LoyaltyWidgetViewModel> | undefined, cdnURL: string, merchantId: string, currency: string, storeURL?: string | null, isPreviewMode?: boolean, callbacks?: LoyaltyWidgetCallbacks);
35
34
  get shouldShowSpendingMethods(): boolean;
36
35
  setWidgetMode(mode: WidgetMode): void;
37
36
  closeMiniModeDescription(): void;
@@ -1 +1 @@
1
- import{__assign as e}from'./../ext/tslib/tslib.es6.mjs.js';import{makeObservable as t,observable as i,action as s,computed as r}from"mobx";import{LoyaltyCustomerInfo as o}from"./loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as n}from"./loyalty-program-earning-method/index.js";import{LoyaltyProgramSpendingMethod as d}from"./loyalty-program-spending-method/index.js";import{LoyaltyWidget as c}from"./loyalty-widget/index.js";import{WidgetMode as a,LoyaltyWidgetScreenTypeEnum as h}from"./types/index.js";var l=function(){function l(l,g,u,p,M,m,y,f){void 0===l&&(l={}),this.userRefreshTrigger=0,this.cartRefreshTrigger=0,this.selectedScreen=l.selectedScreen||h.MAIN_SCREEN,this.currentWidgetMode=y?a.WIDGET_MODE:a.MINI_MODE,this.isMiniModeDescriptionClosed=l.isMiniModeDescriptionClosed||!1,this.isLoading=l.isLoading||!1,this.isActionLoading=l.isActionLoading||!1,this.loyaltyWidget=new c(l.loyaltyWidget),this.cdnURL=g,this.merchantId=u,this.storeUrl=m||l.storeUrl||"",this.currency=p,this.locale=M,this.isPreviewMode=y||!1,this.cartId=l.cartId||null,this.cartId=l.cartId||null,this.ikasEventUser=l.ikasEventUser||null,this.user=l.user?new o(l.user):null,this.earningMethods=l.earningMethods?l.earningMethods.map(function(e){return new n(e)}):[],this.spendingMethods=l.spendingMethods?l.spendingMethods.map(function(e){return new d(e)}):[],this.tiers=l.tiers?l.tiers:[],this.categories=l.categories?l.categories:[],this.products=l.products?l.products:[],this.brands=l.brands?l.brands:[],this.tags=l.tags?l.tags:[],this.pointHistory=l.pointHistory?l.pointHistory:[],this.callbacks=f||void 0,t(this,e(e({cartId:i},y?{}:{loyaltyWidget:i}),{isLoading:i,isActionLoading:i,cdnURL:i,merchantId:i,storeUrl:i,currency:i,locale:i,setWidgetMode:s.bound,closeMiniModeDescription:s.bound,formatCurrency:s.bound,selectedScreen:i,currentWidgetMode:i,isMiniModeDescriptionClosed:i,user:i,earningMethods:i,spendingMethods:i,tiers:i,categories:i,products:i,brands:i,tags:i,pointHistory:i,ikasEventUser:i,userRefreshTrigger:i,cartRefreshTrigger:i,shouldShowSpendingMethods:r}))}return Object.defineProperty(l.prototype,"shouldShowSpendingMethods",{get:function(){return!!this.user&&(!(this.user.totalPoint<=0)&&0!==this.spendingMethods.length)},enumerable:!1,configurable:!0}),l.prototype.setWidgetMode=function(e){this.currentWidgetMode=e,e!==a.WIDGET_MODE||this.isPreviewMode||(this.isMiniModeDescriptionClosed=!0)},l.prototype.closeMiniModeDescription=function(){this.isMiniModeDescriptionClosed=!0},l.prototype.formatCurrency=function(e){var t;return(null===(t=this.callbacks)||void 0===t?void 0:t.formatCurrency)?this.callbacks.formatCurrency(e):"".concat(e.toFixed(2)," ").concat(this.currency)},l}();export{l as LoyaltyWidgetViewModel};
1
+ import{__assign as e}from'./../ext/tslib/tslib.es6.mjs.js';import{makeObservable as t,observable as i,action as s,computed as r}from"mobx";import{LoyaltyCustomerInfo as o}from"./loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as n}from"./loyalty-program-earning-method/index.js";import{LoyaltyProgramSpendingMethod as d}from"./loyalty-program-spending-method/index.js";import{LoyaltyWidget as c}from"./loyalty-widget/index.js";import{WidgetMode as a,LoyaltyWidgetScreenTypeEnum as h}from"./types/index.js";var l=function(){function l(l,g,u,p,M,m,y){void 0===l&&(l={}),this.userRefreshTrigger=0,this.cartRefreshTrigger=0,this.selectedScreen=l.selectedScreen||h.MAIN_SCREEN,this.currentWidgetMode=m?a.WIDGET_MODE:a.MINI_MODE,this.isMiniModeDescriptionClosed=l.isMiniModeDescriptionClosed||!1,this.isLoading=l.isLoading||!1,this.isActionLoading=l.isActionLoading||!1,this.loyaltyWidget=new c(l.loyaltyWidget),this.cdnURL=g,this.merchantId=u,this.storeUrl=M||l.storeUrl||"",this.currency=p,this.isPreviewMode=m||!1,this.cartId=l.cartId||null,this.cartId=l.cartId||null,this.ikasEventUser=l.ikasEventUser||null,this.user=l.user?new o(l.user):null,this.earningMethods=l.earningMethods?l.earningMethods.map(function(e){return new n(e)}):[],this.spendingMethods=l.spendingMethods?l.spendingMethods.map(function(e){return new d(e)}):[],this.tiers=l.tiers?l.tiers:[],this.categories=l.categories?l.categories:[],this.products=l.products?l.products:[],this.brands=l.brands?l.brands:[],this.tags=l.tags?l.tags:[],this.pointHistory=l.pointHistory?l.pointHistory:[],this.callbacks=y||void 0,t(this,e(e({cartId:i},m?{}:{loyaltyWidget:i}),{isLoading:i,isActionLoading:i,cdnURL:i,merchantId:i,storeUrl:i,currency:i,setWidgetMode:s.bound,closeMiniModeDescription:s.bound,formatCurrency:s.bound,selectedScreen:i,currentWidgetMode:i,isMiniModeDescriptionClosed:i,user:i,earningMethods:i,spendingMethods:i,tiers:i,categories:i,products:i,brands:i,tags:i,pointHistory:i,ikasEventUser:i,userRefreshTrigger:i,cartRefreshTrigger:i,shouldShowSpendingMethods:r}))}return Object.defineProperty(l.prototype,"shouldShowSpendingMethods",{get:function(){return!!this.user&&(!(this.user.totalPoint<=0)&&0!==this.spendingMethods.length)},enumerable:!1,configurable:!0}),l.prototype.setWidgetMode=function(e){this.currentWidgetMode=e,e!==a.WIDGET_MODE||this.isPreviewMode||(this.isMiniModeDescriptionClosed=!0)},l.prototype.closeMiniModeDescription=function(){this.isMiniModeDescriptionClosed=!0},l.prototype.formatCurrency=function(e){var t;return(null===(t=this.callbacks)||void 0===t?void 0:t.formatCurrency)?this.callbacks.formatCurrency(e):"".concat(e.toFixed(2)," ").concat(this.currency)},l}();export{l as LoyaltyWidgetViewModel};
@@ -2,11 +2,13 @@ import { MiniMode } from "models/mini-mode";
2
2
  import { LoyaltyWidgetButton } from "../button";
3
3
  import { LoyaltyWidgetHeader } from "./header";
4
4
  import { LoyaltyWidgetSettings } from "./settings";
5
+ import { LoyaltyWidgetTranslations } from "./translations";
5
6
  export declare class LoyaltyWidget {
6
7
  id: string;
7
8
  settings: LoyaltyWidgetSettings;
8
9
  header: LoyaltyWidgetHeader;
9
10
  button: LoyaltyWidgetButton;
10
11
  miniMode: MiniMode;
12
+ translations: LoyaltyWidgetTranslations;
11
13
  constructor(data?: Partial<LoyaltyWidget>);
12
14
  }
@@ -1 +1 @@
1
- import{makeObservable as e,observable as i}from"mobx";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import t from'./../../ext/uuid/dist/esm-browser/v4.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import{MiniMode as o}from"../mini-mode/index.js";import{LoyaltyWidgetButton as s}from"../button/index.js";import{LoyaltyWidgetHeader as d}from"./header/index.js";import{LoyaltyWidgetSettings as n}from"./settings/index.js";var r=function(r){void 0===r&&(r={}),this.id=r.id||t(),this.header=r.header?new d(r.header):new d({}),this.settings=r.settings?new n(r.settings):new n({}),this.miniMode=r.miniMode?new o(r.miniMode):new o({}),this.button=r.button?new s(r.button):new s({}),e(this,{id:i,miniMode:i,button:i,header:i,settings:i})};export{r as LoyaltyWidget};
1
+ import{makeObservable as i,observable as t}from"mobx";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import s from'./../../ext/uuid/dist/esm-browser/v4.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import{MiniMode as e}from"../mini-mode/index.js";import{LoyaltyWidgetButton as o}from"../button/index.js";import{LoyaltyWidgetHeader as n}from"./header/index.js";import{LoyaltyWidgetSettings as r}from"./settings/index.js";import{LoyaltyWidgetTranslations as d}from"./translations.js";var m=function(m){void 0===m&&(m={}),this.id=m.id||s(),this.header=m.header?new n(m.header):new n({}),this.settings=m.settings?new r(m.settings):new r({}),this.miniMode=m.miniMode?new e(m.miniMode):new e({}),this.button=m.button?new o(m.button):new o({}),this.translations=m.translations?new d(m.translations):new d({}),i(this,{id:t,miniMode:t,button:t,header:t,settings:t,translations:t})};export{m as LoyaltyWidget};
@@ -0,0 +1,5 @@
1
+ export declare class LoyaltyWidgetTranslations {
2
+ language: string;
3
+ custom: Record<string, string>;
4
+ constructor(data?: Partial<LoyaltyWidgetTranslations>);
5
+ }
@@ -0,0 +1 @@
1
+ import{makeObservable as t,observable as o}from"mobx";var a=function(a){void 0===a&&(a={}),this.language=a.language||"tr",this.custom=a.custom||{},t(this,{language:o,custom:o})};export{a as LoyaltyWidgetTranslations};
@@ -1 +1 @@
1
- import e from"react";import{observer as o}from"mobx-react";import{WidgetMode as t}from"../../../models/types/index.js";import{XClose as i}from"../../../assets/icons/x-close.js";import{Container as r,CloseButton as a,Text as n}from"./style.js";var l=o(function(o){var l=o.viewModel;return l.isMiniModeDescriptionClosed?null:e.createElement(r,{onClick:function(e){e.stopPropagation(),l.setWidgetMode(t.WIDGET_MODE)}},e.createElement(a,{onClick:function(e){e.stopPropagation(),l.closeMiniModeDescription()}},e.createElement(i,null)),e.createElement(n,null,"Merhaba! 👋 Sadakat programın ve destek ekibimiz burada. Puanlarına göz at veya ekibimizle konuş."))});export{l as default};
1
+ import e from"react";import{observer as o}from"mobx-react";import{WidgetMode as t}from"../../../models/types/index.js";import{XClose as i}from"../../../assets/icons/x-close.js";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as n}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{Container as r,CloseButton as s,Text as l}from"./style.js";var m=o(function(o){var m=o.viewModel,c=n().t;return m.isMiniModeDescriptionClosed?null:e.createElement(r,{onClick:function(e){e.stopPropagation(),m.setWidgetMode(t.WIDGET_MODE)}},e.createElement(s,{onClick:function(e){e.stopPropagation(),m.closeMiniModeDescription()}},e.createElement(i,null)),e.createElement(l,null,c("miniMode.description")))});export{m as default};
@@ -0,0 +1,9 @@
1
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const Header: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const HeaderCol: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const List: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const Row: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const OriginalText: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export declare const ArrowConnection: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const InputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as r}from'./../ext/tslib/tslib.es6.mjs.js';import{observer as n}from"mobx-react";import i,{useState as o,useEffect as s}from"react";import'./../ext/react-i18next/dist/es/context.js';import{I18nextProvider as a}from'./../ext/react-i18next/dist/es/I18nextProvider.js';import{LoyaltyWidgetViewModel as c}from"../models/index.js";import{LoyaltyCustomerInfo as l}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as d}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as u}from"../models/loyalty-program-point-history/index.js";import{LoyaltyProgramSpendingMethod as f}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyWidget as m}from"../models/loyalty-widget/index.js";import{WidgetPositionEnum as v,LoyaltyWidgetLayoutTypeEnum as E}from"../models/loyalty-widget/types/index.js";import{WidgetMode as g,LoyaltyWidgetScreenTypeEnum as y,EarningMethodTypeEnum as p,LoyaltyProgramFilterTypeEnum as h,LoyaltyProgramMethodSpendingTypeEnum as R}from"../models/types/index.js";import T from"./components/mini-mode-button/index.js";import I from"./components/mini-mode-description/index.js";import w from"./screens/credit-earning-methods-screen/index.js";import M from"./screens/credit-history-screen/index.js";import b from"./screens/credit-spending-methods-screen/index.js";import _ from"./screens/loyalty-level-screen/index.js";import k from"./screens/main-screen/index.js";import C from"./utils/i18n.js";import{Container as S,MiniModeWrapper as A,Panel as N,ScreenWrapper as O}from"./style.js";var D=n(function(n){var D,L,P=n.config,x=o(function(){var e=P||window.ikasLoyaltyWidgetConfig;return new c({cartId:(null==e?void 0:e.cartId)||null,ikasEventUser:(null==e?void 0:e.userId)?{id:e.userId}:null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.locale)||"",(null==e?void 0:e.storeURL)||null,null==e?void 0:e.isPreviewMode,null==e?void 0:e.callbacks)})[0],j=o(!1),U=j[0],W=j[1];s(function(){var e=P||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized(x)},[x,P]);var $=function(){return e(void 0,void 0,void 0,function(){var e,n,i,o,s;return t(this,function(t){switch(t.label){case 0:return x.callbacks?(e=new Set,n=new Set,i=new Set,o=new Set,x.earningMethods.forEach(function(t){var s,a;t.methodType===p.ORDER_CREATE&&r(r([],(null===(s=t.orderSettings)||void 0===s?void 0:s.productFilters)||[],!0),(null===(a=t.productSettings)||void 0===a?void 0:a.productFilters)||[],!0).forEach(function(t){t.type===h.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){return e.add(t)}):t.type===h.CATEGORY?t.idList.forEach(function(e){return n.add(e)}):t.type===h.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===h.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),x.spendingMethods&&x.spendingMethods.forEach(function(t){var r,s;t.type===R.FREE_PRODUCT&&(null===(r=t.discountSettings)||void 0===r?void 0:r.freeProductId)&&e.add(t.discountSettings.freeProductId),null===(s=t.productFilters)||void 0===s||s.forEach(function(t){t.type===h.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){return e.add(t)}):t.type===h.CATEGORY?t.idList.forEach(function(e){return n.add(e)}):t.type===h.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===h.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),s=[],e.size>0&&x.callbacks.getProducts&&s.push(x.callbacks.getProducts(Array.from(e)).then(function(e){return x.products=e})),n.size>0&&x.callbacks.getCategories&&s.push(x.callbacks.getCategories(Array.from(n)).then(function(e){return x.categories=e})),i.size>0&&x.callbacks.getBrands&&s.push(x.callbacks.getBrands(Array.from(i)).then(function(e){return x.brands=e})),o.size>0&&x.callbacks.getTags&&s.push(x.callbacks.getTags(Array.from(o)).then(function(e){return x.tags=e})),[4,Promise.all(s)]):[2];case 1:return t.sent(),[2]}})})};s(function(){e(void 0,void 0,void 0,function(){var e,r,n,i,o,s;return t(this,function(t){switch(t.label){case 0:if(!x.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[x.callbacks.getLoyaltyWidget(),x.callbacks.listEarningMethods(),x.callbacks.listLoyaltyProgramTier({})],[4,Promise.all(e)];case 2:return r=t.sent(),n=r[0],i=r[1],o=r[2],x.loyaltyWidget=n instanceof m?n:new m(n||{}),x.earningMethods=i.map(function(e){return new d(e)}),x.tiers=o||[],[4,$()];case 3:return t.sent(),[3,6];case 4:return s=t.sent(),console.error("Failed to initialize loyalty data",s),[3,6];case 5:return W(!0),[7];case 6:return[2]}})})},[]),s(function(){if(window.IkasEvents){var e=function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.customer;r&&(x.ikasEventUser=r),x.userRefreshTrigger++,x.cartRefreshTrigger++},t=function(e){var t,r,n,i,o,s=x.cartId,a=null===(r=null===(t=e.data)||void 0===t?void 0:t.cart)||void 0===r?void 0:r.id;0===(null===(o=null===(i=null===(n=e.data)||void 0===n?void 0:n.cart)||void 0===i?void 0:i.orderLineItems)||void 0===o?void 0:o.length)?x.cartId=null:x.cartId=a,s!==x.cartId&&x.cartRefreshTrigger++},r={CUSTOMER_LOGIN:e,CUSTOMER_VISIT:e,CUSTOMER_LOGOUT:function(){x.userRefreshTrigger++,x.cartRefreshTrigger++},ADD_TO_CART:t,REMOVE_FROM_CART:t,REMOVE_LOYALTY_POINTS:function(e){x.cartRefreshTrigger++,x.userRefreshTrigger++},PAGE_VIEW:function(e){var t,r,n=null===(t=e.data)||void 0===t?void 0:t.customer;if(n){var i=!x.ikasEventUser,o=(null===(r=x.ikasEventUser)||void 0===r?void 0:r.subscriptionStatus)!==n.subscriptionStatus;(i||o)&&(x.ikasEventUser=n,x.userRefreshTrigger++,x.cartRefreshTrigger++)}}},n="ikas-loyalty-widget-subscriber";try{window.IkasEvents.subscribe({id:n,callback:function(e){var t=r[e.type];console.log("event",e),t&&t(e)}})}catch(e){console.error("Failed to subscribe to IkasEvents",e)}return function(){var e;(null===(e=window.IkasEvents)||void 0===e?void 0:e.unsubscribe)&&window.IkasEvents.unsubscribe(n)}}},[x]),s(function(){e(void 0,void 0,void 0,function(){var e,r,n,i,o;return t(this,function(t){switch(t.label){case 0:if(!x.callbacks||!(null===(o=x.ikasEventUser)||void 0===o?void 0:o.id))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Promise.all([x.callbacks.getLoyaltyCustomerInfo(),x.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),r=e[0],n=e[1],x.user=r?new l(r):null,r||(x.ikasEventUser=null),x.pointHistory=n?n.map(function(e){return new u(e)}):[],[3,4];case 3:return i=t.sent(),console.error("Failed to fetch user data",i),[3,4];case 4:return[2]}})})},[null===(D=x.ikasEventUser)||void 0===D?void 0:D.id,x.userRefreshTrigger]),s(function(){e(void 0,void 0,void 0,function(){var e,r;return t(this,function(t){switch(t.label){case 0:if(!x.callbacks)return[3,5];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,x.callbacks.listSpendingMethodsByCartId(x.cartId)];case 2:return e=t.sent(),x.spendingMethods=e.map(function(e){return new f(e)}),[4,$()];case 3:return t.sent(),[3,5];case 4:return r=t.sent(),console.error("Failed to fetch cart data",r),[3,5];case 5:return[2]}})})},[x.cartId,x.cartRefreshTrigger]);var G=function(e){x.selectedScreen=e},V=function(){x.setWidgetMode(g.MINI_MODE),setTimeout(function(){x.selectedScreen=y.MAIN_SCREEN},300)};s(function(){return x.currentWidgetMode===g.WIDGET_MODE?document.body.style.overflow="hidden":document.body.style.overflow="",function(){document.body.style.overflow=""}},[x.currentWidgetMode]);var B=x.selectedScreen===y.MAIN_SCREEN,F=o(null),z=F[0],Y=F[1];s(function(){x.selectedScreen!==y.MAIN_SCREEN&&Y(x.selectedScreen)},[x.selectedScreen]);var H=B?z:x.selectedScreen,q=x.loyaltyWidget.settings.position||v.RIGHT,J=x.loyaltyWidget.settings.type||E.DRAWER;if(!U)return null;var K=(null==P?void 0:P.position)||(null===(L=window.ikasLoyaltyWidgetConfig)||void 0===L?void 0:L.position)||"fixed";return i.createElement(a,{i18n:C},i.createElement(S,{$layoutType:J,$widgetPosition:q,$widgetMode:x.currentWidgetMode,$position:K,onClick:function(){x.currentWidgetMode===g.WIDGET_MODE&&V()},className:"ikas-storefront-widget"},i.createElement(A,{$isVisible:x.currentWidgetMode===g.MINI_MODE,$widgetPosition:q},i.createElement(I,{viewModel:x}),i.createElement(T,{viewModel:x})),i.createElement(N,{$layoutType:J,$isOpen:x.currentWidgetMode===g.WIDGET_MODE,$widgetPosition:q,onClick:function(e){return e.stopPropagation()}},i.createElement(O,{$isActive:B,$isMain:!0,$layoutType:J},i.createElement(k,{viewModel:x,onClose:V,onNavigate:G})),i.createElement(O,{$isActive:!B,$isMain:!1,$layoutType:J},function(){switch(H){case y.CREDIT_SPENDING_METHODS_SCREEN:return i.createElement(b,{viewModel:x,onBack:function(){return G(y.MAIN_SCREEN)},onClose:V});case y.CREDIT_EARNING_METHODS_SCREEN:return i.createElement(w,{viewModel:x,onBack:function(){return G(y.MAIN_SCREEN)},onClose:V});case y.CREDIT_HISTORY_SCREEN:return i.createElement(M,{viewModel:x,onBack:function(){return G(y.MAIN_SCREEN)},onClose:V});case y.LOYALTY_LEVEL_SCREEN:return i.createElement(_,{viewModel:x,onBack:function(){return G(y.MAIN_SCREEN)},onClose:V});default:return null}}()))))});export{D as default};
1
+ import{__awaiter as e,__generator as t,__spreadArray as n}from'./../ext/tslib/tslib.es6.mjs.js';import{toJS as r}from"mobx";import{observer as i}from"mobx-react";import o,{useState as s,useEffect as a}from"react";import'./../ext/react-i18next/dist/es/context.js';import{I18nextProvider as l}from'./../ext/react-i18next/dist/es/I18nextProvider.js';import{LoyaltyWidgetViewModel as c}from"../models/index.js";import{LoyaltyCustomerInfo as d}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as u}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as f}from"../models/loyalty-program-point-history/index.js";import{LoyaltyProgramSpendingMethod as m}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyWidget as v}from"../models/loyalty-widget/index.js";import{WidgetPositionEnum as g,LoyaltyWidgetLayoutTypeEnum as E}from"../models/loyalty-widget/types/index.js";import{WidgetMode as y,LoyaltyWidgetScreenTypeEnum as p,EarningMethodTypeEnum as h,LoyaltyProgramFilterTypeEnum as R,LoyaltyProgramMethodSpendingTypeEnum as T}from"../models/types/index.js";import I from"./components/mini-mode-button/index.js";import b from"./components/mini-mode-description/index.js";import w from"./screens/credit-earning-methods-screen/index.js";import M from"./screens/credit-history-screen/index.js";import k from"./screens/credit-spending-methods-screen/index.js";import _ from"./screens/loyalty-level-screen/index.js";import C from"./screens/main-screen/index.js";import{unflatten as S}from"./utils/object-utils.js";import N from"./utils/i18n.js";import{Container as A,MiniModeWrapper as O,Panel as D,ScreenWrapper as L}from"./style.js";var P=i(function(i){var P,j,x=i.config,U=s(function(){var e=x||window.ikasLoyaltyWidgetConfig;return new c({cartId:(null==e?void 0:e.cartId)||null,ikasEventUser:(null==e?void 0:e.userId)?{id:e.userId}:null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.storeURL)||null,null==e?void 0:e.isPreviewMode,null==e?void 0:e.callbacks)})[0],W=s(!1),$=W[0],G=W[1],B=U.loyaltyWidget.translations,V=JSON.stringify(r(null==B?void 0:B.custom));a(function(){var e=null==B?void 0:B.language,t=(null==B?void 0:B.custom)?r(B.custom):{};if(e){var n=["tr","en","de","nl","fr"].includes(e)?e:"en";if(N.language!==n&&N.changeLanguage(n),Object.keys(t).length>0){var i=S(t);N.addResourceBundle(n,"translation",i,!0,!0)}}},[null==B?void 0:B.language,V]),a(function(){var e=x||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized(U)},[U,x]);var F=function(){return e(void 0,void 0,void 0,function(){var e,r,i,o,s;return t(this,function(t){switch(t.label){case 0:return U.callbacks?(e=new Set,r=new Set,i=new Set,o=new Set,U.earningMethods.forEach(function(t){var s,a;t.methodType===h.ORDER_CREATE&&n(n([],(null===(s=t.orderSettings)||void 0===s?void 0:s.productFilters)||[],!0),(null===(a=t.productSettings)||void 0===a?void 0:a.productFilters)||[],!0).forEach(function(t){t.type===R.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){return e.add(t)}):t.type===R.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===R.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===R.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),U.spendingMethods&&U.spendingMethods.forEach(function(t){var n,s;t.type===T.FREE_PRODUCT&&(null===(n=t.discountSettings)||void 0===n?void 0:n.freeProductId)&&e.add(t.discountSettings.freeProductId),null===(s=t.productFilters)||void 0===s||s.forEach(function(t){t.type===R.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){return e.add(t)}):t.type===R.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===R.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===R.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),s=[],e.size>0&&U.callbacks.getProducts&&s.push(U.callbacks.getProducts(Array.from(e)).then(function(e){return U.products=e})),r.size>0&&U.callbacks.getCategories&&s.push(U.callbacks.getCategories(Array.from(r)).then(function(e){return U.categories=e})),i.size>0&&U.callbacks.getBrands&&s.push(U.callbacks.getBrands(Array.from(i)).then(function(e){return U.brands=e})),o.size>0&&U.callbacks.getTags&&s.push(U.callbacks.getTags(Array.from(o)).then(function(e){return U.tags=e})),[4,Promise.all(s)]):[2];case 1:return t.sent(),[2]}})})};a(function(){e(void 0,void 0,void 0,function(){var e,n,r,i,o,s;return t(this,function(t){switch(t.label){case 0:if(!U.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[U.callbacks.getLoyaltyWidget(),U.callbacks.listEarningMethods(),U.callbacks.listLoyaltyProgramTier({})],[4,Promise.all(e)];case 2:return n=t.sent(),r=n[0],i=n[1],o=n[2],U.loyaltyWidget=r instanceof v?r:new v(r||{}),U.earningMethods=i.map(function(e){return new u(e)}),U.tiers=o||[],[4,F()];case 3:return t.sent(),[3,6];case 4:return s=t.sent(),console.error("Failed to initialize loyalty data",s),[3,6];case 5:return G(!0),[7];case 6:return[2]}})})},[]),a(function(){if(window.IkasEvents){var e=function(e){var t,n=null===(t=e.data)||void 0===t?void 0:t.customer;n&&(U.ikasEventUser=n),U.userRefreshTrigger++,U.cartRefreshTrigger++},t=function(e){var t,n,r,i,o,s=U.cartId,a=null===(n=null===(t=e.data)||void 0===t?void 0:t.cart)||void 0===n?void 0:n.id;0===(null===(o=null===(i=null===(r=e.data)||void 0===r?void 0:r.cart)||void 0===i?void 0:i.orderLineItems)||void 0===o?void 0:o.length)?U.cartId=null:U.cartId=a,s!==U.cartId&&U.cartRefreshTrigger++},n={CUSTOMER_LOGIN:e,CUSTOMER_VISIT:e,CUSTOMER_LOGOUT:function(){U.userRefreshTrigger++,U.cartRefreshTrigger++},ADD_TO_CART:t,REMOVE_FROM_CART:t,REMOVE_LOYALTY_POINTS:function(e){U.cartRefreshTrigger++,U.userRefreshTrigger++},PAGE_VIEW:function(e){var t,n,r=null===(t=e.data)||void 0===t?void 0:t.customer;if(r){var i=!U.ikasEventUser,o=(null===(n=U.ikasEventUser)||void 0===n?void 0:n.subscriptionStatus)!==r.subscriptionStatus;(i||o)&&(U.ikasEventUser=r,U.userRefreshTrigger++,U.cartRefreshTrigger++)}}},r="ikas-loyalty-widget-subscriber";try{window.IkasEvents.subscribe({id:r,callback:function(e){var t=n[e.type];t&&t(e)}})}catch(e){console.error("Failed to subscribe to IkasEvents",e)}return function(){var e;(null===(e=window.IkasEvents)||void 0===e?void 0:e.unsubscribe)&&window.IkasEvents.unsubscribe(r)}}},[U]),a(function(){e(void 0,void 0,void 0,function(){var e,n,r,i,o;return t(this,function(t){switch(t.label){case 0:if(!U.callbacks||!(null===(o=U.ikasEventUser)||void 0===o?void 0:o.id))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Promise.all([U.callbacks.getLoyaltyCustomerInfo(),U.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],U.user=n?new d(n):null,n||(U.ikasEventUser=null),U.pointHistory=r?r.map(function(e){return new f(e)}):[],[3,4];case 3:return i=t.sent(),console.error("Failed to fetch user data",i),[3,4];case 4:return[2]}})})},[null===(P=U.ikasEventUser)||void 0===P?void 0:P.id,U.userRefreshTrigger]),a(function(){e(void 0,void 0,void 0,function(){var e,n;return t(this,function(t){switch(t.label){case 0:if(!U.callbacks)return[3,5];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,U.callbacks.listSpendingMethodsByCartId(U.cartId)];case 2:return e=t.sent(),U.spendingMethods=e.map(function(e){return new m(e)}),[4,F()];case 3:return t.sent(),[3,5];case 4:return n=t.sent(),console.error("Failed to fetch cart data",n),[3,5];case 5:return[2]}})})},[U.cartId,U.cartRefreshTrigger]);var z=function(e){U.selectedScreen=e},Y=function(){U.setWidgetMode(y.MINI_MODE),setTimeout(function(){U.selectedScreen=p.MAIN_SCREEN},300)};a(function(){return U.currentWidgetMode===y.WIDGET_MODE?document.body.style.overflow="hidden":document.body.style.overflow="",function(){document.body.style.overflow=""}},[U.currentWidgetMode]);var H=U.selectedScreen===p.MAIN_SCREEN,J=s(null),q=J[0],K=J[1];a(function(){U.selectedScreen!==p.MAIN_SCREEN&&K(U.selectedScreen)},[U.selectedScreen]);var Q=H?q:U.selectedScreen,X=U.loyaltyWidget.settings.position||g.RIGHT,Z=U.loyaltyWidget.settings.type||E.DRAWER;if(!$)return null;var ee=(null==x?void 0:x.position)||(null===(j=window.ikasLoyaltyWidgetConfig)||void 0===j?void 0:j.position)||"fixed";return o.createElement(l,{i18n:N},o.createElement(A,{$layoutType:Z,$widgetPosition:X,$widgetMode:U.currentWidgetMode,$position:ee,onClick:function(){U.currentWidgetMode===y.WIDGET_MODE&&Y()},className:"ikas-storefront-widget"},o.createElement(O,{$isVisible:U.currentWidgetMode===y.MINI_MODE,$widgetPosition:X},o.createElement(b,{viewModel:U}),o.createElement(I,{viewModel:U})),o.createElement(D,{$layoutType:Z,$isOpen:U.currentWidgetMode===y.WIDGET_MODE,$widgetPosition:X,onClick:function(e){return e.stopPropagation()}},o.createElement(L,{$isActive:H,$isMain:!0,$layoutType:Z},o.createElement(C,{viewModel:U,onClose:Y,onNavigate:z})),o.createElement(L,{$isActive:!H,$isMain:!1,$layoutType:Z},function(){switch(Q){case p.CREDIT_SPENDING_METHODS_SCREEN:return o.createElement(k,{viewModel:U,onBack:function(){return z(p.MAIN_SCREEN)},onClose:Y});case p.CREDIT_EARNING_METHODS_SCREEN:return o.createElement(w,{viewModel:U,onBack:function(){return z(p.MAIN_SCREEN)},onClose:Y});case p.CREDIT_HISTORY_SCREEN:return o.createElement(M,{viewModel:U,onBack:function(){return z(p.MAIN_SCREEN)},onClose:Y});case p.LOYALTY_LEVEL_SCREEN:return o.createElement(_,{viewModel:U,onBack:function(){return z(p.MAIN_SCREEN)},onClose:Y});default:return null}}()))))});export{P as default};
@@ -1 +1 @@
1
- import{observer as e}from"mobx-react";import t from"react";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as n}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{XClose as r}from"../../../assets/icons/x-close.js";import{ChevronLeft as l}from"../../../assets/icons/chevron-left.js";import{LoyaltyProgramPointHistoryTypeEnum as o}from"../../../models/types/index.js";import a from"../../components/count-up/index.js";import{Container as m,Header as c,IconButton as i,Title as s,Content as u,PointsSection as d,PointsTitle as E,PointsValue as p,HistoryList as f,HistoryItem as y,HistoryItemLeft as x,HistoryItemTitle as h,HistoryItemDate as j,HistoryItemAmount as g,Divider as v}from"./style.js";var k=e(function(e){var k=e.viewModel,T=e.onBack,w=e.onClose,C=n().t,R=k.user,b=k.pointHistory,A=k.locale;return t.createElement(m,null,t.createElement(c,null,t.createElement(i,{onClick:T},t.createElement(l,null)),t.createElement(s,null,C("screens.creditHistory")),t.createElement(i,{onClick:w},t.createElement(r,null))),t.createElement(u,null,R&&t.createElement(d,{$borderRadius:k.loyaltyWidget.settings.cartBorderRadius},t.createElement(E,null,C("header.earnedPoints")),t.createElement(p,null,t.createElement(a,{end:R.totalPoint}))),t.createElement(f,null,b.map(function(e,n){var r=e.type===o.EARN;return t.createElement(t.Fragment,{key:e.id},t.createElement(y,null,t.createElement(x,null,t.createElement(h,null,C(r?"history.earnedTitle":"history.spentTitle")),t.createElement(j,null,function(e){if(!e)return"";try{return new Intl.DateTimeFormat(A,{day:"numeric",month:"long",year:"numeric"}).format(new Date(e))}catch(t){return e}}(e.createdAt))),t.createElement(g,{$isEarn:r},r?"":"-",e.amount)),n<b.length-1&&t.createElement(v,null))}))))});export{k as default};
1
+ import{observer as e}from"mobx-react";import t from"react";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as n}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{XClose as r}from"../../../assets/icons/x-close.js";import{ChevronLeft as l}from"../../../assets/icons/chevron-left.js";import{LoyaltyProgramPointHistoryTypeEnum as o}from"../../../models/types/index.js";import a from"../../components/count-up/index.js";import{Container as m,Header as c,IconButton as i,Title as s,Content as u,PointsSection as d,PointsTitle as E,PointsValue as p,HistoryList as f,HistoryItem as y,HistoryItemLeft as x,HistoryItemTitle as g,HistoryItemDate as h,HistoryItemAmount as j,Divider as v}from"./style.js";var k=e(function(e){var k=e.viewModel,T=e.onBack,w=e.onClose,C=n(),R=C.t,b=C.i18n,A=k.user,B=k.pointHistory;return t.createElement(m,null,t.createElement(c,null,t.createElement(i,{onClick:T},t.createElement(l,null)),t.createElement(s,null,R("screens.creditHistory")),t.createElement(i,{onClick:w},t.createElement(r,null))),t.createElement(u,null,A&&t.createElement(d,{$borderRadius:k.loyaltyWidget.settings.cartBorderRadius},t.createElement(E,null,R("header.earnedPoints")),t.createElement(p,null,t.createElement(a,{end:A.totalPoint}))),t.createElement(f,null,B.map(function(e,n){var r=e.type===o.EARN;return t.createElement(t.Fragment,{key:e.id},t.createElement(y,null,t.createElement(x,null,t.createElement(g,null,R(r?"history.earnedTitle":"history.spentTitle")),t.createElement(h,null,function(e){if(!e)return"";try{return new Intl.DateTimeFormat(b.language,{day:"numeric",month:"long",year:"numeric"}).format(new Date(e))}catch(t){return e}}(e.createdAt))),t.createElement(j,{$isEarn:r},r?"":"-",e.amount)),n<B.length-1&&t.createElement(v,null))}))))});export{k as default};