@ikas/bp-storefront 0.91.0 → 0.93.0

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{options as _}from"../../dist/preact.mjs.js";var n,t,o,u,r=0,c=[],e=_,i=e.__b,f=e.__r,a=e.diffed,h=e.__c,m=e.unmount,s=e.__;function v(_,n){e.__h&&e.__h(t,_,r||n),r=0;var o=t.__H||(t.__H={__:[],__h:[]});return _>=o.__.length&&o.__.push({}),o.__[_]}function H(_,o){var u=v(n++,3);!e.__s&&g(u.__H,o)&&(u.__=_,u.u=o,t.__H.__h.push(u))}function l(_){return r=5,d(function(){return{current:_}},[])}function d(_,t){var o=v(n++,7);return g(o.__H,t)&&(o.__=_(),o.__H=t,o.__h=_),o.__}function p(){for(var _;_=c.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(A),_.__H.__h.forEach(F),_.__H.__h=[]}catch(n){_.__H.__h=[],e.__e(n,_.__v)}}e.__b=function(_){t=null,i&&i(_)},e.__=function(_,n){_&&n.__k&&n.__k.__m&&(_.__m=n.__k.__m),s&&s(_,n)},e.__r=function(_){f&&f(_),n=0;var u=(t=_.__c).__H;u&&(o===t?(u.__h=[],t.__h=[],u.__.forEach(function(_){_.__N&&(_.__=_.__N),_.u=_.__N=void 0})):(u.__h.forEach(A),u.__h.forEach(F),u.__h=[],n=0)),o=t},e.diffed=function(_){a&&a(_);var n=_.__c;n&&n.__H&&(n.__H.__h.length&&(1!==c.push(n)&&u===e.requestAnimationFrame||((u=e.requestAnimationFrame)||y)(p)),n.__H.__.forEach(function(_){_.u&&(_.__H=_.u),_.u=void 0})),o=t=null},e.__c=function(_,n){n.some(function(_){try{_.__h.forEach(A),_.__h=_.__h.filter(function(_){return!_.__||F(_)})}catch(t){n.some(function(_){_.__h&&(_.__h=[])}),n=[],e.__e(t,_.__v)}}),h&&h(_,n)},e.unmount=function(_){m&&m(_);var n,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(_){try{A(_)}catch(_){n=_}}),t.__H=void 0,n&&e.__e(n,t.__v))};var E="function"==typeof requestAnimationFrame;function y(_){var n,t=function(){clearTimeout(o),E&&cancelAnimationFrame(n),setTimeout(_)},o=setTimeout(t,35);E&&(n=requestAnimationFrame(t))}function A(_){var n=t,o=_.__c;"function"==typeof o&&(_.__c=void 0,o()),t=n}function F(_){var n=t;_.__c=_.__(),t=n}function g(_,n){return!_||_.length!==n.length||n.some(function(n,t){return n!==_[t]})}export{H as useEffect,d as useMemo,l as useRef};
1
+ import{options as _}from"../../dist/preact.mjs.js";var n,t,o,u,r=0,c=[],e=_,i=e.__b,f=e.__r,a=e.diffed,h=e.__c,m=e.unmount,s=e.__;function v(_,n){e.__h&&e.__h(t,_,r||n),r=0;var o=t.__H||(t.__H={__:[],__h:[]});return _>=o.__.length&&o.__.push({}),o.__[_]}function H(_,o){var u=v(n++,4);!e.__s&&g(u.__H,o)&&(u.__=_,u.u=o,t.__h.push(u))}function l(_){return r=5,d(function(){return{current:_}},[])}function d(_,t){var o=v(n++,7);return g(o.__H,t)&&(o.__=_(),o.__H=t,o.__h=_),o.__}function p(){for(var _;_=c.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(A),_.__H.__h.forEach(F),_.__H.__h=[]}catch(n){_.__H.__h=[],e.__e(n,_.__v)}}e.__b=function(_){t=null,i&&i(_)},e.__=function(_,n){_&&n.__k&&n.__k.__m&&(_.__m=n.__k.__m),s&&s(_,n)},e.__r=function(_){f&&f(_),n=0;var u=(t=_.__c).__H;u&&(o===t?(u.__h=[],t.__h=[],u.__.forEach(function(_){_.__N&&(_.__=_.__N),_.u=_.__N=void 0})):(u.__h.forEach(A),u.__h.forEach(F),u.__h=[],n=0)),o=t},e.diffed=function(_){a&&a(_);var n=_.__c;n&&n.__H&&(n.__H.__h.length&&(1!==c.push(n)&&u===e.requestAnimationFrame||((u=e.requestAnimationFrame)||y)(p)),n.__H.__.forEach(function(_){_.u&&(_.__H=_.u),_.u=void 0})),o=t=null},e.__c=function(_,n){n.some(function(_){try{_.__h.forEach(A),_.__h=_.__h.filter(function(_){return!_.__||F(_)})}catch(t){n.some(function(_){_.__h&&(_.__h=[])}),n=[],e.__e(t,_.__v)}}),h&&h(_,n)},e.unmount=function(_){m&&m(_);var n,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(_){try{A(_)}catch(_){n=_}}),t.__H=void 0,n&&e.__e(n,t.__v))};var E="function"==typeof requestAnimationFrame;function y(_){var n,t=function(){clearTimeout(o),E&&cancelAnimationFrame(n),setTimeout(_)},o=setTimeout(t,35);E&&(n=requestAnimationFrame(t))}function A(_){var n=t,o=_.__c;"function"==typeof o&&(_.__c=void 0,o()),t=n}function F(_){var n=t;_.__c=_.__(),t=n}function g(_,n){return!_||_.length!==n.length||n.some(function(n,t){return n!==_[t]})}export{H as useLayoutEffect,d as useMemo,l as useRef};
@@ -1 +1 @@
1
- import{initIkasBrand as t}from"../brand/init.js";import{initIkasCategory as r}from"../category/init.js";import{initIkasHTMLMetaData as i}from"../html-meta-data/init.js";import{initIkasProductAttributeValue as a}from"./attribute-value/init.js";import{initIkasProductGroup as o}from"./group/init.js";import{initIkasProductVariant as n}from"./variant/init.js";import{initIkasProductVariantType as f}from"./variant-type/init.js";var m={};function u(m,u){m.metaData&&i(m.metaData,u),m.brand&&t(m.brand,u),m.categories.forEach(function(t){return r(t,u)}),m.variants.forEach(n),m.attributes.forEach(a),m.variantTypes.forEach(function(t){return f(t,u)}),m.productGroup&&o(m.productGroup,u),c(m)}function c(t){t.variants.forEach(function(r){m[r.id]=t})}function e(t){return m[t]}export{e as getProductFromStore,u as initIkasProduct,c as initIkasProductExtraFields,m as productVariantStore};
1
+ import{initIkasBrand as t}from"../brand/init.js";import{initIkasCategory as r}from"../category/init.js";import{initIkasHTMLMetaData as i}from"../html-meta-data/init.js";import{initIkasProductAttributeValue as o}from"./attribute-value/init.js";import{initIkasProductGroup as a}from"./group/init.js";import{initIkasProductVariant as n}from"./variant/init.js";import{initIkasProductVariantType as f}from"./variant-type/init.js";var e={};function m(e,m){e.metaData&&i(e.metaData,m),e.brand&&t(e.brand,m),e.categories.forEach(function(t){return r(t,m)}),e.variants.forEach(n),e.attributes.forEach(o),e.variantTypes.forEach(function(t){return f(t,m)}),e.productGroup&&a(e.productGroup,m),u(e)}function u(t){t.variants.forEach(function(r){var i,o;e[r.id]&&(null===(i=t.campaignOffers)||void 0===i?void 0:i.length)&&0===(null===(o=t.offers)||void 0===o?void 0:o.length)||(e[r.id]=t)})}function c(t){return e[t]}export{c as getProductFromStore,m as initIkasProduct,u as initIkasProductExtraFields,e as productVariantStore};
@@ -1 +1 @@
1
- import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var n=function(){function n(){}return n.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(n.pageParams=e,this.window.addEventListener("popstate",n.handlePopState),n.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},n.navigate=function(t,a,r){if(void 0===a&&(a=!1),void 0===r&&(r=!1),void 0!==this.window){var o=n.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):r?this.window.open(o,"_blank"):this.window.location.href=o),n.handleRouteChange(o)}},n.navigateToPage=function(e,r,c,i,s){void 0===i&&(i=!1),void 0===s&&(s=!1);var u=Object.entries(c||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),d="";switch(e){case"INDEX":d="/";break;case"ACCOUNT":d="/account";break;case"ACTIVATE_CUSTOMER":d="/account/activate";break;case"ADDRESSES":d="/account/addresses";break;case"FAVORITE_PRODUCTS":d="/account/favorite-products";break;case"FORGOT_PASSWORD":d="/account/forgot-password";break;case"LOGIN":d="/account/login";break;case"RAFFLE_ACCOUNT":d="/account/raffles";break;case"RECOVER_PASSWORD":d="/account/recover-password";break;case"REGISTER":d="/account/register";break;case"ORDERS":d="/account/orders";break;case"ORDER_DETAIL":d="/account/orders/".concat(r);break;case"BLOG_INDEX":d="/blog";break;case"BLOG":case"BLOG_CATEGORY":d="/blog/".concat(r);break;case"CART":d="/cart";break;case"CHECKOUT":d=t(a);break;case"CUSTOM":d="/pages/".concat(r);break;case"RAFFLE":d="/raffle";break;case"RAFFLE_DETAIL":d="/raffle/".concat(r);break;case"SEARCH":d="/search";break;case"NOT_FOUND":d="/404"}u&&(d+="?".concat(u)),n.navigate(o(d),i,s)},n.addObserver=function(e){n.observers.push(e)},n.removeObserver=function(e){n.observers=n.observers.filter(function(t){return t!==e})},n.goBack=function(){this.window.history.back()},n.getCurrentPath=function(){return n.currentPath},n.getPageParams=function(){return n.pageParams},n.handleRouteChange=function(e){n.currentPath=e,n.notifyObservers()},n.handlePopState=function(){void 0!==this.window&&n.handleRouteChange(this.window.location.pathname)},n.interceptAnchorClicks=function(){void 0!==this.window&&this.window.addEventListener("click",function(e){var t=e.target.closest("a");if(t&&"A"===t.tagName&&t.getAttribute("href")){if(e.metaKey||e.ctrlKey)return;e.preventDefault();var a=t.getAttribute("href"),r="_blank"===t.getAttribute("target");n.navigate(a,!1,r)}})},n.notifyObservers=function(){n.observers.forEach(function(e){return e(n.currentPath)})},n.ensurePathPrefix=function(e){return e.startsWith("http")||e.startsWith("/")?e:"/".concat(e)},n.currentPath="undefined"!=typeof window?window.location.pathname:"/",n.observers=[],n.pageParams={},n.isFromBFCache=!1,n}(),r=n;function o(t){var a=e.getCurrentPath(),n=t.split("/").filter(function(e){return""!==e})[0];return n&&e.getSupportedPaths().includes(n)?t:"".concat(a?"/".concat(a):"").concat(t).replace("//","/")}export{n as Router,r as router,o as withRoutePrefix};
1
+ import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var r=function(){function r(){}return r.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(r.pageParams=e,this.window.addEventListener("popstate",r.handlePopState),r.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},r.navigate=function(t,a,n){if(void 0===a&&(a=!1),void 0===n&&(n=!1),void 0!==this.window){var o=r.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):n?this.window.open(o,"_blank"):this.window.location.href=o),r.handleRouteChange(o)}},r.navigateToPage=function(e,n,c,i,s){void 0===i&&(i=!1),void 0===s&&(s=!1);var u=Object.entries(c||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),d="";switch(e){case"INDEX":d="/";break;case"ACCOUNT":d="/account";break;case"ACTIVATE_CUSTOMER":d="/account/activate";break;case"ADDRESSES":d="/account/addresses";break;case"FAVORITE_PRODUCTS":d="/account/favorite-products";break;case"FORGOT_PASSWORD":d="/account/forgot-password";break;case"LOGIN":d="/account/login";break;case"RAFFLE_ACCOUNT":d="/account/raffles";break;case"RECOVER_PASSWORD":d="/account/recover-password";break;case"REGISTER":d="/account/register";break;case"ORDERS":d="/account/orders";break;case"ORDER_DETAIL":d="/account/orders/".concat(n);break;case"BLOG_INDEX":d="/blog";break;case"BLOG":case"BLOG_CATEGORY":d="/blog/".concat(n);break;case"CART":d="/cart";break;case"CHECKOUT":d=t(a);break;case"CUSTOM":d="/pages/".concat(n);break;case"RAFFLE":d="/raffle";break;case"RAFFLE_DETAIL":d="/raffle/".concat(n);break;case"SEARCH":d="/search";break;case"NOT_FOUND":d="/404"}u&&(d+="?".concat(u)),r.navigate(o(d),i,s)},r.addObserver=function(e){r.observers.push(e)},r.removeObserver=function(e){r.observers=r.observers.filter(function(t){return t!==e})},r.goBack=function(){this.window.history.back()},r.getCurrentPath=function(){return r.currentPath},r.getPageParams=function(){return r.pageParams},r.handleRouteChange=function(e){r.currentPath=e,r.notifyObservers()},r.handlePopState=function(){void 0!==this.window&&r.handleRouteChange(this.window.location.pathname)},r.interceptAnchorClicks=function(){void 0!==this.window&&this.window.addEventListener("click",function(e){var t=e.target.closest("a");if(t&&"A"===t.tagName&&t.getAttribute("href")){var a=t.getAttribute("href");if(e.metaKey||e.ctrlKey)return;if(/^(mailto|tel|sms|javascript):/i.test(a))return;e.preventDefault();var n="_blank"===t.getAttribute("target");r.navigate(a,!1,n)}})},r.notifyObservers=function(){r.observers.forEach(function(e){return e(r.currentPath)})},r.ensurePathPrefix=function(e){return e.startsWith("http")||e.startsWith("/")?e:"/".concat(e)},r.currentPath="undefined"!=typeof window?window.location.pathname:"/",r.observers=[],r.pageParams={},r.isFromBFCache=!1,r}(),n=r;function o(t){var a=e.getCurrentPath(),r=t.split("/").filter(function(e){return""!==e})[0];return r&&e.getSupportedPaths().includes(r)?t:"".concat(a?"/".concat(a):"").concat(t).replace("//","/")}export{r as Router,n as router,o as withRoutePrefix};
@@ -1,10 +1,33 @@
1
1
  import { type CSSProperties } from "preact";
