@unchainedshop/plugins 4.8.4 → 5.0.0-alpha.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.
Files changed (58) hide show
  1. package/README.md +0 -2
  2. package/lib/events/node-event-emitter.d.ts +3 -1
  3. package/lib/events/node-event-emitter.js +3 -3
  4. package/lib/files/gridfs/adapter.d.ts +2 -2
  5. package/lib/files/gridfs/adapter.js +2 -5
  6. package/lib/files/gridfs/index.d.ts +5 -4
  7. package/lib/files/gridfs/index.js +30 -3
  8. package/lib/files/minio/api.js +1 -2
  9. package/lib/files/minio/index.d.ts +4 -5
  10. package/lib/files/minio/index.js +18 -157
  11. package/lib/files/temp-upload/api.d.ts +2 -0
  12. package/lib/files/temp-upload/api.js +1 -2
  13. package/lib/payment/apple-iap/adapter.d.ts +2 -1
  14. package/lib/payment/apple-iap/adapter.js +2 -3
  15. package/lib/payment/apple-iap/api.js +1 -1
  16. package/lib/payment/apple-iap/index.d.ts +6 -4
  17. package/lib/payment/apple-iap/index.js +28 -3
  18. package/lib/payment/cryptopay/api.js +1 -1
  19. package/lib/payment/cryptopay/handle-webhook.js +2 -1
  20. package/lib/payment/cryptopay/index.d.ts +5 -4
  21. package/lib/payment/cryptopay/index.js +31 -3
  22. package/lib/payment/datatrans-v2/adapter.js +11 -3
  23. package/lib/payment/datatrans-v2/api/authorize.js +1 -1
  24. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +1 -1
  25. package/lib/payment/datatrans-v2/api/cancel.js +1 -1
  26. package/lib/payment/datatrans-v2/api/init.js +1 -1
  27. package/lib/payment/datatrans-v2/api/secureFields.js +1 -1
  28. package/lib/payment/datatrans-v2/api/settle.js +1 -1
  29. package/lib/payment/datatrans-v2/api/status.js +1 -1
  30. package/lib/payment/datatrans-v2/api/validate.js +1 -1
  31. package/lib/payment/datatrans-v2/index.d.ts +4 -1
  32. package/lib/payment/datatrans-v2/index.js +17 -411
  33. package/lib/payment/payrexx/api/index.js +2 -2
  34. package/lib/payment/payrexx/api.js +1 -1
  35. package/lib/payment/payrexx/index.d.ts +4 -1
  36. package/lib/payment/payrexx/index.js +19 -158
  37. package/lib/payment/postfinance-checkout/index.d.ts +5 -0
  38. package/lib/payment/postfinance-checkout/index.js +25 -186
  39. package/lib/payment/saferpay/adapter.js +1 -2
  40. package/lib/payment/saferpay/index.d.ts +5 -4
  41. package/lib/payment/saferpay/index.js +29 -3
  42. package/lib/payment/stripe/index.d.ts +4 -1
  43. package/lib/payment/stripe/index.js +22 -116
  44. package/lib/payment/stripe/stripe.js +1 -4
  45. package/lib/presets/all.d.ts +1 -70
  46. package/lib/presets/all.js +41 -27
  47. package/lib/presets/base.d.ts +1 -25
  48. package/lib/presets/base.js +56 -25
  49. package/lib/presets/countries/ch.d.ts +1 -2
  50. package/lib/presets/countries/ch.js +7 -2
  51. package/lib/presets/crypto.d.ts +3 -7
  52. package/lib/presets/crypto.js +18 -7
  53. package/lib/worker/bulk-import/api.d.ts +2 -0
  54. package/lib/worker/bulk-import/api.js +1 -2
  55. package/lib/worker/bulkgate/adapter.js +1 -1
  56. package/lib/worker/twilio/adapter.js +1 -1
  57. package/lib/worker/update-coinbase-rates/adapter.js +3 -5
  58. package/package.json +25 -30
