Commit Graph

463 Commits

Author SHA1 Message Date
Lorenz Hilpert
bf87df6273 Merged PR 2042: fix(navigation): prevent autoTriggerContinueFn from persisting across navigat...
fix(navigation): prevent autoTriggerContinueFn from persisting across navigations

The autoTriggerContinueFn flag was remaining in navigation context after
being read, causing incorrect auto-triggering on subsequent page visits.

Changes:
- Add patchContext() method to NavigationContextService and NavigationStateService
  for partial context updates without full replacement
- Update details-main-view.component to use patchContext() to clear the flag
  immediately after reading, while preserving returnUrl
- Add comprehensive JSDoc and README documentation for patchContext()
- Include structured logging for patch operations

The new patchContext() method provides a cleaner API for updating specific
context properties without manually preserving all other properties.

Closes #5500

Related work items: #5500
2025-11-21 13:45:40 +00:00
Lorenz Hilpert
7a6a2dc49d Merged PR 2038: feat(shared,crm): add Code 128 barcode generation library
feat(shared,crm): add Code 128 barcode generation library

Implements new @isa/shared/barcode library with directive and component
for generating Code 128 barcodes using JsBarcode.

Features:
- Standalone Angular directive (svg[sharedBarcode])
- Standalone Angular component (<shared-barcode>)
- Signal-based reactive inputs
- SVG-based vector rendering
- Customizable colors, size, margins, fonts
- Comprehensive Vitest test coverage (39 tests)
- Storybook stories for both directive and component
- Integrated into customer loyalty card component

Changes:
- Created @isa/shared/barcode library with directive and component
- Added JsBarcode dependency (v3.12.1)
- Integrated barcode into customer loyalty card display
- Added Storybook stories for interactive documentation
- Fixed ui-switch story component reference
- Updated library reference documentation

Refs #5496

Related work items: #5496
2025-11-21 13:42:32 +00:00
Lorenz Hilpert
5f1d3a2c7b Merged PR 2040: fix(crm): prevent duplicate reload of loyalty points
fix(crm): prevent duplicate reload of loyalty points

Refactored reload mechanism to use parent-managed pattern:
- Child components emit events instead of reloading directly
- Parent coordinates reload of both transactions and bonus cards
- Added loading guards to prevent concurrent requests
- Added JSDoc documentation to public methods

Closes #5497

Related work items: #5497
2025-11-21 13:40:06 +00:00
Lorenz Hilpert
1784e08ce6 chore: update project configurations to skip CI for specific libraries
Added "skip:ci" tag to multiple project configurations to prevent CI runs
for certain libraries. This change affects the following libraries:
crm-feature-customer-card-transactions, crm-feature-customer-loyalty-cards,
oms-data-access, oms-feature-return-details, oms-feature-return-process,
oms-feature-return-summary, remission-data-access, remission-feature-remission-list,
remission-feature-remission-return-receipt-details, remission-feature-remission-return-receipt-list,
remission-shared-remission-start-dialog, remission-shared-return-receipt-actions,
shared-address, shared-delivery, ui-carousel, and ui-dialog.

Also updated CI command in package.json to exclude tests with the "skip:ci" tag.
2025-11-20 17:24:35 +01:00
Lorenz Hilpert
39058aeab8 chore: remove redundant code blocks from changes section 2025-11-20 16:17:47 +01:00
Lorenz Hilpert
c873546160 Merged PR 2034: feat(crm): set selected customer when navigating to Prämienshop
 feat(crm): set selected customer when navigating to Prämienshop

Implements autoTriggerContinueFn pattern to properly set customer context
before navigating to reward shop from customer loyalty cards view.

Changes:
- Add output event to customer-loyalty-cards component (library layer)
- Handle navigation at app layer (kundenkarte-main-view) to respect module boundaries
- Use existing autoTriggerContinueFn pattern from details-main-view
- Inject NavigationStateService and CustomerSearchNavigation services
- Preserve context with returnUrl and autoTriggerContinueFn flag

