swell-js 3.19.2 → 3.19.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.
Files changed (42) hide show
  1. package/dist/{api-896f20cf.js → api-f858ecd2.js} +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/swell.cjs.js +1 -1
  5. package/dist/swell.umd.min.js +1 -1
  6. package/package.json +3 -2
  7. package/types/account/camel.d.ts +12 -0
  8. package/types/account/index.d.ts +8 -0
  9. package/types/account/snake.d.ts +51 -0
  10. package/types/attribute/camel.d.ts +6 -0
  11. package/types/attribute/index.d.ts +4 -0
  12. package/types/attribute/snake.d.ts +37 -0
  13. package/types/card/camel.d.ts +12 -0
  14. package/types/card/index.d.ts +8 -0
  15. package/types/card/snake.d.ts +40 -0
  16. package/types/cart/camel.d.ts +9 -0
  17. package/types/cart/index.d.ts +5 -0
  18. package/types/cart/snake.d.ts +112 -0
  19. package/types/category/camel.d.ts +6 -0
  20. package/types/category/index.d.ts +4 -0
  21. package/types/category/snake.d.ts +24 -0
  22. package/types/content/camel.d.ts +9 -0
  23. package/types/content/index.d.ts +7 -0
  24. package/types/content/snake.d.ts +16 -0
  25. package/types/currency/camel.d.ts +16 -0
  26. package/types/currency/index.d.ts +18 -0
  27. package/types/currency/snake.d.ts +22 -0
  28. package/types/index.d.ts +269 -0
  29. package/types/locale/index.d.ts +5 -0
  30. package/types/order/camel.d.ts +9 -0
  31. package/types/order/index.d.ts +5 -0
  32. package/types/order/snake.d.ts +167 -0
  33. package/types/payment/camel.d.ts +6 -0
  34. package/types/payment/index.d.ts +46 -0
  35. package/types/payment/snake.d.ts +42 -0
  36. package/types/product/camel.d.ts +43 -0
  37. package/types/product/index.d.ts +49 -0
  38. package/types/product/snake.d.ts +170 -0
  39. package/types/settings/index.d.ts +10 -0
  40. package/types/subscription/camel.d.ts +6 -0
  41. package/types/subscription/index.d.ts +4 -0
  42. package/types/subscription/snake.d.ts +123 -0
@@ -23,7 +23,7 @@ const options = {
23
23
  };
24
24
 
