@ikas/loyalty-widget-renderer 1.0.0-alpha.40 → 1.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/build/models/image/index.d.ts +1 -0
  2. package/build/models/image/index.js +1 -1
  3. package/build/models/index.d.ts +2 -0
  4. package/build/models/index.js +1 -1
  5. package/build/models/loyalty-program-spending-method/index.d.ts +1 -0
  6. package/build/models/loyalty-program-spending-method/index.js +1 -1
  7. package/build/models/types/index.d.ts +1 -0
  8. package/build/renderer/components/button/index.js +1 -1
  9. package/build/renderer/components/button/style.js +1 -1
  10. package/build/renderer/components/count-up/index.d.ts +7 -0
  11. package/build/renderer/components/count-up/index.js +1 -0
  12. package/build/renderer/components/loyalty-method-card/index.d.ts +2 -1
  13. package/build/renderer/components/loyalty-method-card/index.js +1 -1
  14. package/build/renderer/components/mini-mode-button/index.js +1 -1
  15. package/build/renderer/index.js +1 -1
  16. package/build/renderer/screens/credit-earning-methods-screen/index.js +1 -1
  17. package/build/renderer/screens/credit-history-screen/index.js +1 -1
  18. package/build/renderer/screens/credit-spending-methods-screen/index.js +1 -1
  19. package/build/renderer/screens/loyalty-level-screen/index.js +1 -1
  20. package/build/renderer/screens/main-screen/earning-methods-section/index.d.ts +1 -0
  21. package/build/renderer/screens/main-screen/earning-methods-section/index.js +1 -1
  22. package/build/renderer/screens/main-screen/header/auth-user-section/index.js +1 -1
  23. package/build/renderer/screens/main-screen/header/index.js +1 -1
  24. package/build/renderer/screens/main-screen/header/logo-section/index.js +1 -1
  25. package/build/renderer/screens/main-screen/header/title-section/index.js +1 -1
  26. package/build/renderer/screens/main-screen/header/user-logged-section/index.js +1 -1
  27. package/build/renderer/screens/main-screen/index.js +1 -1
  28. package/build/renderer/screens/main-screen/program-info-section/index.js +1 -1
  29. package/build/renderer/screens/main-screen/spending-methods-section/dynamic-slider.js +1 -1
  30. package/build/renderer/screens/main-screen/spending-methods-section/index.d.ts +1 -0
  31. package/build/renderer/screens/main-screen/spending-methods-section/index.js +1 -1
  32. package/build/renderer/screens/main-screen/style.js +1 -1
  33. package/build/renderer/style.js +1 -1
  34. package/build/renderer/utils/locales/en.json.js +1 -1
  35. package/build/renderer/utils/locales/tr.json.js +1 -1
  36. package/build/renderer/utils/loyalty-details.js +1 -1
  37. package/build/storefront-widget-script-injector.iife.js +6 -6
  38. package/build/storefront-widget-script-injector.iife.js.map +1 -1
  39. package/build/utils.d.ts +4 -3
  40. package/build/utils.js +1 -1
  41. package/package.json +12 -2
package/build/utils.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { EarningMethodTypeEnum, LoyaltyProgramMethodSpendingTypeEnum, LoyaltyWidgetScreenTypeEnum } from "models/types";
3
- import { WidgetIconTypeEnum } from "models/loyalty-widget/types";
2
+ import { LoyaltyWidgetViewModel } from "models";
4
3
  import { LoyaltyProgramEarningMethod } from "models/loyalty-program-earning-method";
