@ikas/storefront-model-functions 6.1.0-beta.9 → 6.1.0-beta.90
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/functions/image/index.d.ts +1 -1
- package/build/functions/image/index.js +1 -1
- package/build/functions/product/filter/index.js +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -1
- package/build/utils/helper.d.ts +1 -1
- package/build/utils/helper.js +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IkasImage } from "@ikas/storefront-models";
|
|
2
2
|
export declare function getDefaultSrc(image: IkasImage): string;
|
|
3
3
|
export declare function getThumbnailSrc(image: IkasImage): string;
|
|
4
|
-
export declare function getSrc(image: IkasImage, size: number): string;
|
|
4
|
+
export declare function getSrc(image: IkasImage, size: number, lossless?: boolean): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as c}from"@ikas/storefront-config";function n(c){return i(c,1080)}function a(c){return i(c,180)}function i(n,a){var i,
|
|
1
|
+
import{IkasStorefrontConfig as c}from"@ikas/storefront-config";function n(c){return i(c,1080)}function a(c){return i(c,180)}function i(n,a,i){var o;void 0===i&&(i=!1);var t=i?a+"L":a,e=c.getCdnUrl();if(n.id.includes("/"))return n.isVideo?"".concat(e,"videos/").concat(n.id,"/original.mp4"):n.fileName?"".concat(e,"images/").concat(n.id,"/").concat(t,"/").concat(n.fileName,".webp"):"".concat(e,"images/").concat(n.id,"/image_").concat(t,".webp");var r=null===(o=c.getMerchantSettings())||void 0===o?void 0:o.merchantId;return n.isVideo?"".concat(e,"videos/").concat(r,"/").concat(n.id,"/original.mp4"):n.fileName?"".concat(e,"images/").concat(r,"/").concat(n.id,"/").concat(t,"/").concat(n.fileName,".webp"):"".concat(e,"images/").concat(r,"/").concat(n.id,"/image_").concat(t,".webp")}export{n as getDefaultSrc,i as getSrc,a as getThumbnailSrc};
|
|
@@ -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
|
|
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";import{stringToSlug as o}from"../../../utils/helper.js";function u(n){return[e.NUMBER_RANGE_LIST,e.NUMBER_RANGE].includes(n.displayType)}function l(e){return e.type===n.STOCK_STATUS}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.id})))||[]}function c(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 o(e.name)})))||[]}function a(e){var n,r,o,u=(null===(n=e.settings)||void 0===n?void 0:n.sortType)||t.ALPHABETICAL_ASC,l=[t.ALPHABETICAL_DESC,t.PRODUCT_COUNT_DESC].includes(u),s=[t.ALPHABETICAL_ASC,t.ALPHABETICAL_DESC].includes(u),c=u===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===(o=e.settings)||void 0===o?void 0:o.customSortedValues)||[];a=a.sort((function(e,n){return d.indexOf(e.id)-d.indexOf(n.id)}))}return a}function d(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 f(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 m(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 o=r(t);o.from<n.numberRangeLimit.from&&(o.from=n.numberRange.from),o.to&&(null===(i=n.numberRangeLimit)||void 0===i?void 0:i.to)&&o.to>n.numberRangeLimit.to&&(o.to=n.numberRangeLimit.to),n.numberRange=o}else n.numberRange=null}function R(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 v(e){var n;return{id:e.key,type:e.type,valueList:s(e),useAndFilter:null===(n=e.settings)||void 0===n?void 0:n.useAndFilter}}function p(n,t){var i,r,u=t.split(",");n.displayType===e.NUMBER_RANGE?n.numberRange=S(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(o(e.name,!1))&&0!==e.resultCount&&(e.isSelected=!0)}))}function E(e){return"".concat(e.from,":").concat(e.to||"")}function S(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 g(e){return e.slug?"/".concat(e.slug):""}export{p as applyQueryParam,R as clear,a as getDisplayedValues,g as getIkasFilterHref,c as getKeyList,s as getValueList,u as isCustomValueFilter,l as isStockFilter,d as onFilterValueClick,m as onNumberRangeChange,f as onNumberRangeClick,S as parseRangeStr,E as rangeToId,v 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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const validatePhoneNumber: (str: string) => boolean;
|
|
2
|
-
export declare const stringToSlug: (str: string) => string;
|
|
2
|
+
export declare const stringToSlug: (str: string, withEncode?: boolean) => string;
|
|
3
3
|
export declare function formatDate(date: Date): string;
|
|
4
4
|
export declare const validateEmail: (str: string) => boolean;
|
package/build/utils/helper.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
import{IkasStorefrontConfig as r}from"@ikas/storefront-config";var e=function(r){return/^\+?\d+$/.test(r)},n=function(r,e){return void 0===e&&(e=!0),r=r.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"-").replace(/-+/g,"-"),e?encodeURIComponent(r):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.90",
|
|
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.90",
|
|
20
|
+
"@ikas/storefront-models": "^6.1.0-beta.90",
|
|
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.90",
|
|
37
|
+
"@ikas/storefront-models": "^6.1.0-beta.90",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
39
|
}
|
|
40
40
|
}
|