2
2
  interface IkasComponentRendererProps {
3
+ /**
4
+ * Unique identifier for this renderer instance. Used to create container
5
+ * elements in the DOM that child components mount into.
6
+ * Each child gets `${id}-${index}` as its container id.
7
+ * Must be unique per renderer — e.g. `product-card-${product.id}`.
8
+ */
3
9
  id: string;
10
+ /**
11
+ * Array of child component descriptors injected by the ikas editor.
12
+ * Each component has `.r()` (render HTML) and `.l()` (mount/hydrate) methods.
13
+ * Comes from a COMPONENT_LIST prop defined in ikas.config.json.
14
+ */
4
15
  components?: any[];
16
+ /**
17
+ * Props from the parent section/component, passed through to child components.
18
+ * Children can access these via dynamic value bindings configured in the editor.
19
+ */
5
20
  parentProps?: Record<string, any>;
21
+ /**
22
+ * Data mapping object passed to child components alongside parentProps.
23
+ * Used with privateVarMap to inject contextual data — e.g. `map={{ product }}`
24
+ * makes the current product available to child components like CardProductName.
25
+ * Keys must match the keys defined in the privateVarMap config.
26
+ */
6
27
  map?: Record<string, any>;
28
+ /** Optional inline styles applied to the wrapper div. */
7
29
  style?: CSSProperties;
30
+ /** Optional CSS class name applied to the wrapper div. */
8
31
  className?: string;
9
32
  }
