@ikas/loyalty-widget-renderer 1.0.0-alpha.95 → 1.0.0-alpha.96

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.
Files changed (33) hide show
  1. package/build/index.d.ts +1 -0
  2. package/build/index.js +1 -1
  3. package/build/locales.d.ts +55 -0
  4. package/build/models/index.d.ts +2 -0
  5. package/build/models/index.js +1 -1
  6. package/build/models/loyalty-customer-info/index.d.ts +2 -0
  7. package/build/models/loyalty-customer-info/index.js +1 -1
  8. package/build/models/loyalty-program/index.d.ts +5 -0
  9. package/build/models/loyalty-program/index.js +1 -0
  10. package/build/models/loyalty-program-earning-method/index.d.ts +1 -0
  11. package/build/models/loyalty-program-earning-method/index.js +1 -1
  12. package/build/models/loyalty-program-point-history/index.d.ts +1 -0
  13. package/build/models/loyalty-program-point-history/index.js +1 -1
  14. package/build/models/types/index.d.ts +2 -0
  15. package/build/renderer/components/count-up/index.js +1 -1
  16. package/build/renderer/index.js +1 -1
  17. package/build/renderer/screens/credit-history-screen/index.js +1 -1
  18. package/build/renderer/screens/credit-spending-methods-screen/index.js +1 -1
  19. package/build/renderer/screens/gift-product-selection-screen/index.js +1 -1
  20. package/build/renderer/screens/loyalty-level-screen/index.js +1 -1
  21. package/build/renderer/screens/main-screen/earning-methods-section/index.js +1 -1
  22. package/build/renderer/screens/main-screen/header/user-logged-section/index.js +1 -1
  23. package/build/renderer/screens/main-screen/header/user-logged-section/style.d.ts +1 -1
  24. package/build/renderer/screens/main-screen/header/user-logged-section/style.js +1 -1
  25. package/build/renderer/screens/main-screen/spending-methods-section/dynamic-slider.js +1 -1
  26. package/build/renderer/utils/locales/de.json.js +1 -1
  27. package/build/renderer/utils/locales/en.json.js +1 -1
  28. package/build/renderer/utils/locales/fr.json.js +1 -1
  29. package/build/renderer/utils/locales/nl.json.js +1 -1
  30. package/build/renderer/utils/locales/tr.json.js +1 -1
  31. package/build/storefront-widget-script-injector.iife.js +6 -6
  32. package/build/storefront-widget-script-injector.iife.js.map +1 -1
  33. package/package.json +1 -1
package/build/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { locales };
8
8
  export * from "./models/image";
9
9
  export * from "./models/button";
10
10
  export * from "./models/loyalty-customer-info";
11
+ export * from "./models/loyalty-program";
11
12
  export * from "./models/loyalty-program-point-history";
12
13
  export * from "./models/loyalty-program-spending-method";
13
14
  export * from "./models/loyalty-program-earning-method";
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export{default as locales}from"./locales.js";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{Refund}from"./assets/widget-icons/normal/refund.js";export{Album02}from"./assets/widget-icons/normal/album02.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{RefundIllustration}from"./assets/widget-icons/illustraions/refundIllustration.js";export{Scenery}from"./assets/widget-icons/illustraions/scenery.js";export{default as LoyaltyWidgetRenderer}from"./renderer/index.js";export{flatten,unflatten}from"./renderer/utils/object-utils.js";
1
+ export{default as locales}from"./locales.js";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{LoyaltyProgram}from"./models/loyalty-program/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{Refund}from"./assets/widget-icons/normal/refund.js";export{Album02}from"./assets/widget-icons/normal/album02.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{RefundIllustration}from"./assets/widget-icons/illustraions/refundIllustration.js";export{Scenery}from"./assets/widget-icons/illustraions/scenery.js";export{default as LoyaltyWidgetRenderer}from"./renderer/index.js";export{flatten,unflatten}from"./renderer/utils/object-utils.js";
@@ -57,9 +57,13 @@ declare const locales: {
57
57
  registerButton: string;
58
58
  haveAccount: string;
59
59
  earnedPoints: string;
60
+ availablePoints: string;
61
+ pendingPoints: string;
60
62
  logoAlt: string;
61
63
  };
