@ikas/storefront-model-functions 6.1.0-beta.1 → 6.1.0-beta.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasProductFilterDisplayType as e,IkasProductFilterType as n,IkasProductFilterSortType as t}from"@ikas/storefront-models";import i from"lodash/sortBy";import r from"lodash/cloneDeep";function u(n){return[e.NUMBER_RANGE_LIST,e.NUMBER_RANGE].includes(n.displayType)}function o(e){return e.type===n.STOCK_STATUS}function l(e){var n;return e.numberRange?[E(e.numberRange)]:e.numberRangeListOptions?e.numberRangeListOptions.filter((function(e){return e.isSelected})).map((function(e){return E(e)})):(null===(n=e.values)||void 0===n?void 0:n.filter((function(e){return e.isSelected})).map((function(e){return e.id})))||[]}function s(e){var n;return e.numberRange?[E(e.numberRange)]:e.numberRangeListOptions?e.numberRangeListOptions.filter((function(e){return e.isSelected})).map((function(e){return E(e)})):(null===(n=e.values)||void 0===n?void 0:n.filter((function(e){return e.isSelected})).map((function(e){return e.key})))||[]}function c(e){var n,r,u,o=(null===(n=e.settings)||void 0===n?void 0:n.sortType)||t.ALPHABETICAL_ASC,l=[t.ALPHABETICAL_DESC,t.PRODUCT_COUNT_DESC].includes(o),s=[t.ALPHABETICAL_ASC,t.ALPHABETICAL_DESC].includes(o),c=o===t.CUSTOM_SORT,a=null===(r=e.values)||void 0===r?void 0:r.filter((function(e){return 0!==e.resultCount||e.isSelected}));if(a=i(a,s?"key":"resultCount"),l&&(a=null==a?void 0:a.reverse()),c){var d=(null===(u=e.settings)||void 0===u?void 0:u.customSortedValues)||[];a=a.sort((function(e,n){return d.indexOf(e.id)-d.indexOf(n.id)}))}return a}function a(e,n){var t;if(u(e))throw new Error("onFilterValueClick cannot be used with NUMBER_RANGE | NUMBER_RANGE_LIST types!");n.isSelected=!n.isSelected,!e.isMultiSelect&&n.isSelected&&(null===(t=e.values)||void 0===t||t.forEach((function(e){e.id!==n.id&&(e.isSelected=!1)})))}function d(n,t){var i;if(n.displayType!==e.NUMBER_RANGE_LIST)throw new Error("onNumberRangeClick can only be used with NUMBER_RANGE filters!");t.isSelected=!t.isSelected,!n.isMultiSelect&&t.isSelected&&(null===(i=n.numberRangeListOptions)||void 0===i||i.forEach((function(e){e.key!==t.key&&(e.isSelected=!1)})))}function f(n,t){var i;if(n.displayType!==e.NUMBER_RANGE)throw new Error("onNumberRangeChange can only be used with NUMBER_RANGE filters!");if(t){var u=r(t);u.from<n.numberRangeLimit.from&&(u.from=n.numberRange.from),u.to&&(null===(i=n.numberRangeLimit)||void 0===i?void 0:i.to)&&u.to>n.numberRangeLimit.to&&(u.to=n.numberRangeLimit.to),n.numberRange=u}else n.numberRange=null}function m(e){var n,t;e.numberRange=null,null===(n=e.numberRangeListOptions)||void 0===n||n.forEach((function(e){return e.isSelected=!1})),null===(t=e.values)||void 0===t||t.forEach((function(e){return e.isSelected=!1}))}function R(e){var n;return{id:e.key,type:e.type,valueList:l(e),useAndFilter:null===(n=e.settings)||void 0===n?void 0:n.useAndFilter}}function v(n,t){var i,r,u=t.split(",");n.displayType===e.NUMBER_RANGE?n.numberRange=p(t):n.displayType===e.NUMBER_RANGE_LIST?null===(i=n.numberRangeListOptions)||void 0===i||i.forEach((function(e){u.includes(e.key)&&(e.isSelected=!0)})):null===(r=n.values)||void 0===r||r.forEach((function(e){u.includes(e.
|
|
1
|
+
import{IkasProductFilterDisplayType as e,IkasProductFilterType as n,IkasProductFilterSortType as t}from"@ikas/storefront-models";import i from"lodash/sortBy";import r from"lodash/cloneDeep";function u(n){return[e.NUMBER_RANGE_LIST,e.NUMBER_RANGE].includes(n.displayType)}function o(e){return e.type===n.STOCK_STATUS}function l(e){var n;return e.numberRange?[E(e.numberRange)]:e.numberRangeListOptions?e.numberRangeListOptions.filter((function(e){return e.isSelected})).map((function(e){return E(e)})):(null===(n=e.values)||void 0===n?void 0:n.filter((function(e){return e.isSelected})).map((function(e){return e.id})))||[]}function s(e){var n;return e.numberRange?[E(e.numberRange)]:e.numberRangeListOptions?e.numberRangeListOptions.filter((function(e){return e.isSelected})).map((function(e){return E(e)})):(null===(n=e.values)||void 0===n?void 0:n.filter((function(e){return e.isSelected})).map((function(e){return e.key})))||[]}function c(e){var n,r,u,o=(null===(n=e.settings)||void 0===n?void 0:n.sortType)||t.ALPHABETICAL_ASC,l=[t.ALPHABETICAL_DESC,t.PRODUCT_COUNT_DESC].includes(o),s=[t.ALPHABETICAL_ASC,t.ALPHABETICAL_DESC].includes(o),c=o===t.CUSTOM_SORT,a=null===(r=e.values)||void 0===r?void 0:r.filter((function(e){return 0!==e.resultCount||e.isSelected}));if(a=i(a,s?"key":"resultCount"),l&&(a=null==a?void 0:a.reverse()),c){var d=(null===(u=e.settings)||void 0===u?void 0:u.customSortedValues)||[];a=a.sort((function(e,n){return d.indexOf(e.id)-d.indexOf(n.id)}))}return a}function a(e,n){var t;if(u(e))throw new Error("onFilterValueClick cannot be used with NUMBER_RANGE | NUMBER_RANGE_LIST types!");n.isSelected=!n.isSelected,!e.isMultiSelect&&n.isSelected&&(null===(t=e.values)||void 0===t||t.forEach((function(e){e.id!==n.id&&(e.isSelected=!1)})))}function d(n,t){var i;if(n.displayType!==e.NUMBER_RANGE_LIST)throw new Error("onNumberRangeClick can only be used with NUMBER_RANGE filters!");t.isSelected=!t.isSelected,!n.isMultiSelect&&t.isSelected&&(null===(i=n.numberRangeListOptions)||void 0===i||i.forEach((function(e){e.key!==t.key&&(e.isSelected=!1)})))}function f(n,t){var i;if(n.displayType!==e.NUMBER_RANGE)throw new Error("onNumberRangeChange can only be used with NUMBER_RANGE filters!");if(t){var u=r(t);u.from<n.numberRangeLimit.from&&(u.from=n.numberRange.from),u.to&&(null===(i=n.numberRangeLimit)||void 0===i?void 0:i.to)&&u.to>n.numberRangeLimit.to&&(u.to=n.numberRangeLimit.to),n.numberRange=u}else n.numberRange=null}function m(e){var n,t;e.numberRange=null,null===(n=e.numberRangeListOptions)||void 0===n||n.forEach((function(e){return e.isSelected=!1})),null===(t=e.values)||void 0===t||t.forEach((function(e){return e.isSelected=!1}))}function R(e){var n;return{id:e.key,type:e.type,valueList:l(e),useAndFilter:null===(n=e.settings)||void 0===n?void 0:n.useAndFilter}}function v(n,t){var i,r,u=t.split(",");n.displayType===e.NUMBER_RANGE?n.numberRange=p(t):n.displayType===e.NUMBER_RANGE_LIST?null===(i=n.numberRangeListOptions)||void 0===i||i.forEach((function(e){u.includes(e.key)&&(e.isSelected=!0)})):null===(r=n.values)||void 0===r||r.forEach((function(e){u.includes(e.name)&&0!==e.resultCount&&(e.isSelected=!0)}))}function E(e){return"".concat(e.from,":").concat(e.to||"")}function p(e){try{var n=e.split(":").map((function(e){return parseInt(e)}));return{from:isNaN(n[0])?0:n[0],to:isNaN(n[1])?void 0:n[1]}}catch(e){return console.log(e),{from:0,to:0}}}function S(e){return e.slug?"/".concat(e.slug):""}export{v as applyQueryParam,m as clear,c as getDisplayedValues,S as getIkasFilterHref,s as getKeyList,l as getValueList,u as isCustomValueFilter,o as isStockFilter,a as onFilterValueClick,f as onNumberRangeChange,d as onNumberRangeClick,p as parseRangeStr,E as rangeToId,R as toInput};
|
package/build/index.d.ts
CHANGED
|
@@ -50,3 +50,4 @@ import * as IkasVariantValueFunctions from "./functions/variant-type/variant-val
|
|
|
50
50
|
export { IkasVariantValueFunctions };
|
|
51
51
|
import * as IkasVariantTypeFunctions from "./functions/variant-type";
|
|
52
52
|
export { IkasVariantTypeFunctions };
|
|
53
|
+
export { stringToSlug } from "./utils/helper";
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"./functions/blog/category/index.js";export{t as IkasBlogCategoryFunctions};import*as o from"./functions/blog/index.js";export{o as IkasBlogFunctions};import*as s from"./functions/brand/index.js";export{s as IkasBrandFunctions};import*as
|
|
1
|
+
import*as t from"./functions/blog/category/index.js";export{t as IkasBlogCategoryFunctions};import*as o from"./functions/blog/index.js";export{o as IkasBlogFunctions};import*as s from"./functions/brand/index.js";export{s as IkasBrandFunctions};import*as r from"./functions/category/path-item/index.js";export{r as IkasCategoryPathItemFunctions};import*as n from"./functions/category/index.js";export{n as IkasCategoryFunctions};import*as i from"./functions/checkout/index.js";export{i as IkasCheckoutFunctions};import*as a from"./functions/customer/address/index.js";export{a as IkasCustomerAddressFunctions};import*as e from"./functions/customer/attribute/index.js";export{e as IkasCustomerAttributeFunctions};import*as u from"./functions/customer/index.js";export{u as IkasCustomerFunctions};import*as c from"./functions/filter-category/index.js";export{c as IkasFilterCategoryFunctions};import*as p from"./functions/image/index.js";export{p as IkasImageFunctions};import*as m from"./functions/order/address/index.js";export{m as IkasOrderAddressFunctions};import*as d from"./functions/order/line-item/variant/value/index.js";export{d as IkasOrderLineItemVariantValueFunctions};import*as f from"./functions/order/line-item/variant/index.js";export{f as IkasOrderLineItemVariantFunctions};import*as x from"./functions/order/line-item/index.js";export{x as IkasOrderLineItemFunctions};import*as I from"./functions/order/index.js";export{I as IkasOrderFunctions};import*as k from"./functions/product/attribute-value/index.js";export{k as IkasProductAttributeValueFunctions};import*as F from"./functions/product/filter/index.js";export{F as IkasProductFilterFunctions};import*as j from"./functions/product/option-set/option/index.js";export{j as IkasProductOptionFunctions};import*as l from"./functions/product/option-set/index.js";export{l as IkasProductOptionSetFunctions};import*as g from"./functions/product/variant/price/index.js";export{g as IkasProductPriceFunctions};import*as y from"./functions/product/variant/index.js";export{y as IkasProductVariantFunctions};import*as v from"./functions/product/index.js";export{v as IkasProductFunctions};import*as P from"./functions/raffle/index.js";export{P as IkasRaffleFunctions};import*as C from"./functions/variant-type/variant-value/index.js";export{C as IkasVariantValueFunctions};import*as V from"./functions/variant-type/index.js";export{V as IkasVariantTypeFunctions};export{stringToSlug}from"./utils/helper.js";
|
package/build/utils/helper.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as
|
|
1
|
+
import{IkasStorefrontConfig as r}from"@ikas/storefront-config";var e=function(r){return/^\+?\d+$/.test(r)},n=function(r){return r=r.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"-").replace(/-+/g,"-"),encodeURIComponent(r)};function t(e){var n={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",hour12:!1},t=r.getCurrentLocale();function a(r){return!!new Intl.DateTimeFormat(r,{hour:"numeric"}).format(0).match(/\s/)}return"undefined"!=typeof navigator?n.hour12=a(navigator.language):n.hour12=a(t),new Intl.DateTimeFormat(t,n).format(e)}var a=function(r){return!(r.length>320)&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(r)};export{t as formatDate,n as stringToSlug,a as validateEmail,e as validatePhoneNumber};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-model-functions",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.11",
|
|
4
4
|
"description": "Functions for ikas storefront models.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"build": "rm -rf build && rollup -c"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
20
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
19
|
+
"@ikas/storefront-config": "^6.1.0-beta.11",
|
|
20
|
+
"@ikas/storefront-models": "^6.1.0-beta.11",
|
|
21
21
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
22
22
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
23
23
|
"rollup-plugin-rename-node-modules": "^1.2.0",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"lodash": "^4.17.21"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
37
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
36
|
+
"@ikas/storefront-config": "^6.1.0-beta.11",
|
|
37
|
+
"@ikas/storefront-models": "^6.1.0-beta.11",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
39
|
}
|
|
40
40
|
}
|