@shware/purchase 5.0.0 → 5.1.1

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 (93) hide show
  1. package/dist/app-store/config.d.cts +1 -2
  2. package/dist/app-store/config.d.cts.map +1 -1
  3. package/dist/app-store/config.d.mts +1 -2
  4. package/dist/app-store/config.d.mts.map +1 -1
  5. package/dist/app-store/handler.d.cts +2 -3
  6. package/dist/app-store/handler.d.cts.map +1 -1
  7. package/dist/app-store/handler.d.mts +2 -3
  8. package/dist/app-store/handler.d.mts.map +1 -1
  9. package/dist/app-store/index.cjs +2 -0
  10. package/dist/app-store/index.d.cts +2 -1
  11. package/dist/app-store/index.d.mts +2 -1
  12. package/dist/app-store/index.mjs +2 -1
  13. package/dist/app-store/mapper.cjs +47 -0
  14. package/dist/app-store/mapper.cjs.map +1 -0
  15. package/dist/app-store/mapper.d.cts +24 -0
  16. package/dist/app-store/mapper.d.cts.map +1 -0
  17. package/dist/app-store/mapper.d.mts +24 -0
  18. package/dist/app-store/mapper.d.mts.map +1 -0
  19. package/dist/app-store/mapper.mjs +46 -0
  20. package/dist/app-store/mapper.mjs.map +1 -0
  21. package/dist/google-play/config.d.cts +1 -2
  22. package/dist/google-play/config.d.cts.map +1 -1
  23. package/dist/google-play/config.d.mts +1 -2
  24. package/dist/google-play/config.d.mts.map +1 -1
  25. package/dist/google-play/index.cjs +2 -0
  26. package/dist/google-play/index.d.cts +2 -2
  27. package/dist/google-play/index.d.mts +2 -2
  28. package/dist/google-play/index.mjs +2 -2
  29. package/dist/google-play/mapper.cjs +48 -0
  30. package/dist/google-play/mapper.cjs.map +1 -1
  31. package/dist/google-play/mapper.d.cts +30 -3
  32. package/dist/google-play/mapper.d.cts.map +1 -1
  33. package/dist/google-play/mapper.d.mts +30 -3
  34. package/dist/google-play/mapper.d.mts.map +1 -1
  35. package/dist/google-play/mapper.mjs +47 -1
  36. package/dist/google-play/mapper.mjs.map +1 -1
  37. package/dist/google-play/real-time-developer-notification.d.cts +16 -17
  38. package/dist/google-play/real-time-developer-notification.d.cts.map +1 -1
  39. package/dist/google-play/real-time-developer-notification.d.mts +16 -17
  40. package/dist/google-play/real-time-developer-notification.d.mts.map +1 -1
  41. package/dist/index.cjs +3 -0
  42. package/dist/index.d.cts +2 -2
  43. package/dist/index.d.mts +2 -2
  44. package/dist/index.mjs +2 -2
  45. package/dist/stripe/config.d.cts +3 -4
  46. package/dist/stripe/config.d.cts.map +1 -1
  47. package/dist/stripe/config.d.mts +3 -4
  48. package/dist/stripe/config.d.mts.map +1 -1
  49. package/dist/stripe/handler.d.cts +1 -2
  50. package/dist/stripe/handler.d.cts.map +1 -1
  51. package/dist/stripe/handler.d.mts +1 -2
  52. package/dist/stripe/handler.d.mts.map +1 -1
  53. package/dist/stripe/index.cjs +1 -0
  54. package/dist/stripe/index.d.cts +4 -3
  55. package/dist/stripe/index.d.mts +4 -3
  56. package/dist/stripe/index.mjs +2 -2
  57. package/dist/stripe/mapper.cjs +18 -0
  58. package/dist/stripe/mapper.cjs.map +1 -1
  59. package/dist/stripe/mapper.d.cts +29 -23
  60. package/dist/stripe/mapper.d.cts.map +1 -1
  61. package/dist/stripe/mapper.d.mts +29 -23
  62. package/dist/stripe/mapper.d.mts.map +1 -1
  63. package/dist/stripe/mapper.mjs +18 -1
  64. package/dist/stripe/mapper.mjs.map +1 -1
  65. package/dist/stripe/metadata.d.cts +1 -2
  66. package/dist/stripe/metadata.d.cts.map +1 -1
  67. package/dist/stripe/metadata.d.mts +1 -2
  68. package/dist/stripe/metadata.d.mts.map +1 -1
  69. package/dist/stripe/pending-checkout.d.cts +3 -4
  70. package/dist/stripe/pending-checkout.d.cts.map +1 -1
  71. package/dist/stripe/pending-checkout.d.mts +3 -4
  72. package/dist/stripe/pending-checkout.d.mts.map +1 -1
  73. package/dist/stripe/schema.cjs +4 -15
  74. package/dist/stripe/schema.cjs.map +1 -1
  75. package/dist/stripe/schema.d.cts +7 -11
  76. package/dist/stripe/schema.d.cts.map +1 -1
  77. package/dist/stripe/schema.d.mts +7 -11
  78. package/dist/stripe/schema.d.mts.map +1 -1
  79. package/dist/stripe/schema.mjs +4 -15
  80. package/dist/stripe/schema.mjs.map +1 -1
  81. package/dist/subscription/index.cjs +25 -0
  82. package/dist/subscription/index.cjs.map +1 -1
  83. package/dist/subscription/index.d.cts +41 -6
  84. package/dist/subscription/index.d.cts.map +1 -1
  85. package/dist/subscription/index.d.mts +41 -6
  86. package/dist/subscription/index.d.mts.map +1 -1
  87. package/dist/subscription/index.mjs +23 -1
  88. package/dist/subscription/index.mjs.map +1 -1
  89. package/dist/types.d.cts +2 -3
  90. package/dist/types.d.cts.map +1 -1
  91. package/dist/types.d.mts +2 -3
  92. package/dist/types.d.mts.map +1 -1
  93. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"mapper.mjs","names":[],"sources":["../../src/google-play/mapper.ts"],"sourcesContent":["import type { SubscriptionStatus } from '../subscription/index';\nimport type { GooglePlaySubscriptionState } from './real-time-developer-notification';\n\nexport function mapSubscriptionStatus(state: GooglePlaySubscriptionState): SubscriptionStatus {\n switch (state) {\n case 'SUBSCRIPTION_STATE_PENDING':\n return 'PENDING';\n case 'SUBSCRIPTION_STATE_ACTIVE':\n return 'ACTIVE';\n case 'SUBSCRIPTION_STATE_PAUSED':\n return 'PAUSED';\n case 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD':\n return 'IN_GRACE_PERIOD';\n case 'SUBSCRIPTION_STATE_ON_HOLD':\n return 'ON_HOLD';\n case 'SUBSCRIPTION_STATE_CANCELED':\n return 'CANCELED';\n case 'SUBSCRIPTION_STATE_EXPIRED':\n return 'EXPIRED';\n case 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED':\n return 'PENDING_PURCHASE_CANCELED';\n default:\n throw new Error(`Unknown Google Play subscription state: ${state}`);\n }\n}\n"],"mappings":";AAGA,SAAgB,sBAAsB,OAAwD;CAC5F,QAAQ,OAAR;EACE,KAAK,8BACH,OAAO;EACT,KAAK,6BACH,OAAO;EACT,KAAK,6BACH,OAAO;EACT,KAAK,sCACH,OAAO;EACT,KAAK,8BACH,OAAO;EACT,KAAK,+BACH,OAAO;EACT,KAAK,8BACH,OAAO;EACT,KAAK,gDACH,OAAO;EACT,SACE,MAAM,IAAI,MAAM,2CAA2C,OAAO;CACtE;AACF"}
