@ikas/bp-storefront 0.133.0 → 1.1.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.
@@ -155,6 +155,25 @@ export declare class Router {
155
155
  * ```
156
156
  */
157
157
  static getPageParams(): Record<string, string>;
158
+ /**
159
+ * Get the current URL query parameters as an object.
160
+ *
161
+ * @ai-category Navigation
162
+ * @ai-related getCurrentPath, getPageParams
163
+ *
164
+ * @returns Object containing query parameters parsed from the current URL
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * import { Router } from "@ikas/bp-storefront";
169
+ *
170
+ * // URL: /search?q=shoes&color=red
171
+ * const query = Router.router_getQueryParams();
172
+ * console.log(query.q); // "shoes"
173
+ * console.log(query.color); // "red"
174
+ * ```
175
+ */
176
+ static router_getQueryParams(): Record<string, string>;
158
177
  private static handleRouteChange;
159
178
  private static handlePopState;
160
179
  private static interceptAnchorClicks;
@@ -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 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
+ 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,i,c,s){void 0===c&&(c=!1),void 0===s&&(s=!1);var u=Object.entries(i||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),h="";switch(e){case"INDEX":h="/";break;case"ACCOUNT":h="/account";break;case"ACTIVATE_CUSTOMER":h="/account/activate";break;case"ADDRESSES":h="/account/addresses";break;case"FAVORITE_PRODUCTS":h="/account/favorite-products";break;case"FORGOT_PASSWORD":h="/account/forgot-password";break;case"LOGIN":h="/account/login";break;case"RAFFLE_ACCOUNT":h="/account/raffles";break;case"RECOVER_PASSWORD":h="/account/recover-password";break;case"REGISTER":h="/account/register";break;case"ORDERS":h="/account/orders";break;case"ORDER_DETAIL":h="/account/orders/".concat(n);break;case"BLOG_INDEX":h="/blog";break;case"BLOG":case"BLOG_CATEGORY":h="/blog/".concat(n);break;case"CART":h="/cart";break;case"CHECKOUT":h=t(a);break;case"CUSTOM":h="/pages/".concat(n);break;case"RAFFLE":h="/raffle";break;case"RAFFLE_DETAIL":h="/raffle/".concat(n);break;case"SEARCH":h="/search";break;case"NOT_FOUND":h="/404"}u&&(h+="?".concat(u)),r.navigate(o(h),c,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.router_getQueryParams=function(){if(void 0===this.window)return{};var e={};return new URLSearchParams(this.window.location.search).forEach(function(t,a){e[a]=t}),e},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};
@@ -92,7 +92,8 @@ export type StorefrontB2BShowProductsEnum = "StorefrontB2BShowProductsEnum" | "A
92
92
  export type StorefrontPageTypesEnum = "StorefrontPageTypesEnum" | "BLOG" | "BLOG_CATEGORY" | "BRAND" | "CATEGORY" | "CUSTOM" | "PRODUCT";
93
93
  export type StorefrontPolicyTypeEnum = "StorefrontPolicyTypeEnum" | "IMPRINT" | "OTHER" | "PRIVACY_POLICY" | "RETURN_POLICY" | "SHIPPING_POLICY" | "TERMS_OF_SERVICE";
94
94
  export type StorefrontPopupDeviceTypeEnum = "StorefrontPopupDeviceTypeEnum" | "ALL" | "DESKTOP" | "MOBILE";
95
- export type StorefrontPopupDisplayFilterTypeEnum = "StorefrontPopupDisplayFilterTypeEnum" | "CART_TOTAL" | "CUSTOMER_SEGMENT";
95
+ export type StorefrontPopupDisplayFilterTypeEnum = "StorefrontPopupDisplayFilterTypeEnum" | "APPLIED_CAMPAIGN" | "BRAND_IN_CART" | "CART_ITEM_COUNT" | "CART_TOTAL" | "CATEGORY_IN_CART" | "CUSTOMER_AUTH_STATUS" | "CUSTOMER_GENDER" | "CUSTOMER_GROUP" | "CUSTOMER_SEGMENT" | "CUSTOMER_SUBSCRIPTION" | "PRODUCT_IN_CART";
96
+ export type StorefrontPopupDisplayFilterOperatorEnum = "StorefrontPopupDisplayFilterOperatorEnum" | "ANY_OF" | "BETWEEN" | "EQUALS" | "GREATER_THAN" | "GREATER_THAN_OR_EQUAL" | "LESS_THAN" | "LESS_THAN_OR_EQUAL" | "NONE_OF" | "NOT_EQUALS";
96
97
  export type StorefrontPopupDisplayFrequencyEnum = "StorefrontPopupDisplayFrequencyEnum" | "EVERY_TIME" | "ONCE_PER_SESSION";
97
98
  export type StorefrontPopupDisplayTriggerTypeEnum = "StorefrontPopupDisplayTriggerTypeEnum" | "EXIT_INTENT" | "ON_PAGE_LOAD" | "SCROLL_DOWN";
98
99
  export type StorefrontPopupPageFilterDataTypeEnum = "StorefrontPopupPageFilterDataTypeEnum" | "CONTAINS" | "DOES_NOT_CONTAIN" | "EXACT_MATCH" | "ID_LIST";
@@ -2659,6 +2660,7 @@ export interface StorefrontPopup {
2659
2660
  deleted: boolean;
2660
2661
  displayFilters: StorefrontPopupDisplayFilter[] | null;
2661
2662
  displaySettings: StorefrontPopupDisplaySettings;
2663
+ hideFilters: StorefrontPopupDisplayFilter[] | null;
2662
2664
  id: string;
2663
2665
  name: string;
2664
2666
  pageFilters: StorefrontPopupPageFilter[] | null;
@@ -2678,9 +2680,9 @@ export interface StorefrontPopupDateFilter {
2678
2680
  startDate: any | null;
2679
2681
  }
2680
2682
  export interface StorefrontPopupDisplayFilter {
2681
- operator: string;
2683
+ operator: StorefrontPopupDisplayFilterOperatorEnum;
2682
2684
  type: StorefrontPopupDisplayFilterTypeEnum;
2683
- value: string;
2685
+ value: string[];
2684
2686
  }
2685
2687
  export interface StorefrontPopupDisplaySettings {
2686
2688
  frequency: StorefrontPopupDisplayFrequencyEnum;
@@ -14,6 +14,7 @@ export type IkasStorefrontPopup = {
14
14
  dateFilter: IkasStorefrontPopupDateFilter | null;
15
15
  displayFilters: IkasStorefrontPopupDisplayFilter[] | null;
16
16
  displaySettings: IkasStorefrontPopupDisplaySettings;
17
+ hideFilters: IkasStorefrontPopupDisplayFilter[] | null;
17
18
  name: string;
18
19
  pageFilters: IkasStorefrontPopupPageFilter[] | null;
19
20
  status: IkasStorefrontPopupStatusEnum;
@@ -1,6 +1,7 @@
1
1
  export type IkasStorefrontPopupDisplayFilter = {
2
- operator: string;
2
+ operator: IkasStorefrontPopupDisplayFilterOperatorEnum;
3
3
  type: IkasStorefrontPopupDisplayFilterTypeEnum;
4
- value: string;
4
+ value: string[];
5
5
  };
6
- export type IkasStorefrontPopupDisplayFilterTypeEnum = "CART_TOTAL" | "CUSTOMER_SEGMENT";
6
+ export type IkasStorefrontPopupDisplayFilterTypeEnum = "APPLIED_CAMPAIGN" | "BRAND_IN_CART" | "CART_ITEM_COUNT" | "CART_TOTAL" | "CATEGORY_IN_CART" | "CUSTOMER_AUTH_STATUS" | "CUSTOMER_GENDER" | "CUSTOMER_GROUP" | "CUSTOMER_SEGMENT" | "CUSTOMER_SUBSCRIPTION" | "PRODUCT_IN_CART";
7
+ export type IkasStorefrontPopupDisplayFilterOperatorEnum = "ANY_OF" | "BETWEEN" | "EQUALS" | "GREATER_THAN" | "GREATER_THAN_OR_EQUAL" | "LESS_THAN" | "LESS_THAN_OR_EQUAL" | "NONE_OF" | "NOT_EQUALS";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "0.133.0",
3
+ "version": "1.1.0",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",