swell-js 5.3.0 → 5.4.1

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/api.mjs CHANGED
@@ -446,7 +446,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
446
446
  const api = {};
447
447
 
448
448
  Object.assign(api, {
449
- version: '5.3.0',
449
+ version: '5.4.1',
450
450
  options,
451
451
  request,
452
452
 
package/dist/swell.cjs CHANGED
@@ -12172,7 +12172,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
12172
12172
  const api = {};
12173
12173
 
12174
12174
  Object.assign(api, {
12175
- version: '5.3.0',
12175
+ version: '5.4.1',
12176
12176
  options,
12177
12177
  request,
12178
12178
 
@@ -17617,7 +17617,7 @@
17617
17617
  const api = {};
17618
17618
 
17619
17619
  Object.assign(api, {
17620
- version: '5.3.0',
17620
+ version: '5.4.1',
17621
17621
  options,
17622
17622
  request,
17623
17623
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swell-js",
3
- "version": "5.3.0",
3
+ "version": "5.4.1",
4
4
  "description": "Swell JS library for client-side stores",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -1,7 +1,11 @@
1
- import type { ConvertSnakeToCamelCase, ResultsResponseCamel } from '..';
1
+ import type {
2
+ ConvertSnakeToCamelCase,
3
+ ResultsResponseCamel,
4
+ ImageCamel,
5
+ } from '..';
2
6
  import type { Replace } from '../utils';
3
7
 
4
- import type { ProductCamel, ImageCamel } from '../product/camel';
8
+ import type { ProductCamel } from '../product/camel';
5
9
 
6
10
  import type { Category } from './snake';
7
11
 
@@ -1,6 +1,6 @@
1
- import type { BaseModel, ResultsResponse } from '..';
1
+ import type { BaseModel, ResultsResponse, Image } from '..';
2
2
 
3
- import type { Image, Product } from '../product';
3
+ import type { Product } from '../product';
4
4
 
5
5
  export interface Category extends BaseModel {
6
6
  active?: boolean;
@@ -1,6 +1,37 @@
1
- import type { ConvertSnakeToCamelCase } from '..';
1
+ import type { ConvertSnakeToCamelCase, ImageCamel } from '..';
2
+ import type { Replace } from '../utils';
2
3
 
3
- import type { Content, ContentSection } from './snake';
4
+ import type { CategoryCamel } from '../category';
5
+ import type { UserCamel } from '../user';
6
+
7
+ import type {
8
+ Content,
9
+ ContentSection,
10
+ ContentPage,
11
+ ContentBlog,
12
+ ContentBlogCategory,
13
+ } from './snake';
4
14
 
5
15
  export type ContentCamel = ConvertSnakeToCamelCase<Content>;
6
16
  export type ContentSectionCamel = ConvertSnakeToCamelCase<ContentSection>;
17
+ export type ContentPageCamel = ConvertSnakeToCamelCase<ContentPage>;
18
+
19
+ export type ContentBlogCamel = ConvertSnakeToCamelCase<
20
+ Replace<
21
+ ContentBlog,
22
+ {
23
+ author?: UserCamel;
24
+ category?: CategoryCamel;
25
+ image?: ImageCamel;
26
+ }
27
+ >
28
+ >;
29
+
30
+ export type ContentBlogCategoryCamel = ConvertSnakeToCamelCase<
31
+ Replace<
32
+ ContentBlogCategory,
33
+ {
34
+ blogs?: ContentBlogCamel[];
35
+ }
36
+ >
37
+ >;
@@ -1,8 +1,38 @@
1
1
  import type { MakeCase } from '../utils';
2
2
 
3
- import type { Content, ContentSection } from './snake';
4
- import type { ContentCamel, ContentSectionCamel } from './camel';
3
+ import type {
4
+ Content,
5
+ ContentSection,
6
+ ContentPage,
7
+ ContentBlog,
8
+ ContentBlogCategory,
9
+ } from './snake';
10
+ import type {
11
+ ContentCamel,
12
+ ContentSectionCamel,
13
+ ContentPageCamel,
14
+ ContentBlogCamel,
15
+ ContentBlogCategoryCamel,
16
+ } from './camel';
5
17
 
6
18
  export type ContentCase = MakeCase<Content, ContentCamel>;
19
+ export type ContentSectionCase = MakeCase<ContentSection, ContentSectionCamel>;
20
+ export type ContentPageCase = MakeCase<ContentPage, ContentPageCamel>;
21
+ export type ContentBlogCase = MakeCase<ContentBlog, ContentBlogCamel>;
22
+ export type ContentBlogCategoryCase = MakeCase<
23
+ ContentBlogCategory,
24
+ ContentBlogCategoryCamel
25
+ >;
7
26
 
8
- export type { Content, ContentSection, ContentCamel, ContentSectionCamel };
27
+ export type {
28
+ Content,
29
+ ContentSection,
30
+ ContentPage,
31
+ ContentBlog,
32
+ ContentBlogCategory,
33
+ ContentCamel,
34
+ ContentSectionCamel,
35
+ ContentPageCamel,
36
+ ContentBlogCamel,
37
+ ContentBlogCategoryCamel,
38
+ };
@@ -1,4 +1,7 @@
1
- import type { BaseModel } from '..';
1
+ import type { BaseModel, Image } from '..';
2
+
3
+ import type { Category } from '../category';
4
+ import type { User } from '../user';
2
5
 
3
6
  export interface ContentSection {
4
7
  id: string;
@@ -15,3 +18,43 @@ export interface Content extends BaseModel {
15
18
  slug?: string;
16
19
  sections?: ContentSection[];
17
20
  }
21
+
22
+ export interface ContentPage extends BaseModel {
23
+ title: string;
24
+ slug: string;
25
+ name?: string;
26
+ content?: string;
27
+ published?: boolean;
28
+ date_published?: string;
29
+ meta_title?: string;
30
+ meta_description?: string;
31
+ meta_keywords?: string;
32
+ theme_template?: string;
33
+ }
34
+
35
+ export interface ContentBlog extends BaseModel {
36
+ title: string;
37
+ slug: string;
38
+ author_id: string;
39
+ author?: User;
40
+ category_id: string;
41
+ category?: Category;
42
+ content?: string;
43
+ summary?: string;
44
+ image?: Image;
45
+ tags?: string[];
46
+ published?: boolean;
47
+ meta_title?: string;
48
+ meta_description?: string;
49
+ meta_keywords?: string;
50
+ theme_template?: string;
51
+ }
52
+
53
+ export interface ContentBlogCategory extends BaseModel {
54
+ title: string;
55
+ slug: string;
56
+ blogs?: ContentBlog[];
57
+ meta_title?: string;
58
+ meta_description?: string;
59
+ meta_keywords?: string;
60
+ }
@@ -1,4 +1,10 @@
1
- export type { Discount, DiscountRule, DiscountRuleBuyGetItem } from './snake';
1
+ export type {
2
+ Discount,
3
+ DiscountRule,
4
+ DiscountRuleBuyGetItem,
5
+ DiscountRuleBuyGetProduct,
6
+ DiscountRuleBuyGetCategory,
7
+ } from './snake';
2
8
 
3
9
  export type {
4
10
  DiscountCamel,
package/types/index.d.ts CHANGED
@@ -162,6 +162,25 @@ export interface ItemDiscount {
162
162
  amount?: number;
163
163
  }
164
164
 
165
+ export interface Image {
166
+ caption?: string;
167
+ file?: {
168
+ content_type?: string;
169
+ date_uploaded?: string;
170
+ filename?: string;
171
+ height?: number;
172
+ length?: number;
173
+ metadata?: object;
174
+ md5?: string;
175
+ private?: boolean;
176
+ url?: string;
177
+ width?: number;
178
+ };
179
+ id?: string;
180
+ }
181
+
182
+ export type ImageCamel = ConvertSnakeToCamelCase<Image>;
183
+
165
184
  export interface SwellError {
166
185
  code: string;
167
186
  message: string;
@@ -1,4 +1,8 @@
1
- import type { ConvertSnakeToCamelCase, ResultsResponseCamel } from '..';
1
+ import type {
2
+ ConvertSnakeToCamelCase,
3
+ ResultsResponseCamel,
4
+ ImageCamel,
5
+ } from '..';
2
6
  import type { Replace } from '../utils';
3
7
 
4
8
  import type { AttributeCamel } from '../attribute/camel';
@@ -6,7 +10,6 @@ import type { AttributeCamel } from '../attribute/camel';
6
10
  import type {
7
11
  Product,
8
12
  Variant,
9
- Image,
10
13
  Price,
11
14
  Upsell,
12
15
  ProductOption,
@@ -54,7 +57,6 @@ export type ProductOptionCamel = ConvertSnakeToCamelCase<
54
57
  >;
55
58
 
56
59
  export type UpsellCamel = ConvertSnakeToCamelCase<Upsell>;
57
- export type ImageCamel = ConvertSnakeToCamelCase<Image>;
58
60
  export type PriceCamel = ConvertSnakeToCamelCase<Price>;
59
61
 
60
62
  export type VariantCamel = ConvertSnakeToCamelCase<
@@ -2,9 +2,9 @@ import type { ResultsResponse, ResultsResponseCamel } from '../index';
2
2
  import type { MakeCase } from '../utils';
3
3
 
4
4
  import type {
5
+ ContentObject,
5
6
  Product,
6
7
  Variant,
7
- Image,
8
8
  Price,
9
9
  Upsell,
10
10
  ProductOption,
@@ -16,7 +16,6 @@ import type {
16
16
  import type {
17
17
  ProductCamel,
18
18
  VariantCamel,
19
- ImageCamel,
20
19
  PriceCamel,
21
20
  UpsellCamel,
22
21
  ProductOptionCamel,
@@ -51,9 +50,9 @@ export interface PurchaseOptions {
51
50
  export type ProductCase = MakeCase<Product, ProductCamel>;
52
51
 
53
52
  export type {
53
+ ContentObject,
54
54
  Product,
55
55
  Variant,
56
- Image,
57
56
  Price,
58
57
  Upsell,
59
58
  ProductOption,
@@ -62,7 +61,6 @@ export type {
62
61
  CrossSell,
63
62
  ProductCamel,
64
63
  VariantCamel,
65
- ImageCamel,
66
64
  PriceCamel,
67
65
  UpsellCamel,
68
66
  ProductOptionCamel,
@@ -1,4 +1,4 @@
1
- import type { BaseModel, ResultsResponse } from '../index';
1
+ import type { BaseModel, ResultsResponse, Image } from '../index';
2
2
 
3
3
  import type { Attribute } from '../attribute';
4
4
 
@@ -70,23 +70,6 @@ export interface Upsell {
70
70
  product_id?: string;
71
71
  }
72
72
 
73
- export interface Image {
74
- caption?: string;
75
- file?: {
76
- content_type?: string;
77
- date_uploaded?: string;
78
- filename?: string;
79
- height?: number;
80
- length?: number;
81
- metadata?: object;
82
- md5?: string;
83
- private?: boolean;
84
- url?: string;
85
- width?: number;
86
- };
87
- id?: string;
88
- }
89
-
90
73
  export interface Price {
91
74
  account_group?: string;
92
75
  price?: number;
@@ -0,0 +1,4 @@
1
+ import type { ConvertSnakeToCamelCase } from '..';
2
+ import type { User } from './snake';
3
+
4
+ export type UserCamel = ConvertSnakeToCamelCase<User>;
@@ -0,0 +1,8 @@
1
+ import type { MakeCase } from '../utils';
2
+
3
+ import type { User } from './snake';
4
+ import type { UserCamel } from './camel';
5
+
6
+ export type UserCase = MakeCase<User, UserCamel>;
7
+
8
+ export type { User, UserCamel };
@@ -0,0 +1,6 @@
1
+ import type { BaseModel } from '..';
2
+
3
+ export interface User extends BaseModel {
4
+ name?: string;
5
+ email?: string;
6
+ }