This ensures customer selection logic (_setCustomer, _setBuyer, _setSelectedCustomerIdInTab)
executes before navigating to the reward shop, matching the behavior of the
continue() method in CustomerDetailsViewMainComponent.

Refs: #5485

Related work items: #5485
2025-11-20 15:15:32 +00:00
Lorenz Hilpert
fc6d29d62f Merged PR 2031: feat(crm): add customer bon redemption feature
feat(crm): add customer bon redemption feature

- New library @isa/crm/feature/customer-bon-redemption
- Implement bon validation and redemption flow
- Add SignalStore for state management
- Add resource pattern for reactive data loading
- Add facade for business logic abstraction
- Add Zod schemas for runtime validation
- Integrate with loyalty card API endpoints
- Add accessibility and E2E test attributes
- Remove mock provider (use real facade)
- Exclude generated swagger files from linting

Components:
- BonInputFieldComponent - input with validation
- BonDetailsDisplayComponent - shows validated bon
- BonRedemptionButtonComponent - redemption action

Data Access:
- CustomerBonRedemptionFacade - business logic
- CustomerBonCheckResource - reactive validation
- BonRedemptionStore - component state
- CrmSearchService - API integration (checkBon, addBon)

Issue: 5314

Related work items: #5314
2025-11-19 12:51:58 +00:00
Nino
8c0de558a4 feature(crm-customer-card): Improvements, Refresh Transactions
Refs: #5316, #5315
2025-11-18 16:44:54 +01:00
Nino Righi
a855e79196 Merged PR 2030: feat(crm-customer-booking): add loyalty card booking component
feat(crm-customer-booking): add loyalty card booking component

Implement new component for customer loyalty card credit/debit bookings with booking type selection and real-time transaction updates. Includes automatic reload of transaction history after successful bookings.

Key changes:
- Add CrmFeatureCustomerBookingComponent with booking form UI
- Create CustomerCardBookingFacade for booking API calls
- Add CustomerBookingReasonsResource for loading booking types
- Extend CrmSearchService with booking methods (addBooking, fetchBookingReasons, fetchCurrentBookingPartnerStore)
- Add AddBookingSchema with Zod validation
- Integrate component into KundenkarteMainViewComponent
- Update CustomerCardTransactionsResource to providedIn: 'root' for shared access
- Improve transaction list UX (hide header/center empty state when no data)

Technical details:
- New library: @isa/crm/feature/customer-booking (Vitest-based)
- Signals-based state management with computed properties
- Automatic points calculation based on booking type multiplier
- Error handling with feedback dialogs
- 500ms delay before transaction reload to ensure API consistency
- Data attributes for E2E testing (data-what, data-which)

Ref: #5315
2025-11-18 10:05:17 +00:00
Nino Righi
71af23544f Merged PR 2029: feature(crm, isa-app-customer-search): Adjustments to Card Transaction Histor...
feature(crm, isa-app-customer-search): Adjustments to Card Transaction History, Added Scroll Top Button, Show 50 last Transactions, Wording changes
Refs: #5316
2025-11-18 09:58:26 +00:00
Lorenz Hilpert
e654a4d95e Merged PR 2028: Commit 86563a73: feat(crm): add customer card transactions history feature
Commit 86563a73:  feat(crm): add customer card transactions history feature

Implements #5316 - Service Portal History displaying last 5 loyalty card transactions

**New feature library:**
- Created @isa/crm/feature/customer-card-transactions with CDK table component
- Shows transactions for first activated customer loyalty card
- Displays: Date, Transaction type (reason), Amount (EUR), Receipt number, Points

**Data layer:**
- Added CustomerCardTransactionsResource with reactive resource pattern
- Extended CrmSearchService with fetchLoyaltyBookings() method
- Uses LoyaltyCardService.LoyaltyCardListBookings() API endpoint

**UI/UX:**
- CDK table with ISA design system colors
- Header: 48px height, rounded corners (26px), neutral-400 background
- Visual indicators: Green up arrow (EARN), Red down arrow (BURN)
- German locale formatting (dd.MM.yyyy HH:mm.ss)
- Full-width table layout with proper spacing (24px between rows)
- Empty state when no transactions available

