@ikas/loyalty-widget-renderer 1.0.0-alpha.27 → 1.0.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ import { LoyaltyProgramFilterTypeEnum, PeriodTypeEnum } from "../types";
2
+ export declare class LoyaltyProgramPointLimit {
3
+ maxPointLimit: number | null;
4
+ minPointLimit: number | null;
5
+ constructor(data?: Partial<LoyaltyProgramPointLimit>);
6
+ }
7
+ export declare class LoyaltyProgramFilter {
8
+ type: LoyaltyProgramFilterTypeEnum;
9
+ idList: string[];
10
+ constructor(data?: Partial<LoyaltyProgramFilter>);
11
+ }
12
+ export declare class LoyaltyProgramMethodTranslation {
13
+ description: string;
14
+ locale: string;
15
+ constructor(data?: Partial<LoyaltyProgramMethodTranslation>);
16
+ }
17
+ export declare class LoyaltyProgramPeriod {
18
+ period: string | null;
19
+ periodType: PeriodTypeEnum | null;
20
+ constructor(data?: Partial<LoyaltyProgramPeriod>);
21
+ }
@@ -0,0 +1 @@
1
+ import{makeObservable as i,observable as t}from"mobx";import{LoyaltyProgramFilterTypeEnum as o}from"../types/index.js";var n=function(o){void 0===o&&(o={}),this.maxPointLimit=o.maxPointLimit||null,this.minPointLimit=o.minPointLimit||null,i(this,{maxPointLimit:t,minPointLimit:t})},e=function(n){void 0===n&&(n={}),this.type=n.type||o.CATEGORY,this.idList=n.idList||[],i(this,{type:t,idList:t})},s=function(o){void 0===o&&(o={}),this.description=o.description||"",this.locale=o.locale||"",i(this,{description:t,locale:t})},p=function(o){void 0===o&&(o={}),this.period=o.period||null,this.periodType=o.periodType||null,i(this,{period:t,periodType:t})};export{e as LoyaltyProgramFilter,s as LoyaltyProgramMethodTranslation,p as LoyaltyProgramPeriod,n as LoyaltyProgramPointLimit};
@@ -1,8 +1,8 @@
1
1
  import { LoyaltyWidget } from "./loyalty-widget";
2
- import { LoyaltyWidgetCallbacks, LoyaltyWidgetScreenTypeEnum, Category, Product, Brand, Tag, LoyaltyProgramTier } from "./types";
2
+ import { LoyaltyWidgetCallbacks, LoyaltyWidgetScreenTypeEnum, Category, Product, Brand, Tag } from "./types";
3
3
  import { LoyaltyProgramSpendingMethod } from "./loyalty-program-spending-method";
4
4
  import { LoyaltyProgramEarningMethod } from "./loyalty-program-earning-method";
5
- import { LoyaltyCustomerInfo } from "./loyalty-customer-info";
5
+ import { LoyaltyCustomerInfo, LoyaltyProgramTier } from "./loyalty-customer-info";
6
6
  import { LoyaltyProgramPointHistory } from "./loyalty-program-point-history";