10
33
  export declare function IkasComponentRenderer({ id: baseId, components, style, className, parentProps, map, }: IkasComponentRendererProps): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
@@ -1 +1 @@
1
- import{__assign as r}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as t}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useEffect as e,useMemo as o}from'./../ext/preact/hooks/dist/hooks.mjs.js';var c={};function s(s){var u=s.id,a=s.components,i=s.style,l=s.className,f=s.parentProps,m=void 0===f?c:f,d=s.map,p=void 0===d?c:d,h=n([]),v=n(m),j=n(p);v.current=m,j.current=p,e(function(){if(a&&0!==a.length){h.current.forEach(function(r){return r()}),h.current=[];for(var t=0;t<a.length;t++){var n=a[t];if(n.l){var e="".concat(u,"-").concat(t),o='[id="'.concat(u,'"] [id="').concat(e,'"]'),c=n.l(o,r(r({},v.current),j.current),{},{id:e,key:e});"function"==typeof c&&h.current.push(c)}}return function(){h.current.forEach(function(r){return r()}),h.current=[]}}},[a,u]);var y=o(function(){return a&&0!==a.length?a.map(function(t,n){var e="".concat(u,"-").concat(n);return t.r(r(r({},v.current),j.current),{},{id:e,key:e})}).join(""):""},[a,u]);return a&&0!==a.length?t("div",{id:u,dangerouslySetInnerHTML:{__html:y},style:r({display:"contents"},i),className:l}):null}export{s as IkasComponentRenderer};
1
+ import{__assign as r}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as t}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useLayoutEffect as e,useMemo as o}from'./../ext/preact/hooks/dist/hooks.mjs.js';var c={};function s(s){var u=s.id,a=s.components,i=s.style,l=s.className,f=s.parentProps,m=void 0===f?c:f,d=s.map,p=void 0===d?c:d,h=n([]),v=n(m),y=n(p);v.current=m,y.current=p,e(function(){if(a&&0!==a.length){h.current.forEach(function(r){return r()}),h.current=[];for(var t=0;t<a.length;t++){var n=a[t];if(n.l){var e="".concat(u,"-").concat(t),o='[id="'.concat(u,'"] [id="').concat(e,'"]'),c=n.l(o,r(r({},v.current),y.current),{},{id:e,key:e});"function"==typeof c&&h.current.push(c)}}return function(){h.current.forEach(function(r){return r()}),h.current=[]}}},[a,u]);var j=o(function(){return a&&0!==a.length?a.map(function(t,n){var e="".concat(u,"-").concat(n);return t.r(r(r({},v.current),y.current),{},{id:e,key:e})}).join(""):""},[a,u]);return a&&0!==a.length?t("div",{id:u,dangerouslySetInnerHTML:{__html:j},style:r({display:"contents"},i),className:l}):null}export{s as IkasComponentRenderer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "0.91.0",
3
+ "version": "0.93.0",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",