@commercelayer/app-elements 1.15.2 → 1.15.3

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/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a2 as s, aI as t, a3 as o, a4 as r, a5 as n, a6 as u, a7 as i, a8 as p, a9 as l, aa as b, ab as c, aJ as d, ac as g, ad as S, T as m, aK as I, aL as k, aM as T, aN as D, ae as R, W as y, Y as h, af as C, ag as H, aO as P, a_ as A, a$ as f, b1 as B, b3 as F, b5 as v, b9 as L, bb as N, bg as O, bj as G, bl as w, bs as V, bu as x, bw as E, by as M, bA as W, bE as J, bF as U, ah as q, ai as z, b0 as K, b2 as Q, b4 as Y, b6 as Z, b8 as _, ba as $, bc as j, bd as X, be as aa, bf as ea, bh as sa, bi as ta, bk as oa, bm as ra, bt as na, bv as ua, bx as ia, bz as pa, bB as la, bC as ba, bD as ca, aP as da, aQ as ga, aR as Sa, aS as ma, _ as Ia, aT as ka, aj as Ta, aU as Da, aV as Ra, ak as ya, al as ha, am as Ca, an as Ha, aW as Pa, bI as Aa, bJ as fa, bK as Ba, bL as Fa, bM as va, bN as La, bO as Na, bP as Oa, ao as Ga, aX as wa, ap as Va, aq as xa, ar as Ea, as as Ma, au as Wa, av as Ja, aw as Ua, ax as qa, ay as za, aD as Ka, az as Qa, aY as Ya, aE as Za, aF as _a, aA as $a, aG as ja, aB as Xa, aZ as ae, $ as ee, aH as se, aC as te, z as oe, a1 as re, C as ne, D as ue, k as ie, y as pe, bn as le, b7 as be, l as ce, m as de, q as ge, A as Se, B as me, E as Ie, bR as ke, bS as Te, bo as De, s as Re, t as ye, u as he, bT as Ce, bU as He, bV as Pe, bW as Ae, bX as fe, F as Be, G as Fe, bY as ve, bZ as Le, b_ as Ne, b$ as Oe, H as Ge, J as we, c0 as Ve, c1 as xe, c2 as Ee, M as Me, N as We, e as Je, K as Ue, L as qe, h as ze, bp as Ke, bq as Qe, br as Ye, n as Ze, r as _e, bG as $e, v as je, x as Xe, O as as, U as es, V as ss, P as ts, Q as os, R as rs, S as ns, bQ as us, Z as is, a0 as ps, bH as ls, at as bs } from "./main-DKXSpV6c.js";
2
+ import { a2 as s, aI as t, a3 as o, a4 as r, a5 as n, a6 as u, a7 as i, a8 as p, a9 as l, aa as b, ab as c, aJ as d, ac as g, ad as S, T as m, aK as I, aL as k, aM as T, aN as D, ae as R, W as y, Y as h, af as C, ag as H, aO as P, a_ as A, a$ as f, b1 as B, b3 as F, b5 as v, b9 as L, bb as N, bg as O, bj as G, bl as w, bs as V, bu as x, bw as E, by as M, bA as W, bE as J, bF as U, ah as q, ai as z, b0 as K, b2 as Q, b4 as Y, b6 as Z, b8 as _, ba as $, bc as j, bd as X, be as aa, bf as ea, bh as sa, bi as ta, bk as oa, bm as ra, bt as na, bv as ua, bx as ia, bz as pa, bB as la, bC as ba, bD as ca, aP as da, aQ as ga, aR as Sa, aS as ma, _ as Ia, aT as ka, aj as Ta, aU as Da, aV as Ra, ak as ya, al as ha, am as Ca, an as Ha, aW as Pa, bI as Aa, bJ as fa, bK as Ba, bL as Fa, bM as va, bN as La, bO as Na, bP as Oa, ao as Ga, aX as wa, ap as Va, aq as xa, ar as Ea, as as Ma, au as Wa, av as Ja, aw as Ua, ax as qa, ay as za, aD as Ka, az as Qa, aY as Ya, aE as Za, aF as _a, aA as $a, aG as ja, aB as Xa, aZ as ae, $ as ee, aH as se, aC as te, z as oe, a1 as re, C as ne, D as ue, k as ie, y as pe, bn as le, b7 as be, l as ce, m as de, q as ge, A as Se, B as me, E as Ie, bR as ke, bS as Te, bo as De, s as Re, t as ye, u as he, bT as Ce, bU as He, bV as Pe, bW as Ae, bX as fe, F as Be, G as Fe, bY as ve, bZ as Le, b_ as Ne, b$ as Oe, H as Ge, J as we, c0 as Ve, c1 as xe, c2 as Ee, M as Me, N as We, e as Je, K as Ue, L as qe, h as ze, bp as Ke, bq as Qe, br as Ye, n as Ze, r as _e, bG as $e, v as je, x as Xe, O as as, U as es, V as ss, P as ts, Q as os, R as rs, S as ns, bQ as us, Z as is, a0 as ps, bH as ls, at as bs } from "./main-BY0B1QQT.js";
3
3
  export {
4
4
  s as A,
5
5
  t as ActionButtons,
@@ -1,5 +1,5 @@
1
1
  import { type ListableResourceType } from '@commercelayer/sdk/lib/cjs/api';
2
- export type TokenProviderAllowedApp = 'bundles' | 'customers' | 'exports' | 'gift_cards' | 'imports' | 'inventory' | 'orders' | 'price_lists' | 'promotions' | 'returns' | 'shipments' | 'sku_lists' | 'skus' | 'stock_transfers' | 'subscriptions' | 'tags' | 'webhooks' | 'dashboard';
2
+ export type TokenProviderAllowedApp = 'bundles' | 'customers' | 'exports' | 'gift_cards' | 'imports' | 'inventory' | 'orders' | 'price_lists' | 'promotions' | 'returns' | 'shipments' | 'sku_lists' | 'skus' | 'stock_transfers' | 'subscriptions' | 'tags' | 'webhooks' | 'dashboard' | 'resources';
3
3
  export type TokenProviderTokenApplicationKind = 'integration' | 'sales_channel' | 'webapp' | 'resources' | TokenProviderAllowedApp;
4
4
  export type TokenProviderRoleActions = 'create' | 'destroy' | 'read' | 'update';
5
5
  export type TokenProviderPermissionItem = Record<TokenProviderRoleActions, boolean>;
@@ -8,7 +8,7 @@ export interface StatusIconProps extends React.HTMLAttributes<HTMLDivElement> {
8
8
  /**
9
9
  * Background color, `none` for no background
10
10
  */
11
- background?: 'green' | 'orange' | 'red' | 'gray' | 'teal' | 'white' | 'black' | 'none';
11
+ background?: 'green' | 'orange' | 'red' | 'gray' | 'lightGray' | 'teal' | 'white' | 'black' | 'none';
12
12
  /**
13
13
  * padding around the icon can bne: 'none' | 'small' | 'large'
14
14
  */
@@ -7,7 +7,7 @@ export declare const ListItemDescription: import('../../atoms/SkeletonTemplate')
7
7
  isLoading?: boolean | undefined;
8
8
  }>;
9
9
  export declare const ListItemIcon: import('../../atoms/SkeletonTemplate').SkeletonTemplateComponent<{
10
- color: "none" | "green" | "orange" | "red" | "gray" | "teal" | "white" | "black" | undefined;
10
+ color: "none" | "green" | "orange" | "red" | "gray" | "lightGray" | "teal" | "white" | "black" | undefined;
11
11
  icon: "download" | "package" | "tag" | "list" | "warning" | "info" | "x" | "appWindow" | "arrowBendDownRight" | "arrowCircleDown" | "arrowCircleUp" | "arrowClockwise" | "arrowDown" | "arrowLeft" | "arrowRight" | "arrowsLeftRight" | "arrowSquareOut" | "arrowUpRight" | "arrowUUpLeft" | "asteriskSimple" | "bookOpenText" | "buildings" | "calendarBlank" | "calendarCheck" | "camera" | "caretDown" | "caretRight" | "chat" | "chatCircle" | "check" | "clipboardText" | "cloudArrowUp" | "creditCard" | "currencyEur" | "dotsThree" | "eye" | "flag" | "folderOpen" | "funnelSimple" | "gearFine" | "gift" | "gitFork" | "githubLogo" | "globeSimple" | "googleLogo" | "hourglass" | "houseSimple" | "lifebuoy" | "lightbulbFilament" | "linkSimple" | "lockSimple" | "lockSimpleOpen" | "magnifyingGlass" | "megaphoneSimple" | "minus" | "minusCircle" | "pencilSimple" | "percent" | "plus" | "printer" | "pulse" | "pushPin" | "puzzlePiece" | "question" | "receipt" | "rocketLaunch" | "seal" | "shapes" | "shield" | "shoppingBag" | "signOut" | "slackLogo" | "sliders" | "squaresFour" | "stack" | "ticket" | "trash" | "treeStructure" | "truck" | "tShirt" | "upload" | "user" | "userCircle" | "users" | "warehouse" | "warningCircle" | "webhooksLogo" | "xCircle";
12
12
  delayMs?: number | undefined;
13
13
  isLoading?: boolean | undefined;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { type FilterItemOptions } from './types';
3
+ interface FieldProps {
4
+ item: FilterItemOptions;
5
+ }
6
+ export declare function FieldOptions({ item }: FieldProps): JSX.Element | null;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { type FilterItemTextSearch } from './types';
3
+ interface FieldProps {
4
+ item: FilterItemTextSearch;
5
+ }
6
+ export declare function FieldTextSearch({ item }: FieldProps): JSX.Element | null;
7
+ export {};
@@ -9,8 +9,21 @@ export interface FiltersFormProps {
9
9
  * New queryString generated on submit to be used to navigate to the listing page
10
10
  */
11
11
  onSubmit: (queryString: string) => void;
12
+ /**
13
+ * By default, we strip out all filters that are not part of the `instructions` array.
14
+ * The option `predicateWhitelist` is used to whitelist a set of predicates that you want to use as filters.
15
+ *
16
+ * @example
17
+ * ```jsx
18
+ * useResourceFilters({
19
+ * instructions,
20
+ * predicateWhitelist: [ 'starts_at_lteq', 'expires_at_gteq', 'starts_at_gt', 'expires_at_lt' ]
21
+ * })
22
+ * ```
23
+ */
24
+ predicateWhitelist: string[];
12
25
  }
13
- declare function FiltersForm({ instructions, onSubmit }: FiltersFormProps): JSX.Element;
26
+ declare function FiltersForm({ instructions, predicateWhitelist, onSubmit }: FiltersFormProps): JSX.Element;
14
27
  declare namespace FiltersForm {
15
28
  var displayName: string;
16
29
  }
@@ -21,5 +21,18 @@ export interface FiltersNavProps {
21
21
  * Implemented function should open the filters form.
22
22
  */
23
23
  onFilterClick: (queryString: string, filterPredicate?: string) => void;
24
+ /**
25
+ * By default, we strip out all filters that are not part of the `instructions` array.
26
+ * The option `predicateWhitelist` is used to whitelist a set of predicates that you want to use as filters.
27
+ *
28
+ * @example
29
+ * ```jsx
30
+ * useResourceFilters({
31
+ * instructions,
32
+ * predicateWhitelist: [ 'starts_at_lteq', 'expires_at_gteq', 'starts_at_gt', 'expires_at_lt' ]
33
+ * })
34
+ * ```
35
+ */
36
+ predicateWhitelist: string[];
24
37
  }
25
- export declare function FiltersNav({ instructions, onFilterClick: onBtnLabelClick, onUpdate, queryString }: FiltersNavProps): JSX.Element;
38
+ export declare function FiltersNav({ instructions, onFilterClick: onBtnLabelClick, onUpdate, queryString, predicateWhitelist }: FiltersNavProps): JSX.Element;
@@ -20,8 +20,21 @@ export interface FilterSearchBarProps {
20
20
  * Input placeholder
21
21
  */
22
22
  placeholder?: string;
23
+ /**
24
+ * By default, we strip out all filters that are not part of the `instructions` array.
25
+ * The option `predicateWhitelist` is used to whitelist a set of predicates that you want to use as filters.
26
+ *
27
+ * @example
28
+ * ```jsx
29
+ * useResourceFilters({
30
+ * instructions,
31
+ * predicateWhitelist: [ 'starts_at_lteq', 'expires_at_gteq', 'starts_at_gt', 'expires_at_lt' ]
32
+ * })
33
+ * ```
34
+ */
35
+ predicateWhitelist: string[];
23
36
  }
24
- declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString }: FilterSearchBarProps): JSX.Element;
37
+ declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist }: FilterSearchBarProps): JSX.Element;
25
38
  declare namespace FiltersSearchBar {
26
39
  var displayName: string;
27
40
  }
