swell-js 4.2.5 → 5.0.0
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 +18 -5
- package/dist/settings.mjs +5 -1
- package/dist/swell.cjs +23 -6
- package/dist/swell.cjs.map +1 -1
- package/dist/swell.umd.min.js +23 -6
- package/dist/swell.umd.min.js.map +1 -1
- package/package.json +3 -2
- package/types/account/camel.ts +26 -0
- package/types/account/index.ts +26 -0
- package/types/account/{snake.d.ts → snake.ts} +8 -10
- package/types/attribute/camel.ts +15 -0
- package/types/attribute/index.ts +8 -0
- package/types/attribute/{snake.d.ts → snake.ts} +3 -4
- package/types/billing/camel.ts +39 -0
- package/types/billing/index.ts +21 -0
- package/types/billing/{snake.d.ts → snake.ts} +9 -18
- package/types/card/camel.ts +28 -0
- package/types/card/index.ts +26 -0
- package/types/card/{snake.d.ts → snake.ts} +6 -6
- package/types/cart/camel.ts +95 -0
- package/types/cart/index.ts +45 -0
- package/types/cart/{snake.d.ts → snake.ts} +20 -31
- package/types/category/camel.ts +21 -0
- package/types/category/index.ts +8 -0
- package/types/category/{snake.d.ts → snake.ts} +3 -5
- package/types/content/camel.ts +6 -0
- package/types/content/index.ts +8 -0
- package/types/content/{snake.d.ts → snake.ts} +3 -5
- package/types/coupon/camel.ts +15 -0
- package/types/coupon/index.ts +2 -0
- package/types/coupon/{snake.d.ts → snake.ts} +3 -3
- package/types/currency/camel.ts +14 -0
- package/types/currency/index.ts +34 -0
- package/types/currency/{snake.d.ts → snake.ts} +3 -3
- package/types/discount/camel.ts +32 -0
- package/types/discount/index.ts +7 -0
- package/types/discount/{snake.d.ts → snake.ts} +7 -9
- package/types/giftcard/camel.ts +30 -0
- package/types/giftcard/index.ts +2 -0
- package/types/giftcard/{snake.d.ts → snake.ts} +7 -9
- package/types/index.d.ts +407 -397
- package/types/invoice/camel.ts +37 -0
- package/types/invoice/index.ts +8 -0
- package/types/invoice/{snake.d.ts → snake.ts} +11 -11
- package/types/order/camel.ts +79 -0
- package/types/order/index.ts +32 -0
- package/types/order/{snake.d.ts → snake.ts} +18 -26
- package/types/payment/camel.ts +58 -0
- package/types/payment/index.ts +79 -0
- package/types/payment/{snake.d.ts → snake.ts} +16 -21
- package/types/product/camel.ts +86 -0
- package/types/product/index.ts +72 -0
- package/types/product/{snake.d.ts → snake.ts} +12 -23
- package/types/promotion/camel.ts +28 -0
- package/types/promotion/index.ts +2 -0
- package/types/promotion/{snake.d.ts → snake.ts} +6 -8
- package/types/purchase_link/camel.ts +21 -0
- package/types/purchase_link/index.ts +2 -0
- package/types/purchase_link/{snake.d.ts → snake.ts} +6 -6
- package/types/refund/camel.ts +19 -0
- package/types/refund/index.ts +2 -0
- package/types/refund/{snake.d.ts → snake.ts} +5 -5
- package/types/shipment_rating/camel.ts +15 -0
- package/types/shipment_rating/index.ts +2 -0
- package/types/shipment_rating/{snake.d.ts → snake.ts} +2 -4
- package/types/subscription/camel.ts +61 -0
- package/types/subscription/index.ts +28 -0
- package/types/subscription/{snake.d.ts → snake.ts} +14 -20
- package/types/utils.ts +10 -0
- package/types/account/camel.d.ts +0 -8
- package/types/account/index.d.ts +0 -9
- package/types/attribute/camel.d.ts +0 -4
- package/types/attribute/index.d.ts +0 -4
- package/types/billing/camel.d.ts +0 -25
- package/types/billing/index.d.ts +0 -38
- package/types/card/camel.d.ts +0 -9
- package/types/card/index.d.ts +0 -9
- package/types/cart/camel.d.ts +0 -32
- package/types/cart/index.d.ts +0 -46
- package/types/category/camel.d.ts +0 -4
- package/types/category/index.d.ts +0 -4
- package/types/content/camel.d.ts +0 -5
- package/types/content/index.d.ts +0 -8
- package/types/coupon/camel.d.ts +0 -4
- package/types/coupon/index.d.ts +0 -4
- package/types/currency/camel.d.ts +0 -15
- package/types/currency/index.d.ts +0 -21
- package/types/discount/camel.d.ts +0 -15
- package/types/discount/index.d.ts +0 -18
- package/types/giftcard/camel.d.ts +0 -6
- package/types/giftcard/index.d.ts +0 -5
- package/types/invoice/camel.d.ts +0 -4
- package/types/invoice/index.d.ts +0 -4
- package/types/order/camel.d.ts +0 -15
- package/types/order/index.d.ts +0 -20
- package/types/payment/camel.d.ts +0 -35
- package/types/payment/index.d.ts +0 -51
- package/types/product/camel.d.ts +0 -24
- package/types/product/index.d.ts +0 -49
- package/types/promotion/camel.d.ts +0 -7
- package/types/promotion/index.d.ts +0 -8
- package/types/purchase_link/camel.d.ts +0 -4
- package/types/purchase_link/index.d.ts +0 -4
- package/types/refund/camel.d.ts +0 -4
- package/types/refund/index.d.ts +0 -4
- package/types/shipment_rating/camel.d.ts +0 -7
- package/types/shipment_rating/index.d.ts +0 -10
- package/types/subscription/camel.d.ts +0 -15
- package/types/subscription/index.d.ts +0 -21
- /package/types/locale/{index.d.ts → index.ts} +0 -0
- /package/types/settings/{index.d.ts → index.ts} +0 -0
package/dist/api.mjs
CHANGED
|
@@ -126,12 +126,21 @@ function methods(api, _opt) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/** @typedef {import('../types').InitOptions} InitOptions */
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @template {'snake' | 'camel'} C
|
|
133
|
+
* @typedef {import('../types').SwellClient<C>} SwellClient<C>
|
|
134
|
+
*/
|
|
135
|
+
|
|
129
136
|
/**
|
|
130
137
|
* Swell API client
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
* @param {
|
|
134
|
-
* @
|
|
138
|
+
*
|
|
139
|
+
* @template {'snake' | 'camel'} C
|
|
140
|
+
* @param {string} [initStore] - Store name
|
|
141
|
+
* @param {string} [initKey] - API key
|
|
142
|
+
* @param {InitOptions} [initOptions] - Options
|
|
143
|
+
* @returns {SwellClient<C>} API client
|
|
135
144
|
*/
|
|
136
145
|
function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
137
146
|
const options = {
|
|
@@ -145,7 +154,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
|
145
154
|
const api = {};
|
|
146
155
|
|
|
147
156
|
Object.assign(api, {
|
|
148
|
-
version: '
|
|
157
|
+
version: '5.0.0',
|
|
149
158
|
options,
|
|
150
159
|
request,
|
|
151
160
|
|
|
@@ -228,6 +237,10 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
|
228
237
|
functions: methods(api),
|
|
229
238
|
|
|
230
239
|
utils,
|
|
240
|
+
|
|
241
|
+
getCookie,
|
|
242
|
+
|
|
243
|
+
setCookie,
|
|
231
244
|
});
|
|
232
245
|
|
|
233
246
|
async function request(
|
package/dist/settings.mjs
CHANGED
|
@@ -181,7 +181,11 @@ function methods(api, opt) {
|
|
|
181
181
|
value: session,
|
|
182
182
|
});
|
|
183
183
|
} catch (err) {
|
|
184
|
-
|
|
184
|
+
if (err instanceof Error) {
|
|
185
|
+
err.message = `Swell: unable to load settings (${err.message})`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
console.error(err);
|
|
185
189
|
}
|
|
186
190
|
},
|
|
187
191
|
};
|
package/dist/swell.cjs
CHANGED
|
@@ -6155,7 +6155,11 @@ function methods$4(api, opt) {
|
|
|
6155
6155
|
value: session,
|
|
6156
6156
|
});
|
|
6157
6157
|
} catch (err) {
|
|
6158
|
-
|
|
6158
|
+
if (err instanceof Error) {
|
|
6159
|
+
err.message = `Swell: unable to load settings (${err.message})`;
|
|
6160
|
+
}
|
|
6161
|
+
|
|
6162
|
+
console.error(err);
|
|
6159
6163
|
}
|
|
6160
6164
|
},
|
|
6161
6165
|
};
|
|
@@ -10157,12 +10161,21 @@ function methods(api, _opt) {
|
|
|
10157
10161
|
};
|
|
10158
10162
|
}
|
|
10159
10163
|
|
|
10164
|
+
/** @typedef {import('../types').InitOptions} InitOptions */
|
|
10165
|
+
|
|
10166
|
+
/**
|
|
10167
|
+
* @template {'snake' | 'camel'} C
|
|
10168
|
+
* @typedef {import('../types').SwellClient<C>} SwellClient<C>
|
|
10169
|
+
*/
|
|
10170
|
+
|
|
10160
10171
|
/**
|
|
10161
10172
|
* Swell API client
|
|
10162
|
-
*
|
|
10163
|
-
* @
|
|
10164
|
-
* @param {
|
|
10165
|
-
* @
|
|
10173
|
+
*
|
|
10174
|
+
* @template {'snake' | 'camel'} C
|
|
10175
|
+
* @param {string} [initStore] - Store name
|
|
10176
|
+
* @param {string} [initKey] - API key
|
|
10177
|
+
* @param {InitOptions} [initOptions] - Options
|
|
10178
|
+
* @returns {SwellClient<C>} API client
|
|
10166
10179
|
*/
|
|
10167
10180
|
function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
10168
10181
|
const options = {
|
|
@@ -10176,7 +10189,7 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
|
10176
10189
|
const api = {};
|
|
10177
10190
|
|
|
10178
10191
|
Object.assign(api, {
|
|
10179
|
-
version: '
|
|
10192
|
+
version: '5.0.0',
|
|
10180
10193
|
options,
|
|
10181
10194
|
request,
|
|
10182
10195
|
|
|
@@ -10259,6 +10272,10 @@ function swell(initStore = undefined, initKey, initOptions = {}) {
|
|
|
10259
10272
|
functions: methods(api),
|
|
10260
10273
|
|
|
10261
10274
|
utils,
|
|
10275
|
+
|
|
10276
|
+
getCookie,
|
|
10277
|
+
|
|
10278
|
+
setCookie,
|
|
10262
10279
|
});
|
|
10263
10280
|
|
|
10264
10281
|
async function request(
|