7
7
  export declare class LoyaltyWidgetViewModel {
8
8
  selectedScreen: LoyaltyWidgetScreenTypeEnum;
@@ -1,4 +1,4 @@
1
- import { LoyaltyProgramPeriod } from "../types";
1
+ import { LoyaltyProgramPeriod } from "../common";
2
2
  export declare class LoyaltyProgramTierTranslation {
3
3
  locale: string;
4
4
  name: string;
@@ -7,16 +7,16 @@ export declare class LoyaltyProgramTierTranslation {
7
7
  export declare class LoyaltyProgramTier {
8
8
  id: string;
9
9
  name: string;
10
- pointsRequired: number;
11
- tierPointMultiplier: number;
10
+ pointsRequired: number | null;
11
+ tierPointMultiplier: number | null;
12
12
  loyaltyProgramId: string;
13
- customerSegmentId: string;
14
- createdAt: string;
15
- updatedAt: string;
13
+ customerSegmentId: string | null;
14
+ createdAt: any | null;
15
+ updatedAt: any | null;
16
16
  deleted: boolean;
17
17
  isActive: boolean;
18
18
  period: LoyaltyProgramPeriod | null;
19
- translations: LoyaltyProgramTierTranslation[];
19
+ translations: LoyaltyProgramTierTranslation[] | null;
20
20
  constructor(data?: Partial<LoyaltyProgramTier>);
21
21
  }
22
22
  export declare class LoyaltyCustomerInfo {
@@ -1 +1 @@
1
- import{makeObservable as t,observable as e}from"mobx";import{LoyaltyProgramPeriod as i}from"../types/index.js";var o=function(i){void 0===i&&(i={}),this.locale=i.locale||"",this.name=i.name||"",t(this,{locale:e,name:e})},r=function(r){void 0===r&&(r={}),this.id=r.id||"",this.name=r.name||"",this.pointsRequired=r.pointsRequired||0,this.tierPointMultiplier=r.tierPointMultiplier||0,this.loyaltyProgramId=r.loyaltyProgramId||"",this.customerSegmentId=r.customerSegmentId||"",this.createdAt=r.createdAt||"",this.updatedAt=r.updatedAt||"",this.deleted=r.deleted||!1,this.isActive=r.isActive||!1,this.period=r.period?new i(r.period):null,this.translations=r.translations?r.translations.map(function(t){return new o(t)}):[],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.customerTierId=i.customerTierId?new r(i.customerTierId):null,this.loyaltyProgramCustomerId=i.loyaltyProgramCustomerId||"",this.loyaltyProgramId=i.loyaltyProgramId||"",this.totalPoint=i.totalPoint||0,t(this,{customerTierId:e,loyaltyProgramCustomerId:e,loyaltyProgramId:e,totalPoint:e})};export{s as LoyaltyCustomerInfo,r as LoyaltyProgramTier,o as LoyaltyProgramTierTranslation};
1
+ import{makeObservable as t,observable as i}from"mobx";import{LoyaltyProgramPeriod as e}from"../common/index.js";var o=function(e){void 0===e&&(e={}),this.locale=e.locale||"",this.name=e.name||"",t(this,{locale:i,name:i})},r=function(r){void 0===r&&(r={}),this.id=r.id||"",this.name=r.name||"",this.pointsRequired=r.pointsRequired||null,this.tierPointMultiplier=r.tierPointMultiplier||null,this.loyaltyProgramId=r.loyaltyProgramId||"",this.customerSegmentId=r.customerSegmentId||null,this.createdAt=r.createdAt||null,this.updatedAt=r.updatedAt||null,this.deleted=r.deleted||!1,this.isActive=r.isActive||!1,this.period=r.period?new e(r.period):null,this.translations=r.translations?r.translations.map(function(t){return new o(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})},l=function(e){void 0===e&&(e={}),this.customerTierId=e.customerTierId?new r(e.customerTierId):null,this.loyaltyProgramCustomerId=e.loyaltyProgramCustomerId||"",this.loyaltyProgramId=e.loyaltyProgramId||"",this.totalPoint=e.totalPoint||0,t(this,{customerTierId:i,loyaltyProgramCustomerId:i,loyaltyProgramId:i,totalPoint:i})};export{l as LoyaltyCustomerInfo,r as LoyaltyProgramTier,o as LoyaltyProgramTierTranslation};
@@ -1,51 +1,37 @@
1
- import { EarningMethodTypeEnum, LoyaltyProgramPointEarningTypeEnum, LoyaltyProgramPeriod, LoyaltyProgramFilterTypeEnum } from "../types";
2
- export declare class LoyaltyProgramPointLimit {
3
- maxPointLimit: number;
4
- minPointLimit: number;
5
- constructor(data?: Partial<LoyaltyProgramPointLimit>);
6
- }
7
- export declare class LoyaltyProgramFilter {
8
- type: LoyaltyProgramFilterTypeEnum;
9
- idList: string[];
10
- constructor(data?: Partial<LoyaltyProgramFilter>);
11
- }
1
+ import { EarningMethodTypeEnum, LoyaltyProgramPointEarningTypeEnum } from "../types";
2
+ import { LoyaltyProgramPointLimit, LoyaltyProgramFilter, LoyaltyProgramMethodTranslation, LoyaltyProgramPeriod } from "../common";
12
3
  export declare class LoyaltyProgramEarningMethodOrderSettings {
13
- maxOrderAmount: number;
4
+ maxOrderAmount: number | null;
14
5
  minOrderAmount: number;
15
- productFilters: LoyaltyProgramFilter[];
6
+ productFilters: LoyaltyProgramFilter[] | null;
16
7
  constructor(data?: Partial<LoyaltyProgramEarningMethodOrderSettings>);
17
8
  }
18
9
  export declare class LoyaltyProgramEarningMethodProductSettings {
19
- maxProductQuantity: number;
20
- minProductQuantity: number;
21
- productFilters: LoyaltyProgramFilter[];
10
+ maxProductQuantity: number | null;
11
+ minProductQuantity: number | null;
12
+ productFilters: LoyaltyProgramFilter[] | null;
22
13
  constructor(data?: Partial<LoyaltyProgramEarningMethodProductSettings>);
23
14
  }
24
- export declare class LoyaltyProgramMethodTranslation {
25
- description: string;
26
- locale: string;
27
- constructor(data?: Partial<LoyaltyProgramMethodTranslation>);
28
- }
29
15
  export declare class LoyaltyProgramEarningMethod {
30
- amountPerPointsEarned: number;
31
- createdAt: string;
16
+ amountPerPointsEarned: number | null;
17
+ createdAt: any | null;
32
18
  deleted: boolean;
33
- description: string;
19
+ description: string | null;
34
20
  earnedPointLimit: LoyaltyProgramPointLimit | null;
35
21
  id: string;
36
22
  isActive: boolean;
37
- lastValidityDate: string;
23
+ lastValidityDate: any | null;
38
24
  loyaltyProgramId: string;
39
25
  methodType: EarningMethodTypeEnum;
40
26
  orderSettings: LoyaltyProgramEarningMethodOrderSettings | null;
41
27
  pointEarningType: LoyaltyProgramPointEarningTypeEnum;
42
28
  pointsEarned: number;
43
29
  productSettings: LoyaltyProgramEarningMethodProductSettings | null;
44
- quantityPerPointsEarned: number;
45
- segmentId: string;
46
- tierIds: string[];
47
- translations: LoyaltyProgramMethodTranslation[];
48
- updatedAt: string;
30
+ quantityPerPointsEarned: number | null;
31
+ segmentId: string | null;
32
+ tierIds: string[] | null;
33
+ translations: LoyaltyProgramMethodTranslation[] | null;
34
+ updatedAt: any | null;
49
35
  validityPeriod: LoyaltyProgramPeriod | null;
50
36
  constructor(data?: Partial<LoyaltyProgramEarningMethod>);
51
37
  }
@@ -1 +1 @@
1
- import{makeObservable as t,observable as i}from"mobx";import{EarningMethodTypeEnum as n,LoyaltyProgramPointEarningTypeEnum as e,LoyaltyProgramPeriod as r,LoyaltyProgramFilterTypeEnum as o}from"../types/index.js";var d=function(n){void 0===n&&(n={}),this.maxPointLimit=n.maxPointLimit||0,this.minPointLimit=n.minPointLimit||0,t(this,{maxPointLimit:i,minPointLimit:i})},s=function(n){void 0===n&&(n={}),this.type=n.type||o.CATEGORY,this.idList=n.idList||[],t(this,{type:i,idList:i})},a=function(n){void 0===n&&(n={}),this.maxOrderAmount=n.maxOrderAmount||0,this.minOrderAmount=n.minOrderAmount||0,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new s(t)}):[],t(this,{maxOrderAmount:i,minOrderAmount:i,productFilters:i})},u=function(n){void 0===n&&(n={}),this.maxProductQuantity=n.maxProductQuantity||0,this.minProductQuantity=n.minProductQuantity||0,this.productFilters=n.productFilters?n.productFilters.map(function(t){return new s(t)}):[],t(this,{maxProductQuantity:i,minProductQuantity:i,productFilters:i})},m=function(n){void 0===n&&(n={}),this.description=n.description||"",this.locale=n.locale||"",t(this,{description:i,locale:i})},l=function(o){void 0===o&&(o={}),this.amountPerPointsEarned=o.amountPerPointsEarned||0,this.createdAt=o.createdAt||"",this.deleted=o.deleted||!1,this.description=o.description||"",this.earnedPointLimit=o.earnedPointLimit?new d(o.earnedPointLimit):null,this.id=o.id||"",this.isActive=o.isActive||!1,this.lastValidityDate=o.lastValidityDate||"",this.loyaltyProgramId=o.loyaltyProgramId||"",this.methodType=o.methodType||n.ORDER_CREATE,this.orderSettings=o.orderSettings?new a(o.orderSettings):null,this.pointEarningType=o.pointEarningType||e.STATIC,this.pointsEarned=o.pointsEarned||0,this.productSettings=o.productSettings?new u(o.productSettings):null,this.quantityPerPointsEarned=o.quantityPerPointsEarned||0,this.segmentId=o.segmentId||"",this.tierIds=o.tierIds||[],this.translations=o.translations?o.translations.map(function(t){return new m(t)}):[],this.updatedAt=o.updatedAt||"",this.validityPeriod=o.validityPeriod?new r(o.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{l as LoyaltyProgramEarningMethod,a as LoyaltyProgramEarningMethodOrderSettings,u as LoyaltyProgramEarningMethodProductSettings,s as LoyaltyProgramFilter,m as LoyaltyProgramMethodTranslation,d as LoyaltyProgramPointLimit};
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,10 +1,10 @@
1
1
  import { LoyaltyProgramPointHistoryTypeEnum } from "../types";
2
2
  export declare class LoyaltyProgramPointHistory {
3
3
  amount: number;
4
- createdAt: string;
4
+ createdAt: any | null;
5
5
  customerId: string;
6
6
  deleted: boolean;
7
- expireDate: string | null;
7
+ expireDate: any | null;
8
8
  id: string;
9
9
  loyaltyProgramCustomerId: string;
10
10
  loyaltyProgramEarningMethodId: string | null;
@@ -12,6 +12,6 @@ export declare class LoyaltyProgramPointHistory {
12
12
  loyaltyProgramSpendingMethodId: string | null;
13
13
  orderId: string | null;
14
14
  type: LoyaltyProgramPointHistoryTypeEnum;
15
- updatedAt: string;
15
+ updatedAt: any | null;
16
16
  constructor(data?: Partial<LoyaltyProgramPointHistory>);
17
17
  }
@@ -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||"",this.customerId=d.customerId||"",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.updatedAt=d.updatedAt||"",t(this,{amount:e,createdAt:e,customerId:e,deleted:e,expireDate:e,id:e,loyaltyProgramCustomerId:e,loyaltyProgramEarningMethodId:e,loyaltyProgramId:e,loyaltyProgramSpendingMethodId:e,orderId:e,type: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){void 0===d&&(d={}),this.amount=d.amount||0,this.createdAt=d.createdAt||null,this.customerId=d.customerId||"",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.updatedAt=d.updatedAt||null,t(this,{amount:e,createdAt:e,customerId:e,deleted:e,expireDate:e,id:e,loyaltyProgramCustomerId:e,loyaltyProgramEarningMethodId:e,loyaltyProgramId:e,loyaltyProgramSpendingMethodId:e,orderId:e,type:e,updatedAt:e})};export{d as LoyaltyProgramPointHistory};
@@ -1,27 +1,13 @@
1
- import { LoyaltyProgramMethodSpendingTypeEnum, LoyaltyProgramFilterTypeEnum } from "../types";
2
- export declare class LoyaltyProgramPointLimit {
3
- maxPointLimit: number | null;
4
- minPointLimit: number | null;
5
- constructor(data?: Partial<LoyaltyProgramPointLimit>);
6
- }
7
- export declare class LoyaltyProgramFilter {
8
- idList: string[];
9
- type: LoyaltyProgramFilterTypeEnum;
10
- constructor(data?: Partial<LoyaltyProgramFilter>);
11
- }
1
+ import { LoyaltyProgramMethodSpendingTypeEnum } from "../types";
2
+ import { LoyaltyProgramPointLimit, LoyaltyProgramFilter, LoyaltyProgramMethodTranslation } from "../common";
12
3
  export declare class LoyaltyProgramDiscountSettings {
13
4
  discountAmount: number | null;
14
5
  freeProductId: string | null;
15
6
  point: number;
16
7
  constructor(data?: Partial<LoyaltyProgramDiscountSettings>);
17
8
  }
18
- export declare class LoyaltyProgramMethodTranslation {
19
- description: string | null;
20
- locale: string | null;
21
- constructor(data?: Partial<LoyaltyProgramMethodTranslation>);
22
- }
23
9
  export declare class LoyaltyProgramSpendingMethod {
24
- createdAt: string;
10
+ createdAt: any | null;
25
11
  deleted: boolean;
26
12
  description: string | null;
27
13
  discountSettings: LoyaltyProgramDiscountSettings | null;
@@ -30,9 +16,9 @@ export declare class LoyaltyProgramSpendingMethod {
30
16
  isDynamic: boolean;
31
17
  loyaltyProgramId: string;
32
18
  pointUsageLimit: LoyaltyProgramPointLimit | null;
33
- productFilters: LoyaltyProgramFilter[];
34
- translations: LoyaltyProgramMethodTranslation[];
19
+ productFilters: LoyaltyProgramFilter[] | null;
20
+ translations: LoyaltyProgramMethodTranslation[] | null;
35
21
  type: LoyaltyProgramMethodSpendingTypeEnum;
36
- updatedAt: string;
22
+ updatedAt: any | null;
37
23
  constructor(data?: Partial<LoyaltyProgramSpendingMethod>);
38
24
  }
@@ -1 +1 @@
1
- import{makeObservable as t,observable as i}from"mobx";import{LoyaltyProgramMethodSpendingTypeEnum as n,LoyaltyProgramFilterTypeEnum as s}from"../types/index.js";var o=function(n){void 0===n&&(n={}),this.maxPointLimit=n.maxPointLimit||null,this.minPointLimit=n.minPointLimit||null,t(this,{maxPointLimit:i,minPointLimit:i})},e=function(n){void 0===n&&(n={}),this.idList=n.idList||[],this.type=n.type||s.PRODUCT_AND_VARIANT,t(this,{idList:i,type:i})},d=function(n){void 0===n&&(n={}),this.discountAmount=n.discountAmount||null,this.freeProductId=n.freeProductId||null,this.point=n.point||0,t(this,{discountAmount:i,freeProductId:i,point:i})},r=function(n){void 0===n&&(n={}),this.description=n.description||null,this.locale=n.locale||null,t(this,{description:i,locale:i})},l=function(s){void 0===s&&(s={}),this.createdAt=s.createdAt||"",this.deleted=s.deleted||!1,this.description=s.description||null,this.discountSettings=s.discountSettings?new d(s.discountSettings):null,this.id=s.id||"",this.isActive=s.isActive||!1,this.isDynamic=s.isDynamic||!1,this.loyaltyProgramId=s.loyaltyProgramId||"",this.pointUsageLimit=s.pointUsageLimit?new o(s.pointUsageLimit):null,this.productFilters=s.productFilters?s.productFilters.map(function(t){return new e(t)}):[],this.translations=s.translations?s.translations.map(function(t){return new r(t)}):[],this.type=s.type||n.FIXED_AMOUNT,this.updatedAt=s.updatedAt||"",t(this,{createdAt:i,deleted:i,description:i,discountSettings:i,id:i,isActive:i,isDynamic:i,loyaltyProgramId:i,pointUsageLimit:i,productFilters:i,translations:i,type:i,updatedAt:i})};export{d as LoyaltyProgramDiscountSettings,e as LoyaltyProgramFilter,r as LoyaltyProgramMethodTranslation,o as LoyaltyProgramPointLimit,l as LoyaltyProgramSpendingMethod};
1
+ import{makeObservable as t,observable as i}from"mobx";import{LoyaltyProgramMethodSpendingTypeEnum as n}from"../types/index.js";import{LoyaltyProgramPointLimit as s,LoyaltyProgramFilter as e,LoyaltyProgramMethodTranslation as o}from"../common/index.js";var d=function(n){void 0===n&&(n={}),this.discountAmount=n.discountAmount||null,this.freeProductId=n.freeProductId||null,this.point=n.point||0,t(this,{discountAmount:i,freeProductId:i,point:i})},r=function(r){void 0===r&&(r={}),this.createdAt=r.createdAt||null,this.deleted=r.deleted||!1,this.description=r.description||null,this.discountSettings=r.discountSettings?new d(r.discountSettings):null,this.id=r.id||"",this.isActive=r.isActive||!1,this.isDynamic=r.isDynamic||!1,this.loyaltyProgramId=r.loyaltyProgramId||"",this.pointUsageLimit=r.pointUsageLimit?new s(r.pointUsageLimit):null,this.productFilters=r.productFilters?r.productFilters.map(function(t){return new e(t)}):null,this.translations=r.translations?r.translations.map(function(t){return new o(t)}):null,this.type=r.type||n.FIXED_AMOUNT,this.updatedAt=r.updatedAt||null,t(this,{createdAt:i,deleted:i,description:i,discountSettings:i,id:i,isActive:i,isDynamic:i,loyaltyProgramId:i,pointUsageLimit:i,productFilters:i,translations:i,type:i,updatedAt:i})};export{d as LoyaltyProgramDiscountSettings,r as LoyaltyProgramSpendingMethod};
@@ -1,6 +1,6 @@
1
1
  import { LoyaltyProgramSpendingMethod } from "../loyalty-program-spending-method";
2
2
  import type { LoyaltyProgramEarningMethod } from "../loyalty-program-earning-method";
3
- import type { LoyaltyCustomerInfo } from "../loyalty-customer-info";
3
+ import type { LoyaltyCustomerInfo, LoyaltyProgramTier } from "../loyalty-customer-info";
4
4
  import type { LoyaltyWidget } from "../loyalty-widget";
5
5
  import type { LoyaltyProgramPointHistory } from "../loyalty-program-point-history";
6
6
  export declare enum LoyaltyWidgetScreenTypeEnum {
@@ -41,11 +41,6 @@ export declare enum PeriodTypeEnum {
41
41
  WEEK = "WEEK",
42
42
  YEAR = "YEAR"
43
43
  }
44
- export declare class LoyaltyProgramPeriod {
45
- period: string;
46
- periodType: PeriodTypeEnum;
47
- constructor(data?: Partial<LoyaltyProgramPeriod>);
48
- }
49
44
  export type Category = {
50
45
  id: string;
51
46
  name: string;
@@ -80,45 +75,16 @@ export type StringFilterInput = {
80
75
  endsWith?: string;
81
76
  nendsWith?: string;
82
77
  };
83
- export type LoyaltyProgramTierTranslation = {
84
- locale: string;
85
- name: string;
86
- };
87
- export type LoyaltyProgramTier = {
88
- createdAt?: string;
89
- customerSegmentId?: string;
90
- deleted: boolean;
91
- id: string;
92
- isActive: boolean;
93
- loyaltyProgramId: string;
94
- name: string;
95
- period?: LoyaltyProgramPeriod;
96
- pointsRequired?: number;
97
- tierPointMultiplier?: number;
98
- translations?: LoyaltyProgramTierTranslation[];
99
- updatedAt?: string;
100
- };
101
78
  export type ListLoyaltyProgramTierInput = {
102
79
  id?: StringFilterInput;
103
- includeDeleted?: boolean;
104
80
  loyaltyProgramId?: StringFilterInput;
105
81
  };
106
82
  export declare enum LoyaltyProgramPointHistoryTypeEnum {
107
83
  EARN = "EARN",
108
84
  SPEND = "SPEND"
109
85
  }
110
- export type LoyaltyProgramPointHistoryTypeEnumFilterInput = {
111
- eq?: LoyaltyProgramPointHistoryTypeEnum;
112
- in?: LoyaltyProgramPointHistoryTypeEnum[];
113
- ne?: LoyaltyProgramPointHistoryTypeEnum;
114
- nin?: LoyaltyProgramPointHistoryTypeEnum[];
115
- };
116
86
  export type ListLoyaltyProgramPointHistoryInput = {
117
- customerId?: StringFilterInput;
118
- includeDeleted?: boolean;
119
87
  loyaltyProgramId?: StringFilterInput;
120
- sort?: string;
121
- type?: LoyaltyProgramPointHistoryTypeEnumFilterInput;
122
88
  };
123
89
  export type LoyaltyWidgetCallbacks = {
124
90
  listSpendingMethodsByCartId: (cartId?: string | null) => Promise<LoyaltyProgramSpendingMethod[]>;
@@ -1 +1 @@
1
- import{makeObservable as E,observable as R}from"mobx";var T,_,N,C,O,A;!function(E){E.MAIN_SCREEN="MAIN_SCREEN",E.CREDIT_SPENDING_METHODS_SCREEN="CREDIT_SPENDING_METHODS_SCREEN",E.CREDIT_EARNING_METHODS_SCREEN="CREDIT_EARNING_METHODS_SCREEN",E.CREDIT_HISTORY_SCREEN="CREDIT_HISTORY_SCREEN",E.LOYALTY_LEVEL_SCREEN="LOYALTY_LEVEL_SCREEN"}(T||(T={})),function(E){E.BUY_PRODUCT="BUY_PRODUCT",E.CUSTOMER_REGISTER="CUSTOMER_REGISTER",E.CUSTOMER_REVIEW="CUSTOMER_REVIEW",E.CUSTOMER_SEGMENT="CUSTOMER_SEGMENT",E.ENABLE_SUBSCRIPTION="ENABLE_SUBSCRIPTION",E.ORDER_CREATE="ORDER_CREATE"}(_||(_={})),function(E){E.DYNAMIC_ORDER_AMOUNT="DYNAMIC_ORDER_AMOUNT",E.DYNAMIC_ORDER_QUANTITY="DYNAMIC_ORDER_QUANTITY",E.STATIC="STATIC"}(N||(N={})),function(E){E.FIXED_AMOUNT="FIXED_AMOUNT",E.FREE_PRODUCT="FREE_PRODUCT",E.FREE_SHIPPING="FREE_SHIPPING",E.RATIO="RATIO"}(C||(C={})),function(E){E.CATEGORY="CATEGORY",E.DYNAMIC_CATEGORY="DYNAMIC_CATEGORY",E.PRODUCT_AND_VARIANT="PRODUCT_AND_VARIANT",E.PRODUCT_BRAND="PRODUCT_BRAND",E.PRODUCT_TAG="PRODUCT_TAG"}(O||(O={})),function(E){E.MONTH="MONTH",E.WEEK="WEEK",E.YEAR="YEAR"}(A||(A={}));var D,I=function(T){void 0===T&&(T={}),this.period=T.period||"",this.periodType=T.periodType||A.MONTH,E(this,{period:R,periodType:R})};!function(E){E.EARN="EARN",E.SPEND="SPEND"}(D||(D={}));export{_ as EarningMethodTypeEnum,O as LoyaltyProgramFilterTypeEnum,C as LoyaltyProgramMethodSpendingTypeEnum,I as LoyaltyProgramPeriod,N as LoyaltyProgramPointEarningTypeEnum,D as LoyaltyProgramPointHistoryTypeEnum,T as LoyaltyWidgetScreenTypeEnum,A as PeriodTypeEnum};
1
+ var E,R,T,_,N,C,A;!function(E){E.MAIN_SCREEN="MAIN_SCREEN",E.CREDIT_SPENDING_METHODS_SCREEN="CREDIT_SPENDING_METHODS_SCREEN",E.CREDIT_EARNING_METHODS_SCREEN="CREDIT_EARNING_METHODS_SCREEN",E.CREDIT_HISTORY_SCREEN="CREDIT_HISTORY_SCREEN",E.LOYALTY_LEVEL_SCREEN="LOYALTY_LEVEL_SCREEN"}(E||(E={})),function(E){E.BUY_PRODUCT="BUY_PRODUCT",E.CUSTOMER_REGISTER="CUSTOMER_REGISTER",E.CUSTOMER_REVIEW="CUSTOMER_REVIEW",E.CUSTOMER_SEGMENT="CUSTOMER_SEGMENT",E.ENABLE_SUBSCRIPTION="ENABLE_SUBSCRIPTION",E.ORDER_CREATE="ORDER_CREATE"}(R||(R={})),function(E){E.DYNAMIC_ORDER_AMOUNT="DYNAMIC_ORDER_AMOUNT",E.DYNAMIC_ORDER_QUANTITY="DYNAMIC_ORDER_QUANTITY",E.STATIC="STATIC"}(T||(T={})),function(E){E.FIXED_AMOUNT="FIXED_AMOUNT",E.FREE_PRODUCT="FREE_PRODUCT",E.FREE_SHIPPING="FREE_SHIPPING",E.RATIO="RATIO"}(_||(_={})),function(E){E.CATEGORY="CATEGORY",E.DYNAMIC_CATEGORY="DYNAMIC_CATEGORY",E.PRODUCT_AND_VARIANT="PRODUCT_AND_VARIANT",E.PRODUCT_BRAND="PRODUCT_BRAND",E.PRODUCT_TAG="PRODUCT_TAG"}(N||(N={})),function(E){E.MONTH="MONTH",E.WEEK="WEEK",E.YEAR="YEAR"}(C||(C={})),function(E){E.EARN="EARN",E.SPEND="SPEND"}(A||(A={}));export{R as EarningMethodTypeEnum,N as LoyaltyProgramFilterTypeEnum,_ as LoyaltyProgramMethodSpendingTypeEnum,T as LoyaltyProgramPointEarningTypeEnum,A as LoyaltyProgramPointHistoryTypeEnum,E as LoyaltyWidgetScreenTypeEnum,C as PeriodTypeEnum};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as n}from'./../ext/tslib/tslib.es6.mjs.js';import r,{useState as o,useRef as i,useEffect as s}from"react";import{observer as a}from"mobx-react";import'./../ext/react-i18next/dist/es/context.js';import{I18nextProvider as c}from'./../ext/react-i18next/dist/es/I18nextProvider.js';import l from"./utils/i18n.js";import{LoyaltyWidgetScreenTypeEnum as d,EarningMethodTypeEnum as u,LoyaltyProgramFilterTypeEnum as m,LoyaltyProgramMethodSpendingTypeEnum as f}from"../models/types/index.js";import{WidgetPositionEnum as p,LoyaltyWidgetLayoutTypeEnum as y}from"../models/loyalty-widget/types/index.js";import E from"./screens/main-screen/index.js";import g from"./screens/credit-spending-methods-screen/index.js";import h from"./screens/credit-earning-methods-screen/index.js";import v from"./screens/credit-history-screen/index.js";import C from"./screens/loyalty-level-screen/index.js";import{LoyaltyWidgetViewModel as R}from"../models/index.js";import{LoyaltyWidget as I}from"../models/loyalty-widget/index.js";import{LoyaltyProgramSpendingMethod as b}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyCustomerInfo as S}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as _}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as k}from"../models/loyalty-program-point-history/index.js";import{Container as w,Panel as A,ScreenWrapper as T}from"./style.js";var N=a(function(a){var N,M=a.config,P=o(function(){var e=M||window.ikasLoyaltyWidgetConfig;return new R({cartId:(null==e?void 0:e.cartId)||null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.locale)||"",null==e?void 0:e.callbacks)})[0],L=i(!0);s(function(){e(void 0,void 0,void 0,function(){var e,r,o,i,s,a,c,l,d,p,y,E,g,h;return t(this,function(t){switch(t.label){case 0:if(!P.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[P.callbacks.getLoyaltyWidget(),P.callbacks.listEarningMethods(),P.callbacks.listLoyaltyProgramTier({includeDeleted:!1})],P.cartId&&(e.push(P.callbacks.listSpendingMethodsByCartId(P.cartId)),e.push(P.callbacks.getLoyaltyCustomerInfo()),e.push(P.callbacks.listLoyaltyProgramPointHistory({}))),[4,Promise.all(e)];case 2:return r=t.sent(),o=r[0],i=r[1],s=r[2],a=[],c=null,l=[],P.cartId&&(a=r[3],c=r[4],l=r[5]),P.loyaltyWidget=o instanceof I?o:new I(o||{}),P.earningMethods=i.map(function(e){return new _(e)}),P.tiers=s||[],P.cartId&&(P.spendingMethods=a.map(function(e){return new b(e)}),P.user=c?new S(c):null,P.pointHistory=l?l.map(function(e){return new k(e)}):[]),d=new Set,p=new Set,y=new Set,E=new Set,P.earningMethods.forEach(function(e){var t,r;e.methodType===u.ORDER_CREATE&&n(n([],(null===(t=e.orderSettings)||void 0===t?void 0:t.productFilters)||[],!0),(null===(r=e.productSettings)||void 0===r?void 0:r.productFilters)||[],!0).forEach(function(e){e.type===m.PRODUCT_AND_VARIANT?e.idList.forEach(function(e){return d.add(e)}):e.type===m.CATEGORY?e.idList.forEach(function(e){return p.add(e)}):e.type===m.PRODUCT_BRAND?e.idList.forEach(function(e){return y.add(e)}):e.type===m.PRODUCT_TAG&&e.idList.forEach(function(e){return E.add(e)})})}),P.spendingMethods&&P.spendingMethods.forEach(function(e){var t,n;e.type===f.FREE_PRODUCT&&(null===(t=e.discountSettings)||void 0===t?void 0:t.freeProductId)&&d.add(e.discountSettings.freeProductId),null===(n=e.productFilters)||void 0===n||n.forEach(function(e){e.type===m.PRODUCT_AND_VARIANT?e.idList.forEach(function(e){return d.add(e)}):e.type===m.CATEGORY?e.idList.forEach(function(e){return p.add(e)}):e.type===m.PRODUCT_BRAND?e.idList.forEach(function(e){return y.add(e)}):e.type===m.PRODUCT_TAG&&e.idList.forEach(function(e){return E.add(e)})})}),g=[],d.size>0&&P.callbacks.getProducts&&g.push(P.callbacks.getProducts(Array.from(d)).then(function(e){return P.products=e})),p.size>0&&P.callbacks.getCategories&&g.push(P.callbacks.getCategories(Array.from(p)).then(function(e){return P.categories=e})),y.size>0&&P.callbacks.getBrands&&g.push(P.callbacks.getBrands(Array.from(y)).then(function(e){return P.brands=e})),E.size>0&&P.callbacks.getTags&&g.push(P.callbacks.getTags(Array.from(E)).then(function(e){return P.tags=e})),[4,Promise.all(g)];case 3:return t.sent(),[3,6];case 4:return h=t.sent(),console.error("Failed to initialize loyalty data",h),[3,6];case 5:return L.current=!1,[7];case 6:return[2]}})})},[]),s(function(){if(!L.current){e(void 0,void 0,void 0,function(){var e,n,r,o,i;return t(this,function(t){switch(t.label){case 0:if(!P.callbacks)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Promise.all([P.callbacks.listSpendingMethodsByCartId(P.cartId),P.callbacks.getLoyaltyCustomerInfo(),P.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],o=e[2],P.spendingMethods=n.map(function(e){return new b(e)}),P.user=r?new S(r):null,P.pointHistory=o?o.map(function(e){return new k(e)}):[],[3,4];case 3:return i=t.sent(),console.error("Failed to fetch cart dependent data",i),[3,4];case 4:return[2]}})})}},[P.cartId]);var x=function(e){P.selectedScreen=e},D=function(){var e;(null===(e=P.callbacks)||void 0===e?void 0:e.onWidgetClose)&&P.callbacks.onWidgetClose()},j=P.selectedScreen===d.MAIN_SCREEN,O=o(null),B=O[0],W=O[1];s(function(){P.selectedScreen!==d.MAIN_SCREEN&&W(P.selectedScreen)},[P.selectedScreen]);var H=j?B:P.selectedScreen,U=P.loyaltyWidget.settings.position||p.RIGHT,$=P.loyaltyWidget.settings.type||y.DRAWER;return r.createElement(c,{i18n:l},r.createElement(w,{$layoutType:$,$widgetPosition:U,$position:(null==M?void 0:M.position)||(null===(N=window.ikasLoyaltyWidgetConfig)||void 0===N?void 0:N.position)||"fixed"},r.createElement(A,{$layoutType:$},r.createElement(T,{$isActive:j,$isMain:!0},r.createElement(E,{viewModel:P,onClose:D,onNavigate:x})),r.createElement(T,{$isActive:!j,$isMain:!1},function(){switch(H){case d.CREDIT_SPENDING_METHODS_SCREEN:return r.createElement(g,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:D});case d.CREDIT_EARNING_METHODS_SCREEN:return r.createElement(h,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:D});case d.CREDIT_HISTORY_SCREEN:return r.createElement(v,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:D});case d.LOYALTY_LEVEL_SCREEN:return r.createElement(C,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:D});default:return null}}()))))});export{N as default};
1
+ import{__awaiter as e,__generator as t,__spreadArray as n}from'./../ext/tslib/tslib.es6.mjs.js';import r,{useState as o,useRef as i,useEffect as s}from"react";import{observer as a}from"mobx-react";import'./../ext/react-i18next/dist/es/context.js';import{I18nextProvider as c}from'./../ext/react-i18next/dist/es/I18nextProvider.js';import l from"./utils/i18n.js";import{LoyaltyWidgetScreenTypeEnum as d,EarningMethodTypeEnum as u,LoyaltyProgramFilterTypeEnum as m,LoyaltyProgramMethodSpendingTypeEnum as f}from"../models/types/index.js";import{WidgetPositionEnum as p,LoyaltyWidgetLayoutTypeEnum as y}from"../models/loyalty-widget/types/index.js";import E from"./screens/main-screen/index.js";import g from"./screens/credit-spending-methods-screen/index.js";import h from"./screens/credit-earning-methods-screen/index.js";import v from"./screens/credit-history-screen/index.js";import C from"./screens/loyalty-level-screen/index.js";import{LoyaltyWidgetViewModel as R}from"../models/index.js";import{LoyaltyWidget as I}from"../models/loyalty-widget/index.js";import{LoyaltyProgramSpendingMethod as b}from"../models/loyalty-program-spending-method/index.js";import{LoyaltyCustomerInfo as S}from"../models/loyalty-customer-info/index.js";import{LoyaltyProgramEarningMethod as _}from"../models/loyalty-program-earning-method/index.js";import{LoyaltyProgramPointHistory as k}from"../models/loyalty-program-point-history/index.js";import{Container as w,Panel as A,ScreenWrapper as T}from"./style.js";var N=a(function(a){var N,M=a.config,P=o(function(){var e=M||window.ikasLoyaltyWidgetConfig;return new R({cartId:(null==e?void 0:e.cartId)||null},(null==e?void 0:e.cdnURL)||"",(null==e?void 0:e.merchantId)||"",(null==e?void 0:e.currency)||"",(null==e?void 0:e.locale)||"",null==e?void 0:e.callbacks)})[0],L=i(!0);s(function(){e(void 0,void 0,void 0,function(){var e,r,o,i,s,a,c,l,d,p,y,E,g,h;return t(this,function(t){switch(t.label){case 0:if(!P.callbacks)return[3,6];t.label=1;case 1:return t.trys.push([1,4,5,6]),e=[P.callbacks.getLoyaltyWidget(),P.callbacks.listEarningMethods(),P.callbacks.listLoyaltyProgramTier({})],P.cartId&&(e.push(P.callbacks.listSpendingMethodsByCartId(P.cartId)),e.push(P.callbacks.getLoyaltyCustomerInfo()),e.push(P.callbacks.listLoyaltyProgramPointHistory({}))),[4,Promise.all(e)];case 2:return r=t.sent(),o=r[0],i=r[1],s=r[2],a=[],c=null,l=[],P.cartId&&(a=r[3],c=r[4],l=r[5]),P.loyaltyWidget=o instanceof I?o:new I(o||{}),P.earningMethods=i.map(function(e){return new _(e)}),P.tiers=s||[],P.cartId&&(P.spendingMethods=a.map(function(e){return new b(e)}),P.user=c?new S(c):null,P.pointHistory=l?l.map(function(e){return new k(e)}):[]),d=new Set,p=new Set,y=new Set,E=new Set,P.earningMethods.forEach(function(e){var t,r;e.methodType===u.ORDER_CREATE&&n(n([],(null===(t=e.orderSettings)||void 0===t?void 0:t.productFilters)||[],!0),(null===(r=e.productSettings)||void 0===r?void 0:r.productFilters)||[],!0).forEach(function(e){e.type===m.PRODUCT_AND_VARIANT?e.idList.forEach(function(e){return d.add(e)}):e.type===m.CATEGORY?e.idList.forEach(function(e){return p.add(e)}):e.type===m.PRODUCT_BRAND?e.idList.forEach(function(e){return y.add(e)}):e.type===m.PRODUCT_TAG&&e.idList.forEach(function(e){return E.add(e)})})}),P.spendingMethods&&P.spendingMethods.forEach(function(e){var t,n;e.type===f.FREE_PRODUCT&&(null===(t=e.discountSettings)||void 0===t?void 0:t.freeProductId)&&d.add(e.discountSettings.freeProductId),null===(n=e.productFilters)||void 0===n||n.forEach(function(e){e.type===m.PRODUCT_AND_VARIANT?e.idList.forEach(function(e){return d.add(e)}):e.type===m.CATEGORY?e.idList.forEach(function(e){return p.add(e)}):e.type===m.PRODUCT_BRAND?e.idList.forEach(function(e){return y.add(e)}):e.type===m.PRODUCT_TAG&&e.idList.forEach(function(e){return E.add(e)})})}),g=[],d.size>0&&P.callbacks.getProducts&&g.push(P.callbacks.getProducts(Array.from(d)).then(function(e){return P.products=e})),p.size>0&&P.callbacks.getCategories&&g.push(P.callbacks.getCategories(Array.from(p)).then(function(e){return P.categories=e})),y.size>0&&P.callbacks.getBrands&&g.push(P.callbacks.getBrands(Array.from(y)).then(function(e){return P.brands=e})),E.size>0&&P.callbacks.getTags&&g.push(P.callbacks.getTags(Array.from(E)).then(function(e){return P.tags=e})),[4,Promise.all(g)];case 3:return t.sent(),[3,6];case 4:return h=t.sent(),console.error("Failed to initialize loyalty data",h),[3,6];case 5:return L.current=!1,[7];case 6:return[2]}})})},[]),s(function(){if(!L.current){e(void 0,void 0,void 0,function(){var e,n,r,o,i;return t(this,function(t){switch(t.label){case 0:if(!P.callbacks)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Promise.all([P.callbacks.listSpendingMethodsByCartId(P.cartId),P.callbacks.getLoyaltyCustomerInfo(),P.callbacks.listLoyaltyProgramPointHistory({})])];case 2:return e=t.sent(),n=e[0],r=e[1],o=e[2],P.spendingMethods=n.map(function(e){return new b(e)}),P.user=r?new S(r):null,P.pointHistory=o?o.map(function(e){return new k(e)}):[],[3,4];case 3:return i=t.sent(),console.error("Failed to fetch cart dependent data",i),[3,4];case 4:return[2]}})})}},[P.cartId]);var x=function(e){P.selectedScreen=e},j=function(){var e;(null===(e=P.callbacks)||void 0===e?void 0:e.onWidgetClose)&&P.callbacks.onWidgetClose()},D=P.selectedScreen===d.MAIN_SCREEN,O=o(null),B=O[0],W=O[1];s(function(){P.selectedScreen!==d.MAIN_SCREEN&&W(P.selectedScreen)},[P.selectedScreen]);var H=D?B:P.selectedScreen,U=P.loyaltyWidget.settings.position||p.RIGHT,$=P.loyaltyWidget.settings.type||y.DRAWER;return r.createElement(c,{i18n:l},r.createElement(w,{$layoutType:$,$widgetPosition:U,$position:(null==M?void 0:M.position)||(null===(N=window.ikasLoyaltyWidgetConfig)||void 0===N?void 0:N.position)||"fixed"},r.createElement(A,{$layoutType:$},r.createElement(T,{$isActive:D,$isMain:!0},r.createElement(E,{viewModel:P,onClose:j,onNavigate:x})),r.createElement(T,{$isActive:!D,$isMain:!1},function(){switch(H){case d.CREDIT_SPENDING_METHODS_SCREEN:return r.createElement(g,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:j});case d.CREDIT_EARNING_METHODS_SCREEN:return r.createElement(h,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:j});case d.CREDIT_HISTORY_SCREEN:return r.createElement(v,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:j});case d.LOYALTY_LEVEL_SCREEN:return r.createElement(C,{viewModel:P,onBack:function(){return x(d.MAIN_SCREEN)},onClose:j});default:return null}}()))))});export{N as default};
@@ -1 +1 @@
1
- import{__assign as e}from'./../../../../ext/tslib/tslib.es6.mjs.js';import t from"react";import{observer as o}from"mobx-react";import'./../../../../ext/react-i18next/dist/es/context.js';import{useTranslation as i}from'./../../../../ext/react-i18next/dist/es/useTranslation.js';import{EarningMethodTypeEnum as n}from"../../../../models/types/index.js";import{getEarningMethodTitle as r,getEarningMethodIcon as d}from"../../../../utils.js";import s from"../../../components/loyalty-method-card/index.js";import{getEarningMethodDescriptionV2 as l}from"../../../utils/loyalty-details.js";var a=o(function(e){var o=e.method,a=e.viewModel,m=e.mode,c=e.actionText,p=e.onClick,u=i(),g=u.t,x=u.i18n,f=a.loyaltyWidget,y=x.language,v=o.translations.find(function(e){return e.locale===y}),T=(null==v?void 0:v.description)||o.description||r(o),h=d(o.methodType,f.settings.widgetIconType),E=o.orderSettings,j=(null==E?void 0:E.productFilters)||[],R=o.methodType===n.ORDER_CREATE&&E&&(E.minOrderAmount>0||E.maxOrderAmount>0||j.length>0),C=R?"accordion":m,M="",b="";if(R){M=g("earningMethods.xPoints",{points:o.pointsEarned});var w=l(g,o,a);w&&(b=t.createElement("div",{style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400}},w))}else M=l(g,o,a)||g("earningMethods.xPoints",{points:o.pointsEarned});var k=!!a.user&&o.methodType===n.CUSTOMER_REGISTER;return t.createElement(s,{title:T,description:M,icon:h,action:c&&p?{text:c,onClick:p}:void 0,isCompleted:k,mode:C,settings:{borderRadius:f.settings.cartBorderRadius,widgetIconType:f.settings.widgetIconType,button:f.button}},b)}),m=o(function(o){var i=o.viewModel,n=o.containerStyle,r=o.mode,d=void 0===r?"card":r,s=o.getActionProps,l=i.earningMethods;return t.createElement("div",{style:e({display:"flex",flexDirection:"column",gap:"12px",padding:"0 24px"},n)},l.map(function(e){var o=s?s(e):null;return t.createElement(a,{key:e.id,method:e,viewModel:i,mode:d,actionText:null==o?void 0:o.actionText,onClick:null==o?void 0:o.onClick})}))});export{m as default};
1
+ import{__assign as e}from'./../../../../ext/tslib/tslib.es6.mjs.js';import t from"react";import{observer as o}from"mobx-react";import'./../../../../ext/react-i18next/dist/es/context.js';import{useTranslation as i}from'./../../../../ext/react-i18next/dist/es/useTranslation.js';import{EarningMethodTypeEnum as n}from"../../../../models/types/index.js";import{getEarningMethodTitle as r,getEarningMethodIcon as d}from"../../../../utils.js";import l from"../../../components/loyalty-method-card/index.js";import{getEarningMethodDescriptionV2 as s}from"../../../utils/loyalty-details.js";var a=o(function(e){var o,a,m=e.method,c=e.viewModel,p=e.mode,u=e.actionText,g=e.onClick,v=i(),x=v.t,f=v.i18n,y=c.loyaltyWidget,T=f.language,h=null===(o=m.translations)||void 0===o?void 0:o.find(function(e){return e.locale===T}),E=(null==h?void 0:h.description)||m.description||r(m),j=d(m.methodType,y.settings.widgetIconType),R=m.orderSettings,C=(null==R?void 0:R.productFilters)||[],M=m.methodType===n.ORDER_CREATE&&R&&(R.minOrderAmount>0||(null!==(a=R.maxOrderAmount)&&void 0!==a?a:0)>0||C.length>0),b=M?"accordion":p,w="",k="";if(M){w=x("earningMethods.xPoints",{points:m.pointsEarned});var S=s(x,m,c);S&&(k=t.createElement("div",{style:{fontSize:"14px",color:"#475467",lineHeight:"20px",fontWeight:400}},S))}else w=s(x,m,c)||x("earningMethods.xPoints",{points:m.pointsEarned});var _=!!c.user&&m.methodType===n.CUSTOMER_REGISTER;return t.createElement(l,{title:E,description:w,icon:j,action:u&&g?{text:u,onClick:g}:void 0,isCompleted:_,mode:b,settings:{borderRadius:y.settings.cartBorderRadius,widgetIconType:y.settings.widgetIconType,button:y.button}},k)}),m=o(function(o){var i=o.viewModel,n=o.containerStyle,r=o.mode,d=void 0===r?"card":r,l=o.getActionProps,s=i.earningMethods;return t.createElement("div",{style:e({display:"flex",flexDirection:"column",gap:"12px",padding:"0 24px"},n)},s.map(function(e){var o=l?l(e):null;return t.createElement(a,{key:e.id,method:e,viewModel:i,mode:d,actionText:null==o?void 0:o.actionText,onClick:null==o?void 0:o.onClick})}))});export{m as default};
package/build/utils.js CHANGED
@@ -1 +1 @@
1
- import{__makeTemplateObject as e}from'./ext/tslib/tslib.es6.mjs.js';import t from"react";import{EarningMethodTypeEnum as n,LoyaltyWidgetScreenTypeEnum as s,LoyaltyProgramPointEarningTypeEnum as r,LoyaltyProgramMethodSpendingTypeEnum as i}from"./models/types/index.js";import{BubbleChatDone as l}from"./assets/widget-icons/normal/bubbleChatDone.js";import{CommentAdd01 as o}from"./assets/widget-icons/normal/commentAdd01.js";import{CouponPercent as E}from"./assets/widget-icons/normal/couponPercent.js";import{DiscountTag02 as a}from"./assets/widget-icons/normal/discountTag02.js";import{Gift as m}from"./assets/widget-icons/normal/gift.js";import{MoneyAdd01 as c}from"./assets/widget-icons/normal/moneyAdd01.js";import{PackageDelivered as d}from"./assets/widget-icons/normal/packageDelivered.js";import{SaveMoneyDollar as u}from"./assets/widget-icons/normal/saveMoneyDollar.js";import{ShoppingBasketAdd02 as R}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";import{UserAdd01 as p}from"./assets/widget-icons/normal/userAdd01.js";import{UsersIllustration as T}from"./assets/widget-icons/illustraions/usersIllustration.js";import{BubbleChatIllustration as _}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";import{ApprovedChatIllustration as I}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";import{TshirtIllustration as S}from"./assets/widget-icons/illustraions/tshirtIllustration.js";import{Medal as g}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as f}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as O}from"./assets/widget-icons/illustraions/shippingBox.js";import{BigSaleMedal as N}from"./assets/widget-icons/illustraions/bigSaleMedal.js";import{ShoppingCartIllustration as C}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";import{WidgetIconTypeEnum as M}from"./models/loyalty-widget/types/index.js";import A from'./ext/i18next/dist/esm/i18next.js';import{BankCoin as U}from"./assets/widget-icons/illustraions/bankCoin.js";import'./ext/react-i18next/dist/es/context.js';import{useTranslation as D}from'./ext/react-i18next/dist/es/useTranslation.js';import{textSM as j}from"./renderer/components/style/typography.js";import P from"styled-components";var x,h,y,w,v,L,b,G,B,F=((x={})[M.ILLUSTRATION]=((h={})[n.CUSTOMER_REGISTER]=t.createElement(T,null),h[n.ENABLE_SUBSCRIPTION]=t.createElement(I,null),h[n.BUY_PRODUCT]=t.createElement(S,null),h[n.CUSTOMER_REVIEW]=t.createElement(_,null),h[n.CUSTOMER_SEGMENT]=t.createElement(E,null),h[n.ORDER_CREATE]=t.createElement(C,null),h),x[M.NORMAL]=((y={})[n.CUSTOMER_REGISTER]=t.createElement(p,null),y[n.ENABLE_SUBSCRIPTION]=t.createElement(l,null),y[n.BUY_PRODUCT]=t.createElement(u,null),y[n.CUSTOMER_REVIEW]=t.createElement(o,null),y[n.CUSTOMER_SEGMENT]=t.createElement(E,null),y[n.ORDER_CREATE]=t.createElement(R,null),y),x),Y=((w={})[M.ILLUSTRATION]=((v={})[s.MAIN_SCREEN]=t.createElement("div",null),v[s.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(g,null),v[s.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(N,null),v[s.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),v[s.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),v),w[M.NORMAL]=((L={})[s.MAIN_SCREEN]=t.createElement("div",null),L[s.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(c,null),L[s.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(E,null),L[s.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),L[s.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),L),w),H=function(e,t){return Y[t][e]},V=function(e,t){return F[t][e]},k=function(e){var t=D().t;switch(e.methodType){case n.CUSTOMER_REGISTER:return t("earningMethods.CUSTOMER_REGISTER.title");case n.ENABLE_SUBSCRIPTION:return t("earningMethods.ENABLE_SUBSCRIPTION.title");case n.CUSTOMER_REVIEW:return t("earningMethods.CUSTOMER_REVIEW.title");case n.ORDER_CREATE:if(e.pointEarningType===r.DYNAMIC_ORDER_AMOUNT)return t("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.title");if(e.pointEarningType===r.STATIC)return t("earningMethods.ORDER_CREATE.BASE.title");case n.BUY_PRODUCT:return t("earningMethods.BUY_PRODUCT.title");case n.CUSTOMER_SEGMENT:return t("earningMethods.CUSTOMER_SEGMENT.title");default:return""}},X=function(e,n){var s,r,l;return n===M.NONE?null:((s={})[M.ILLUSTRATION]=((r={})[i.FIXED_AMOUNT]=t.createElement(U,null),r[i.RATIO]=t.createElement(U,null),r[i.FREE_PRODUCT]=t.createElement(f,null),r[i.FREE_SHIPPING]=t.createElement(O,null),r),s[M.NORMAL]=((l={})[i.FIXED_AMOUNT]=t.createElement(a,null),l[i.RATIO]=t.createElement(a,null),l[i.FREE_PRODUCT]=t.createElement(m,null),l[i.FREE_SHIPPING]=t.createElement(d,null),l),s)[n][e]},W=function(e){var t=D().t,n=A.language,s=e.translations.find(function(e){return e.locale===n});if(null==s?void 0:s.description)return s.description;if(e.description)return e.description;switch(e.type){case i.FIXED_AMOUNT:return t("spendingMethods.FIXED_AMOUNT.title");case i.RATIO:return t("spendingMethods.RATIO.title");case i.FREE_SHIPPING:return t("spendingMethods.FREE_SHIPPING.title");case i.FREE_PRODUCT:return t("spendingMethods.FREE_PRODUCT.title");default:return""}},q=P.span(b||(b=e(["\n display: flex;\n padding: 2px 8px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n border-radius: 6px;\n border: 0.6px solid #cdd5df;\n opacity: 0.8;\n background: #f8fafc;\n ","\n color: #121926;\n"],["\n display: flex;\n padding: 2px 8px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n border-radius: 6px;\n border: 0.6px solid #cdd5df;\n opacity: 0.8;\n background: #f8fafc;\n ","\n color: #121926;\n"])),j),z=P.span(G||(G=e(["\n ","\n color: #364152;\n"],["\n ","\n color: #364152;\n"])),j),J=P.span(B||(B=e(["\n color: #697586;\n"],["\n color: #697586;\n"]))),K=function(e,n){var s,r,l=D().t,o=(null===(s=e.discountSettings)||void 0===s?void 0:s.point)||0,E=null===(r=e.discountSettings)||void 0===r?void 0:r.discountAmount,a=function(e,s){return void 0===s&&(s=!1),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement(z,null,l("earningMethods.xPoints",{points:o})),t.createElement(J,null,"→"),t.createElement(q,null,e," ",s&&n))};return e.type===i.FIXED_AMOUNT&&E?a(E,!0):e.type===i.RATIO&&E?a("%".concat(E)):l("earningMethods.xPoints",{points:o})};export{V as getEarningMethodIcon,k as getEarningMethodTitle,H as getScreenIcon,K as getSpendingMethodDescription,X as getSpendingMethodIcon,W as getSpendingMethodTitle};
1
+ import{__makeTemplateObject as e}from'./ext/tslib/tslib.es6.mjs.js';import t from"react";import{EarningMethodTypeEnum as n,LoyaltyWidgetScreenTypeEnum as s,LoyaltyProgramPointEarningTypeEnum as r,LoyaltyProgramMethodSpendingTypeEnum as i}from"./models/types/index.js";import{BubbleChatDone as l}from"./assets/widget-icons/normal/bubbleChatDone.js";import{CommentAdd01 as o}from"./assets/widget-icons/normal/commentAdd01.js";import{CouponPercent as E}from"./assets/widget-icons/normal/couponPercent.js";import{DiscountTag02 as a}from"./assets/widget-icons/normal/discountTag02.js";import{Gift as m}from"./assets/widget-icons/normal/gift.js";import{MoneyAdd01 as d}from"./assets/widget-icons/normal/moneyAdd01.js";import{PackageDelivered as c}from"./assets/widget-icons/normal/packageDelivered.js";import{SaveMoneyDollar as u}from"./assets/widget-icons/normal/saveMoneyDollar.js";import{ShoppingBasketAdd02 as R}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";import{UserAdd01 as p}from"./assets/widget-icons/normal/userAdd01.js";import{UsersIllustration as T}from"./assets/widget-icons/illustraions/usersIllustration.js";import{BubbleChatIllustration as _}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";import{ApprovedChatIllustration as I}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";import{TshirtIllustration as S}from"./assets/widget-icons/illustraions/tshirtIllustration.js";import{Medal as g}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as f}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as O}from"./assets/widget-icons/illustraions/shippingBox.js";import{BigSaleMedal as N}from"./assets/widget-icons/illustraions/bigSaleMedal.js";import{ShoppingCartIllustration as C}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";import{WidgetIconTypeEnum as M}from"./models/loyalty-widget/types/index.js";import A from'./ext/i18next/dist/esm/i18next.js';import{BankCoin as U}from"./assets/widget-icons/illustraions/bankCoin.js";import'./ext/react-i18next/dist/es/context.js';import{useTranslation as D}from'./ext/react-i18next/dist/es/useTranslation.js';import{textSM as j}from"./renderer/components/style/typography.js";import P from"styled-components";var x,h,y,v,w,L,b,G,B,F=((x={})[M.ILLUSTRATION]=((h={})[n.CUSTOMER_REGISTER]=t.createElement(T,null),h[n.ENABLE_SUBSCRIPTION]=t.createElement(I,null),h[n.BUY_PRODUCT]=t.createElement(S,null),h[n.CUSTOMER_REVIEW]=t.createElement(_,null),h[n.CUSTOMER_SEGMENT]=t.createElement(E,null),h[n.ORDER_CREATE]=t.createElement(C,null),h),x[M.NORMAL]=((y={})[n.CUSTOMER_REGISTER]=t.createElement(p,null),y[n.ENABLE_SUBSCRIPTION]=t.createElement(l,null),y[n.BUY_PRODUCT]=t.createElement(u,null),y[n.CUSTOMER_REVIEW]=t.createElement(o,null),y[n.CUSTOMER_SEGMENT]=t.createElement(E,null),y[n.ORDER_CREATE]=t.createElement(R,null),y),x),Y=((v={})[M.ILLUSTRATION]=((w={})[s.MAIN_SCREEN]=t.createElement("div",null),w[s.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(g,null),w[s.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(N,null),w[s.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),w[s.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),w),v[M.NORMAL]=((L={})[s.MAIN_SCREEN]=t.createElement("div",null),L[s.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(d,null),L[s.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(E,null),L[s.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),L[s.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),L),v),H=function(e,t){return Y[t][e]},V=function(e,t){return F[t][e]},k=function(e){var t=D().t;switch(e.methodType){case n.CUSTOMER_REGISTER:return t("earningMethods.CUSTOMER_REGISTER.title");case n.ENABLE_SUBSCRIPTION:return t("earningMethods.ENABLE_SUBSCRIPTION.title");case n.CUSTOMER_REVIEW:return t("earningMethods.CUSTOMER_REVIEW.title");case n.ORDER_CREATE:if(e.pointEarningType===r.DYNAMIC_ORDER_AMOUNT)return t("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.title");if(e.pointEarningType===r.STATIC)return t("earningMethods.ORDER_CREATE.BASE.title");case n.BUY_PRODUCT:return t("earningMethods.BUY_PRODUCT.title");case n.CUSTOMER_SEGMENT:return t("earningMethods.CUSTOMER_SEGMENT.title");default:return""}},X=function(e,n){var s,r,l;return n===M.NONE?null:((s={})[M.ILLUSTRATION]=((r={})[i.FIXED_AMOUNT]=t.createElement(U,null),r[i.RATIO]=t.createElement(U,null),r[i.FREE_PRODUCT]=t.createElement(f,null),r[i.FREE_SHIPPING]=t.createElement(O,null),r),s[M.NORMAL]=((l={})[i.FIXED_AMOUNT]=t.createElement(a,null),l[i.RATIO]=t.createElement(a,null),l[i.FREE_PRODUCT]=t.createElement(m,null),l[i.FREE_SHIPPING]=t.createElement(c,null),l),s)[n][e]},W=function(e){var t,n=D().t,s=A.language,r=null===(t=e.translations)||void 0===t?void 0:t.find(function(e){return e.locale===s});if(null==r?void 0:r.description)return r.description;if(e.description)return e.description;switch(e.type){case i.FIXED_AMOUNT:return n("spendingMethods.FIXED_AMOUNT.title");case i.RATIO:return n("spendingMethods.RATIO.title");case i.FREE_SHIPPING:return n("spendingMethods.FREE_SHIPPING.title");case i.FREE_PRODUCT:return n("spendingMethods.FREE_PRODUCT.title");default:return""}},q=P.span(b||(b=e(["\n display: flex;\n padding: 2px 8px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n border-radius: 6px;\n border: 0.6px solid #cdd5df;\n opacity: 0.8;\n background: #f8fafc;\n ","\n color: #121926;\n"],["\n display: flex;\n padding: 2px 8px;\n justify-content: center;\n align-items: center;\n gap: 6px;\n border-radius: 6px;\n border: 0.6px solid #cdd5df;\n opacity: 0.8;\n background: #f8fafc;\n ","\n color: #121926;\n"])),j),z=P.span(G||(G=e(["\n ","\n color: #364152;\n"],["\n ","\n color: #364152;\n"])),j),J=P.span(B||(B=e(["\n color: #697586;\n"],["\n color: #697586;\n"]))),K=function(e,n){var s,r,l=D().t,o=(null===(s=e.discountSettings)||void 0===s?void 0:s.point)||0,E=null===(r=e.discountSettings)||void 0===r?void 0:r.discountAmount,a=function(e,s){return void 0===s&&(s=!1),t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},t.createElement(z,null,l("earningMethods.xPoints",{points:o})),t.createElement(J,null,"→"),t.createElement(q,null,e," ",s&&n))};return e.type===i.FIXED_AMOUNT&&E?a(E,!0):e.type===i.RATIO&&E?a("%".concat(E)):l("earningMethods.xPoints",{points:o})};export{V as getEarningMethodIcon,k as getEarningMethodTitle,H as getScreenIcon,K as getSpendingMethodDescription,X as getSpendingMethodIcon,W as getSpendingMethodTitle};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/loyalty-widget-renderer",
3
- "version": "1.0.0-alpha.27",
3
+ "version": "1.0.0-alpha.29",
4
4
  "description": "",
5
5
  "author": "ucy",
6
6
  "license": "ISC",
@@ -1,5 +0,0 @@
1
- export declare class Category {
2
- id: string;
3
- name: string;
4
- constructor(data?: Partial<Category>);
5
- }