@ikas/loyalty-widget-renderer 1.0.0-alpha.76 → 1.0.0-alpha.78
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/locales.d.ts +5 -0
- package/build/models/index.js +1 -1
- package/build/renderer/components/mini-mode-description/index.js +1 -1
- package/build/renderer/screens/main-screen/program-info-section/style.js +1 -1
- package/build/renderer/utils/locales/de.json.js +1 -1
- package/build/renderer/utils/locales/en.json.js +1 -1
- package/build/renderer/utils/locales/fr.json.js +1 -1
- package/build/renderer/utils/locales/nl.json.js +1 -1
- package/build/renderer/utils/locales/tr.json.js +1 -1
- package/build/storefront-widget-script-injector.iife.js +3 -3
- package/build/storefront-widget-script-injector.iife.js.map +1 -1
- package/build/utils.d.ts +24 -0
- package/build/utils.js +1 -1
- package/package.json +1 -1
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
interface WidgetStorageData {
|
|
3
|
+
closedDescriptionSessionId?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get ikas_session_id from cookies
|
|
7
|
+
*/
|
|
8
|
+
export declare const getIkasSessionId: () => string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Get widget storage data from localStorage
|
|
11
|
+
*/
|
|
12
|
+
export declare const getWidgetStorage: () => WidgetStorageData;
|
|
13
|
+
/**
|
|
14
|
+
* Set widget storage data to localStorage
|
|
15
|
+
*/
|
|
16
|
+
export declare const setWidgetStorage: (data: WidgetStorageData) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Check if description is closed for current session
|
|
19
|
+
*/
|
|
20
|
+
export declare const isDescriptionClosedForCurrentSession: () => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Mark description as closed for current session
|
|
23
|
+
*/
|
|
24
|
+
export declare const markDescriptionClosedForSession: () => void;
|
|
2
25
|
import { LoyaltyWidgetViewModel } from "models";
|
|
3
26
|
import { LoyaltyProgramEarningMethod } from "models/loyalty-program-earning-method";
|
|
4
27
|
import { LoyaltyProgramSpendingMethod } from "models/loyalty-program-spending-method";
|
|
@@ -10,3 +33,4 @@ export declare const getEarningMethodTitle: (earningMethod: LoyaltyProgramEarnin
|
|
|
10
33
|
export declare const getSpendingMethodIcon: (spendingMethod: LoyaltyProgramMethodSpendingTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
|
|
11
34
|
export declare const getSpendingMethodTitle: (method: LoyaltyProgramSpendingMethod) => string;
|
|
12
35
|
export declare const getSpendingMethodDescription: (method: LoyaltyProgramSpendingMethod, viewModel: LoyaltyWidgetViewModel) => string | React.JSX.Element;
|
|
36
|
+
export {};
|
package/build/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__makeTemplateObject as e}from'./ext/tslib/tslib.es6.mjs.js';import n from"react";import'./ext/react-i18next/dist/es/context.js';import{useTranslation 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 U,LoyaltyWidgetScreenTypeEnum as x,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{for(var e=document.cookie.split(";"),t=0,n=e;t<n.length;t++){var r=n[t].trim().split("="),i=r[0],s=r[1];if("ikas_session_id"===i){var l=decodeURIComponent(s);return JSON.parse(l).id||null}}return 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={})[U.CUSTOMER_REGISTER]=n.createElement(f,null),b[U.ENABLE_SUBSCRIPTION]=n.createElement(_,null),b[U.BUY_PRODUCT]=n.createElement(I,null),b[U.CUSTOMER_REVIEW]=n.createElement(g,null),b[U.CUSTOMER_SEGMENT]=n.createElement(E,null),b[U.ORDER_CREATE]=n.createElement(M,null),b),L[D.NORMAL]=((F={})[U.CUSTOMER_REGISTER]=n.createElement(T,null),F[U.ENABLE_SUBSCRIPTION]=n.createElement(o,null),F[U.BUY_PRODUCT]=n.createElement(p,null),F[U.CUSTOMER_REVIEW]=n.createElement(a,null),F[U.CUSTOMER_SEGMENT]=n.createElement(E,null),F[U.ORDER_CREATE]=n.createElement(R,null),F),L),Z=((G={})[D.ILLUSTRATION]=((B={})[x.MAIN_SCREEN]=n.createElement("div",null),B[x.CREDIT_EARNING_METHODS_SCREEN]=n.createElement(S,null),B[x.CREDIT_SPENDING_METHODS_SCREEN]=n.createElement(C,null),B[x.CREDIT_HISTORY_SCREEN]=n.createElement("div",null),B[x.LOYALTY_LEVEL_SCREEN]=n.createElement("div",null),B),G[D.NORMAL]=((Y={})[x.MAIN_SCREEN]=n.createElement("div",null),Y[x.CREDIT_EARNING_METHODS_SCREEN]=n.createElement(d,null),Y[x.CREDIT_SPENDING_METHODS_SCREEN]=n.createElement(E,null),Y[x.CREDIT_HISTORY_SCREEN]=n.createElement("div",null),Y[x.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 U.CUSTOMER_REGISTER:return t("earningMethods.CUSTOMER_REGISTER.title");case U.ENABLE_SUBSCRIPTION:return t("earningMethods.ENABLE_SUBSCRIPTION.title");case U.CUSTOMER_REVIEW:return t("earningMethods.CUSTOMER_REVIEW.title");case U.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 U.BUY_PRODUCT:return t("earningMethods.BUY_PRODUCT.title");case U.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};
|