@capibox/bridge-server 0.0.71 → 0.0.73

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/dist/index.d.ts CHANGED
@@ -1037,9 +1037,23 @@ interface components {
1037
1037
  project?: string;
1038
1038
  };
1039
1039
  WebhookResponseDto: {
1040
- /** @example Webhook detail retrieved successfully */
1041
- message: string;
1042
- webhook: components["schemas"]["WebhookDetailDto"];
1040
+ /** @description The unique identifier of the webhook */
1041
+ id: number;
1042
+ /** @description The title of the webhook */
1043
+ title?: string;
1044
+ /** @description The events that trigger the webhook */
1045
+ events: string[];
1046
+ /** @description The URL endpoint to send the webhook to */
1047
+ endpoint: string;
1048
+ /**
1049
+ * @description The HTTP method to use when sending the webhook
1050
+ * @default GET
1051
+ */
1052
+ method: string;
1053
+ /** @description The authorization header to use when sending the webhook */
1054
+ authorization?: string;
1055
+ /** @description The project associated with the webhook */
1056
+ project?: string;
1043
1057
  };
1044
1058
  UpdateWebhookDto: {
1045
1059
  /** @description The title of the webhook */
@@ -2481,48 +2495,6 @@ interface components {
2481
2495
  uuid: string;
2482
2496
  event: components["schemas"]["TiktokCapiPayloadBridge"];
2483
2497
  };
2484
- ReportItemDto: {
2485
- /**
2486
- * @description Unique ID of the report item
2487
- * @example 1
2488
- */
2489
- id: number;
2490
- /**
2491
- * @description Order ID
2492
- * @example ORD-123456
2493
- */
2494
- orderId: string;
2495
- /**
2496
- * @description Country code
2497
- * @example US
2498
- */
2499
- country: string;
2500
- /**
2501
- * @description Origin of the order
2502
- * @example web
2503
- */
2504
- origin: string;
2505
- /**
2506
- * @description Gender of the customer
2507
- * @example male
2508
- */
2509
- gender: string;
2510
- /**
2511
- * @description Language code
2512
- * @example en
2513
- */
2514
- language: string;
2515
- /**
2516
- * @description Slug associated with the report item
2517
- * @example sample-slug-1
2518
- */
2519
- slug: string;
2520
- /**
2521
- * @description Customer email
2522
- * @example customer1@example.com
2523
- */
2524
- email: string;
2525
- };
2526
2498
  TrustpilotServiceReviewInvitationDto: {
2527
2499
  /** @example 507f191e810c19729de860ea */
2528
2500
  templateId: string;
@@ -6873,6 +6845,48 @@ interface components {
6873
6845
  */
6874
6846
  message: string;
6875
6847
  };
6848
+ ReportItemDto: {
6849
+ /**
6850
+ * @description Unique ID of the report item
6851
+ * @example 1
6852
+ */
6853
+ id: number;
6854
+ /**
6855
+ * @description Order ID
6856
+ * @example ORD-123456
6857
+ */
6858
+ orderId: string;
6859
+ /**
6860
+ * @description Country code
6861
+ * @example US
6862
+ */
6863
+ country: string;
6864
+ /**
6865
+ * @description Origin of the order
6866
+ * @example web
6867
+ */
6868
+ origin: string;
6869
+ /**
6870
+ * @description Gender of the customer
6871
+ * @example male
6872
+ */
6873
+ gender: string;
6874
+ /**
6875
+ * @description Language code
6876
+ * @example en
6877
+ */
6878
+ language: string;
6879
+ /**
6880
+ * @description Slug associated with the report item
6881
+ * @example sample-slug-1
6882
+ */
6883
+ slug: string;
6884
+ /**
6885
+ * @description Customer email
6886
+ * @example customer1@example.com
6887
+ */
6888
+ email: string;
6889
+ };
6876
6890
  NotFoundErrorDto: {
6877
6891
  /** @example 404 */
6878
6892
  statusCode: number;
@@ -7296,6 +7310,285 @@ interface components {
7296
7310
  /** @description The list of order items */
7297
7311
  data: components["schemas"]["OrderItemResponseDto"][];
7298
7312
  };
7313
+ WebhookPaginatedResponseDto: {
7314
+ data: components["schemas"]["WebhookResponseDto"][];
7315
+ /** @example 100 */
7316
+ total: number;
7317
+ /** @example 1 */
7318
+ page: number;
7319
+ /** @example 10 */
7320
+ limit: number;
7321
+ /** @example 10 */
7322
+ totalPages: number;
7323
+ };
7324
+ Webhook: {
7325
+ /** @description The unique identifier of the webhook */
7326
+ id: number;
7327
+ /** @description The title of the webhook */
7328
+ title?: string;
7329
+ /** @description The events that trigger the webhook */
7330
+ events: string[];
7331
+ /** @description The URL endpoint to send the webhook to */
7332
+ endpoint: string;
7333
+ /**
7334
+ * @description The HTTP method to use when sending the webhook
7335
+ * @default GET
7336
+ */
7337
+ method: string;
7338
+ /** @description The authorization header to use when sending the webhook */
7339
+ authorization?: string;
7340
+ /** @description The project associated with the webhook */
7341
+ project?: string;
7342
+ };
7343
+ JobResponseDto: {
7344
+ /** @description The unique identifier of the job */
7345
+ id: number;
7346
+ /** @description The action to be performed by the job */
7347
+ action: string;
7348
+ /** @description The data associated with the job */
7349
+ data?: Record<string, never>;
7350
+ /**
7351
+ * Format: date-time
7352
+ * @description The date and time when the job was created
7353
+ */
7354
+ created_at: string;
7355
+ /** @description The current status of the job */
7356
+ status: string;
7357
+ /** @description The date and time when the job was executed */
7358
+ executed_at?: Record<string, never>;
7359
+ /** @description The ID of the associated webhook */
7360
+ webhook_id?: number;
7361
+ };
7362
+ JobPaginatedResponseDto: {
7363
+ data: components["schemas"]["JobResponseDto"][];
7364
+ /** @example 100 */
7365
+ total: number;
7366
+ /** @example 1 */
7367
+ page: number;
7368
+ /** @example 10 */
7369
+ limit: number;
7370
+ /** @example 10 */
7371
+ totalPages: number;
7372
+ };
7373
+ AddJobDto: {
7374
+ /**
7375
+ * @description The data to be processed by the job
7376
+ * @example {
7377
+ * "key": "value"
7378
+ * }
7379
+ */
7380
+ data: Record<string, never>;
7381
+ /**
7382
+ * @description The event type for the job
7383
+ * @example webhook.created
7384
+ */
7385
+ event: string;
7386
+ };
7387
+ Job: {
7388
+ /** @description The unique identifier of the job */
7389
+ id: number;
7390
+ /** @description The action to be performed by the job */
7391
+ action: string;
7392
+ /** @description The data associated with the job */
7393
+ data: Record<string, never>;
7394
+ /**
7395
+ * Format: date-time
7396
+ * @description The date and time when the job was created
7397
+ */
7398
+ created_at: string;
7399
+ /** @description The current status of the job */
7400
+ status: string;
7401
+ /**
7402
+ * Format: date-time
7403
+ * @description The date and time when the job was executed
7404
+ */
7405
+ executed_at?: string;
7406
+ /** @description The ID of the associated webhook */
7407
+ webhook_id?: number;
7408
+ /** @description The associated webhook */
7409
+ webhook: components["schemas"]["Webhook"];
7410
+ };
7411
+ WebhookDto: Record<string, never>;
7412
+ PublicPaymentResponseDto: {
7413
+ /** @description Source */
7414
+ source: string;
7415
+ /** @description Charge ID */
7416
+ chargeId: string;
7417
+ /** @description Total amount */
7418
+ total: number;
7419
+ /** @description Currency */
7420
+ currency: string;
7421
+ /** @description Date */
7422
+ date: string;
7423
+ /** @description Type */
7424
+ type: string;
7425
+ };
7426
+ PaymentFilterDto: {
7427
+ /**
7428
+ * @description Payment source (e.g., AppStore, Stripe, PayPal)
7429
+ * @example AppStore
7430
+ */
7431
+ source?: string;
7432
+ /**
7433
+ * @description Unique source identifier
7434
+ * @example SRC12345
7435
+ */
7436
+ sourceId?: string;
7437
+ /**
7438
+ * @description Filter payments between two timezone dates (start)
7439
+ * @example 2025-10-01
7440
+ */
7441
+ timezoneDateFrom?: string;
7442
+ /**
7443
+ * @description Filter payments between two timezone dates (end)
7444
+ * @example 2025-10-31
7445
+ */
7446
+ timezoneDateTo?: string;
7447
+ /**
7448
+ * @description Payment type (e.g., payment_success, payment_refunded)
7449
+ * @example payment_success
7450
+ */
7451
+ type?: string;
7452
+ /**
7453
+ * @description Unique order identifier
7454
+ * @example ORD-56789
7455
+ */
7456
+ orderId?: string;
7457
+ /**
7458
+ * @description Single main order ID (used when filtering by one order)
7459
+ * @example MAIN-999
7460
+ */
7461
+ mainOrderId?: string;
7462
+ /**
7463
+ * @description Multiple main order IDs (used when filtering by many orders)
7464
+ * @example [
7465
+ * "MAIN-999",
7466
+ * "MAIN-888",
7467
+ * "MAIN-777"
7468
+ * ]
7469
+ */
7470
+ mainOrderIds?: unknown[][];
7471
+ /**
7472
+ * @description Sort by field
7473
+ * @example date
7474
+ */
7475
+ sortBy?: string;
7476
+ /**
7477
+ * @description Sort order
7478
+ * @example DESC
7479
+ */
7480
+ sortOrder?: string;
7481
+ /**
7482
+ * @description Page number
7483
+ * @example 1
7484
+ */
7485
+ page?: number;
7486
+ /**
7487
+ * @description Items per page
7488
+ * @example 10
7489
+ */
7490
+ limit?: number;
7491
+ };
7492
+ PaymentDto: {
7493
+ /**
7494
+ * @description Payment ID
7495
+ * @example 1
7496
+ */
7497
+ id: number;
7498
+ /**
7499
+ * @description Payment source
7500
+ * @example AppStore
7501
+ */
7502
+ source: string;
7503
+ /**
7504
+ * @description Unique source identifier
7505
+ * @example SRC12345
7506
+ */
7507
+ sourceId: string;
7508
+ /**
7509
+ * @description Source type
7510
+ * @example Subscription
7511
+ */
7512
+ sourceType: string;
7513
+ /**
7514
+ * @description Original date of payment
7515
+ * @example 2025-10-29T14:30:00.000Z
7516
+ */
7517
+ date: Record<string, never>;
7518
+ /**
7519
+ * @description Timezone date of payment
7520
+ * @example 2025-10-29T20:30:00.000Z
7521
+ */
7522
+ timezoneDate: Record<string, never>;
7523
+ /**
7524
+ * @description Total payment amount
7525
+ * @example 49.99
7526
+ */
7527
+ total: number;
7528
+ /**
7529
+ * @description Payment type
7530
+ * @example payment_success
7531
+ */
7532
+ type: string;
7533
+ /**
7534
+ * @description Timezone report date
7535
+ * @example 2025-10-29T21:00:00.000Z
7536
+ */
7537
+ timezoneReportDate: Record<string, never>;
7538
+ /**
7539
+ * @description Order ID
7540
+ * @example ORD-56789
7541
+ */
7542
+ orderId: string;
7543
+ /**
7544
+ * @description Processor ID
7545
+ * @example PROC-123
7546
+ */
7547
+ processorId: string;
7548
+ /**
7549
+ * @description Main Order ID
7550
+ * @example MAIN-999
7551
+ */
7552
+ mainOrderId: string;
7553
+ /**
7554
+ * @description Currency
7555
+ * @example USD
7556
+ */
7557
+ currency: string;
7558
+ /**
7559
+ * @description Original total amount
7560
+ * @example 49.99
7561
+ */
7562
+ orgTotal: number;
7563
+ /**
7564
+ * @description Currency conversion rate
7565
+ * @example 1
7566
+ */
7567
+ currencyRate: number;
7568
+ };
7569
+ PaymentMetaDto: {
7570
+ /**
7571
+ * @description Total number of items
7572
+ * @example 100
7573
+ */
7574
+ total: number;
7575
+ /**
7576
+ * @description Current page number
7577
+ * @example 1
7578
+ */
7579
+ currentPage: number;
7580
+ /**
7581
+ * @description Total number of pages
7582
+ * @example 10
7583
+ */
7584
+ pages: number;
7585
+ };
7586
+ PaymentListResponseDto: {
7587
+ /** @description List of payments */
7588
+ payments: components["schemas"]["PaymentDto"][];
7589
+ /** @description Pagination metadata */
7590
+ meta: components["schemas"]["PaymentMetaDto"];
7591
+ };
7299
7592
  };
7300
7593
  responses: never;
7301
7594
  parameters: never;
@@ -7363,6 +7656,46 @@ declare const server: {
7363
7656
  lastPaid: components["schemas"]["RealtimeUtmSearchDetailDto"];
7364
7657
  }>;
7365
7658
  };
7659
+ order: {
7660
+ getByUuid: (uuid: string) => Promise<{
7661
+ id: number;
7662
+ orderId: string;
7663
+ country: string;
7664
+ origin: string;
7665
+ gender: string;
7666
+ language: string;
7667
+ slug: string;
7668
+ email: string;
7669
+ }>;
7670
+ getByEmail: (email: string) => Promise<{
7671
+ id: number;
7672
+ orderId: string;
7673
+ country: string;
7674
+ origin: string;
7675
+ gender: string;
7676
+ language: string;
7677
+ slug: string;
7678
+ email: string;
7679
+ }[]>;
7680
+ };
7681
+ payments: {
7682
+ firstPayment: (uuid: string) => Promise<{
7683
+ source: string;
7684
+ chargeId: string;
7685
+ total: number;
7686
+ currency: string;
7687
+ date: string;
7688
+ type: string;
7689
+ }>;
7690
+ last5Payments: (uuid: string) => Promise<{
7691
+ source: string;
7692
+ chargeId: string;
7693
+ total: number;
7694
+ currency: string;
7695
+ date: string;
7696
+ type: string;
7697
+ }[]>;
7698
+ };
7366
7699
  };
