@voucherify/sdk 2.3.0 → 2.5.0
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/CHANGELOG.md +69 -0
- package/README.md +237 -5
- package/dist/Customers.d.ts +12 -0
- package/dist/Exports.d.ts +4 -0
- package/dist/Loyalties.d.ts +72 -3
- package/dist/ProductCollections.d.ts +26 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/types/Categories.d.ts +8 -0
- package/dist/types/Customers.d.ts +42 -0
- package/dist/types/Exports.d.ts +119 -0
- package/dist/types/Loyalties.d.ts +630 -0
- package/dist/types/ProductCollections.d.ts +95 -0
- package/dist/types/Rewards.d.ts +57 -1
- package/dist/types/UtilityTypes.d.ts +3 -0
- package/dist/voucherifysdk.esm.js +220 -5
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +220 -5
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ import { ProductsCreateResponse, ProductsCreateSkuResponse } from './Products';
|
|
|
3
3
|
import { SimpleCustomer } from './Customers';
|
|
4
4
|
import { ValidationRulesCreateAssignmentResponse } from './ValidationRules';
|
|
5
5
|
import { VouchersResponse } from './Vouchers';
|
|
6
|
+
import { Reward, RewardAssignment } from './Rewards';
|
|
7
|
+
import { Category } from './Categories';
|
|
6
8
|
interface LoyaltiesVoucher {
|
|
7
9
|
code_config?: {
|
|
8
10
|
length?: number;
|
|
@@ -154,6 +156,7 @@ export interface LoyaltyFixed {
|
|
|
154
156
|
}
|
|
155
157
|
export interface LoyaltyProportional {
|
|
156
158
|
type: 'PROPORTIONAL';
|
|
159
|
+
calculation_type?: 'ORDER_AMOUNT' | 'ORDER_TOTAL_AMOUNT' | 'ORDER_METADATA' | 'ORDER_ITEMS_QUANTITY' | 'ORDER_ITEMS_AMOUNT' | 'ORDER_ITEMS_SUBTOTAL_AMOUNT' | 'CUSTOMER_METADATA' | 'CUSTOM_EVENT_METADATA';
|
|
157
160
|
order?: {
|
|
158
161
|
amount: {
|
|
159
162
|
every: number;
|
|
@@ -464,4 +467,631 @@ export interface LoyaltyPointsTransfer {
|
|
|
464
467
|
code: string;
|
|
465
468
|
points: number;
|
|
466
469
|
}
|
|
470
|
+
export declare type LoyaltiesTransferPointsResponseBody = {
|
|
471
|
+
id: string;
|
|
472
|
+
code: string;
|
|
473
|
+
campaign: string;
|
|
474
|
+
campaign_id: string;
|
|
475
|
+
category: string | null;
|
|
476
|
+
category_id: string | null;
|
|
477
|
+
categories: Category[];
|
|
478
|
+
type: 'LOYALTY_CARD';
|
|
479
|
+
loyalty_card: {
|
|
480
|
+
points: number;
|
|
481
|
+
balance: number;
|
|
482
|
+
next_expiration_date?: string;
|
|
483
|
+
next_expiration_points?: number;
|
|
484
|
+
};
|
|
485
|
+
start_date: string | null;
|
|
486
|
+
expiration_date: string | null;
|
|
487
|
+
validity_timeframe: {
|
|
488
|
+
interval?: string;
|
|
489
|
+
duration?: string;
|
|
490
|
+
} | null;
|
|
491
|
+
validity_day_of_week: number[] | null;
|
|
492
|
+
publish?: {
|
|
493
|
+
object: 'list';
|
|
494
|
+
count?: number;
|
|
495
|
+
entries?: string[];
|
|
496
|
+
url?: string;
|
|
497
|
+
};
|
|
498
|
+
redemption?: {
|
|
499
|
+
quantity: number | null;
|
|
500
|
+
redeemed_points?: number;
|
|
501
|
+
redeemed_quantity?: number;
|
|
502
|
+
redemption_entries?: string[];
|
|
503
|
+
object?: 'list';
|
|
504
|
+
url?: string;
|
|
505
|
+
};
|
|
506
|
+
active: boolean;
|
|
507
|
+
additional_info: string | null;
|
|
508
|
+
metadata: Record<string, unknown>;
|
|
509
|
+
is_referral_code: boolean;
|
|
510
|
+
holder_id?: string;
|
|
511
|
+
updated_at?: string;
|
|
512
|
+
created_at: string;
|
|
513
|
+
};
|
|
514
|
+
export declare type LoyaltiesTransferPointsRequestBody = LoyaltiesTransferPoints[];
|
|
515
|
+
export interface LoyaltiesListMemberRewardsRequestQuery {
|
|
516
|
+
affordable_only?: boolean;
|
|
517
|
+
limit?: number;
|
|
518
|
+
page?: number;
|
|
519
|
+
}
|
|
520
|
+
export interface LoyaltiesListMemberRewardsResponseBody {
|
|
521
|
+
object: 'list';
|
|
522
|
+
data_ref: 'data';
|
|
523
|
+
data: {
|
|
524
|
+
reward: Reward;
|
|
525
|
+
assignment: RewardAssignment;
|
|
526
|
+
object: 'loyalty_reward';
|
|
527
|
+
}[];
|
|
528
|
+
total: number;
|
|
529
|
+
}
|
|
530
|
+
export interface LoyaltiesGetPointsExpirationRequestQuery {
|
|
531
|
+
limit?: number;
|
|
532
|
+
page?: number;
|
|
533
|
+
}
|
|
534
|
+
export interface LoyaltiesGetPointsExpirationResponseBody {
|
|
535
|
+
object: 'list';
|
|
536
|
+
data_ref: 'data';
|
|
537
|
+
data: {
|
|
538
|
+
id: string;
|
|
539
|
+
voucher_id: string;
|
|
540
|
+
campaign_id: string;
|
|
541
|
+
bucket: {
|
|
542
|
+
total_points: number;
|
|
543
|
+
};
|
|
544
|
+
created_at: string;
|
|
545
|
+
status: string;
|
|
546
|
+
expires_at: string;
|
|
547
|
+
updated_at?: string;
|
|
548
|
+
object: 'loyalty_points_bucket';
|
|
549
|
+
}[];
|
|
550
|
+
total: number;
|
|
551
|
+
}
|
|
552
|
+
export interface LoyaltiesListCardTransactionsRequestQuery {
|
|
553
|
+
limit?: number;
|
|
554
|
+
page?: number;
|
|
555
|
+
}
|
|
556
|
+
export interface LoyaltiesListCardTransactionsResponseBody {
|
|
557
|
+
object: 'list';
|
|
558
|
+
data_ref: 'data';
|
|
559
|
+
data: LoyaltyCardTransaction[];
|
|
560
|
+
has_more: boolean;
|
|
561
|
+
}
|
|
562
|
+
export interface LoyaltiesExportCardTransactionsRequestBody {
|
|
563
|
+
order?: 'created_at' | '-created_at';
|
|
564
|
+
fields?: LoyaltyCardTransactionsFields[];
|
|
565
|
+
}
|
|
566
|
+
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
567
|
+
id: string;
|
|
568
|
+
object: 'export';
|
|
569
|
+
created_at: string;
|
|
570
|
+
status: 'SCHEDULED';
|
|
571
|
+
channel: string;
|
|
572
|
+
exported_object: 'voucher_transactions';
|
|
573
|
+
parameters: {
|
|
574
|
+
order?: string;
|
|
575
|
+
fields?: LoyaltyCardTransactionsFields[];
|
|
576
|
+
filters: {
|
|
577
|
+
voucher_id: {
|
|
578
|
+
conditions: {
|
|
579
|
+
$in: [string];
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
result: null;
|
|
585
|
+
user_id: null | string;
|
|
586
|
+
}
|
|
587
|
+
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
588
|
+
points: number;
|
|
589
|
+
expiration_date?: string;
|
|
590
|
+
expiration_type?: PointsExpirationTypes;
|
|
591
|
+
reason?: string;
|
|
592
|
+
source_id?: string;
|
|
593
|
+
}
|
|
594
|
+
export interface LoyaltiesAddOrRemoveCardBalanceResponseBody {
|
|
595
|
+
points?: number;
|
|
596
|
+
amount?: number;
|
|
597
|
+
total: number;
|
|
598
|
+
balance: number;
|
|
599
|
+
type: 'LOYALTY_CARD' | 'GIFT_VOUCHER';
|
|
600
|
+
object: 'balance';
|
|
601
|
+
related_object: {
|
|
602
|
+
type: 'voucher';
|
|
603
|
+
id: string;
|
|
604
|
+
};
|
|
605
|
+
operation_type?: 'MANUAL' | 'AUTOMATIC';
|
|
606
|
+
}
|
|
607
|
+
export declare type LoyaltiesCreateTiersRequestBody = (LoyaltyTierBase & {
|
|
608
|
+
metadata?: Record<string, unknown>;
|
|
609
|
+
})[];
|
|
610
|
+
export declare type LoyaltiesCreateTiersResponseBody = LoyaltyTier[];
|
|
611
|
+
export declare type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
612
|
+
export declare type LoyaltiesGetRewardDetailsResponseBody = Reward;
|
|
613
|
+
export interface LoyaltiesListTiersRequestQuery {
|
|
614
|
+
limit?: number;
|
|
615
|
+
page?: number;
|
|
616
|
+
order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
|
|
617
|
+
}
|
|
618
|
+
export interface LoyaltiesListLoyaltyTierEarningRulesRequestQuery {
|
|
619
|
+
limit?: number;
|
|
620
|
+
page?: number;
|
|
621
|
+
}
|
|
622
|
+
export declare type LoyaltiesGetTierResponseBody = LoyaltyTier;
|
|
623
|
+
export interface LoyaltiesListTiersResponseBody {
|
|
624
|
+
object: 'list';
|
|
625
|
+
data_ref: 'data';
|
|
626
|
+
data: LoyaltyTier[];
|
|
627
|
+
total: number;
|
|
628
|
+
}
|
|
629
|
+
export interface LoyaltiesListMemberLoyaltyTiersResponseBody {
|
|
630
|
+
object: 'list';
|
|
631
|
+
data_ref: 'data';
|
|
632
|
+
data: LoyaltyTier[];
|
|
633
|
+
total: number;
|
|
634
|
+
}
|
|
635
|
+
export interface LoyaltiesListMemberRewardsRequestQuery {
|
|
636
|
+
affordable_only?: boolean;
|
|
637
|
+
limit?: number;
|
|
638
|
+
page?: number;
|
|
639
|
+
}
|
|
640
|
+
export interface LoyaltiesListMemberRewardsResponseBody {
|
|
641
|
+
object: 'list';
|
|
642
|
+
data_ref: 'data';
|
|
643
|
+
data: {
|
|
644
|
+
reward: Reward;
|
|
645
|
+
assignment: RewardAssignment;
|
|
646
|
+
object: 'loyalty_reward';
|
|
647
|
+
}[];
|
|
648
|
+
total: number;
|
|
649
|
+
}
|
|
650
|
+
export interface LoyaltiesGetPointsExpirationRequestQuery {
|
|
651
|
+
limit?: number;
|
|
652
|
+
page?: number;
|
|
653
|
+
}
|
|
654
|
+
export interface LoyaltiesGetPointsExpirationResponseBody {
|
|
655
|
+
object: 'list';
|
|
656
|
+
data_ref: 'data';
|
|
657
|
+
data: {
|
|
658
|
+
id: string;
|
|
659
|
+
voucher_id: string;
|
|
660
|
+
campaign_id: string;
|
|
661
|
+
bucket: {
|
|
662
|
+
total_points: number;
|
|
663
|
+
};
|
|
664
|
+
created_at: string;
|
|
665
|
+
status: string;
|
|
666
|
+
expires_at: string;
|
|
667
|
+
updated_at?: string;
|
|
668
|
+
object: 'loyalty_points_bucket';
|
|
669
|
+
}[];
|
|
670
|
+
total: number;
|
|
671
|
+
}
|
|
672
|
+
export interface LoyaltiesListCardTransactionsRequestQuery {
|
|
673
|
+
limit?: number;
|
|
674
|
+
page?: number;
|
|
675
|
+
}
|
|
676
|
+
export interface LoyaltiesListCardTransactionsResponseBody {
|
|
677
|
+
object: 'list';
|
|
678
|
+
data_ref: 'data';
|
|
679
|
+
data: LoyaltyCardTransaction[];
|
|
680
|
+
has_more: boolean;
|
|
681
|
+
}
|
|
682
|
+
export interface LoyaltiesExportCardTransactionsRequestBody {
|
|
683
|
+
order?: 'created_at' | '-created_at';
|
|
684
|
+
fields?: LoyaltyCardTransactionsFields[];
|
|
685
|
+
}
|
|
686
|
+
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
687
|
+
id: string;
|
|
688
|
+
object: 'export';
|
|
689
|
+
created_at: string;
|
|
690
|
+
status: 'SCHEDULED';
|
|
691
|
+
channel: string;
|
|
692
|
+
exported_object: 'voucher_transactions';
|
|
693
|
+
parameters: {
|
|
694
|
+
order?: string;
|
|
695
|
+
fields?: LoyaltyCardTransactionsFields[];
|
|
696
|
+
filters: {
|
|
697
|
+
voucher_id: {
|
|
698
|
+
conditions: {
|
|
699
|
+
$in: [string];
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
};
|
|
704
|
+
result: null;
|
|
705
|
+
user_id: null | string;
|
|
706
|
+
}
|
|
707
|
+
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
708
|
+
points: number;
|
|
709
|
+
expiration_date?: string;
|
|
710
|
+
expiration_type?: PointsExpirationTypes;
|
|
711
|
+
reason?: string;
|
|
712
|
+
source_id?: string;
|
|
713
|
+
}
|
|
714
|
+
export interface LoyaltiesAddOrRemoveCardBalanceResponseBody {
|
|
715
|
+
points?: number;
|
|
716
|
+
amount?: number;
|
|
717
|
+
total: number;
|
|
718
|
+
balance: number;
|
|
719
|
+
type: 'LOYALTY_CARD' | 'GIFT_VOUCHER';
|
|
720
|
+
object: 'balance';
|
|
721
|
+
related_object: {
|
|
722
|
+
type: 'voucher';
|
|
723
|
+
id: string;
|
|
724
|
+
};
|
|
725
|
+
operation_type?: 'MANUAL' | 'AUTOMATIC';
|
|
726
|
+
}
|
|
727
|
+
export declare type LoyaltiesGetEarningRuleResponseBody = EarningRule;
|
|
728
|
+
export declare type LoyaltiesEnableEarningRulesResponseBody = EarningRuleBase & {
|
|
729
|
+
updated_at: string | null;
|
|
730
|
+
active: true;
|
|
731
|
+
};
|
|
732
|
+
export declare type LoyaltiesDisableEarningRulesResponseBody = EarningRuleBase & {
|
|
733
|
+
updated_at: string | null;
|
|
734
|
+
active: false;
|
|
735
|
+
};
|
|
736
|
+
export declare type LoyaltiesListLoyaltyTierEarningRulesResponseBody = {
|
|
737
|
+
object: 'list';
|
|
738
|
+
data_ref: 'data';
|
|
739
|
+
data: EarningRule[];
|
|
740
|
+
total: number;
|
|
741
|
+
};
|
|
742
|
+
export interface LoyaltyTierBase {
|
|
743
|
+
name: string;
|
|
744
|
+
earning_rules?: Record<string, MappingMultiply | MappingFixed>;
|
|
745
|
+
rewards?: Record<string, MappingMultiply | MappingFixed>;
|
|
746
|
+
points: {
|
|
747
|
+
from?: number;
|
|
748
|
+
to?: number;
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
export declare type LoyaltyTier = LoyaltyTierBase & {
|
|
752
|
+
id: string;
|
|
753
|
+
campaign_id: string;
|
|
754
|
+
metadata: Record<string, unknown> | null;
|
|
755
|
+
created_at: string;
|
|
756
|
+
updated_at?: string | null;
|
|
757
|
+
config: {
|
|
758
|
+
points: {
|
|
759
|
+
from?: number;
|
|
760
|
+
to?: number;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
expiration?: {
|
|
764
|
+
customer_id: string;
|
|
765
|
+
campaign_id: string;
|
|
766
|
+
tier_id: string;
|
|
767
|
+
start_date?: string;
|
|
768
|
+
expiration_date?: string;
|
|
769
|
+
created_at: string;
|
|
770
|
+
updated_at?: string;
|
|
771
|
+
};
|
|
772
|
+
object: 'loyalty_tier';
|
|
773
|
+
};
|
|
774
|
+
interface MappingMultiply {
|
|
775
|
+
type: 'MULTIPLY';
|
|
776
|
+
multiplier: number;
|
|
777
|
+
}
|
|
778
|
+
interface MappingFixed {
|
|
779
|
+
type: 'CUSTOM';
|
|
780
|
+
points: number;
|
|
781
|
+
}
|
|
782
|
+
export interface LoyaltyCardTransaction {
|
|
783
|
+
id: string;
|
|
784
|
+
source_id: string | null;
|
|
785
|
+
voucher_id: string;
|
|
786
|
+
campaign_id: string;
|
|
787
|
+
source: string | null;
|
|
788
|
+
reason: string | null;
|
|
789
|
+
type: LoyaltyCardTransactionsType;
|
|
790
|
+
details: {
|
|
791
|
+
balance: {
|
|
792
|
+
type: 'loyalty_card';
|
|
793
|
+
total: number;
|
|
794
|
+
object: 'balance';
|
|
795
|
+
points: number;
|
|
796
|
+
balance: number;
|
|
797
|
+
related_object: {
|
|
798
|
+
id: string;
|
|
799
|
+
type: 'voucher';
|
|
800
|
+
};
|
|
801
|
+
};
|
|
802
|
+
order?: {
|
|
803
|
+
id: string;
|
|
804
|
+
source_id: string;
|
|
805
|
+
};
|
|
806
|
+
event?: {
|
|
807
|
+
id: string;
|
|
808
|
+
type: string;
|
|
809
|
+
};
|
|
810
|
+
earning_rule?: {
|
|
811
|
+
id: string;
|
|
812
|
+
source: {
|
|
813
|
+
banner: string;
|
|
814
|
+
};
|
|
815
|
+
};
|
|
816
|
+
segment?: {
|
|
817
|
+
id: string;
|
|
818
|
+
name: string;
|
|
819
|
+
};
|
|
820
|
+
loyalty_tier?: {
|
|
821
|
+
id: string;
|
|
822
|
+
name: string;
|
|
823
|
+
};
|
|
824
|
+
redemption?: {
|
|
825
|
+
id: string;
|
|
826
|
+
};
|
|
827
|
+
rollback?: {
|
|
828
|
+
id: string;
|
|
829
|
+
};
|
|
830
|
+
reward?: {
|
|
831
|
+
id: string;
|
|
832
|
+
name: string;
|
|
833
|
+
};
|
|
834
|
+
custom_event?: {
|
|
835
|
+
id: string;
|
|
836
|
+
type: string;
|
|
837
|
+
};
|
|
838
|
+
event_schema?: {
|
|
839
|
+
id: string;
|
|
840
|
+
name: string;
|
|
841
|
+
};
|
|
842
|
+
source_voucher?: SimpleLoyaltyVoucher;
|
|
843
|
+
destination_voucher?: SimpleLoyaltyVoucher;
|
|
844
|
+
};
|
|
845
|
+
related_transaction_id: string | null;
|
|
846
|
+
created_at: string;
|
|
847
|
+
}
|
|
848
|
+
export interface SimpleLoyaltyVoucher {
|
|
849
|
+
id: string;
|
|
850
|
+
code: string;
|
|
851
|
+
loyalty_card: {
|
|
852
|
+
points: number;
|
|
853
|
+
balance: number;
|
|
854
|
+
next_expiration_date?: string;
|
|
855
|
+
next_expiration_points?: string;
|
|
856
|
+
};
|
|
857
|
+
type: 'LOYALTY_CARD';
|
|
858
|
+
campaign: string;
|
|
859
|
+
campaign_id: string;
|
|
860
|
+
is_referral_code?: boolean;
|
|
861
|
+
holder_id?: string;
|
|
862
|
+
referrer_id?: string;
|
|
863
|
+
created_at?: string;
|
|
864
|
+
object: 'voucher';
|
|
865
|
+
}
|
|
866
|
+
export interface LoyaltiesTransferPoints {
|
|
867
|
+
code: string;
|
|
868
|
+
points: number;
|
|
869
|
+
reason?: string;
|
|
870
|
+
source_id: string;
|
|
871
|
+
}
|
|
872
|
+
export declare type LoyaltyCardTransactionsFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
|
|
873
|
+
export declare type LoyaltyCardTransactionsType = 'POINTS_ACCRUAL' | 'POINTS_CANCELLATION' | 'POINTS_REDEMPTION' | 'POINTS_REFUND' | 'POINTS_ADDITION' | 'POINTS_REMOVAL' | 'POINTS_EXPIRATION' | 'POINTS_TRANSFER_IN' | 'POINTS_TRANSFER_OUT';
|
|
874
|
+
export declare type EarningRule = EarningRuleBase & {
|
|
875
|
+
validation_rule_id: string | null;
|
|
876
|
+
updated_at: string | null;
|
|
877
|
+
active: boolean;
|
|
878
|
+
};
|
|
879
|
+
export declare type PointsExpirationTypes = 'PROGRAM_RULES' | 'CUSTOM_DATE' | 'NON_EXPIRING';
|
|
880
|
+
export interface LoyaltyCardTransaction {
|
|
881
|
+
id: string;
|
|
882
|
+
source_id: string | null;
|
|
883
|
+
voucher_id: string;
|
|
884
|
+
campaign_id: string;
|
|
885
|
+
source: string | null;
|
|
886
|
+
reason: string | null;
|
|
887
|
+
type: LoyaltyCardTransactionsType;
|
|
888
|
+
details: {
|
|
889
|
+
balance: {
|
|
890
|
+
type: 'loyalty_card';
|
|
891
|
+
total: number;
|
|
892
|
+
object: 'balance';
|
|
893
|
+
points: number;
|
|
894
|
+
balance: number;
|
|
895
|
+
related_object: {
|
|
896
|
+
id: string;
|
|
897
|
+
type: 'voucher';
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
order?: {
|
|
901
|
+
id: string;
|
|
902
|
+
source_id: string;
|
|
903
|
+
};
|
|
904
|
+
event?: {
|
|
905
|
+
id: string;
|
|
906
|
+
type: string;
|
|
907
|
+
};
|
|
908
|
+
earning_rule?: {
|
|
909
|
+
id: string;
|
|
910
|
+
source: {
|
|
911
|
+
banner: string;
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
segment?: {
|
|
915
|
+
id: string;
|
|
916
|
+
name: string;
|
|
917
|
+
};
|
|
918
|
+
loyalty_tier?: {
|
|
919
|
+
id: string;
|
|
920
|
+
name: string;
|
|
921
|
+
};
|
|
922
|
+
redemption?: {
|
|
923
|
+
id: string;
|
|
924
|
+
};
|
|
925
|
+
rollback?: {
|
|
926
|
+
id: string;
|
|
927
|
+
};
|
|
928
|
+
reward?: {
|
|
929
|
+
id: string;
|
|
930
|
+
name: string;
|
|
931
|
+
};
|
|
932
|
+
custom_event?: {
|
|
933
|
+
id: string;
|
|
934
|
+
type: string;
|
|
935
|
+
};
|
|
936
|
+
event_schema?: {
|
|
937
|
+
id: string;
|
|
938
|
+
name: string;
|
|
939
|
+
};
|
|
940
|
+
source_voucher?: SimpleLoyaltyVoucher;
|
|
941
|
+
destination_voucher?: SimpleLoyaltyVoucher;
|
|
942
|
+
};
|
|
943
|
+
related_transaction_id: string | null;
|
|
944
|
+
created_at: string;
|
|
945
|
+
}
|
|
946
|
+
export interface SimpleLoyaltyVoucher {
|
|
947
|
+
id: string;
|
|
948
|
+
code: string;
|
|
949
|
+
loyalty_card: {
|
|
950
|
+
points: number;
|
|
951
|
+
balance: number;
|
|
952
|
+
next_expiration_date?: string;
|
|
953
|
+
next_expiration_points?: string;
|
|
954
|
+
};
|
|
955
|
+
type: 'LOYALTY_CARD';
|
|
956
|
+
campaign: string;
|
|
957
|
+
campaign_id: string;
|
|
958
|
+
is_referral_code?: boolean;
|
|
959
|
+
holder_id?: string;
|
|
960
|
+
referrer_id?: string;
|
|
961
|
+
created_at?: string;
|
|
962
|
+
object: 'voucher';
|
|
963
|
+
}
|
|
964
|
+
export interface LoyaltiesTransferPoints {
|
|
965
|
+
code: string;
|
|
966
|
+
points: number;
|
|
967
|
+
reason?: string;
|
|
968
|
+
source_id: string;
|
|
969
|
+
}
|
|
970
|
+
export interface EarningRuleBase {
|
|
971
|
+
id: string;
|
|
972
|
+
created_at: string;
|
|
973
|
+
loyalty: EarningRuleFixed | EarningRuleProportional;
|
|
974
|
+
event?: EarningRuleEvent;
|
|
975
|
+
custom_event?: {
|
|
976
|
+
schema_id: string;
|
|
977
|
+
};
|
|
978
|
+
segment?: {
|
|
979
|
+
id: string;
|
|
980
|
+
};
|
|
981
|
+
source: {
|
|
982
|
+
banner?: string;
|
|
983
|
+
object_id: string;
|
|
984
|
+
object_type: 'campaign';
|
|
985
|
+
};
|
|
986
|
+
loyalty_tier?: {
|
|
987
|
+
id: string;
|
|
988
|
+
};
|
|
989
|
+
object: 'earning_rule';
|
|
990
|
+
automation_id: string;
|
|
991
|
+
start_date?: string;
|
|
992
|
+
expiration_date?: string;
|
|
993
|
+
validity_timeframe?: {
|
|
994
|
+
duration: string;
|
|
995
|
+
interval: string;
|
|
996
|
+
};
|
|
997
|
+
validity_day_of_week?: number[];
|
|
998
|
+
metadata: Record<string, unknown>;
|
|
999
|
+
}
|
|
1000
|
+
export declare type EarningRuleEvent = 'order.paid' | 'customer.segment.entered' | 'custom_event' | 'customer.loyalty.tier.upgraded' | 'customer.loyalty.tier.downgraded' | 'customer.loyalty.tier.prolonged' | 'customer.loyalty.tier.joined' | 'customer.loyalty.tier.left';
|
|
1001
|
+
export interface EarningRuleFixed {
|
|
1002
|
+
type: 'FIXED';
|
|
1003
|
+
points: number;
|
|
1004
|
+
}
|
|
1005
|
+
export declare type EarningRuleProportionalOrder = EarningRuleProportionalOrderAmount | EarningRuleProportionalOrderTotalAmount | EarningRuleProportionalOrderMetadata;
|
|
1006
|
+
export interface EarningRuleProportionalOrderAmount {
|
|
1007
|
+
type: 'PROPORTIONAL';
|
|
1008
|
+
calculation_type: 'ORDER_AMOUNT';
|
|
1009
|
+
order: {
|
|
1010
|
+
amount: {
|
|
1011
|
+
every: number;
|
|
1012
|
+
points: number;
|
|
1013
|
+
};
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
export interface EarningRuleProportionalOrderTotalAmount {
|
|
1017
|
+
type: 'PROPORTIONAL';
|
|
1018
|
+
calculation_type: 'ORDER_TOTAL_AMOUNT';
|
|
1019
|
+
order: {
|
|
1020
|
+
total_amount: {
|
|
1021
|
+
every: number;
|
|
1022
|
+
points: number;
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
export interface EarningRuleProportionalOrderMetadata {
|
|
1027
|
+
type: 'PROPORTIONAL';
|
|
1028
|
+
calculation_type: 'ORDER_METADATA';
|
|
1029
|
+
order: {
|
|
1030
|
+
metadata: {
|
|
1031
|
+
every: number;
|
|
1032
|
+
points: number;
|
|
1033
|
+
property: string;
|
|
1034
|
+
};
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
export declare type EarningRuleProportional = EarningRuleProportionalOrder | EarningRuleProportionalOrderItems | EarningRuleProportionalCustomerMetadata | EarningRuleProportionalCustomEvent;
|
|
1038
|
+
export declare type EarningRuleProportionalOrderItems = EarningRuleProportionalOrderItemsQuantity | EarningRuleProportionalOrderItemsAmount | EarningRuleProportionalOrderItemsSubtotalAmount;
|
|
1039
|
+
export interface EarningRuleProportionalOrderItemsQuantity {
|
|
1040
|
+
type: 'PROPORTIONAL';
|
|
1041
|
+
calculation_type: 'ORDER_ITEMS_QUANTITY';
|
|
1042
|
+
order_items: {
|
|
1043
|
+
quantity: {
|
|
1044
|
+
every: number;
|
|
1045
|
+
points: number;
|
|
1046
|
+
object: `products_collection` | `product` | `sku`;
|
|
1047
|
+
id: string;
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
export interface EarningRuleProportionalOrderItemsAmount {
|
|
1052
|
+
type: 'PROPORTIONAL';
|
|
1053
|
+
calculation_type: 'ORDER_ITEMS_AMOUNT';
|
|
1054
|
+
order_items: {
|
|
1055
|
+
amount: {
|
|
1056
|
+
every: number;
|
|
1057
|
+
points: number;
|
|
1058
|
+
object: `products_collection` | `product` | `sku`;
|
|
1059
|
+
id: string;
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
export interface EarningRuleProportionalOrderItemsSubtotalAmount {
|
|
1064
|
+
type: 'PROPORTIONAL';
|
|
1065
|
+
calculation_type: 'ORDER_ITEMS_SUBTOTAL_AMOUNT';
|
|
1066
|
+
order_items: {
|
|
1067
|
+
subtotal_amount: {
|
|
1068
|
+
every: number;
|
|
1069
|
+
points: number;
|
|
1070
|
+
object: `products_collection` | `product` | `sku`;
|
|
1071
|
+
id: string;
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
export interface EarningRuleProportionalCustomerMetadata {
|
|
1076
|
+
type: 'PROPORTIONAL';
|
|
1077
|
+
calculation_type: 'CUSTOMER_METADATA';
|
|
1078
|
+
customer: {
|
|
1079
|
+
metadata: {
|
|
1080
|
+
every: number;
|
|
1081
|
+
points: number;
|
|
1082
|
+
property: string;
|
|
1083
|
+
};
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
export interface EarningRuleProportionalCustomEvent {
|
|
1087
|
+
type: 'PROPORTIONAL';
|
|
1088
|
+
calculation_type: 'CUSTOM_EVENT_METADATA';
|
|
1089
|
+
custom_event: {
|
|
1090
|
+
metadata: {
|
|
1091
|
+
every: number;
|
|
1092
|
+
points: number;
|
|
1093
|
+
property: string;
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
467
1097
|
export {};
|