@@ -1,25 +1,56 @@
1
- import "../delivery/post.js";
2
- import "../payment/invoice.js";
3
- import "../warehousing/store.js";
4
- import "../pricing/free-payment.js";
5
- import "../pricing/free-delivery.js";
6
- import "../pricing/order-items.js";
7
- import "../pricing/order-discount.js";
8
- import "../pricing/order-delivery.js";
9
- import "../pricing/order-payment.js";
10
- import "../pricing/product-catalog-price.js";
11
- import "../pricing/product-discount.js";
12
- import "../quotations/manual.js";
13
- import "../enrollments/licensed.js";
14
- import "../events/node-event-emitter.js";
15
- import "../worker/bulk-import.js";
16
- import "../worker/zombie-killer.js";
17
- import "../worker/message.js";
18
- import "../worker/external.js";
19
- import "../worker/http-request.js";
20
- import "../worker/heartbeat.js";
21
- import "../worker/email.js";
22
- import "../worker/error-notifications.js";
23
- import "../worker/bulk-export.js";
24
- import gridfsModules from "../files/gridfs/index.js";
25
- export default gridfsModules;
1
+ import { pluginRegistry } from '@unchainedshop/core';
2
+ import { setEmitAdapter } from '@unchainedshop/events';
3
+ import { GridFSPlugin } from "../files/gridfs/index.js";
4
+ import { TempUploadPlugin } from "../files/temp-upload/index.js";
5
+ import { InvoicePlugin } from "../payment/invoice/index.js";
6
+ import { PostPlugin } from "../delivery/post/index.js";
7
+ import { StorePlugin } from "../warehousing/store/index.js";
8
+ import { ERCMetadataPlugin } from "../warehousing/erc-metadata/index.js";
9
+ import { PaymentFreePricePlugin } from "../pricing/free-payment/index.js";
10
+ import { DeliveryFreePricePlugin } from "../pricing/free-delivery/index.js";
11
+ import { OrderItemsPlugin } from "../pricing/order-items/index.js";
12
+ import { OrderDiscountPlugin } from "../pricing/order-discount/index.js";
13
+ import { OrderDeliveryPlugin } from "../pricing/order-delivery/index.js";
14
+ import { OrderPaymentPlugin } from "../pricing/order-payment/index.js";
15
+ import { ProductPricePlugin } from "../pricing/product-catalog-price/index.js";
16
+ import { ProductDiscountPlugin } from "../pricing/product-discount/index.js";
17
+ import { ManualOfferingPlugin } from "../quotations/manual/index.js";
18
+ import { LicensedEnrollmentsPlugin } from "../enrollments/licensed/index.js";
19
+ import { NodeEventEmitter } from "../events/node-event-emitter.js";
20
+ import { BulkImportPlugin } from "../worker/bulk-import/index.js";
21
+ import { ZombieKillerPlugin } from "../worker/zombie-killer/index.js";
22
+ import { MessagePlugin } from "../worker/message/index.js";
23
+ import { ExternalPlugin } from "../worker/external/index.js";
24
+ import { HttpRequestPlugin } from "../worker/http-request/index.js";
25
+ import { HeartbeatPlugin } from "../worker/heartbeat/index.js";
26
+ import { EmailPlugin } from "../worker/email/index.js";
27
+ import { ErrorNotificationsPlugin } from "../worker/error-notifications/index.js";
28
+ import { BulkExportPlugin } from "../worker/bulk-export/index.js";
29
+ export function registerBasePlugins() {
30
+ pluginRegistry.register(GridFSPlugin);
31
+ pluginRegistry.register(TempUploadPlugin);
32
+ pluginRegistry.register(InvoicePlugin);
33
+ pluginRegistry.register(PostPlugin);
34
+ pluginRegistry.register(StorePlugin);
35
+ pluginRegistry.register(ERCMetadataPlugin);
36
+ pluginRegistry.register(PaymentFreePricePlugin);
37
+ pluginRegistry.register(DeliveryFreePricePlugin);
38
+ pluginRegistry.register(OrderItemsPlugin);
39
+ pluginRegistry.register(OrderDiscountPlugin);
40
+ pluginRegistry.register(OrderDeliveryPlugin);
41
+ pluginRegistry.register(OrderPaymentPlugin);
42
+ pluginRegistry.register(ProductPricePlugin);
43
+ pluginRegistry.register(ProductDiscountPlugin);
44
+ pluginRegistry.register(ManualOfferingPlugin);
45
+ pluginRegistry.register(LicensedEnrollmentsPlugin);
46
+ setEmitAdapter(NodeEventEmitter());
47
+ pluginRegistry.register(BulkImportPlugin);
48
+ pluginRegistry.register(ZombieKillerPlugin);
49
+ pluginRegistry.register(MessagePlugin);
50
+ pluginRegistry.register(ExternalPlugin);
51
+ pluginRegistry.register(HttpRequestPlugin);
52
+ pluginRegistry.register(HeartbeatPlugin);
53
+ pluginRegistry.register(EmailPlugin);
54
+ pluginRegistry.register(ErrorNotificationsPlugin);
55
+ pluginRegistry.register(BulkExportPlugin);
56
+ }
@@ -1,2 +1 @@
1
- import '../../pricing/product-swiss-tax.ts';
2
- import '../../pricing/delivery-swiss-tax.ts';
1
+ export declare function registerSwissTaxPlugins(): void;
@@ -1,2 +1,7 @@
1
- import "../../pricing/product-swiss-tax.js";
2
- import "../../pricing/delivery-swiss-tax.js";
1
+ import { ProductSwissTaxPlugin } from "../../pricing/product-swiss-tax/index.js";
2
+ import { DeliverySwissTaxPlugin } from "../../pricing/delivery-swiss-tax/index.js";
3
+ import { pluginRegistry } from '@unchainedshop/core';
4
+ export function registerSwissTaxPlugins() {
5
+ pluginRegistry.register(ProductSwissTaxPlugin);
6
+ pluginRegistry.register(DeliverySwissTaxPlugin);
7
+ }
@@ -1,7 +1,3 @@
1
- import cryptopayModules from '../payment/cryptopay/index.ts';
2
- import '../warehousing/eth-minter.ts';
3
- import '../pricing/product-price-rateconversion.ts';
4
- import '../worker/update-ecb-rates.ts';
5
- import '../worker/update-coinbase-rates.ts';
6
- import '../worker/export-token.ts';
7
- export default cryptopayModules;
1
+ declare const _default: {};
2
+ export default _default;
3
+ export declare function registerCryptoPlugins(): void;
@@ -1,7 +1,18 @@
1
- import cryptopayModules from "../payment/cryptopay/index.js";
2
- import "../warehousing/eth-minter.js";
3
- import "../pricing/product-price-rateconversion.js";
4
- import "../worker/update-ecb-rates.js";
5
- import "../worker/update-coinbase-rates.js";
6
- import "../worker/export-token.js";
7
- export default cryptopayModules;
1
+ import { pluginRegistry } from '@unchainedshop/core';
2
+ import { CryptopayPlugin } from "../payment/cryptopay/index.js";
3
+ import { ETHMinterPlugin } from "../warehousing/eth-minter/index.js";
4
+ import { ProductPriceRateConversionPlugin } from "../pricing/product-price-rateconversion/index.js";
5
+ import { ExportTokenPlugin } from "../worker/export-token/index.js";
6
+ import { UpdateECBRatesPlugin } from "../worker/update-ecb-rates/index.js";
7
+ import { UpdateCoinbaseRatesPlugin } from "../worker/update-coinbase-rates/index.js";
8
+ import { UpdateTokenOwnershipPlugin } from "../worker/update-token-ownership/index.js";
9
+ export default {};
10
+ export function registerCryptoPlugins() {
11
+ pluginRegistry.register(CryptopayPlugin);
12
+ pluginRegistry.register(ETHMinterPlugin);
13
+ pluginRegistry.register(ProductPriceRateConversionPlugin);
14
+ pluginRegistry.register(ExportTokenPlugin);
15
+ pluginRegistry.register(UpdateECBRatesPlugin);
16
+ pluginRegistry.register(UpdateCoinbaseRatesPlugin);
17
+ pluginRegistry.register(UpdateTokenOwnershipPlugin);
18
+ }
@@ -1,7 +1,9 @@
1
1
  import type { UnchainedCore } from '@unchainedshop/core';
