@ikas/loyalty-widget-renderer 1.0.0-alpha.78 → 1.0.0-alpha.79
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/renderer/components/mini-mode-description/index.d.ts +1 -0
- package/build/renderer/components/mini-mode-description/index.js +1 -1
- package/build/renderer/index.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/build/utils.d.ts +6 -6
- package/build/utils.js +1 -1
- package/package.json +1 -1
package/build/utils.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { LoyaltyWidgetViewModel } from "models";
|
|
3
|
+
import { LoyaltyProgramEarningMethod } from "models/loyalty-program-earning-method";
|
|
4
|
+
import { LoyaltyProgramSpendingMethod } from "models/loyalty-program-spending-method";
|
|
5
|
+
import { WidgetIconTypeEnum } from "models/loyalty-widget/types";
|
|
6
|
+
import { EarningMethodTypeEnum, LoyaltyProgramMethodSpendingTypeEnum, LoyaltyWidgetScreenTypeEnum } from "models/types";
|
|
2
7
|
interface WidgetStorageData {
|
|
3
8
|
closedDescriptionSessionId?: string;
|
|
4
9
|
}
|
|
5
10
|
/**
|
|
6
|
-
* Get ikas_session_id from
|
|
11
|
+
* Get ikas_session_id from localStorage
|
|
7
12
|
*/
|
|
8
13
|
export declare const getIkasSessionId: () => string | null;
|
|
9
14
|
/**
|
|
@@ -22,11 +27,6 @@ export declare const isDescriptionClosedForCurrentSession: () => boolean;
|
|
|
22
27
|
* Mark description as closed for current session
|
|
23
28
|
*/
|
|
24
29
|
export declare const markDescriptionClosedForSession: () => void;
|
|
25
|
-
import { LoyaltyWidgetViewModel } from "models";
|
|
26
|
-
import { LoyaltyProgramEarningMethod } from "models/loyalty-program-earning-method";
|
|
27
|
-
import { LoyaltyProgramSpendingMethod } from "models/loyalty-program-spending-method";
|
|
28
|
-
import { WidgetIconTypeEnum } from "models/loyalty-widget/types";
|
|
29
|
-
import { EarningMethodTypeEnum, LoyaltyProgramMethodSpendingTypeEnum, LoyaltyWidgetScreenTypeEnum } from "models/types";
|
|
30
30
|
export declare const getScreenIcon: (screenType: LoyaltyWidgetScreenTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
|
|
31
31
|
export declare const getEarningMethodIcon: (earningMethod: EarningMethodTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
|
|
32
32
|
export declare const getEarningMethodTitle: (earningMethod: LoyaltyProgramEarningMethod) => string;
|
package/build/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__makeTemplateObject as e,__assign as t}from'./ext/tslib/tslib.es6.mjs.js';import n from"react";import'./ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./ext/react-i18next/dist/es/useTranslation.js';import i from'./ext/i18next/dist/esm/i18next.js';import s from"styled-components";import{ArrowRight as l}from"./assets/icons/arrow-right.js";import{BubbleChatDone as o}from"./assets/widget-icons/normal/bubbleChatDone.js";import{CommentAdd01 as a}from"./assets/widget-icons/normal/commentAdd01.js";import{CouponPercent as E}from"./assets/widget-icons/normal/couponPercent.js";import{DiscountTag02 as m}from"./assets/widget-icons/normal/discountTag02.js";import{Gift as c}from"./assets/widget-icons/normal/gift.js";import{MoneyAdd01 as d}from"./assets/widget-icons/normal/moneyAdd01.js";import{PackageDelivered as u}from"./assets/widget-icons/normal/packageDelivered.js";import{SaveMoneyDollar as p}from"./assets/widget-icons/normal/saveMoneyDollar.js";import{ShoppingBasketAdd02 as R}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";import{UserAdd01 as T}from"./assets/widget-icons/normal/userAdd01.js";import{UsersIllustration as f}from"./assets/widget-icons/illustraions/usersIllustration.js";import{BubbleChatIllustration as g}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";import{ApprovedChatIllustration as _}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";import{TshirtIllustration as I}from"./assets/widget-icons/illustraions/tshirtIllustration.js";import{Medal as S}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as O}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as N}from"./assets/widget-icons/illustraions/shippingBox.js";import{BigSaleMedal as C}from"./assets/widget-icons/illustraions/bigSaleMedal.js";import{ShoppingCartIllustration as M}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";import{BankCoin as A}from"./assets/widget-icons/illustraions/bankCoin.js";import{WidgetIconTypeEnum as D}from"./models/loyalty-widget/types/index.js";import{EarningMethodTypeEnum as
|
|
1
|
+
import{__makeTemplateObject as e,__assign as t}from'./ext/tslib/tslib.es6.mjs.js';import n from"react";import'./ext/react-i18next/dist/es/context.js';import{useTranslation as r}from'./ext/react-i18next/dist/es/useTranslation.js';import i from'./ext/i18next/dist/esm/i18next.js';import s from"styled-components";import{ArrowRight as l}from"./assets/icons/arrow-right.js";import{BubbleChatDone as o}from"./assets/widget-icons/normal/bubbleChatDone.js";import{CommentAdd01 as a}from"./assets/widget-icons/normal/commentAdd01.js";import{CouponPercent as E}from"./assets/widget-icons/normal/couponPercent.js";import{DiscountTag02 as m}from"./assets/widget-icons/normal/discountTag02.js";import{Gift as c}from"./assets/widget-icons/normal/gift.js";import{MoneyAdd01 as d}from"./assets/widget-icons/normal/moneyAdd01.js";import{PackageDelivered as u}from"./assets/widget-icons/normal/packageDelivered.js";import{SaveMoneyDollar as p}from"./assets/widget-icons/normal/saveMoneyDollar.js";import{ShoppingBasketAdd02 as R}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";import{UserAdd01 as T}from"./assets/widget-icons/normal/userAdd01.js";import{UsersIllustration as f}from"./assets/widget-icons/illustraions/usersIllustration.js";import{BubbleChatIllustration as g}from"./assets/widget-icons/illustraions/bubbleChatIllustration.js";import{ApprovedChatIllustration as _}from"./assets/widget-icons/illustraions/approvedChatIllustration.js";import{TshirtIllustration as I}from"./assets/widget-icons/illustraions/tshirtIllustration.js";import{Medal as S}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as O}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as N}from"./assets/widget-icons/illustraions/shippingBox.js";import{BigSaleMedal as C}from"./assets/widget-icons/illustraions/bigSaleMedal.js";import{ShoppingCartIllustration as M}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";import{BankCoin as A}from"./assets/widget-icons/illustraions/bankCoin.js";import{WidgetIconTypeEnum as D}from"./models/loyalty-widget/types/index.js";import{EarningMethodTypeEnum as x,LoyaltyWidgetScreenTypeEnum as U,LoyaltyProgramPointEarningTypeEnum as y,LoyaltyProgramMethodSpendingTypeEnum as h}from"./models/types/index.js";import{FlexibleValueContainer as j}from"./renderer/components/flexible-value-container/index.js";import{textSM as v,textXSMedium as w,textXS as P}from"./renderer/components/style/typography.js";var L,b,F,G,B,Y,H,k,V,X="ikas-storefront-widget",W=function(){try{var e=localStorage.getItem("ikas_session_id");return e&&JSON.parse(e).id||null}catch(e){return null}},J=function(){try{var e=localStorage.getItem(X);return e?JSON.parse(e):{}}catch(e){return{}}},q=function(e){try{var n=J(),r=t(t({},n),e);localStorage.setItem(X,JSON.stringify(r))}catch(e){}},z=function(){var e=W();return!!e&&J().closedDescriptionSessionId===e},K=function(){var e=W();e&&q({closedDescriptionSessionId:e})},Q=((L={})[D.ILLUSTRATION]=((b={})[x.CUSTOMER_REGISTER]=n.createElement(f,null),b[x.ENABLE_SUBSCRIPTION]=n.createElement(_,null),b[x.BUY_PRODUCT]=n.createElement(I,null),b[x.CUSTOMER_REVIEW]=n.createElement(g,null),b[x.CUSTOMER_SEGMENT]=n.createElement(E,null),b[x.ORDER_CREATE]=n.createElement(M,null),b),L[D.NORMAL]=((F={})[x.CUSTOMER_REGISTER]=n.createElement(T,null),F[x.ENABLE_SUBSCRIPTION]=n.createElement(o,null),F[x.BUY_PRODUCT]=n.createElement(p,null),F[x.CUSTOMER_REVIEW]=n.createElement(a,null),F[x.CUSTOMER_SEGMENT]=n.createElement(E,null),F[x.ORDER_CREATE]=n.createElement(R,null),F),L),Z=((G={})[D.ILLUSTRATION]=((B={})[U.MAIN_SCREEN]=n.createElement("div",null),B[U.CREDIT_EARNING_METHODS_SCREEN]=n.createElement(S,null),B[U.CREDIT_SPENDING_METHODS_SCREEN]=n.createElement(C,null),B[U.CREDIT_HISTORY_SCREEN]=n.createElement("div",null),B[U.LOYALTY_LEVEL_SCREEN]=n.createElement("div",null),B),G[D.NORMAL]=((Y={})[U.MAIN_SCREEN]=n.createElement("div",null),Y[U.CREDIT_EARNING_METHODS_SCREEN]=n.createElement(d,null),Y[U.CREDIT_SPENDING_METHODS_SCREEN]=n.createElement(E,null),Y[U.CREDIT_HISTORY_SCREEN]=n.createElement("div",null),Y[U.LOYALTY_LEVEL_SCREEN]=n.createElement("div",null),Y),G),$=function(e,t){return t&&t!==D.NONE&&Z[t]?Z[t][e]:null},ee=function(e,t){return t&&t!==D.NONE&&Q[t]?Q[t][e]:null},te=function(e){var t=r().t;switch(e.methodType){case x.CUSTOMER_REGISTER:return t("earningMethods.CUSTOMER_REGISTER.title");case x.ENABLE_SUBSCRIPTION:return t("earningMethods.ENABLE_SUBSCRIPTION.title");case x.CUSTOMER_REVIEW:return t("earningMethods.CUSTOMER_REVIEW.title");case x.ORDER_CREATE:if(e.pointEarningType===y.DYNAMIC_ORDER_AMOUNT)return t("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.title");if(e.pointEarningType===y.STATIC)return t("earningMethods.ORDER_CREATE.BASE.title");case x.BUY_PRODUCT:return t("earningMethods.BUY_PRODUCT.title");case x.CUSTOMER_SEGMENT:return t("earningMethods.CUSTOMER_SEGMENT.title");default:return""}},ne=function(e,t){var r,i,s;return t===D.NONE?null:((r={})[D.ILLUSTRATION]=((i={})[h.FIXED_AMOUNT]=n.createElement(A,null),i[h.RATIO]=n.createElement(A,null),i[h.FREE_PRODUCT]=n.createElement(O,null),i[h.FREE_SHIPPING]=n.createElement(N,null),i),r[D.NORMAL]=((s={})[h.FIXED_AMOUNT]=n.createElement(m,null),s[h.RATIO]=n.createElement(m,null),s[h.FREE_PRODUCT]=n.createElement(c,null),s[h.FREE_SHIPPING]=n.createElement(u,null),s),r)[t][e]},re=function(e){var t,n=r().t,s=i.language,l=null===(t=e.translations)||void 0===t?void 0:t.find(function(e){return e.locale===s});if(null==l?void 0:l.description)return l.description;if(e.description)return e.description;switch(e.type){case h.FIXED_AMOUNT:return e.isDynamic?n("spendingMethods.FIXED_AMOUNT.dynamicTitle"):n("spendingMethods.FIXED_AMOUNT.title");case h.RATIO:return n("spendingMethods.RATIO.title");case h.FREE_SHIPPING:return n("spendingMethods.FREE_SHIPPING.title");case h.FREE_PRODUCT:return n("spendingMethods.FREE_PRODUCT.title");default:return""}},ie=s.span(H||(H=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 @media (max-width: 600px) {\n ","\n }\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\n @media (max-width: 600px) {\n ","\n }\n"])),v,w),se=s.span(k||(k=e(["\n ","\n color: #364152;\n\n @media (max-width: 600px) {\n ","\n }\n"],["\n ","\n color: #364152;\n\n @media (max-width: 600px) {\n ","\n }\n"])),v,P),le=s.span(V||(V=e(["\n color: #697586;\n display: flex;\n align-items: center;\n"],["\n color: #697586;\n display: flex;\n align-items: center;\n"]))),oe=function(e,t){var i,s,o=r().t,a=(null===(i=e.discountSettings)||void 0===i?void 0:i.point)||0,E=null===(s=e.discountSettings)||void 0===s?void 0:s.discountAmount,m=function(e,r){return void 0===r&&(r=!1),n.createElement(j,null,function(i){return i?n.createElement(n.Fragment,null,n.createElement(se,null,o("earningMethods.xPoints",{points:a})),n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},n.createElement(le,null,n.createElement(l,null)),n.createElement(ie,null,r&&"number"==typeof e?t.formatCurrency(e):e))):n.createElement(n.Fragment,null,n.createElement(se,null,o("earningMethods.xPoints",{points:a})),n.createElement(le,null,n.createElement(l,null)),n.createElement(ie,null,r&&"number"==typeof e?t.formatCurrency(e):e))})};return e.type===h.FIXED_AMOUNT&&E?m(E,!0):e.type===h.RATIO&&E?m("%".concat(E)):o("earningMethods.xPoints",{points:a})};export{ee as getEarningMethodIcon,te as getEarningMethodTitle,W as getIkasSessionId,$ as getScreenIcon,oe as getSpendingMethodDescription,ne as getSpendingMethodIcon,re as getSpendingMethodTitle,J as getWidgetStorage,z as isDescriptionClosedForCurrentSession,K as markDescriptionClosedForSession,q as setWidgetStorage};
|