@@ -4,13 +4,14 @@ export interface AdaptFormValuesToSdkParams<FilterFormValues> {
4
4
  formValues: FilterFormValues;
5
5
  timezone?: string;
6
6
  instructions: FiltersInstructions;
7
+ predicateWhitelist?: string[];
7
8
  }
8
9
  /**
9
10
  * Covert FilterFormValues in SDK filter object
10
11
  * @param formValues a valid FilterFormValues object
11
12
  * @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
12
13
  */
13
- export declare function adaptFormValuesToSdk<FilterFormValues extends Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue>>({ formValues, instructions, timezone }: AdaptFormValuesToSdkParams<FilterFormValues>): QueryFilter;
14
+ export declare function adaptFormValuesToSdk<FilterFormValues extends Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue>>({ formValues, instructions, timezone, predicateWhitelist }: AdaptFormValuesToSdkParams<FilterFormValues>): QueryFilter;
14
15
  export declare function extractEnforcedValues(instructions: FiltersInstructions): QueryFilter;
15
16
  /**
16
17
  * Be sure to have all the default values
@@ -2,10 +2,11 @@ import { type FiltersInstructions, type FormFullValues, type UiFilterName, type
2
2
  export interface AdaptUrlQueryToFormValuesParams {
3
3
  queryString: string;
4
4
  instructions: FiltersInstructions;
5
+ predicateWhitelist?: string[];
5
6
  }
6
7
  /**
7
8
  * Covert query string in filters form values
8
9
  * @param qs url query string
9
10
  * @returns an object containing FilterFormValues
10
11
  */
11
- export declare function adaptUrlQueryToFormValues<FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ queryString, instructions }: AdaptUrlQueryToFormValuesParams): FilterFormValues & FormFullValues;
12
+ export declare function adaptUrlQueryToFormValues<FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ queryString, instructions, predicateWhitelist }: AdaptUrlQueryToFormValuesParams): FilterFormValues & FormFullValues;
@@ -3,6 +3,7 @@ import { type FiltersInstructions } from './types';
3
3
  export interface AdaptUrlQueryToSdkParams {
4
4
  queryString: string;
5
5
  instructions: FiltersInstructions;
6
+ predicateWhitelist?: string[];
6
7
  timezone?: string;
7
8
  }
8
9
  /**
@@ -11,4 +12,4 @@ export interface AdaptUrlQueryToSdkParams {
11
12
  * @returns an object of type QueryFilter to be used in the SDK
12
13
  * stripping out empty or undefined values and enforcing default status_in when empty
13
14
  */
14
- export declare function adaptUrlQueryToSdk({ queryString, instructions, timezone }: AdaptUrlQueryToSdkParams): QueryFilter;
15
+ export declare function adaptUrlQueryToSdk({ queryString, instructions, predicateWhitelist, timezone }: AdaptUrlQueryToSdkParams): QueryFilter;
@@ -2,10 +2,11 @@ import { type FiltersInstructions } from './types';
2
2
  export interface AdaptUrlQueryToUrlQueryParams {
3
3
  queryString: string;
4
4
  instructions: FiltersInstructions;
5
+ predicateWhitelist?: string[];
5
6
  }
6
7
  /**
7
8
  * Parse current URL query string to return a new query string that contains only valid form values
8
9
  * @param qs url query string
9
10
  * @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
10
11
  */
11
- export declare function adaptUrlQueryToUrlQuery({ queryString, instructions }: AdaptUrlQueryToUrlQueryParams): string;
12
+ export declare function adaptUrlQueryToUrlQuery({ queryString, instructions, predicateWhitelist }: AdaptUrlQueryToUrlQueryParams): string;
@@ -7,6 +7,7 @@ import { type AdaptUrlQueryToUrlQueryParams } from './adaptUrlQueryToUrlQuery';
7
7
  import { type FiltersInstructions, type FormFullValues, type PageInfoFormValues, type TimeRangeFormValues, type UiFilterName, type UiFilterValue } from './types';
8
8
  interface MakeFilterAdaptersParams {
9
9
  instructions: FiltersInstructions;
10
+ predicateWhitelist: string[];
10
11
  }
11
12
  interface MakeFilterAdaptersReturn<FilterFormValues extends FormFullValues> {
12
13
  adaptFormValuesToUrlQuery: (params: Pick<AdaptFormValuesToUrlQueryParams<FormFullValues>, 'formValues'>) => string;
@@ -16,5 +17,5 @@ interface MakeFilterAdaptersReturn<FilterFormValues extends FormFullValues> {
16
17
  adaptUrlQueryToUrlQuery: (params: Pick<AdaptUrlQueryToUrlQueryParams, 'queryString'>) => string;
17
18
  validInstructions: FiltersInstructions;
18
19
  }
19
- export type MakeFiltersAdapters = <FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ instructions }: MakeFilterAdaptersParams) => MakeFilterAdaptersReturn<FilterFormValues>;
20
+ export type MakeFiltersAdapters = <FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ instructions, predicateWhitelist }: MakeFilterAdaptersParams) => MakeFilterAdaptersReturn<FilterFormValues>;
20
21
  export {};
@@ -86,9 +86,11 @@ export interface FilterItemTextSearch extends Omit<BaseFilterItem, 'sdk'> {
86
86
  type: 'textSearch';
87
87
  render: {
88
88
  /**
89
- * UI component to render
89
+ * UI component to render.
90
+ *
91
+ * ⚠️ You can have only one `searchBar` component.
90
92
  */
91
- component: 'searchBar';
93
+ component: 'searchBar' | 'input';
92
94
  };
93
95
  sdk: Pick<BaseFilterItem['sdk'], 'predicate'>;
94
96
  }
@@ -12,6 +12,19 @@ interface UseResourceFiltersConfig {
12
12
  * Array of instruction items to build the filters behaviors
13
13
  */
14
14
  instructions: FiltersInstructions;
15
+ /**
16
+ * By default, we strip out all filters that are not part of the `instructions` array.
17
+ * The option `predicateWhitelist` is used to whitelist a set of predicates that you want to use as filters.
18
+ *
19
+ * @example
20
+ * ```jsx
21
+ * useResourceFilters({
22
+ * instructions,
23
+ * predicateWhitelist: [ 'starts_at_lteq', 'expires_at_gteq', 'starts_at_gt', 'expires_at_lt' ]
24
+ * })
25
+ * ```
26
+ */
27
+ predicateWhitelist?: string[];
15
28
  }
16
29
  interface UseResourceFiltersHook {
17
30
  /**
@@ -58,5 +71,5 @@ interface UseResourceFiltersHook {
58
71
  */
59
72
  viewTitle?: string;
60
73
  }
61
- export declare function useResourceFilters({ instructions }: UseResourceFiltersConfig): UseResourceFiltersHook;
74
+ export declare function useResourceFilters({ instructions, predicateWhitelist }: UseResourceFiltersConfig): UseResourceFiltersHook;
62
75
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "1.15.2",
3
+ "version": "1.15.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { type FilterItemOptions, type FilterItemTextSearch } from './types';
3
- interface FieldProps {
4
- item: FilterItemOptions | FilterItemTextSearch;
5
- }
6
- export declare function FieldItem({ item }: FieldProps): JSX.Element | null;
7
- export {};