5
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";
6
7
  export declare const getScreenIcon: (screenType: LoyaltyWidgetScreenTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
7
8
  export declare const getEarningMethodIcon: (earningMethod: EarningMethodTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
8
9
  export declare const getEarningMethodTitle: (earningMethod: LoyaltyProgramEarningMethod) => string;
9
10
  export declare const getSpendingMethodIcon: (spendingMethod: LoyaltyProgramMethodSpendingTypeEnum, widgetIconType: WidgetIconTypeEnum) => React.JSX.Element | null;
10
11
  export declare const getSpendingMethodTitle: (method: LoyaltyProgramSpendingMethod) => string;
11
- export declare const getSpendingMethodDescription: (method: LoyaltyProgramSpendingMethod, currency: string) => string | React.JSX.Element;
12
+ export declare const getSpendingMethodDescription: (method: LoyaltyProgramSpendingMethod, viewModel: LoyaltyWidgetViewModel) => string | React.JSX.Element;
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 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 O}from"./assets/widget-icons/illustraions/tshirtIllustration.js";import{Medal as S}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as g}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as f}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(O,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(S,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 t&&t!==M.NONE&&Y[t]?Y[t][e]:null},V=function(e,t){return t&&t!==M.NONE&&F[t]?F[t][e]:null},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(g,null),r[i.FREE_SHIPPING]=t.createElement(f,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};
1
+ import{__makeTemplateObject as e}from'./ext/tslib/tslib.es6.mjs.js';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 s from'./ext/i18next/dist/esm/i18next.js';import r from"styled-components";import{BubbleChatDone as i}from"./assets/widget-icons/normal/bubbleChatDone.js";import{CommentAdd01 as l}from"./assets/widget-icons/normal/commentAdd01.js";import{CouponPercent as o}from"./assets/widget-icons/normal/couponPercent.js";import{DiscountTag02 as E}from"./assets/widget-icons/normal/discountTag02.js";import{Gift as a}from"./assets/widget-icons/normal/gift.js";import{MoneyAdd01 as m}from"./assets/widget-icons/normal/moneyAdd01.js";import{PackageDelivered as c}from"./assets/widget-icons/normal/packageDelivered.js";import{SaveMoneyDollar as d}from"./assets/widget-icons/normal/saveMoneyDollar.js";import{ShoppingBasketAdd02 as u}from"./assets/widget-icons/normal/shoppingBasketAdd02.js";import{UserAdd01 as R}from"./assets/widget-icons/normal/userAdd01.js";import{UsersIllustration as p}from"./assets/widget-icons/illustraions/usersIllustration.js";import{BubbleChatIllustration as T}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 f}from"./assets/widget-icons/illustraions/medal.js";import{GiftIllustration as O}from"./assets/widget-icons/illustraions/giftIllustration.js";import{ShippingBox as S}from"./assets/widget-icons/illustraions/shippingBox.js";import{BigSaleMedal as g}from"./assets/widget-icons/illustraions/bigSaleMedal.js";import{ShoppingCartIllustration as N}from"./assets/widget-icons/illustraions/shoppingCartIllustration.js";import{BankCoin as C}from"./assets/widget-icons/illustraions/bankCoin.js";import{WidgetIconTypeEnum as M}from"./models/loyalty-widget/types/index.js";import{EarningMethodTypeEnum as A,LoyaltyWidgetScreenTypeEnum as U,LoyaltyProgramPointEarningTypeEnum as D,LoyaltyProgramMethodSpendingTypeEnum as j}from"./models/types/index.js";import{textSM as P}from"./renderer/components/style/typography.js";var y,x,h,v,w,L,b,G,B,F=((y={})[M.ILLUSTRATION]=((x={})[A.CUSTOMER_REGISTER]=t.createElement(p,null),x[A.ENABLE_SUBSCRIPTION]=t.createElement(_,null),x[A.BUY_PRODUCT]=t.createElement(I,null),x[A.CUSTOMER_REVIEW]=t.createElement(T,null),x[A.CUSTOMER_SEGMENT]=t.createElement(o,null),x[A.ORDER_CREATE]=t.createElement(N,null),x),y[M.NORMAL]=((h={})[A.CUSTOMER_REGISTER]=t.createElement(R,null),h[A.ENABLE_SUBSCRIPTION]=t.createElement(i,null),h[A.BUY_PRODUCT]=t.createElement(d,null),h[A.CUSTOMER_REVIEW]=t.createElement(l,null),h[A.CUSTOMER_SEGMENT]=t.createElement(o,null),h[A.ORDER_CREATE]=t.createElement(u,null),h),y),Y=((v={})[M.ILLUSTRATION]=((w={})[U.MAIN_SCREEN]=t.createElement("div",null),w[U.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(f,null),w[U.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(g,null),w[U.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),w[U.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),w),v[M.NORMAL]=((L={})[U.MAIN_SCREEN]=t.createElement("div",null),L[U.CREDIT_EARNING_METHODS_SCREEN]=t.createElement(m,null),L[U.CREDIT_SPENDING_METHODS_SCREEN]=t.createElement(o,null),L[U.CREDIT_HISTORY_SCREEN]=t.createElement("div",null),L[U.LOYALTY_LEVEL_SCREEN]=t.createElement("div",null),L),v),H=function(e,t){return t&&t!==M.NONE&&Y[t]?Y[t][e]:null},V=function(e,t){return t&&t!==M.NONE&&F[t]?F[t][e]:null},k=function(e){var t=n().t;switch(e.methodType){case A.CUSTOMER_REGISTER:return t("earningMethods.CUSTOMER_REGISTER.title");case A.ENABLE_SUBSCRIPTION:return t("earningMethods.ENABLE_SUBSCRIPTION.title");case A.CUSTOMER_REVIEW:return t("earningMethods.CUSTOMER_REVIEW.title");case A.ORDER_CREATE:if(e.pointEarningType===D.DYNAMIC_ORDER_AMOUNT)return t("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.title");if(e.pointEarningType===D.STATIC)return t("earningMethods.ORDER_CREATE.BASE.title");case A.BUY_PRODUCT:return t("earningMethods.BUY_PRODUCT.title");case A.CUSTOMER_SEGMENT:return t("earningMethods.CUSTOMER_SEGMENT.title");default:return""}},X=function(e,n){var s,r,i;return n===M.NONE?null:((s={})[M.ILLUSTRATION]=((r={})[j.FIXED_AMOUNT]=t.createElement(C,null),r[j.RATIO]=t.createElement(C,null),r[j.FREE_PRODUCT]=t.createElement(O,null),r[j.FREE_SHIPPING]=t.createElement(S,null),r),s[M.NORMAL]=((i={})[j.FIXED_AMOUNT]=t.createElement(E,null),i[j.RATIO]=t.createElement(E,null),i[j.FREE_PRODUCT]=t.createElement(a,null),i[j.FREE_SHIPPING]=t.createElement(c,null),i),s)[n][e]},W=function(e){var t,r=n().t,i=s.language,l=null===(t=e.translations)||void 0===t?void 0:t.find(function(e){return e.locale===i});if(null==l?void 0:l.description)return l.description;if(e.description)return e.description;switch(e.type){case j.FIXED_AMOUNT:return r("spendingMethods.FIXED_AMOUNT.title");case j.RATIO:return r("spendingMethods.RATIO.title");case j.FREE_SHIPPING:return r("spendingMethods.FREE_SHIPPING.title");case j.FREE_PRODUCT:return r("spendingMethods.FREE_PRODUCT.title");default:return""}},q=r.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"])),P),z=r.span(G||(G=e(["\n ","\n color: #364152;\n"],["\n ","\n color: #364152;\n"])),P),J=r.span(B||(B=e(["\n color: #697586;\n"],["\n color: #697586;\n"]))),K=function(e,s){var r,i,l=n().t,o=(null===(r=e.discountSettings)||void 0===r?void 0:r.point)||0,E=null===(i=e.discountSettings)||void 0===i?void 0:i.discountAmount,a=function(e,n){return void 0===n&&(n=!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,n&&"number"==typeof e?s.formatCurrency(e):e))};return e.type===j.FIXED_AMOUNT&&E?a(E,!0):e.type===j.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.40",
3
+ "version": "1.0.0-alpha.42",
4
4
  "description": "",
5
5
  "author": "ucy",
6
6
  "license": "ISC",
@@ -25,22 +25,32 @@
25
25
  "build": "rm -rf build && rollup -c",
26
26
  "watch": "rollup -c -w",
27
27
  "dev": "parcel app/index.html --port 3000",
28
- "serve": "npm run build && npx serve build -p 3000 --cors"
28
+ "serve": "npm run build && npx serve build -p 3000 --cors",
29
+ "lint:fix": "eslint './src/**/*.{ts,tsx}' --fix"
29
30
  },
30
31
  "devDependencies": {
32
+ "@eslint/eslintrc": "^3.3.3",
33
+ "@eslint/js": "^9.39.1",
31
34
  "@rollup/plugin-commonjs": "^22.0.0",
32
35
  "@rollup/plugin-json": "^4.1.0",
33
36
  "@rollup/plugin-node-resolve": "^13.3.0",
37
+ "@trivago/prettier-plugin-sort-imports": "^6.0.0",
34
38
  "@types/lodash": "^4.14.191",
35
39
  "@types/node": "^12.0.0",
36
40
  "@types/react": "^17 || ^18",
37
41
  "@types/react-dom": "^17 || ^18",
38
42
  "@types/styled-components": "5.1.26",
39
43
  "@types/uuid": "^9.0.0",
44
+ "@typescript-eslint/eslint-plugin": "^8.48.1",
45
+ "@typescript-eslint/parser": "^8.48.1",
40
46
  "cloudflare": "^5.2.0",
47
+ "eslint": "^9.39.1",
48
+ "eslint-plugin-react": "^7.37.5",
49
+ "eslint-plugin-unused-imports": "^4.3.0",
41
50
  "mobx": "^6.7.0",
42
51
  "mobx-react": "^7.6.0",
43
52
  "parcel": "^2.12.0",
53
+ "prettier": "^3.7.4",
44
54
  "react": "^17 || ^18",
45
55
  "react-dom": "^17 || ^18",
46
56
  "rollup": "^2.75.6",