@unchainedshop/plugins 4.8.24 → 4.8.26
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/lib/payment/stripe/stripe.js +1 -1
- package/lib/pricing/tax/ch-tax-rates.json +1 -1
- package/lib/pricing/tax/eraRates.d.ts +3 -2
- package/lib/pricing/tax/eraRates.js +34 -8
- package/lib/pricing/tax/eu-tax-rates.json +33 -1
- package/lib/pricing/tax/eu.js +1 -1
- package/lib/pricing/tax/uk-tax-rates.json +1 -1
- package/lib/pricing/tax/us-tax-rates.json +63 -3
- package/lib/pricing/tax/us.js +1 -1
- package/package.json +1 -1
- package/lib/delivery/post/adapter.d.ts +0 -2
- package/lib/delivery/post/adapter.js +0 -22
- package/lib/delivery/post/index.d.ts +0 -4
- package/lib/delivery/post/index.js +0 -10
- package/lib/delivery/send-message/adapter.d.ts +0 -2
- package/lib/delivery/send-message/adapter.js +0 -39
- package/lib/delivery/send-message/index.d.ts +0 -4
- package/lib/delivery/send-message/index.js +0 -10
- package/lib/delivery/stores/adapter.d.ts +0 -2
- package/lib/delivery/stores/adapter.js +0 -42
- package/lib/delivery/stores/index.d.ts +0 -4
- package/lib/delivery/stores/index.js +0 -10
- package/lib/enrollments/licensed/adapter.d.ts +0 -6
- package/lib/enrollments/licensed/adapter.js +0 -51
- package/lib/enrollments/licensed/index.d.ts +0 -4
- package/lib/enrollments/licensed/index.js +0 -10
- package/lib/files/gridfs/api.d.ts +0 -7
- package/lib/files/gridfs/api.js +0 -163
- package/lib/files/minio/adapter.d.ts +0 -4
- package/lib/files/minio/adapter.js +0 -160
- package/lib/files/minio/api.d.ts +0 -2
- package/lib/files/minio/api.js +0 -40
- package/lib/files/temp-upload/api.d.ts +0 -8
- package/lib/files/temp-upload/api.js +0 -48
- package/lib/files/temp-upload/index.d.ts +0 -3
- package/lib/files/temp-upload/index.js +0 -15
- package/lib/filters/local-search/adapter.d.ts +0 -2
- package/lib/filters/local-search/adapter.js +0 -56
- package/lib/filters/local-search/index.d.ts +0 -4
- package/lib/filters/local-search/index.js +0 -10
- package/lib/filters/strict-equal/adapter.d.ts +0 -2
- package/lib/filters/strict-equal/adapter.js +0 -23
- package/lib/filters/strict-equal/index.d.ts +0 -4
- package/lib/filters/strict-equal/index.js +0 -10
- package/lib/payment/apple-iap/api.d.ts +0 -2
- package/lib/payment/apple-iap/api.js +0 -119
- package/lib/payment/cryptopay/adapter.d.ts +0 -2
- package/lib/payment/cryptopay/adapter.js +0 -157
- package/lib/payment/cryptopay/api.d.ts +0 -2
- package/lib/payment/cryptopay/api.js +0 -23
- package/lib/payment/datatrans-v2/adapter.d.ts +0 -2
- package/lib/payment/datatrans-v2/adapter.js +0 -417
- package/lib/payment/datatrans-v2/api.d.ts +0 -2
- package/lib/payment/datatrans-v2/api.js +0 -108
- package/lib/payment/invoice/adapter.d.ts +0 -2
- package/lib/payment/invoice/adapter.js +0 -26
- package/lib/payment/invoice/index.d.ts +0 -4
- package/lib/payment/invoice/index.js +0 -10
- package/lib/payment/invoice-prepaid/adapter.d.ts +0 -2
- package/lib/payment/invoice-prepaid/adapter.js +0 -29
- package/lib/payment/invoice-prepaid/index.d.ts +0 -4
- package/lib/payment/invoice-prepaid/index.js +0 -10
- package/lib/payment/payrexx/adapter.d.ts +0 -2
- package/lib/payment/payrexx/adapter.js +0 -161
- package/lib/payment/payrexx/api.d.ts +0 -2
- package/lib/payment/payrexx/api.js +0 -97
- package/lib/payment/postfinance-checkout/adapter.d.ts +0 -2
- package/lib/payment/postfinance-checkout/adapter.js +0 -189
- package/lib/payment/postfinance-checkout/webhook.d.ts +0 -2
- package/lib/payment/postfinance-checkout/webhook.js +0 -48
- package/lib/payment/saferpay/webhook.d.ts +0 -2
- package/lib/payment/saferpay/webhook.js +0 -64
- package/lib/payment/stripe/adapter.d.ts +0 -2
- package/lib/payment/stripe/adapter.js +0 -121
- package/lib/payment/stripe/api.d.ts +0 -6
- package/lib/payment/stripe/api.js +0 -165
- package/lib/pricing/delivery-eu-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-eu-tax/adapter.js +0 -55
- package/lib/pricing/delivery-eu-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-eu-tax/index.js +0 -10
- package/lib/pricing/delivery-swiss-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-swiss-tax/adapter.js +0 -43
- package/lib/pricing/delivery-swiss-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-swiss-tax/index.js +0 -10
- package/lib/pricing/delivery-uk-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-uk-tax/adapter.js +0 -43
- package/lib/pricing/delivery-uk-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-uk-tax/index.js +0 -10
- package/lib/pricing/delivery-us-sales-tax/adapter.d.ts +0 -3
- package/lib/pricing/delivery-us-sales-tax/adapter.js +0 -58
- package/lib/pricing/delivery-us-sales-tax/index.d.ts +0 -4
- package/lib/pricing/delivery-us-sales-tax/index.js +0 -10
- package/lib/pricing/discount-100-off/adapter.d.ts +0 -3
- package/lib/pricing/discount-100-off/adapter.js +0 -30
- package/lib/pricing/discount-100-off/index.d.ts +0 -4
- package/lib/pricing/discount-100-off/index.js +0 -10
- package/lib/pricing/discount-half-price-manual/adapter.d.ts +0 -3
- package/lib/pricing/discount-half-price-manual/adapter.js +0 -30
- package/lib/pricing/discount-half-price-manual/index.d.ts +0 -4
- package/lib/pricing/discount-half-price-manual/index.js +0 -10
- package/lib/pricing/free-delivery/adapter.d.ts +0 -3
- package/lib/pricing/free-delivery/adapter.js +0 -27
- package/lib/pricing/free-delivery/index.d.ts +0 -4
- package/lib/pricing/free-delivery/index.js +0 -10
- package/lib/pricing/free-payment/adapter.d.ts +0 -3
- package/lib/pricing/free-payment/adapter.js +0 -27
- package/lib/pricing/free-payment/index.d.ts +0 -4
- package/lib/pricing/free-payment/index.js +0 -10
- package/lib/pricing/order-delivery/adapter.d.ts +0 -3
- package/lib/pricing/order-delivery/adapter.js +0 -33
- package/lib/pricing/order-delivery/index.d.ts +0 -4
- package/lib/pricing/order-delivery/index.js +0 -10
- package/lib/pricing/order-discount/adapter.d.ts +0 -3
- package/lib/pricing/order-discount/adapter.js +0 -74
- package/lib/pricing/order-discount/index.d.ts +0 -4
- package/lib/pricing/order-discount/index.js +0 -10
- package/lib/pricing/order-items/adapter.d.ts +0 -3
- package/lib/pricing/order-items/adapter.js +0 -43
- package/lib/pricing/order-items/index.d.ts +0 -4
- package/lib/pricing/order-items/index.js +0 -10
- package/lib/pricing/order-payment/adapter.d.ts +0 -3
- package/lib/pricing/order-payment/adapter.js +0 -33
- package/lib/pricing/order-payment/index.d.ts +0 -4
- package/lib/pricing/order-payment/index.js +0 -10
- package/lib/pricing/product-catalog-price/adapter.d.ts +0 -3
- package/lib/pricing/product-catalog-price/adapter.js +0 -60
- package/lib/pricing/product-catalog-price/index.d.ts +0 -4
- package/lib/pricing/product-catalog-price/index.js +0 -10
- package/lib/pricing/product-discount/adapter.d.ts +0 -3
- package/lib/pricing/product-discount/adapter.js +0 -69
- package/lib/pricing/product-discount/index.d.ts +0 -4
- package/lib/pricing/product-discount/index.js +0 -10
- package/lib/pricing/product-eu-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-eu-tax/adapter.js +0 -56
- package/lib/pricing/product-eu-tax/index.d.ts +0 -4
- package/lib/pricing/product-eu-tax/index.js +0 -10
- package/lib/pricing/product-price-rateconversion/adapter.d.ts +0 -3
- package/lib/pricing/product-price-rateconversion/adapter.js +0 -53
- package/lib/pricing/product-price-rateconversion/index.d.ts +0 -4
- package/lib/pricing/product-price-rateconversion/index.js +0 -10
- package/lib/pricing/product-quotation-price.d.ts +0 -2
- package/lib/pricing/product-quotation-price.js +0 -40
- package/lib/pricing/product-swiss-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-swiss-tax/adapter.js +0 -57
- package/lib/pricing/product-swiss-tax/index.d.ts +0 -4
- package/lib/pricing/product-swiss-tax/index.js +0 -10
- package/lib/pricing/product-uk-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-uk-tax/adapter.js +0 -57
- package/lib/pricing/product-uk-tax/index.d.ts +0 -4
- package/lib/pricing/product-uk-tax/index.js +0 -10
- package/lib/pricing/product-us-sales-tax/adapter.d.ts +0 -3
- package/lib/pricing/product-us-sales-tax/adapter.js +0 -52
- package/lib/pricing/product-us-sales-tax/index.d.ts +0 -4
- package/lib/pricing/product-us-sales-tax/index.js +0 -10
- package/lib/quotations/manual/adapter.d.ts +0 -2
- package/lib/quotations/manual/adapter.js +0 -24
- package/lib/quotations/manual/index.d.ts +0 -4
- package/lib/quotations/manual/index.js +0 -10
- package/lib/warehousing/erc-metadata/api.d.ts +0 -12
- package/lib/warehousing/erc-metadata/api.js +0 -43
- package/lib/warehousing/erc-metadata/index.d.ts +0 -3
- package/lib/warehousing/erc-metadata/index.js +0 -15
- package/lib/warehousing/eth-minter/adapter.d.ts +0 -2
- package/lib/warehousing/eth-minter/adapter.js +0 -119
- package/lib/warehousing/eth-minter/index.d.ts +0 -4
- package/lib/warehousing/eth-minter/index.js +0 -10
- package/lib/warehousing/store/adapter.d.ts +0 -2
- package/lib/warehousing/store/adapter.js +0 -33
- package/lib/warehousing/store/index.d.ts +0 -4
- package/lib/warehousing/store/index.js +0 -10
- package/lib/worker/budgetsms/adapter.d.ts +0 -22
- package/lib/worker/budgetsms/adapter.js +0 -169
- package/lib/worker/budgetsms/index.d.ts +0 -4
- package/lib/worker/budgetsms/index.js +0 -10
- package/lib/worker/bulk-export/adapter.d.ts +0 -3
- package/lib/worker/bulk-export/adapter.js +0 -64
- package/lib/worker/bulk-export/index.d.ts +0 -4
- package/lib/worker/bulk-export/index.js +0 -10
- package/lib/worker/bulk-import/adapter.d.ts +0 -3
- package/lib/worker/bulk-import/adapter.js +0 -65
- package/lib/worker/bulk-import/api.d.ts +0 -9
- package/lib/worker/bulk-import/api.js +0 -52
- package/lib/worker/bulk-import/index.d.ts +0 -4
- package/lib/worker/bulk-import/index.js +0 -18
- package/lib/worker/bulkgate/adapter.d.ts +0 -12
- package/lib/worker/bulkgate/adapter.js +0 -91
- package/lib/worker/bulkgate/index.d.ts +0 -4
- package/lib/worker/bulkgate/index.js +0 -10
- package/lib/worker/email/adapter.d.ts +0 -9
- package/lib/worker/email/adapter.js +0 -150
- package/lib/worker/email/index.d.ts +0 -4
- package/lib/worker/email/index.js +0 -10
- package/lib/worker/enrollment-order-generator/adapter.d.ts +0 -4
- package/lib/worker/enrollment-order-generator/adapter.js +0 -77
- package/lib/worker/enrollment-order-generator/index.d.ts +0 -4
- package/lib/worker/enrollment-order-generator/index.js +0 -13
- package/lib/worker/error-notifications/adapter.d.ts +0 -10
- package/lib/worker/error-notifications/adapter.js +0 -62
- package/lib/worker/error-notifications/index.d.ts +0 -4
- package/lib/worker/error-notifications/index.js +0 -13
- package/lib/worker/export-token/adapter.d.ts +0 -4
- package/lib/worker/export-token/adapter.js +0 -25
- package/lib/worker/export-token/index.d.ts +0 -4
- package/lib/worker/export-token/index.js +0 -13
- package/lib/worker/external/adapter.d.ts +0 -3
- package/lib/worker/external/adapter.js +0 -13
- package/lib/worker/external/index.d.ts +0 -4
- package/lib/worker/external/index.js +0 -10
- package/lib/worker/gc-guests/adapter.d.ts +0 -9
- package/lib/worker/gc-guests/adapter.js +0 -56
- package/lib/worker/gc-guests/index.d.ts +0 -4
- package/lib/worker/gc-guests/index.js +0 -13
- package/lib/worker/heartbeat/adapter.d.ts +0 -8
- package/lib/worker/heartbeat/adapter.js +0 -26
- package/lib/worker/heartbeat/index.d.ts +0 -4
- package/lib/worker/heartbeat/index.js +0 -10
- package/lib/worker/http-request/adapter.d.ts +0 -8
- package/lib/worker/http-request/adapter.js +0 -55
- package/lib/worker/http-request/index.d.ts +0 -4
- package/lib/worker/http-request/index.js +0 -10
- package/lib/worker/invalidate-carts/adapter.d.ts +0 -9
- package/lib/worker/invalidate-carts/adapter.js +0 -52
- package/lib/worker/invalidate-carts/index.d.ts +0 -4
- package/lib/worker/invalidate-carts/index.js +0 -13
- package/lib/worker/message/adapter.d.ts +0 -11
- package/lib/worker/message/adapter.js +0 -42
- package/lib/worker/message/index.d.ts +0 -4
- package/lib/worker/message/index.js +0 -10
- package/lib/worker/push-notification/adapter.d.ts +0 -9
- package/lib/worker/push-notification/adapter.js +0 -87
- package/lib/worker/push-notification/index.d.ts +0 -4
- package/lib/worker/push-notification/index.js +0 -10
- package/lib/worker/twilio/adapter.d.ts +0 -8
- package/lib/worker/twilio/adapter.js +0 -59
- package/lib/worker/twilio/index.d.ts +0 -4
- package/lib/worker/twilio/index.js +0 -10
- package/lib/worker/update-coinbase-rates/adapter.d.ts +0 -4
- package/lib/worker/update-coinbase-rates/adapter.js +0 -59
- package/lib/worker/update-coinbase-rates/index.d.ts +0 -4
- package/lib/worker/update-coinbase-rates/index.js +0 -13
- package/lib/worker/update-ecb-rates/adapter.d.ts +0 -4
- package/lib/worker/update-ecb-rates/adapter.js +0 -94
- package/lib/worker/update-ecb-rates/index.d.ts +0 -4
- package/lib/worker/update-ecb-rates/index.js +0 -13
- package/lib/worker/update-token-ownership/adapter.d.ts +0 -5
- package/lib/worker/update-token-ownership/adapter.js +0 -58
- package/lib/worker/update-token-ownership/index.d.ts +0 -4
- package/lib/worker/update-token-ownership/index.js +0 -13
- package/lib/worker/zombie-killer/adapter.d.ts +0 -15
- package/lib/worker/zombie-killer/adapter.js +0 -113
- package/lib/worker/zombie-killer/index.d.ts +0 -4
- package/lib/worker/zombie-killer/index.js +0 -13
|
@@ -3,8 +3,9 @@ export interface TaxRateEra {
|
|
|
3
3
|
rate: number;
|
|
4
4
|
}
|
|
5
5
|
export interface CompiledTaxRateEra {
|
|
6
|
-
validFrom:
|
|
6
|
+
validFrom: string;
|
|
7
7
|
rate: number;
|
|
8
|
+
timeZone: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const compileEraRates: (eras: TaxRateEra[],
|
|
10
|
+
export declare const compileEraRates: (eras: TaxRateEra[], timeZone: string) => CompiledTaxRateEra[];
|
|
10
11
|
export declare const rateForDate: (eras: CompiledTaxRateEra[]) => (referenceDate?: Date) => number;
|
|
@@ -1,14 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const formatDateInTimeZone = (date, timeZone) => {
|
|
2
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
3
|
+
timeZone,
|
|
4
|
+
year: 'numeric',
|
|
5
|
+
month: '2-digit',
|
|
6
|
+
day: '2-digit',
|
|
7
|
+
}).formatToParts(date);
|
|
8
|
+
const value = (type) => parts.find((part) => part.type === type)?.value;
|
|
9
|
+
return `${value('year')}-${value('month')}-${value('day')}`;
|
|
10
|
+
};
|
|
11
|
+
const isIsoDate = (value) => {
|
|
12
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
13
|
+
return false;
|
|
14
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
15
|
+
const parsed = new Date(Date.UTC(year, month - 1, day));
|
|
16
|
+
return (parsed.getUTCFullYear() === year && parsed.getUTCMonth() === month - 1 && parsed.getUTCDate() === day);
|
|
17
|
+
};
|
|
18
|
+
export const compileEraRates = (eras, timeZone) => {
|
|
19
|
+
new Intl.DateTimeFormat('en-US', { timeZone });
|
|
20
|
+
return eras
|
|
21
|
+
.map(({ validFrom, rate }) => {
|
|
22
|
+
if (!isIsoDate(validFrom)) {
|
|
23
|
+
throw new TypeError(`Invalid tax era date '${validFrom}'`);
|
|
24
|
+
}
|
|
25
|
+
return { validFrom, rate, timeZone };
|
|
26
|
+
})
|
|
27
|
+
.sort((left, right) => left.validFrom.localeCompare(right.validFrom));
|
|
28
|
+
};
|
|
7
29
|
export const rateForDate = (eras) => (referenceDate = new Date()) => {
|
|
8
|
-
|
|
30
|
+
if (!eras.length)
|
|
31
|
+
throw new TypeError('Cannot resolve a tax rate from an empty era list');
|
|
32
|
+
if (!Number.isFinite(referenceDate.getTime()))
|
|
33
|
+
throw new TypeError('Invalid tax reference date');
|
|
34
|
+
const localDate = formatDateInTimeZone(referenceDate, eras[0].timeZone);
|
|
9
35
|
let applicable = eras[0];
|
|
10
36
|
for (const era of eras) {
|
|
11
|
-
if (era.validFrom <=
|
|
37
|
+
if (era.validFrom <= localDate)
|
|
12
38
|
applicable = era;
|
|
13
39
|
}
|
|
14
40
|
return applicable.rate;
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "https://ec.europa.eu/taxation_customs/tedb/#/vat-search",
|
|
3
3
|
"verifiedAt": "2026-08-20",
|
|
4
|
-
"
|
|
4
|
+
"timezones": {
|
|
5
|
+
"AT": "Europe/Vienna",
|
|
6
|
+
"BE": "Europe/Brussels",
|
|
7
|
+
"BG": "Europe/Sofia",
|
|
8
|
+
"CY": "Asia/Nicosia",
|
|
9
|
+
"CZ": "Europe/Prague",
|
|
10
|
+
"DE": "Europe/Berlin",
|
|
11
|
+
"DK": "Europe/Copenhagen",
|
|
12
|
+
"EE": "Europe/Tallinn",
|
|
13
|
+
"ES": "Europe/Madrid",
|
|
14
|
+
"FI": "Europe/Helsinki",
|
|
15
|
+
"FR": "Europe/Paris",
|
|
16
|
+
"GR": "Europe/Athens",
|
|
17
|
+
"HR": "Europe/Zagreb",
|
|
18
|
+
"HU": "Europe/Budapest",
|
|
19
|
+
"IE": "Europe/Dublin",
|
|
20
|
+
"IT": "Europe/Rome",
|
|
21
|
+
"LT": "Europe/Vilnius",
|
|
22
|
+
"LU": "Europe/Luxembourg",
|
|
23
|
+
"LV": "Europe/Riga",
|
|
24
|
+
"MT": "Europe/Malta",
|
|
25
|
+
"NL": "Europe/Amsterdam",
|
|
26
|
+
"PL": "Europe/Warsaw",
|
|
27
|
+
"PT": "Europe/Lisbon",
|
|
28
|
+
"RO": "Europe/Bucharest",
|
|
29
|
+
"SE": "Europe/Stockholm",
|
|
30
|
+
"SI": "Europe/Ljubljana",
|
|
31
|
+
"SK": "Europe/Bratislava"
|
|
32
|
+
},
|
|
5
33
|
"countries": {
|
|
6
34
|
"AT": {
|
|
7
35
|
"standard": [
|
|
@@ -213,6 +241,10 @@
|
|
|
213
241
|
}
|
|
214
242
|
],
|
|
215
243
|
"reduced2": [
|
|
244
|
+
{
|
|
245
|
+
"validFrom": "2009-01-01",
|
|
246
|
+
"rate": 0.09
|
|
247
|
+
},
|
|
216
248
|
{
|
|
217
249
|
"validFrom": "2025-01-01",
|
|
218
250
|
"rate": 0.13
|
package/lib/pricing/tax/eu.js
CHANGED
|
@@ -6,7 +6,7 @@ const countryRates = Object.fromEntries(Object.entries(euTaxRates.countries).map
|
|
|
6
6
|
countryCode,
|
|
7
7
|
Object.fromEntries(Object.entries(categories).map(([category, eras]) => [
|
|
8
8
|
category,
|
|
9
|
-
rateForDate(compileEraRates(eras, euTaxRates.
|
|
9
|
+
rateForDate(compileEraRates(eras, euTaxRates.timezones[countryCode])),
|
|
10
10
|
])),
|
|
11
11
|
]));
|
|
12
12
|
const normalizeCountryCode = (countryCode) => {
|
|
@@ -1,7 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "https://taxfoundation.org/data/all/state/2026-sales-tax-rates-midyear/",
|
|
3
3
|
"verifiedAt": "2026-08-20",
|
|
4
|
-
"
|
|
4
|
+
"timezones": {
|
|
5
|
+
"AK": "America/Anchorage",
|
|
6
|
+
"AL": "America/Chicago",
|
|
7
|
+
"AR": "America/Chicago",
|
|
8
|
+
"AZ": "America/Phoenix",
|
|
9
|
+
"CA": "America/Los_Angeles",
|
|
10
|
+
"CO": "America/Denver",
|
|
11
|
+
"CT": "America/New_York",
|
|
12
|
+
"DC": "America/New_York",
|
|
13
|
+
"DE": "America/New_York",
|
|
14
|
+
"FL": "America/New_York",
|
|
15
|
+
"GA": "America/New_York",
|
|
16
|
+
"HI": "Pacific/Honolulu",
|
|
17
|
+
"IA": "America/Chicago",
|
|
18
|
+
"ID": "America/Boise",
|
|
19
|
+
"IL": "America/Chicago",
|
|
20
|
+
"IN": "America/Indiana/Indianapolis",
|
|
21
|
+
"KS": "America/Chicago",
|
|
22
|
+
"KY": "America/New_York",
|
|
23
|
+
"LA": "America/Chicago",
|
|
24
|
+
"MA": "America/New_York",
|
|
25
|
+
"MD": "America/New_York",
|
|
26
|
+
"ME": "America/New_York",
|
|
27
|
+
"MI": "America/Detroit",
|
|
28
|
+
"MN": "America/Chicago",
|
|
29
|
+
"MO": "America/Chicago",
|
|
30
|
+
"MS": "America/Chicago",
|
|
31
|
+
"MT": "America/Denver",
|
|
32
|
+
"NC": "America/New_York",
|
|
33
|
+
"ND": "America/Chicago",
|
|
34
|
+
"NE": "America/Chicago",
|
|
35
|
+
"NH": "America/New_York",
|
|
36
|
+
"NJ": "America/New_York",
|
|
37
|
+
"NM": "America/Denver",
|
|
38
|
+
"NV": "America/Los_Angeles",
|
|
39
|
+
"NY": "America/New_York",
|
|
40
|
+
"OH": "America/New_York",
|
|
41
|
+
"OK": "America/Chicago",
|
|
42
|
+
"OR": "America/Los_Angeles",
|
|
43
|
+
"PA": "America/New_York",
|
|
44
|
+
"RI": "America/New_York",
|
|
45
|
+
"SC": "America/New_York",
|
|
46
|
+
"SD": "America/Chicago",
|
|
47
|
+
"TN": "America/Chicago",
|
|
48
|
+
"TX": "America/Chicago",
|
|
49
|
+
"UT": "America/Denver",
|
|
50
|
+
"VA": "America/New_York",
|
|
51
|
+
"VT": "America/New_York",
|
|
52
|
+
"WA": "America/Los_Angeles",
|
|
53
|
+
"WI": "America/Chicago",
|
|
54
|
+
"WV": "America/New_York",
|
|
55
|
+
"WY": "America/Denver"
|
|
56
|
+
},
|
|
5
57
|
"states": {
|
|
6
58
|
"AK": [
|
|
7
59
|
{
|
|
@@ -268,10 +320,18 @@
|
|
|
268
320
|
}
|
|
269
321
|
],
|
|
270
322
|
"SD": [
|
|
323
|
+
{
|
|
324
|
+
"validFrom": "2016-06-01",
|
|
325
|
+
"rate": 0.045
|
|
326
|
+
},
|
|
271
327
|
{
|
|
272
328
|
"validFrom": "2023-07-01",
|
|
273
|
-
"rate": 0.042
|
|
274
|
-
|
|
329
|
+
"rate": 0.042
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"validFrom": "2027-07-01",
|
|
333
|
+
"rate": 0.045,
|
|
334
|
+
"note": "HB 1137 temporary cut expires after 2027-06-30"
|
|
275
335
|
}
|
|
276
336
|
],
|
|
277
337
|
"TN": [
|
package/lib/pricing/tax/us.js
CHANGED
|
@@ -4,7 +4,7 @@ export const US_COUNTRY_CODE = 'US';
|
|
|
4
4
|
export const US_SALES_TAX_EXEMPT_VALUE = 'exempt';
|
|
5
5
|
const stateRates = Object.fromEntries(Object.entries(usTaxRates.states).map(([stateCode, eras]) => [
|
|
6
6
|
stateCode,
|
|
7
|
-
rateForDate(compileEraRates(eras, usTaxRates.
|
|
7
|
+
rateForDate(compileEraRates(eras, usTaxRates.timezones[stateCode])),
|
|
8
8
|
]));
|
|
9
9
|
export const US_STATE_CODES = Object.keys(stateRates);
|
|
10
10
|
export const resolveUsSalesTaxRate = ({ regionCode, referenceDate, }) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/plugins",
|
|
3
3
|
"description": "Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.26",
|
|
5
5
|
"main": "lib/plugins-index.js",
|
|
6
6
|
"types": "lib/plugins-index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DeliveryAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
|
-
export const Post = {
|
|
4
|
-
...DeliveryAdapter,
|
|
5
|
-
key: 'shop.unchained.post',
|
|
6
|
-
label: 'Manual',
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
typeSupported: (type) => {
|
|
9
|
-
return type === DeliveryProviderType.SHIPPING;
|
|
10
|
-
},
|
|
11
|
-
actions: (config, context) => {
|
|
12
|
-
return {
|
|
13
|
-
...DeliveryAdapter.actions(config, context),
|
|
14
|
-
isActive: () => {
|
|
15
|
-
return true;
|
|
16
|
-
},
|
|
17
|
-
configurationError: () => {
|
|
18
|
-
return null;
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { Post } from "./adapter.js";
|
|
3
|
-
export const PostPlugin = {
|
|
4
|
-
key: 'shop.unchained.post',
|
|
5
|
-
label: 'Post Delivery Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [Post],
|
|
8
|
-
};
|
|
9
|
-
export default PostPlugin;
|
|
10
|
-
export { Post } from "./adapter.js";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { DeliveryAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
|
-
export const SendMessage = {
|
|
4
|
-
...DeliveryAdapter,
|
|
5
|
-
key: 'shop.unchained.delivery.send-message',
|
|
6
|
-
label: 'Forward via Messaging',
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
initialConfiguration: [
|
|
9
|
-
{ key: 'from', value: '' },
|
|
10
|
-
{ key: 'to', value: '' },
|
|
11
|
-
{ key: 'cc', value: '' },
|
|
12
|
-
],
|
|
13
|
-
typeSupported: (type) => {
|
|
14
|
-
return type === DeliveryProviderType.SHIPPING;
|
|
15
|
-
},
|
|
16
|
-
actions: (config, context) => {
|
|
17
|
-
return {
|
|
18
|
-
...DeliveryAdapter.actions(config, context),
|
|
19
|
-
isActive: () => {
|
|
20
|
-
return true;
|
|
21
|
-
},
|
|
22
|
-
configurationError: () => {
|
|
23
|
-
return null;
|
|
24
|
-
},
|
|
25
|
-
send: async () => {
|
|
26
|
-
const { modules, order } = context;
|
|
27
|
-
return modules.worker.addWork({
|
|
28
|
-
type: 'MESSAGE',
|
|
29
|
-
retries: 0,
|
|
30
|
-
input: {
|
|
31
|
-
template: 'DELIVERY',
|
|
32
|
-
orderId: order._id,
|
|
33
|
-
config,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { SendMessage } from "./adapter.js";
|
|
3
|
-
export const SendMessagePlugin = {
|
|
4
|
-
key: 'shop.unchained.delivery.send-message',
|
|
5
|
-
label: 'Send Message Delivery Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [SendMessage],
|
|
8
|
-
};
|
|
9
|
-
export default SendMessagePlugin;
|
|
10
|
-
export { SendMessage } from "./adapter.js";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DeliveryAdapter } from '@unchainedshop/core';
|
|
2
|
-
import { DeliveryProviderType } from '@unchainedshop/core-delivery';
|
|
3
|
-
export const PickMup = {
|
|
4
|
-
...DeliveryAdapter,
|
|
5
|
-
key: 'shop.unchained.stores',
|
|
6
|
-
label: 'Pre-configured Stores',
|
|
7
|
-
version: '1.0.0',
|
|
8
|
-
typeSupported: (type) => {
|
|
9
|
-
return type === DeliveryProviderType.PICKUP;
|
|
10
|
-
},
|
|
11
|
-
actions: (config, context) => {
|
|
12
|
-
const getStores = () => {
|
|
13
|
-
const storesItem = config.find((item) => item.key === 'stores');
|
|
14
|
-
if (!storesItem)
|
|
15
|
-
return [];
|
|
16
|
-
try {
|
|
17
|
-
return typeof storesItem.value === 'string' ? JSON.parse(storesItem.value) : storesItem.value;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return storesItem?.value ?? [];
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return {
|
|
24
|
-
...DeliveryAdapter.actions(config, context),
|
|
25
|
-
isActive() {
|
|
26
|
-
return true;
|
|
27
|
-
},
|
|
28
|
-
isAutoReleaseAllowed() {
|
|
29
|
-
return false;
|
|
30
|
-
},
|
|
31
|
-
configurationError() {
|
|
32
|
-
return null;
|
|
33
|
-
},
|
|
34
|
-
pickUpLocationById: async (id) => {
|
|
35
|
-
return getStores().find((store) => store._id === id);
|
|
36
|
-
},
|
|
37
|
-
pickUpLocations: async () => {
|
|
38
|
-
return getStores();
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { PickMup } from "./adapter.js";
|
|
3
|
-
export const PickMupPlugin = {
|
|
4
|
-
key: 'shop.unchained.stores',
|
|
5
|
-
label: 'Pick-up Stores Delivery Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [PickMup],
|
|
8
|
-
};
|
|
9
|
-
export default PickMupPlugin;
|
|
10
|
-
export { PickMup } from "./adapter.js";
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { EnrollmentAdapter } from '@unchainedshop/core';
|
|
2
|
-
export const rangeMatcher = (date = new Date()) => {
|
|
3
|
-
const timestamp = date.getTime();
|
|
4
|
-
return ({ start, end }) => {
|
|
5
|
-
const startTimestamp = new Date(start).getTime();
|
|
6
|
-
const endTimestamp = new Date(end).getTime();
|
|
7
|
-
return startTimestamp <= timestamp && endTimestamp >= timestamp;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export const LicensedEnrollments = {
|
|
11
|
-
...EnrollmentAdapter,
|
|
12
|
-
key: 'shop.unchained.enrollments.licensed',
|
|
13
|
-
version: '1.0.0',
|
|
14
|
-
label: 'Simple Licensed Enrollments',
|
|
15
|
-
isActivatedFor: (productPlan) => {
|
|
16
|
-
return productPlan?.usageCalculationType === 'LICENSED';
|
|
17
|
-
},
|
|
18
|
-
actions: (params) => {
|
|
19
|
-
const { enrollment } = params;
|
|
20
|
-
return {
|
|
21
|
-
...EnrollmentAdapter.actions(params),
|
|
22
|
-
isValidForActivation: async () => {
|
|
23
|
-
const periods = enrollment?.periods || [];
|
|
24
|
-
return periods.findIndex(rangeMatcher()) !== -1;
|
|
25
|
-
},
|
|
26
|
-
isOverdue: async () => {
|
|
27
|
-
return false;
|
|
28
|
-
},
|
|
29
|
-
configurationForOrder: async (context) => {
|
|
30
|
-
const { period } = context;
|
|
31
|
-
const beginningOfPeriod = period.start.getTime() <= new Date().getTime();
|
|
32
|
-
if (!enrollment)
|
|
33
|
-
throw new Error('Enrollment missing in context');
|
|
34
|
-
if (beginningOfPeriod) {
|
|
35
|
-
return {
|
|
36
|
-
period,
|
|
37
|
-
orderContext: {},
|
|
38
|
-
orderPositionTemplates: [
|
|
39
|
-
{
|
|
40
|
-
quantity: 1,
|
|
41
|
-
productId: enrollment.productId,
|
|
42
|
-
originalProductId: enrollment.productId,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {} from '@unchainedshop/core';
|
|
2
|
-
import { LicensedEnrollments } from "./adapter.js";
|
|
3
|
-
export const LicensedEnrollmentsPlugin = {
|
|
4
|
-
key: 'shop.unchained.enrollments.licensed',
|
|
5
|
-
label: 'Licensed Enrollments Plugin',
|
|
6
|
-
version: '1.0.0',
|
|
7
|
-
adapters: [LicensedEnrollments],
|
|
8
|
-
};
|
|
9
|
-
export default LicensedEnrollmentsPlugin;
|
|
10
|
-
export { LicensedEnrollments, rangeMatcher } from "./adapter.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type UnchainedCore } from '@unchainedshop/core';
|
|
2
|
-
import type { GridFSFileUploadsModule } from './module.ts';
|
|
3
|
-
export declare const gridfsRouteHandler: (request: Request, context: UnchainedCore & {
|
|
4
|
-
params: Record<string, string>;
|
|
5
|
-
modules: GridFSFileUploadsModule;
|
|
6
|
-
rawRequest?: any;
|
|
7
|
-
}) => Promise<Response>;
|