feat: product design surveys, cart expiry/buy-later, and catalog polish
Add like/dislike surveys with majority alerts for manufacturing decisions, clearer accounting mapping copy, and related cart/catalog admin-app improvements. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { AccountingFeatures, documentStatusRank } from './accounting-config';
|
||||
import { AccountingSyncService } from './accounting-sync.service';
|
||||
import { AccountingWorkerService } from './accounting-worker.service';
|
||||
import { ACCOUNTING_PROVIDERS } from './providers';
|
||||
import { accountingDebug } from './accounting-debug-log';
|
||||
|
||||
type Tx = Prisma.TransactionClient | PrismaService;
|
||||
|
||||
@@ -54,11 +55,18 @@ export class AccountingHooksService {
|
||||
*/
|
||||
async orderStatusReached(tx: Tx, orderId: string, status: string) {
|
||||
const c = await this.config.get();
|
||||
if (c.provider === 'none' || !c.features.documents) return;
|
||||
const trace = (decision: string) =>
|
||||
accountingDebug('order.status', { orderId, status, provider: c.provider, triggerStatus: c.documents.triggerStatus, decision });
|
||||
if (c.provider === 'none' || !c.features.documents) return trace('ignored: provider none or documents switched off');
|
||||
const rank = documentStatusRank(status);
|
||||
if (!rank) return;
|
||||
if (rank >= documentStatusRank(c.documents.triggerStatus)) await this.queueOrderDocument(tx, c.provider, orderId);
|
||||
else await this.orderCancelled(tx, orderId);
|
||||
if (!rank) return trace('ignored: status never triggers a document');
|
||||
if (rank >= documentStatusRank(c.documents.triggerStatus)) {
|
||||
await this.queueOrderDocument(tx, c.provider, orderId);
|
||||
trace('document queued (unless one was already queued)');
|
||||
} else {
|
||||
await this.orderCancelled(tx, orderId);
|
||||
trace('below trigger status: any sent document withdrawn');
|
||||
}
|
||||
}
|
||||
|
||||
private async queueOrderDocument(tx: Tx, provider: string, orderId: string) {
|
||||
|
||||
Reference in New Issue
Block a user