1
+ {"version":3,"file":"mapper.mjs","names":[],"sources":["../../src/google-play/mapper.ts"],"sourcesContent":["import type { CancellationDetails, SubscriptionStatus } from '../subscription/index';\nimport type { GooglePlaySubscriptionState } from './real-time-developer-notification';\n\nexport function mapSubscriptionStatus(state: GooglePlaySubscriptionState): SubscriptionStatus {\n switch (state) {\n case 'SUBSCRIPTION_STATE_PENDING':\n return 'PENDING';\n case 'SUBSCRIPTION_STATE_ACTIVE':\n return 'ACTIVE';\n case 'SUBSCRIPTION_STATE_PAUSED':\n return 'PAUSED';\n case 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD':\n return 'IN_GRACE_PERIOD';\n case 'SUBSCRIPTION_STATE_ON_HOLD':\n return 'ON_HOLD';\n case 'SUBSCRIPTION_STATE_CANCELED':\n return 'CANCELED';\n case 'SUBSCRIPTION_STATE_EXPIRED':\n return 'EXPIRED';\n case 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED':\n return 'PENDING_PURCHASE_CANCELED';\n default:\n throw new Error(`Unknown Google Play subscription state: ${state}`);\n }\n}\n\n/** Play's cancel-survey answers in the shared vocabulary. */\nconst SURVEY_FEEDBACK: Record<string, CancellationDetails['feedback']> = {\n CANCEL_SURVEY_REASON_NOT_ENOUGH_USAGE: 'unused',\n CANCEL_SURVEY_REASON_TECHNICAL_ISSUES: 'low_quality',\n CANCEL_SURVEY_REASON_COST_RELATED: 'too_expensive',\n CANCEL_SURVEY_REASON_FOUND_BETTER_APP: 'switched_service',\n CANCEL_SURVEY_REASON_OTHERS: 'other',\n};\n\n/**\n * `canceledStateContext` of `purchases.subscriptionsv2.get`, declared structurally so this\n * module does not depend on the Play Developer API client.\n */\nexport interface CanceledStateContext {\n userInitiatedCancellation?: {\n cancelTime?: string | null;\n cancelSurveyResult?: { reason?: string | null; reasonUserInput?: string | null } | null;\n } | null;\n systemInitiatedCancellation?: object | null;\n developerInitiatedCancellation?: object | null;\n replacementCancellation?: object | null;\n}\n\n/**\n * Why a Play subscription stopped renewing. The Play Store asks the user for a reason on cancel\n * (and for free text when it is \"Other\"), which comes back in `cancelSurveyResult`. Null while\n * the subscription renews, and for a replacement: that is the linked purchase taking over, not a\n * cancellation to report.\n */\nexport function mapCancellationDetails(\n context: CanceledStateContext | null | undefined\n): CancellationDetails | null {\n if (!context) return null;\n if (context.userInitiatedCancellation) {\n const survey = context.userInitiatedCancellation.cancelSurveyResult;\n return {\n initiator: 'user',\n reason: survey?.reason ?? null,\n feedback: (survey?.reason && SURVEY_FEEDBACK[survey.reason]) || null,\n comment: survey?.reasonUserInput ?? null,\n };\n }\n if (context.systemInitiatedCancellation) {\n return { initiator: 'system', reason: 'SYSTEM_INITIATED', feedback: null, comment: null };\n }\n if (context.developerInitiatedCancellation) {\n return { initiator: 'developer', reason: 'DEVELOPER_INITIATED', feedback: null, comment: null };\n }\n return null;\n}\n\n/**\n * When the subscription was cancelled. Only a user cancellation carries the time; for the others\n * the caller falls back to when it learnt of it.\n */\nexport function mapCanceledAt(context: CanceledStateContext | null | undefined): string | null {\n return context?.userInitiatedCancellation?.cancelTime ?? null;\n}\n"],"mappings":";AAGA,SAAgB,sBAAsB,OAAwD;CAC5F,QAAQ,OAAR;EACE,KAAK,8BACH,OAAO;EACT,KAAK,6BACH,OAAO;EACT,KAAK,6BACH,OAAO;EACT,KAAK,sCACH,OAAO;EACT,KAAK,8BACH,OAAO;EACT,KAAK,+BACH,OAAO;EACT,KAAK,8BACH,OAAO;EACT,KAAK,gDACH,OAAO;EACT,SACE,MAAM,IAAI,MAAM,2CAA2C,OAAO;CACtE;AACF;;AAGA,MAAM,kBAAmE;CACvE,uCAAuC;CACvC,uCAAuC;CACvC,mCAAmC;CACnC,uCAAuC;CACvC,6BAA6B;AAC/B;;;;;;;AAsBA,SAAgB,uBACd,SAC4B;CAC5B,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,QAAQ,2BAA2B;EACrC,MAAM,SAAS,QAAQ,0BAA0B;EACjD,OAAO;GACL,WAAW;GACX,QAAQ,QAAQ,UAAU;GAC1B,UAAW,QAAQ,UAAU,gBAAgB,OAAO,WAAY;GAChE,SAAS,QAAQ,mBAAmB;EACtC;CACF;CACA,IAAI,QAAQ,6BACV,OAAO;EAAE,WAAW;EAAU,QAAQ;EAAoB,UAAU;EAAM,SAAS;CAAK;CAE1F,IAAI,QAAQ,gCACV,OAAO;EAAE,WAAW;EAAa,QAAQ;EAAuB,UAAU;EAAM,SAAS;CAAK;CAEhG,OAAO;AACT;;;;;AAMA,SAAgB,cAAc,SAAiE;CAC7F,OAAO,SAAS,2BAA2B,cAAc;AAC3D"}
@@ -1,5 +1,5 @@
1
1
  //#region src/google-play/real-time-developer-notification.d.ts