2
+ import type { RolesInterface } from '@unchainedshop/roles';
2
3
  export declare function bulkImportHandler(request: Request, context: UnchainedCore & {
3
4
  params: Record<string, string>;
4
5
  rawRequest?: any;
6
+ roles?: RolesInterface;
5
7
  userId?: string;
6
8
  user?: any;
7
9
  }): Promise<Response>;
@@ -1,9 +1,8 @@
1
1
  import { createLogger } from '@unchainedshop/logger';
2
- import { Roles } from '@unchainedshop/roles';
3
2
  const logger = createLogger('unchained:bulk-import');
4
3
  export async function bulkImportHandler(request, context) {
5
4
  try {
6
- const hasPermission = await Roles.userHasPermission(context, 'bulkImport', []);
5
+ const hasPermission = await context.roles?.userHasPermission(context, 'bulkImport', []);
7
6
  if (!hasPermission) {
8
7
  return Response.json({ error: 'Permission denied', message: 'User does not have bulkImport permission' }, { status: 403 });
9
8
  }
@@ -31,7 +31,7 @@ export const BulkGateWorker = {
31
31
  },
32
32
  body: JSON.stringify(requestBody),
33
33
  });
34
- const responseData = await response.json();
34
+ const responseData = (await response.json());
35
35
  if (responseData.error || responseData.type) {
36
36
  return {
37
37
  success: false,
@@ -26,7 +26,7 @@ export const SmsWorkerPlugin = {
26
26
  ...params,
27
27
  }),
28
28
  });
