dodopayments 2.27.0 → 2.28.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/internal/utils/env.js +2 -2
  9. package/internal/utils/env.js.map +1 -1
  10. package/internal/utils/env.mjs +2 -2
  11. package/internal/utils/env.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/index.d.mts +1 -1
  14. package/resources/index.d.mts.map +1 -1
  15. package/resources/index.d.ts +1 -1
  16. package/resources/index.d.ts.map +1 -1
  17. package/resources/index.js.map +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/license-keys.d.mts +47 -21
  20. package/resources/license-keys.d.mts.map +1 -1
  21. package/resources/license-keys.d.ts +47 -21
  22. package/resources/license-keys.d.ts.map +1 -1
  23. package/resources/license-keys.js +13 -16
  24. package/resources/license-keys.js.map +1 -1
  25. package/resources/license-keys.mjs +13 -16
  26. package/resources/license-keys.mjs.map +1 -1
  27. package/resources/products/products.d.mts +132 -9
  28. package/resources/products/products.d.mts.map +1 -1
  29. package/resources/products/products.d.ts +132 -9
  30. package/resources/products/products.d.ts.map +1 -1
  31. package/resources/products/products.js.map +1 -1
  32. package/resources/products/products.mjs.map +1 -1
  33. package/resources/webhook-events.d.mts +28 -2
  34. package/resources/webhook-events.d.mts.map +1 -1
  35. package/resources/webhook-events.d.ts +28 -2
  36. package/resources/webhook-events.d.ts.map +1 -1
  37. package/src/client.ts +2 -0
  38. package/src/internal/utils/env.ts +2 -2
  39. package/src/resources/index.ts +1 -0
  40. package/src/resources/license-keys.ts +57 -20
  41. package/src/resources/products/products.ts +208 -9
  42. package/src/resources/webhook-events.ts +57 -2
  43. package/src/version.ts +1 -1
  44. package/version.d.mts +1 -1
  45. package/version.d.ts +1 -1
  46. package/version.js +1 -1
  47. package/version.mjs +1 -1
