swell-js 5.5.0 → 5.5.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 +1 -1
- package/dist/swell.cjs +1 -1
- package/dist/swell.umd.min.js +1 -1
- package/package.json +1 -1
- package/types/product/camel.ts +42 -0
- package/types/product/index.ts +18 -6
- package/types/product/snake.ts +50 -3
package/dist/api.mjs
CHANGED
package/dist/swell.cjs
CHANGED
|
@@ -12559,7 +12559,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
|
12559
12559
|
const api = {};
|
|
12560
12560
|
|
|
12561
12561
|
Object.assign(api, {
|
|
12562
|
-
version: '5.5.
|
|
12562
|
+
version: '5.5.1',
|
|
12563
12563
|
options,
|
|
12564
12564
|
request,
|
|
12565
12565
|
|
package/dist/swell.umd.min.js
CHANGED
|
@@ -18004,7 +18004,7 @@
|
|
|
18004
18004
|
const api = {};
|
|
18005
18005
|
|
|
18006
18006
|
Object.assign(api, {
|
|
18007
|
-
version: '5.5.
|
|
18007
|
+
version: '5.5.1',
|
|
18008
18008
|
options,
|
|
18009
18009
|
request,
|
|
18010
18010
|
|
package/package.json
CHANGED
package/types/product/camel.ts
CHANGED
|
@@ -6,6 +6,10 @@ import type {
|
|
|
6
6
|
import type { Replace } from '../utils';
|
|
7
7
|
|
|
8
8
|
import type { AttributeCamel } from '../attribute/camel';
|
|
9
|
+
import type {
|
|
10
|
+
SubscriptionBillingScheduleCamel,
|
|
11
|
+
SubscriptionOrderScheduleCamel,
|
|
12
|
+
} from '../subscription/camel';
|
|
9
13
|
|
|
10
14
|
import type {
|
|
11
15
|
Product,
|
|
@@ -16,6 +20,9 @@ import type {
|
|
|
16
20
|
OptionValue,
|
|
17
21
|
Bundle,
|
|
18
22
|
CrossSell,
|
|
23
|
+
StandardPurchaseOption,
|
|
24
|
+
SubscriptionPlan,
|
|
25
|
+
SubscriptionPurchaseOption,
|
|
19
26
|
} from './snake';
|
|
20
27
|
|
|
21
28
|
export type BundleCamel = ConvertSnakeToCamelCase<
|
|
@@ -59,6 +66,39 @@ export type ProductOptionCamel = ConvertSnakeToCamelCase<
|
|
|
59
66
|
export type UpsellCamel = ConvertSnakeToCamelCase<Upsell>;
|
|
60
67
|
export type PriceCamel = ConvertSnakeToCamelCase<Price>;
|
|
61
68
|
|
|
69
|
+
export type SubscriptionPlanCamel = ConvertSnakeToCamelCase<
|
|
70
|
+
Replace<
|
|
71
|
+
SubscriptionPlan,
|
|
72
|
+
{
|
|
73
|
+
billing_schedule?: SubscriptionBillingScheduleCamel;
|
|
74
|
+
order_schedule?: SubscriptionOrderScheduleCamel;
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
>;
|
|
78
|
+
|
|
79
|
+
export type StandardPurchaseOptionCamel = ConvertSnakeToCamelCase<
|
|
80
|
+
Replace<
|
|
81
|
+
StandardPurchaseOption,
|
|
82
|
+
{
|
|
83
|
+
prices?: PriceCamel[];
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
>;
|
|
87
|
+
|
|
88
|
+
export type SubscriptionPurchaseOptionCamel = ConvertSnakeToCamelCase<
|
|
89
|
+
Replace<
|
|
90
|
+
SubscriptionPurchaseOption,
|
|
91
|
+
{
|
|
92
|
+
plans?: SubscriptionPlanCamel[];
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
>;
|
|
96
|
+
|
|
97
|
+
export type PurchaseOptionsCamel = {
|
|
98
|
+
standard?: StandardPurchaseOptionCamel;
|
|
99
|
+
subscription?: SubscriptionPurchaseOptionCamel;
|
|
100
|
+
};
|
|
101
|
+
|
|
62
102
|
export type VariantCamel = ConvertSnakeToCamelCase<
|
|
63
103
|
Replace<
|
|
64
104
|
Variant,
|
|
@@ -67,6 +107,7 @@ export type VariantCamel = ConvertSnakeToCamelCase<
|
|
|
67
107
|
images?: ImageCamel[];
|
|
68
108
|
parent?: ProductCamel;
|
|
69
109
|
prices?: PriceCamel[];
|
|
110
|
+
purchase_options?: PurchaseOptionsCamel;
|
|
70
111
|
}
|
|
71
112
|
>
|
|
72
113
|
>;
|
|
@@ -81,6 +122,7 @@ export type ProductCamel = ConvertSnakeToCamelCase<
|
|
|
81
122
|
images?: ImageCamel[];
|
|
82
123
|
options?: ProductOptionCamel[];
|
|
83
124
|
prices?: PriceCamel[];
|
|
125
|
+
purchase_options?: PurchaseOptionsCamel;
|
|
84
126
|
up_sells?: UpsellCamel[];
|
|
85
127
|
variants?: ResultsResponseCamel<VariantCamel>;
|
|
86
128
|
}
|
package/types/product/index.ts
CHANGED
|
@@ -11,6 +11,11 @@ import type {
|
|
|
11
11
|
OptionValue,
|
|
12
12
|
Bundle,
|
|
13
13
|
CrossSell,
|
|
14
|
+
PurchaseOptions,
|
|
15
|
+
StandardPurchaseOption,
|
|
16
|
+
SubscriptionPlan,
|
|
17
|
+
SubscriptionPurchaseOption,
|
|
18
|
+
SubscriptionInterval,
|
|
14
19
|
} from './snake';
|
|
15
20
|
|
|
16
21
|
import type {
|
|
@@ -22,6 +27,10 @@ import type {
|
|
|
22
27
|
OptionValueCamel,
|
|
23
28
|
BundleCamel,
|
|
24
29
|
CrossSellCamel,
|
|
30
|
+
PurchaseOptionsCamel,
|
|
31
|
+
StandardPurchaseOptionCamel,
|
|
32
|
+
SubscriptionPlanCamel,
|
|
33
|
+
SubscriptionPurchaseOptionCamel,
|
|
25
34
|
} from './camel';
|
|
26
35
|
|
|
27
36
|
export interface PriceRange {
|
|
@@ -41,12 +50,6 @@ export type FlexibleProductInputCase = MakeCase<
|
|
|
41
50
|
FlexibleProductInputCamel
|
|
42
51
|
>;
|
|
43
52
|
|
|
44
|
-
export interface PurchaseOptions {
|
|
45
|
-
standard?: object;
|
|
46
|
-
subscription?: object;
|
|
47
|
-
trial?: object;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
53
|
export type ProductCase = MakeCase<Product, ProductCamel>;
|
|
51
54
|
|
|
52
55
|
export type {
|
|
@@ -59,6 +62,11 @@ export type {
|
|
|
59
62
|
OptionValue,
|
|
60
63
|
Bundle,
|
|
61
64
|
CrossSell,
|
|
65
|
+
PurchaseOptions,
|
|
66
|
+
StandardPurchaseOption,
|
|
67
|
+
SubscriptionPlan,
|
|
68
|
+
SubscriptionPurchaseOption,
|
|
69
|
+
SubscriptionInterval,
|
|
62
70
|
ProductCamel,
|
|
63
71
|
VariantCamel,
|
|
64
72
|
PriceCamel,
|
|
@@ -67,4 +75,8 @@ export type {
|
|
|
67
75
|
OptionValueCamel,
|
|
68
76
|
BundleCamel,
|
|
69
77
|
CrossSellCamel,
|
|
78
|
+
PurchaseOptionsCamel,
|
|
79
|
+
StandardPurchaseOptionCamel,
|
|
80
|
+
SubscriptionPlanCamel,
|
|
81
|
+
SubscriptionPurchaseOptionCamel,
|
|
70
82
|
};
|
package/types/product/snake.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { BaseModel, ResultsResponse, Image } from '../index';
|
|
2
2
|
|
|
3
3
|
import type { Attribute } from '../attribute';
|
|
4
|
+
import type {
|
|
5
|
+
SubscriptionBillingSchedule,
|
|
6
|
+
SubscriptionOrderSchedule,
|
|
7
|
+
} from '../subscription';
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
export type SubscriptionInterval = 'monthly' | 'daily' | 'weekly' | 'yearly';
|
|
6
10
|
|
|
7
11
|
export interface ContentObject {
|
|
8
12
|
[key: string]: unknown;
|
|
@@ -36,8 +40,11 @@ export interface OptionValue {
|
|
|
36
40
|
name?: string;
|
|
37
41
|
price?: number;
|
|
38
42
|
shipment_weight?: number;
|
|
39
|
-
|
|
43
|
+
/** @deprecated */
|
|
44
|
+
subscription_interval?: SubscriptionInterval;
|
|
45
|
+
/** @deprecated */
|
|
40
46
|
subscription_interval_count?: number;
|
|
47
|
+
/** @deprecated */
|
|
41
48
|
subscription_trial_days?: number;
|
|
42
49
|
}
|
|
43
50
|
|
|
@@ -77,6 +84,43 @@ export interface Price {
|
|
|
77
84
|
quantity_min?: number;
|
|
78
85
|
}
|
|
79
86
|
|
|
87
|
+
export interface StandardPurchaseOption {
|
|
88
|
+
id?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
active?: boolean;
|
|
92
|
+
price?: number;
|
|
93
|
+
sale?: boolean;
|
|
94
|
+
sale_price?: number;
|
|
95
|
+
orig_price?: number;
|
|
96
|
+
prices?: Price[];
|
|
97
|
+
account_groups?: string[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface SubscriptionPlan {
|
|
101
|
+
id?: string;
|
|
102
|
+
name?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
active?: boolean;
|
|
105
|
+
price?: number;
|
|
106
|
+
billing_schedule?: SubscriptionBillingSchedule;
|
|
107
|
+
order_schedule?: SubscriptionOrderSchedule;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface SubscriptionPurchaseOption {
|
|
111
|
+
id?: string;
|
|
112
|
+
name?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
active?: boolean;
|
|
115
|
+
account_groups?: string[];
|
|
116
|
+
plans?: SubscriptionPlan[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface PurchaseOptions {
|
|
120
|
+
standard?: StandardPurchaseOption;
|
|
121
|
+
subscription?: SubscriptionPurchaseOption;
|
|
122
|
+
}
|
|
123
|
+
|
|
80
124
|
export interface Variant extends BaseModel {
|
|
81
125
|
active?: boolean;
|
|
82
126
|
archived?: boolean;
|
|
@@ -96,7 +140,9 @@ export interface Variant extends BaseModel {
|
|
|
96
140
|
sku?: string;
|
|
97
141
|
stock_level?: number;
|
|
98
142
|
/** @deprecated use `purchase_options.subscription` instead */
|
|
99
|
-
subscription_interval?:
|
|
143
|
+
subscription_interval?: SubscriptionInterval;
|
|
144
|
+
/** @deprecated use `purchase_options.subscription` instead */
|
|
145
|
+
subscription_interval_count?: number;
|
|
100
146
|
/** @deprecated use `purchase_options.subscription` instead */
|
|
101
147
|
subscription_trial_days?: number;
|
|
102
148
|
}
|
|
@@ -157,6 +203,7 @@ export interface Product extends BaseModel {
|
|
|
157
203
|
| null;
|
|
158
204
|
stock_tracking?: boolean;
|
|
159
205
|
tags?: string[];
|
|
206
|
+
type?: 'standard' | 'subscription' | 'bundle' | 'giftcard';
|
|
160
207
|
up_sells?: Upsell[];
|
|
161
208
|
variable?: boolean;
|
|
162
209
|
variants?: ResultsResponse<Variant>;
|