@storecraft/dashboard 1.0.5 → 1.0.7

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.
Files changed (45) hide show
  1. package/README.md +5 -0
  2. package/dist/lib/index.cjs +350 -332
  3. package/dist/lib/index.js +16255 -15972
  4. package/dist/lib/index.umd.cjs +357 -339
  5. package/dist/lib/src/apps/gallery/gallery.d.ts +8 -0
  6. package/dist/lib/src/comps/collection-products.d.ts +12 -0
  7. package/dist/lib/src/comps/common-button.d.ts +2 -2
  8. package/dist/lib/src/comps/common-fields.d.ts +4 -0
  9. package/dist/lib/src/comps/common-table-fields.d.ts +6 -0
  10. package/dist/lib/src/comps/common-ui.d.ts +3 -0
  11. package/dist/lib/src/comps/copyable-view.d.ts +8 -1
  12. package/dist/lib/src/comps/discount-details.d.ts +5 -5
  13. package/dist/lib/src/comps/discount-filters.d.ts +12 -73
  14. package/dist/lib/src/comps/fields-view.d.ts +28 -1
  15. package/dist/lib/src/comps/home-sales-chart.d.ts +1 -1
  16. package/dist/lib/src/comps/home-stat-card.d.ts +5 -1
  17. package/dist/lib/src/comps/image-editor.d.ts +17 -4
  18. package/dist/lib/src/comps/login-form.d.ts +4 -1
  19. package/dist/lib/src/comps/markdown-card.d.ts +10 -1
  20. package/dist/lib/src/comps/md-view.d.ts +1 -1
  21. package/dist/lib/src/comps/media.d.ts +3 -2
  22. package/dist/lib/src/comps/modal.d.ts +1 -1
  23. package/dist/lib/src/comps/order-line-items.d.ts +1 -1
  24. package/dist/lib/src/comps/order-payment-gateway.d.ts +6 -2
  25. package/dist/lib/src/comps/order-price.d.ts +7 -2
  26. package/dist/lib/src/comps/product-discounts.d.ts +6 -0
  27. package/dist/lib/src/comps/quick-search-browser.d.ts +9 -0
  28. package/dist/lib/src/comps/resource-view.d.ts +10 -0
  29. package/dist/lib/src/comps/select-resource.d.ts +15 -0
  30. package/dist/lib/src/comps/settings-change-password.d.ts +2 -0
  31. package/dist/lib/src/comps/table-schema-view.d.ts +30 -3
  32. package/dist/lib/src/comps/tags-edit.d.ts +1 -1
  33. package/dist/lib/src/comps/template-example-input.d.ts +1 -1
  34. package/dist/lib/src/comps/template-template.d.ts +1 -1
  35. package/dist/lib/src/comps/transition.d.ts +18 -0
  36. package/dist/lib/src/hooks/useCollectionsActions.d.ts +5 -5
  37. package/dist/lib/src/hooks/useDocumentActions.d.ts +6 -4
  38. package/dist/lib/src/hooks/useNavigateWithState.d.ts +9 -0
  39. package/dist/lib/src/pages/index.d.ts +4 -1
  40. package/dist/lib/src/pages/order.d.ts +9 -3
  41. package/dist/website/assets/{index-BfM2PNos.js → index-DSycl0UP.js} +349 -331
  42. package/dist/website/assets/{style-BNtKM1eP.css → style-CN_HKE4z.css} +1 -1
  43. package/dist/website/index.html +3 -3
  44. package/dist/website/localhost_3000_logo.png +0 -0
  45. package/package.json +2 -2