2
- type PubsubMessage = {
2
+ export type PubsubMessage = {
3
3
  data: string;
4
4
  attributes: Record<string, string>;
5
5
  messageId: string;
@@ -7,7 +7,7 @@ type PubsubMessage = {
7
7
  orderingKey: string;
8
8
  };
9
9
  /** https://developer.android.com/google/play/billing/rtdn-reference */
10
- interface DeveloperNotification {
10
+ export interface DeveloperNotification {
11
11
  version: string;
12
12
  packageName: string;
13
13
  eventTimeMillis: number;
@@ -19,7 +19,7 @@ interface DeveloperNotification {
19
19
  /**
20
20
  * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
21
21
  * */
22
- declare const SubscriptionNotificationType: {
22
+ export declare const SubscriptionNotificationType: {
23
23
  /** A subscription was recovered from account hold. */
24
24
  readonly SUBSCRIPTION_RECOVERED: 1;
25
25
  /** An active subscription was renewed. */
@@ -57,37 +57,37 @@ declare const SubscriptionNotificationType: {
57
57
  /** A pending transaction of a subscription has been canceled. */
58
58
  readonly SUBSCRIPTION_PENDING_PURCHASE_CANCELED: 20;
59
59
  };
60
- type SubscriptionNotificationType = (typeof SubscriptionNotificationType)[keyof typeof SubscriptionNotificationType];
61
- interface SubscriptionNotification {
60
+ export type SubscriptionNotificationType = (typeof SubscriptionNotificationType)[keyof typeof SubscriptionNotificationType];
61
+ export interface SubscriptionNotification {
62
62
  version: string;
63
63
  purchaseToken: string;
64
64
  notificationType: SubscriptionNotificationType;
65
65
  }
66
- declare const OneTimeProductNotificationType: {
66
+ export declare const OneTimeProductNotificationType: {
67
67
  /** A one-time product was successfully purchased by a user. */
68
68
  readonly ONE_TIME_PRODUCT_PURCHASED: 1;
69
69
  /** A pending one-time product purchase has been canceled by the user. */
70
70
  readonly ONE_TIME_PRODUCT_CANCELED: 2;
71
71
  };
72
- type OneTimeProductNotificationType = (typeof OneTimeProductNotificationType)[keyof typeof OneTimeProductNotificationType];
73
- interface OneTimeProductNotification {
72
+ export type OneTimeProductNotificationType = (typeof OneTimeProductNotificationType)[keyof typeof OneTimeProductNotificationType];
73
+ export interface OneTimeProductNotification {
74
74
  version: string;
75
75
  sku: string;
76
76
  purchaseToken: string;
77
77
  notificationType: OneTimeProductNotificationType;
78
78
  }
79
- declare const VoidedPurchaseProductType: {
79
+ export declare const VoidedPurchaseProductType: {
80
80
  /** A subscription purchase has been voided. */
81
81
  readonly PRODUCT_TYPE_SUBSCRIPTION: 1;
82
82
  /** A one-time purchase has been voided. */
83
83
  readonly PRODUCT_TYPE_ONE_TIME: 2;
84
84
  };
85
- type VoidedPurchaseProductType = (typeof VoidedPurchaseProductType)[keyof typeof VoidedPurchaseProductType];
85
+ export type VoidedPurchaseProductType = (typeof VoidedPurchaseProductType)[keyof typeof VoidedPurchaseProductType];
86
86
  /**
87
87
  * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
88
88
  * will be REFUND_TYPE_FULL_REFUND.
89
89
  */
90
- declare const VoidedPurchaseRefundType: {
90
+ export declare const VoidedPurchaseRefundType: {
91
91
  /** The purchase has been fully voided. */
92
92
  readonly REFUND_TYPE_FULL_REFUND: 1;
93
93
  /**
@@ -96,18 +96,18 @@ declare const VoidedPurchaseRefundType: {
96
96
  */
97
97
  readonly REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND: 2;
98
98
  };
99
- type VoidedPurchaseRefundType = (typeof VoidedPurchaseRefundType)[keyof typeof VoidedPurchaseRefundType];
100
- interface VoidedPurchaseNotification {
99
+ export type VoidedPurchaseRefundType = (typeof VoidedPurchaseRefundType)[keyof typeof VoidedPurchaseRefundType];
100
+ export interface VoidedPurchaseNotification {
101
101
  purchaseToken: string;
102
102
  orderId: string;
103
103
  productType: VoidedPurchaseProductType;
104
104
  refundType: VoidedPurchaseRefundType;
105
105
  }
106
- interface TestNotification {
106
+ export interface TestNotification {
107
107
  version: string;
108
108
  }
109
109
  /** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
110
- declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
110
+ export declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
111
111
  /** Unspecified subscription state. */
112
112
  'SUBSCRIPTION_STATE_UNSPECIFIED',
113
113
  /**
@@ -148,7 +148,6 @@ declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
148
148
  * subscription, use linkedPurchaseToken to get the current state of that subscription.
149
149
  */
150
150
  'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED'];
151
- type GooglePlaySubscriptionState = (typeof GOOGLE_PLAY_SUBSCRIPTION_STATES)[number];
151
+ export type GooglePlaySubscriptionState = (typeof GOOGLE_PLAY_SUBSCRIPTION_STATES)[number];
152
152
  //#endregion
153
- export { DeveloperNotification, GOOGLE_PLAY_SUBSCRIPTION_STATES, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
154
153
  //# sourceMappingURL=real-time-developer-notification.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"real-time-developer-notification.d.cts","names":[],"sources":["../../src/google-play/real-time-developer-notification.ts"],"mappings":";KACY;EACV;EACA,YAAY;EACZ;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA,0BAA0B;EAC1B,4BAA4B;EAC5B,4BAA4B;EAC5B,kBAAkB;;;;;cAMP;;WAEX;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;KAGU,uCACF,2CAA2C;UAEpC;EACf;EACA;EACA,kBAAkB;;cAGP;;WAEX;;WAGA;;KAGU,yCACF,6CAA6C;UAEtC;EACf;EACA;EACA;EACA,kBAAkB;;cAGP;;WAEX;;WAGA;;KAGU,oCACF,wCAAwC;;;;;cAMrC;;WAEX;;;;;WAMA;;KAGU,mCACF,uCAAuC;UAEhC;EACf;EACA;EACA,aAAa;EACb,YAAY;;UAGG;EACf;;;cAIW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmDD,sCAAsC"}
1
+ {"version":3,"file":"real-time-developer-notification.d.cts","names":[],"sources":["../../src/google-play/real-time-developer-notification.ts"],"mappings":";YACY;EACV;EACA,YAAY;EACZ;EACA;EACA;;;iBAIe;EACf;EACA;EACA;EACA,0BAA0B;EAC1B,4BAA4B;EAC5B,4BAA4B;EAC5B,kBAAkB;;;;;qBAMP;;WAEX;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;YAGU,uCACF,2CAA2C;iBAEpC;EACf;EACA;EACA,kBAAkB;;qBAGP;;WAEX;;WAGA;;YAGU,yCACF,6CAA6C;iBAEtC;EACf;EACA;EACA;EACA,kBAAkB;;qBAGP;;WAEX;;WAGA;;YAGU,oCACF,wCAAwC;;;;;qBAMrC;;WAEX;;;;;WAMA;;YAGU,mCACF,uCAAuC;iBAEhC;EACf;EACA;EACA,aAAa;EACb,YAAY;;iBAGG;EACf;;;qBAIW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmDD,sCAAsC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/google-play/real-time-developer-notification.d.ts
2
- type PubsubMessage = {
2
+ export type PubsubMessage = {
3
3
  data: string;
4
4
  attributes: Record<string, string>;
5
5
  messageId: string;
@@ -7,7 +7,7 @@ type PubsubMessage = {
7
7
  orderingKey: string;
8
8
  };
9
9
  /** https://developer.android.com/google/play/billing/rtdn-reference */
10
- interface DeveloperNotification {
10
+ export interface DeveloperNotification {
11
11
  version: string;
12
12
  packageName: string;
13
13
  eventTimeMillis: number;
@@ -19,7 +19,7 @@ interface DeveloperNotification {
19
19
  /**
20
20
  * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
21
21
  * */
22
- declare const SubscriptionNotificationType: {
22
+ export declare const SubscriptionNotificationType: {
23
23
  /** A subscription was recovered from account hold. */
24
24
  readonly SUBSCRIPTION_RECOVERED: 1;
25
25
  /** An active subscription was renewed. */
@@ -57,37 +57,37 @@ declare const SubscriptionNotificationType: {
57
57
  /** A pending transaction of a subscription has been canceled. */
58
58
  readonly SUBSCRIPTION_PENDING_PURCHASE_CANCELED: 20;
59
59
  };
60
- type SubscriptionNotificationType = (typeof SubscriptionNotificationType)[keyof typeof SubscriptionNotificationType];
61
- interface SubscriptionNotification {
60
+ export type SubscriptionNotificationType = (typeof SubscriptionNotificationType)[keyof typeof SubscriptionNotificationType];
61
+ export interface SubscriptionNotification {
62
62
  version: string;
63
63
  purchaseToken: string;
64
64
  notificationType: SubscriptionNotificationType;
65
65
  }
66
- declare const OneTimeProductNotificationType: {
66
+ export declare const OneTimeProductNotificationType: {
67
67
  /** A one-time product was successfully purchased by a user. */
68
68
  readonly ONE_TIME_PRODUCT_PURCHASED: 1;
69
69
  /** A pending one-time product purchase has been canceled by the user. */
70
70
  readonly ONE_TIME_PRODUCT_CANCELED: 2;
71
71
  };
72
- type OneTimeProductNotificationType = (typeof OneTimeProductNotificationType)[keyof typeof OneTimeProductNotificationType];
73
- interface OneTimeProductNotification {
72
+ export type OneTimeProductNotificationType = (typeof OneTimeProductNotificationType)[keyof typeof OneTimeProductNotificationType];
73
+ export interface OneTimeProductNotification {
74
74
  version: string;
75
75
  sku: string;
76
76
  purchaseToken: string;
77
77
  notificationType: OneTimeProductNotificationType;
78
78
  }
79
- declare const VoidedPurchaseProductType: {
79
+ export declare const VoidedPurchaseProductType: {
80
80
  /** A subscription purchase has been voided. */
81
81
  readonly PRODUCT_TYPE_SUBSCRIPTION: 1;
82
82
  /** A one-time purchase has been voided. */
83
83
  readonly PRODUCT_TYPE_ONE_TIME: 2;
84
84
  };
85
- type VoidedPurchaseProductType = (typeof VoidedPurchaseProductType)[keyof typeof VoidedPurchaseProductType];
85
+ export type VoidedPurchaseProductType = (typeof VoidedPurchaseProductType)[keyof typeof VoidedPurchaseProductType];
86
86
  /**
87
87
  * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
88
88
  * will be REFUND_TYPE_FULL_REFUND.
89
89
  */
90
- declare const VoidedPurchaseRefundType: {
90
+ export declare const VoidedPurchaseRefundType: {
91
91
  /** The purchase has been fully voided. */
92
92
  readonly REFUND_TYPE_FULL_REFUND: 1;
93
93
  /**
@@ -96,18 +96,18 @@ declare const VoidedPurchaseRefundType: {
96
96
  */
97
97
  readonly REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND: 2;
98
98
  };
99
- type VoidedPurchaseRefundType = (typeof VoidedPurchaseRefundType)[keyof typeof VoidedPurchaseRefundType];
100
- interface VoidedPurchaseNotification {
99
+ export type VoidedPurchaseRefundType = (typeof VoidedPurchaseRefundType)[keyof typeof VoidedPurchaseRefundType];
100
+ export interface VoidedPurchaseNotification {
101
101
  purchaseToken: string;
102
102
  orderId: string;
103
103
  productType: VoidedPurchaseProductType;
104
104
  refundType: VoidedPurchaseRefundType;
105
105
  }
106
- interface TestNotification {
106
+ export interface TestNotification {
107
107
  version: string;
108
108
  }
109
109
  /** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
110
- declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
110
+ export declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
111
111
  /** Unspecified subscription state. */
112
112
  'SUBSCRIPTION_STATE_UNSPECIFIED',
113
113
  /**
@@ -148,7 +148,6 @@ declare const GOOGLE_PLAY_SUBSCRIPTION_STATES: readonly [
148
148
  * subscription, use linkedPurchaseToken to get the current state of that subscription.
149
149
  */
150
150
  'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED'];
151
- type GooglePlaySubscriptionState = (typeof GOOGLE_PLAY_SUBSCRIPTION_STATES)[number];
151
+ export type GooglePlaySubscriptionState = (typeof GOOGLE_PLAY_SUBSCRIPTION_STATES)[number];
152
152
  //#endregion
153
- export { DeveloperNotification, GOOGLE_PLAY_SUBSCRIPTION_STATES, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
154
153
  //# sourceMappingURL=real-time-developer-notification.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"real-time-developer-notification.d.mts","names":[],"sources":["../../src/google-play/real-time-developer-notification.ts"],"mappings":";KACY;EACV;EACA,YAAY;EACZ;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA,0BAA0B;EAC1B,4BAA4B;EAC5B,4BAA4B;EAC5B,kBAAkB;;;;;cAMP;;WAEX;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;KAGU,uCACF,2CAA2C;UAEpC;EACf;EACA;EACA,kBAAkB;;cAGP;;WAEX;;WAGA;;KAGU,yCACF,6CAA6C;UAEtC;EACf;EACA;EACA;EACA,kBAAkB;;cAGP;;WAEX;;WAGA;;KAGU,oCACF,wCAAwC;;;;;cAMrC;;WAEX;;;;;WAMA;;KAGU,mCACF,uCAAuC;UAEhC;EACf;EACA;EACA,aAAa;EACb,YAAY;;UAGG;EACf;;;cAIW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmDD,sCAAsC"}
1
+ {"version":3,"file":"real-time-developer-notification.d.mts","names":[],"sources":["../../src/google-play/real-time-developer-notification.ts"],"mappings":";YACY;EACV;EACA,YAAY;EACZ;EACA;EACA;;;iBAIe;EACf;EACA;EACA;EACA,0BAA0B;EAC1B,4BAA4B;EAC5B,4BAA4B;EAC5B,kBAAkB;;;;;qBAMP;;WAEX;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;;;;WAMA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;WAGA;;YAGU,uCACF,2CAA2C;iBAEpC;EACf;EACA;EACA,kBAAkB;;qBAGP;;WAEX;;WAGA;;YAGU,yCACF,6CAA6C;iBAEtC;EACf;EACA;EACA;EACA,kBAAkB;;qBAGP;;WAEX;;WAGA;;YAGU,oCACF,wCAAwC;;;;;qBAMrC;;WAEX;;;;;WAMA;;YAGU,mCACF,uCAAuC;iBAEhC;EACf;EACA;EACA,aAAa;EACb,YAAY;;iBAGG;EACf;;;qBAIW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmDD,sCAAsC"}
package/dist/index.cjs CHANGED
@@ -5,7 +5,10 @@ const require_google_play_config = require("./google-play/config.cjs");
5
5
  const require_stripe_config = require("./stripe/config.cjs");
6
6
  exports.AVAILABLE_STATUSES = require_subscription_index.AVAILABLE_STATUSES;
7
7
  exports.AppStoreConfig = require_app_store_config.AppStoreConfig;
8
+ exports.CANCELLATION_FEEDBACKS = require_subscription_index.CANCELLATION_FEEDBACKS;
9
+ exports.CANCELLATION_INITIATORS = require_subscription_index.CANCELLATION_INITIATORS;
8
10
  exports.GooglePlayConfig = require_google_play_config.GooglePlayConfig;
9
11
  exports.PLATFORMS = require_subscription_index.PLATFORMS;
12
+ exports.RESUBSCRIBE_INTENTS = require_subscription_index.RESUBSCRIBE_INTENTS;
10
13
  exports.SUBSCRIPTION_STATUSES = require_subscription_index.SUBSCRIPTION_STATUSES;
11
14
  exports.StripeConfig = require_stripe_config.StripeConfig;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AppStoreConfig } from "./app-store/config.cjs";
2
+ import { AVAILABLE_STATUSES, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, CancellationDetails, CancellationFeedback, CancellationInitiator, PLATFORMS, Platform, RESUBSCRIBE_INTENTS, ResubscribeIntent, SUBSCRIPTION_STATUSES, SubscriptionStatus } from "./subscription/index.cjs";
2
3
  import { GooglePlayConfig } from "./google-play/config.cjs";
3
- import { AVAILABLE_STATUSES, PLATFORMS, Platform, SUBSCRIPTION_STATUSES, SubscriptionStatus } from "./subscription/index.cjs";
4
4
  import { StripeConfig } from "./stripe/config.cjs";
5
- export { AVAILABLE_STATUSES, AppStoreConfig, GooglePlayConfig, PLATFORMS, type Platform, SUBSCRIPTION_STATUSES, StripeConfig, type SubscriptionStatus };
5
+ export { AVAILABLE_STATUSES, AppStoreConfig, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, type CancellationDetails, type CancellationFeedback, type CancellationInitiator, GooglePlayConfig, PLATFORMS, type Platform, RESUBSCRIBE_INTENTS, type ResubscribeIntent, SUBSCRIPTION_STATUSES, StripeConfig, type SubscriptionStatus };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AppStoreConfig } from "./app-store/config.mjs";
2
+ import { AVAILABLE_STATUSES, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, CancellationDetails, CancellationFeedback, CancellationInitiator, PLATFORMS, Platform, RESUBSCRIBE_INTENTS, ResubscribeIntent, SUBSCRIPTION_STATUSES, SubscriptionStatus } from "./subscription/index.mjs";
2
3
  import { GooglePlayConfig } from "./google-play/config.mjs";
3
- import { AVAILABLE_STATUSES, PLATFORMS, Platform, SUBSCRIPTION_STATUSES, SubscriptionStatus } from "./subscription/index.mjs";
4
4
  import { StripeConfig } from "./stripe/config.mjs";
5
- export { AVAILABLE_STATUSES, AppStoreConfig, GooglePlayConfig, PLATFORMS, type Platform, SUBSCRIPTION_STATUSES, StripeConfig, type SubscriptionStatus };
5
+ export { AVAILABLE_STATUSES, AppStoreConfig, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, type CancellationDetails, type CancellationFeedback, type CancellationInitiator, GooglePlayConfig, PLATFORMS, type Platform, RESUBSCRIBE_INTENTS, type ResubscribeIntent, SUBSCRIPTION_STATUSES, StripeConfig, type SubscriptionStatus };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { AVAILABLE_STATUSES, PLATFORMS, SUBSCRIPTION_STATUSES } from "./subscription/index.mjs";
1
+ import { AVAILABLE_STATUSES, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, PLATFORMS, RESUBSCRIBE_INTENTS, SUBSCRIPTION_STATUSES } from "./subscription/index.mjs";
2
2
  import { AppStoreConfig } from "./app-store/config.mjs";
3
3
  import { GooglePlayConfig } from "./google-play/config.mjs";
4
4
  import { StripeConfig } from "./stripe/config.mjs";
5
- export { AVAILABLE_STATUSES, AppStoreConfig, GooglePlayConfig, PLATFORMS, SUBSCRIPTION_STATUSES, StripeConfig };
5
+ export { AVAILABLE_STATUSES, AppStoreConfig, CANCELLATION_FEEDBACKS, CANCELLATION_INITIATORS, GooglePlayConfig, PLATFORMS, RESUBSCRIBE_INTENTS, SUBSCRIPTION_STATUSES, StripeConfig };
@@ -1,13 +1,13 @@
1
1
  import { Metadata } from "../types.cjs";
2
2
  //#region src/stripe/config.d.ts
3
- type PriceId = `price_${string}`;
3
+ export type PriceId = `price_${string}`;
4
4
  /**
5
5
  * Which Stripe object space the config addresses. Test and live prices are
6
6
  * disjoint, so a config is built for exactly one of them. Derive it from the
7
7
  * secret key (`sk_test_` vs `sk_live_`) rather than from the deployment
8
8
  * environment: the key is what actually decides which space API calls hit.
9
9
  */
10
- type StripeMode = 'live' | 'test';
10
+ export type StripeMode = 'live' | 'test';
11
11
  declare const addMethod: unique symbol;
12
12
  declare class Product<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never, I extends PriceId = never> {
13
13
  readonly id: string;
@@ -43,7 +43,7 @@ type Options = {
43
43
  cancellationCouponId: string;
44
44
  allowPromotionCodes: boolean;
45
45
  };
46
- declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never> {
46
+ export declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never> {
47
47
  private readonly products;
48
48
  readonly mode: StripeMode;
49
49
  returnUrl: string;
@@ -73,5 +73,4 @@ declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE
73
73
  getCreditExpiresAt: (productId: string, priceId?: string) => string;
74
74
  }
75
75
  //#endregion
76
- export { PriceId, StripeConfig, StripeMode };
77
76
  //# sourceMappingURL=config.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.cts","names":[],"sources":["../../src/stripe/config.ts"],"mappings":";;KAIY;;;;;;;KAQA;cAEN;cAEA,QACJ,WAAW,oBAAoB,mBAC/B,4BACA,4BACA,2BACA,2BACA,UAAU;WAED;WACA,QAAQ,aAAa,IAAI,IAAI,IAAI,IAAI;WACrC,MAAM;WACN,eAAe;WACf,QAAQ,IAAI,SAAS;EAE9B,gBAAgB;EAEhB,YACE,QAAQ,aAAa,IAAI,IAAI,IAAI,IAA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N,gBAAe;;;;;;EAejB,QAAS,UAAU,SAAO,SACf,UAAU,YAAY,GAAC,WACtB,aACT,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;;;;;;;;;EAcnC,UAAO,gBAAoB,GAAC;IAAW,MAAM;QAAS,aAAA,IAAA,IAAA,IAAA,IAAA;;KAgBnD;EACH,MAAM;EACN;EACA;EACA;EACA;EACA;;qBAGW,aACX,WAAW,oBAAoB,mBAC/B,4BACA,4BACA,2BACA;mBAEiB;WAED,MAAM;EACf;EACA;EACA;EACA;EACA;MAEH;GAMH,aAAU,SAAa,QAAQ,IAAI,IAAI,IAAI,IAAI;UAczC;SASA,SAAU,aAAW,mBAAmB,qBAAmB,8BAA0B,SACjF,YAAO,aAAA,MAAA,MAAA;;;;;EASlB;KACG,aAAa,MAAM,qBAClB,WAAW,UAAU,aAAa,IACjC,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI;KAC9B,aAAa,MAAM,qBAAqB,UAAU,IAAI,UAAU,IAC/D,WAAW,UAAU,aAAa,GAClC,MAAM,GACN,kBAAkB,KAAK,YAAY,aAAa,IAC/C,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,IAAI,IAAI;;EAK/C,UAAO,sBAAwB;EAO/B,mBAAgB,sBAAwB;EAOxC,UAAO;;EAOP,aAAU,sBAAwB;EAOlC,kBAAe,mBAAqB;mBAanB;EAajB,qBAAkB,mBAAqB"}
@@ -1,13 +1,13 @@
1
1
  import { Metadata } from "../types.mjs";
2
2
  //#region src/stripe/config.d.ts
3
- type PriceId = `price_${string}`;
3
+ export type PriceId = `price_${string}`;
4
4
  /**
5
5
  * Which Stripe object space the config addresses. Test and live prices are
6
6
  * disjoint, so a config is built for exactly one of them. Derive it from the
7
7
  * secret key (`sk_test_` vs `sk_live_`) rather than from the deployment
8
8
  * environment: the key is what actually decides which space API calls hit.
9
9
  */
10
- type StripeMode = 'live' | 'test';
10
+ export type StripeMode = 'live' | 'test';
11
11
  declare const addMethod: unique symbol;
12
12
  declare class Product<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never, I extends PriceId = never> {
13
13
  readonly id: string;
@@ -43,7 +43,7 @@ type Options = {
43
43
  cancellationCouponId: string;
44
44
  allowPromotionCodes: boolean;
45
45
  };
46
- declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never> {
46
+ export declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE extends string = string, BP extends string = string, PL extends string = never, PI extends string = never> {
47
47
  private readonly products;
48
48
  readonly mode: StripeMode;
49
49
  returnUrl: string;
@@ -73,5 +73,4 @@ declare class StripeConfig<NS extends Lowercase<string> = Lowercase<string>, PE
73
73
  getCreditExpiresAt: (productId: string, priceId?: string) => string;
74
74
  }
75
75
  //#endregion
76
- export { PriceId, StripeConfig, StripeMode };
77
76
  //# sourceMappingURL=config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/stripe/config.ts"],"mappings":";;KAIY;;;;;;;KAQA;cAEN;cAEA,QACJ,WAAW,oBAAoB,mBAC/B,4BACA,4BACA,2BACA,2BACA,UAAU;WAED;WACA,QAAQ,aAAa,IAAI,IAAI,IAAI,IAAI;WACrC,MAAM;WACN,eAAe;WACf,QAAQ,IAAI,SAAS;EAE9B,gBAAgB;EAEhB,YACE,QAAQ,aAAa,IAAI,IAAI,IAAI,IAAI,KACrC,YACA,OAAM,WACN,gBAAe;;;;;;EAejB,QAAS,UAAU,SAAO,SACf,UAAU,YAAY,GAAC,WACtB,aACT,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;;;;;;;;;EAcnC,UAAO,gBAAoB,GAAC;IAAW,MAAM;QAAS,aAAA,IAAA,IAAA,IAAA,IAAA;;KAgBnD;EACH,MAAM;EACN;EACA;EACA;EACA;EACA;;cAGW,aACX,WAAW,oBAAoB,mBAC/B,4BACA,4BACA,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AAM;EACf;EACA;EACA;EACA;EACA;MAEH;GAMH,aAAU,SAAa,QAAQ,IAAI,IAAI,IAAI,IAAI;UAczC;SASA,SAAU,aAAW,mBAAmB,qBAAmB,8BAA0B,SACjF,YAAO,aAAA,MAAA,MAAA;;;;;EASlB;KACG,aAAa,MAAM,qBAClB,WAAW,UAAU,aAAa,IACjC,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI;KAC9B,aAAa,MAAM,qBAAqB,UAAU,IAAI,UAAU,IAC/D,WAAW,UAAU,aAAa,GAClC,MAAM,GACN,kBAAkB,KAAK,YAAY,aAAa,IAC/C,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,IAAI,IAAI;;EAK/C,UAAO,sBAAwB;EAO/B,mBAAgB,sBAAwB;EAOxC,UAAO;;EAOP,aAAU,sBAAwB;EAOlC,kBAAe,mBAAqB;mBAanB;EAajB,qBAAkB,mBAAqB"}
@@ -4,7 +4,7 @@ type StripeEventObject<T extends Stripe.Event.Type> = Extract<Stripe.Event, {
4
4
  type: T;
5
5
  }>['data']['object'];
6
6
  type EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (object: StripeEventObject<T>) => Promise<void>;
7
- declare class StripeEventHandler {
7
+ export declare class StripeEventHandler {
8
8
  private readonly handlers;
9
9
  private constructor();
10
10
  static create(): StripeEventHandler;
@@ -12,5 +12,4 @@ declare class StripeEventHandler {
12
12
  process: (event: Stripe.Event) => Promise<void>;
13
13
  }
14
14
  //#endregion
15
- export { StripeEventHandler };
16
15
  //# sourceMappingURL=handler.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.cts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;cAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
1
+ {"version":3,"file":"handler.d.cts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;qBAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
@@ -4,7 +4,7 @@ type StripeEventObject<T extends Stripe.Event.Type> = Extract<Stripe.Event, {
4
4
  type: T;
5
5
  }>['data']['object'];
6
6
  type EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (object: StripeEventObject<T>) => Promise<void>;
7
- declare class StripeEventHandler {
7
+ export declare class StripeEventHandler {
8
8
  private readonly handlers;
9
9
  private constructor();
10
10
  static create(): StripeEventHandler;
@@ -12,5 +12,4 @@ declare class StripeEventHandler {
12
12
  process: (event: Stripe.Event) => Promise<void>;
13
13
  }
14
14
  //#endregion
15
- export { StripeEventHandler };
16
15
  //# sourceMappingURL=handler.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.mts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;cAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
1
+ {"version":3,"file":"handler.d.mts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;qBAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
@@ -14,6 +14,7 @@ exports.createCheckoutSessionSchema = require_stripe_schema.createCheckoutSessio
14
14
  exports.getBeginCheckoutProperties = require_stripe_mapper.getBeginCheckoutProperties;
15
15
  exports.getPendingCheckouts = require_stripe_pending_checkout.getPendingCheckouts;
16
16
  exports.getPurchaseProperties = require_stripe_mapper.getPurchaseProperties;
17
+ exports.mapCancellationDetails = require_stripe_mapper.mapCancellationDetails;
17
18
  exports.mapCharge = require_stripe_mapper.mapCharge;
18
19
  exports.mapCheckoutSession = require_stripe_mapper.mapCheckoutSession;
19
20
  exports.mapInvoice = require_stripe_mapper.mapInvoice;
@@ -1,8 +1,9 @@
1
+ import { CancellationDetails } from "../subscription/index.cjs";
1
2
  import { PriceId, StripeConfig, StripeMode } from "./config.cjs";
2
3
  import { StripeEventHandler } from "./handler.cjs";
3
- import { BeginCheckoutProperties, CheckoutSession, LineItem, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.cjs";
4
- import { CancellationDetails, CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.cjs";
4
+ import { BeginCheckoutProperties, CheckoutSession, LineItem, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.cjs";
5
+ import { CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.cjs";
5
6
  import { METADATA_KEYS } from "./metadata.cjs";
6
7
  import { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from "./pending-checkout.cjs";
7
8
  import { Stripe } from "stripe";
8
- export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, type LineItem, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, type StripeMode, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
9
+ export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, type LineItem, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, type StripeMode, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
@@ -1,8 +1,9 @@
1
+ import { CancellationDetails } from "../subscription/index.mjs";
1
2
  import { PriceId, StripeConfig, StripeMode } from "./config.mjs";
2
3
  import { StripeEventHandler } from "./handler.mjs";
3
- import { BeginCheckoutProperties, CheckoutSession, LineItem, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.mjs";
4
- import { CancellationDetails, CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.mjs";
4
+ import { BeginCheckoutProperties, CheckoutSession, LineItem, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.mjs";
5
+ import { CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.mjs";
5
6
  import { METADATA_KEYS } from "./metadata.mjs";
6
7
  import { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from "./pending-checkout.mjs";
7
8
  import { Stripe } from "stripe";
8
- export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, type LineItem, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, type StripeMode, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
9
+ export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, type LineItem, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, type StripeMode, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
@@ -1,7 +1,7 @@
1
1
  import { StripeConfig } from "./config.mjs";
2
2
  import { StripeEventHandler } from "./handler.mjs";
3
- import { getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.mjs";
3
+ import { getBeginCheckoutProperties, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.mjs";
4
4
  import { cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.mjs";
5
5
  import { METADATA_KEYS } from "./metadata.mjs";
6
6
  import { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from "./pending-checkout.mjs";
7
- export { METADATA_KEYS, StripeConfig, StripeEventHandler, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
7
+ export { METADATA_KEYS, StripeConfig, StripeEventHandler, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCancellationDetails, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_subscription_index = require("../subscription/index.cjs");
2
3
  //#region src/stripe/mapper.ts
3
4
  function mapTime(stripeTimestampSeconds) {
4
5
  if (!stripeTimestampSeconds) return null;
@@ -198,10 +199,27 @@ function getBeginCheckoutProperties(p) {
198
199
  }]
199
200
  };
200
201
  }
202
+ /**
203
+ * Stripe's `cancellation_details` in the shared shape. The object is present on every
204
+ * subscription with all three fields null, so an active one maps to null rather than an empty
205
+ * record. `reason` says who acted: `cancellation_requested` is the customer (or us on their
206
+ * behalf), the payment reasons are Stripe ending it.
207
+ */
208
+ function mapCancellationDetails(subscription) {
209
+ const details = subscription.cancellation_details;
210
+ if (!details || !details.reason && !details.feedback && !details.comment) return null;
211
+ return {
212
+ initiator: details.reason === "payment_failed" || details.reason === "payment_disputed" ? "system" : "user",
213
+ reason: details.reason ?? null,
214
+ feedback: details.feedback ? require_subscription_index.CANCELLATION_FEEDBACKS.includes(details.feedback) ? details.feedback : "other" : null,
215
+ comment: details.comment ?? null
216
+ };
217
+ }
201
218
  //#endregion
202
219
  exports.ZERO_DECIMAL_CURRENCIES = ZERO_DECIMAL_CURRENCIES;
203
220
  exports.getBeginCheckoutProperties = getBeginCheckoutProperties;
204
221
  exports.getPurchaseProperties = getPurchaseProperties;
222
+ exports.mapCancellationDetails = mapCancellationDetails;
205
223
  exports.mapCharge = mapCharge;
206
224
  exports.mapCheckoutSession = mapCheckoutSession;
207
225
  exports.mapInvoice = mapInvoice;
@@ -1 +1 @@
1
- {"version":3,"file":"mapper.cjs","names":[],"sources":["../../src/stripe/mapper.ts"],"sourcesContent":["import type { Stripe } from 'stripe';\nimport type { SubscriptionStatus } from '../subscription/index';\n\nexport function mapTime<T extends number | null>(\n stripeTimestampSeconds: T\n): T extends number ? string : null {\n if (!stripeTimestampSeconds) return null as T extends number ? string : null;\n return new Date(stripeTimestampSeconds * 1000).toISOString() as T extends number ? string : null;\n}\n\nexport type Price = {\n id: string;\n type: Stripe.Price.Type;\n active: boolean;\n billing_scheme: Stripe.Price.BillingScheme;\n currency: Stripe.Price['currency'];\n unit_amount: number | null;\n unit_amount_decimal: string | null;\n recurring: Stripe.Price.Recurring | null;\n};\n\nexport function mapPrice(price: Stripe.Price): Price {\n return {\n id: price.id,\n type: price.type,\n active: price.active,\n billing_scheme: price.billing_scheme,\n currency: price.currency,\n unit_amount: price.unit_amount,\n unit_amount_decimal: price.unit_amount_decimal?.toString() ?? null,\n recurring: price.recurring,\n };\n}\n\nexport interface LineItem {\n id: string;\n currency: string;\n quantity: number | null;\n description: string | null;\n amount_tax: number;\n amount_total: number;\n amount_subtotal: number;\n amount_discount: number;\n price: Price | null;\n}\n\nexport function mapLineItem(item: Stripe.LineItem): LineItem {\n return {\n id: item.price\n ? typeof item.price.product === 'string'\n ? item.price.product\n : item.price.product.id\n : item.id,\n currency: item.currency,\n quantity: item.quantity,\n description: item.description,\n amount_tax: item.amount_tax,\n amount_total: item.amount_total,\n amount_subtotal: item.amount_subtotal,\n amount_discount: item.amount_discount,\n price: item.price ? mapPrice(item.price) : null,\n };\n}\n\n// Re-exported under our own name so consumers need not reach into stripe's namespace.\n// Open-ended since stripe 22.4: a status the API adds later is not a type error.\nexport type PaymentStatus = Stripe.Checkout.Session.PaymentStatus;\n\n// Declared rather than inferred from mapCheckoutSession: an inferred shape is\n// structural, so a consumer's declaration emit has to spell out payment_status\n// through stripe's internal module path — TS2883 in any package that reaches\n// stripe transitively instead of depending on it (see line_items/price too).\nexport interface CheckoutSession {\n id: string;\n url: string | null;\n coupon: string | undefined;\n livemode: boolean;\n expires_at: number;\n payment_status: PaymentStatus;\n currency: string | null;\n amount_total: number | null;\n line_items: LineItem[] | undefined;\n}\n\nexport function mapCheckoutSession(session: Stripe.Checkout.Session): CheckoutSession {\n let coupon: string | undefined = undefined;\n if (Array.isArray(session.discounts) && session.discounts.length !== 0) {\n const discount = session.discounts[0];\n if (discount.coupon && typeof discount.coupon === 'object') {\n coupon = discount.coupon.id;\n } else if (typeof discount.coupon === 'string') {\n coupon = discount.coupon;\n } else {\n coupon = undefined;\n }\n }\n\n return {\n id: session.id,\n url: session.url,\n coupon,\n livemode: session.livemode,\n expires_at: session.expires_at,\n payment_status: session.payment_status,\n currency: session.currency,\n amount_total: session.amount_total,\n line_items: session.line_items?.data.map(mapLineItem),\n };\n}\n\nexport function mapInvoice(i: Stripe.Invoice) {\n return {\n id: i.id,\n number: i.number,\n total: i.total,\n subtotal: i.subtotal,\n amount_due: i.amount_due,\n amount_paid: i.amount_paid,\n amount_remaining: i.amount_remaining,\n currency: i.currency,\n billing_reason: i.billing_reason,\n hosted_invoice_url: i.hosted_invoice_url,\n invoice_pdf: i.invoice_pdf,\n receipt_number: i.receipt_number,\n status: i.status,\n created: i.created,\n period_start: i.period_start,\n period_end: i.period_end,\n };\n}\n\nexport function mapPaymentIntent(intent: Stripe.PaymentIntent) {\n return {\n id: intent.id,\n amount: intent.amount,\n amount_capturable: intent.amount_capturable,\n amount_received: intent.amount_received,\n currency: intent.currency,\n client_secret: intent.client_secret,\n description: intent.description,\n status: intent.status,\n created: intent.created,\n };\n}\n\nexport function mapCharge(charge: Stripe.Charge) {\n return {\n id: charge.id,\n description: charge.description,\n currency: charge.currency,\n amount: charge.amount,\n amount_captured: charge.amount_captured,\n amount_refunded: charge.amount_refunded,\n receipt_email: charge.receipt_email,\n receipt_number: charge.receipt_number,\n receipt_url: charge.receipt_url,\n status: charge.status,\n created: charge.created,\n payment_intent:\n charge.payment_intent && typeof charge.payment_intent === 'object'\n ? mapPaymentIntent(charge.payment_intent)\n : undefined,\n };\n}\n\nexport type ProductPrice = {\n id: string;\n type: Stripe.Price.Type;\n unit_amount: number;\n currency: Stripe.Price['currency'];\n product: {\n id: Stripe.Product['id'];\n name: Stripe.Product['name'];\n description: Stripe.Product['description'];\n livemode: Stripe.Product['livemode'];\n };\n};\n\nexport function mapSubscriptionStatus(status: Stripe.Subscription.Status): SubscriptionStatus {\n switch (status) {\n case 'active':\n return 'ACTIVE';\n case 'canceled':\n return 'CANCELED';\n case 'incomplete':\n return 'INCOMPLETE';\n case 'incomplete_expired':\n return 'INCOMPLETE_EXPIRED';\n case 'past_due':\n return 'PAST_DUE';\n case 'paused':\n return 'PAUSED';\n case 'trialing':\n return 'TRIALING';\n case 'unpaid':\n return 'UNPAID';\n default: {\n console.error(`Invalid stripe status: ${String(status)}`);\n throw new Error(`Invalid stripe status: ${String(status)}`);\n }\n }\n}\n\nexport const ZERO_DECIMAL_CURRENCIES = [\n 'BIF',\n 'CLP',\n 'DJF',\n 'GNF',\n 'JPY',\n 'KMF',\n 'KRW',\n 'MGA',\n 'PYG',\n 'RWF',\n 'UGX',\n 'VND',\n 'VUV',\n 'XAF',\n 'XOF',\n 'XPF',\n];\n\nexport function minorUnits(currency: string) {\n return ZERO_DECIMAL_CURRENCIES.includes(currency.toUpperCase()) ? 1 : 100;\n}\n\nexport function price(value: number, currency: string) {\n return value / minorUnits(currency);\n}\n\nexport interface Item {\n item_id: string;\n item_name: string;\n affiliation?: 'Google Store' | (string & {});\n coupon?: string;\n discount?: number;\n index?: number;\n item_brand?: string;\n item_category?: string;\n item_category2?: string;\n item_category3?: string;\n item_category4?: string;\n item_category5?: string;\n item_list_id?: string;\n item_list_name?: string;\n item_variant?: string;\n location_id?: string;\n price?: number;\n quantity?: number;\n}\n\nexport interface PurchaseProperties {\n currency: string;\n value: number;\n transaction_id: string;\n coupon?: string;\n shipping?: number;\n tax?: number;\n items?: Item[];\n}\n\nexport interface BeginCheckoutProperties {\n currency: string;\n value: number;\n coupon?: string;\n items: Item[];\n}\n\n// Google Ads rejects conversion transaction IDs longer than 64 characters.\n// https://support.google.com/google-ads/answer/6386790\nconst GOOGLE_ADS_TRANSACTION_ID_MAX = 64;\n\n/**\n * GA4 purchase events feed Google Ads conversions, whose transaction IDs are\n * capped at 64 characters — but Stripe checkout session ids exceed that:\n * around 2021 they grew from ~32 chars (`cs_live_` + 24 random chars) to ~66\n * (`cs_live_a` + 57), with no announcement. Stripe treats id length/format as\n * opaque and backwards-compatible, guaranteeing only that ids never exceed\n * 255 chars, so they may grow again at any time.\n *\n * Dropping the fixed `cs_live_`/`cs_test_` prefix brings the id under 64\n * while staying reversible: prepend the prefix (livemode tells which) to\n * reconstruct the full session id for Stripe dashboard lookups. The payment\n * intent id (~27 chars) is not a substitute — it only exists on\n * `mode: 'payment'` sessions (subscription-mode sessions carry it on the\n * invoice instead), and its short length is just as unguaranteed as the\n * session id's was.\n *\n * Must stay deterministic: GA4/Google Ads dedupe purchases by\n * transaction_id, and the same session may be tracked from multiple paths.\n */\nfunction toTransactionId(sessionId: string): string {\n const stripped = sessionId.replace(/^cs_(live|test)_/, '');\n if (stripped.length > GOOGLE_ADS_TRANSACTION_ID_MAX) {\n console.warn(\n `transaction_id still exceeds ${GOOGLE_ADS_TRANSACTION_ID_MAX} chars after stripping ` +\n `the prefix — Stripe may have lengthened session ids again; truncating: ${sessionId}`\n );\n }\n return stripped.slice(0, GOOGLE_ADS_TRANSACTION_ID_MAX);\n}\n\nexport function getPurchaseProperties(session: CheckoutSession): PurchaseProperties {\n let value: number;\n let currency: string;\n if (!session.amount_total || !session.currency) {\n value = session.line_items?.reduce((acc, item) => acc + item.amount_total, 0) ?? 0;\n currency = session.line_items?.[0]?.currency ?? 'usd';\n } else {\n value = session.amount_total;\n currency = session.currency;\n }\n\n return {\n transaction_id: toTransactionId(session.id),\n value: price(value, currency),\n currency: currency.toUpperCase(),\n coupon: session.coupon,\n items: session.line_items?.map((item, index) => ({\n index,\n item_id: item.id,\n item_name: item.description ?? '',\n price: price(item.amount_total, item.currency),\n quantity: item.quantity ?? 1,\n discount: price(item.amount_discount, item.currency),\n })),\n };\n}\n\nexport function getBeginCheckoutProperties(p: ProductPrice): BeginCheckoutProperties {\n return {\n currency: p.currency.toUpperCase(),\n value: price(p.unit_amount, p.currency),\n items: [\n {\n item_id: p.product.id,\n item_name: p.product.name,\n price: price(p.unit_amount, p.currency),\n },\n ],\n };\n}\n"],"mappings":";;AAGA,SAAgB,QACd,wBACkC;CAClC,IAAI,CAAC,wBAAwB,OAAO;CACpC,wBAAO,IAAI,KAAK,yBAAyB,GAAI,EAAA,CAAE,YAAY;AAC7D;AAaA,SAAgB,SAAS,OAA4B;CACnD,OAAO;EACL,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,gBAAgB,MAAM;EACtB,UAAU,MAAM;EAChB,aAAa,MAAM;EACnB,qBAAqB,MAAM,qBAAqB,SAAS,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AAQ,oBAAoB,EAAE;CACzD,IAAI,SAAS,SAAS,+BACpB,QAAQ,KACN,gCAAgC,8BAA8B,gGACc,WAC9E;CAEF,OAAO,SAAS,MAAM,GAAG,6BAA6B;AACxD;AAEA,SAAgB,sBAAsB,SAA8C;CAClF,IAAI;CACJ,IAAI;CACJ,IAAI,CAAC,QAAQ,gBAAgB,CAAC,QAAQ,UAAU;EAC9C,QAAQ,QAAQ,YAAY,QAAQ,KAAK,SAAS,MAAM,KAAK,cAAc,CAAC,KAAK;EACjF,WAAW,QAAQ,aAAa,EAAE,EAAE,YAAY;CAClD,OAAO;EACL,QAAQ,QAAQ;EAChB,WAAW,QAAQ;CACrB;CAEA,OAAO;EACL,gBAAgB,gBAAgB,QAAQ,EAAE;EAC1C,OAAO,MAAM,OAAO,QAAQ;EAC5B,UAAU,SAAS,YAAY;EAC/B,QAAQ,QAAQ;EAChB,OAAO,QAAQ,YAAY,KAAK,MAAM,WAAW;GAC/C;GACA,SAAS,KAAK;GACd,WAAW,KAAK,eAAe;GAC/B,OAAO,MAAM,KAAK,cAAc,KAAK,QAAQ;GAC7C,UAAU,KAAK,YAAY;GAC3B,UAAU,MAAM,KAAK,iBAAiB,KAAK,QAAQ;EACrD,EAAE;CACJ;AACF;AAEA,SAAgB,2BAA2B,GAA0C;CACnF,OAAO;EACL,UAAU,EAAE,SAAS,YAAY;EACjC,OAAO,MAAM,EAAE,aAAa,EAAE,QAAQ;EACtC,OAAO,CACL;GACE,SAAS,EAAE,QAAQ;GACnB,WAAW,EAAE,QAAQ;GACrB,OAAO,MAAM,EAAE,aAAa,EAAE,QAAQ;EACxC,CACF;CACF;AACF"}
1
+ {"version":3,"file":"mapper.cjs","names":["CANCELLATION_FEEDBACKS"],"sources":["../../src/stripe/mapper.ts"],"sourcesContent":["import type { Stripe } from 'stripe';\nimport {\n CANCELLATION_FEEDBACKS,\n type CancellationDetails,\n type CancellationFeedback,\n type SubscriptionStatus,\n} from '../subscription/index';\n\nexport function mapTime<T extends number | null>(\n stripeTimestampSeconds: T\n): T extends number ? string : null {\n if (!stripeTimestampSeconds) return null as T extends number ? string : null;\n return new Date(stripeTimestampSeconds * 1000).toISOString() as T extends number ? string : null;\n}\n\nexport type Price = {\n id: string;\n type: Stripe.Price.Type;\n active: boolean;\n billing_scheme: Stripe.Price.BillingScheme;\n currency: Stripe.Price['currency'];\n unit_amount: number | null;\n unit_amount_decimal: string | null;\n recurring: Stripe.Price.Recurring | null;\n};\n\nexport function mapPrice(price: Stripe.Price): Price {\n return {\n id: price.id,\n type: price.type,\n active: price.active,\n billing_scheme: price.billing_scheme,\n currency: price.currency,\n unit_amount: price.unit_amount,\n unit_amount_decimal: price.unit_amount_decimal?.toString() ?? null,\n recurring: price.recurring,\n };\n}\n\nexport interface LineItem {\n id: string;\n currency: string;\n quantity: number | null;\n description: string | null;\n amount_tax: number;\n amount_total: number;\n amount_subtotal: number;\n amount_discount: number;\n price: Price | null;\n}\n\nexport function mapLineItem(item: Stripe.LineItem): LineItem {\n return {\n id: item.price\n ? typeof item.price.product === 'string'\n ? item.price.product\n : item.price.product.id\n : item.id,\n currency: item.currency,\n quantity: item.quantity,\n description: item.description,\n amount_tax: item.amount_tax,\n amount_total: item.amount_total,\n amount_subtotal: item.amount_subtotal,\n amount_discount: item.amount_discount,\n price: item.price ? mapPrice(item.price) : null,\n };\n}\n\n// Re-exported under our own name so consumers need not reach into stripe's namespace.\n// Open-ended since stripe 22.4: a status the API adds later is not a type error.\nexport type PaymentStatus = Stripe.Checkout.Session.PaymentStatus;\n\n// Declared rather than inferred from mapCheckoutSession: an inferred shape is\n// structural, so a consumer's declaration emit has to spell out payment_status\n// through stripe's internal module path — TS2883 in any package that reaches\n// stripe transitively instead of depending on it (see line_items/price too).\nexport interface CheckoutSession {\n id: string;\n url: string | null;\n coupon: string | undefined;\n livemode: boolean;\n expires_at: number;\n payment_status: PaymentStatus;\n currency: string | null;\n amount_total: number | null;\n line_items: LineItem[] | undefined;\n}\n\nexport function mapCheckoutSession(session: Stripe.Checkout.Session): CheckoutSession {\n let coupon: string | undefined = undefined;\n if (Array.isArray(session.discounts) && session.discounts.length !== 0) {\n const discount = session.discounts[0];\n if (discount.coupon && typeof discount.coupon === 'object') {\n coupon = discount.coupon.id;\n } else if (typeof discount.coupon === 'string') {\n coupon = discount.coupon;\n } else {\n coupon = undefined;\n }\n }\n\n return {\n id: session.id,\n url: session.url,\n coupon,\n livemode: session.livemode,\n expires_at: session.expires_at,\n payment_status: session.payment_status,\n currency: session.currency,\n amount_total: session.amount_total,\n line_items: session.line_items?.data.map(mapLineItem),\n };\n}\n\nexport function mapInvoice(i: Stripe.Invoice) {\n return {\n id: i.id,\n number: i.number,\n total: i.total,\n subtotal: i.subtotal,\n amount_due: i.amount_due,\n amount_paid: i.amount_paid,\n amount_remaining: i.amount_remaining,\n currency: i.currency,\n billing_reason: i.billing_reason,\n hosted_invoice_url: i.hosted_invoice_url,\n invoice_pdf: i.invoice_pdf,\n receipt_number: i.receipt_number,\n status: i.status,\n created: i.created,\n period_start: i.period_start,\n period_end: i.period_end,\n };\n}\n\nexport function mapPaymentIntent(intent: Stripe.PaymentIntent) {\n return {\n id: intent.id,\n amount: intent.amount,\n amount_capturable: intent.amount_capturable,\n amount_received: intent.amount_received,\n currency: intent.currency,\n client_secret: intent.client_secret,\n description: intent.description,\n status: intent.status,\n created: intent.created,\n };\n}\n\nexport function mapCharge(charge: Stripe.Charge) {\n return {\n id: charge.id,\n description: charge.description,\n currency: charge.currency,\n amount: charge.amount,\n amount_captured: charge.amount_captured,\n amount_refunded: charge.amount_refunded,\n receipt_email: charge.receipt_email,\n receipt_number: charge.receipt_number,\n receipt_url: charge.receipt_url,\n status: charge.status,\n created: charge.created,\n payment_intent:\n charge.payment_intent && typeof charge.payment_intent === 'object'\n ? mapPaymentIntent(charge.payment_intent)\n : undefined,\n };\n}\n\nexport type ProductPrice = {\n id: string;\n type: Stripe.Price.Type;\n unit_amount: number;\n currency: Stripe.Price['currency'];\n product: {\n id: Stripe.Product['id'];\n name: Stripe.Product['name'];\n description: Stripe.Product['description'];\n livemode: Stripe.Product['livemode'];\n };\n};\n\nexport function mapSubscriptionStatus(status: Stripe.Subscription.Status): SubscriptionStatus {\n switch (status) {\n case 'active':\n return 'ACTIVE';\n case 'canceled':\n return 'CANCELED';\n case 'incomplete':\n return 'INCOMPLETE';\n case 'incomplete_expired':\n return 'INCOMPLETE_EXPIRED';\n case 'past_due':\n return 'PAST_DUE';\n case 'paused':\n return 'PAUSED';\n case 'trialing':\n return 'TRIALING';\n case 'unpaid':\n return 'UNPAID';\n default: {\n console.error(`Invalid stripe status: ${String(status)}`);\n throw new Error(`Invalid stripe status: ${String(status)}`);\n }\n }\n}\n\nexport const ZERO_DECIMAL_CURRENCIES = [\n 'BIF',\n 'CLP',\n 'DJF',\n 'GNF',\n 'JPY',\n 'KMF',\n 'KRW',\n 'MGA',\n 'PYG',\n 'RWF',\n 'UGX',\n 'VND',\n 'VUV',\n 'XAF',\n 'XOF',\n 'XPF',\n];\n\nexport function minorUnits(currency: string) {\n return ZERO_DECIMAL_CURRENCIES.includes(currency.toUpperCase()) ? 1 : 100;\n}\n\nexport function price(value: number, currency: string) {\n return value / minorUnits(currency);\n}\n\nexport interface Item {\n item_id: string;\n item_name: string;\n affiliation?: 'Google Store' | (string & {});\n coupon?: string;\n discount?: number;\n index?: number;\n item_brand?: string;\n item_category?: string;\n item_category2?: string;\n item_category3?: string;\n item_category4?: string;\n item_category5?: string;\n item_list_id?: string;\n item_list_name?: string;\n item_variant?: string;\n location_id?: string;\n price?: number;\n quantity?: number;\n}\n\nexport interface PurchaseProperties {\n currency: string;\n value: number;\n transaction_id: string;\n coupon?: string;\n shipping?: number;\n tax?: number;\n items?: Item[];\n}\n\nexport interface BeginCheckoutProperties {\n currency: string;\n value: number;\n coupon?: string;\n items: Item[];\n}\n\n// Google Ads rejects conversion transaction IDs longer than 64 characters.\n// https://support.google.com/google-ads/answer/6386790\nconst GOOGLE_ADS_TRANSACTION_ID_MAX = 64;\n\n/**\n * GA4 purchase events feed Google Ads conversions, whose transaction IDs are\n * capped at 64 characters — but Stripe checkout session ids exceed that:\n * around 2021 they grew from ~32 chars (`cs_live_` + 24 random chars) to ~66\n * (`cs_live_a` + 57), with no announcement. Stripe treats id length/format as\n * opaque and backwards-compatible, guaranteeing only that ids never exceed\n * 255 chars, so they may grow again at any time.\n *\n * Dropping the fixed `cs_live_`/`cs_test_` prefix brings the id under 64\n * while staying reversible: prepend the prefix (livemode tells which) to\n * reconstruct the full session id for Stripe dashboard lookups. The payment\n * intent id (~27 chars) is not a substitute — it only exists on\n * `mode: 'payment'` sessions (subscription-mode sessions carry it on the\n * invoice instead), and its short length is just as unguaranteed as the\n * session id's was.\n *\n * Must stay deterministic: GA4/Google Ads dedupe purchases by\n * transaction_id, and the same session may be tracked from multiple paths.\n */\nfunction toTransactionId(sessionId: string): string {\n const stripped = sessionId.replace(/^cs_(live|test)_/, '');\n if (stripped.length > GOOGLE_ADS_TRANSACTION_ID_MAX) {\n console.warn(\n `transaction_id still exceeds ${GOOGLE_ADS_TRANSACTION_ID_MAX} chars after stripping ` +\n `the prefix — Stripe may have lengthened session ids again; truncating: ${sessionId}`\n );\n }\n return stripped.slice(0, GOOGLE_ADS_TRANSACTION_ID_MAX);\n}\n\nexport function getPurchaseProperties(session: CheckoutSession): PurchaseProperties {\n let value: number;\n let currency: string;\n if (!session.amount_total || !session.currency) {\n value = session.line_items?.reduce((acc, item) => acc + item.amount_total, 0) ?? 0;\n currency = session.line_items?.[0]?.currency ?? 'usd';\n } else {\n value = session.amount_total;\n currency = session.currency;\n }\n\n return {\n transaction_id: toTransactionId(session.id),\n value: price(value, currency),\n currency: currency.toUpperCase(),\n coupon: session.coupon,\n items: session.line_items?.map((item, index) => ({\n index,\n item_id: item.id,\n item_name: item.description ?? '',\n price: price(item.amount_total, item.currency),\n quantity: item.quantity ?? 1,\n discount: price(item.amount_discount, item.currency),\n })),\n };\n}\n\nexport function getBeginCheckoutProperties(p: ProductPrice): BeginCheckoutProperties {\n return {\n currency: p.currency.toUpperCase(),\n value: price(p.unit_amount, p.currency),\n items: [\n {\n item_id: p.product.id,\n item_name: p.product.name,\n price: price(p.unit_amount, p.currency),\n },\n ],\n };\n}\n\n/**\n * Stripe's `cancellation_details` in the shared shape. The object is present on every\n * subscription with all three fields null, so an active one maps to null rather than an empty\n * record. `reason` says who acted: `cancellation_requested` is the customer (or us on their\n * behalf), the payment reasons are Stripe ending it.\n */\nexport function mapCancellationDetails(\n subscription: Pick<Stripe.Subscription, 'cancellation_details'>\n): CancellationDetails | null {\n const details = subscription.cancellation_details;\n if (!details || (!details.reason && !details.feedback && !details.comment)) return null;\n return {\n initiator:\n details.reason === 'payment_failed' || details.reason === 'payment_disputed'\n ? 'system'\n : 'user',\n reason: details.reason ?? null,\n // Stripe's feedback vocabulary is ours; anything it adds later is reported as \"other\".\n feedback: details.feedback\n ? (CANCELLATION_FEEDBACKS as readonly string[]).includes(details.feedback)\n ? (details.feedback as CancellationFeedback)\n : 'other'\n : null,\n comment: details.comment ?? null,\n };\n}\n"],"mappings":";;;AAQA,SAAgB,QACd,wBACkC;CAClC,IAAI,CAAC,wBAAwB,OAAO;CACpC,wBAAO,IAAI,KAAK,yBAAyB,GAAI,EAAA,CAAE,YAAY;AAC7D;AAaA,SAAgB,SAAS,OAA4B;CACnD,OAAO;EACL,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,gBAAgB,MAAM;EACtB,UAAU,MAAM;EAChB,aAAa,MAAM;EACnB,qBAAqB,MAAM,qBAAqB,SAAS,KAAK;EAC9D,WAAW,MAAM;CACnB;AACF;AAcA,SAAgB,YAAY,MAAiC;CAC3D,OAAO;EACL,IAAI,KAAK,QACL,OAAO,KAAK,MAAM,YAAY,WAC5B,KAAK,MAAM,UACX,KAAK,MAAM,QAAQ,KACrB,KAAK;EACT,UAAU,KAAK;EACf,UAAU,KAAK;EACf,aAAa,KAAK;EAClB,YAAY,KAAK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