@ikas/loyalty-widget-renderer 1.0.0-alpha.83 → 1.0.0-alpha.85
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 +20 -0
- package/build/models/index.js +1 -1
- package/build/models/mini-mode/index.d.ts +1 -0
- package/build/models/mini-mode/index.js +1 -1
- package/build/models/types/index.d.ts +1 -0
- package/build/renderer/components/product-filter-card/index.d.ts +13 -0
- package/build/renderer/components/product-filter-card/index.js +1 -0
- package/build/renderer/components/product-filter-card/style.d.ts +10 -0
- package/build/renderer/components/product-filter-card/style.js +1 -0
- package/build/renderer/index.js +1 -1
- package/build/renderer/screens/gift-product-selection-screen/index.js +1 -1
- package/build/renderer/screens/gift-product-selection-screen/style.d.ts +3 -1
- package/build/renderer/screens/gift-product-selection-screen/style.js +1 -1
- package/build/renderer/screens/loyalty-level-screen/index.js +1 -1
- package/build/renderer/screens/main-screen/earning-methods-section/index.js +1 -1
- package/build/renderer/screens/main-screen/program-info-section/index.js +1 -1
- package/build/renderer/screens/main-screen/spending-methods-section/index.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/renderer/utils/loyalty-details.d.ts +8 -0
- package/build/renderer/utils/loyalty-details.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 +9 -0
- package/build/utils.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TFunction } from "i18next";
|
|
2
2
|
import { LoyaltyWidgetViewModel } from "models";
|
|
3
|
+
import { LoyaltyProgramFilter } from "models/common";
|
|
3
4
|
import { LoyaltyProgramEarningMethod } from "models/loyalty-program-earning-method";
|
|
4
5
|
import { LoyaltyProgramFilterTypeEnum } from "models/types";
|
|
5
6
|
export type FilterDetail = {
|
|
@@ -9,4 +10,11 @@ export type FilterDetail = {
|
|
|
9
10
|
};
|
|
10
11
|
export declare const getFilterDetails: (viewModel: LoyaltyWidgetViewModel, filterType: LoyaltyProgramFilterTypeEnum, idList: string[]) => FilterDetail[];
|
|
11
12
|
export declare const getFreeProductName: (viewModel: LoyaltyWidgetViewModel, productId: string) => string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* PRODUCT_AND_VARIANT filtrelerindeki ürünlerin viewModel.products'ta bulunup bulunamadığını kontrol eder.
|
|
15
|
+
* Eğer PRODUCT_AND_VARIANT filtresi yoksa true döner (ürün bilgisine bağımlı değil).
|
|
16
|
+
* Eğer varsa, en az bir ürünün çözülebilir olmasını gerektirir.
|
|
17
|
+
*/
|
|
18
|
+
export declare const hasResolvableProductFilters: (viewModel: LoyaltyWidgetViewModel, filters: LoyaltyProgramFilter[]) => boolean;
|
|
19
|
+
export declare const getEarningMethodConditionList: (t: TFunction, earningMethod: LoyaltyProgramEarningMethod, viewModel: LoyaltyWidgetViewModel) => string[];
|
|
12
20
|
export declare const getEarningMethodDescriptionV2: (t: TFunction, earningMethod: LoyaltyProgramEarningMethod, viewModel: LoyaltyWidgetViewModel) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as
|
|
1
|
+
import{__spreadArray as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{LoyaltyProgramFilterTypeEnum as t,EarningMethodTypeEnum as r,LoyaltyProgramPointEarningTypeEnum as e}from"../../models/types/index.js";var i=function(n,r,e){var i;if(!e||0===e.length)return[];if(r===t.PRODUCT_AND_VARIANT){var o=e.find(function(n){return n.startsWith("p:")}),a=e.find(function(n){return n.startsWith("v:")});if(!o)return[];var u=o.slice(2),c=a?a.slice(2):null,d=null===(i=n.products)||void 0===i?void 0:i.find(function(n){return n.id===u});if(!d)return[];var s=d.name;if(c&&d.variants){var E=d.variants.find(function(n){return n.id===c});(null==E?void 0:E.variantText)&&(s="".concat(d.name," (").concat(E.variantText,")"))}return[{type:r,name:s,id:u}]}var R=[];return e.forEach(function(e){var i="";switch(r){case t.CATEGORY:case t.DYNAMIC_CATEGORY:if(n.categories){var o=n.categories.find(function(n){return n.id===e});o&&(i=o.name)}break;case t.PRODUCT_BRAND:if(n.brands){var a=n.brands.find(function(n){return n.id===e});a&&(i=a.name)}break;case t.PRODUCT_TAG:if(n.tags){var u=n.tags.find(function(n){return n.id===e});u&&(i=u.name)}}i&&R.push({type:r,name:i,id:e})}),R},o=function(n,t){if(n.products){var r=n.products.find(function(n){return n.id===t});return r?r.name:void 0}},a=function(n,r){var e=r.filter(function(n){return n.type===t.PRODUCT_AND_VARIANT});return 0===e.length||e.some(function(t){var r,e,i=null===(r=t.idList)||void 0===r?void 0:r.find(function(n){return n.startsWith("p:")});if(!i)return!1;var o=i.slice(2);return null===(e=n.products)||void 0===e?void 0:e.some(function(n){return n.id===o})})},u=function(o,a,u){var c,d,s,E=function(n){return n.filter(function(n){return n.type!==t.PRODUCT_AND_VARIANT}).map(function(n){switch(n.type){case t.CATEGORY:case t.DYNAMIC_CATEGORY:return o("earningMethods.ORDER_CREATE.BASE.descriptionOnlyCategory",{category:n.name});case t.PRODUCT_BRAND:return o("earningMethods.ORDER_CREATE.BASE.descriptionOnlyBrand",{brand:n.name});case t.PRODUCT_TAG:return o("earningMethods.ORDER_CREATE.BASE.descriptionOnlyTag",{tag:n.name});default:return n.name}}).filter(Boolean)};switch(a.methodType){case r.BUY_PRODUCT:return E(n([],(null===(c=a.productSettings)||void 0===c?void 0:c.productFilters)||[],!0).reduce(function(n,t){return n.concat(i(u,t.type,t.idList))},[]));case r.ORDER_CREATE:var R=n(n([],(null===(d=a.productSettings)||void 0===d?void 0:d.productFilters)||[],!0),(null===(s=a.orderSettings)||void 0===s?void 0:s.productFilters)||[],!0).reduce(function(n,t){return n.concat(i(u,t.type,t.idList))},[]),f=[];f.push.apply(f,E(R));var p=a.orderSettings||{},m=p.minOrderAmount,A=p.maxOrderAmount;return"number"==typeof m&&m>0&&f.push(o("earningMethods.ORDER_CREATE.BASE.descriptionStaticMinimum",{amount:u.formatCurrency(m)})),"number"==typeof A&&A>0&&f.push(o("earningMethods.ORDER_CREATE.BASE.descriptionStaticMaximum",{amount:u.formatCurrency(A)})),a.pointEarningType===e.DYNAMIC_ORDER_AMOUNT&&f.push(o("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.description",{amount:u.formatCurrency(a.amountPerPointsEarned||0),points:a.pointsEarned})),f;default:return[]}},c=function(o,a,u){var c,d,s,E=function(n){return n.filter(function(n){return n.type!==t.PRODUCT_AND_VARIANT}).map(function(n){switch(n.type){case t.CATEGORY:case t.DYNAMIC_CATEGORY:return o("earningMethods.ORDER_CREATE.BASE.genericCategory",{category:n.name});case t.PRODUCT_BRAND:return o("earningMethods.ORDER_CREATE.BASE.genericBrand",{brand:n.name});case t.PRODUCT_TAG:return o("earningMethods.ORDER_CREATE.BASE.genericTag",{tag:n.name});default:return n.name}}).filter(Boolean).join(", ")};switch(a.methodType){case r.CUSTOMER_REGISTER:case r.CUSTOMER_REVIEW:case r.ENABLE_SUBSCRIPTION:return o("earningMethods.xPoints",{points:a.pointsEarned});case r.BUY_PRODUCT:var R=E(n([],(null===(c=a.productSettings)||void 0===c?void 0:c.productFilters)||[],!0).reduce(function(n,t){return n.concat(i(u,t.type,t.idList))},[]));return R||void 0;case r.ORDER_CREATE:var f=n(n([],(null===(d=a.productSettings)||void 0===d?void 0:d.productFilters)||[],!0),(null===(s=a.orderSettings)||void 0===s?void 0:s.productFilters)||[],!0),p=E(f.reduce(function(n,t){return n.concat(i(u,t.type,t.idList))},[])),m=a.orderSettings||{},A=m.minOrderAmount,l=m.maxOrderAmount,T="number"==typeof l&&l>0,C="";switch("number"==typeof A&&A>0?C=o("earningMethods.ORDER_CREATE.BASE.descriptionStaticMinimum",{amount:u.formatCurrency(A)}):T&&(C=o("earningMethods.ORDER_CREATE.BASE.descriptionStaticMaximum",{amount:u.formatCurrency(l)})),a.pointEarningType){case e.DYNAMIC_ORDER_AMOUNT:return(O=[p,C,o("earningMethods.ORDER_CREATE.RECEIVE_POINTS_ON_SPEND.description",{amount:u.formatCurrency(a.amountPerPointsEarned||0),points:a.pointsEarned})].filter(Boolean)).join(" ");case e.STATIC:var O;return 0===(O=[p,C].filter(Boolean)).length?void f.length:!C&&p?o("earningMethods.ORDER_CREATE.BASE.descriptionWithFilter",{filter:p}):O.join(", ")}break;default:return""}};export{u as getEarningMethodConditionList,c as getEarningMethodDescriptionV2,i as getFilterDetails,o as getFreeProductName,a as hasResolvableProductFilters};
|