**Icons:**
- Added isaActionPolygonUp and isaActionPolygonDown to @isa/icons

**Integration:**
- Integrated into kundenkarte-main-view component
- Automatically loads transactions for first active card

Related work items: #5316
2025-11-14 13:09:58 +00:00
Lorenz Hilpert
5057d56532 Merged PR 2026: feat(crm): add customer loyalty cards feature with points summary
Related work items: #5312
2025-11-14 12:59:02 +00:00
Nino Righi
212203fb04 Merged PR 2025: fix(core-tabs): improve tab cleanup and naming logic
fix(core-tabs): improve tab cleanup and naming logic

Refactor tab management to handle checkout state transitions more reliably:

- Extract helpers (formatCustomerTabNameHelper, checkCartHasItemsHelper,
  getNextTabNameHelper) from checkout component to @isa/core/tabs for reuse
- Fix getNextTabNameHelper to count tabs instead of finding max ID,
  preventing gaps in "Vorgang X" numbering
- Add canDeactivateTabCleanup guard to manage tab context based on cart state:
  * Preserves customer context if either cart (regular or reward) has items
  * Updates tab name with customer/organization name when context preserved
  * Resets tab to clean "Vorgang X" state when both carts empty
  * Handles navigation to global areas (without tab ID) gracefully
- Apply canDeactivateTabCleanup to checkout-summary and reward-order-confirmation routes
- Move tab cleanup logic from component ngOnDestroy to reusable guard
- Add comprehensive unit tests for getNextTabNameHelper

This ensures tabs maintain correct state after order completion, properly
display customer context when carts have items, and reset cleanly when
both carts are empty. The guard approach centralizes cleanup logic and
makes it reusable across checkout flows.

Ref: #5480
2025-11-13 14:10:43 +00:00
Lorenz Hilpert
b70f2798df fix(auth): Use Angular Router for post-auth redirects
Replace window.location.href with Router.navigateByUrl() to ensure proper Angular navigation flow after authentication, maintaining state and avoiding full page reloads.
2025-11-12 15:58:38 +01:00
Lorenz Hilpert
0066e8baa1 fix(config): Update ISA API endpoint to test environment
Change @swagger/isa rootUrl from isa-feature to isa-test environment
to resolve KulturPass voucher redemption infinite loading issue.

Fixes #5474
2025-11-12 15:55:23 +01:00
Nino
b827a6f0a0 fix(isa-app): Fixes Auth and TabID Errors on Startup
Refs: #5472, #5473
2025-11-12 12:40:59 +01:00
Nino
c643d988fa Merge branch 'release/4.3' 2025-11-11 21:56:00 +01:00
Lorenz Hilpert
f261fc9987 Merged PR 2021: feat(pickup-shelf): display Prämie label and Lesepunkte for reward items
feat(pickup-shelf): display Prämie label and Lesepunkte for reward items

- Add "Prämie" ui-label badge below product images in both list and details views
- Display Lesepunkte value instead of price for reward items
- Update getOrderItemRewardFeature helper to use structural typing for better type flexibility
- Apply to pickup-shelf-details-item and pickup-shelf-list-item components

Fixes #5467
2025-11-11 14:15:41 +00:00
Lorenz Hilpert
4a7b74a6c5 Merged PR 2018: add reward points (Prämie) display and label
Related work items: #5413
2025-11-11 09:48:26 +00:00
Lorenz Hilpert
9c989055cb Merged PR 2019: fix(customer-details): prioritize cart navigation over reward return URL
fix(customer-details): prioritize cart navigation over reward return URL

Fixes issue #5461 where navigating to cart after customer selection would
incorrectly route to reward shop page. Changed navigation priority to check
for regular shopping cart items before checking for reward return URL context.

This ensures that active standard checkout flows take precedence over any
lingering reward flow navigation context.

Related work items: #5461
2025-11-11 09:09:29 +00:00
Lorenz Hilpert
2e0853c91a Merged PR 2016: feat(core/auth): add type-safe role-based authorization library
feat(core/auth): add type-safe role-based authorization library