7367
7700
 
7368
7701
  export { type SdkRemoteFunnel, server };
package/dist/index.js CHANGED
@@ -687,7 +687,91 @@ var realtimeUtmOrderData = (uuid) => __async(null, null, function* () {
687
687
  }
688
688
  );
689
689
  if (!res.data) {
690
- throw new Error("Failed to append session.");
690
+ throw new Error("Failed to get realtime utm data.");
691
+ }
692
+ return res.data;
693
+ });
694
+
695
+ // src/server/order/order-get-by-uuid.ts
696
+ var orderGetByUuid = (uuid) => __async(null, null, function* () {
697
+ const res = yield $apiClient.GET(
698
+ "/dynamic-public/orders-management/report-item/order/{orderId}",
699
+ {
700
+ params: {
701
+ header: {
702
+ "project-key": `${process.env.CAPIBOX_API_KEY}`
703
+ },
704
+ path: {
705
+ orderId: uuid
706
+ }
707
+ }
708
+ }
709
+ );
710
+ if (!res.data) {
711
+ throw new Error("Failed to get order by uuid.");
712
+ }
713
+ return res.data;
714
+ });
715
+
716
+ // src/server/order/order-get-by-email.ts
717
+ var orderGetByEmail = (email) => __async(null, null, function* () {
718
+ const res = yield $apiClient.GET(
719
+ "/dynamic-public/orders-management/report-item/email/{email}",
720
+ {
721
+ params: {
722
+ header: {
723
+ "project-key": `${process.env.CAPIBOX_API_KEY}`
724
+ },
725
+ path: {
726
+ email
727
+ }
728
+ }
729
+ }
730
+ );
731
+ if (!res.data) {
732
+ throw new Error("Failed to get order by email.");
733
+ }
734
+ return res.data;
735
+ });
736
+
737
+ // src/server/payments/payment-first-payment.ts
738
+ var paymentFirstPayment = (uuid) => __async(null, null, function* () {
739
+ const res = yield $apiClient.GET(
740
+ "/dynamic-public/payments-management/payments/first-payment",
741
+ {
742
+ params: {
743
+ header: {
744
+ "project-key": `${process.env.CAPIBOX_API_KEY}`
745
+ },
746
+ query: {
747
+ referenceId: uuid
748
+ }
749
+ }
750
+ }
751
+ );
752
+ if (!res.data) {
753
+ throw new Error("Failed to get first payment.");
754
+ }
755
+ return res.data;
756
+ });
757
+
758
+ // src/server/payments/payment-last-payments.ts
759
+ var paymentLastPayments = (uuid) => __async(null, null, function* () {
760
+ const res = yield $apiClient.GET(
761
+ "/dynamic-public/payments-management/payments/last-5-payments",
762
+ {
763
+ params: {
764
+ header: {
765
+ "project-key": `${process.env.CAPIBOX_API_KEY}`
766
+ },
767
+ query: {
768
+ referenceId: uuid
769
+ }
770
+ }
771
+ }
772
+ );
773
+ if (!res.data) {
774
+ throw new Error("Failed to get last payments.");
691
775
  }
692
776
  return res.data;
693
777
  });
@@ -716,6 +800,14 @@ var server = {
716
800
  },
717
801
  realtime: {
718
802
  orderUtmData: realtimeUtmOrderData
803
+ },
804
+ order: {
805
+ getByUuid: orderGetByUuid,
806
+ getByEmail: orderGetByEmail
807
+ },
808
+ payments: {
809
+ firstPayment: paymentFirstPayment,
810
+ last5Payments: paymentLastPayments
719
811
  }
720
812
  };
721
813
  // Annotate the CommonJS export names for ESM import in node: