@plasmicpkgs/commerce 0.0.8 → 0.0.11

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,10 +1,17 @@
1
1
  import { Product } from "./types/product";
2
2
  import React from "react";
3
+ import { Category } from "./types/site";
3
4
  export declare const ProductContext: React.Context<Product | undefined>;
4
5
  export declare const ProductFormContext: React.Context<any>;
6
+ export declare const CategoryContext: React.Context<Category | undefined>;
5
7
  export declare function ProductProvider({ product, children }: {
6
8
  product: Product;
7
9
  children: React.ReactNode;
8
10
  }): JSX.Element;
9
- export declare function useProduct(): Product | undefined;
10
- export declare function useProductForm(): any;
11
+ export declare const useProduct: () => Product;
12
+ export declare const useProductForm: () => any;
13
+ export declare function CategoryProvider({ category, children }: {
14
+ category: Category;
15
+ children: React.ReactNode;
16
+ }): JSX.Element;
17
+ export declare const useCategoryContext: () => Category | undefined;
package/dist/index.d.ts CHANGED
@@ -34,4 +34,6 @@ export * from "./registerProductPrice";
34
34
  export * from "./registerProductQuantity";
35
35
  export * from "./registerProductTextField";
36
36
  export * from "./registerProductVariantPicker";
37
+ export * from "./registerCategoryCollection";
38
+ export * from "./registerCategoryField";
37
39
  export declare function registerAll(loader?: Registerable): void;
@@ -3,8 +3,9 @@ import { Registerable } from "./registerable";
3
3
  interface CartProps {
4
4
  className?: string;
5
5
  field: string;
6
+ hideIfIsEmpty?: boolean;
6
7
  }
7
8
  export declare const cartMeta: ComponentMeta<CartProps>;
8
- export declare function CartComponent(props: CartProps): JSX.Element;
9
+ export declare function CartComponent(props: CartProps): JSX.Element | null;
9
10
  export declare function registerCart(loader?: Registerable, customCartMeta?: ComponentMeta<CartProps>): void;
10
11
  export {};
@@ -0,0 +1,19 @@
1
+ import { ComponentMeta } from "@plasmicapp/host/registerComponent";
2
+ import React from "react";
3
+ import { Registerable } from "./registerable";
4
+ import { Category } from "./types/site";
5
+ interface CategoryCollectionProps {
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ emptyMessage?: React.ReactNode;
9
+ loadingMessage?: React.ReactNode;
10
+ noLayout?: boolean;
11
+ category?: string;
12
+ setControlContextData?: (data: {
13
+ categories: Category[];
14
+ }) => void;
15
+ }
16
+ export declare const categoryCollectionMeta: ComponentMeta<CategoryCollectionProps>;
17
+ export declare function CategoryCollection(props: CategoryCollectionProps): JSX.Element | null;
18
+ export declare function registerCategoryCollection(loader?: Registerable, customCategoryCollectionMeta?: ComponentMeta<CategoryCollectionProps>): void;
19
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ComponentMeta } from "@plasmicapp/host/registerComponent";
2
+ import { Registerable } from "./registerable";
3
+ interface CategoryFieldProps {
4
+ className?: string;
5
+ field?: string;
6
+ }
7
+ export declare const categoryFieldMeta: ComponentMeta<CategoryFieldProps>;
8
+ export declare function CategoryField(props: CategoryFieldProps): JSX.Element;
9
+ export declare function registerCategoryField(loader?: Registerable, customCategoryFieldMeta?: ComponentMeta<CategoryFieldProps>): void;
10
+ export {};
@@ -6,6 +6,8 @@ import { CommerceExtraFeatures } from "./utils/types";
6
6
  interface ProductCollectionProps {
7
7
  className?: string;
8
8
  children?: React.ReactNode;
9
+ emptyMessage?: React.ReactNode;
10
+ loadingMessage?: React.ReactNode;
9
11
  count?: number;
10
12
  category?: string;
11
13
  includeSubCategories?: boolean;
@@ -15,9 +17,10 @@ interface ProductCollectionProps {
15
17
  categories: Category[];
16
18
  brands: Brand[];
17
19
  features?: CommerceExtraFeatures;
20
+ hasCategoryCtx?: boolean;
18
21
  }) => void;
19
22
  }
20
23
  export declare const productCollectionMeta: ComponentMeta<ProductCollectionProps>;
21
- export declare function ProductCollection(props: ProductCollectionProps): JSX.Element;
24
+ export declare function ProductCollection(props: ProductCollectionProps): JSX.Element | null;
22
25
  export declare function registerProductCollection(loader?: Registerable, customProductCollectionMeta?: ComponentMeta<ProductCollectionProps>): void;
23
26
  export {};
@@ -3,6 +3,7 @@ export declare type Category = {
3
3
  name: string;
4
4
  slug: string;
5
5
  path: string;
6
+ isEmpty?: boolean;
6
7
  };
7
8
  export declare type Brand = {
8
9
  name: string;
@@ -16,6 +17,7 @@ export declare type SiteTypes = {
16
17
  category: Category;
17
18
  brand: Brand;
18
19
  searchBody: SearchSiteInfoBody;
20
+ getCategoriesBody: GetCategoriesBody;
19
21
  };
20
22
  export declare type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
21
23
  data: {
@@ -23,10 +25,15 @@ export declare type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
23
25
  brands: T['brand'][];
24
26
  };
25
27
  };
28
+ export declare type GetCategoriesBody = {
29
+ topologicalSort?: boolean;
30
+ addIsEmptyField?: boolean;
31
+ categoryId?: string;
32
+ };
26
33
  export declare type GetCategoriesHook<T extends SiteTypes = SiteTypes> = {
27
- data: T['category'][] | null;
28
- input: {};
29
- fetcherInput: {};
34
+ data: T['category'][];
35
+ input: T['getCategoriesBody'];
36
+ fetcherInput: T['getCategoriesBody'];
30
37
  swrState: {
31
38
  isEmpty: boolean;
32
39
  };
@@ -0,0 +1,2 @@
1
+ import { Product } from "../types/product";
2
+ export declare const defaultProduct: Product;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicpkgs/commerce",
3
- "version": "0.0.8",
3
+ "version": "0.0.11",
4
4
  "description": "Plasmic registration calls for commerce components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "analyze": "size-limit --why"
19
19
  },
20
20
  "devDependencies": {
21
- "@plasmicapp/host": "^1.0.38",
21
+ "@plasmicapp/host": "1.0.40",
22
22
  "@size-limit/preset-small-lib": "^4.11.0",
23
23
  "@types/js-cookie": "^3.0.1",
24
24
  "@types/node": "^14.0.26",
@@ -39,5 +39,5 @@
39
39
  "react-hook-form": "^7.28.0",
40
40
  "swr": "^1.2.2"
41
41
  },
42
- "gitHead": "85308892b93b18d913f32ead0a92f7999741f245"
42
+ "gitHead": "a7eeb747553a1283da9d51b203daf50f3e69682f"
43
43
  }