@unchainedshop/platform 3.0.0-alpha7 → 3.0.0-rc2
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/bulk-importer/createBulkImporter.d.ts +0 -1
- package/lib/bulk-importer/createBulkImporter.d.ts.map +1 -1
- package/lib/bulk-importer/createBulkImporter.js +12 -15
- package/lib/bulk-importer/createBulkImporter.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/create.js +2 -2
- package/lib/bulk-importer/handlers/filter/create.js.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.d.ts.map +1 -1
- package/lib/bulk-importer/handlers/filter/update.js +1 -1
- package/lib/bulk-importer/handlers/filter/update.js.map +1 -1
- package/lib/bulk-importer/handlers/product/remove.js +1 -1
- package/lib/bulk-importer/handlers/product/remove.js.map +1 -1
- package/lib/bulk-importer/upsertAsset.d.ts.map +1 -1
- package/lib/bulk-importer/upsertAsset.js +1 -1
- package/lib/bulk-importer/upsertAsset.js.map +1 -1
- package/lib/context/setAccessToken.js +2 -2
- package/lib/context/setAccessToken.js.map +1 -1
- package/lib/migrations/runMigrations.js +2 -2
- package/lib/migrations/runMigrations.js.map +1 -1
- package/lib/setup/setupCarts.d.ts.map +1 -1
- package/lib/setup/setupCarts.js +5 -2
- package/lib/setup/setupCarts.js.map +1 -1
- package/lib/setup/setupTemplates.d.ts.map +1 -1
- package/lib/setup/setupTemplates.js +3 -3
- package/lib/setup/setupTemplates.js.map +1 -1
- package/lib/setup/setupUploadHandlers.d.ts +3 -0
- package/lib/setup/setupUploadHandlers.d.ts.map +1 -0
- package/lib/setup/setupUploadHandlers.js +19 -0
- package/lib/setup/setupUploadHandlers.js.map +1 -0
- package/lib/setup/setupWorkqueue.d.ts +3 -2
- package/lib/setup/setupWorkqueue.d.ts.map +1 -1
- package/lib/setup/setupWorkqueue.js +3 -1
- package/lib/setup/setupWorkqueue.js.map +1 -1
- package/lib/startPlatform.d.ts.map +1 -1
- package/lib/startPlatform.js +5 -2
- package/lib/startPlatform.js.map +1 -1
- package/lib/templates/order-parser/formatAddress.d.ts +1 -1
- package/lib/templates/order-parser/formatAddress.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderPositionsData.d.ts +1 -2
- package/lib/templates/order-parser/getOrderPositionsData.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderPositionsData.js +6 -6
- package/lib/templates/order-parser/getOrderPositionsData.js.map +1 -1
- package/lib/templates/order-parser/getOrderSummaryData.d.ts +2 -2
- package/lib/templates/order-parser/getOrderSummaryData.d.ts.map +1 -1
- package/lib/templates/order-parser/getOrderSummaryData.js +5 -2
- package/lib/templates/order-parser/getOrderSummaryData.js.map +1 -1
- package/lib/templates/order-parser/index.d.ts +3 -2
- package/lib/templates/order-parser/index.d.ts.map +1 -1
- package/lib/templates/order-parser/index.js.map +1 -1
- package/lib/templates/resolveAccountActionTemplate.d.ts +1 -1
- package/lib/templates/resolveAccountActionTemplate.d.ts.map +1 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts +1 -1
- package/lib/templates/resolveEnrollmentStatusTemplate.d.ts.map +1 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts +1 -1
- package/lib/templates/resolveErrorReportTemplate.d.ts.map +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.d.ts.map +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.js +1 -1
- package/lib/templates/resolveForwardDeliveryTemplate.js.map +1 -1
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts +5 -2
- package/lib/templates/resolveOrderConfirmationTemplate.d.ts.map +1 -1
- package/lib/templates/resolveOrderConfirmationTemplate.js.map +1 -1
- package/lib/templates/resolveOrderRejectionTemplate.d.ts +1 -1
- package/lib/templates/resolveOrderRejectionTemplate.d.ts.map +1 -1
- package/lib/templates/resolveQuotationStatusTemplate.d.ts +1 -1
- package/lib/templates/resolveQuotationStatusTemplate.d.ts.map +1 -1
- package/package.json +15 -21
- package/src/bulk-importer/createBulkImporter.ts +14 -21
- package/src/bulk-importer/handlers/filter/create.ts +9 -18
- package/src/bulk-importer/handlers/filter/update.ts +4 -9
- package/src/bulk-importer/handlers/product/remove.ts +1 -1
- package/src/bulk-importer/upsertAsset.ts +9 -12
- package/src/context/setAccessToken.ts +2 -2
- package/src/migrations/runMigrations.ts +2 -2
- package/src/setup/setupCarts.ts +10 -9
- package/src/setup/setupTemplates.ts +4 -5
- package/src/setup/setupUploadHandlers.ts +22 -0
- package/src/setup/setupWorkqueue.ts +5 -9
- package/src/startPlatform.ts +6 -2
- package/src/templates/order-parser/formatAddress.ts +1 -1
- package/src/templates/order-parser/getOrderPositionsData.ts +8 -11
- package/src/templates/order-parser/getOrderSummaryData.ts +6 -4
- package/src/templates/order-parser/index.ts +5 -1
- package/src/templates/resolveAccountActionTemplate.ts +1 -1
- package/src/templates/resolveEnrollmentStatusTemplate.ts +1 -1
- package/src/templates/resolveErrorReportTemplate.ts +1 -1
- package/src/templates/resolveForwardDeliveryTemplate.ts +2 -2
- package/src/templates/resolveOrderConfirmationTemplate.ts +5 -5
- package/src/templates/resolveOrderRejectionTemplate.ts +1 -1
- package/src/templates/resolveQuotationStatusTemplate.ts +1 -1
- package/tsconfig.json +5 -7
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
2
|
import { Order } from '@unchainedshop/core-orders';
|
|
3
3
|
import formatPrice from './formatPrice.js';
|
|
4
|
+
import { ProductPricingSheet } from '@unchainedshop/core';
|
|
4
5
|
|
|
5
6
|
type PriceFormatter = ({ amount, currency }: { amount: number; currency: string }) => string;
|
|
6
7
|
|
|
7
8
|
export const getOrderPositionsData = async (
|
|
8
9
|
order: Order,
|
|
9
|
-
params: { locale?:
|
|
10
|
+
params: { locale?: string; useNetPrice?: boolean; format?: PriceFormatter },
|
|
10
11
|
context: UnchainedCore,
|
|
11
12
|
) => {
|
|
12
13
|
const { modules } = context;
|
|
@@ -19,18 +20,15 @@ export const getOrderPositionsData = async (
|
|
|
19
20
|
orderPositions.map(async (orderPosition) => {
|
|
20
21
|
const productTexts = await modules.products.texts.findLocalizedText({
|
|
21
22
|
productId: orderPosition.productId,
|
|
22
|
-
locale: params.locale
|
|
23
|
+
locale: params.locale,
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
const positionPricing = ProductPricingSheet({
|
|
27
|
+
calculation: orderPosition.calculation,
|
|
28
|
+
currency: order.currency,
|
|
29
|
+
quantity: orderPosition.quantity,
|
|
27
30
|
});
|
|
28
31
|
|
|
29
|
-
const positionPricing = modules.orders.positions.pricingSheet(
|
|
30
|
-
orderPosition,
|
|
31
|
-
order.currency,
|
|
32
|
-
context,
|
|
33
|
-
);
|
|
34
32
|
const total = positionPricing.total({ useNetPrice });
|
|
35
33
|
const unitPrice = positionPricing.unitPrice({ useNetPrice });
|
|
36
34
|
|
|
@@ -38,7 +36,6 @@ export const getOrderPositionsData = async (
|
|
|
38
36
|
return {
|
|
39
37
|
productId: orderPosition.productId,
|
|
40
38
|
configuration: orderPosition.configuration,
|
|
41
|
-
originalProductTexts,
|
|
42
39
|
productTexts,
|
|
43
40
|
quantity,
|
|
44
41
|
rawPrices: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
2
1
|
import { Order } from '@unchainedshop/core-orders';
|
|
3
|
-
import { OrderPricingRowCategory } from '@unchainedshop/core
|
|
2
|
+
import { UnchainedCore, OrderPricingSheet, OrderPricingRowCategory } from '@unchainedshop/core';
|
|
4
3
|
import formatPrice from './formatPrice.js';
|
|
5
4
|
import { formatAddress } from './formatAddress.js';
|
|
6
5
|
|
|
@@ -8,7 +7,7 @@ type PriceFormatter = ({ amount, currency }: { amount: number; currency: string
|
|
|
8
7
|
|
|
9
8
|
export const getOrderSummaryData = async (
|
|
10
9
|
order: Order,
|
|
11
|
-
params: { locale?:
|
|
10
|
+
params: { locale?: string; useNetPrice?: boolean; format?: PriceFormatter },
|
|
12
11
|
context: UnchainedCore,
|
|
13
12
|
) => {
|
|
14
13
|
const { modules } = context;
|
|
@@ -28,7 +27,10 @@ export const getOrderSummaryData = async (
|
|
|
28
27
|
|
|
29
28
|
const deliveryAddress = formatAddress(orderDelivery?.context?.deliveryAddress || order.billingAddress);
|
|
30
29
|
const billingAddress = formatAddress(order.billingAddress);
|
|
31
|
-
const orderPricing =
|
|
30
|
+
const orderPricing = OrderPricingSheet({
|
|
31
|
+
calculation: order.calculation,
|
|
32
|
+
currency: order.currency,
|
|
33
|
+
});
|
|
32
34
|
|
|
33
35
|
const paymentTotal = orderPricing.total({
|
|
34
36
|
category: OrderPricingRowCategory.Payment,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
1
2
|
import { getOrderPositionsData } from './getOrderPositionsData.js';
|
|
2
3
|
import { getOrderSummaryData } from './getOrderSummaryData.js';
|
|
3
4
|
|
|
@@ -31,7 +32,10 @@ Total: {{summary.prices.gross}}
|
|
|
31
32
|
{{/summary.rawPrices.taxes.amount}}
|
|
32
33
|
`;
|
|
33
34
|
|
|
34
|
-
export const transformOrderToText = async (
|
|
35
|
+
export const transformOrderToText = async (
|
|
36
|
+
{ order, locale }: { order: Order; locale: string },
|
|
37
|
+
context,
|
|
38
|
+
) => {
|
|
35
39
|
const { modules } = context;
|
|
36
40
|
const data = {
|
|
37
41
|
orderDate: new Date(order.ordered).toLocaleString(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateResolver } from '@unchainedshop/core
|
|
1
|
+
import { TemplateResolver } from '@unchainedshop/core';
|
|
2
2
|
import { systemLocale } from '@unchainedshop/utils';
|
|
3
3
|
import { transformOrderToText } from './order-parser/index.js';
|
|
4
4
|
|
|
@@ -28,7 +28,7 @@ export const resolveForwardDeliveryTemplate: TemplateResolver = async ({ config,
|
|
|
28
28
|
const data = {
|
|
29
29
|
shopName: EMAIL_WEBSITE_NAME,
|
|
30
30
|
shopUrl: EMAIL_WEBSITE_URL,
|
|
31
|
-
orderDetails: await transformOrderToText({ order, locale: systemLocale }, context),
|
|
31
|
+
orderDetails: await transformOrderToText({ order, locale: systemLocale.baseName }, context),
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
return [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateResolver } from '@unchainedshop/core
|
|
1
|
+
import { TemplateResolver } from '@unchainedshop/core';
|
|
2
2
|
import { transformOrderToText } from './order-parser/index.js';
|
|
3
3
|
|
|
4
4
|
const { EMAIL_FROM, EMAIL_WEBSITE_NAME, EMAIL_WEBSITE_URL } = process.env;
|
|
@@ -11,10 +11,10 @@ Thank you very much for your order.
|
|
|
11
11
|
{{shopName}}: {{shopUrl}}
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
|
-
export const resolveOrderConfirmationTemplate: TemplateResolver
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
) => {
|
|
14
|
+
export const resolveOrderConfirmationTemplate: TemplateResolver<{
|
|
15
|
+
orderId: string;
|
|
16
|
+
locale: string;
|
|
17
|
+
}> = async ({ orderId, locale }, context) => {
|
|
18
18
|
const { modules } = context;
|
|
19
19
|
const order = await modules.orders.findOrder({ orderId });
|
|
20
20
|
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../shared/base.tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"declarationDir": "./lib",
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./lib"
|
|
6
7
|
},
|
|
7
|
-
"exclude": ["**/*.test.ts", "**/*.test.js", "tests"]
|
|
8
|
-
|
|
9
|
-
"./src"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
8
|
+
"exclude": ["**/*.test.ts", "**/*.test.js", "tests", "lib"]
|
|
9
|
+
}
|