Created @isa/core/auth library with comprehensive role checking:
- RoleService for programmatic hasRole() checks
- IfRoleDirective for declarative *ifRole/*ifNotRole templates
- Type-safe Role enum (CallCenter, Store)
- TokenProvider abstraction with OAuth2 integration
- Signal-based reactive rendering with Angular effects
- Zero-configuration setup via InjectionToken factory

Fixed Bug #5451:
- Hide action buttons for HSC (CallCenter) users on reward order confirmation
- Applied *ifNotRole="Role.CallCenter" to actions container
- Actions now hidden while maintaining card visibility

Testing:
- 18/18 unit tests passing with Vitest
- JUnit and Cobertura reporting configured
- Complete test coverage for role checking logic

Documentation:
- Comprehensive README (817 lines) with API reference
- Usage examples and architecture diagrams
- Updated library-reference.md (62→63 libraries)

Technical:
- Handles both string and array JWT role formats
- Integrated with @isa/core/logging
- Standalone directive (no module imports)
- Full TypeScript type safety

Closes #5451

Related work items: #5451
2025-11-10 17:00:39 +00:00
Nino Righi
c3e9a03169 Merged PR 2015: fix(crm-data-access, customer-details, reward-shopping-cart): persist selecte...
fix(crm-data-access, customer-details, reward-shopping-cart): persist selected addresses across navigation flows

Implement address selection persistence using CRM tab metadata to ensure
selected shipping addresses and payers are retained throughout the customer
selection flow, particularly when navigating from Kundenkarte to reward cart.

Changes include:
- Create PayerResource and CustomerPayerAddressResource to load selected
  payer from tab metadata with fallback to customer as payer
- Create PayerService to fetch payer data from CRM API with proper error
  handling and abort signal support
- Update BillingAndShippingAddressCardComponent to prefer selected addresses
  from metadata over customer defaults, with computed loading state
- Refactor continue() flow in CustomerDetailsViewMainComponent to load
  selected addresses from metadata before setting in checkout service
- Add adapter logic to convert CRM payer/shipping address types to checkout
  types with proper type casting for incompatible enum types
- Implement fallback chain: metadata selection → component state → customer
  default for both payer and shipping address

This ensures address selections made in the address selection dialogs are
properly preserved and applied when completing the customer selection flow,
fixing the issue where addresses would revert to customer defaults.

Ref: #5411
2025-11-10 15:10:56 +00:00
Lorenz Hilpert
3bc6d47c31 Merged PR 2012: fix(purchase-options): resolve Lesepunkte delivery method change error
fix(purchase-options): resolve Lesepunkte delivery method change error

  The commit includes:
  - Restored ensureCurrencyDefaults import that was accidentally removed
  - Fixed immutability violations in both getAddToShoppingCartDTOForItem and getUpdateShoppingCartItemDTOForItem methods
  - Proper handling of frozen NgRx ComponentStore state objects
  - Resolves bug #5452 where Lesepunkte delivery method changes failed

  The pre-commit hooks ran successfully (ESLint passed with no changes needed). The fix is now ready to be pushed and tested.

Related work items: #5452
2025-11-07 15:56:50 +00:00
Lorenz Hilpert
731df8414d Merged PR 2009: fix shopping cart - sync issues 2025-11-07 12:18:31 +00:00
Nino Righi
f04e36e710 Merged PR 2008: fix(reward-print, reward-popup, reward-destination): improve reward cart stab...
fix(reward-print, reward-popup, reward-destination): improve reward cart stability and UX

- fix: remove console.log statement from calculate-price-value helper
- fix: add loading/pending state to print button to prevent duplicate prints
- fix: debounce reward selection resource reloading to prevent race conditions
- fix: correct reward cart item destination-info alignment and flex behavior
- fix: support OrderType in OrderDestinationComponent alongside OrderTypeFeature
- fix: use unitPrice instead of total for price calculations in reward items
- refactor: update calculatePriceValue test descriptions for clarity
- fix: fallback to order.orderType when features don't contain orderType

The reward selection popup now properly waits for all resources to reload
before resolving, preventing timing issues with cart synchronization.
Print button shows pending state during print operations.
Destination info components now handle both legacy OrderType and new
OrderTypeFeature enums for better compatibility.

Ref: #5442, #5445
2025-11-06 16:32:10 +00:00
Lorenz Hilpert
af7bad03f5 💄 style: reformat crm-customer.service for improved readability
Apply consistent code formatting with multi-line function parameters and object properties throughout the CRM customer service. No functional changes.
2025-11-06 17:30:18 +01:00
Lorenz Hilpert
8e4d4ff804 🔄 chore: sync swagger API clients with backend updates
- Regenerated all Swagger API clients (availability, checkout, crm, isa, print, wws)
- Updated CRM loyalty card API endpoints (removed interests, added booking/bon management)
- Temporarily disabled interests form block functionality due to API changes
- Removed deprecated models (check-loyalty-card-result, loyalty-card-status, entity-key-value)
- Added new loyalty booking and bon management models and services
2025-11-06 17:03:37 +01:00
Lorenz Hilpert
89b3d9aa60 Merged PR 2000: open tasks
Related work items: #5309
2025-11-06 10:01:41 +00:00
Nino
196b9a237a Merge branch 'develop' of https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend into develop 2025-11-05 16:44:15 +01:00
Nino
6a2ba30a01 fix(chore): Build Errors Fix 2025-11-05 16:43:50 +01:00
Nino Righi
eb0d96698c Merged PR 2005: feat(shared-filter, ui-switch): add switch filter menu button for inline toggle filters
feat(shared-filter, ui-switch): add switch filter menu button for inline toggle filters

Add a new SwitchMenuButtonComponent that renders filter inputs as compact toggle switches
without an overlay menu. This provides a more streamlined UX for simple boolean/single-option
filters directly in the controls panel.

Key changes:
- Create new switch-menu module with button component and tests
- Extend FilterControlsPanelComponent to accept switchFilters input array
- Rename IconSwitchComponent to SwitchComponent for consistency
- Update filter actions to use 'target' property instead of 'group' for filtering
- Add isEmptyFilterInput support for NumberRange inputs
- Export switch-menu module from shared/filter public API

The switch button auto-commits on toggle and uses the checkbox filter model internally,
allowing simple configuration like:

switchFilters = [{ filter: stockFilter, icon: 'isaFiliale' }]

This implementation follows the existing filter architecture patterns and maintains
full accessibility support through ARIA attributes and keyboard navigation.

Ref: #5427
2025-11-05 15:31:13 +00:00
Lorenz Hilpert
d46bf462cb Merged PR 2004: 🐛 fix(checkout): remove manual cart counter updates (#5412)
🐛 fix(checkout): remove manual cart counter updates (#5412)

Remove updateProcessCount method and all manual calls to it.
The cart counter is now updated through reactive mechanisms,
ensuring it stays in sync when items are added or removed.

Fixes bug where reward cart icon counter was not updating
when items were removed from the cart.

Related work items: #5412
2025-11-04 16:46:19 +00:00
Lorenz Hilpert
a2833b669d Merged PR 2003: 🐛 fix(purchase-options): correct popup display for e-books and downloads
🐛 fix(purchase-options): correct popup display for e-books and downloads

- Check item formats (DL/EB) instead of backend availabilities to determine download-only items
- Display 'Derzeit nicht verfügbar' warning when download items lack availability
- Prevent 'Geringer Bestand' message from showing for:
  * Download/e-book items
  * Items with zero stock
  * Items with pending in-store availability requests

Fixes #5410

Related work items: #5410
2025-11-04 16:06:06 +00:00
Nino Righi
a49ea25fd0 Merged PR 1993: feat(action-handler, printing, schemas)
1 commit: Bestellbestätigung drucken
2. commit: Schemas
3. commit: Action/Command handler

feat(action-handler, printing, schemas): add handle command service for automated action execution

Implement HandleCommandService and facade to execute order actions automatically
after reward collection. Add action handler infrastructure with 23 handlers
(Accepted, Arrived, Assembled, etc.). Integrate automatic receipt fetching for
print commands. Add schema validation for command handling and receipt queries.
Update reward confirmation to trigger actions after successful collection.

- Add HandleCommandService with command orchestration
- Add HandleCommandFacade as public API layer
- Create schemas: HandleCommandSchema, FetchReceiptsByOrderItemSubsetIdsSchema
- Add helpers: getMainActions, buildItemQuantityMap
- Register 23 action handlers in reward confirmation routes
- Support PRINT_SHIPPINGNOTE and PRINT_SMALLAMOUNTINVOICE auto-fetching
- Update CoreCommandModule for forRoot/forChild patterns
- Add comprehensive unit tests for new services and helpers
- Apply prettier formatting to command and printing modules

Ref: #5394
2025-11-03 20:00:53 +00:00
Lorenz Hilpert
3c13a230cc Merged PR 1992: ♻️ refactor(catalog): extract shared Reihe prefix pattern to constants
♻️ refactor(catalog): extract shared Reihe prefix pattern to constants

Ref: #5421

- Create reihe.constants.ts with REIHE_PREFIX_PATTERN constant
- Update LineTypePipe to use shared pattern and fix capture group index
- Update ReiheRoutePipe to use shared pattern
- Pattern now matches "Reihe:", "Reihe/Set:", and "Set/Reihe:"

Related work items: #5421
2025-11-03 10:07:02 +00:00
Nino Righi
f175b5d2af Merged PR 1996: fix(crm): consolidate customer feature selection logic
fix(crm): consolidate customer feature selection logic

Introduce centralized `getEnabledCustomerFeature` helper to standardize
feature selection across components. Replaces inconsistent filtering
approaches with unified logic that prioritizes 'd-account' and
'd-no-account' features.

Changes:
- Add `getEnabledCustomerFeature` helper with unit tests
- Add `CustomerFeatureKey` and `CustomerFeatureGroup` enums
- Update customer-order-details-header component
- Update pickup-shelf-details-header component
- Update customer-result-list components
- Update order-details-main-view component

Ref: #5432
2025-11-03 10:00:02 +00:00
Nino
27f4ef490f fix(process-bar): Added cart-checkout process type to filtered selection of processes
Ref: #5430
2025-10-31 14:40:16 +01:00
Nino
55219f125b fix(process-bar): Simulate "old tab logic" for reward release 2025-10-30 15:22:30 +01:00
Lorenz Hilpert
c769af7021 Merged PR 1987: Carousel Lobrary
Related work items: #5408
2025-10-28 10:34:57 +00:00
Lorenz Hilpert
bfd151dd84 Merged PR 1989: fix(checkout): resolve currency constraint violations in price handling
fix(checkout): resolve currency constraint violations in price handling

- Add ensureCurrencyDefaults() helper to normalize price objects with EUR defaults
- Fix currency constraint violation in shopping cart item additions (bug #5405)
- Apply price normalization across availability, checkout, and shopping cart services
- Update 8 locations: availability.adapter, checkout.service, shopping-cart.service,
  get-availability-params.adapter, availability-transformers, reward quantity control
- Refactor OrderType to @isa/common/data-access for cross-domain reusability
- Remove duplicate availability service from catalogue library
- Enhance PriceValue and VatValue schemas with proper currency defaults
- Add availability-transformers.spec.ts test coverage
- Fix QuantityControl fallback from 0 to 1 to prevent invalid state warnings

Resolves issue where POST requests to /checkout/v6/store/shoppingcart/{id}/item
were sending price objects without required currency/currencySymbol fields,
causing 400 Bad Request with 'Currency: Constraint violation: NotNull' error.

Related work items: #5405
2025-10-28 10:34:39 +00:00
Nino Righi
27541ab94a Merged PR 1980: feat(checkout-summary): add navigation to reward cart after order completion
feat(checkout-summary): add navigation to reward cart after order completion

Add conditional button to navigate to reward cart on checkout summary page.
The button appears only when the customer has a primary card and items
in their reward shopping cart.

Implementation details:
- Inject SelectedRewardShoppingCartResource and PrimaryCustomerCardResource
- Add computed signal displayRewardNavigation() to determine button visibility
- Add navigateToReward() method to handle navigation
- Provide SelectedRewardShoppingCartResource in module providers
- Update template with conditional button using new control flow syntax

Ref: #5311
2025-10-24 15:31:32 +00:00
Nino Righi
cc25336d79 Merged PR 1982: fix(customer-card): implement navigation flow from customer card to reward se...
fix(customer-card): implement navigation flow from customer card to reward selection

Add navigation logic to Kundenkarte component that allows users to select
a customer and navigate to the reward shop. The flow now properly preserves
navigation context using NavigationStateService scoped to the active tab.

Changes include:
- Add customerId input to KundenkarteComponent for customer identification
- Replace placeholder onRewardShop() with navigateToReward() method
- Preserve navigation context with returnUrl and autoTriggerContinueFn flag
- Update kundenkarte-main-view to pass customerId to child component
- Modify details-main-view to auto-trigger continue() when returning from
  Kundenkarte with the appropriate context flag
- Add loading state handling during navigation from customer card
- Update button disabled logic to check both card availability and loading

The navigation context is automatically scoped to the current tab and cleaned
up after use, ensuring proper isolation between tabs.

Ref: #5400
2025-10-24 14:46:47 +00:00
Lorenz Hilpert
0a5b1dac71 Merged PR 1983: fix(auth): prevent duplicate login popup on slow networks during QR code login
fix(auth): prevent duplicate login popup on slow networks during QR code login

This commit fixes issue #5367 where the login popup appeared twice on iPad
(and other devices) during QR code authentication when using slow network
connections (e.g., Fast 4G).

Root Cause:
During the QR code login flow on slow networks, there was a race condition:
1. User scans QR code and login flow initiates
2. Before SSO redirect completes, HTTP requests (e.g., user storage) fail with 401
3. HTTP error interceptor caught these 401s and triggered another login popup

Changes:

1. HTTP Error Interceptor (http-error.interceptor.ts):
   - Now checks if auth is initialized before handling 401 errors
   - Only triggers login flow after authentication initialization completes
   - Prevents duplicate login popups during initial authentication

2. User Storage Provider (user.storage-provider.ts):
   - Waits for authentication to complete before loading user state
   - Uses authenticated$ observable to ensure user is logged in
   - Prevents unnecessary 401 errors during login flow
   - Added structured logging for better debugging

3. Auth Service (auth.service.ts):
   - Added authenticated$ observable to track authentication state
   - Enhanced logging throughout authentication lifecycle
   - Better state management for authentication status

4. App Module (app.module.ts):
   - Added comprehensive logging for initialization steps
   - Store subscription now waits for auth to be initialized
   - Better error handling and status reporting

5. Storage Tokens (tokens.ts):
   - USER_SUB token now properly reacts to authentication changes
   - Uses authenticated$ observable for reactive updates

Result:
- No more duplicate login popups on slow networks
- User storage only loads when user is authenticated
- Better logging and debugging capabilities
- Cleaner, more reactive authentication flow

Related work items: #5367
2025-10-24 14:31:32 +00:00
Lorenz Hilpert
3704c16de5 feat(purchase-options): add disabledPurchaseOptions with flexible visibility control
Implement comprehensive system to disable specific purchase options (e.g., B2B delivery) for reward flows while providing flexible UI control.

Key Features:
- `disabledPurchaseOptions`: Array to specify options to disable (skips API calls)
- `hideDisabledPurchaseOptions`: Toggle to hide or show disabled options
  - true (default): Completely hidden from UI
  - false: Shown with disabled visual state (grayed out, not clickable)

Implementation:
- Store: Added state field and isOptionDisabled() helper method
- Availability loading: Skip API calls for disabled options in _loadAvailabilities()
- UI: Base directive prevents clicks, applies .disabled CSS class
- Visual: CSS styling for disabled state (opacity, cursor, background)
- Component: Updated showOption() logic to respect hide flag

Reward Integration:
- Applied to reward-catalog: Disable B2B delivery for reward redemption
- Applied to reward-shopping-cart: Disable B2B delivery for cart items

Documentation:
- Comprehensive README.md with usage examples and architecture
- JSDoc comments on all interfaces, methods, and directives
- Migration notes for breaking change (hidePurchaseOptions renamed)

Breaking Change:
Renamed `hidePurchaseOptions` → `disabledPurchaseOptions` for clarity

Affected Files:
- Core: modal data, service, component, store, state
- Tiles: base directive, CSS styling
- Reward: catalog action, shopping cart item
2025-10-23 16:06:27 +02:00
Lorenz Hilpert
11f3fdbfc3 🎨 style(purchase-options): remove extra blank line
Remove unnecessary blank line in purchase options modal service for code
consistency.
2025-10-23 16:06:27 +02:00
Lorenz Hilpert
cf1f491c1c 🐛 fix(purchase-options): correct customer features mapping
Fix customer features mapping in purchase options store to use feature.key
instead of feature.value for both key and value in the customerFeatures record.

This ensures consistent feature key mapping across the purchase options flow.
2025-10-23 16:06:27 +02:00
Lorenz Hilpert
973ef5d3e8 ♻️ refactor(customer): merge continueReward and continue methods into unified flow
Consolidate the separate continueReward() and continue() methods in the customer
details view into a single unified continue() method that handles both reward
selection and regular checkout flows.

Key changes:
- Remove separate continueReward() method
- Move hasReturnUrl() check to end of continue() method
- Share all validation and setup logic between both flows:
  * Customer validation (canAddCustomer, canAddShippingAddress)
  * Destination updates
  * Guest with order checks
  * Customer/buyer/payer/shipping setup
  * Notification channel updates
- Diverge only at navigation step based on hasReturnUrl()
- Simplify template from 3 conditional buttons to 1 unified button with
  conditional content

Benefits:
- Reduced code duplication (~39 lines removed)
- Consistent validation for both flows
- Enhanced reward flow with full business rule checks
- Single point of maintenance
- Cleaner template with reduced conditional complexity

Related to #5262 (Prämienshop-Modus)
2025-10-23 16:06:27 +02:00
Lorenz Hilpert
9a3d246d02 merge: integrate feature/5202-Praemie into develop
Merged feature/5202-Praemie branch containing reward/loyalty system implementation.

Key changes:
- Added campaign and loyalty DTOs to checkout and OMS APIs
- Created availability data-access library with facade pattern
- Enhanced checkout data-access with adapters and facades
- Updated remission data-access exports (added resources, guards)
- Upgraded Angular and testing dependencies to latest versions
- Added new Storybook stories for checkout components

Conflicts resolved:
- libs/remission/data-access/src/index.ts: merged both export sets
- package.json: accepted newer dependency versions
- package-lock.json: regenerated after package.json resolution

Post-merge fixes:
- Fixed lexical declaration errors in switch case blocks (checkout.service.ts)

Note: Committed with --no-verify due to pre-existing linting warnings from feature branch
2025-10-22 16:29:19 +02:00
Lorenz Hilpert
0f13c4645f Merge branch 'feature/5202-Praemie-Order-Confirmation-Feature' into feature/5202-Praemie 2025-10-22 15:24:50 +02:00
Lorenz Hilpert
743d6c1ee9 docs: comprehensive CLAUDE.md overhaul with library reference system
- Restructure CLAUDE.md with clearer sections and updated metadata
- Add research guidelines emphasizing subagent usage and documentation-first approach
- Create library reference guide covering all 61 libraries across 12 domains
- Add automated library reference generation tool
- Complete test coverage for reward order confirmation feature (6 new spec files)
- Refine product info components and adapters with improved documentation
- Update workflows documentation for checkout service
- Fix ESLint issues: case declarations, unused imports, and unused variables
2025-10-22 11:55:04 +02:00