@@ -542,13 +542,18 @@ export interface Product {
542
542
  */
543
543
  credit_entitlements: Array<CreditEntitlementMappingResponse>;
544
544
 
545
+ /**
546
+ * Attached entitlements (integration-based access grants)
547
+ */
548
+ entitlements: Array<Product.Entitlement>;
549
+
545
550
  /**
546
551
  * Indicates if the product is recurring (e.g., subscriptions).
547
552
  */
548
553
  is_recurring: boolean;
549
554
 
550
555
  /**
551
- * Indicates whether the product requires a license key.
556
+ * @deprecated Indicates whether the product requires a license key.
552
557
  */
553
558
  license_key_enabled: boolean;
554
559
 
@@ -595,12 +600,12 @@ export interface Product {
595
600
  image?: string | null;
596
601
 
597
602
  /**
598
- * Message sent upon license key activation, if applicable.
603
+ * @deprecated Message sent upon license key activation, if applicable.
599
604
  */
600
605
  license_key_activation_message?: string | null;
601
606
 
602
607
  /**
603
- * Limit on the number of activations for the license key, if enabled.
608
+ * @deprecated Limit on the number of activations for the license key, if enabled.
604
609
  */
605
610
  license_key_activations_limit?: number | null;
606
611
 
@@ -620,6 +625,94 @@ export interface Product {
620
625
  product_collection_id?: string | null;
621
626
  }
622
627
 
628
+ export namespace Product {
629
+ /**
630
+ * Summary of an entitlement attached to a product
631
+ */
632
+ export interface Entitlement {
633
+ id: string;
634
+
635
+ /**
636
+ * Platform-specific configuration for an entitlement. Each variant uses unique
637
+ * field names so `#[serde(untagged)]` can disambiguate correctly.
638
+ */
639
+ integration_config:
640
+ | Entitlement.GitHubConfig
641
+ | Entitlement.DiscordConfig
642
+ | Entitlement.TelegramConfig
643
+ | Entitlement.FigmaConfig
644
+ | Entitlement.FramerConfig
645
+ | Entitlement.NotionConfig
646
+ | Entitlement.DigitalFilesConfig
647
+ | Entitlement.LicenseKeyConfig;
648
+
649
+ integration_type:
650
+ | 'discord'
651
+ | 'telegram'
652
+ | 'github'
653
+ | 'figma'
654
+ | 'framer'
655
+ | 'notion'
656
+ | 'digital_files'
657
+ | 'license_key';
658
+
659
+ name: string;
660
+
661
+ description?: string | null;
662
+ }
663
+
664
+ export namespace Entitlement {
665
+ export interface GitHubConfig {
666
+ /**
667
+ * One of: pull, push, admin, maintain, triage
668
+ */
669
+ permission: string;
670
+
671
+ target_id: string;
672
+ }
673
+
674
+ export interface DiscordConfig {
675
+ guild_id: string;
676
+
677
+ role_id?: string | null;
678
+ }
679
+
680
+ export interface TelegramConfig {
681
+ chat_id: string;
682
+ }
683
+
684
+ export interface FigmaConfig {
685
+ figma_file_id: string;
686
+ }
687
+
688
+ export interface FramerConfig {
689
+ framer_template_id: string;
690
+ }
691
+
692
+ export interface NotionConfig {
693
+ notion_template_id: string;
694
+ }
695
+
696
+ export interface DigitalFilesConfig {
697
+ digital_file_ids: Array<string>;
698
+
699
+ external_url?: string | null;
700
+
701
+ instructions?: string | null;
702
+ }
703
+
704
+ export interface LicenseKeyConfig {
705
+ activation_message?: string | null;
706
+
707
+ activations_limit?: number | null;
708
+
709
+ duration_count?: number | null;
710
+
711
+ duration_interval?: string | null;
712
+ }
713
+ }
714
+ }
715
+
623
716
  export interface ProductListResponse {
624
717
  /**
625
718
  * Unique identifier for the business to which the product belongs.
@@ -631,6 +724,11 @@ export interface ProductListResponse {
631
724
  */
632
725
  created_at: string;
633
726
 
727
+ /**
728
+ * Entitlements linked to this product
729
+ */
730
+ entitlements: Array<ProductListResponse.Entitlement>;
731
+
634
732
  /**
635
733
  * Indicates if the product is recurring (e.g., subscriptions).
636
734
  */
@@ -701,6 +799,94 @@ export interface ProductListResponse {
701
799
  tax_inclusive?: boolean | null;
702
800
  }
703
801
 
802
+ export namespace ProductListResponse {
803
+ /**
804
+ * Summary of an entitlement attached to a product
805
+ */
806
+ export interface Entitlement {
807
+ id: string;
808
+
809
+ /**
810
+ * Platform-specific configuration for an entitlement. Each variant uses unique
811
+ * field names so `#[serde(untagged)]` can disambiguate correctly.
812
+ */
813
+ integration_config:
814
+ | Entitlement.GitHubConfig
815
+ | Entitlement.DiscordConfig
816
+ | Entitlement.TelegramConfig
817
+ | Entitlement.FigmaConfig
818
+ | Entitlement.FramerConfig
819
+ | Entitlement.NotionConfig
820
+ | Entitlement.DigitalFilesConfig
821
+ | Entitlement.LicenseKeyConfig;
822
+
823
+ integration_type:
824
+ | 'discord'
825
+ | 'telegram'
826
+ | 'github'
827
+ | 'figma'
828
+ | 'framer'
829
+ | 'notion'
830
+ | 'digital_files'
831
+ | 'license_key';
832
+
833
+ name: string;
834
+
835
+ description?: string | null;
836
+ }
837
+
838
+ export namespace Entitlement {
839
+ export interface GitHubConfig {
840
+ /**
841
+ * One of: pull, push, admin, maintain, triage
842
+ */
843
+ permission: string;
844
+
845
+ target_id: string;
846
+ }
847
+
848
+ export interface DiscordConfig {
849
+ guild_id: string;
850
+
851
+ role_id?: string | null;
852
+ }
853
+
854
+ export interface TelegramConfig {
855
+ chat_id: string;
856
+ }
857
+
858
+ export interface FigmaConfig {
859
+ figma_file_id: string;
860
+ }
861
+
862
+ export interface FramerConfig {
863
+ framer_template_id: string;
864
+ }
865
+
866
+ export interface NotionConfig {
867
+ notion_template_id: string;
868
+ }
869
+
870
+ export interface DigitalFilesConfig {
871
+ digital_file_ids: Array<string>;
872
+
873
+ external_url?: string | null;
874
+
875
+ instructions?: string | null;
876
+ }
877
+
878
+ export interface LicenseKeyConfig {
879
+ activation_message?: string | null;
880
+
881
+ activations_limit?: number | null;
882
+
883
+ duration_count?: number | null;
884
+
885
+ duration_interval?: string | null;
886
+ }
887
+ }
888
+ }
889
+
704
890
  export interface ProductUpdateFilesResponse {
705
891
  file_id: string;
706
892
 
@@ -749,12 +935,18 @@ export interface ProductCreateParams {
749
935
  digital_product_delivery?: ProductCreateParams.DigitalProductDelivery | null;
750
936
 
751
937
  /**
752
- * Optional message displayed during license key activation
938
+ * Optional entitlement IDs to attach to this product (max 20)
939
+ */
940
+ entitlement_ids?: Array<string> | null;
941
+
942
+ /**
943
+ * @deprecated Optional message displayed during license key activation
753
944
  */
754
945
  license_key_activation_message?: string | null;
755
946
 
756
947
  /**
757
- * The number of times the license key can be activated. Must be 0 or greater
948
+ * @deprecated The number of times the license key can be activated. Must be 0 or
949
+ * greater
758
950
  */
759
951
  license_key_activations_limit?: number | null;
760
952
 
@@ -766,7 +958,8 @@ export interface ProductCreateParams {
766
958
  license_key_duration?: LicenseKeyDuration | null;
767
959
 
768
960
  /**
769
- * When true, generates and sends a license key to your customer. Defaults to false
961
+ * @deprecated When true, generates and sends a license key to your customer.
962
+ * Defaults to false
770
963
  */
771
964
  license_key_enabled?: boolean | null;
772
965
 
@@ -817,13 +1010,19 @@ export interface ProductUpdateParams {
817
1010
  */
818
1011
  digital_product_delivery?: ProductUpdateParams.DigitalProductDelivery | null;
819
1012
 
1013
+ /**
1014
+ * Entitlement IDs to attach (replaces all existing when present) Send empty array
1015
+ * to remove all, omit field to leave unchanged
1016
+ */
1017
+ entitlement_ids?: Array<string> | null;
1018
+
820
1019
  /**
821
1020
  * Product image id after its uploaded to S3
822
1021
  */
823
1022
  image_id?: string | null;
824
1023
 
825
1024
  /**
826
- * Message sent to the customer upon license key activation.
1025
+ * @deprecated Message sent to the customer upon license key activation.
827
1026
  *
828
1027
  * Only applicable if `license_key_enabled` is `true`. This message contains
829
1028
  * instructions for activating the license key.
@@ -831,7 +1030,7 @@ export interface ProductUpdateParams {
831
1030
  license_key_activation_message?: string | null;
832
1031
 
833
1032
  /**
834
- * Limit for the number of activations for the license key.
1033
+ * @deprecated Limit for the number of activations for the license key.
835
1034
  *
836
1035
  * Only applicable if `license_key_enabled` is `true`. Represents the maximum
837
1036
  * number of times the license key can be activated.
@@ -847,7 +1046,7 @@ export interface ProductUpdateParams {
847
1046
  license_key_duration?: LicenseKeyDuration | null;
848
1047
 
849
1048
  /**
850
- * Whether the product requires a license key.
1049
+ * @deprecated Whether the product requires a license key.
851
1050
  *
852
1051
  * If `true`, additional fields related to license key (duration, activations
853
1052
  * limit, activation message) become applicable.
@@ -54,7 +54,11 @@ export type WebhookEventType =
54
54
  | 'dunning.started'
55
55
  | 'dunning.recovered'
56
56
  | 'acr.email'
57
- | 'dunning.email';
57
+ | 'dunning.email'
58
+ | 'entitlement_grant.created'
59
+ | 'entitlement_grant.delivered'
60
+ | 'entitlement_grant.failed'
61
+ | 'entitlement_grant.revoked';
58
62
 
59
63
  export interface WebhookPayload {
60
64
  business_id: string;
@@ -71,7 +75,8 @@ export interface WebhookPayload {
71
75
  | WebhookPayload.CreditLedgerEntry
72
76
  | WebhookPayload.CreditBalanceLow
73
77
  | WebhookPayload.AbandonedCheckout
74
- | WebhookPayload.DunningAttempt;
78
+ | WebhookPayload.DunningAttempt
79
+ | WebhookPayload.EntitlementGrant;
75
80
 
76
81
  /**
77
82
  * The timestamp of when the event occurred (not necessarily the same of when it
@@ -167,6 +172,56 @@ export namespace WebhookPayload {
167
172
 
168
173
  payment_id?: string | null;
169
174
  }
175
+
176
+ export interface EntitlementGrant {
177
+ id: string;
178
+
179
+ business_id: string;
180
+
181
+ created_at: string;
182
+
183
+ customer_id: string;
184
+
185
+ entitlement_id: string;
186
+
187
+ external_id: string;
188
+
189
+ payload_type: 'EntitlementGrant';
190
+
191
+ status: 'Pending' | 'Delivered' | 'Failed' | 'Revoked';
192
+
193
+ updated_at: string;
194
+
195
+ delivered_at?: string | null;
196
+
197
+ error_code?: string | null;
198
+
199
+ error_message?: string | null;
200
+
201
+ license_key?: string | null;
202
+
203
+ license_key_activations_limit?: number | null;
204
+
205
+ license_key_activations_used?: number | null;
206
+
207
+ license_key_expires_at?: string | null;
208
+
209
+ license_key_status?: string | null;
210
+
211
+ metadata?: unknown;
212
+
213
+ oauth_expires_at?: string | null;
214
+
215
+ oauth_url?: string | null;
216
+
217
+ payment_id?: string | null;
218
+
219
+ revocation_reason?: string | null;
220
+
221
+ revoked_at?: string | null;
222
+
223
+ subscription_id?: string | null;
224
+ }
170
225
  }
171
226
 
172
227
  export declare namespace WebhookEvents {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.27.0'; // x-release-please-version
1
+ export const VERSION = '2.28.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.27.0";
1
+ export declare const VERSION = "2.28.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.27.0";
1
+ export declare const VERSION = "2.28.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.27.0'; // x-release-please-version
4
+ exports.VERSION = '2.28.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.27.0'; // x-release-please-version
1
+ export const VERSION = '2.28.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map