@@ -15,23 +15,38 @@ export function SelectResourceWithTags<T extends import('@storecraft/core/v-api'
15
15
  * If you need something with pagination, try `BrowseCollection` instead.
16
16
  */
17
17
  export type SelectResourceParams<T, TRANSFORM = T> = {
18
+ /**
19
+ * callback when selection is made (value) => any
20
+ */
18
21
  /**
19
22
  * callback when selection is made (value) => any
20
23
  */
21
24
  onSelect: (value: TRANSFORM) => any;
22
25
  header: string;
26
+ /**
27
+ * add all sentinal
28
+ */
23
29
  /**
24
30
  * add all sentinal
25
31
  */
26
32
  add_all?: boolean;
33
+ /**
34
+ * add all sentinal
35
+ */
27
36
  /**
28
37
  * add all sentinal
29
38
  */
30
39
  layout: 0 | 1;
40
+ /**
41
+ * table identifier to query
42
+ */
31
43
  /**
32
44
  * table identifier to query
33
45
  */
34
46
  resource: keyof App["db"]["resources"];
47
+ /**
48
+ * number of item to query
49
+ */
35
50
  /**
36
51
  * number of item to query
37
52
  */
@@ -0,0 +1,2 @@
1
+ export function SettingsChangePassword({ ...rest }: (({ ...rest }: any & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => import("react").JSX.Element) & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>): import("react").JSX.Element;
2
+ export type SettingsChangePasswordParams = object;
@@ -1,6 +1,6 @@
1
1
  export function TableSchemaView<T>({ context, fields, data, recordClassName, className }: {
2
2
  context: any;
3
- fields: TableSchemaViewField<T, keyof T, import('react').FC<TableSchemaViewComponentParams<T, keyof T>>>[];
3
+ fields: TableSchemaViewField<T>[];
4
4
  data: object[];
5
5
  recordClassName?: string;
6
6
  className?: string;
@@ -10,6 +10,9 @@ export function TableSchemaView<T>({ context, fields, data, recordClassName, cla
10
10
  * components of `TableSchemaView`
11
11
  */
12
12
  export type TableSchemaViewContext<T extends import('@storecraft/core/v-api').BaseType> = {
13
+ /**
14
+ * item
15
+ */
13
16
  /**
14
17
  * item
15
18
  */
@@ -21,28 +24,43 @@ export type TableSchemaViewContext<T extends import('@storecraft/core/v-api').Ba
21
24
  /**
22
25
  * infer `params` of `react` functional component
23
26
  */
24
- export type Params<T> = T extends import('react').FC<infer P> ? P : never;
27
+ export type Params<T> = T extends React.FC<infer P> ? P : never;
25
28
  /**
26
29
  * The `field` parameter given to `TableSchemaView`
27
30
  * components
28
31
  */
29
- export type TableSchemaViewField<T extends unknown, Key extends keyof T = keyof T, Comp extends import('react').FC<{}> = import('react').FC<TableSchemaViewComponentParams<T, Key>>> = {
32
+ export type TableSchemaViewField<T extends unknown, Key extends keyof T = keyof T, Comp extends React.FC = import('react').FC<TableSchemaViewComponentParams<T, Key>>> = {
33
+ /**
34
+ * Key of field in the data
35
+ */
30
36
  /**
31
37
  * Key of field in the data
32
38
  */
33
39
  key: Key;
40
+ /**
41
+ * Name of field
42
+ */
34
43
  /**
35
44
  * Name of field
36
45
  */
37
46
  name: string;
47
+ /**
48
+ * Name of field
49
+ */
38
50
  /**
39
51
  * Name of field
40
52
  */
41
53
  comp: React.FC<Params<Comp> & TableSchemaViewComponentParams<T[Key], T>>;
54
+ /**
55
+ * component parameters
56
+ */
42
57
  /**
43
58
  * component parameters
44
59
  */
45
60
  comp_params?: Params<Comp>;
61
+ /**
62
+ * transform data
63
+ */
46
64
  /**
47
65
  * transform data
48
66
  */
@@ -53,14 +71,23 @@ export type TableSchemaViewField<T extends unknown, Key extends keyof T = keyof
53
71
  * `TableSchemaView`
54
72
  */
55
73
  export type TableSchemaViewComponentParams<V extends unknown, T extends unknown = any> = {
74
+ /**
75
+ * Key of field in the data
76
+ */
56
77
  /**
57
78
  * Key of field in the data
58
79
  */
59
80
  field?: TableSchemaViewField<T>;
81
+ /**
82
+ * Context
83
+ */
60
84
  /**
61
85
  * Context
62
86
  */
63
87
  context?: TableSchemaViewContext<T>;
88
+ /**
89
+ * Value of field
90
+ */
64
91
  /**
65
92
  * Value of field
66
93
  */
@@ -1,4 +1,4 @@
1
- export function SelectTags({ onSelect, header, limit, layout, className, clsHeader, clsReload, ...rest }: Omit<import('./select-resource.jsx').SelectResourceParams<import('@storecraft/core/v-api').TagType, string>, 'resource' | 'transform_fn' | 'name_fn'>): import("react").JSX.Element;
1
+ export function SelectTags({ onSelect, header, limit, layout, className, clsHeader, clsReload, ...rest }: Omit<import('./select-resource.jsx').SelectResourceParams<import('@storecraft/core/v-api').TagType, string>, "resource" | "transform_fn" | "name_fn">): import("react").JSX.Element;
2
2
  export default TagsEdit;
3
3
  export type InternalManualTagParams = {
4
4
  onAdd: (values: string[]) => void;
@@ -1,3 +1,3 @@
1
- export function TemplateExampleInput({ field, context, setError, value, onChange, ...rest }: TemplateTemplateParams & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'>): import("react").JSX.Element;
1
+ export function TemplateExampleInput({ field, context, setError, value, onChange, ...rest }: TemplateTemplateParams & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onChange">): import("react").JSX.Element;
2
2
  export default TemplateExampleInput;
3
3
  export type TemplateTemplateParams = import('./fields-view.jsx').FieldLeafViewParams<import('@storecraft/core/v-api').TemplateType["reference_example_input"]>;
@@ -1,4 +1,4 @@
1
- export function TemplateTemplate({ field, context, setError, value, onChange, ...rest }: TemplateTemplateParams & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'>): import("react").JSX.Element;
1
+ export function TemplateTemplate({ field, context, setError, value, onChange, ...rest }: TemplateTemplateParams & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onChange">): import("react").JSX.Element;
2
2
  export default TemplateTemplate;
3
3
  export type DangerousHTMLViewParams = {
4
4
  value?: string | TrustedHTML;
@@ -3,26 +3,44 @@ export type InnerTransitionParams = {
3
3
  show: boolean;
4
4
  unMountOnExit: boolean;
5
5
  duration: number;
6
+ /**
7
+ * class-names for `event`
8
+ */
6
9
  /**
7
10
  * class-names for `event`
8
11
  */
9
12
  enter: string;
13
+ /**
14
+ * class-names for `event`
15
+ */
10
16
  /**
11
17
  * class-names for `event`
12
18
  */
13
19
  enterFrom: string;
20
+ /**
21
+ * class-names for `event`
22
+ */
14
23
  /**
15
24
  * class-names for `event`
16
25
  */
17
26
  enterTo: string;
27
+ /**
28
+ * class-names for `event`
29
+ */
18
30
  /**
19
31
  * class-names for `event`
20
32
  */
21
33
  leave: string;
34
+ /**
35
+ * class-names for `event`
36
+ */
22
37
  /**
23
38
  * class-names for `event`
24
39
  */
25
40
  leaveFrom: string;
41
+ /**
42
+ * class-names for `event`
43
+ */
26
44
  /**
27
45
  * class-names for `event`
28
46
  */
@@ -3,7 +3,7 @@ export default useCollectionsActions;
3
3
  /**
4
4
  * This `type` will give you the return type of the hook
5
5
  */
6
- export type HookReturnType<T> = Omit<ReturnType<typeof useCollectionsActions<T>>, 'page' | 'pages'> & {
6
+ export type HookReturnType<T> = Omit<ReturnType<typeof useCollectionsActions<T>>, "page" | "pages"> & {
7
7
  page: T[];
8
8
  pages: T[][];
9
9
  };
@@ -27,15 +27,15 @@ export type HookReturnType<T> = Omit<ReturnType<typeof useCollectionsActions<T>>
27
27
  *
28
28
  * This hook wraps `useCollection` hook
29
29
  *
30
- * @template {Partial<import('@storecraft/core/v-api').BaseType>} T
30
+ * @template {Partial<import('@storecraft/core/v-api').BaseType> | any} [T=any]
31
31
  *
32
32
  * @param {((keyof App["db"]["resources"]) | 'payments/gateways' | 'extensions')} resource the collection id in backend
33
33
  * @param {string} [slug] front end slug
34
34
  * @param {boolean} [autoLoad=true]
35
35
  * @param {import('@storecraft/core/v-api').ApiQuery} [autoLoadQuery=q_initial]
36
36
  */
37
- declare function useCollectionsActions<T extends Partial<import('@storecraft/core/v-api').BaseType>>(resource: ((keyof App["db"]["resources"]) | 'payments/gateways' | 'extensions'), slug?: string, autoLoad?: boolean, autoLoadQuery?: import('@storecraft/core/v-api').ApiQuery): {
38
- resource: "search" | "products" | "collections" | "discounts" | "tags" | "shipping_methods" | "posts" | "auth_users" | "customers" | "storefronts" | "images" | "templates" | "notifications" | "orders" | "extensions" | "payments/gateways";
37
+ declare function useCollectionsActions<T extends unknown = any>(resource: ((keyof App["db"]["resources"]) | "payments/gateways" | "extensions"), slug?: string, autoLoad?: boolean, autoLoadQuery?: import('@storecraft/core/v-api').ApiQuery): {
38
+ resource: "search" | "auth_users" | "tags" | "collections" | "customers" | "products" | "storefronts" | "images" | "posts" | "templates" | "shipping_methods" | "notifications" | "discounts" | "orders" | "payments/gateways" | "extensions";
39
39
  query_api: import('@storecraft/core/v-api').ApiQuery;
40
40
  ref_actions: import('react').MutableRefObject<import('../comps/collection-actions.jsx').ImperativeInterface>;
41
41
  context: {
@@ -56,7 +56,7 @@ declare function useCollectionsActions<T extends Partial<import('@storecraft/cor
56
56
  limit: number;
57
57
  vql: string;
58
58
  expand?: import('@storecraft/core/v-api').ExpandQuery;
59
- vqlParsed?: import("@storecraft/core/v-ql").VQL.Node;
59
+ vqlParsed?: import("@storecraft/core/v-ql").VQL.AST;
60
60
  sortBy?: import('@storecraft/core/v-api').SortCursor;
61
61
  order?: import('@storecraft/core/v-api').SortOrder;
62
62
  }>;
@@ -1,11 +1,12 @@
1
1
  import { App } from '@storecraft/core';
2
- export function useDocumentActions<T extends {}>(resource: (keyof App["db"]["resources"] | 'payments/gateways' | 'extensions'), document: string, slug: string, mode?: DocumentActionsMode, base?: string): {
2
+ export function useDocumentActions<T>(resource: (keyof App["db"]["resources"] | "payments/gateways" | "extensions"), document: string, slug: string, mode?: DocumentActionsMode, base?: string): {
3
3
  actions: {
4
4
  reloadPromise: (try_cache?: boolean) => Promise<void>;
5
+ reload_hard: import('react').MutableRefObject<(try_cache?: boolean) => Promise<T>>;
5
6
  savePromise: () => Promise<T>;
6
7
  deletePromise: () => Promise<string>;
7
8
  duplicate: (state_next_extra?: Partial<T>) => Promise<void>;
8
- navWithState: (to: import('react-router').To, current_state?: any, next_state?: any) => void;
9
+ navWithState: (to: import('react-router').To, current_state?: (() => any) | any, next_state?: (() => any) | any) => void;
9
10
  reload: (try_cache?: boolean) => Promise<T>;
10
11
  setError: import('react').Dispatch<any>;
11
12
  };
@@ -18,6 +19,7 @@ export function useDocumentActions<T extends {}>(resource: (keyof App["db"]["res
18
19
  isEditMode: boolean;
19
20
  isCreateMode: boolean;
20
21
  isViewMode: boolean;
22
+ op: import('@storecraft/sdk-react-hooks').Op;
21
23
  loading: boolean;
22
24
  hasChanged: any;
23
25
  hasLoaded: boolean;
@@ -29,7 +31,7 @@ export function useDocumentActions<T extends {}>(resource: (keyof App["db"]["res
29
31
  /**
30
32
  * This `type` will give you the return type of the hook
31
33
  */
32
- export type HookReturnType<T> = Omit<ReturnType<typeof useDocumentActions<T>>, 'doc'> & {
34
+ export type HookReturnType<T> = Omit<ReturnType<typeof useDocumentActions<T>>, "doc"> & {
33
35
  doc: T;
34
36
  };
35
- export type DocumentActionsMode = 'edit' | 'view' | 'create';
37
+ export type DocumentActionsMode = "edit" | "view" | "create";
@@ -2,14 +2,23 @@ export function LinkWithState({ to, current_state, next_state, onClick, ...rest
2
2
  export default useNavigateWithState;
3
3
  export type Params = {
4
4
  to: import('react-router-dom').To;
5
+ /**
6
+ * object or function
7
+ */
5
8
  /**
6
9
  * object or function
7
10
  */
8
11
  current_state: () => any | object;
12
+ /**
13
+ * object or function
14
+ */
9
15
  /**
10
16
  * object or function
11
17
  */
12
18
  next_state?: () => any | object;
19
+ /**
20
+ * callback
21
+ */
13
22
  /**
14
23
  * callback
15
24
  */
@@ -28,7 +28,10 @@ export type BaseDocumentState<T extends unknown = any> = {
28
28
  hasChanged?: boolean;
29
29
  data?: T;
30
30
  };
31
- export type BaseDocumentContext<State extends BaseDocumentState<any> = any> = {
31
+ export type BaseDocumentContext<State extends BaseDocumentState = any> = {
32
+ /**
33
+ * Get the values of the `fields-view` tree
34
+ */
32
35
  /**
33
36
  * Get the values of the `fields-view` tree
34
37
  */
@@ -3,13 +3,19 @@ declare function _default({ mode, ...rest }: {
3
3
  }): import("react").JSX.Element;
4
4
  export default _default;
5
5
  /**
6
- * Intrinsic state of `tag`
6
+ * Intrinsic state of `order`
7
7
  */
8
8
  export type State = {
9
9
  data: import('@storecraft/core/v-api').OrderData;
10
10
  hasChanged: boolean;
11
11
  };
12
12
  /**
13
- * Public `tag` context
13
+ * Inner `order` context
14
14
  */
15
- export type Context = import('./index.jsx').BaseDocumentContext<State>;
15
+ export type InnerContext = {
16
+ create_checkout: (gateay: string) => Promise<any>;
17
+ };
18
+ /**
19
+ * Public `order` context
20
+ */
21
+ export type Context = import('./index.jsx').BaseDocumentContext<State> & InnerContext;