25
25
  const api = {
26
- version: '3.19.2',
26
+ version: '3.19.3',
27
27
  options,
28
28
  request,
29
29
 
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-896f20cf.js';
1
+ export { a as default } from './api-f858ecd2.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-896f20cf.js';
1
+ export { a as default } from './api-f858ecd2.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
package/dist/swell.cjs.js CHANGED
@@ -7655,7 +7655,7 @@ const options = {
7655
7655
  };
7656
7656
 
7657
7657
  const api = {
7658
- version: '3.19.2',
7658
+ version: '3.19.3',
7659
7659
  options,
7660
7660
  request,
7661
7661
 
@@ -12128,7 +12128,7 @@
12128
12128
  previewContent: null
12129
12129
  };
12130
12130
  const api = {
12131
- version: "3.19.2",
12131
+ version: "3.19.3",
12132
12132
  options,
12133
12133
  request,
12134
12134
  init(store, key, opt = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swell-js",
3
- "version": "3.19.2",
3
+ "version": "3.19.3",
4
4
  "description": "Swell JS library for client-side stores",
5
5
  "engines": {
6
6
  "node": ">=14.19.1",
@@ -16,7 +16,8 @@
16
16
  "browser": "./dist/swell.umd.min.js",
17
17
  "types": "./types/index.d.ts",
18
18
  "files": [
19
- "dist"
19
+ "dist",
20
+ "types"
20
21
  ],
21
22
  "dependencies": {
22
23
  "deepmerge": "4.2.2",
@@ -0,0 +1,12 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { PasswordTokenInputSnake, AccountSnake, AddressSnake } from './snake';
3
+
4
+ export type PasswordTokenInputCamel = {
5
+ [K in keyof PasswordTokenInputSnake as SnakeToCamelCase<K>]: PasswordTokenInputSnake[K];
6
+ };
7
+ export type AccountCamel = {
8
+ [K in keyof AccountSnake as SnakeToCamelCase<K>]: AccountSnake[K];
9
+ };
10
+ export type AddressCamel = {
11
+ [K in keyof AddressSnake as SnakeToCamelCase<K>]: AddressSnake[K];
12
+ };
@@ -0,0 +1,8 @@
1
+ import { AccountSnake, AddressSnake, PasswordTokenInputSnake } from './snake';
2
+ import { AccountCamel, AddressCamel, PasswordTokenInputCamel } from './camel';
3
+
4
+ interface PasswordTokenInput
5
+ extends PasswordTokenInputSnake,
6
+ PasswordTokenInputCamel {}
7
+ interface Account extends AccountSnake, AccountCamel {}
8
+ interface Address extends AddressSnake, AddressCamel {}
@@ -0,0 +1,51 @@
1
+ import { BaseModel } from '..';
2
+ import { Subscription } from '../subscription';
3
+ import { Card } from '../card';
4
+ import { Order } from '../order';
5
+
6
+ interface PasswordTokenInputSnake {
7
+ password_token?: string;
8
+ }
9
+
10
+ interface AccountSnake extends BaseModel {
11
+ addresses?: AddressSnake[];
12
+ balance?: number;
13
+ billing?: AddressSnake;
14
+ cards?: Card[];
15
+ date_first_order?: string;
16
+ date_last_order?: string;
17
+ email?: string;
18
+ email_optin?: boolean;
19
+ first_name?: string;
20
+ group?: string;
21
+ last_name?: string;
22
+ metadata?: object;
23
+ name?: string;
24
+ orders?: Order[];
25
+ order_count?: number;
26
+ order_value?: number;
27
+ password?: string;
28
+ password_reset_url?: string;
29
+ phone?: string;
30
+ shipping?: AddressSnake;
31
+ subscriptions?: Subscription[];
32
+ type?: string;
33
+ vat_number?: string;
34
+ }
35
+
36
+ interface AddressSnake extends BaseModel {
37
+ active?: boolean;
38
+ address1: string;
39
+ address2?: string;
40
+ city?: string;
41
+ company?: string;
42
+ country?: string;
43
+ fingerprint?: string;
44
+ first_name?: string;
45
+ last_name?: string;
46
+ name?: string;
47
+ parent_id?: string;
48
+ phone?: string;
49
+ state?: string;
50
+ zip?: string;
51
+ }
@@ -0,0 +1,6 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { AttributeSnake } from './snake';
3
+
4
+ export type AttributeCamel = {
5
+ [K in keyof AttributeSnake as SnakeToCamelCase<K>]: AttributeSnake[K];
6
+ };
@@ -0,0 +1,4 @@
1
+ import { AttributeCamel } from './camel';
2
+ import { AttributeSnake } from './snake';
3
+
4
+ export interface Attribute extends AttributeCamel, AttributeSnake {}
@@ -0,0 +1,37 @@
1
+ import { BaseModel } from '..';
2
+ import { Product } from '../product';
3
+
4
+ export interface AttributeSnake extends BaseModel {
5
+ default?: string | null | number | boolean | object;
6
+ filterable?: boolean;
7
+ localized?: boolean;
8
+ multi?: boolean;
9
+ name?: string;
10
+ products?: Product[];
11
+ required?: boolean;
12
+ searchable?: boolean;
13
+ type?:
14
+ | 'asset'
15
+ | 'boolean'
16
+ | 'checkbox'
17
+ | 'collection'
18
+ | 'date'
19
+ | 'currency'
20
+ | 'dropdown'
21
+ | 'field_group'
22
+ | 'file'
23
+ | 'icon'
24
+ | 'image'
25
+ | 'long_text'
26
+ | 'lookup'
27
+ | 'number'
28
+ | 'radio'
29
+ | 'select'
30
+ | 'short_text'
31
+ | 'tags'
32
+ | 'text'
33
+ | 'textarea';
34
+ values?: string[];
35
+ variant?: boolean;
36
+ visible?: boolean;
37
+ }
@@ -0,0 +1,12 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { CardSnake, InputCreateTokenSnake, TokenResponseSnake } from './snake';
3
+
4
+ export type CardCamel = {
5
+ [K in keyof CardSnake as SnakeToCamelCase<K>]: CardSnake[K];
6
+ };
7
+ export type InputCreateTokenCamel = {
8
+ [K in keyof InputCreateTokenSnake as SnakeToCamelCase<K>]: InputCreateTokenSnake[K];
9
+ };
10
+ export type TokenResponseCamel = {
11
+ [K in keyof TokenResponseSnake as SnakeToCamelCase<K>]: TokenResponseSnake[K];
12
+ };
@@ -0,0 +1,8 @@
1
+ import { CardSnake, InputCreateTokenSnake, TokenResponseSnake } from './snake';
2
+ import { CardCamel, InputCreateTokenCamel, TokenResponseCamel } from './camel';
3
+
4
+ interface InputCreateToken
5
+ extends InputCreateTokenSnake,
6
+ InputCreateTokenCamel {}
7
+ interface TokenResponse extends TokenResponseSnake, TokenResponseCamel {}
8
+ interface Card extends CardCamel, CardSnake {}
@@ -0,0 +1,40 @@
1
+ import { BaseModel } from '..';
2
+ import { Account } from '../account';
3
+
4
+ interface InputCreateTokenSnake {
5
+ account_id?: string;
6
+ billing?: object; // TODO: Add billing
7
+ cvc?: number;
8
+ exp_month?: number;
9
+ exp_year?: number;
10
+ number?: string;
11
+ }
12
+
13
+ interface TokenResponseSnake {
14
+ address_check?: 'pass' | 'failed' | 'checked' | 'unchecked';
15
+ brand?: string;
16
+ cvc_check?: 'pass' | 'failed' | 'checked' | 'unchecked';
17
+ exp_month?: number;
18
+ exp_year?: number;
19
+ last4?: string;
20
+ token?: string;
21
+ zip_check?: 'pass' | 'failed' | 'checked' | 'unchecked';
22
+ }
23
+
24
+ interface CardSnake extends BaseModel {
25
+ active?: boolean;
26
+ address_check?: 'unchecked' | 'pass' | 'fail';
27
+ billing?: object; // TODO: Create Billing Interface
28
+ brand?: string;
29
+ cvc_check?: 'unchecked' | 'pass' | 'fail';
30
+ exp_month?: number;
31
+ exp_year?: number;
32
+ fingerprint?: string;
33
+ gateway?: string;
34
+ last4?: string;
35
+ parent?: Account;
36
+ parent_id?: string;
37
+ test?: boolean;
38
+ token: string;
39
+ zip_check?: 'unchecked' | 'pass' | 'fail';
40
+ }
@@ -0,0 +1,9 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { CartSnake, CartItemSnake } from './snake';
3
+
4
+ export type CartCamel = {
5
+ [K in keyof CartSnake as SnakeToCamelCase<K>]: CartSnake[K];
6
+ };
7
+ export type CartItemCamel = {
8
+ [K in keyof CartItemSnake as SnakeToCamelCase<K>]: CartItemSnake[K];
9
+ };
@@ -0,0 +1,5 @@
1
+ import { CartSnake, CartItemSnake } from './snake';
2
+ import { CartCamel, CartItemCamel } from './camel';
3
+
4
+ export interface Cart extends CartSnake, CartCamel {}
5
+ export interface CartItem extends CartItemSnake, CartItemCamel {}
@@ -0,0 +1,112 @@
1
+ import { BaseModel, Discount, Tax } from '../index';
2
+ import { Product, Variant } from '../product';
3
+ import { Subscription } from '../subscription';
4
+ import { Account } from '../account';
5
+ import { Order } from '../order';
6
+
7
+ interface CartItemSnake extends BaseModel {
8
+ bundle_items?: [object];
9
+ delivery?: 'shipment' | 'subscription' | 'giftcard' | null;
10
+ description?: string;
11
+ discount_each?: number;
12
+ discount_total?: number;
13
+ discounts?: [Discount];
14
+ metadata?: object;
15
+ options?: [object]; // TODO: Add Options Variant
16
+ orig_price?: number;
17
+ price?: number;
18
+ price_total?: number;
19
+ product_id?: string;
20
+ product_name?: string;
21
+ product?: Product;
22
+ quantity?: number;
23
+ shipment_location?: string;
24
+ shipment_weight?: number;
25
+ subscription_interval?: string;
26
+ subscription_interval_count?: number;
27
+ subscription_trial_days?: number;
28
+ subscription_paid?: boolean;
29
+ tax_each?: number;
30
+ tax_total?: number;
31
+ taxes?: [Tax];
32
+ trial_price_total?: number;
33
+ variant_id?: string;
34
+ variant?: Variant;
35
+ }
36
+
37
+ interface CartSnake extends BaseModel {
38
+ abandoned?: boolean;
39
+ abandoned_notifications?: number;
40
+ account?: Account;
41
+ account_credit_amount?: number;
42
+ account_credit_applied?: boolean;
43
+ account_id?: string;
44
+ account_info_saved?: boolean;
45
+ account_logged_in?: boolean;
46
+ active?: boolean;
47
+ billing?: object; // TODO: Billing Object
48
+ checkout_id?: string;
49
+ checkout_url?: string;
50
+ comments?: string;
51
+ coupon?: object; // TODO: Create Coupon Object
52
+ coupon_code?: string;
53
+ coupon_id?: string;
54
+ currency?: string;
55
+ currency_rate?: number;
56
+ date_abandoned?: string;
57
+ date_abandoned_next?: string;
58
+ date_webhook_first_failed?: string;
59
+ date_webhook_last_succeeded?: string;
60
+ discount_total?: number;
61
+ discounts?: [object]; // TODO: Add discount object
62
+ display_currency?: string;
63
+ display_locale?: string;
64
+ gift?: boolean;
65
+ gift_message?: string;
66
+ giftcard_delivery?: boolean;
67
+ giftcard_total?: number;
68
+ giftcards?: [object]; // TODO: Add gift card object
69
+ grand_total?: number;
70
+ guest?: boolean;
71
+ item_discount?: number;
72
+ item_quantity?: number;
73
+ item_shipment_weight?: number;
74
+ item_tax?: number;
75
+ item_tax_included?: boolean;
76
+ items?: [CartItemSnake];
77
+ metadata?: object;
78
+ notes?: string;
79
+ number?: string;
80
+ order?: Order;
81
+ order_id?: string;
82
+ orig_price?: number;
83
+ promotion_ids?: [string]; // TODO: Create a special type for this?
84
+ promotions?: [object]; // TODO: Create Promotion Object
85
+ purchase_link_ids?: [string];
86
+ purchase_links?: [object]; // TODO : Create Purchase Links
87
+ purchase_links_errors?: [object];
88
+ recovered?: boolean;
89
+ schedule?: object;
90
+ shipment_delivery?: boolean;
91
+ shipment_discount?: number;
92
+ shipment_price?: number;
93
+ shipment_rating?: object; // TODO: Create Shipment Rating
94
+ shipment_tax?: number;
95
+ shipment_tax_included?: boolean;
96
+ shipment_total?: number;
97
+ shipping?: object; // TODO: Create Shipping Object
98
+ status?: 'active' | 'converted' | 'abandoned' | 'recovered';
99
+ sub_total?: number;
100
+ subscription?: Subscription;
101
+ subscription_delivery?: boolean;
102
+ subscription_id?: string;
103
+ target_order?: Order;
104
+ target_order_id?: string;
105
+ tax_included_total?: number;
106
+ tax_total?: number;
107
+ taxes?: [Tax];
108
+ taxes_fixed?: boolean;
109
+ webhook_attempts_failed?: number;
110
+ webhook_response?: string;
111
+ webhook_status?: number;
112
+ }
@@ -0,0 +1,6 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { CategorySnake } from './snake';
3
+
4
+ export type CategoryCamel = {
5
+ [K in keyof CategorySnake as SnakeToCamelCase<K>]: CategorySnake[K];
6
+ };
@@ -0,0 +1,4 @@
1
+ import { CategorySnake } from './snake';
2
+ import { CategoryCamel } from './camel';
3
+
4
+ export interface Category extends CategorySnake, CategoryCamel {}
@@ -0,0 +1,24 @@
1
+ import { BaseModel } from '..';
2
+ import { Image, Product } from '../product';
3
+
4
+ interface CategorySnake extends BaseModel {
5
+ active?: boolean;
6
+ children?: CategorySnake[];
7
+ demo?: boolean;
8
+ description: string;
9
+ image?: Image;
10
+ images?: Image[];
11
+ meta_description?: string;
12
+ meta_keywords?: string;
13
+ meta_title?: string;
14
+ name: string;
15
+ parent_id?: string;
16
+ parent?: CategorySnake;
17
+ products?: Product[];
18
+ products_indexed?: Product[];
19
+ slug: string;
20
+ sort?: number;
21
+ sorting?: string;
22
+ top?: CategorySnake;
23
+ top_id?: string;
24
+ }
@@ -0,0 +1,9 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import { ContentSnake, ContentSectionSnake } from './snake';
3
+
4
+ export type ContentCamel = {
5
+ [K in keyof ContentSnake as SnakeToCamelCase<K>]: ContentSnake[K];
6
+ };
7
+ export type ContentSectionCamel = {
8
+ [K in keyof ContentSectionSnake as SnakeToCamelCase<K>]: ContentSectionSnake[K];
9
+ };
@@ -0,0 +1,7 @@
1
+ import { ContentSnake, ContentSectionSnake } from './snake';
2
+ import { ContentCamel, ContentSectionCamel } from './camel';
3
+
4
+ export interface Content extends ContentSnake, ContentCamel {}
5
+ export interface ContentSection
6
+ extends ContentSectionSnake,
7
+ ContentSectionCamel {}
@@ -0,0 +1,16 @@
1
+ import { BaseModel } from '..';
2
+
3
+ interface ContentSectionSnake {
4
+ id: string;
5
+ type: string;
6
+ [otherAttr: string]: string | number | boolean | null;
7
+ }
8
+ interface ContentSnake extends BaseModel {
9
+ content?: string;
10
+ meta_description?: string | null;
11
+ name?: string;
12
+ published?: boolean;
13
+ redirect?: string | null;
14
+ slug?: string;
15
+ sections?: ContentSectionSnake[];
16
+ }
@@ -0,0 +1,16 @@
1
+ import { SnakeToCamelCase } from '..';
2
+ import {
3
+ FormatInputSnake,
4
+ SelectCurrencyReturnSnake,
5
+ EnabledCurrencySnake,
6
+ } from './snake';
7
+
8
+ export type FormatInputCamel = {
9
+ [K in keyof FormatInputSnake as SnakeToCamelCase<K>]: FormatInputSnake[K];
10
+ };
11
+ export type SelectCurrencyReturnCamel = {
12
+ [K in keyof SelectCurrencyReturnSnake as SnakeToCamelCase<K>]: SelectCurrencyReturnSnake[K];
13
+ };
14
+ export type EnabledCurrencyCamel = {
15
+ [K in keyof EnabledCurrencySnake as SnakeToCamelCase<K>]: EnabledCurrencySnake[K];
16
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ SelectCurrencyReturnSnake,
3
+ EnabledCurrencySnake,
4
+ FormatInputSnake,
5
+ } from './snake';
6
+ import {
7
+ SelectCurrencyReturnCamel,
8
+ EnabledCurrencyCamel,
9
+ FormatInputCamel,
10
+ } from './camel';
11
+
12
+ export interface SelectCurrencyReturn
13
+ extends SelectCurrencyReturnSnake,
14
+ SelectCurrencyReturnCamel {}
15
+ export interface EnabledCurrency
16
+ extends EnabledCurrencySnake,
17
+ EnabledCurrencyCamel {}
18
+ export interface FormatInput extends FormatInputSnake, FormatInputCamel {}
@@ -0,0 +1,22 @@
1
+ export interface FormatInputSnake {
2
+ code: string;
3
+ decimals: number;
4
+ locale: string;
5
+ rate: number;
6
+ }
7
+
8
+ export interface EnabledCurrencySnake {
9
+ code: string;
10
+ decimals: number;
11
+ name: string;
12
+ rate: number;
13
+ symbol: string;
14
+ type: string;
15
+ }
16
+
17
+ export interface SelectCurrencyReturnSnake {
18
+ account_id?: string;
19
+ cart_id?: string;
20
+ currency: string;
21
+ public_key?: string;
22
+ }