29
- const data = await response.json();
29
+ const data = (await response.json());
30
30
  if (!response.ok) {
31
31
  return {
32
32
  success: false,
@@ -1,11 +1,9 @@
1
1
  import { WorkerAdapter, WorkerDirector, schedule } from '@unchainedshop/core';
2
2
  import { resolveBestCurrency } from '@unchainedshop/utils';
3
3
  const getExchangeRates = async (base) => {
4
- return fetch(`https://api.coinbase.com/v2/exchange-rates?currency=${base}`, {
5
- method: 'GET',
6
- })
7
- .then((res) => res.json())
8
- .then((r) => r?.data);
4
+ const res = await fetch(`https://api.coinbase.com/v2/exchange-rates?currency=${base}`);
5
+ const { data } = (await res.json());
6
+ return data;
9
7
  };
10
8
  const everyMinute = schedule.parse.cron('* * * * *');
11
9
  export const UpdateCoinbaseRates = {
package/package.json CHANGED
@@ -1,11 +1,22 @@
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",
4
+ "version": "5.0.0-alpha.1",
5
5
  "main": "lib/plugins-index.js",
6
6
  "types": "lib/plugins-index.d.ts",
7
7
  "exports": {
8
- "./*": "./lib/*"
8
+ "./presets/*": "./lib/presets/*.js",
9
+ "./presets/countries/*": "./lib/presets/countries/*.js",
10
+ "./events/*": "./lib/events/*.js",
11
+ "./enrollments/*": "./lib/enrollments/*/index.js",
12
+ "./quotations/*": "./lib/quotations/*/index.js",
13
+ "./filters/*": "./lib/filters/*/index.js",
14
+ "./delivery/*": "./lib/delivery/*/index.js",
15
+ "./warehousing/*": "./lib/warehousing/*/index.js",
16
+ "./payment/*": "./lib/payment/*/index.js",
17
+ "./files/*": "./lib/files/*/index.js",
18
+ "./pricing/*": "./lib/pricing/*/index.js",
19
+ "./worker/*": "./lib/worker/*/index.js"
9
20
  },
10
21
  "type": "module",
11
22
  "scripts": {
@@ -37,32 +48,28 @@
37
48
  },
38
49
  "homepage": "https://github.com/unchainedshop/unchained#readme",
39
50
  "dependencies": {
40
- "@unchainedshop/api": "^4.6.0",
41
- "@unchainedshop/core-delivery": "^4.6.0",
42
- "@unchainedshop/core-enrollments": "^4.6.0",
43
- "@unchainedshop/core-orders": "^4.6.0",
44
- "@unchainedshop/core-payment": "^4.6.0",
45
- "@unchainedshop/core-products": "^4.6.0",
46
- "@unchainedshop/core-warehousing": "^4.6.0",
47
- "@unchainedshop/core-worker": "^4.6.0",
48
- "@unchainedshop/events": "^4.6.0",
49
- "@unchainedshop/file-upload": "^4.6.0",
50
- "@unchainedshop/logger": "^4.6.0",
51
- "@unchainedshop/utils": "^4.6.0"
51
+ "@unchainedshop/api": "^5.0.0-alpha.1",
52
+ "@unchainedshop/core-delivery": "^5.0.0-alpha.1",
53
+ "@unchainedshop/core-enrollments": "^5.0.0-alpha.1",
54
+ "@unchainedshop/core-orders": "^5.0.0-alpha.1",
55
+ "@unchainedshop/core-payment": "^5.0.0-alpha.1",
56
+ "@unchainedshop/core-products": "^5.0.0-alpha.1",
57
+ "@unchainedshop/core-warehousing": "^5.0.0-alpha.1",
58
+ "@unchainedshop/core-worker": "^5.0.0-alpha.1",
59
+ "@unchainedshop/events": "^5.0.0-alpha.1",
60
+ "@unchainedshop/logger": "^5.0.0-alpha.1",
61
+ "@unchainedshop/utils": "^5.0.0-alpha.1"
52
62
  },
53
63
  "peerDependencies": {
54
64
  "@aws-sdk/client-eventbridge": ">= 3.714 < 4",
55
- "@paypal/checkout-server-sdk": "1.x",
56
65
  "@redis/client": ">= 1 < 6",
57
66
  "@scure/bip32": ">= 2",
58
67
  "@scure/btc-signer": ">= 2",
59
68
  "mime": ">= 4 < 5",
60
- "expiry-map": "2.x",
61
69
  "express": ">= 5 < 6",
62
70
  "fastify": ">= 5.2 < 6",
63
71
  "minio": "8.x",
64
72
  "nodemailer": ">= 6.9 < 9",
65
- "p-memoize": "8.x",
66
73
  "stripe": ">= 19 < 21",
67
74
  "web-push": ">= 3.6 <4",
68
75
  "xml-js": ">= 1.6 < 2"
@@ -71,9 +78,6 @@
71
78
  "@aws-sdk/client-eventbridge": {
72
79
  "optional": true
73
80
  },
74
- "@paypal/checkout-server-sdk": {
75
- "optional": true
76
- },
77
81
  "@redis/client": {
78
82
  "optional": true
79
83
  },
@@ -83,9 +87,6 @@
83
87
  "@scure/btc-signer": {
84
88
  "optional": true
85
89
  },
86
- "expiry-map": {
87
- "optional": true
88
- },
89
90
  "express": {
90
91
  "optional": true
91
92
  },
@@ -98,9 +99,6 @@
98
99
  "nodemailer": {
99
100
  "optional": true
100
101
  },
101
- "p-memoize": {
102
- "optional": true
103
- },
104
102
  "stripe": {
105
103
  "optional": true
106
104
  },
@@ -112,18 +110,15 @@
112
110
  }
113
111
  },
114
112
  "devDependencies": {
115
- "@paypal/checkout-server-sdk": "^1.0.3",
116
113
  "@redis/client": "^5.6.0",
117
114
  "@scure/bip32": "^2.0.0",
118
115
  "@scure/btc-signer": "^2.0.0",
119
116
  "@types/express": "^5.0.3",
120
117
  "@types/node": "^25.0.0",
121
- "expiry-map": "^2.0.0",
122
118
  "express": "^5.1.0",
123
119
  "fastify": "^5.4.0",
124
120
  "minio": "^8.0.5",
125
- "nodemailer": "^8.0.2",
126
- "p-memoize": "^8.0.0",
121
+ "nodemailer": "^8.0.1",
127
122
  "stripe": "^20.0.0",
128
123
  "typescript": "^5.8.3",
129
124
  "web-push": "^3.6.7",