62
64
  earningMethods: {
65
+ waitingPeriod_one: string;
66
+ waitingPeriod_other: string;
63
67
  xPoints: string;
64
68
  CUSTOMER_REGISTER: {
65
69
  title: string;
@@ -101,6 +105,11 @@ declare const locales: {
101
105
  };
102
106
  };
103
107
  history: {
108
+ availableInDays_one: string;
109
+ availableInDays_other: string;
110
+ availableInMinutes_one: string;
111
+ availableInMinutes_other: string;
112
+ availableInHoursAndMinutes: string;
104
113
  expiresInMinutes_one: string;
105
114
  expiresInMinutes_other: string;
106
115
  expiresInHoursAndMinutes: string;
@@ -135,6 +144,8 @@ declare const locales: {
135
144
  creditHistory: string;
136
145
  loyaltyLevel: string;
137
146
  loyaltyLevelScreen: {
147
+ nextTierLabel: string;
148
+ collectPoints: string;
138
149
  afterEarning: string;
139
150
  reachNextTier: string;
140
151
  allTiersCompleted: string;
@@ -207,9 +218,13 @@ declare const locales: {
207
218
  registerButton: string;
208
219
  haveAccount: string;
209
220
  earnedPoints: string;
221
+ availablePoints: string;
222
+ pendingPoints: string;
210
223
  logoAlt: string;
211
224
  };
212
225
  earningMethods: {
226
+ waitingPeriod_one: string;
227
+ waitingPeriod_other: string;
213
228
  xPoints: string;
214
229
  CUSTOMER_REGISTER: {
215
230
  title: string;
@@ -251,6 +266,11 @@ declare const locales: {
251
266
  };
252
267
  };
253
268
  history: {
269
+ availableInDays_one: string;
270
+ availableInDays_other: string;
271
+ availableInMinutes_one: string;
272
+ availableInMinutes_other: string;
273
+ availableInHoursAndMinutes: string;
254
274
  expiresInMinutes_one: string;
255
275
  expiresInMinutes_other: string;
256
276
  expiresInHoursAndMinutes: string;
@@ -285,6 +305,8 @@ declare const locales: {
285
305
  creditHistory: string;
286
306
  loyaltyLevel: string;
287
307
  loyaltyLevelScreen: {
308
+ nextTierLabel: string;
309
+ collectPoints: string;
288
310
  afterEarning: string;
289
311
  reachNextTier: string;
290
312
  allTiersCompleted: string;
@@ -357,9 +379,13 @@ declare const locales: {
357
379
  registerButton: string;
358
380
  haveAccount: string;
359
381
  earnedPoints: string;
382
+ availablePoints: string;
383
+ pendingPoints: string;
360
384
  logoAlt: string;
361
385
  };
362
386
  earningMethods: {
387
+ waitingPeriod_one: string;
388
+ waitingPeriod_other: string;
363
389
  xPoints: string;
364
390
  CUSTOMER_REGISTER: {
365
391
  title: string;
@@ -401,6 +427,11 @@ declare const locales: {
401
427
  };
402
428
  };
403
429
  history: {
430
+ availableInDays_one: string;
431
+ availableInDays_other: string;
432
+ availableInMinutes_one: string;
433
+ availableInMinutes_other: string;
434
+ availableInHoursAndMinutes: string;
404
435
  expiresInMinutes_one: string;
405
436
  expiresInMinutes_other: string;
406
437
  expiresInHoursAndMinutes: string;
@@ -435,6 +466,8 @@ declare const locales: {
435
466
  creditHistory: string;
436
467
  loyaltyLevel: string;
437
468
  loyaltyLevelScreen: {
469
+ nextTierLabel: string;
470
+ collectPoints: string;
438
471
  afterEarning: string;
439
472
  reachNextTier: string;
440
473
  allTiersCompleted: string;
@@ -507,9 +540,13 @@ declare const locales: {
507
540
  registerButton: string;
508
541
  haveAccount: string;
509
542
  earnedPoints: string;
543
+ availablePoints: string;
544
+ pendingPoints: string;
510
545
  logoAlt: string;
511
546
  };
512
547
  earningMethods: {
548
+ waitingPeriod_one: string;
549
+ waitingPeriod_other: string;
513
550
  xPoints: string;
514
551
  CUSTOMER_REGISTER: {
515
552
  title: string;
@@ -551,6 +588,11 @@ declare const locales: {
551
588
  };
552
589
  };
553
590
  history: {
591
+ availableInDays_one: string;
592
+ availableInDays_other: string;
593
+ availableInMinutes_one: string;
594
+ availableInMinutes_other: string;
595
+ availableInHoursAndMinutes: string;
554
596
  expiresInMinutes_one: string;
555
597
  expiresInMinutes_other: string;
556
598
  expiresInHoursAndMinutes: string;
@@ -585,6 +627,8 @@ declare const locales: {
585
627
  creditHistory: string;
586
628
  loyaltyLevel: string;
587
629
  loyaltyLevelScreen: {
630
+ nextTierLabel: string;
631
+ collectPoints: string;
588
632
  afterEarning: string;
589
633
  reachNextTier: string;
590
634
  allTiersCompleted: string;
@@ -657,9 +701,13 @@ declare const locales: {
657
701
  registerButton: string;
658
702
  haveAccount: string;
659
703
  earnedPoints: string;
704
+ availablePoints: string;
705
+ pendingPoints: string;
660
706
  logoAlt: string;
661
707
  };
662
708
  earningMethods: {
709
+ waitingPeriod_one: string;
710
+ waitingPeriod_other: string;
663
711
  xPoints: string;
664
712
  CUSTOMER_REGISTER: {
665
713
  title: string;
@@ -701,6 +749,11 @@ declare const locales: {
701
749
  };
702
750
  };
703
751
  history: {
752
+ availableInDays_one: string;
753
+ availableInDays_other: string;
754
+ availableInMinutes_one: string;
755
+ availableInMinutes_other: string;
756
+ availableInHoursAndMinutes: string;
704
757
  expiresInMinutes_one: string;
705
758
  expiresInMinutes_other: string;
706
759
  expiresInHoursAndMinutes: string;
@@ -735,6 +788,8 @@ declare const locales: {
735
788
  creditHistory: string;
736
789
  loyaltyLevel: string;
737
790
  loyaltyLevelScreen: {
791
+ nextTierLabel: string;
792
+ collectPoints: string;
738
793
  afterEarning: string;
739
794
  reachNextTier: string;
740
795
  allTiersCompleted: string;
@@ -1,4 +1,5 @@
1
1
  import { LoyaltyCustomerInfo, LoyaltyProgramTier } from "./loyalty-customer-info";
2
+ import { LoyaltyProgram } from "./loyalty-program";
2
3
  import { LoyaltyProgramEarningMethod } from "./loyalty-program-earning-method";
3
4
  import { LoyaltyProgramPointHistory } from "./loyalty-program-point-history";
4
5
  import { LoyaltyProgramSpendingMethod } from "./loyalty-program-spending-method";
@@ -21,6 +22,7 @@ export declare class LoyaltyWidgetViewModel {
21
22
  currency: string;
22
23
  isPreviewMode: boolean;
23
24
  user: LoyaltyCustomerInfo | null;
25
+ loyaltyProgram: LoyaltyProgram | null;
24
26
  categories: Category[] | null;
25
27
  products: Product[];
26
28
  brands: Brand[];
@@ -1 +1 @@
1
- import{__assign as t}from'./../ext/tslib/tslib.es6.mjs.js';import{makeObservable as i,observable as e,computed as o,action as n}from"mobx";import{markDescriptionClosedForSession as r,markDescriptionPermanentlyClosed as s,isDescriptionClosedForCurrentSession as d,isDescriptionPermanentlyClosed as a}from"../utils.js";import{LoyaltyCustomerInfo as c}from"./loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as h}from"./loyalty-program-earning-method/index.js";import{LoyaltyProgramSpendingMethod as u}from"./loyalty-program-spending-method/index.js";import{LoyaltyWidget as p}from"./loyalty-widget/index.js";import{LoyaltyWidgetScreenTypeEnum as g,WidgetMode as l}from"./types/index.js";var y=function(){function y(r,s,y,M,f,m,v){void 0===r&&(r={}),this.userRefreshTrigger=0,this.cartRefreshTrigger=0,this.navigationStack=[g.MAIN_SCREEN],this.currentWidgetMode=m?l.WIDGET_MODE:l.MINI_MODE,this.isMiniModeDescriptionClosed=d()||a(),this.isLoading=r.isLoading||!1,this.isActionLoading=r.isActionLoading||!1,this.loyaltyWidget=new p(r.loyaltyWidget),this.cdnURL=s,this.merchantId=y,this.storeUrl=f||r.storeUrl||"",this.currency=M,this.isPreviewMode=m||!1,this.cartId=r.cartId||null,this.ikasEventUser=r.ikasEventUser||null,this.user=r.user?new c(r.user):null,this.earningMethods=r.earningMethods?r.earningMethods.map(function(t){return new h(t)}):[],this.spendingMethods=r.spendingMethods?r.spendingMethods.map(function(t){return new u(t)}):[],this.tiers=r.tiers?r.tiers:[],this.categories=r.categories?r.categories:[],this.products=r.products?r.products:[],this.brands=r.brands?r.brands:[],this.tags=r.tags?r.tags:[],this.pointHistory=r.pointHistory?r.pointHistory:[],this.callbacks=v||void 0,i(this,t(t({cartId:e},m?{}:{loyaltyWidget:e}),{isLoading:e,isActionLoading:e,cdnURL:e,merchantId:e,storeUrl:e,currency:e,navigationStack:e,currentScreen:o,isMainScreen:o,pushScreen:n.bound,popScreen:n.bound,resetNavigation:n.bound,setWidgetMode:n.bound,closeMiniModeDescription:n.bound,formatCurrency:n.bound,currentWidgetMode:e,isMiniModeDescriptionClosed:e,user:e,earningMethods:e,spendingMethods:e,tiers:e,categories:e,products:e,brands:e,tags:e,pointHistory:e,ikasEventUser:e,userRefreshTrigger:e,cartRefreshTrigger:e,shouldShowSpendingMethods:o}))}return Object.defineProperty(y.prototype,"currentScreen",{get:function(){return this.navigationStack[this.navigationStack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isMainScreen",{get:function(){return this.currentScreen===g.MAIN_SCREEN},enumerable:!1,configurable:!0}),y.prototype.pushScreen=function(t){this.currentScreen!==t&&this.navigationStack.push(t)},y.prototype.popScreen=function(){this.navigationStack.length>1&&this.navigationStack.pop()},y.prototype.resetNavigation=function(){this.navigationStack=[g.MAIN_SCREEN]},Object.defineProperty(y.prototype,"shouldShowSpendingMethods",{get:function(){return!!this.user&&(!(this.user.totalPoint<=0)&&0!==this.spendingMethods.length)},enumerable:!1,configurable:!0}),y.prototype.setWidgetMode=function(t){var i,e;this.currentWidgetMode=t,t!==l.WIDGET_MODE||this.isPreviewMode||(this.isMiniModeDescriptionClosed=!0,r(),(null===(e=null===(i=this.loyaltyWidget)||void 0===i?void 0:i.miniMode)||void 0===e?void 0:e.hideDescriptionAfterClose)&&s())},y.prototype.closeMiniModeDescription=function(){var t,i;this.isMiniModeDescriptionClosed=!0,r(),(null===(i=null===(t=this.loyaltyWidget)||void 0===t?void 0:t.miniMode)||void 0===i?void 0:i.hideDescriptionAfterClose)&&s()},y.prototype.formatCurrency=function(t){var i;return(null===(i=this.callbacks)||void 0===i?void 0:i.formatCurrency)?this.callbacks.formatCurrency(t):"".concat(t.toFixed(2)," ").concat(this.currency)},y}();export{y as LoyaltyWidgetViewModel};
1
+ import{__assign as t}from'./../ext/tslib/tslib.es6.mjs.js';import{makeObservable as i,observable as e,computed as o,action as r}from"mobx";import{markDescriptionClosedForSession as n,markDescriptionPermanentlyClosed as s,isDescriptionClosedForCurrentSession as a,isDescriptionPermanentlyClosed as d}from"../utils.js";import{LoyaltyCustomerInfo as c}from"./loyalty-customer-info/index.js";import{LoyaltyProgram as l}from"./loyalty-program/index.js";import{LoyaltyProgramEarningMethod as h}from"./loyalty-program-earning-method/index.js";import{LoyaltyProgramSpendingMethod as u}from"./loyalty-program-spending-method/index.js";import{LoyaltyWidget as g}from"./loyalty-widget/index.js";import{LoyaltyWidgetScreenTypeEnum as p,WidgetMode as y}from"./types/index.js";var m=function(){function m(n,s,m,M,f,v,b){void 0===n&&(n={}),this.userRefreshTrigger=0,this.cartRefreshTrigger=0,this.navigationStack=[p.MAIN_SCREEN],this.currentWidgetMode=v?y.WIDGET_MODE:y.MINI_MODE,this.isMiniModeDescriptionClosed=a()||d(),this.isLoading=n.isLoading||!1,this.isActionLoading=n.isActionLoading||!1,this.loyaltyWidget=new g(n.loyaltyWidget),this.cdnURL=s,this.merchantId=m,this.storeUrl=f||n.storeUrl||"",this.currency=M,this.isPreviewMode=v||!1,this.cartId=n.cartId||null,this.ikasEventUser=n.ikasEventUser||null,this.user=n.user?new c(n.user):null,this.loyaltyProgram=n.loyaltyProgram?new l(n.loyaltyProgram):null,this.earningMethods=n.earningMethods?n.earningMethods.map(function(t){return new h(t)}):[],this.spendingMethods=n.spendingMethods?n.spendingMethods.map(function(t){return new u(t)}):[],this.tiers=n.tiers?n.tiers:[],this.categories=n.categories?n.categories:[],this.products=n.products?n.products:[],this.brands=n.brands?n.brands:[],this.tags=n.tags?n.tags:[],this.pointHistory=n.pointHistory?n.pointHistory:[],this.callbacks=b||void 0,i(this,t(t({cartId:e},v?{}:{loyaltyWidget:e}),{isLoading:e,isActionLoading:e,cdnURL:e,merchantId:e,storeUrl:e,currency:e,navigationStack:e,currentScreen:o,isMainScreen:o,pushScreen:r.bound,popScreen:r.bound,resetNavigation:r.bound,setWidgetMode:r.bound,closeMiniModeDescription:r.bound,formatCurrency:r.bound,currentWidgetMode:e,isMiniModeDescriptionClosed:e,user:e,loyaltyProgram:e,earningMethods:e,spendingMethods:e,tiers:e,categories:e,products:e,brands:e,tags:e,pointHistory:e,ikasEventUser:e,userRefreshTrigger:e,cartRefreshTrigger:e,shouldShowSpendingMethods:o}))}return Object.defineProperty(m.prototype,"currentScreen",{get:function(){return this.navigationStack[this.navigationStack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"isMainScreen",{get:function(){return this.currentScreen===p.MAIN_SCREEN},enumerable:!1,configurable:!0}),m.prototype.pushScreen=function(t){this.currentScreen!==t&&this.navigationStack.push(t)},m.prototype.popScreen=function(){this.navigationStack.length>1&&this.navigationStack.pop()},m.prototype.resetNavigation=function(){this.navigationStack=[p.MAIN_SCREEN]},Object.defineProperty(m.prototype,"shouldShowSpendingMethods",{get:function(){return!!this.user&&(!(this.user.availablePoint<=0)&&0!==this.spendingMethods.length)},enumerable:!1,configurable:!0}),m.prototype.setWidgetMode=function(t){var i,e;this.currentWidgetMode=t,t!==y.WIDGET_MODE||this.isPreviewMode||(this.isMiniModeDescriptionClosed=!0,n(),(null===(e=null===(i=this.loyaltyWidget)||void 0===i?void 0:i.miniMode)||void 0===e?void 0:e.hideDescriptionAfterClose)&&s())},m.prototype.closeMiniModeDescription=function(){var t,i;this.isMiniModeDescriptionClosed=!0,n(),(null===(i=null===(t=this.loyaltyWidget)||void 0===t?void 0:t.miniMode)||void 0===i?void 0:i.hideDescriptionAfterClose)&&s()},m.prototype.formatCurrency=function(t){var i;return(null===(i=this.callbacks)||void 0===i?void 0:i.formatCurrency)?this.callbacks.formatCurrency(t):"".concat(t.toFixed(2)," ").concat(this.currency)},m}();export{m as LoyaltyWidgetViewModel};
@@ -29,6 +29,8 @@ export declare class CartLoyaltyLineData {
29
29
  constructor(data?: Partial<CartLoyaltyLineData>);
30
30
  }
31
31
  export declare class LoyaltyCustomerInfo {
32
+ availablePoint: number;
33
+ cumulativeEarnedPoints: number;
32
34
  customerTier: LoyaltyProgramTier | null;
33
35
  loyaltyProgramCustomerId: string;
34
36
  loyaltyProgramId: string;
@@ -1 +1 @@
1
- import{makeObservable as t,observable as e}from"mobx";import{LoyaltyProgramPeriod as i}from"../common/index.js";var n,o,r=function(i){void 0===i&&(i={}),this.locale=i.locale||"",this.name=i.name||"",t(this,{locale:e,name:e})},l=function(n){void 0===n&&(n={}),this.id=n.id||"",this.name=n.name||"",this.pointsRequired=n.pointsRequired||null,this.tierPointMultiplier=n.tierPointMultiplier||null,this.loyaltyProgramId=n.loyaltyProgramId||"",this.customerSegmentId=n.customerSegmentId||null,this.createdAt=n.createdAt||null,this.updatedAt=n.updatedAt||null,this.deleted=n.deleted||!1,this.isActive=n.isActive||!1,this.period=n.period?new i(n.period):null,this.translations=n.translations?n.translations.map(function(t){return new r(t)}):null,t(this,{id:e,name:e,pointsRequired:e,tierPointMultiplier:e,loyaltyProgramId:e,customerSegmentId:e,createdAt:e,updatedAt:e,deleted:e,isActive:e,period:e,translations:e})},s=function(i){void 0===i&&(i={}),this.campaignType=i.campaignType||null,this.discountAmount=i.discountAmount||0,this.discountAmountType=i.discountAmountType||o.AMOUNT,this.discountPercentage=void 0!==i.discountPercentage&&null!==i.discountPercentage?i.discountPercentage:null,this.loyaltySpendingMethodId=i.loyaltySpendingMethodId||"",this.pointUsed=i.pointUsed||0,t(this,{campaignType:e,discountAmount:e,discountAmountType:e,discountPercentage:e,loyaltySpendingMethodId:e,pointUsed:e})},d=function(i){void 0===i&&(i={}),this.customerTier=i.customerTier?new l(i.customerTier):null,this.loyaltyProgramCustomerId=i.loyaltyProgramCustomerId||"",this.loyaltyProgramId=i.loyaltyProgramId||"",this.totalPoint=i.totalPoint||0,this.nextTierRequiredPoint=void 0!==i.nextTierRequiredPoint&&null!==i.nextTierRequiredPoint?i.nextTierRequiredPoint:null,this.cartLoyaltyLines=i.cartLoyaltyLines?i.cartLoyaltyLines.map(function(t){return new s(t)}):null,t(this,{customerTier:e,loyaltyProgramCustomerId:e,loyaltyProgramId:e,totalPoint:e,nextTierRequiredPoint:e,cartLoyaltyLines:e})};!function(t){t.BUY_X_THEN_GET_Y="BUY_X_THEN_GET_Y",t.FIXED_AMOUNT="FIXED_AMOUNT",t.FREE_SHIPPING="FREE_SHIPPING",t.RATIO="RATIO"}(n||(n={})),function(t){t.AMOUNT="AMOUNT",t.RATIO="RATIO"}(o||(o={}));export{n as CampaignTypeEnum,s as CartLoyaltyLineData,d as LoyaltyCustomerInfo,l as LoyaltyProgramTier,r as LoyaltyProgramTierTranslation,o as OrderAmountTypeEnum};
1
+ import{makeObservable as t,observable as i}from"mobx";import{LoyaltyProgramPeriod as e}from"../common/index.js";var n,o,l=function(e){void 0===e&&(e={}),this.locale=e.locale||"",this.name=e.name||"",t(this,{locale:i,name:i})},a=function(n){void 0===n&&(n={}),this.id=n.id||"",this.name=n.name||"",this.pointsRequired=n.pointsRequired||null,this.tierPointMultiplier=n.tierPointMultiplier||null,this.loyaltyProgramId=n.loyaltyProgramId||"",this.customerSegmentId=n.customerSegmentId||null,this.createdAt=n.createdAt||null,this.updatedAt=n.updatedAt||null,this.deleted=n.deleted||!1,this.isActive=n.isActive||!1,this.period=n.period?new e(n.period):null,this.translations=n.translations?n.translations.map(function(t){return new l(t)}):null,t(this,{id:i,name:i,pointsRequired:i,tierPointMultiplier:i,loyaltyProgramId:i,customerSegmentId:i,createdAt:i,updatedAt:i,deleted:i,isActive:i,period:i,translations:i})},r=function(e){void 0===e&&(e={}),this.campaignType=e.campaignType||null,this.discountAmount=e.discountAmount||0,this.discountAmountType=e.discountAmountType||o.AMOUNT,this.discountPercentage=void 0!==e.discountPercentage&&null!==e.discountPercentage?e.discountPercentage:null,this.loyaltySpendingMethodId=e.loyaltySpendingMethodId||"",this.pointUsed=e.pointUsed||0,t(this,{campaignType:i,discountAmount:i,discountAmountType:i,discountPercentage:i,loyaltySpendingMethodId:i,pointUsed:i})},s=function(e){var n,o;void 0===e&&(e={}),this.availablePoint=null!==(n=e.availablePoint)&&void 0!==n?n:0,this.cumulativeEarnedPoints=null!==(o=e.cumulativeEarnedPoints)&&void 0!==o?o:0,this.customerTier=e.customerTier?new a(e.customerTier):null,this.loyaltyProgramCustomerId=e.loyaltyProgramCustomerId||"",this.loyaltyProgramId=e.loyaltyProgramId||"",this.totalPoint=e.totalPoint||0,this.nextTierRequiredPoint=void 0!==e.nextTierRequiredPoint&&null!==e.nextTierRequiredPoint?e.nextTierRequiredPoint:null,this.cartLoyaltyLines=e.cartLoyaltyLines?e.cartLoyaltyLines.map(function(t){return new r(t)}):null,t(this,{availablePoint:i,cumulativeEarnedPoints:i,customerTier:i,loyaltyProgramCustomerId:i,loyaltyProgramId:i,totalPoint:i,nextTierRequiredPoint:i,cartLoyaltyLines:i})};!function(t){t.BUY_X_THEN_GET_Y="BUY_X_THEN_GET_Y",t.FIXED_AMOUNT="FIXED_AMOUNT",t.FREE_SHIPPING="FREE_SHIPPING",t.RATIO="RATIO"}(n||(n={})),function(t){t.AMOUNT="AMOUNT",t.RATIO="RATIO"}(o||(o={}));export{n as CampaignTypeEnum,r as CartLoyaltyLineData,s as LoyaltyCustomerInfo,a as LoyaltyProgramTier,l as LoyaltyProgramTierTranslation,o as OrderAmountTypeEnum};
@@ -0,0 +1,5 @@
1
+ export declare class LoyaltyProgram {
2
+ id: string;
3
+ waitingPeriodDays: number | null;
4
+ constructor(data?: Partial<LoyaltyProgram>);
5
+ }
@@ -0,0 +1 @@
1
+ import{makeObservable as i,observable as o}from"mobx";var t=function(t){var a;void 0===t&&(t={}),this.id=t.id||"",this.waitingPeriodDays=null!==(a=t.waitingPeriodDays)&&void 0!==a?a:null,i(this,{id:o,waitingPeriodDays:o})};export{t as LoyaltyProgram};
@@ -33,5 +33,6 @@ export declare class LoyaltyProgramEarningMethod {
33
33
  translations: LoyaltyProgramMethodTranslation[] | null;
34
34
  updatedAt: any | null;
35
35
  validityPeriod: LoyaltyProgramPeriod | null;
36
+ waitingPeriodDays: number | null;
36
37
  constructor(data?: Partial<LoyaltyProgramEarningMethod>);
37
38
  }
@@ -1 +1 @@
1
- import{makeObservable as t,observable as i}from"mobx";import{EarningMethodTypeEnum as n,LoyaltyProgramPointEarningTypeEnum as e}from"../types/index.js";import{LoyaltyProgramFilter as r,LoyaltyProgramPointLimit as d,LoyaltyProgramMethodTranslation as o,LoyaltyProgramPeriod as s}from"../common/index.js";var a=function(n){void 0===n&&(n={}),this.maxOrderAmount=n.maxOrderAmount||null,this.minOrderAmount=n.minOrderAmount||0,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new r(t)}):null,t(this,{maxOrderAmount:i,minOrderAmount:i,productFilters:i})},l=function(n){void 0===n&&(n={}),this.maxProductQuantity=n.maxProductQuantity||null,this.minProductQuantity=n.minProductQuantity||null,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new r(t)}):null,t(this,{maxProductQuantity:i,minProductQuantity:i,productFilters:i})},u=function(r){void 0===r&&(r={}),this.amountPerPointsEarned=r.amountPerPointsEarned||null,this.createdAt=r.createdAt||null,this.deleted=r.deleted||!1,this.description=r.description||null,this.earnedPointLimit=r.earnedPointLimit?new d(r.earnedPointLimit):null,this.id=r.id||"",this.isActive=r.isActive||!1,this.lastValidityDate=r.lastValidityDate||null,this.loyaltyProgramId=r.loyaltyProgramId||"",this.methodType=r.methodType||n.ORDER_CREATE,this.orderSettings=r.orderSettings?new a(r.orderSettings):null,this.pointEarningType=r.pointEarningType||e.STATIC,this.pointsEarned=r.pointsEarned||0,this.productSettings=r.productSettings?new l(r.productSettings):null,this.quantityPerPointsEarned=r.quantityPerPointsEarned||null,this.segmentId=r.segmentId||null,this.tierIds=r.tierIds||null,this.translations=r.translations?r.translations.map(function(t){return new o(t)}):null,this.updatedAt=r.updatedAt||null,this.validityPeriod=r.validityPeriod?new s(r.validityPeriod):null,t(this,{amountPerPointsEarned:i,createdAt:i,deleted:i,description:i,earnedPointLimit:i,id:i,isActive:i,lastValidityDate:i,loyaltyProgramId:i,methodType:i,orderSettings:i,pointEarningType:i,pointsEarned:i,productSettings:i,quantityPerPointsEarned:i,segmentId:i,tierIds:i,translations:i,updatedAt:i,validityPeriod:i})};export{u as LoyaltyProgramEarningMethod,a as LoyaltyProgramEarningMethodOrderSettings,l as LoyaltyProgramEarningMethodProductSettings};
1
+ import{makeObservable as t,observable as i}from"mobx";import{EarningMethodTypeEnum as n,LoyaltyProgramPointEarningTypeEnum as e}from"../types/index.js";import{LoyaltyProgramFilter as r,LoyaltyProgramPointLimit as d,LoyaltyProgramMethodTranslation as o,LoyaltyProgramPeriod as s}from"../common/index.js";var a=function(n){void 0===n&&(n={}),this.maxOrderAmount=n.maxOrderAmount||null,this.minOrderAmount=n.minOrderAmount||0,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new r(t)}):null,t(this,{maxOrderAmount:i,minOrderAmount:i,productFilters:i})},l=function(n){void 0===n&&(n={}),this.maxProductQuantity=n.maxProductQuantity||null,this.minProductQuantity=n.minProductQuantity||null,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new r(t)}):null,t(this,{maxProductQuantity:i,minProductQuantity:i,productFilters:i})},u=function(r){var u;void 0===r&&(r={}),this.waitingPeriodDays=null!==(u=r.waitingPeriodDays)&&void 0!==u?u:null,this.amountPerPointsEarned=r.amountPerPointsEarned||null,this.createdAt=r.createdAt||null,this.deleted=r.deleted||!1,this.description=r.description||null,this.earnedPointLimit=r.earnedPointLimit?new d(r.earnedPointLimit):null,this.id=r.id||"",this.isActive=r.isActive||!1,this.lastValidityDate=r.lastValidityDate||null,this.loyaltyProgramId=r.loyaltyProgramId||"",this.methodType=r.methodType||n.ORDER_CREATE,this.orderSettings=r.orderSettings?new a(r.orderSettings):null,this.pointEarningType=r.pointEarningType||e.STATIC,this.pointsEarned=r.pointsEarned||0,this.productSettings=r.productSettings?new l(r.productSettings):null,this.quantityPerPointsEarned=r.quantityPerPointsEarned||null,this.segmentId=r.segmentId||null,this.tierIds=r.tierIds||null,this.translations=r.translations?r.translations.map(function(t){return new o(t)}):null,this.updatedAt=r.updatedAt||null,this.validityPeriod=r.validityPeriod?new s(r.validityPeriod):null,t(this,{amountPerPointsEarned:i,createdAt:i,deleted:i,description:i,earnedPointLimit:i,id:i,isActive:i,lastValidityDate:i,loyaltyProgramId:i,methodType:i,orderSettings:i,pointEarningType:i,pointsEarned:i,productSettings:i,quantityPerPointsEarned:i,segmentId:i,tierIds:i,translations:i,updatedAt:i,validityPeriod:i,waitingPeriodDays:i})};export{u as LoyaltyProgramEarningMethod,a as LoyaltyProgramEarningMethodOrderSettings,l as LoyaltyProgramEarningMethodProductSettings};
@@ -1,6 +1,7 @@
1
1
  import { LoyaltyProgramPointHistoryTypeEnum } from "../types";
2
2
  export declare class LoyaltyProgramPointHistory {
3
3
  amount: number;
4
+ availableDate: any | null;
4
5
  createdAt: any | null;
5
6
  customerId: string;
6
7
  customerReviewId: string | null;
@@ -1 +1 @@
1
- import{makeObservable as t,observable as e}from"mobx";import{LoyaltyProgramPointHistoryTypeEnum as r}from"../types/index.js";var d=function(d){void 0===d&&(d={}),this.amount=d.amount||0,this.createdAt=d.createdAt||null,this.customerId=d.customerId||"",this.customerReviewId=d.customerReviewId||null,this.deleted=d.deleted||!1,this.expireDate=d.expireDate||null,this.id=d.id||"",this.loyaltyProgramCustomerId=d.loyaltyProgramCustomerId||"",this.loyaltyProgramEarningMethodId=d.loyaltyProgramEarningMethodId||null,this.loyaltyProgramId=d.loyaltyProgramId||"",this.loyaltyProgramSpendingMethodId=d.loyaltyProgramSpendingMethodId||null,this.orderId=d.orderId||null,this.type=d.type||r.EARN,this.productVariantId=d.productVariantId||null,this.updatedAt=d.updatedAt||null,t(this,{amount:e,createdAt:e,customerId:e,customerReviewId:e,deleted:e,expireDate:e,id:e,loyaltyProgramCustomerId:e,loyaltyProgramEarningMethodId:e,loyaltyProgramId:e,loyaltyProgramSpendingMethodId:e,orderId:e,type:e,productVariantId:e,updatedAt:e})};export{d as LoyaltyProgramPointHistory};
1
+ import{makeObservable as t,observable as e}from"mobx";import{LoyaltyProgramPointHistoryTypeEnum as r}from"../types/index.js";var d=function(d){var a;void 0===d&&(d={}),this.amount=d.amount||0,this.availableDate=null!==(a=d.availableDate)&&void 0!==a?a:null,this.createdAt=d.createdAt||null,this.customerId=d.customerId||"",this.customerReviewId=d.customerReviewId||null,this.deleted=d.deleted||!1,this.expireDate=d.expireDate||null,this.id=d.id||"",this.loyaltyProgramCustomerId=d.loyaltyProgramCustomerId||"",this.loyaltyProgramEarningMethodId=d.loyaltyProgramEarningMethodId||null,this.loyaltyProgramId=d.loyaltyProgramId||"",this.loyaltyProgramSpendingMethodId=d.loyaltyProgramSpendingMethodId||null,this.orderId=d.orderId||null,this.type=d.type||r.EARN,this.productVariantId=d.productVariantId||null,this.updatedAt=d.updatedAt||null,t(this,{amount:e,availableDate:e,createdAt:e,customerId:e,customerReviewId:e,deleted:e,expireDate:e,id:e,loyaltyProgramCustomerId:e,loyaltyProgramEarningMethodId:e,loyaltyProgramId:e,loyaltyProgramSpendingMethodId:e,orderId:e,type:e,productVariantId:e,updatedAt:e})};export{d as LoyaltyProgramPointHistory};
@@ -1,5 +1,6 @@
1
1
  import { LoyaltyWidgetViewModel } from "models";
2
2
  import type { LoyaltyCustomerInfo, LoyaltyProgramTier } from "../loyalty-customer-info";
3
+ import type { LoyaltyProgram } from "../loyalty-program";
3
4
  import type { LoyaltyProgramEarningMethod } from "../loyalty-program-earning-method";
4
5
  import type { LoyaltyProgramPointHistory } from "../loyalty-program-point-history";
5
6
  import { LoyaltyProgramSpendingMethod } from "../loyalty-program-spending-method";
@@ -113,6 +114,7 @@ export type ListLoyaltyProgramPointHistoryInput = {
113
114
  export type LoyaltyWidgetCallbacks = {
114
115
  listSpendingMethodsByCartId: (cartId?: string | null) => Promise<LoyaltyProgramSpendingMethod[]>;
115
116
  getLoyaltyCustomerInfo: () => Promise<LoyaltyCustomerInfo | null>;
117
+ getLoyaltyProgram?: () => Promise<LoyaltyProgram | null>;
116
118
  listEarningMethods: () => Promise<LoyaltyProgramEarningMethod[]>;
117
119
  listLoyaltyProgramTier: (input: ListLoyaltyProgramTierInput) => Promise<LoyaltyProgramTier[]>;
118
120
  listLoyaltyProgramPointHistory: (input: ListLoyaltyProgramPointHistoryInput) => Promise<LoyaltyProgramPointHistory[]>;
@@ -1 +1 @@
1
- import r,{useState as n,useRef as t,useEffect as e}from"react";var u=function(u){var a=u.end,c=u.duration,i=void 0===c?1e3:c,o=n(a),m=o[0],l=o[1],f=t(null),v=t(a);return e(function(){var r;v.current=m,f.current=null;var n=function(t){f.current||(f.current=t);var e=Math.min((t-f.current)/i,1),u=1-Math.pow(1-e,4),c=Math.round(v.current+(a-v.current)*u);l(c),e<1&&(r=requestAnimationFrame(n))};return r=requestAnimationFrame(n),function(){return cancelAnimationFrame(r)}},[a,i]),r.createElement(r.Fragment,null,m)};export{u as default};
1
+ import r,{useState as n,useRef as t,useEffect as e}from"react";var u=function(u){var a=u.end,c=u.duration,i=void 0===c?1e3:c,o=n(a),m=o[0],l=o[1],f=t(null),v=t(a);return e(function(){if(m!==a){var r;v.current=m,f.current=null;var n=function(t){f.current||(f.current=t);var e=Math.min((t-f.current)/i,1),u=1-Math.pow(1-e,4),c=1===e?a:Math.round(v.current+(a-v.current)*u);l(c),e<1&&(r=requestAnimationFrame(n))};return r=requestAnimationFrame(n),function(){return cancelAnimationFrame(r)}}},[a,i]),r.createElement(r.Fragment,null,m)};export{u as default};
@@ -1 +1 @@
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 d}from"../models/index.js";import{LoyaltyCustomerInfo as c}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 v}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyWidget as m}from"../models/loyalty-widget/index.js";import{WidgetPositionEnum as g,LoyaltyWidgetLayoutTypeEnum as p}from"../models/loyalty-widget/types/index.js";import{WidgetMode as y,LoyaltyWidgetScreenTypeEnum as E,EarningMethodTypeEnum as h,LoyaltyProgramFilterTypeEnum as T,LoyaltyProgramMethodSpendingTypeEnum as R}from"../models/types/index.js";import k 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 I from"./screens/credit-history-screen/index.js";import M from"./screens/credit-spending-methods-screen/index.js";import _ from"./screens/gift-product-selection-screen/index.js";import C from"./screens/loyalty-level-screen/index.js";import O from"./screens/main-screen/index.js";import S from"./utils/i18n.js";import{unflatten as D}from"./utils/object-utils.js";import{Container as P,MiniModeWrapper as L,Panel as A,ScreenWrapper as U}from"./style.js";var j=i(function(i){var j,W,x,N=i.config,$=s(function(){var e=N||window.ikasLoyaltyWidgetConfig;return new d({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],G=s(!1),B=G[0],F=G[1],V=s(!1),z=V[0],Y=V[1],H=s(!1),J=H[0],q=H[1],K=$.loyaltyWidget.translations,Q=JSON.stringify(r(null==K?void 0:K.custom));a(function(){var e=null==K?void 0:K.language,t=(null==K?void 0:K.custom)?r(K.custom):{};if(e){var n=["tr","en","de","nl","fr"].includes(e)?e:"en";if(S.language!==n&&S.changeLanguage(n),Object.keys(t).length>0){var i=D(t);S.addResourceBundle(n,"translation",i,!0,!0)}}},[null==K?void 0:K.language,Q]),a(function(){var e=N||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized($)},[$,N]);var X=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 $.callbacks?(e=new Set,r=new Set,i=new Set,o=new Set,$.earningMethods.forEach(function(t){var s,a;t.methodType!==h.ORDER_CREATE&&t.methodType!==h.BUY_PRODUCT||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===T.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===T.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===T.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===T.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),$.spendingMethods&&$.spendingMethods.forEach(function(t){var n,s;t.type===R.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===T.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===T.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===T.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===T.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),s=[],e.size>0&&$.callbacks.getProducts&&s.push($.callbacks.getProducts(Array.from(e)).then(function(e){$.products=e})),r.size>0&&$.callbacks.getCategories&&s.push($.callbacks.getCategories(Array.from(r)).then(function(e){return $.categories=e})),i.size>0&&$.callbacks.getBrands&&s.push($.callbacks.getBrands(Array.from(i)).then(function(e){return $.brands=e})),o.size>0&&$.callbacks.getTags&&s.push($.callbacks.getTags(Array.from(o)).then(function(e){return $.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(!$.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[$.callbacks.getLoyaltyWidget(),$.callbacks.listEarningMethods(),$.callbacks.listLoyaltyProgramTier({})],[4,Promise.all(e)];case 2:return n=t.sent(),r=n[0],i=n[1],o=n[2],$.loyaltyWidget=r instanceof m?r:new m(r||{}),$.earningMethods=i.map(function(e){return new u(e)}),$.tiers=o||[],[4,X()];case 3:return t.sent(),!$.isPreviewMode&&$.loyaltyWidget.settings.openOnPageLoad&&$.setWidgetMode(y.WIDGET_MODE),[3,6];case 4:return s=t.sent(),console.error("Failed to initialize loyalty data",s),[3,6];case 5:return F(!0),[7];case 6:return[2]}})})},[]),a(function(){if(window.IkasEvents){var e=function(e){var t,n,r=null===(t=e.data)||void 0===t?void 0:t.customer;(null==r?void 0:r.id)&&(null===(n=$.ikasEventUser)||void 0===n?void 0:n.id)!==r.id&&($.ikasEventUser=r,$.userRefreshTrigger++,$.cartRefreshTrigger++)},t=function(e){var t,n,r,i,o,s=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)?$.cartId=null:$.cartId=s,$.cartRefreshTrigger++},n={CUSTOMER_LOGIN:e,CUSTOMER_VISIT:e,CUSTOMER_LOGOUT:function(){$.ikasEventUser=null,$.user=null,$.pointHistory=[],$.userRefreshTrigger++,$.cartRefreshTrigger++},ADD_TO_CART:function(e){return t(e)},REMOVE_FROM_CART:t,REMOVE_LOYALTY_POINTS:function(){$.cartRefreshTrigger++,$.userRefreshTrigger++},PAGE_VIEW:function(e){var t,n,r=null===(t=e.data)||void 0===t?void 0:t.customer;if(null==r?void 0:r.id){var i=!$.ikasEventUser,o=(null===(n=$.ikasEventUser)||void 0===n?void 0:n.subscriptionStatus)!==r.subscriptionStatus;(i||o)&&($.ikasEventUser=r,$.userRefreshTrigger++,$.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)}}},[$]),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(z)return[2];if(Y(!0),!$.callbacks||!(null===(o=$.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([$.callbacks.getLoyaltyCustomerInfo(),$.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],$.user=n?new c(n):null,n||($.ikasEventUser=null),$.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 Y(!1),[2]}})})},[null===(j=$.ikasEventUser)||void 0===j?void 0:j.id,$.userRefreshTrigger]),a(function(){e(void 0,void 0,void 0,function(){var e,n,r;return t(this,function(t){switch(t.label){case 0:if(J)return[2];if(q(!0),!$.callbacks||!(null===(r=$.ikasEventUser)||void 0===r?void 0:r.id))return[3,6];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,$.callbacks.listSpendingMethodsByCartId($.cartId)];case 2:return e=t.sent(),$.spendingMethods=e.map(function(e){return new v(e)}),[4,X()];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[3,7];case 6:$.spendingMethods=[],t.label=7;case 7:return q(!1),[2]}})})},[$.cartId,$.cartRefreshTrigger,null===(W=$.ikasEventUser)||void 0===W?void 0:W.id]);var Z=function(){$.setWidgetMode(y.MINI_MODE),setTimeout(function(){$.resetNavigation()},300)};a(function(){return $.currentWidgetMode===y.WIDGET_MODE?document.body.style.overflow="hidden":document.body.style.overflow="",function(){document.body.style.overflow=""}},[$.currentWidgetMode]);var ee=s(null),te=ee[0],ne=ee[1],re=s(null),ie=re[0],oe=re[1],se=$.navigationStack.length,ae=se>1?$.navigationStack[1]:null,le=se>2?$.navigationStack[2]:null;a(function(){ae&&ne(ae)},[ae]),a(function(){le&&oe(le)},[le]);var de=$.loyaltyWidget.settings.position||g.RIGHT,ce=$.loyaltyWidget.settings.type||p.DRAWER,ue=function(e){switch(e){case E.CREDIT_SPENDING_METHODS_SCREEN:return o.createElement(M,{viewModel:$,onBack:function(){return $.popScreen()},onClose:Z});case E.CREDIT_EARNING_METHODS_SCREEN:return o.createElement(w,{viewModel:$,onBack:function(){return $.popScreen()},onClose:Z});case E.CREDIT_HISTORY_SCREEN:return o.createElement(I,{viewModel:$,onBack:function(){return $.popScreen()},onClose:Z});case E.LOYALTY_LEVEL_SCREEN:return o.createElement(C,{viewModel:$,onBack:function(){return $.popScreen()},onClose:Z});case E.GIFT_PRODUCT_SELECTION_SCREEN:return o.createElement(_,{viewModel:$,onBack:function(){return $.popScreen()},onClose:Z});default:return null}};if(!B)return null;var fe=(null==N?void 0:N.position)||(null===(x=window.ikasLoyaltyWidgetConfig)||void 0===x?void 0:x.position)||"fixed";return o.createElement(l,{i18n:S},o.createElement(P,{$layoutType:ce,$widgetPosition:de,$widgetMode:$.currentWidgetMode,$position:fe,onClick:function(){$.currentWidgetMode===y.WIDGET_MODE&&Z()},className:"ikas-storefront-widget"},o.createElement(L,{$isVisible:$.currentWidgetMode===y.MINI_MODE,$widgetPosition:de},o.createElement(b,{viewModel:$,isInitialized:B}),o.createElement(k,{viewModel:$})),o.createElement(A,{$layoutType:ce,$isOpen:$.currentWidgetMode===y.WIDGET_MODE,$widgetPosition:de,onClick:function(e){return e.stopPropagation()}},o.createElement(U,{$isActive:$.isMainScreen,$layer:0,$layoutType:ce},o.createElement(O,{viewModel:$,onClose:Z,onNavigate:function(e){return $.pushScreen(e)}})),o.createElement(U,{$isActive:!!ae,$layer:1,$layoutType:ce},ue(ae||te)),o.createElement(U,{$isActive:!!le,$layer:2,$layoutType:ce},ue(le||ie)))))});export{j 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 d}from"../models/index.js";import{LoyaltyCustomerInfo as c}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgram as u}from"../models/loyalty-program/index.js";import{LoyaltyProgramEarningMethod as f}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as v}from"../models/loyalty-program-point-history/index.js";import{LoyaltyProgramSpendingMethod as m}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyWidget as g}from"../models/loyalty-widget/index.js";import{WidgetPositionEnum as p,LoyaltyWidgetLayoutTypeEnum as y}from"../models/loyalty-widget/types/index.js";import{WidgetMode as E,LoyaltyWidgetScreenTypeEnum as h,EarningMethodTypeEnum as T,LoyaltyProgramFilterTypeEnum as k,LoyaltyProgramMethodSpendingTypeEnum as R}from"../models/types/index.js";import b from"./components/mini-mode-button/index.js";import w from"./components/mini-mode-description/index.js";import I from"./screens/credit-earning-methods-screen/index.js";import M from"./screens/credit-history-screen/index.js";import _ from"./screens/credit-spending-methods-screen/index.js";import C from"./screens/gift-product-selection-screen/index.js";import O from"./screens/loyalty-level-screen/index.js";import S from"./screens/main-screen/index.js";import D from"./utils/i18n.js";import{unflatten as P}from"./utils/object-utils.js";import{Container as L,MiniModeWrapper as A,Panel as U,ScreenWrapper as j}from"./style.js";var x=i(function(i){var x,W,N,$=i.config,G=s(function(){var e=$||window.ikasLoyaltyWidgetConfig;return new d({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],B=s(!1),F=B[0],V=B[1],z=s(!1),Y=z[0],H=z[1],J=s(!1),q=J[0],K=J[1],Q=G.loyaltyWidget.translations,X=JSON.stringify(r(null==Q?void 0:Q.custom));a(function(){var e=null==Q?void 0:Q.language,t=(null==Q?void 0:Q.custom)?r(Q.custom):{};if(e){var n=["tr","en","de","nl","fr"].includes(e)?e:"en";if(D.language!==n&&D.changeLanguage(n),Object.keys(t).length>0){var i=P(t);D.addResourceBundle(n,"translation",i,!0,!0)}}},[null==Q?void 0:Q.language,X]),a(function(){var e=$||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized(G)},[G,$]);var Z=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 G.callbacks?(e=new Set,r=new Set,i=new Set,o=new Set,G.earningMethods.forEach(function(t){var s,a;t.methodType!==T.ORDER_CREATE&&t.methodType!==T.BUY_PRODUCT||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===k.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===k.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===k.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===k.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),G.spendingMethods&&G.spendingMethods.forEach(function(t){var n,s;t.type===R.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===k.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===k.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===k.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===k.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),s=[],e.size>0&&G.callbacks.getProducts&&s.push(G.callbacks.getProducts(Array.from(e)).then(function(e){G.products=e})),r.size>0&&G.callbacks.getCategories&&s.push(G.callbacks.getCategories(Array.from(r)).then(function(e){return G.categories=e})),i.size>0&&G.callbacks.getBrands&&s.push(G.callbacks.getBrands(Array.from(i)).then(function(e){return G.brands=e})),o.size>0&&G.callbacks.getTags&&s.push(G.callbacks.getTags(Array.from(o)).then(function(e){return G.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,a,l,d,c;return t(this,function(t){switch(t.label){case 0:if(!G.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[G.callbacks.getLoyaltyWidget(),G.callbacks.listEarningMethods(),G.callbacks.listLoyaltyProgramTier({}),null!==(c=null===(d=(l=G.callbacks).getLoyaltyProgram)||void 0===d?void 0:d.call(l))&&void 0!==c?c:Promise.resolve(null)],[4,Promise.all(e)];case 2:return n=t.sent(),r=n[0],i=n[1],o=n[2],s=n[3],G.loyaltyWidget=r instanceof g?r:new g(r||{}),G.earningMethods=i.map(function(e){return new f(e)}),G.tiers=o||[],G.loyaltyProgram=s?new u(s):null,[4,Z()];case 3:return t.sent(),!G.isPreviewMode&&G.loyaltyWidget.settings.openOnPageLoad&&G.setWidgetMode(E.WIDGET_MODE),[3,6];case 4:return a=t.sent(),console.error("Failed to initialize loyalty data",a),[3,6];case 5:return V(!0),[7];case 6:return[2]}})})},[]),a(function(){if(window.IkasEvents){var e=function(e){var t,n,r=null===(t=e.data)||void 0===t?void 0:t.customer;(null==r?void 0:r.id)&&(null===(n=G.ikasEventUser)||void 0===n?void 0:n.id)!==r.id&&(G.ikasEventUser=r,G.userRefreshTrigger++,G.cartRefreshTrigger++)},t=function(e){var t,n,r,i,o,s=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)?G.cartId=null:G.cartId=s,G.cartRefreshTrigger++},n={CUSTOMER_LOGIN:e,CUSTOMER_VISIT:e,CUSTOMER_LOGOUT:function(){G.ikasEventUser=null,G.user=null,G.pointHistory=[],G.userRefreshTrigger++,G.cartRefreshTrigger++},ADD_TO_CART:function(e){return t(e)},REMOVE_FROM_CART:t,REMOVE_LOYALTY_POINTS:function(){G.cartRefreshTrigger++,G.userRefreshTrigger++},PAGE_VIEW:function(e){var t,n,r=null===(t=e.data)||void 0===t?void 0:t.customer;if(null==r?void 0:r.id){var i=!G.ikasEventUser,o=(null===(n=G.ikasEventUser)||void 0===n?void 0:n.subscriptionStatus)!==r.subscriptionStatus;(i||o)&&(G.ikasEventUser=r,G.userRefreshTrigger++,G.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)}}},[G]),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(Y)return[2];if(H(!0),!G.callbacks||!(null===(o=G.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([G.callbacks.getLoyaltyCustomerInfo(),G.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],G.user=n?new c(n):null,n||(G.ikasEventUser=null),G.pointHistory=r?r.map(function(e){return new v(e)}):[],[3,4];case 3:return i=t.sent(),console.error("Failed to fetch user data",i),[3,4];case 4:return H(!1),[2]}})})},[null===(x=G.ikasEventUser)||void 0===x?void 0:x.id,G.userRefreshTrigger]),a(function(){e(void 0,void 0,void 0,function(){var e,n,r;return t(this,function(t){switch(t.label){case 0:if(q)return[2];if(K(!0),!G.callbacks||!(null===(r=G.ikasEventUser)||void 0===r?void 0:r.id))return[3,6];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,G.callbacks.listSpendingMethodsByCartId(G.cartId)];case 2:return e=t.sent(),G.spendingMethods=e.map(function(e){return new m(e)}),[4,Z()];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[3,7];case 6:G.spendingMethods=[],t.label=7;case 7:return K(!1),[2]}})})},[G.cartId,G.cartRefreshTrigger,null===(W=G.ikasEventUser)||void 0===W?void 0:W.id]);var ee=function(){G.setWidgetMode(E.MINI_MODE),setTimeout(function(){G.resetNavigation()},300)};a(function(){return G.currentWidgetMode===E.WIDGET_MODE?document.body.style.overflow="hidden":document.body.style.overflow="",function(){document.body.style.overflow=""}},[G.currentWidgetMode]);var te=s(null),ne=te[0],re=te[1],ie=s(null),oe=ie[0],se=ie[1],ae=G.navigationStack.length,le=ae>1?G.navigationStack[1]:null,de=ae>2?G.navigationStack[2]:null;a(function(){le&&re(le)},[le]),a(function(){de&&se(de)},[de]);var ce=G.loyaltyWidget.settings.position||p.RIGHT,ue=G.loyaltyWidget.settings.type||y.DRAWER,fe=function(e){switch(e){case h.CREDIT_SPENDING_METHODS_SCREEN:return o.createElement(_,{viewModel:G,onBack:function(){return G.popScreen()},onClose:ee});case h.CREDIT_EARNING_METHODS_SCREEN:return o.createElement(I,{viewModel:G,onBack:function(){return G.popScreen()},onClose:ee});case h.CREDIT_HISTORY_SCREEN:return o.createElement(M,{viewModel:G,onBack:function(){return G.popScreen()},onClose:ee});case h.LOYALTY_LEVEL_SCREEN:return o.createElement(O,{viewModel:G,onBack:function(){return G.popScreen()},onClose:ee});case h.GIFT_PRODUCT_SELECTION_SCREEN:return o.createElement(C,{viewModel:G,onBack:function(){return G.popScreen()},onClose:ee});default:return null}};if(!F)return null;var ve=(null==$?void 0:$.position)||(null===(N=window.ikasLoyaltyWidgetConfig)||void 0===N?void 0:N.position)||"fixed";return o.createElement(l,{i18n:D},o.createElement(L,{$layoutType:ue,$widgetPosition:ce,$widgetMode:G.currentWidgetMode,$position:ve,onClick:function(){G.currentWidgetMode===E.WIDGET_MODE&&ee()},className:"ikas-storefront-widget"},o.createElement(A,{$isVisible:G.currentWidgetMode===E.MINI_MODE,$widgetPosition:ce},o.createElement(w,{viewModel:G,isInitialized:F}),o.createElement(b,{viewModel:G})),o.createElement(U,{$layoutType:ue,$isOpen:G.currentWidgetMode===E.WIDGET_MODE,$widgetPosition:ce,onClick:function(e){return e.stopPropagation()}},o.createElement(j,{$isActive:G.isMainScreen,$layer:0,$layoutType:ue},o.createElement(S,{viewModel:G,onClose:ee,onNavigate:function(e){return G.pushScreen(e)}})),o.createElement(j,{$isActive:!!le,$layer:1,$layoutType:ue},fe(le||ne)),o.createElement(j,{$isActive:!!de,$layer:2,$layoutType:ue},fe(de||oe)))))});export{x 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,EarningMethodTypeEnum as i}from"../../../models/types/index.js";import a from"../../components/count-up/index.js";import{getRefundIcon as u,getHistoryEarningMethodLabel as s,getEarningMethodIcon as c}from"../../../utils.js";import{Container as m,Header as d,IconButton as E,Title as y,Content as p,PointsSection as f,PointsTitle as h,PointsValue as g,HistoryList as T,HistoryItem as A,HistoryItemLeft as N,HistoryItemTitle as D,EarningMethodInfo as R,EarningMethodIcon as M,HistoryItemDate as x,ExpirationWarning as v,HistoryItemAmount as U,Divider as L}from"./style.js";var w=[o.EARN,o.REFILL,o.MANUAL_EARN],I=[o.SPEND,o.REFUND,o.MANUAL_DEDUCT],_=e(function(e){var _=e.viewModel,j=e.onBack,F=e.onClose,C=n(),b=C.t,k=C.i18n,P=_.user,H=_.pointHistory,W=_.earningMethods;return t.createElement(m,null,t.createElement(d,null,t.createElement(E,{onClick:j},t.createElement(l,null)),t.createElement(y,null,b("screens.creditHistory")),t.createElement(E,{onClick:F},t.createElement(r,null))),t.createElement(p,null,P&&t.createElement(f,{$borderRadius:_.loyaltyWidget.settings.cartBorderRadius},t.createElement(h,null,b("header.earnedPoints")),t.createElement(g,null,t.createElement(a,{end:P.totalPoint}))),t.createElement(T,null,H.map(function(e,n){var r,l=(r=e.type,w.includes(r)?"positive":I.includes(r)?"negative":"neutral"),a=function(e){if(!e)return null;var t=new Date(e);if(Number.isNaN(t.getTime()))return null;var n=t.getTime()-Date.now();if(n<=0)return b("history.expired");if(n>=864e5)return b("history.expiresInDays",{count:Math.floor(n/864e5)});var r=Math.floor(n/6e4);return n<36e5?b("history.expiresInMinutes",{count:Math.max(1,r)}):b("history.expiresInHoursAndMinutes",{hours:b("history.hours",{count:Math.floor(r/60)}),minutes:b("history.minutes",{count:r%60})})}(e.expireDate),m=function(e){if(e.type===o.MANUAL_EARN||e.type===o.MANUAL_DEDUCT)return null;var t=e.loyaltyProgramEarningMethodId;if(!t)return null;var n=W.find(function(e){return e.id===t});return e.type===o.REFUND?{label:b("history.orderRefund"),icon:u(_.loyaltyWidget.settings.widgetIconType),methodType:i.ORDER_CREATE}:n&&e.type===o.EARN?{label:s(n.methodType),icon:c(n.methodType,_.loyaltyWidget.settings.widgetIconType),methodType:n.methodType}:null}(e);return t.createElement(t.Fragment,{key:e.id},t.createElement(A,null,t.createElement(N,null,t.createElement(D,null,function(){switch(e.type){case o.EARN:return b("history.earnedTitle");case o.SPEND:return b("history.spentTitle");case o.REFUND:return b("history.refundTitle");case o.REFILL:return b("history.refillTitle");case o.MANUAL_EARN:return b("history.manualEarnTitle");case o.MANUAL_DEDUCT:return b("history.manualDeductTitle");default:return b("history.unknownTitle")}}()),m&&t.createElement(t.Fragment,null,t.createElement(R,null,m.icon&&t.createElement(M,null,m.icon),m.label)),t.createElement(x,null,function(e){if(!e)return"";try{return new Intl.DateTimeFormat(k.language,{day:"numeric",month:"long",year:"numeric"}).format(new Date(e))}catch(t){return e}}(e.createdAt),a&&t.createElement(v,null,a))),t.createElement(U,{$sign:l},"negative"===l?"-":"",e.amount)),n<H.length-1&&t.createElement(L,null))}))))});export{_ as default};
1
+ import{observer as e}from"mobx-react";import t,{useState as n,useEffect as r}from"react";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as l}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{XClose as i}from"../../../assets/icons/x-close.js";import{ChevronLeft as a}from"../../../assets/icons/chevron-left.js";import{LoyaltyProgramPointHistoryTypeEnum as o,EarningMethodTypeEnum as u}from"../../../models/types/index.js";import s from"../../components/count-up/index.js";import{getRefundIcon as c,getHistoryEarningMethodLabel as m,getEarningMethodIcon as y}from"../../../utils.js";import{Container as d,Header as E,IconButton as f,Title as h,Content as p,PointsSection as v,PointsTitle as A,PointsValue as D,HistoryList as T,HistoryItem as N,HistoryItemLeft as g,HistoryItemTitle as M,EarningMethodInfo as R,EarningMethodIcon as b,HistoryItemDate as x,ExpirationWarning as I,HistoryItemAmount as U,Divider as w}from"./style.js";var L=[o.EARN,o.REFILL,o.MANUAL_EARN],F=[o.SPEND,o.REFUND,o.MANUAL_DEDUCT],_=e(function(e){var _=e.viewModel,j=e.onBack,C=e.onClose,k=l(),P=k.t,H=k.i18n,W=_.user,B=_.pointHistory,S=_.earningMethods,$=n(0)[1],O=Date.now();r(function(){var e=B.reduce(function(e,t){if(t.type!==o.EARN||!t.availableDate)return e;var n=new Date(t.availableDate).getTime();return n>O?Math.min(e,n):e},1/0);if(Number.isFinite(e)){var t=setTimeout(function(){return $(function(e){return e+1})},Math.max(1,Math.min(6e4,e-O)));return function(){return clearTimeout(t)}}},[B,O]);var q=function(e,t){if(void 0===t&&(t=!1),!e)return null;var n=new Date(e).getTime();if(Number.isNaN(n))return null;var r=n-O;if(r<=0)return t?null:P("history.expired");if(r>=864e5)return P(t?"history.availableInDays":"history.expiresInDays",{count:Math.floor(r/864e5)});var l=Math.floor(r/6e4);return r<36e5?P(t?"history.availableInMinutes":"history.expiresInMinutes",{count:Math.max(1,l)}):P(t?"history.availableInHoursAndMinutes":"history.expiresInHoursAndMinutes",{hours:P("history.hours",{count:Math.floor(l/60)}),minutes:P("history.minutes",{count:l%60})})};return t.createElement(d,null,t.createElement(E,null,t.createElement(f,{onClick:j},t.createElement(a,null)),t.createElement(h,null,P("screens.creditHistory")),t.createElement(f,{onClick:C},t.createElement(i,null))),t.createElement(p,null,W&&t.createElement(v,{$borderRadius:_.loyaltyWidget.settings.cartBorderRadius},t.createElement(A,null,P("header.availablePoints")),t.createElement(D,null,t.createElement(s,{end:W.availablePoint}))),t.createElement(T,null,B.map(function(e,n){var r,l=(r=e.type,L.includes(r)?"positive":F.includes(r)?"negative":"neutral"),i=e.type===o.EARN?q(e.availableDate,!0):null,a=null!=i?i:q(e.expireDate),s=function(e){if(e.type===o.MANUAL_EARN||e.type===o.MANUAL_DEDUCT)return null;var t=e.loyaltyProgramEarningMethodId;if(!t)return null;var n=S.find(function(e){return e.id===t});return e.type===o.REFUND?{label:P("history.orderRefund"),icon:c(_.loyaltyWidget.settings.widgetIconType),methodType:u.ORDER_CREATE}:n&&e.type===o.EARN?{label:m(n.methodType),icon:y(n.methodType,_.loyaltyWidget.settings.widgetIconType),methodType:n.methodType}:null}(e);return t.createElement(t.Fragment,{key:e.id},t.createElement(N,null,t.createElement(g,null,t.createElement(M,null,function(){switch(e.type){case o.EARN:return P("history.earnedTitle");case o.SPEND:return P("history.spentTitle");case o.REFUND:return P("history.refundTitle");case o.REFILL:return P("history.refillTitle");case o.MANUAL_EARN:return P("history.manualEarnTitle");case o.MANUAL_DEDUCT:return P("history.manualDeductTitle");default:return P("history.unknownTitle")}}()),s&&t.createElement(t.Fragment,null,t.createElement(R,null,s.icon&&t.createElement(b,null,s.icon),s.label)),t.createElement(x,null,function(e){if(!e)return"";try{return new Intl.DateTimeFormat(H.language,{day:"numeric",month:"long",year:"numeric"}).format(new Date(e))}catch(t){return e}}(e.createdAt),a&&t.createElement(I,null,a))),t.createElement(U,{$sign:l},"negative"===l?"-":"",e.amount)),n<B.length-1&&t.createElement(w,null))}))))});export{_ 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{ChevronLeft as r}from"../../../assets/icons/chevron-left.js";import{XClose as o}from"../../../assets/icons/x-close.js";import l from"../../components/count-up/index.js";import s from"../main-screen/cart-warning/index.js";import i from"../main-screen/spending-methods-section/index.js";import{Container as m,Header as a,IconButton as c,Title as d,Content as u,PointsSection as p,PointsTitle as E,PointsValue as f}from"./style.js";var g=e(function(e){var g=e.viewModel,x=e.onBack,j=e.onClose,v=n().t,h=g.user;return t.createElement(m,null,t.createElement(a,null,t.createElement(c,{onClick:x},t.createElement(r,null)),t.createElement(d,null,v("screens.creditSpendingMethods")),t.createElement(c,{onClick:j},t.createElement(o,null))),t.createElement(u,null,h&&t.createElement(p,{$borderRadius:g.loyaltyWidget.settings.cartBorderRadius},t.createElement(E,null,v("header.earnedPoints")),t.createElement(f,null,t.createElement(l,{end:h.totalPoint}))),!!h&&!g.cartId&&t.createElement("div",{style:{padding:"0 16px",marginBottom:16}},t.createElement(s,{viewModel:g})),t.createElement("div",{style:{marginTop:8}},t.createElement(i,{viewModel:g,mode:"accordion",methods:g.spendingMethods,getActionProps:function(e){return null}}))))});export{g 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{ChevronLeft as r}from"../../../assets/icons/chevron-left.js";import{XClose as o}from"../../../assets/icons/x-close.js";import l from"../../components/count-up/index.js";import i from"../main-screen/cart-warning/index.js";import a from"../main-screen/spending-methods-section/index.js";import{Container as s,Header as m,IconButton as c,Title as d,Content as u,PointsSection as p,PointsTitle as E,PointsValue as f}from"./style.js";var g=e(function(e){var g=e.viewModel,v=e.onBack,x=e.onClose,j=n().t,h=g.user;return t.createElement(s,null,t.createElement(m,null,t.createElement(c,{onClick:v},t.createElement(r,null)),t.createElement(d,null,j("screens.creditSpendingMethods")),t.createElement(c,{onClick:x},t.createElement(o,null))),t.createElement(u,null,h&&t.createElement(p,{$borderRadius:g.loyaltyWidget.settings.cartBorderRadius},t.createElement(E,null,j("header.availablePoints")),t.createElement(f,null,t.createElement(l,{end:h.availablePoint}))),!!h&&!g.cartId&&t.createElement("div",{style:{padding:"0 16px",marginBottom:16}},t.createElement(i,{viewModel:g})),t.createElement("div",{style:{marginTop:8}},t.createElement(a,{viewModel:g,mode:"accordion",methods:g.spendingMethods,getActionProps:function(e){return null}}))))});export{g as default};
@@ -1 +1 @@
1
- import{__spreadArray as e,__awaiter as t,__generator as n}from'./../../../ext/tslib/tslib.es6.mjs.js';import{observer as l}from"mobx-react";import i,{useState as o}from"react";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{ChevronLeft as s}from"../../../assets/icons/chevron-left.js";import{XClose as a}from"../../../assets/icons/x-close.js";import{Scenery as d}from"../../../assets/widget-icons/illustraions/scenery.js";import{Album02 as u}from"../../../assets/widget-icons/normal/album02.js";import{WidgetIconTypeEnum as c}from"../../../models/loyalty-widget/types/index.js";import m from"../../components/button/index.js";import v from"../../components/count-up/index.js";import{getProductFullUrl as f}from"../../components/product-filter-card/index.js";import{getFreeProductMethods as p}from"../../utils/spending-method-utils.js";import{ProductCard as g,ProductCardContent as E,ProductImageContainer as y,ProductImage as b,ProductInfo as h,ProductNameContainer as I,ProductName as j,VariantText as S,PointBadge as x,Container as P,Header as w,IconButton as k,Title as M,Content as T,PointsSection as A,PointsTitle as C,PointsValue as R,ProductList as _}from"./style.js";var L=l(function(e){var l,s,a,v,p=e.method,P=e.viewModel,w=r().t,k=o(!1),M=k[0],T=k[1],A=P.loyaltyWidget,C=null===(l=p.discountSettings)||void 0===l?void 0:l.freeProductId,R=null===(s=p.discountSettings)||void 0===s?void 0:s.freeProductVariantId,_=C?P.products.find(function(e){return e.id===C}):null,L=R?null===(a=null==_?void 0:_.variants)||void 0===a?void 0:a.find(function(e){return e.id===R}):null,U=(null==L?void 0:L.mainImageSrc)||(null==_?void 0:_.mainImageSrc),W=(null==L?void 0:L.variantText)||null,z=(null===(v=p.discountSettings)||void 0===v?void 0:v.point)||0,B=A.settings.widgetIconType===c.ILLUSTRATION?d:u,F=f(P.storeUrl,null==_?void 0:_.url);return i.createElement(g,{$clickable:!!F,onClick:function(){F&&window.open(F,"_self")}},i.createElement(E,null,i.createElement(y,null,U?i.createElement(b,{src:U,alt:(null==_?void 0:_.name)||""}):i.createElement(B,null)),i.createElement(h,null,i.createElement(I,null,i.createElement(j,null,(null==_?void 0:_.name)||"-"),W&&i.createElement(S,null,W)),i.createElement(x,null,w("earningMethods.xPoints",{points:z})))),i.createElement("div",{onClick:function(e){return e.stopPropagation()},role:"presentation"},i.createElement(m,{button:A.button,paddingSize:"small",fontSize:"textSMMedium",onClick:function(){return t(void 0,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:if(!P.cartId||!p.isAvailable)return[2];T(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,null===(e=P.callbacks)||void 0===e?void 0:e.useLoyaltyPoints({cartId:P.cartId,loyaltyProgramId:p.loyaltyProgramId,loyaltySpendingMethodId:p.id})];case 2:return t.sent()&&(P.userRefreshTrigger++,P.cartRefreshTrigger++,P.resetNavigation()),[3,4];case 3:return T(!1),[7];case 4:return[2]}})})},isLoading:M,disabled:!p.isAvailable||!P.cartId,fullWidth:!0},w("spendingMethods.FREE_PRODUCT.addFree"))))}),U=l(function(t){var n=t.viewModel,l=t.onBack,o=t.onClose,d=r().t,u=n.user,c=p(n.spendingMethods).filter(function(e){var t,l=null===(t=e.discountSettings)||void 0===t?void 0:t.freeProductId;return!!l&&n.products.some(function(e){return e.id===l})}),m=e([],c,!0).sort(function(e,t){var n,l;return e.isAvailable&&!t.isAvailable?-1:!e.isAvailable&&t.isAvailable?1:((null===(n=e.discountSettings)||void 0===n?void 0:n.point)||0)-((null===(l=t.discountSettings)||void 0===l?void 0:l.point)||0)});return i.createElement(P,null,i.createElement(w,null,i.createElement(k,{onClick:l},i.createElement(s,null)),i.createElement(M,null,d("screens.giftProductSelection")),i.createElement(k,{onClick:o},i.createElement(a,null))),i.createElement(T,null,u&&i.createElement(A,{$borderRadius:n.loyaltyWidget.settings.cartBorderRadius},i.createElement(C,null,d("header.earnedPoints")),i.createElement(R,null,i.createElement(v,{end:u.totalPoint}))),i.createElement(_,null,m.map(function(e){return i.createElement(L,{key:e.id,method:e,viewModel:n})}))))});export{U as default};
1
+ import{__spreadArray as e,__awaiter as t,__generator as n}from'./../../../ext/tslib/tslib.es6.mjs.js';import{observer as l}from"mobx-react";import i,{useState as o}from"react";import'./../../../ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import{ChevronLeft as s}from"../../../assets/icons/chevron-left.js";import{XClose as a}from"../../../assets/icons/x-close.js";import{Scenery as d}from"../../../assets/widget-icons/illustraions/scenery.js";import{Album02 as u}from"../../../assets/widget-icons/normal/album02.js";import{WidgetIconTypeEnum as c}from"../../../models/loyalty-widget/types/index.js";import m from"../../components/button/index.js";import v from"../../components/count-up/index.js";import{getProductFullUrl as f}from"../../components/product-filter-card/index.js";import{getFreeProductMethods as p}from"../../utils/spending-method-utils.js";import{ProductCard as g,ProductCardContent as E,ProductImageContainer as b,ProductImage as y,ProductInfo as h,ProductNameContainer as I,ProductName as j,VariantText as S,PointBadge as x,Container as P,Header as w,IconButton as k,Title as M,Content as T,PointsSection as A,PointsTitle as C,PointsValue as R,ProductList as _}from"./style.js";var L=l(function(e){var l,s,a,v,p=e.method,P=e.viewModel,w=r().t,k=o(!1),M=k[0],T=k[1],A=P.loyaltyWidget,C=null===(l=p.discountSettings)||void 0===l?void 0:l.freeProductId,R=null===(s=p.discountSettings)||void 0===s?void 0:s.freeProductVariantId,_=C?P.products.find(function(e){return e.id===C}):null,L=R?null===(a=null==_?void 0:_.variants)||void 0===a?void 0:a.find(function(e){return e.id===R}):null,U=(null==L?void 0:L.mainImageSrc)||(null==_?void 0:_.mainImageSrc),W=(null==L?void 0:L.variantText)||null,z=(null===(v=p.discountSettings)||void 0===v?void 0:v.point)||0,B=A.settings.widgetIconType===c.ILLUSTRATION?d:u,F=f(P.storeUrl,null==_?void 0:_.url);return i.createElement(g,{$clickable:!!F,onClick:function(){F&&window.open(F,"_self")}},i.createElement(E,null,i.createElement(b,null,U?i.createElement(y,{src:U,alt:(null==_?void 0:_.name)||""}):i.createElement(B,null)),i.createElement(h,null,i.createElement(I,null,i.createElement(j,null,(null==_?void 0:_.name)||"-"),W&&i.createElement(S,null,W)),i.createElement(x,null,w("earningMethods.xPoints",{points:z})))),i.createElement("div",{onClick:function(e){return e.stopPropagation()},role:"presentation"},i.createElement(m,{button:A.button,paddingSize:"small",fontSize:"textSMMedium",onClick:function(){return t(void 0,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:if(!P.cartId||!p.isAvailable)return[2];T(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,null===(e=P.callbacks)||void 0===e?void 0:e.useLoyaltyPoints({cartId:P.cartId,loyaltyProgramId:p.loyaltyProgramId,loyaltySpendingMethodId:p.id})];case 2:return t.sent()&&(P.userRefreshTrigger++,P.cartRefreshTrigger++,P.resetNavigation()),[3,4];case 3:return T(!1),[7];case 4:return[2]}})})},isLoading:M,disabled:!p.isAvailable||!P.cartId,fullWidth:!0},w("spendingMethods.FREE_PRODUCT.addFree"))))}),U=l(function(t){var n=t.viewModel,l=t.onBack,o=t.onClose,d=r().t,u=n.user,c=p(n.spendingMethods).filter(function(e){var t,l=null===(t=e.discountSettings)||void 0===t?void 0:t.freeProductId;return!!l&&n.products.some(function(e){return e.id===l})}),m=e([],c,!0).sort(function(e,t){var n,l;return e.isAvailable&&!t.isAvailable?-1:!e.isAvailable&&t.isAvailable?1:((null===(n=e.discountSettings)||void 0===n?void 0:n.point)||0)-((null===(l=t.discountSettings)||void 0===l?void 0:l.point)||0)});return i.createElement(P,null,i.createElement(w,null,i.createElement(k,{onClick:l},i.createElement(s,null)),i.createElement(M,null,d("screens.giftProductSelection")),i.createElement(k,{onClick:o},i.createElement(a,null))),i.createElement(T,null,u&&i.createElement(A,{$borderRadius:n.loyaltyWidget.settings.cartBorderRadius},i.createElement(C,null,d("header.availablePoints")),i.createElement(R,null,i.createElement(v,{end:u.availablePoint}))),i.createElement(_,null,m.map(function(e){return i.createElement(L,{key:e.id,method:e,viewModel:n})}))))});export{U as default};
@@ -1 +1 @@
1
- import{observer as e}from"mobx-react";import t,{useMemo as n}from"react";import{Trans as r}from'./../../../ext/react-i18next/dist/es/Trans.js';import{useTranslation as l}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import'./../../../ext/react-i18next/dist/es/context.js';import{XClose as o}from"../../../assets/icons/x-close.js";import{ChevronLeft as i}from"../../../assets/icons/chevron-left.js";import{Check as c}from"../../../assets/icons/check.js";import a from"../../components/count-up/index.js";import{Container as s,Header as u,IconButton as m,Title as d,Content as p,PointsSection as E,PointsText as y,PointsValue as f,ProgressBarContainer as g,ProgressBarFill as v,DescriptionText as h,TimelineContainer as $,TimelineItem as T,OtherTiersHeader as R,TimelineLine as k,CheckIconContainer as x,CurrentIndicator as b,CurrentIndicatorDot as L,UpcomingIndicator as j,TimelineContent as q,TimelineTitle as P,TimelineDescription as S,MultiplierSection as C,MultiplierValue as G}from"./style.js";var M=e(function(e){var M,W=e.viewModel,B=e.onBack,I=e.onClose,D=l().t,N=W.user,_=W.tiers,w=!!(null===(M=null==N?void 0:N.customerTier)||void 0===M?void 0:M.customerSegmentId),A=n(function(){return _.filter(function(e){return!e.customerSegmentId}).sort(function(e,t){return(e.pointsRequired||0)-(t.pointsRequired||0)})},[_]),F=n(function(){return(null==N?void 0:N.customerTier)?A.findIndex(function(e){var t;return e.id===(null===(t=N.customerTier)||void 0===t?void 0:t.id)}):-1},[A,null==N?void 0:N.customerTier]),K=n(function(){return!N||w?null:-1===F?A.find(function(e){return(e.pointsRequired||0)>N.totalPoint})||A[0]:A[F+1]||null},[A,F,N,w]),z=n(function(){return N?K?0===(K.pointsRequired||0)?100:Math.min(N.totalPoint/(K.pointsRequired||1)*100,100):100:0},[N,K]),H=n(function(){return N&&K?Math.max(0,(K.pointsRequired||0)-N.totalPoint):0},[N,K]);if(!N)return null;var J=function(e){return"completed"===e?t.createElement(x,null,t.createElement(c,null)):"current"===e?t.createElement(b,null,t.createElement(L,null)):t.createElement(j,null)},O=function(e,n,l){return t.createElement(q,null,t.createElement(P,{$status:n},e.name),l&&t.createElement(S,{$status:n},"current"===n?D("screens.loyaltyLevelScreen.currentTierDescription"):"".concat(e.pointsRequired||0," ").concat(D("common.points")," ").concat(D("screens.loyaltyLevelScreen.afterEarning"))),(e.tierPointMultiplier||1)>1&&t.createElement(C,{$borderRadius:W.loyaltyWidget.settings.cartBorderRadius},t.createElement(r,{i18nKey:"screens.loyaltyLevelScreen.multiplierDescription",values:{multiplier:e.tierPointMultiplier||1},components:[t.createElement(G,{key:"0"})]})))};return t.createElement(s,null,t.createElement(u,null,t.createElement(m,{onClick:B},t.createElement(i,null)),t.createElement(d,null,D("screens.loyaltyLevel")),t.createElement(m,{onClick:I},t.createElement(o,null))),t.createElement(p,null,t.createElement(E,{$borderRadius:W.loyaltyWidget.settings.cartBorderRadius},t.createElement("div",null,t.createElement(y,null,D("header.earnedPoints")),t.createElement(f,null,t.createElement(a,{end:N.totalPoint})," ",D("common.points"))),!w&&t.createElement(g,{$color:W.loyaltyWidget.header.background.progressBarContainerColor||void 0},t.createElement(v,{$percentage:z,$color:W.loyaltyWidget.header.background.bgColor||void 0,$isGradient:"GRADIENT"===W.loyaltyWidget.header.background.type})),!w&&t.createElement(h,null,K?D("screens.loyaltyLevelScreen.reachNextTier",{tierName:K.name,points:H}):D("screens.loyaltyLevelScreen.allTiersCompleted"))),t.createElement($,null,w&&N.customerTier?t.createElement(t.Fragment,null,t.createElement(T,{$compact:A.length>0},J("current"),O(N.customerTier,"current",!0)),A.length>0&&t.createElement(R,null,D("screens.loyaltyLevelScreen.otherTiers")),A.map(function(e,n){var r=n===A.length-1;return t.createElement(T,{key:e.id},!r&&t.createElement(k,{$isLast:!1,$connectionType:"solid-light",$topGap:!0,$bottomGap:!0}),J("upcoming"),O(e,"upcoming",!1))})):A.map(function(e,n){var r="upcoming";F>-1?r=n<F?"completed":n===F?"current":"upcoming":N.totalPoint>=(e.pointsRequired||0)&&(r="completed");var l=n===A.length-1,o="solid-light",i=!0,c=!0;return"completed"===r?F>-1&&n+1===F?(o="solid-dark",i=!0,c=!1):F>-1&&n+1<F?(o="solid-dark",i=!0,c=!0):(o="solid-light",i=!0,c=!0):"current"===r?(o="split",i=!1,c=!0):(o="solid-light",i=!0,c=!0),t.createElement(T,{key:e.id},t.createElement(k,{$isLast:l,$connectionType:o,$topGap:i,$bottomGap:c}),J(r),O(e,r,!0))}))))});export{M as default};
1
+ import{observer as e}from"mobx-react";import t from"react";import{Trans as n}from'./../../../ext/react-i18next/dist/es/Trans.js';import{useTranslation as r}from'./../../../ext/react-i18next/dist/es/useTranslation.js';import'./../../../ext/react-i18next/dist/es/context.js';import{XClose as l}from"../../../assets/icons/x-close.js";import{ChevronLeft as o}from"../../../assets/icons/chevron-left.js";import{Check as i}from"../../../assets/icons/check.js";import{Container as c,Header as a,IconButton as s,Title as u,Content as m,PointsSection as d,PointsText as p,PointsValue as E,ProgressBarContainer as y,ProgressBarFill as g,DescriptionText as v,TimelineContainer as f,TimelineItem as $,OtherTiersHeader as h,TimelineLine as T,CheckIconContainer as k,CurrentIndicator as L,CurrentIndicatorDot as R,UpcomingIndicator as b,TimelineContent as S,TimelineTitle as x,TimelineDescription as j,MultiplierSection as C,MultiplierValue as q}from"./style.js";var G=e(function(e){var G,M=e.viewModel,W=e.onBack,B=e.onClose,P=r(),D=P.t,I=P.i18n,_=M.user,F=M.tiers,N=!!(null===(G=null==_?void 0:_.customerTier)||void 0===G?void 0:G.customerSegmentId);if(!_)return null;var w=F.filter(function(e){return!e.customerSegmentId}).sort(function(e,t){return(e.pointsRequired||0)-(t.pointsRequired||0)}),A=_.cumulativeEarnedPoints,K=N?null:w.find(function(e){return(e.pointsRequired||0)>A}),z=(null==K?void 0:K.pointsRequired)||0,H=z>0?Math.min(A/z*100,100):0,J=Math.max(0,z-A),O=function(e){var t;return e.id===(null===(t=_.customerTier)||void 0===t?void 0:t.id)?"current":A>=(e.pointsRequired||0)?"completed":"upcoming"},Q=function(e){return"completed"===e?t.createElement(k,null,t.createElement(i,null)):"current"===e?t.createElement(L,null,t.createElement(R,null)):t.createElement(b,null)},U=function(e,r,l){return t.createElement(S,null,t.createElement(x,{$status:r},e.name),l&&t.createElement(j,{$status:r},"current"===r?D("screens.loyaltyLevelScreen.currentTierDescription"):"".concat(e.pointsRequired||0," ").concat(D("common.points")," ").concat(D("screens.loyaltyLevelScreen.afterEarning"))),(e.tierPointMultiplier||1)>1&&t.createElement(C,{$borderRadius:M.loyaltyWidget.settings.cartBorderRadius},t.createElement(n,{i18nKey:"screens.loyaltyLevelScreen.multiplierDescription",values:{multiplier:e.tierPointMultiplier||1},components:[t.createElement(q,{key:"0"})]})))};return t.createElement(c,null,t.createElement(a,null,t.createElement(s,{onClick:W},t.createElement(o,null)),t.createElement(u,null,D("screens.loyaltyLevel")),t.createElement(s,{onClick:B},t.createElement(l,null))),t.createElement(m,null,!N&&t.createElement(d,{$borderRadius:M.loyaltyWidget.settings.cartBorderRadius},K?t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement(p,null,D("screens.loyaltyLevelScreen.nextTierLabel",{tierName:K.name})),t.createElement(E,null,D("screens.loyaltyLevelScreen.collectPoints",{points:J.toLocaleString(I.language)}))),t.createElement(y,{$color:M.loyaltyWidget.header.background.progressBarContainerColor||void 0},t.createElement(g,{$percentage:H,$color:M.loyaltyWidget.header.background.bgColor||void 0,$isGradient:"GRADIENT"===M.loyaltyWidget.header.background.type}))):t.createElement(v,null,D("screens.loyaltyLevelScreen.allTiersCompleted"))),t.createElement(f,null,N&&_.customerTier?t.createElement(t.Fragment,null,t.createElement($,{$compact:w.length>0},Q("current"),U(_.customerTier,"current",!0)),w.length>0&&t.createElement(h,null,D("screens.loyaltyLevelScreen.otherTiers")),w.map(function(e,n){var r=n===w.length-1;return t.createElement($,{key:e.id},!r&&t.createElement(T,{$isLast:!1,$connectionType:"solid-light",$topGap:!0,$bottomGap:!0}),Q("upcoming"),U(e,"upcoming",!1))})):w.map(function(e,n){var r=O(e),l=n===w.length-1,o="solid-light",i=!0,c=!0,a=w[n+1],s=a?O(a):null;return"completed"===r?"current"===s?(o="solid-dark",i=!0,c=!1):"completed"===s?(o="solid-dark",i=!0,c=!0):(o="solid-light",i=!0,c=!0):"current"===r?(o="split",i=!1,c=!0):(o="solid-light",i=!0,c=!0),t.createElement($,{key:e.id},t.createElement(T,{$isLast:l,$connectionType:o,$topGap:i,$bottomGap:c}),Q(r),U(e,r,!0))}))))});export{G as default};
@@ -1 +1 @@
1
- import{__spreadArray as e,__assign as t}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{observer as o}from"mobx-react";import n,{useMemo as i}from"react";import'./../../../../ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./../../../../ext/react-i18next/dist/es/useTranslation.js';import{EarningMethodTypeEnum as d,LoyaltyProgramFilterTypeEnum as l}from"../../../../models/types/index.js";import s from"../../../components/loyalty-method-card/index.js";import{ProductFilterList as a}from"../../../components/product-filter-card/index.js";import{getEarningMethodConditionList as p,getEarningMethodDescriptionV2 as c,hasResolvableProductFilters as m}from"../../../utils/loyalty-details.js";import{getEarningMethodTitle as u,getEarningMethodIcon as E}from"../../../../utils.js";var T=o(function(t){var o,m,T=t.method,f=t.viewModel,g=t.mode,y=t.actionText,v=t.onClick,R=t.isActionLoading,x=r(),h=x.t,C=x.i18n,A=f.loyaltyWidget,S=C.language,_=null===(o=T.translations)||void 0===o?void 0:o.find(function(e){return e.locale===S}),O=(null==_?void 0:_.description)||T.description||u(T),U=E(T.methodType,A.settings.widgetIconType),D=T.orderSettings,B=T.productSettings,I=(null==D?void 0:D.productFilters)||[],M=(null==B?void 0:B.productFilters)||[],P=T.methodType===d.ORDER_CREATE&&D&&(D.minOrderAmount>0||(null!==(m=D.maxOrderAmount)&&void 0!==m?m:0)>0||I.length>0)||T.methodType===d.BUY_PRODUCT&&M.length>0,N=P?"accordion":g,j=i(function(){return T.methodType===d.ORDER_CREATE?e([],I||[],!0).filter(function(e){return e.type===l.PRODUCT_AND_VARIANT}):T.methodType===d.BUY_PRODUCT?(M||[]).filter(function(e){return e.type===l.PRODUCT_AND_VARIANT}):[]},[T.methodType,I,M]),k="",b=null;if(P){k=h("earningMethods.xPoints",{points:T.pointsEarned});var w=p(h,T,f),F=j.length>0,H=w.length>0,L=void 0;T.methodType===d.ORDER_CREATE?F&&H?L=h("earningMethods.ORDER_CREATE.BASE.productAndConditionHeader"):F&&(L=h("earningMethods.ORDER_CREATE.BASE.productFilterHeader")):T.methodType===d.BUY_PRODUCT&&F&&(L=h("earningMethods.BUY_PRODUCT.productFilterHeader")),b=n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},L&&n.createElement("div",{style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400}},L),H&&n.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},w.map(function(e,t){return n.createElement("div",{key:t,style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400,display:"flex",gap:"6px"}},n.createElement("span",null,"•"),n.createElement("span",null,e))})),F&&n.createElement(a,{filters:j,viewModel:f}))}else k=c(h,T,f)||h("earningMethods.xPoints",{points:T.pointsEarned});var Y=!!f.user&&T.methodType===d.CUSTOMER_REGISTER||!!f.ikasEventUser&&T.methodType===d.ENABLE_SUBSCRIPTION&&"SUBSCRIBED"===f.ikasEventUser.subscriptionStatus,W=!f.user&&T.methodType===d.ENABLE_SUBSCRIPTION,z=y&&v&&!W?{text:y,onClick:v,loading:R}:void 0;return n.createElement(s,{title:O,description:k,icon:U,action:z,isCompleted:Y,mode:N,settings:{borderRadius:A.settings.cartBorderRadius,widgetIconType:A.settings.widgetIconType,button:A.button}},b)}),f=o(function(o){var i=o.viewModel,r=o.containerStyle,l=o.mode,s=void 0===l?"card":l,a=o.getActionProps,p=i.earningMethods;return n.createElement("div",{style:t({display:"flex",flexDirection:"column",gap:"12px",padding:"0 16px"},r)},e([],p,!0).filter(function(t){var o,n,r=e(e([],(null===(o=t.orderSettings)||void 0===o?void 0:o.productFilters)||[],!0),(null===(n=t.productSettings)||void 0===n?void 0:n.productFilters)||[],!0);return m(i,r)}).sort(function(e,t){var o=function(e){return e===d.CUSTOMER_REGISTER?0:e===d.ENABLE_SUBSCRIPTION?1:2};return o(e.methodType)-o(t.methodType)}).map(function(e){var t=a?a(e):null;return n.createElement(T,{key:e.id,method:e,viewModel:i,mode:s,actionText:null==t?void 0:t.actionText,onClick:null==t?void 0:t.onClick,isActionLoading:null==t?void 0:t.loading})}))});export{f as default};
1
+ import{__spreadArray as e,__assign as t}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{observer as o}from"mobx-react";import i,{useMemo as n}from"react";import'./../../../../ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./../../../../ext/react-i18next/dist/es/useTranslation.js';import{EarningMethodTypeEnum as d,LoyaltyProgramFilterTypeEnum as l}from"../../../../models/types/index.js";import s from"../../../components/loyalty-method-card/index.js";import{ProductFilterList as a}from"../../../components/product-filter-card/index.js";import{getEarningMethodConditionList as p,getEarningMethodDescriptionV2 as c,hasResolvableProductFilters as u}from"../../../utils/loyalty-details.js";import{getEarningMethodTitle as m,getEarningMethodIcon as E}from"../../../../utils.js";var T=o(function(t){var o,u,T,g,y,v=t.method,f=t.viewModel,R=t.mode,h=t.actionText,x=t.onClick,C=t.isActionLoading,A=r(),_=A.t,S=A.i18n,D=f.loyaltyWidget,O=S.language,U=null===(o=v.translations)||void 0===o?void 0:o.find(function(e){return e.locale===O}),P=(null==U?void 0:U.description)||v.description||m(v),B=E(v.methodType,D.settings.widgetIconType),I=v.orderSettings,M=v.productSettings,w=(null==I?void 0:I.productFilters)||[],N=(null==M?void 0:M.productFilters)||[],j=v.methodType===d.ORDER_CREATE&&I&&(I.minOrderAmount>0||(null!==(u=I.maxOrderAmount)&&void 0!==u?u:0)>0||w.length>0)||v.methodType===d.BUY_PRODUCT&&N.length>0,k=(v.methodType===d.ORDER_CREATE||v.methodType===d.BUY_PRODUCT)&&null!==(y=null!==(T=v.waitingPeriodDays)&&void 0!==T?T:null===(g=f.loyaltyProgram)||void 0===g?void 0:g.waitingPeriodDays)&&void 0!==y?y:0,b=k>0,F=j||b,H=F?"accordion":R,L=n(function(){return v.methodType===d.ORDER_CREATE?e([],w||[],!0).filter(function(e){return e.type===l.PRODUCT_AND_VARIANT}):v.methodType===d.BUY_PRODUCT?(N||[]).filter(function(e){return e.type===l.PRODUCT_AND_VARIANT}):[]},[v.methodType,w,N]),Y="",W=null;if(F){Y=_("earningMethods.xPoints",{points:v.pointsEarned});var z=p(_,v,f);b&&z.push(_("earningMethods.waitingPeriod",{count:k}));var G=L.length>0,V=z.length>0,q=void 0;v.methodType===d.ORDER_CREATE?G&&V?q=_("earningMethods.ORDER_CREATE.BASE.productAndConditionHeader"):G&&(q=_("earningMethods.ORDER_CREATE.BASE.productFilterHeader")):v.methodType===d.BUY_PRODUCT&&G&&(q=_("earningMethods.BUY_PRODUCT.productFilterHeader")),W=i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"12px"}},q&&i.createElement("div",{style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400}},q),V&&i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},z.map(function(e,t){return i.createElement("div",{key:t,style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400,display:"flex",gap:"6px"}},i.createElement("span",null,"•"),i.createElement("span",null,e))})),G&&i.createElement(a,{filters:L,viewModel:f}))}else Y=c(_,v,f)||_("earningMethods.xPoints",{points:v.pointsEarned});var J=!!f.user&&v.methodType===d.CUSTOMER_REGISTER||!!f.ikasEventUser&&v.methodType===d.ENABLE_SUBSCRIPTION&&"SUBSCRIBED"===f.ikasEventUser.subscriptionStatus,K=!f.user&&v.methodType===d.ENABLE_SUBSCRIPTION,Q=h&&x&&!K?{text:h,onClick:x,loading:C}:void 0;return i.createElement(s,{title:P,description:Y,icon:B,action:Q,isCompleted:J,mode:H,settings:{borderRadius:D.settings.cartBorderRadius,widgetIconType:D.settings.widgetIconType,button:D.button}},W)}),g=o(function(o){var n=o.viewModel,r=o.containerStyle,l=o.mode,s=void 0===l?"card":l,a=o.getActionProps,p=n.earningMethods;return i.createElement("div",{style:t({display:"flex",flexDirection:"column",gap:"12px",padding:"0 16px"},r)},e([],p,!0).filter(function(t){var o,i,r=e(e([],(null===(o=t.orderSettings)||void 0===o?void 0:o.productFilters)||[],!0),(null===(i=t.productSettings)||void 0===i?void 0:i.productFilters)||[],!0);return u(n,r)}).sort(function(e,t){var o=function(e){return e===d.CUSTOMER_REGISTER?0:e===d.ENABLE_SUBSCRIPTION?1:2};return o(e.methodType)-o(t.methodType)}).map(function(e){var t=a?a(e):null;return i.createElement(T,{key:e.id,method:e,viewModel:n,mode:s,actionText:null==t?void 0:t.actionText,onClick:null==t?void 0:t.onClick,isActionLoading:null==t?void 0:t.loading})}))});export{g 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 r}from'./../../../../../ext/react-i18next/dist/es/useTranslation.js';import{BadgeLevel1 as n}from"../../../../../assets/badgeLevel1.js";import{BadgeLevel2 as l}from"../../../../../assets/badgeLevel2.js";import{BadgeLevel3 as o}from"../../../../../assets/badgeLevel3.js";import{BadgeLevel4 as a}from"../../../../../assets/badgeLevel4.js";import{BadgeIconTypeEnum as m}from"../../../../../models/loyalty-widget/types/index.js";import s from"../../../../components/count-up/index.js";import c from"../../../../components/tooltip/index.js";import{Container as i,TopRow as u,LeftSection as d,BadgeIconContainer as E,PointsContainer as p,Label as g,PointsValue as f,CurrentPoints as v,TotalPoints as L,RightSection as y,LevelBadge as b,BadgeText as j,ProgressBarContainer as x,ProgressBarFill as h}from"./style.js";var T=e(function(e){var T=e.viewModel,_=r().t,I=T.loyaltyWidget,V=T.user,W=I.settings;if(!V)return null;var $=V.totalPoint,k=V.customerTier,w=V.nextTierRequiredPoint||0,C=w>0?Math.min($/w*100,100):0,M=t.useMemo(function(){var e=V.customerTier;return e?"🏆 ".concat(e.name):"🏆 "},[W.badgeIconLevel,V.customerTier]);return t.createElement(i,null,t.createElement(u,null,t.createElement(d,null,t.createElement(E,null,function(){switch(W.badgeIconLevel){case m.LEVEL_1:return t.createElement(n,null);case m.LEVEL_2:return t.createElement(l,null);case m.LEVEL_3:return t.createElement(o,null);case m.LEVEL_4:return t.createElement(a,null);default:return null}}()),t.createElement(p,null,t.createElement(g,null,_("header.earnedPoints")),t.createElement(f,null,t.createElement(v,null,t.createElement(s,{end:$})),w>0&&t.createElement(L,null,"/ ",w)))),t.createElement(y,null,W.badgeIconLevel!==m.NONE&&!!(null==k?void 0:k.name.length)&&t.createElement(b,null,t.createElement(c,{content:M},t.createElement(j,null,M))))),w>0&&t.createElement(x,{$color:T.loyaltyWidget.header.background.progressBarContainerColor||void 0},t.createElement(h,{$percentage:C,$color:T.loyaltyWidget.header.background.bgColor||void 0,$isGradient:"GRADIENT"===T.loyaltyWidget.header.background.type})))});export{T 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{BadgeLevel1 as r}from"../../../../../assets/badgeLevel1.js";import{BadgeLevel2 as l}from"../../../../../assets/badgeLevel2.js";import{BadgeLevel3 as o}from"../../../../../assets/badgeLevel3.js";import{BadgeLevel4 as a}from"../../../../../assets/badgeLevel4.js";import{BadgeIconTypeEnum as m}from"../../../../../models/loyalty-widget/types/index.js";import i from"../../../../components/count-up/index.js";import s from"../../../../components/tooltip/index.js";import{Container as c,TopRow as u,LeftSection as d,BadgeIconContainer as E,PointsContainer as p,Label as g,PointsValue as v,CurrentPoints as f,PendingPoints as L,RightSection as b,LevelBadge as y,BadgeText as j,ProgressBarContainer as x,ProgressBarFill as h}from"./style.js";var P=e(function(e){var P=e.viewModel,T=n().t,_=P.loyaltyWidget,I=P.user,V=_.settings;if(!I)return null;var W=I.availablePoint,$=I.cumulativeEarnedPoints,k=I.totalPoint,w=I.customerTier,C=k-W,M=I.nextTierRequiredPoint||0,N=M>0?Math.min($/M*100,100):0,G=t.useMemo(function(){var e=I.customerTier;return e?"🏆 ".concat(e.name):"🏆 "},[V.badgeIconLevel,I.customerTier]);return t.createElement(c,null,t.createElement(u,null,t.createElement(d,null,t.createElement(E,null,function(){switch(V.badgeIconLevel){case m.LEVEL_1:return t.createElement(r,null);case m.LEVEL_2:return t.createElement(l,null);case m.LEVEL_3:return t.createElement(o,null);case m.LEVEL_4:return t.createElement(a,null);default:return null}}()),t.createElement(p,null,t.createElement(g,null,T("header.availablePoints")),t.createElement(v,null,t.createElement(f,null,t.createElement(i,{end:W}))),C>0&&t.createElement(L,null,T("header.pendingPoints",{points:C})))),t.createElement(b,null,V.badgeIconLevel!==m.NONE&&!!(null==w?void 0:w.name.length)&&t.createElement(y,null,t.createElement(s,{content:G},t.createElement(j,null,G))))),M>0&&t.createElement(x,{$color:P.loyaltyWidget.header.background.progressBarContainerColor||void 0},t.createElement(h,{$percentage:N,$color:P.loyaltyWidget.header.background.bgColor||void 0,$isGradient:"GRADIENT"===P.loyaltyWidget.header.background.type})))});export{P as default};
@@ -6,7 +6,7 @@ export declare const PointsContainer: import("styled-components").StyledComponen
6
6
  export declare const Label: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export declare const PointsValue: import("styled-components").StyledComponent<"div", any, {}, never>;
8
8
  export declare const CurrentPoints: import("styled-components").StyledComponent<"span", any, {}, never>;
9
- export declare const TotalPoints: import("styled-components").StyledComponent<"span", any, {}, never>;
9
+ export declare const PendingPoints: import("styled-components").StyledComponent<"div", any, {}, never>;
10
10
  export declare const BadgeIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
11
11
  export declare const Badge: import("styled-components").StyledComponent<"div", any, {}, never>;
12
12
  export declare const LevelBadge: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1 +1 @@
1
- import{__makeTemplateObject as n}from'./../../../../../ext/tslib/tslib.es6.mjs.js';import e from"styled-components";import{textSM as i,displayXSSemiBold as r,textLGSemiBold as a}from"../../../../components/style/typography.js";var t=e.div(b||(b=n(["\n display: flex;\n flex-direction: column;\n padding: 16px;\n gap: 20px;\n width: 100%;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: column;\n padding: 16px;\n gap: 20px;\n width: 100%;\n box-sizing: border-box;\n"]))),p=e.div(h||(h=n(["\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n width: 100%;\n"],["\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n width: 100%;\n"]))),d=e.div(u||(u=n(["\n display: flex;\n gap: 16px;\n align-items: center;\n"],["\n display: flex;\n gap: 16px;\n align-items: center;\n"]))),o=e.div(w||(w=n([""],[""]))),x=e.div(m||(m=n(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"],["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"]))),l=e.div(v||(v=n(["\n color: #121926;\n text-align: center;\n ","\n"],["\n color: #121926;\n text-align: center;\n ","\n"])),i),s=e.div(y||(y=n(["\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"],["\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"]))),g=e.span(k||(k=n(["\n color: #121926;\n ","\n"],["\n color: #121926;\n ","\n"])),r),f=e.span(B||(B=n(["\n color: #9aa4b2;\n ","\n"],["\n color: #9aa4b2;\n ","\n"])),a),c=e.div(j||(j=n(["\n svg {\n width: 40px;\n height: 40px;\n }\n"],["\n svg {\n width: 40px;\n height: 40px;\n }\n"])));e.div(G||(G=n(["\n display: flex;\n padding: 4px 10px;\n align-items: center;\n gap: 4px;\n border-radius: 999px;\n border: 1px solid var(--Gray-Blue-100, #eef2f6);\n background: var(--Basic-50, #fff);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n"],["\n display: flex;\n padding: 4px 10px;\n align-items: center;\n gap: 4px;\n border-radius: 999px;\n border: 1px solid var(--Gray-Blue-100, #eef2f6);\n background: var(--Basic-50, #fff);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n"])));var b,h,u,w,m,v,y,k,B,j,G,$,z,E,F,_=e.div($||($=n(["\n display: flex;\n padding: 4px 10px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n\n border-radius: 8px;\n border: 0.6px solid var(--Gray-Blue-300, #cdd5df);\n background: var(--Basic-50, #fff);\n box-shadow:\n 0 1px 1px 0 rgba(38, 69, 109, 0.03),\n 0 1px 1px 0 rgba(38, 69, 109, 0.02),\n 0 2px 1px 0 rgba(38, 69, 109, 0.01),\n 0 -3px 1px 0 rgba(238, 242, 246, 0.5) inset;\n"],["\n display: flex;\n padding: 4px 10px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n\n border-radius: 8px;\n border: 0.6px solid var(--Gray-Blue-300, #cdd5df);\n background: var(--Basic-50, #fff);\n box-shadow:\n 0 1px 1px 0 rgba(38, 69, 109, 0.03),\n 0 1px 1px 0 rgba(38, 69, 109, 0.02),\n 0 2px 1px 0 rgba(38, 69, 109, 0.01),\n 0 -3px 1px 0 rgba(238, 242, 246, 0.5) inset;\n"]))),q=e.span(z||(z=n(["\n color: #364152;\n text-align: center;\n\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n max-width: 70px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"],["\n color: #364152;\n text-align: center;\n\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n max-width: 70px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"]))),A=e.div(E||(E=n(["\n width: 100%;\n height: 8px;\n border-radius: 4px;\n background: ",";\n overflow: hidden;\n"],["\n width: 100%;\n height: 8px;\n border-radius: 4px;\n background: ",";\n overflow: hidden;\n"])),function(n){return n.$color||"#eef2f6"}),C=e.div(F||(F=n(["\n width: ","%;\n height: 100%;\n\n border-radius: 4px;\n background: ",";\n\n transition: width 0.3s ease-in-out;\n"],["\n width: ","%;\n height: 100%;\n\n border-radius: 4px;\n background: ",";\n\n transition: width 0.3s ease-in-out;\n"])),function(n){return n.$percentage},function(n){return n.$isGradient?"linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(255, 255, 255, 0.5) 100%), ".concat(n.$color||"#4F46E5"):n.$color||"#4F46E5"});export{c as BadgeIconContainer,q as BadgeText,t as Container,g as CurrentPoints,l as Label,d as LeftSection,_ as LevelBadge,x as PointsContainer,s as PointsValue,A as ProgressBarContainer,C as ProgressBarFill,o as RightSection,p as TopRow,f as TotalPoints};
1
+ import{__makeTemplateObject as n}from'./../../../../../ext/tslib/tslib.es6.mjs.js';import e from"styled-components";import{textSM as i,displayXSSemiBold as r}from"../../../../components/style/typography.js";var t=e.div(c||(c=n(["\n display: flex;\n flex-direction: column;\n padding: 16px;\n gap: 20px;\n width: 100%;\n box-sizing: border-box;\n"],["\n display: flex;\n flex-direction: column;\n padding: 16px;\n gap: 20px;\n width: 100%;\n box-sizing: border-box;\n"]))),a=e.div(b||(b=n(["\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n width: 100%;\n"],["\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n width: 100%;\n"]))),p=e.div(h||(h=n(["\n display: flex;\n gap: 16px;\n align-items: center;\n"],["\n display: flex;\n gap: 16px;\n align-items: center;\n"]))),o=e.div(u||(u=n([""],[""]))),d=e.div(m||(m=n(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"],["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"]))),x=e.div(w||(w=n(["\n color: #121926;\n text-align: center;\n ","\n"],["\n color: #121926;\n text-align: center;\n ","\n"])),i),l=e.div(v||(v=n(["\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"],["\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"]))),s=e.span(y||(y=n(["\n color: #121926;\n ","\n"],["\n color: #121926;\n ","\n"])),r),g=e.div(k||(k=n(["\n margin-top: 4px;\n color: #697586;\n ","\n"],["\n margin-top: 4px;\n color: #697586;\n ","\n"])),i),f=e.div(B||(B=n(["\n svg {\n width: 40px;\n height: 40px;\n }\n"],["\n svg {\n width: 40px;\n height: 40px;\n }\n"])));e.div(j||(j=n(["\n display: flex;\n padding: 4px 10px;\n align-items: center;\n gap: 4px;\n border-radius: 999px;\n border: 1px solid var(--Gray-Blue-100, #eef2f6);\n background: var(--Basic-50, #fff);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n"],["\n display: flex;\n padding: 4px 10px;\n align-items: center;\n gap: 4px;\n border-radius: 999px;\n border: 1px solid var(--Gray-Blue-100, #eef2f6);\n background: var(--Basic-50, #fff);\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n"])));var c,b,h,u,m,w,v,y,k,B,j,G,$,z,E,F=e.div(G||(G=n(["\n display: flex;\n padding: 4px 10px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n\n border-radius: 8px;\n border: 0.6px solid var(--Gray-Blue-300, #cdd5df);\n background: var(--Basic-50, #fff);\n box-shadow:\n 0 1px 1px 0 rgba(38, 69, 109, 0.03),\n 0 1px 1px 0 rgba(38, 69, 109, 0.02),\n 0 2px 1px 0 rgba(38, 69, 109, 0.01),\n 0 -3px 1px 0 rgba(238, 242, 246, 0.5) inset;\n"],["\n display: flex;\n padding: 4px 10px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n\n border-radius: 8px;\n border: 0.6px solid var(--Gray-Blue-300, #cdd5df);\n background: var(--Basic-50, #fff);\n box-shadow:\n 0 1px 1px 0 rgba(38, 69, 109, 0.03),\n 0 1px 1px 0 rgba(38, 69, 109, 0.02),\n 0 2px 1px 0 rgba(38, 69, 109, 0.01),\n 0 -3px 1px 0 rgba(238, 242, 246, 0.5) inset;\n"]))),_=e.span($||($=n(["\n color: #364152;\n text-align: center;\n\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n max-width: 70px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"],["\n color: #364152;\n text-align: center;\n\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n max-width: 70px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"]))),q=e.div(z||(z=n(["\n width: 100%;\n height: 8px;\n border-radius: 4px;\n background: ",";\n overflow: hidden;\n"],["\n width: 100%;\n height: 8px;\n border-radius: 4px;\n background: ",";\n overflow: hidden;\n"])),function(n){return n.$color||"#eef2f6"}),A=e.div(E||(E=n(["\n width: ","%;\n height: 100%;\n\n border-radius: 4px;\n background: ",";\n\n transition: width 0.3s ease-in-out;\n"],["\n width: ","%;\n height: 100%;\n\n border-radius: 4px;\n background: ",";\n\n transition: width 0.3s ease-in-out;\n"])),function(n){return n.$percentage},function(n){return n.$isGradient?"linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(255, 255, 255, 0.5) 100%), ".concat(n.$color||"#4F46E5"):n.$color||"#4F46E5"});export{f as BadgeIconContainer,_ as BadgeText,t as Container,s as CurrentPoints,x as Label,p as LeftSection,F as LevelBadge,g as PendingPoints,d as PointsContainer,l as PointsValue,q as ProgressBarContainer,A as ProgressBarFill,o as RightSection,a as TopRow};