@ikas/loyalty-widget-renderer 1.0.0-alpha.90 → 1.0.0-alpha.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -1
- package/build/models/index.d.ts +1 -13
- package/build/models/index.js +1 -1
- package/build/models/loyalty-program-point-history/index.d.ts +0 -13
- package/build/models/loyalty-program-point-history/index.js +1 -1
- package/build/models/types/index.d.ts +1 -17
- package/build/renderer/index.js +1 -1
- package/build/renderer/screens/credit-history-screen/index.js +1 -1
- package/build/renderer/screens/credit-history-screen/style.d.ts +0 -2
- package/build/renderer/screens/credit-history-screen/style.js +1 -1
- package/build/storefront-widget-script-injector.iife.js +1 -1
- package/build/storefront-widget-script-injector.iife.js.map +1 -1
- package/package.json +1 -1
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
|
|
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";
|
package/build/models/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { LoyaltyProgramEarningMethod } from "./loyalty-program-earning-method";
|
|
|
3
3
|
import { LoyaltyProgramPointHistory } from "./loyalty-program-point-history";
|
|
4
4
|
import { LoyaltyProgramSpendingMethod } from "./loyalty-program-spending-method";
|
|
5
5
|
import { LoyaltyWidget } from "./loyalty-widget";
|
|
6
|
-
import { Brand, Category,
|
|
6
|
+
import { Brand, Category, LoyaltyWidgetCallbacks, LoyaltyWidgetScreenTypeEnum, Product, Tag, WidgetMode } from "./types";
|
|
7
7
|
export declare class LoyaltyWidgetViewModel {
|
|
8
8
|
navigationStack: LoyaltyWidgetScreenTypeEnum[];
|
|
9
9
|
currentWidgetMode: WidgetMode;
|
|
@@ -29,10 +29,6 @@ export declare class LoyaltyWidgetViewModel {
|
|
|
29
29
|
spendingMethods: LoyaltyProgramSpendingMethod[];
|
|
30
30
|
tiers: LoyaltyProgramTier[];
|
|
31
31
|
pointHistory: LoyaltyProgramPointHistory[];
|
|
32
|
-
pointHistoryPage: number;
|
|
33
|
-
pointHistoryLimit: number | null;
|
|
34
|
-
pointHistoryHasNext: boolean;
|
|
35
|
-
isPointHistoryLoadingMore: boolean;
|
|
36
32
|
callbacks?: LoyaltyWidgetCallbacks;
|
|
37
33
|
constructor(data: Partial<LoyaltyWidgetViewModel> | undefined, cdnURL: string, merchantId: string, currency: string, storeURL?: string | null, isPreviewMode?: boolean, callbacks?: LoyaltyWidgetCallbacks);
|
|
38
34
|
get currentScreen(): LoyaltyWidgetScreenTypeEnum;
|
|
@@ -43,13 +39,5 @@ export declare class LoyaltyWidgetViewModel {
|
|
|
43
39
|
get shouldShowSpendingMethods(): boolean;
|
|
44
40
|
setWidgetMode(mode: WidgetMode): void;
|
|
45
41
|
closeMiniModeDescription(): void;
|
|
46
|
-
setPointHistoryFirstPage(response: LoyaltyProgramPointHistoryPaginationResponse | LoyaltyProgramPointHistory[] | null): void;
|
|
47
|
-
resetPointHistory(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Liste sonuna gelindiğinde bir sonraki sayfayı çekip mevcut listenin sonuna ekler.
|
|
50
|
-
* Devam eden bir istek varken ya da `hasNext` false iken yeni istek atılmaz; hata
|
|
51
|
-
* durumunda yüklenmiş kayıtlar ve sayfa bilgisi korunur, böylece tekrar denenebilir.
|
|
52
|
-
*/
|
|
53
|
-
loadMorePointHistory(): Promise<void>;
|
|
54
42
|
formatCurrency(price: number): string;
|
|
55
43
|
}
|
package/build/models/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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,4 +1,3 @@
|
|
|
1
|
-
import type { LoyaltyProgramPointHistoryPaginationResponse } from "../types";
|
|
2
1
|
import { LoyaltyProgramPointHistoryTypeEnum } from "../types";
|
|
3
2
|
export declare class LoyaltyProgramPointHistory {
|
|
4
3
|
amount: number;
|
|
@@ -18,15 +17,3 @@ export declare class LoyaltyProgramPointHistory {
|
|
|
18
17
|
updatedAt: any | null;
|
|
19
18
|
constructor(data?: Partial<LoyaltyProgramPointHistory>);
|
|
20
19
|
}
|
|
21
|
-
export type NormalizedPointHistoryPage = {
|
|
22
|
-
data: LoyaltyProgramPointHistory[];
|
|
23
|
-
hasNext: boolean;
|
|
24
|
-
limit: number | null;
|
|
25
|
-
page: number;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* `listLoyaltyProgramPointHistory` sayfalı cevap döner. Widget bağımsız yayınlandığı
|
|
29
|
-
* için henüz güncellenmemiş bir host düz liste de gönderebilir; iki şekli de tek
|
|
30
|
-
* sayfa yapısına indiriyoruz.
|
|
31
|
-
*/
|
|
32
|
-
export declare const normalizePointHistoryPage: (response: LoyaltyProgramPointHistoryPaginationResponse | LoyaltyProgramPointHistory[] | null | undefined, requestedPage: number) => NormalizedPointHistoryPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeObservable as t,observable as e}from"mobx";import{LoyaltyProgramPointHistoryTypeEnum as r}from"../types/index.js";var
|
|
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};
|
|
@@ -107,31 +107,15 @@ export interface LoyaltyProgramPointHistoryTypeEnumFilterInput {
|
|
|
107
107
|
ne?: LoyaltyProgramPointHistoryTypeEnum | null;
|
|
108
108
|
nin?: LoyaltyProgramPointHistoryTypeEnum[] | null;
|
|
109
109
|
}
|
|
110
|
-
export type PaginationInput = {
|
|
111
|
-
page?: number | null;
|
|
112
|
-
limit?: number | null;
|
|
113
|
-
};
|
|
114
110
|
export type ListLoyaltyProgramPointHistoryInput = {
|
|
115
111
|
type?: LoyaltyProgramPointHistoryTypeEnumFilterInput | null;
|
|
116
|
-
pagination?: PaginationInput | null;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* `listLoyaltyProgramPointHistory` sayfalı cevap dönüyor: kayıtlar `data` içinde,
|
|
120
|
-
* sayfa bilgisi ise `page`/`limit`/`hasNext` ile birlikte geliyor.
|
|
121
|
-
*/
|
|
122
|
-
export type LoyaltyProgramPointHistoryPaginationResponse = {
|
|
123
|
-
count: number;
|
|
124
|
-
data: LoyaltyProgramPointHistory[];
|
|
125
|
-
hasNext: boolean;
|
|
126
|
-
limit: number;
|
|
127
|
-
page: number;
|
|
128
112
|
};
|
|
129
113
|
export type LoyaltyWidgetCallbacks = {
|
|
130
114
|
listSpendingMethodsByCartId: (cartId?: string | null) => Promise<LoyaltyProgramSpendingMethod[]>;
|
|
131
115
|
getLoyaltyCustomerInfo: () => Promise<LoyaltyCustomerInfo | null>;
|
|
132
116
|
listEarningMethods: () => Promise<LoyaltyProgramEarningMethod[]>;
|
|
133
117
|
listLoyaltyProgramTier: (input: ListLoyaltyProgramTierInput) => Promise<LoyaltyProgramTier[]>;
|
|
134
|
-
listLoyaltyProgramPointHistory: (input: ListLoyaltyProgramPointHistoryInput) => Promise<
|
|
118
|
+
listLoyaltyProgramPointHistory: (input: ListLoyaltyProgramPointHistoryInput) => Promise<LoyaltyProgramPointHistory[]>;
|
|
135
119
|
useLoyaltyPoints: (input: AddLoyaltyToCartInput) => Promise<boolean>;
|
|
136
120
|
removeLoyaltyPointsFromCart: () => Promise<void>;
|
|
137
121
|
getLoyaltyWidget: () => Promise<LoyaltyWidget>;
|
package/build/renderer/index.js
CHANGED
|
@@ -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 c}from"../models/index.js";import{LoyaltyCustomerInfo as d}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as u}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramSpendingMethod as f}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyWidget as v}from"../models/loyalty-widget/index.js";import{WidgetPositionEnum as m,LoyaltyWidgetLayoutTypeEnum as g}from"../models/loyalty-widget/types/index.js";import{WidgetMode as p,LoyaltyWidgetScreenTypeEnum as E,EarningMethodTypeEnum as y,LoyaltyProgramFilterTypeEnum as h,LoyaltyProgramMethodSpendingTypeEnum as T}from"../models/types/index.js";import R from"./components/mini-mode-button/index.js";import k from"./components/mini-mode-description/index.js";import b from"./screens/credit-earning-methods-screen/index.js";import w from"./screens/credit-history-screen/index.js";import I from"./screens/credit-spending-methods-screen/index.js";import M from"./screens/gift-product-selection-screen/index.js";import _ from"./screens/loyalty-level-screen/index.js";import C from"./screens/main-screen/index.js";import O from"./utils/i18n.js";import{unflatten as S}from"./utils/object-utils.js";import{Container as D,MiniModeWrapper as P,Panel as A,ScreenWrapper as L}from"./style.js";var U=i(function(i){var U,j,N,x=i.config,W=s(function(){var e=x||window.ikasLoyaltyWidgetConfig;return new c({cartId:(null==e?void 0:e.cartId)||null,ikasEventUser:(null==e?void 0:e.userId)?{id:e.userId}:null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.storeURL)||null,null==e?void 0:e.isPreviewMode,null==e?void 0:e.callbacks)})[0],$=s(!1),G=$[0],B=$[1],F=s(!1),V=F[0],z=F[1],Y=s(!1),H=Y[0],J=Y[1],q=W.loyaltyWidget.translations,K=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(O.language!==n&&O.changeLanguage(n),Object.keys(t).length>0){var i=S(t);O.addResourceBundle(n,"translation",i,!0,!0)}}},[null==q?void 0:q.language,K]),a(function(){var e=x||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized(W)},[W,x]);var Q=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 W.callbacks?(e=new Set,r=new Set,i=new Set,o=new Set,W.earningMethods.forEach(function(t){var s,a;t.methodType!==y.ORDER_CREATE&&t.methodType!==y.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===h.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===h.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===h.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===h.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),W.spendingMethods&&W.spendingMethods.forEach(function(t){var n,s;t.type===T.FREE_PRODUCT&&(null===(n=t.discountSettings)||void 0===n?void 0:n.freeProductId)&&e.add(t.discountSettings.freeProductId),null===(s=t.productFilters)||void 0===s||s.forEach(function(t){t.type===h.PRODUCT_AND_VARIANT?t.idList.forEach(function(t){t.startsWith("v:")||e.add(t.replace(/^p:/,""))}):t.type===h.CATEGORY?t.idList.forEach(function(e){return r.add(e)}):t.type===h.PRODUCT_BRAND?t.idList.forEach(function(e){return i.add(e)}):t.type===h.PRODUCT_TAG&&t.idList.forEach(function(e){return o.add(e)})})}),s=[],e.size>0&&W.callbacks.getProducts&&s.push(W.callbacks.getProducts(Array.from(e)).then(function(e){W.products=e})),r.size>0&&W.callbacks.getCategories&&s.push(W.callbacks.getCategories(Array.from(r)).then(function(e){return W.categories=e})),i.size>0&&W.callbacks.getBrands&&s.push(W.callbacks.getBrands(Array.from(i)).then(function(e){return W.brands=e})),o.size>0&&W.callbacks.getTags&&s.push(W.callbacks.getTags(Array.from(o)).then(function(e){return W.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(!W.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[W.callbacks.getLoyaltyWidget(),W.callbacks.listEarningMethods(),W.callbacks.listLoyaltyProgramTier({})],[4,Promise.all(e)];case 2:return n=t.sent(),r=n[0],i=n[1],o=n[2],W.loyaltyWidget=r instanceof v?r:new v(r||{}),W.earningMethods=i.map(function(e){return new u(e)}),W.tiers=o||[],[4,Q()];case 3:return t.sent(),[3,6];case 4:return s=t.sent(),console.error("Failed to initialize loyalty data",s),[3,6];case 5:return B(!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=W.ikasEventUser)||void 0===n?void 0:n.id)!==r.id&&(W.ikasEventUser=r,W.userRefreshTrigger++,W.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)?W.cartId=null:W.cartId=s,W.cartRefreshTrigger++},n={CUSTOMER_LOGIN:e,CUSTOMER_VISIT:e,CUSTOMER_LOGOUT:function(){W.ikasEventUser=null,W.user=null,W.resetPointHistory(),W.userRefreshTrigger++,W.cartRefreshTrigger++},ADD_TO_CART:function(e){return t(e)},REMOVE_FROM_CART:t,REMOVE_LOYALTY_POINTS:function(){W.cartRefreshTrigger++,W.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=!W.ikasEventUser,o=(null===(n=W.ikasEventUser)||void 0===n?void 0:n.subscriptionStatus)!==r.subscriptionStatus;(i||o)&&(W.ikasEventUser=r,W.userRefreshTrigger++,W.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)}}},[W]),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(V)return[2];if(z(!0),!W.callbacks||!(null===(o=W.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([W.callbacks.getLoyaltyCustomerInfo(),W.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],W.user=n?new d(n):null,n||(W.ikasEventUser=null),W.setPointHistoryFirstPage(r),[3,4];case 3:return i=t.sent(),console.error("Failed to fetch user data",i),[3,4];case 4:return z(!1),[2]}})})},[null===(U=W.ikasEventUser)||void 0===U?void 0:U.id,W.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(H)return[2];if(J(!0),!W.callbacks||!(null===(r=W.ikasEventUser)||void 0===r?void 0:r.id))return[3,6];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,W.callbacks.listSpendingMethodsByCartId(W.cartId)];case 2:return e=t.sent(),W.spendingMethods=e.map(function(e){return new f(e)}),[4,Q()];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:W.spendingMethods=[],t.label=7;case 7:return J(!1),[2]}})})},[W.cartId,W.cartRefreshTrigger,null===(j=W.ikasEventUser)||void 0===j?void 0:j.id]);var X=function(){W.setWidgetMode(p.MINI_MODE),setTimeout(function(){W.resetNavigation()},300)};a(function(){return W.currentWidgetMode===p.WIDGET_MODE?document.body.style.overflow="hidden":document.body.style.overflow="",function(){document.body.style.overflow=""}},[W.currentWidgetMode]);var Z=s(null),ee=Z[0],te=Z[1],ne=s(null),re=ne[0],ie=ne[1],oe=W.navigationStack.length,se=oe>1?W.navigationStack[1]:null,ae=oe>2?W.navigationStack[2]:null;a(function(){se&&te(se)},[se]),a(function(){ae&&ie(ae)},[ae]);var le=W.loyaltyWidget.settings.position||m.RIGHT,ce=W.loyaltyWidget.settings.type||g.DRAWER,de=function(e){switch(e){case E.CREDIT_SPENDING_METHODS_SCREEN:return o.createElement(I,{viewModel:W,onBack:function(){return W.popScreen()},onClose:X});case E.CREDIT_EARNING_METHODS_SCREEN:return o.createElement(b,{viewModel:W,onBack:function(){return W.popScreen()},onClose:X});case E.CREDIT_HISTORY_SCREEN:return o.createElement(w,{viewModel:W,onBack:function(){return W.popScreen()},onClose:X});case E.LOYALTY_LEVEL_SCREEN:return o.createElement(_,{viewModel:W,onBack:function(){return W.popScreen()},onClose:X});case E.GIFT_PRODUCT_SELECTION_SCREEN:return o.createElement(M,{viewModel:W,onBack:function(){return W.popScreen()},onClose:X});default:return null}};if(!G)return null;var ue=(null==x?void 0:x.position)||(null===(N=window.ikasLoyaltyWidgetConfig)||void 0===N?void 0:N.position)||"fixed";return o.createElement(l,{i18n:O},o.createElement(D,{$layoutType:ce,$widgetPosition:le,$widgetMode:W.currentWidgetMode,$position:ue,onClick:function(){W.currentWidgetMode===p.WIDGET_MODE&&X()},className:"ikas-storefront-widget"},o.createElement(P,{$isVisible:W.currentWidgetMode===p.MINI_MODE,$widgetPosition:le},o.createElement(k,{viewModel:W,isInitialized:G}),o.createElement(R,{viewModel:W})),o.createElement(A,{$layoutType:ce,$isOpen:W.currentWidgetMode===p.WIDGET_MODE,$widgetPosition:le,onClick:function(e){return e.stopPropagation()}},o.createElement(L,{$isActive:W.isMainScreen,$layer:0,$layoutType:ce},o.createElement(C,{viewModel:W,onClose:X,onNavigate:function(e){return W.pushScreen(e)}})),o.createElement(L,{$isActive:!!se,$layer:1,$layoutType:ce},de(se||ee)),o.createElement(L,{$isActive:!!ae,$layer:2,$layoutType:ce},de(ae||re)))))});export{U as default};
|
|
1
|
+
import{__awaiter as e,__generator as t,__spreadArray as n}from'./../ext/tslib/tslib.es6.mjs.js';import{toJS as r}from"mobx";import{observer as i}from"mobx-react";import o,{useState as s,useEffect as a}from"react";import'./../ext/react-i18next/dist/es/context.js';import{I18nextProvider as l}from'./../ext/react-i18next/dist/es/I18nextProvider.js';import{LoyaltyWidgetViewModel as c}from"../models/index.js";import{LoyaltyCustomerInfo as d}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as u}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as f}from"../models/loyalty-program-point-history/index.js";import{LoyaltyProgramSpendingMethod as 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 A,MiniModeWrapper as L,Panel as P,ScreenWrapper as U}from"./style.js";var j=i(function(i){var j,x,N,W=i.config,$=s(function(){var e=W||window.ikasLoyaltyWidgetConfig;return new c({cartId:(null==e?void 0:e.cartId)||null,ikasEventUser:(null==e?void 0:e.userId)?{id:e.userId}:null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.storeURL)||null,null==e?void 0:e.isPreviewMode,null==e?void 0:e.callbacks)})[0],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=W||window.ikasLoyaltyWidgetConfig;(null==e?void 0:e.onViewModelInitialized)&&e.onViewModelInitialized($)},[$,W]);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(),[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 d(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===(x=$.ikasEventUser)||void 0===x?void 0:x.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 ce=$.loyaltyWidget.settings.position||g.RIGHT,de=$.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==W?void 0:W.position)||(null===(N=window.ikasLoyaltyWidgetConfig)||void 0===N?void 0:N.position)||"fixed";return o.createElement(l,{i18n:S},o.createElement(A,{$layoutType:de,$widgetPosition:ce,$widgetMode:$.currentWidgetMode,$position:fe,onClick:function(){$.currentWidgetMode===y.WIDGET_MODE&&Z()},className:"ikas-storefront-widget"},o.createElement(L,{$isVisible:$.currentWidgetMode===y.MINI_MODE,$widgetPosition:ce},o.createElement(b,{viewModel:$,isInitialized:B}),o.createElement(k,{viewModel:$})),o.createElement(P,{$layoutType:de,$isOpen:$.currentWidgetMode===y.WIDGET_MODE,$widgetPosition:ce,onClick:function(e){return e.stopPropagation()}},o.createElement(U,{$isActive:$.isMainScreen,$layer:0,$layoutType:de},o.createElement(O,{viewModel:$,onClose:Z,onNavigate:function(e){return $.pushScreen(e)}})),o.createElement(U,{$isActive:!!ae,$layer:1,$layoutType:de},ue(ae||te)),o.createElement(U,{$isActive:!!le,$layer:2,$layoutType:de},ue(le||ie)))))});export{j 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
|
|
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 a}from"../../../models/types/index.js";import i from"../../components/count-up/index.js";import{getRefundIcon as c,getHistoryEarningMethodLabel as s,getEarningMethodIcon as u}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 A,HistoryItem as T,HistoryItemLeft as N,HistoryItemTitle as R,EarningMethodInfo as D,EarningMethodIcon as U,HistoryItemDate as v,HistoryItemAmount as L,Divider as M}from"./style.js";var _=[o.EARN,o.REFILL,o.MANUAL_EARN],j=[o.SPEND,o.REFUND,o.MANUAL_DEDUCT],x=e(function(e){var x=e.viewModel,F=e.onBack,w=e.onClose,C=n(),I=C.t,b=C.i18n,k=x.user,P=x.pointHistory,W=x.earningMethods;return t.createElement(m,null,t.createElement(d,null,t.createElement(E,{onClick:F},t.createElement(l,null)),t.createElement(y,null,I("screens.creditHistory")),t.createElement(E,{onClick:w},t.createElement(r,null))),t.createElement(p,null,k&&t.createElement(f,{$borderRadius:x.loyaltyWidget.settings.cartBorderRadius},t.createElement(h,null,I("header.earnedPoints")),t.createElement(g,null,t.createElement(i,{end:k.totalPoint}))),t.createElement(A,null,P.map(function(e,n){var r,l=(r=e.type,_.includes(r)?"positive":j.includes(r)?"negative":"neutral"),i=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:I("history.orderRefund"),icon:c(x.loyaltyWidget.settings.widgetIconType),methodType:a.ORDER_CREATE}:n&&e.type===o.EARN?{label:s(n.methodType),icon:u(n.methodType,x.loyaltyWidget.settings.widgetIconType),methodType:n.methodType}:null}(e);return t.createElement(t.Fragment,{key:e.id},t.createElement(T,null,t.createElement(N,null,t.createElement(R,null,function(){switch(e.type){case o.EARN:return I("history.earnedTitle");case o.SPEND:return I("history.spentTitle");case o.REFUND:return I("history.refundTitle");case o.REFILL:return I("history.refillTitle");case o.MANUAL_EARN:return I("history.manualEarnTitle");case o.MANUAL_DEDUCT:return I("history.manualDeductTitle");default:return I("history.unknownTitle")}}()),i&&t.createElement(t.Fragment,null,t.createElement(D,null,i.icon&&t.createElement(U,null,i.icon),i.label)),t.createElement(v,null,function(e){if(!e)return"";try{return new Intl.DateTimeFormat(b.language,{day:"numeric",month:"long",year:"numeric"}).format(new Date(e))}catch(t){return e}}(e.createdAt))),t.createElement(L,{$sign:l},"negative"===l?"-":"",e.amount)),n<P.length-1&&t.createElement(M,null))}))))});export{x as default};
|
|
@@ -19,5 +19,3 @@ export declare const HistoryItemAmount: import("styled-components").StyledCompon
|
|
|
19
19
|
$sign: "positive" | "negative" | "neutral";
|
|
20
20
|
}, never>;
|
|
21
21
|
export declare const Divider: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
-
export declare const LoadMoreIndicator: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
23
|
-
export declare const Loader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from'./../../../ext/tslib/tslib.es6.mjs.js';import e
|
|
1
|
+
import{__makeTemplateObject as n}from'./../../../ext/tslib/tslib.es6.mjs.js';import e from"styled-components";import{textMDMedium as i,textSMMedium as o,textXLSemiBold as t,textXSMedium as p,textLGMedium as r}from"../../components/style/typography.js";var d,l,a,x,c,f,s,g,b,u,m,y,h,v,w,j,k,z=e.div(d||(d=n(["\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: #ffffff;\n"],["\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: #ffffff;\n"]))),$=e.div(l||(l=n(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px;\n border-bottom: 1px solid #eef2f6;\n position: sticky;\n top: 0;\n background-color: #ffffff;\n z-index: 10;\n"],["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px;\n border-bottom: 1px solid #eef2f6;\n position: sticky;\n top: 0;\n background-color: #ffffff;\n z-index: 10;\n"]))),R=e.div(a||(a=n(["\n ","\n color: #121926;\n text-align: center;\n flex: 1;\n"],["\n ","\n color: #121926;\n text-align: center;\n flex: 1;\n"])),i),_=e.button(x||(x=n(["\n background: none;\n border: none;\n cursor: pointer;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #697586;\n\n &:hover {\n opacity: 0.8;\n }\n"],["\n background: none;\n border: none;\n cursor: pointer;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #697586;\n\n &:hover {\n opacity: 0.8;\n }\n"]))),q=e.div(c||(c=n(["\n padding-top: 20px;\n padding-bottom: 20px;\n flex: 1;\n overflow-y: auto;\n"],["\n padding-top: 20px;\n padding-bottom: 20px;\n flex: 1;\n overflow-y: auto;\n"]))),A=e.div(f||(f=n(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px;\n border-radius: ",";\n border: 1px solid #eef2f6;\n background: #fff;\n box-shadow:\n 0 7px 2px 0 rgba(0, 0, 0, 0),\n 0 5px 2px 0 rgba(0, 0, 0, 0.01),\n 0 3px 2px 0 rgba(0, 0, 0, 0.02),\n 0 1px 1px 0 rgba(0, 0, 0, 0.03),\n 0 0 1px 0 rgba(0, 0, 0, 0.04);\n margin: 0 16px 24px 16px;\n"],["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px;\n border-radius: ",";\n border: 1px solid #eef2f6;\n background: #fff;\n box-shadow:\n 0 7px 2px 0 rgba(0, 0, 0, 0),\n 0 5px 2px 0 rgba(0, 0, 0, 0.01),\n 0 3px 2px 0 rgba(0, 0, 0, 0.02),\n 0 1px 1px 0 rgba(0, 0, 0, 0.03),\n 0 0 1px 0 rgba(0, 0, 0, 0.04);\n margin: 0 16px 24px 16px;\n"])),function(n){var e=n.$borderRadius;return"".concat(e,"px")}),B=e.div(s||(s=n(["\n ","\n color: #121926;\n"],["\n ","\n color: #121926;\n"])),o),C=e.div(g||(g=n(["\n ","\n color: #121926;\n"],["\n ","\n color: #121926;\n"])),t),D=e.div(b||(b=n(["\n display: flex;\n flex-direction: column;\n padding: 0 16px;\n margin-top: 4px;\n"],["\n display: flex;\n flex-direction: column;\n padding: 0 16px;\n margin-top: 4px;\n"]))),E=e.div(u||(u=n(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 12px 0 6px;\n gap: 16px;\n"],["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 12px 0 6px;\n gap: 16px;\n"]))),F=e.div(m||(m=n(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n"],["\n display: flex;\n flex-direction: column;\n gap: 4px;\n"]))),G=e.div(y||(y=n(["\n ","\n color: #121926;\n"],["\n ","\n color: #121926;\n"])),o),H=e.span(h||(h=n(["\n ",";\n display: inline-flex;\n align-items: center;\n gap: 4px;\n color: #697586;\n"],["\n ",";\n display: inline-flex;\n align-items: center;\n gap: 4px;\n color: #697586;\n"])),p),I=e.span(v||(v=n(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n\n svg {\n width: 12px;\n height: 12px;\n }\n"],["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 12px;\n height: 12px;\n\n svg {\n width: 12px;\n height: 12px;\n }\n"]))),J=e.div(w||(w=n(["\n ","\n color: #697586;\n"],["\n ","\n color: #697586;\n"])),p),K=e.div(j||(j=n(["\n ","\n color: ",";\n"],["\n ","\n color: ",";\n"])),r,function(n){return"negative"===n.$sign?"#697586":"#121926"}),L=e.div(k||(k=n(["\n height: 1px;\n background-color: #eef2f6;\n margin: 16px 0;\n width: 100%;\n"],["\n height: 1px;\n background-color: #eef2f6;\n margin: 16px 0;\n width: 100%;\n"])));export{z as Container,q as Content,L as Divider,I as EarningMethodIcon,H as EarningMethodInfo,$ as Header,E as HistoryItem,K as HistoryItemAmount,J as HistoryItemDate,F as HistoryItemLeft,G as HistoryItemTitle,D as HistoryList,_ as IconButton,A as PointsSection,B as PointsTitle,C as PointsValue,R as Title};
|