Skip to content

Commit

Permalink
feat: CXINT-1851: PDF Invoices feature library (#17807)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
SherwinVarghese and github-actions[bot] authored Sep 14, 2023
1 parent 4246b61 commit b519cbc
Show file tree
Hide file tree
Showing 126 changed files with 5,157 additions and 33 deletions.
7 changes: 6 additions & 1 deletion .env-cmdrc
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud",
"CX_B2B": "true",
"CX_S4OM": "true",
"CX_REQUESTED_DELIVERY_DATE": "true"
"CX_REQUESTED_DELIVERY_DATE": "true",
"CX_PDF_INVOICES": "true"
},
"requested-delivery-date": {
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s8-public.model-t.myhybris.cloud",
"CX_REQUESTED_DELIVERY_DATE": "true"
},
"pdf-invoices": {
"CX_BASE_URL": "https://api.cg79x9wuu9-eccommerc1-s5-public.model-t.myhybris.cloud",
"CX_PDF_INVOICES": "true"
}
}
16 changes: 16 additions & 0 deletions core-libs/setup/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
4 changes: 4 additions & 0 deletions extra-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ module.exports = {
__dirname,
'feature-libs/organization'
),
'@spartacus/pdf-invoices': path.join(
__dirname,
'feature-libs/pdf-invoices'
),
'@spartacus/product': path.join(__dirname, 'feature-libs/product'),
'@spartacus/product-configurator': path.join(
__dirname,
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/asm/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/cart/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/checkout/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/customer-ticketing/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/order/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
16 changes: 16 additions & 0 deletions feature-libs/organization/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@
"@spartacus/organization/user-registration/root": [
"../../feature-libs/organization/user-registration/root/public_api"
],
"@spartacus/pdf-invoices/assets": [
"../../feature-libs/pdf-invoices/assets/public_api"
],
"@spartacus/pdf-invoices/components": [
"../../feature-libs/pdf-invoices/components/public_api"
],
"@spartacus/pdf-invoices/core": [
"../../feature-libs/pdf-invoices/core/public_api"
],
"@spartacus/pdf-invoices": ["../../feature-libs/pdf-invoices/public_api"],
"@spartacus/pdf-invoices/occ": [
"../../feature-libs/pdf-invoices/occ/public_api"
],
"@spartacus/pdf-invoices/root": [
"../../feature-libs/pdf-invoices/root/public_api"
],
"@spartacus/pickup-in-store/assets": [
"../../feature-libs/pickup-in-store/assets/public_api"
],
Expand Down
4 changes: 4 additions & 0 deletions feature-libs/pdf-invoices/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": ["schematics/**/*.d.ts"]
}
4 changes: 4 additions & 0 deletions feature-libs/pdf-invoices/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# PDF Invoices

This feature allows users to view invoices for their orders and download PDF invoices using `Invoices` APIs.
When the user selects an invoice, the backend returns a byte array, which is converted to PDF and downloaded.
2 changes: 2 additions & 0 deletions feature-libs/pdf-invoices/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import '@spartacus/styles/scss/core';
@import './styles/index';
6 changes: 6 additions & 0 deletions feature-libs/pdf-invoices/assets/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "./public_api.ts"
}
}
7 changes: 7 additions & 0 deletions feature-libs/pdf-invoices/assets/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: 2023 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

export * from './translations/translations';
11 changes: 11 additions & 0 deletions feature-libs/pdf-invoices/assets/translations/en/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2023 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

import { pdfInvoices } from './pdf-invoices';

export const en = {
pdfInvoices,
};
39 changes: 39 additions & 0 deletions feature-libs/pdf-invoices/assets/translations/en/pdf-invoices.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SPDX-FileCopyrightText: 2023 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

export const pdfInvoices = {
pdfInvoices: {
featureNotEnabled:
'Unable to obtain invoices, ensure that SAP Invoice and API for Invoices are enabled.',
invoicesLoadingError:
'Something went wrong. Unable to display invoices for the order',
invoicesTable: {
header: 'Invoices',
label: 'Invoices Table',
invoiceId: 'Invoice #',
createdAt: 'Date',
netAmount: 'Net Amount',
totalAmount: 'Total Amount',
attachment: 'Download Invoice',
download: 'Download',
attachmentDescription: 'Download PDF for invoice {{id}}.',
noneFound: 'No Invoices Found',
},
downloadPDFError: 'Something went wrong. Unable to obtain the invoice PDF.',
sortBy: 'Sort by',
sortInvoices: 'Sort invoices',
sorts: {
byCreatedAtAsc: 'Date Ascending',
byCreatedAtDesc: 'Date Descending',
byInvoiceIdAsc: 'Invoice Number Ascending',
byInvoiceIdDesc: 'Invoice Number Descending',
byNetAmountAsc: 'Net Amount Ascending',
byNetAmountDesc: 'Net Amount Descending',
byTotalAmountAsc: 'Total Amount Ascending',
byTotalAmountDesc: 'Total Amount Descending',
},
},
};
16 changes: 16 additions & 0 deletions feature-libs/pdf-invoices/assets/translations/translations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* SPDX-FileCopyrightText: 2023 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

import { TranslationChunksConfig, TranslationResources } from '@spartacus/core';
import { en } from './en/index';

export const pdfInvoicesTranslations: TranslationResources = {
en,
};

export const pdfInvoicesTranslationChunksConfig: TranslationChunksConfig = {
pdfInvoices: ['pdfInvoices'],
};
7 changes: 7 additions & 0 deletions feature-libs/pdf-invoices/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* SPDX-FileCopyrightText: 2023 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

export * from './pdf-invoices-components.module';
Loading

0 comments on commit b519cbc

Please sign in to comment.