@shware/purchase 1.8.9 → 1.9.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 (128) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/dist/app-store/config.cjs +98 -128
  3. package/dist/app-store/config.cjs.map +1 -1
  4. package/dist/app-store/config.d.cts +31 -31
  5. package/dist/app-store/config.d.cts.map +1 -0
  6. package/dist/app-store/config.d.mts +39 -0
  7. package/dist/app-store/config.d.mts.map +1 -0
  8. package/dist/app-store/config.mjs +93 -91
  9. package/dist/app-store/config.mjs.map +1 -1
  10. package/dist/app-store/index.cjs +3 -31
  11. package/dist/app-store/index.d.cts +2 -3
  12. package/dist/app-store/index.d.mts +2 -0
  13. package/dist/app-store/index.mjs +1 -5
  14. package/dist/google-play/config.cjs +100 -123
  15. package/dist/google-play/config.cjs.map +1 -1
  16. package/dist/google-play/config.d.cts +31 -31
  17. package/dist/google-play/config.d.cts.map +1 -0
  18. package/dist/google-play/config.d.mts +39 -0
  19. package/dist/google-play/config.d.mts.map +1 -0
  20. package/dist/google-play/config.mjs +95 -86
  21. package/dist/google-play/config.mjs.map +1 -1
  22. package/dist/google-play/index.cjs +9 -42
  23. package/dist/google-play/index.d.cts +3 -4
  24. package/dist/google-play/index.d.mts +3 -0
  25. package/dist/google-play/index.mjs +2 -17
  26. package/dist/google-play/real-time-developer-notification.cjs +122 -81
  27. package/dist/google-play/real-time-developer-notification.cjs.map +1 -1
  28. package/dist/google-play/real-time-developer-notification.d.cts +119 -117
  29. package/dist/google-play/real-time-developer-notification.d.cts.map +1 -0
  30. package/dist/google-play/real-time-developer-notification.d.mts +150 -0
  31. package/dist/google-play/real-time-developer-notification.d.mts.map +1 -0
  32. package/dist/google-play/real-time-developer-notification.mjs +118 -53
  33. package/dist/google-play/real-time-developer-notification.mjs.map +1 -1
  34. package/dist/index.cjs +13 -48
  35. package/dist/index.d.cts +5 -6
  36. package/dist/index.d.mts +5 -0
  37. package/dist/index.mjs +2 -19
  38. package/dist/stripe/config.cjs +104 -133
  39. package/dist/stripe/config.cjs.map +1 -1
  40. package/dist/stripe/config.d.cts +35 -35
  41. package/dist/stripe/config.d.cts.map +1 -0
  42. package/dist/stripe/config.d.mts +43 -0
  43. package/dist/stripe/config.d.mts.map +1 -0
  44. package/dist/stripe/config.mjs +99 -96
  45. package/dist/stripe/config.mjs.map +1 -1
  46. package/dist/stripe/handler.cjs +25 -53
  47. package/dist/stripe/handler.cjs.map +1 -1
  48. package/dist/stripe/handler.d.cts +10 -9
  49. package/dist/stripe/handler.d.cts.map +1 -0
  50. package/dist/stripe/handler.d.mts +16 -0
  51. package/dist/stripe/handler.d.mts.map +1 -0
  52. package/dist/stripe/handler.mjs +25 -29
  53. package/dist/stripe/handler.mjs.map +1 -1
  54. package/dist/stripe/index.cjs +27 -74
  55. package/dist/stripe/index.d.cts +8 -12
  56. package/dist/stripe/index.d.mts +8 -0
  57. package/dist/stripe/index.mjs +5 -44
  58. package/dist/stripe/mapper.cjs +168 -219
  59. package/dist/stripe/mapper.cjs.map +1 -1
  60. package/dist/stripe/mapper.d.cts +115 -114
  61. package/dist/stripe/mapper.d.cts.map +1 -0
  62. package/dist/stripe/mapper.d.mts +158 -0
  63. package/dist/stripe/mapper.d.mts.map +1 -0
  64. package/dist/stripe/mapper.mjs +155 -182
  65. package/dist/stripe/mapper.mjs.map +1 -1
  66. package/dist/stripe/metadata.cjs +11 -35
  67. package/dist/stripe/metadata.cjs.map +1 -1
  68. package/dist/stripe/metadata.d.cts +9 -7
  69. package/dist/stripe/metadata.d.cts.map +1 -0
  70. package/dist/stripe/metadata.d.mts +12 -0
  71. package/dist/stripe/metadata.d.mts.map +1 -0
  72. package/dist/stripe/metadata.mjs +11 -11
  73. package/dist/stripe/metadata.mjs.map +1 -1
  74. package/dist/stripe/pending-checkout.cjs +55 -61
  75. package/dist/stripe/pending-checkout.cjs.map +1 -1
  76. package/dist/stripe/pending-checkout.d.cts +3 -1
  77. package/dist/stripe/pending-checkout.d.cts.map +1 -0
  78. package/dist/stripe/{pending-checkout.d.ts → pending-checkout.d.mts} +3 -1
  79. package/dist/stripe/pending-checkout.d.mts.map +1 -0
  80. package/dist/stripe/pending-checkout.mjs +52 -34
  81. package/dist/stripe/pending-checkout.mjs.map +1 -1
  82. package/dist/stripe/schema.cjs +30 -55
  83. package/dist/stripe/schema.cjs.map +1 -1
  84. package/dist/stripe/schema.d.cts +36 -37
  85. package/dist/stripe/schema.d.cts.map +1 -0
  86. package/dist/stripe/schema.d.mts +40 -0
  87. package/dist/stripe/schema.d.mts.map +1 -0
  88. package/dist/stripe/schema.mjs +28 -40
  89. package/dist/stripe/schema.mjs.map +1 -1
  90. package/dist/subscription/index.cjs +178 -80
  91. package/dist/subscription/index.cjs.map +1 -1
  92. package/dist/subscription/index.d.cts +136 -134
  93. package/dist/subscription/index.d.cts.map +1 -0
  94. package/dist/subscription/index.d.mts +150 -0
  95. package/dist/subscription/index.d.mts.map +1 -0
  96. package/dist/subscription/index.mjs +173 -51
  97. package/dist/subscription/index.mjs.map +1 -1
  98. package/dist/types.cjs +0 -19
  99. package/dist/types.d.cts +7 -6
  100. package/dist/types.d.cts.map +1 -0
  101. package/dist/types.d.mts +10 -0
  102. package/dist/types.d.mts.map +1 -0
  103. package/dist/types.mjs +1 -1
  104. package/package.json +40 -25
  105. package/dist/app-store/config.d.ts +0 -39
  106. package/dist/app-store/index.cjs.map +0 -1
  107. package/dist/app-store/index.d.ts +0 -3
  108. package/dist/app-store/index.mjs.map +0 -1
  109. package/dist/google-play/config.d.ts +0 -39
  110. package/dist/google-play/index.cjs.map +0 -1
  111. package/dist/google-play/index.d.ts +0 -4
  112. package/dist/google-play/index.mjs.map +0 -1
  113. package/dist/google-play/real-time-developer-notification.d.ts +0 -148
  114. package/dist/index.cjs.map +0 -1
  115. package/dist/index.d.ts +0 -6
  116. package/dist/index.mjs.map +0 -1
  117. package/dist/stripe/config.d.ts +0 -43
  118. package/dist/stripe/handler.d.ts +0 -15
  119. package/dist/stripe/index.cjs.map +0 -1
  120. package/dist/stripe/index.d.ts +0 -12
  121. package/dist/stripe/index.mjs.map +0 -1
  122. package/dist/stripe/mapper.d.ts +0 -157
  123. package/dist/stripe/metadata.d.ts +0 -10
  124. package/dist/stripe/schema.d.ts +0 -41
  125. package/dist/subscription/index.d.ts +0 -148
  126. package/dist/types.cjs.map +0 -1
  127. package/dist/types.d.ts +0 -9
  128. package/dist/types.mjs.map +0 -1
@@ -1,92 +1,101 @@
1
- // src/google-play/config.ts
2
1
  import { invariant } from "@shware/utils";
3
2
  import ms from "ms";
4
- var addMethod = /* @__PURE__ */ Symbol("addMethod");
3
+ //#region src/google-play/config.ts
4
+ const addMethod = Symbol("addMethod");
5
5
  var Subscription = class {
6
- productId;
7
- config;
8
- plans;
9
- defaultPlans;
10
- constructor(config, productId) {
11
- this.config = config;
12
- this.productId = productId;
13
- this.plans = /* @__PURE__ */ new Map();
14
- this.defaultPlans = /* @__PURE__ */ new Set();
15
- }
16
- basePlan = (planId, plan, metadata = { credits: 0, expiresIn: "0" }) => {
17
- this.plans.set(planId, { ...metadata, plan });
18
- return this;
19
- };
20
- default = (planIds) => {
21
- planIds.forEach((planId) => this.defaultPlans.add(planId));
22
- this.config[addMethod](this);
23
- return this.config;
24
- };
6
+ productId;
7
+ config;
8
+ plans;
9
+ defaultPlans;
10
+ constructor(config, productId) {
11
+ this.config = config;
12
+ this.productId = productId;
13
+ this.plans = /* @__PURE__ */ new Map();
14
+ this.defaultPlans = /* @__PURE__ */ new Set();
15
+ }
16
+ basePlan = (planId, plan, metadata = {
17
+ credits: 0,
18
+ expiresIn: "0"
19
+ }) => {
20
+ this.plans.set(planId, {
21
+ ...metadata,
22
+ plan
23
+ });
24
+ return this;
25
+ };
26
+ default = (planIds) => {
27
+ planIds.forEach((planId) => this.defaultPlans.add(planId));
28
+ this.config[addMethod](this);
29
+ return this.config;
30
+ };
25
31
  };
26
- var GooglePlayConfig = class _GooglePlayConfig {
27
- package;
28
- audience;
29
- onetimes;
30
- subscriptions;
31
- products;
32
- [addMethod] = (subscription) => {
33
- subscription.plans.forEach((metadata, planId) => {
34
- this.products.set(this.getId(subscription.productId, planId), metadata);
35
- });
36
- this.subscriptions.set(subscription.productId, subscription);
37
- return this;
38
- };
39
- getId = (productId, planId) => {
40
- return planId ? `${productId}:${planId}` : productId;
41
- };
42
- constructor(options) {
43
- this.package = options.package;
44
- this.audience = options.audience;
45
- this.products = /* @__PURE__ */ new Map();
46
- this.onetimes = /* @__PURE__ */ new Set();
47
- this.subscriptions = /* @__PURE__ */ new Map();
48
- }
49
- static create = (options) => {
50
- return new _GooglePlayConfig(options);
51
- };
52
- subscription = (productId) => {
53
- return new Subscription(this, productId);
54
- };
55
- onetime = (productId, metadata = { credits: 0, expiresIn: "0" }) => {
56
- this.onetimes.add(productId);
57
- this.products.set(productId, metadata);
58
- return this;
59
- };
60
- getPlan = (productId, planId) => {
61
- const id = this.getId(productId, planId);
62
- const metadata = this.products.get(id);
63
- invariant(metadata, `Product not found for ${id}`);
64
- invariant(metadata.plan, `Plan not found for ${id}`);
65
- return metadata.plan;
66
- };
67
- getMode = (productId) => {
68
- if (this.onetimes.has(productId)) return "payment";
69
- if (this.subscriptions.has(productId)) return "subscription";
70
- throw new Error(`Mode not found for product ${productId}`);
71
- };
72
- getCreditAmount = (productId, planId) => {
73
- const id = this.getId(productId, planId);
74
- const metadata = this.products.get(id);
75
- invariant(metadata, `Product not found for ${id}`);
76
- return metadata.credits;
77
- };
78
- getCreditExpiresIn = (productId, planId) => {
79
- const id = this.getId(productId, planId);
80
- const metadata = this.products.get(id);
81
- invariant(metadata, `Product not found for ${id}`);
82
- return ms(metadata.expiresIn);
83
- };
84
- getCreditExpiresAt = (productId, planId) => {
85
- const expiresIn = this.getCreditExpiresIn(productId, planId);
86
- return new Date(Date.now() + expiresIn).toISOString();
87
- };
88
- };
89
- export {
90
- GooglePlayConfig
32
+ var GooglePlayConfig = class GooglePlayConfig {
33
+ package;
34
+ audience;
35
+ onetimes;
36
+ subscriptions;
37
+ products;
38
+ [addMethod] = (subscription) => {
39
+ subscription.plans.forEach((metadata, planId) => {
40
+ this.products.set(this.getId(subscription.productId, planId), metadata);
41
+ });
42
+ this.subscriptions.set(subscription.productId, subscription);
43
+ return this;
44
+ };
45
+ getId = (productId, planId) => {
46
+ return planId ? `${productId}:${planId}` : productId;
47
+ };
48
+ constructor(options) {
49
+ this.package = options.package;
50
+ this.audience = options.audience;
51
+ this.products = /* @__PURE__ */ new Map();
52
+ this.onetimes = /* @__PURE__ */ new Set();
53
+ this.subscriptions = /* @__PURE__ */ new Map();
54
+ }
55
+ static create = (options) => {
56
+ return new GooglePlayConfig(options);
57
+ };
58
+ subscription = (productId) => {
59
+ return new Subscription(this, productId);
60
+ };
61
+ onetime = (productId, metadata = {
62
+ credits: 0,
63
+ expiresIn: "0"
64
+ }) => {
65
+ this.onetimes.add(productId);
66
+ this.products.set(productId, metadata);
67
+ return this;
68
+ };
69
+ getPlan = (productId, planId) => {
70
+ const id = this.getId(productId, planId);
71
+ const metadata = this.products.get(id);
72
+ invariant(metadata, `Product not found for ${id}`);
73
+ invariant(metadata.plan, `Plan not found for ${id}`);
74
+ return metadata.plan;
75
+ };
76
+ getMode = (productId) => {
77
+ if (this.onetimes.has(productId)) return "payment";
78
+ if (this.subscriptions.has(productId)) return "subscription";
79
+ throw new Error(`Mode not found for product ${productId}`);
80
+ };
81
+ getCreditAmount = (productId, planId) => {
82
+ const id = this.getId(productId, planId);
83
+ const metadata = this.products.get(id);
84
+ invariant(metadata, `Product not found for ${id}`);
85
+ return metadata.credits;
86
+ };
87
+ getCreditExpiresIn = (productId, planId) => {
88
+ const id = this.getId(productId, planId);
89
+ const metadata = this.products.get(id);
90
+ invariant(metadata, `Product not found for ${id}`);
91
+ return ms(metadata.expiresIn);
92
+ };
93
+ getCreditExpiresAt = (productId, planId) => {
94
+ const expiresIn = this.getCreditExpiresIn(productId, planId);
95
+ return new Date(Date.now() + expiresIn).toISOString();
96
+ };
91
97
  };
98
+ //#endregion
99
+ export { GooglePlayConfig };
100
+
92
101
  //# sourceMappingURL=config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/google-play/config.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport ms from 'ms';\nimport type { IsUnique, Metadata } from '../types';\n\nconst addMethod = Symbol('addMethod');\n\nclass Subscription<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n I extends Lowercase<string> = never,\n> {\n readonly productId: string;\n readonly config: GooglePlayConfig<NS, PE, PI>;\n readonly plans: Map<string, Metadata & { plan?: PE }>;\n readonly defaultPlans: Set<string>;\n\n constructor(config: GooglePlayConfig<NS, PE, PI>, productId: string) {\n this.config = config;\n this.productId = productId;\n this.plans = new Map();\n this.defaultPlans = new Set();\n }\n\n basePlan = <K extends Lowercase<string>>(\n planId: K extends I ? never : K,\n plan: PE,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ): Subscription<NS, PE, PI, I | K> => {\n this.plans.set(planId, { ...metadata, plan });\n return this;\n };\n\n default = <const T extends readonly [I, ...I[]]>(\n planIds: T & (IsUnique<T> extends true ? unknown : never)\n ) => {\n planIds.forEach((planId) => this.defaultPlans.add(planId));\n this.config[addMethod](this);\n return this.config;\n };\n}\n\ntype Options = { package: string; audience: string };\n\nexport class GooglePlayConfig<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n> {\n readonly package: string;\n readonly audience: string;\n private onetimes: Set<string>;\n private subscriptions: Map<string, Subscription<NS, PE, PI>>;\n private products: Map<string, (Metadata & { plan?: PE }) | null>;\n\n [addMethod] = (subscription: Subscription<NS, PE, PI>) => {\n subscription.plans.forEach((metadata, planId) => {\n this.products.set(this.getId(subscription.productId, planId), metadata);\n });\n this.subscriptions.set(subscription.productId, subscription);\n return this;\n };\n\n private getId = (productId: string, planId?: string) => {\n return planId ? `${productId}:${planId}` : productId;\n };\n\n private constructor(options: Options) {\n this.package = options.package;\n this.audience = options.audience;\n this.products = new Map();\n this.onetimes = new Set();\n this.subscriptions = new Map();\n }\n\n static create = <NS extends Lowercase<string>, PE extends string = string>(options: Options) => {\n return new GooglePlayConfig<NS, PE>(options);\n };\n\n subscription = <K extends `${NS}.${Lowercase<string>}`>(productId: K extends PI ? never : K) => {\n return new Subscription<NS, PE, PI | K>(this, productId);\n };\n\n onetime = <K extends `${NS}.${Lowercase<string>}`>(\n productId: K extends PI ? never : K,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ) => {\n this.onetimes.add(productId);\n this.products.set(productId, metadata);\n return this as GooglePlayConfig<NS, PE, PI | K>;\n };\n\n getPlan = (productId: string, planId: string): PE => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n invariant(metadata.plan, `Plan not found for ${id}`);\n return metadata.plan;\n };\n\n getMode = (productId: string): 'payment' | 'subscription' => {\n if (this.onetimes.has(productId)) return 'payment';\n if (this.subscriptions.has(productId)) return 'subscription';\n throw new Error(`Mode not found for product ${productId}`);\n };\n\n getCreditAmount = (productId: string, planId?: string): number => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n return metadata.credits;\n };\n\n private getCreditExpiresIn = (productId: string, planId?: string): number => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n return ms(metadata.expiresIn);\n };\n\n getCreditExpiresAt = (productId: string, planId?: string): string => {\n const expiresIn = this.getCreditExpiresIn(productId, planId);\n return new Date(Date.now() + expiresIn).toISOString();\n };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,OAAO,QAAQ;AAGf,IAAM,YAAY,uBAAO,WAAW;AAEpC,IAAM,eAAN,MAKE;AAAA,EACS;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAsC,WAAmB;AACnE,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,SAAK,QAAQ,oBAAI,IAAI;AACrB,SAAK,eAAe,oBAAI,IAAI;AAAA,EAC9B;AAAA,EAEA,WAAW,CACT,QACA,MACA,WAAqB,EAAE,SAAS,GAAG,WAAW,IAAI,MACd;AACpC,SAAK,MAAM,IAAI,QAAQ,EAAE,GAAG,UAAU,KAAK,CAAC;AAC5C,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,CACR,YACG;AACH,YAAQ,QAAQ,CAAC,WAAW,KAAK,aAAa,IAAI,MAAM,CAAC;AACzD,SAAK,OAAO,SAAS,EAAE,IAAI;AAC3B,WAAO,KAAK;AAAA,EACd;AACF;AAIO,IAAM,mBAAN,MAAM,kBAIX;AAAA,EACS;AAAA,EACA;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EAER,CAAC,SAAS,IAAI,CAAC,iBAA2C;AACxD,iBAAa,MAAM,QAAQ,CAAC,UAAU,WAAW;AAC/C,WAAK,SAAS,IAAI,KAAK,MAAM,aAAa,WAAW,MAAM,GAAG,QAAQ;AAAA,IACxE,CAAC;AACD,SAAK,cAAc,IAAI,aAAa,WAAW,YAAY;AAC3D,WAAO;AAAA,EACT;AAAA,EAEQ,QAAQ,CAAC,WAAmB,WAAoB;AACtD,WAAO,SAAS,GAAG,SAAS,IAAI,MAAM,KAAK;AAAA,EAC7C;AAAA,EAEQ,YAAY,SAAkB;AACpC,SAAK,UAAU,QAAQ;AACvB,SAAK,WAAW,QAAQ;AACxB,SAAK,WAAW,oBAAI,IAAI;AACxB,SAAK,WAAW,oBAAI,IAAI;AACxB,SAAK,gBAAgB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EAEA,OAAO,SAAS,CAA2D,YAAqB;AAC9F,WAAO,IAAI,kBAAyB,OAAO;AAAA,EAC7C;AAAA,EAEA,eAAe,CAAyC,cAAwC;AAC9F,WAAO,IAAI,aAA6B,MAAM,SAAS;AAAA,EACzD;AAAA,EAEA,UAAU,CACR,WACA,WAAqB,EAAE,SAAS,GAAG,WAAW,IAAI,MAC/C;AACH,SAAK,SAAS,IAAI,SAAS;AAC3B,SAAK,SAAS,IAAI,WAAW,QAAQ;AACrC,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,CAAC,WAAmB,WAAuB;AACnD,UAAM,KAAK,KAAK,MAAM,WAAW,MAAM;AACvC,UAAM,WAAW,KAAK,SAAS,IAAI,EAAE;AACrC,cAAU,UAAU,yBAAyB,EAAE,EAAE;AACjD,cAAU,SAAS,MAAM,sBAAsB,EAAE,EAAE;AACnD,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,UAAU,CAAC,cAAkD;AAC3D,QAAI,KAAK,SAAS,IAAI,SAAS,EAAG,QAAO;AACzC,QAAI,KAAK,cAAc,IAAI,SAAS,EAAG,QAAO;AAC9C,UAAM,IAAI,MAAM,8BAA8B,SAAS,EAAE;AAAA,EAC3D;AAAA,EAEA,kBAAkB,CAAC,WAAmB,WAA4B;AAChE,UAAM,KAAK,KAAK,MAAM,WAAW,MAAM;AACvC,UAAM,WAAW,KAAK,SAAS,IAAI,EAAE;AACrC,cAAU,UAAU,yBAAyB,EAAE,EAAE;AACjD,WAAO,SAAS;AAAA,EAClB;AAAA,EAEQ,qBAAqB,CAAC,WAAmB,WAA4B;AAC3E,UAAM,KAAK,KAAK,MAAM,WAAW,MAAM;AACvC,UAAM,WAAW,KAAK,SAAS,IAAI,EAAE;AACrC,cAAU,UAAU,yBAAyB,EAAE,EAAE;AACjD,WAAO,GAAG,SAAS,SAAS;AAAA,EAC9B;AAAA,EAEA,qBAAqB,CAAC,WAAmB,WAA4B;AACnE,UAAM,YAAY,KAAK,mBAAmB,WAAW,MAAM;AAC3D,WAAO,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,EAAE,YAAY;AAAA,EACtD;AACF;","names":[]}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../src/google-play/config.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport ms from 'ms';\nimport type { IsUnique, Metadata } from '../types';\n\nconst addMethod = Symbol('addMethod');\n\nclass Subscription<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n I extends Lowercase<string> = never,\n> {\n readonly productId: string;\n readonly config: GooglePlayConfig<NS, PE, PI>;\n readonly plans: Map<string, Metadata & { plan?: PE }>;\n readonly defaultPlans: Set<string>;\n\n constructor(config: GooglePlayConfig<NS, PE, PI>, productId: string) {\n this.config = config;\n this.productId = productId;\n this.plans = new Map();\n this.defaultPlans = new Set();\n }\n\n basePlan = <K extends Lowercase<string>>(\n planId: K extends I ? never : K,\n plan: PE,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ): Subscription<NS, PE, PI, I | K> => {\n this.plans.set(planId, { ...metadata, plan });\n return this;\n };\n\n default = <const T extends readonly [I, ...I[]]>(\n planIds: T & (IsUnique<T> extends true ? unknown : never)\n ) => {\n planIds.forEach((planId) => this.defaultPlans.add(planId));\n this.config[addMethod](this);\n return this.config;\n };\n}\n\ntype Options = { package: string; audience: string };\n\nexport class GooglePlayConfig<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n> {\n readonly package: string;\n readonly audience: string;\n private onetimes: Set<string>;\n private subscriptions: Map<string, Subscription<NS, PE, PI>>;\n private products: Map<string, (Metadata & { plan?: PE }) | null>;\n\n [addMethod] = (subscription: Subscription<NS, PE, PI>) => {\n subscription.plans.forEach((metadata, planId) => {\n this.products.set(this.getId(subscription.productId, planId), metadata);\n });\n this.subscriptions.set(subscription.productId, subscription);\n return this;\n };\n\n private getId = (productId: string, planId?: string) => {\n return planId ? `${productId}:${planId}` : productId;\n };\n\n private constructor(options: Options) {\n this.package = options.package;\n this.audience = options.audience;\n this.products = new Map();\n this.onetimes = new Set();\n this.subscriptions = new Map();\n }\n\n static create = <NS extends Lowercase<string>, PE extends string = string>(options: Options) => {\n return new GooglePlayConfig<NS, PE>(options);\n };\n\n subscription = <K extends `${NS}.${Lowercase<string>}`>(productId: K extends PI ? never : K) => {\n return new Subscription<NS, PE, PI | K>(this, productId);\n };\n\n onetime = <K extends `${NS}.${Lowercase<string>}`>(\n productId: K extends PI ? never : K,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ) => {\n this.onetimes.add(productId);\n this.products.set(productId, metadata);\n return this as GooglePlayConfig<NS, PE, PI | K>;\n };\n\n getPlan = (productId: string, planId: string): PE => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n invariant(metadata.plan, `Plan not found for ${id}`);\n return metadata.plan;\n };\n\n getMode = (productId: string): 'payment' | 'subscription' => {\n if (this.onetimes.has(productId)) return 'payment';\n if (this.subscriptions.has(productId)) return 'subscription';\n throw new Error(`Mode not found for product ${productId}`);\n };\n\n getCreditAmount = (productId: string, planId?: string): number => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n return metadata.credits;\n };\n\n private getCreditExpiresIn = (productId: string, planId?: string): number => {\n const id = this.getId(productId, planId);\n const metadata = this.products.get(id);\n invariant(metadata, `Product not found for ${id}`);\n return ms(metadata.expiresIn);\n };\n\n getCreditExpiresAt = (productId: string, planId?: string): string => {\n const expiresIn = this.getCreditExpiresIn(productId, planId);\n return new Date(Date.now() + expiresIn).toISOString();\n };\n}\n"],"mappings":";;;AAIA,MAAM,YAAY,OAAO,WAAW;AAEpC,IAAM,eAAN,MAKE;CACA;CACA;CACA;CACA;CAEA,YAAY,QAAsC,WAAmB;EACnE,KAAK,SAAS;EACd,KAAK,YAAY;EACjB,KAAK,wBAAQ,IAAI,IAAI;EACrB,KAAK,+BAAe,IAAI,IAAI;CAC9B;CAEA,YACE,QACA,MACA,WAAqB;EAAE,SAAS;EAAG,WAAW;CAAI,MACd;EACpC,KAAK,MAAM,IAAI,QAAQ;GAAE,GAAG;GAAU;EAAK,CAAC;EAC5C,OAAO;CACT;CAEA,WACE,YACG;EACH,QAAQ,SAAS,WAAW,KAAK,aAAa,IAAI,MAAM,CAAC;EACzD,KAAK,OAAO,UAAU,CAAC,IAAI;EAC3B,OAAO,KAAK;CACd;AACF;AAIA,IAAa,mBAAb,MAAa,iBAIX;CACA;CACA;CACA;CACA;CACA;CAEA,CAAC,cAAc,iBAA2C;EACxD,aAAa,MAAM,SAAS,UAAU,WAAW;GAC/C,KAAK,SAAS,IAAI,KAAK,MAAM,aAAa,WAAW,MAAM,GAAG,QAAQ;EACxE,CAAC;EACD,KAAK,cAAc,IAAI,aAAa,WAAW,YAAY;EAC3D,OAAO;CACT;CAEA,SAAiB,WAAmB,WAAoB;EACtD,OAAO,SAAS,GAAG,UAAU,GAAG,WAAW;CAC7C;CAEA,YAAoB,SAAkB;EACpC,KAAK,UAAU,QAAQ;EACvB,KAAK,WAAW,QAAQ;EACxB,KAAK,2BAAW,IAAI,IAAI;EACxB,KAAK,2BAAW,IAAI,IAAI;EACxB,KAAK,gCAAgB,IAAI,IAAI;CAC/B;CAEA,OAAO,UAAoE,YAAqB;EAC9F,OAAO,IAAI,iBAAyB,OAAO;CAC7C;CAEA,gBAAwD,cAAwC;EAC9F,OAAO,IAAI,aAA6B,MAAM,SAAS;CACzD;CAEA,WACE,WACA,WAAqB;EAAE,SAAS;EAAG,WAAW;CAAI,MAC/C;EACH,KAAK,SAAS,IAAI,SAAS;EAC3B,KAAK,SAAS,IAAI,WAAW,QAAQ;EACrC,OAAO;CACT;CAEA,WAAW,WAAmB,WAAuB;EACnD,MAAM,KAAK,KAAK,MAAM,WAAW,MAAM;EACvC,MAAM,WAAW,KAAK,SAAS,IAAI,EAAE;EACrC,UAAU,UAAU,yBAAyB,IAAI;EACjD,UAAU,SAAS,MAAM,sBAAsB,IAAI;EACnD,OAAO,SAAS;CAClB;CAEA,WAAW,cAAkD;EAC3D,IAAI,KAAK,SAAS,IAAI,SAAS,GAAG,OAAO;EACzC,IAAI,KAAK,cAAc,IAAI,SAAS,GAAG,OAAO;EAC9C,MAAM,IAAI,MAAM,8BAA8B,WAAW;CAC3D;CAEA,mBAAmB,WAAmB,WAA4B;EAChE,MAAM,KAAK,KAAK,MAAM,WAAW,MAAM;EACvC,MAAM,WAAW,KAAK,SAAS,IAAI,EAAE;EACrC,UAAU,UAAU,yBAAyB,IAAI;EACjD,OAAO,SAAS;CAClB;CAEA,sBAA8B,WAAmB,WAA4B;EAC3E,MAAM,KAAK,KAAK,MAAM,WAAW,MAAM;EACvC,MAAM,WAAW,KAAK,SAAS,IAAI,EAAE;EACrC,UAAU,UAAU,yBAAyB,IAAI;EACjD,OAAO,GAAG,SAAS,SAAS;CAC9B;CAEA,sBAAsB,WAAmB,WAA4B;EACnE,MAAM,YAAY,KAAK,mBAAmB,WAAW,MAAM;EAC3D,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC,YAAY;CACtD;AACF"}
@@ -1,42 +1,9 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/google-play/index.ts
21
- var google_play_exports = {};
22
- __export(google_play_exports, {
23
- GooglePlayConfig: () => import_config.GooglePlayConfig,
24
- GooglePlaySubscriptionState: () => import_real_time_developer_notification.GooglePlaySubscriptionState,
25
- OneTimeProductNotificationType: () => import_real_time_developer_notification.OneTimeProductNotificationType,
26
- SubscriptionNotificationType: () => import_real_time_developer_notification.SubscriptionNotificationType,
27
- VoidedPurchaseProductType: () => import_real_time_developer_notification.VoidedPurchaseProductType,
28
- VoidedPurchaseRefundType: () => import_real_time_developer_notification.VoidedPurchaseRefundType
29
- });
30
- module.exports = __toCommonJS(google_play_exports);
31
- var import_real_time_developer_notification = require("./real-time-developer-notification.cjs");
32
- var import_config = require("./config.cjs");
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- GooglePlayConfig,
36
- GooglePlaySubscriptionState,
37
- OneTimeProductNotificationType,
38
- SubscriptionNotificationType,
39
- VoidedPurchaseProductType,
40
- VoidedPurchaseRefundType
41
- });
42
- //# sourceMappingURL=index.cjs.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_google_play_config = require("./config.cjs");
3
+ const require_google_play_real_time_developer_notification = require("./real-time-developer-notification.cjs");
4
+ exports.GooglePlayConfig = require_google_play_config.GooglePlayConfig;
5
+ exports.GooglePlaySubscriptionState = require_google_play_real_time_developer_notification.GooglePlaySubscriptionState;
6
+ exports.OneTimeProductNotificationType = require_google_play_real_time_developer_notification.OneTimeProductNotificationType;
7
+ exports.SubscriptionNotificationType = require_google_play_real_time_developer_notification.SubscriptionNotificationType;
8
+ exports.VoidedPurchaseProductType = require_google_play_real_time_developer_notification.VoidedPurchaseProductType;
9
+ exports.VoidedPurchaseRefundType = require_google_play_real_time_developer_notification.VoidedPurchaseRefundType;
@@ -1,4 +1,3 @@
1
- export { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from './real-time-developer-notification.cjs';
2
- export { GooglePlayConfig } from './config.cjs';
3
- import '../types.cjs';
4
- import 'ms';
1
+ import { GooglePlayConfig } from "./config.cjs";
2
+ import { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from "./real-time-developer-notification.cjs";
3
+ export { type DeveloperNotification, GooglePlayConfig, GooglePlaySubscriptionState, type OneTimeProductNotification, OneTimeProductNotificationType, type PubsubMessage, type SubscriptionNotification, SubscriptionNotificationType, type TestNotification, type VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
@@ -0,0 +1,3 @@
1
+ import { GooglePlayConfig } from "./config.mjs";
2
+ import { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from "./real-time-developer-notification.mjs";
3
+ export { type DeveloperNotification, GooglePlayConfig, GooglePlaySubscriptionState, type OneTimeProductNotification, OneTimeProductNotificationType, type PubsubMessage, type SubscriptionNotification, SubscriptionNotificationType, type TestNotification, type VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
@@ -1,18 +1,3 @@
1
- // src/google-play/index.ts
2
- import {
3
- GooglePlaySubscriptionState,
4
- SubscriptionNotificationType,
5
- OneTimeProductNotificationType,
6
- VoidedPurchaseProductType,
7
- VoidedPurchaseRefundType
8
- } from "./real-time-developer-notification.mjs";
9
1
  import { GooglePlayConfig } from "./config.mjs";
10
- export {
11
- GooglePlayConfig,
12
- GooglePlaySubscriptionState,
13
- OneTimeProductNotificationType,
14
- SubscriptionNotificationType,
15
- VoidedPurchaseProductType,
16
- VoidedPurchaseRefundType
17
- };
18
- //# sourceMappingURL=index.mjs.map
2
+ import { GooglePlaySubscriptionState, OneTimeProductNotificationType, SubscriptionNotificationType, VoidedPurchaseProductType, VoidedPurchaseRefundType } from "./real-time-developer-notification.mjs";
3
+ export { GooglePlayConfig, GooglePlaySubscriptionState, OneTimeProductNotificationType, SubscriptionNotificationType, VoidedPurchaseProductType, VoidedPurchaseRefundType };
@@ -1,83 +1,124 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/google-play/real-time-developer-notification.ts
3
+ /**
4
+ * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
5
+ * */
6
+ let SubscriptionNotificationType = /* @__PURE__ */ function(SubscriptionNotificationType) {
7
+ /** A subscription was recovered from account hold. */
8
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_RECOVERED"] = 1] = "SUBSCRIPTION_RECOVERED";
9
+ /** An active subscription was renewed. */
10
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_RENEWED"] = 2] = "SUBSCRIPTION_RENEWED";
11
+ /**
12
+ * A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,
13
+ * sent when the user cancels.
14
+ */
15
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_CANCELED"] = 3] = "SUBSCRIPTION_CANCELED";
16
+ /** A new subscription was purchased. */
17
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PURCHASED"] = 4] = "SUBSCRIPTION_PURCHASED";
18
+ /** A subscription has entered account hold (if enabled). */
19
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_ON_HOLD"] = 5] = "SUBSCRIPTION_ON_HOLD";
20
+ /** A subscription has entered grace period (if enabled). */
21
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_IN_GRACE_PERIOD"] = 6] = "SUBSCRIPTION_IN_GRACE_PERIOD";
22
+ /**
23
+ * User has restored their subscription from Play > Account > Subscriptions. The subscription was
24
+ * canceled but had not expired yet when the user restores. For more information, see Restorations.
25
+ */
26
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_RESTARTED"] = 7] = "SUBSCRIPTION_RESTARTED";
27
+ /** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */
28
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PRICE_CHANGE_CONFIRMED"] = 8] = "SUBSCRIPTION_PRICE_CHANGE_CONFIRMED";
29
+ /** A subscription's recurrence time has been extended. */
30
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_DEFERRED"] = 9] = "SUBSCRIPTION_DEFERRED";
31
+ /** A subscription has been paused. */
32
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PAUSED"] = 10] = "SUBSCRIPTION_PAUSED";
33
+ /** A subscription pause schedule has been changed. */
34
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED"] = 11] = "SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED";
35
+ /** A subscription has been revoked from the user before the expiration time. */
36
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_REVOKED"] = 12] = "SUBSCRIPTION_REVOKED";
37
+ /** A subscription has expired. */
38
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_EXPIRED"] = 13] = "SUBSCRIPTION_EXPIRED";
39
+ /** A subscription item's price change details are updated. */
40
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PRICE_CHANGE_UPDATED"] = 19] = "SUBSCRIPTION_PRICE_CHANGE_UPDATED";
41
+ /** A pending transaction of a subscription has been canceled. */
42
+ SubscriptionNotificationType[SubscriptionNotificationType["SUBSCRIPTION_PENDING_PURCHASE_CANCELED"] = 20] = "SUBSCRIPTION_PENDING_PURCHASE_CANCELED";
43
+ return SubscriptionNotificationType;
44
+ }({});
45
+ let OneTimeProductNotificationType = /* @__PURE__ */ function(OneTimeProductNotificationType) {
46
+ /** A one-time product was successfully purchased by a user. */
47
+ OneTimeProductNotificationType[OneTimeProductNotificationType["ONE_TIME_PRODUCT_PURCHASED"] = 1] = "ONE_TIME_PRODUCT_PURCHASED";
48
+ /** A pending one-time product purchase has been canceled by the user. */
49
+ OneTimeProductNotificationType[OneTimeProductNotificationType["ONE_TIME_PRODUCT_CANCELED"] = 2] = "ONE_TIME_PRODUCT_CANCELED";
50
+ return OneTimeProductNotificationType;
51
+ }({});
52
+ let VoidedPurchaseProductType = /* @__PURE__ */ function(VoidedPurchaseProductType) {
53
+ /** A subscription purchase has been voided. */
54
+ VoidedPurchaseProductType[VoidedPurchaseProductType["PRODUCT_TYPE_SUBSCRIPTION"] = 1] = "PRODUCT_TYPE_SUBSCRIPTION";
55
+ /** A one-time purchase has been voided. */
56
+ VoidedPurchaseProductType[VoidedPurchaseProductType["PRODUCT_TYPE_ONE_TIME"] = 2] = "PRODUCT_TYPE_ONE_TIME";
57
+ return VoidedPurchaseProductType;
58
+ }({});
59
+ /**
60
+ * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
61
+ * will be REFUND_TYPE_FULL_REFUND.
62
+ */
63
+ let VoidedPurchaseRefundType = /* @__PURE__ */ function(VoidedPurchaseRefundType) {
64
+ /** The purchase has been fully voided. */
65
+ VoidedPurchaseRefundType[VoidedPurchaseRefundType["REFUND_TYPE_FULL_REFUND"] = 1] = "REFUND_TYPE_FULL_REFUND";
66
+ /**
67
+ * The purchase has been partially voided by a quantity-based partial refund, applicable only to
68
+ * multi-quantity purchases. A purchase can be partially voided multiple times.
69
+ */
70
+ VoidedPurchaseRefundType[VoidedPurchaseRefundType["REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND"] = 2] = "REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND";
71
+ return VoidedPurchaseRefundType;
72
+ }({});
73
+ /** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
74
+ let GooglePlaySubscriptionState = /* @__PURE__ */ function(GooglePlaySubscriptionState) {
75
+ /** Unspecified subscription state. */
76
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_UNSPECIFIED"] = "SUBSCRIPTION_STATE_UNSPECIFIED";
77
+ /**
78
+ * Subscription was created but awaiting payment during signup. In this state, all items are
79
+ * awaiting payment.
80
+ */
81
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_PENDING"] = "SUBSCRIPTION_STATE_PENDING";
82
+ /**
83
+ * Subscription is active.
84
+ * (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.
85
+ * (2) If the subscription is a prepaid plan, at least one item is not expired.
86
+ */
87
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_ACTIVE"] = "SUBSCRIPTION_STATE_ACTIVE";
88
+ /**
89
+ * Subscription is paused. The state is only available when the subscription is an auto renewing
90
+ * plan. In this state, all items are in paused state.
91
+ */
92
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_PAUSED"] = "SUBSCRIPTION_STATE_PAUSED";
93
+ /**
94
+ * Subscription is in grace period. The state is only available when the subscription is an auto
95
+ * renewing plan. In this state, all items are in grace period.
96
+ */
97
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_IN_GRACE_PERIOD"] = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD";
98
+ /**
99
+ * Subscription is on hold (suspended). The state is only available when the subscription is an
100
+ * auto renewing plan. In this state, all items are on hold.
101
+ */
102
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_ON_HOLD"] = "SUBSCRIPTION_STATE_ON_HOLD";
103
+ /**
104
+ * Subscription is canceled but not expired yet. The state is only available when the subscription
105
+ * is an auto renewing plan. All items have autoRenewEnabled set to false.
106
+ */
107
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_CANCELED"] = "SUBSCRIPTION_STATE_CANCELED";
108
+ /** Subscription is expired. All items have expiryTime in the past. */
109
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_EXPIRED"] = "SUBSCRIPTION_STATE_EXPIRED";
110
+ /**
111
+ * Pending transaction for subscription is canceled. If this pending purchase was for an existing
112
+ * subscription, use linkedPurchaseToken to get the current state of that subscription.
113
+ */
114
+ GooglePlaySubscriptionState["SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"] = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED";
115
+ return GooglePlaySubscriptionState;
116
+ }({});
117
+ //#endregion
118
+ exports.GooglePlaySubscriptionState = GooglePlaySubscriptionState;
119
+ exports.OneTimeProductNotificationType = OneTimeProductNotificationType;
120
+ exports.SubscriptionNotificationType = SubscriptionNotificationType;
121
+ exports.VoidedPurchaseProductType = VoidedPurchaseProductType;
122
+ exports.VoidedPurchaseRefundType = VoidedPurchaseRefundType;
19
123
 
20
- // src/google-play/real-time-developer-notification.ts
21
- var real_time_developer_notification_exports = {};
22
- __export(real_time_developer_notification_exports, {
23
- GooglePlaySubscriptionState: () => GooglePlaySubscriptionState,
24
- OneTimeProductNotificationType: () => OneTimeProductNotificationType,
25
- SubscriptionNotificationType: () => SubscriptionNotificationType,
26
- VoidedPurchaseProductType: () => VoidedPurchaseProductType,
27
- VoidedPurchaseRefundType: () => VoidedPurchaseRefundType
28
- });
29
- module.exports = __toCommonJS(real_time_developer_notification_exports);
30
- var SubscriptionNotificationType = /* @__PURE__ */ ((SubscriptionNotificationType2) => {
31
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RECOVERED"] = 1] = "SUBSCRIPTION_RECOVERED";
32
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RENEWED"] = 2] = "SUBSCRIPTION_RENEWED";
33
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_CANCELED"] = 3] = "SUBSCRIPTION_CANCELED";
34
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PURCHASED"] = 4] = "SUBSCRIPTION_PURCHASED";
35
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_ON_HOLD"] = 5] = "SUBSCRIPTION_ON_HOLD";
36
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_IN_GRACE_PERIOD"] = 6] = "SUBSCRIPTION_IN_GRACE_PERIOD";
37
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RESTARTED"] = 7] = "SUBSCRIPTION_RESTARTED";
38
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_CONFIRMED"] = 8] = "SUBSCRIPTION_PRICE_CHANGE_CONFIRMED";
39
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_DEFERRED"] = 9] = "SUBSCRIPTION_DEFERRED";
40
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSED"] = 10] = "SUBSCRIPTION_PAUSED";
41
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED"] = 11] = "SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED";
42
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_REVOKED"] = 12] = "SUBSCRIPTION_REVOKED";
43
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_EXPIRED"] = 13] = "SUBSCRIPTION_EXPIRED";
44
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_UPDATED"] = 19] = "SUBSCRIPTION_PRICE_CHANGE_UPDATED";
45
- SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PENDING_PURCHASE_CANCELED"] = 20] = "SUBSCRIPTION_PENDING_PURCHASE_CANCELED";
46
- return SubscriptionNotificationType2;
47
- })(SubscriptionNotificationType || {});
48
- var OneTimeProductNotificationType = /* @__PURE__ */ ((OneTimeProductNotificationType2) => {
49
- OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_PURCHASED"] = 1] = "ONE_TIME_PRODUCT_PURCHASED";
50
- OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_CANCELED"] = 2] = "ONE_TIME_PRODUCT_CANCELED";
51
- return OneTimeProductNotificationType2;
52
- })(OneTimeProductNotificationType || {});
53
- var VoidedPurchaseProductType = /* @__PURE__ */ ((VoidedPurchaseProductType2) => {
54
- VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_SUBSCRIPTION"] = 1] = "PRODUCT_TYPE_SUBSCRIPTION";
55
- VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_ONE_TIME"] = 2] = "PRODUCT_TYPE_ONE_TIME";
56
- return VoidedPurchaseProductType2;
57
- })(VoidedPurchaseProductType || {});
58
- var VoidedPurchaseRefundType = /* @__PURE__ */ ((VoidedPurchaseRefundType2) => {
59
- VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_FULL_REFUND"] = 1] = "REFUND_TYPE_FULL_REFUND";
60
- VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND"] = 2] = "REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND";
61
- return VoidedPurchaseRefundType2;
62
- })(VoidedPurchaseRefundType || {});
63
- var GooglePlaySubscriptionState = /* @__PURE__ */ ((GooglePlaySubscriptionState2) => {
64
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_UNSPECIFIED"] = "SUBSCRIPTION_STATE_UNSPECIFIED";
65
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING"] = "SUBSCRIPTION_STATE_PENDING";
66
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ACTIVE"] = "SUBSCRIPTION_STATE_ACTIVE";
67
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PAUSED"] = "SUBSCRIPTION_STATE_PAUSED";
68
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_IN_GRACE_PERIOD"] = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD";
69
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ON_HOLD"] = "SUBSCRIPTION_STATE_ON_HOLD";
70
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_CANCELED"] = "SUBSCRIPTION_STATE_CANCELED";
71
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_EXPIRED"] = "SUBSCRIPTION_STATE_EXPIRED";
72
- GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"] = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED";
73
- return GooglePlaySubscriptionState2;
74
- })(GooglePlaySubscriptionState || {});
75
- // Annotate the CommonJS export names for ESM import in node:
76
- 0 && (module.exports = {
77
- GooglePlaySubscriptionState,
78
- OneTimeProductNotificationType,
79
- SubscriptionNotificationType,
80
- VoidedPurchaseProductType,
81
- VoidedPurchaseRefundType
82
- });
83
124
  //# sourceMappingURL=real-time-developer-notification.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/google-play/real-time-developer-notification.ts"],"sourcesContent":["// ref: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage\nexport type PubsubMessage = {\n data: string;\n attributes: Record<string, string>;\n messageId: string;\n publishTime: string;\n orderingKey: string;\n};\n\n/** https://developer.android.com/google/play/billing/rtdn-reference */\nexport interface DeveloperNotification {\n version: string;\n packageName: string;\n eventTimeMillis: number;\n subscriptionNotification: SubscriptionNotification;\n oneTimeProductNotification: OneTimeProductNotification;\n voidedPurchaseNotification: VoidedPurchaseNotification;\n testNotification: TestNotification;\n}\n\n/**\n * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)\n * */\nexport enum SubscriptionNotificationType {\n /** A subscription was recovered from account hold. */\n SUBSCRIPTION_RECOVERED = 1,\n\n /** An active subscription was renewed. */\n SUBSCRIPTION_RENEWED = 2,\n\n /**\n * A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,\n * sent when the user cancels.\n */\n SUBSCRIPTION_CANCELED = 3,\n\n /** A new subscription was purchased. */\n SUBSCRIPTION_PURCHASED = 4,\n\n /** A subscription has entered account hold (if enabled). */\n SUBSCRIPTION_ON_HOLD = 5,\n\n /** A subscription has entered grace period (if enabled). */\n SUBSCRIPTION_IN_GRACE_PERIOD = 6,\n\n /**\n * User has restored their subscription from Play > Account > Subscriptions. The subscription was\n * canceled but had not expired yet when the user restores. For more information, see Restorations.\n */\n SUBSCRIPTION_RESTARTED = 7,\n\n /** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */\n SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,\n\n /** A subscription's recurrence time has been extended. */\n SUBSCRIPTION_DEFERRED = 9,\n\n /** A subscription has been paused. */\n SUBSCRIPTION_PAUSED = 10,\n\n /** A subscription pause schedule has been changed. */\n SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,\n\n /** A subscription has been revoked from the user before the expiration time. */\n SUBSCRIPTION_REVOKED = 12,\n\n /** A subscription has expired. */\n SUBSCRIPTION_EXPIRED = 13,\n\n /** A subscription item's price change details are updated. */\n SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,\n\n /** A pending transaction of a subscription has been canceled. */\n SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20,\n}\n\nexport interface SubscriptionNotification {\n version: string;\n purchaseToken: string;\n notificationType: SubscriptionNotificationType;\n}\n\nexport enum OneTimeProductNotificationType {\n /** A one-time product was successfully purchased by a user. */\n ONE_TIME_PRODUCT_PURCHASED = 1,\n\n /** A pending one-time product purchase has been canceled by the user. */\n ONE_TIME_PRODUCT_CANCELED = 2,\n}\n\nexport interface OneTimeProductNotification {\n version: string;\n sku: string;\n purchaseToken: string;\n notificationType: OneTimeProductNotificationType;\n}\n\nexport enum VoidedPurchaseProductType {\n /** A subscription purchase has been voided. */\n PRODUCT_TYPE_SUBSCRIPTION = 1,\n\n /** A one-time purchase has been voided. */\n PRODUCT_TYPE_ONE_TIME = 2,\n}\n\n/**\n * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType\n * will be REFUND_TYPE_FULL_REFUND.\n */\nexport enum VoidedPurchaseRefundType {\n /** The purchase has been fully voided. */\n REFUND_TYPE_FULL_REFUND = 1,\n\n /**\n * The purchase has been partially voided by a quantity-based partial refund, applicable only to\n * multi-quantity purchases. A purchase can be partially voided multiple times.\n */\n REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2,\n}\n\nexport interface VoidedPurchaseNotification {\n purchaseToken: string;\n orderId: string;\n productType: VoidedPurchaseProductType;\n refundType: VoidedPurchaseRefundType;\n}\n\nexport interface TestNotification {\n version: string;\n}\n\n/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */\nexport enum GooglePlaySubscriptionState {\n /** Unspecified subscription state. */\n SUBSCRIPTION_STATE_UNSPECIFIED = 'SUBSCRIPTION_STATE_UNSPECIFIED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n */\n SUBSCRIPTION_STATE_PENDING = 'SUBSCRIPTION_STATE_PENDING',\n\n /**\n * Subscription is active.\n * (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.\n * (2) If the subscription is a prepaid plan, at least one item is not expired.\n */\n SUBSCRIPTION_STATE_ACTIVE = 'SUBSCRIPTION_STATE_ACTIVE',\n\n /**\n * Subscription is paused. The state is only available when the subscription is an auto renewing\n * plan. In this state, all items are in paused state.\n */\n SUBSCRIPTION_STATE_PAUSED = 'SUBSCRIPTION_STATE_PAUSED',\n\n /**\n * Subscription is in grace period. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in grace period.\n */\n SUBSCRIPTION_STATE_IN_GRACE_PERIOD = 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold.\n */\n SUBSCRIPTION_STATE_ON_HOLD = 'SUBSCRIPTION_STATE_ON_HOLD',\n\n /**\n * Subscription is canceled but not expired yet. The state is only available when the subscription\n * is an auto renewing plan. All items have autoRenewEnabled set to false.\n */\n SUBSCRIPTION_STATE_CANCELED = 'SUBSCRIPTION_STATE_CANCELED',\n\n /** Subscription is expired. All items have expiryTime in the past. */\n SUBSCRIPTION_STATE_EXPIRED = 'SUBSCRIPTION_STATE_EXPIRED',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an existing\n * subscription, use linkedPurchaseToken to get the current state of that subscription.\n */\n SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,IAAK,+BAAL,kBAAKA,kCAAL;AAEL,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAMA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAGA,EAAAA,4DAAA,kCAA+B,KAA/B;AAMA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,yCAAsC,KAAtC;AAGA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,yBAAsB,MAAtB;AAGA,EAAAA,4DAAA,yCAAsC,MAAtC;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,uCAAoC,MAApC;AAGA,EAAAA,4DAAA,4CAAyC,MAAzC;AAlDU,SAAAA;AAAA,GAAA;AA2DL,IAAK,iCAAL,kBAAKC,oCAAL;AAEL,EAAAA,gEAAA,gCAA6B,KAA7B;AAGA,EAAAA,gEAAA,+BAA4B,KAA5B;AALU,SAAAA;AAAA,GAAA;AAeL,IAAK,4BAAL,kBAAKC,+BAAL;AAEL,EAAAA,sDAAA,+BAA4B,KAA5B;AAGA,EAAAA,sDAAA,2BAAwB,KAAxB;AALU,SAAAA;AAAA,GAAA;AAYL,IAAK,2BAAL,kBAAKC,8BAAL;AAEL,EAAAA,oDAAA,6BAA0B,KAA1B;AAMA,EAAAA,oDAAA,+CAA4C,KAA5C;AARU,SAAAA;AAAA,GAAA;AAuBL,IAAK,8BAAL,kBAAKC,iCAAL;AAEL,EAAAA,6BAAA,oCAAiC;AAMjC,EAAAA,6BAAA,gCAA6B;AAO7B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,wCAAqC;AAMrC,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,iCAA8B;AAG9B,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,kDAA+C;AAhDrC,SAAAA;AAAA,GAAA;","names":["SubscriptionNotificationType","OneTimeProductNotificationType","VoidedPurchaseProductType","VoidedPurchaseRefundType","GooglePlaySubscriptionState"]}
1
+ {"version":3,"file":"real-time-developer-notification.cjs","names":[],"sources":["../../src/google-play/real-time-developer-notification.ts"],"sourcesContent":["// ref: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage\nexport type PubsubMessage = {\n data: string;\n attributes: Record<string, string>;\n messageId: string;\n publishTime: string;\n orderingKey: string;\n};\n\n/** https://developer.android.com/google/play/billing/rtdn-reference */\nexport interface DeveloperNotification {\n version: string;\n packageName: string;\n eventTimeMillis: number;\n subscriptionNotification: SubscriptionNotification;\n oneTimeProductNotification: OneTimeProductNotification;\n voidedPurchaseNotification: VoidedPurchaseNotification;\n testNotification: TestNotification;\n}\n\n/**\n * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)\n * */\nexport enum SubscriptionNotificationType {\n /** A subscription was recovered from account hold. */\n SUBSCRIPTION_RECOVERED = 1,\n\n /** An active subscription was renewed. */\n SUBSCRIPTION_RENEWED = 2,\n\n /**\n * A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,\n * sent when the user cancels.\n */\n SUBSCRIPTION_CANCELED = 3,\n\n /** A new subscription was purchased. */\n SUBSCRIPTION_PURCHASED = 4,\n\n /** A subscription has entered account hold (if enabled). */\n SUBSCRIPTION_ON_HOLD = 5,\n\n /** A subscription has entered grace period (if enabled). */\n SUBSCRIPTION_IN_GRACE_PERIOD = 6,\n\n /**\n * User has restored their subscription from Play > Account > Subscriptions. The subscription was\n * canceled but had not expired yet when the user restores. For more information, see Restorations.\n */\n SUBSCRIPTION_RESTARTED = 7,\n\n /** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */\n SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,\n\n /** A subscription's recurrence time has been extended. */\n SUBSCRIPTION_DEFERRED = 9,\n\n /** A subscription has been paused. */\n SUBSCRIPTION_PAUSED = 10,\n\n /** A subscription pause schedule has been changed. */\n SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,\n\n /** A subscription has been revoked from the user before the expiration time. */\n SUBSCRIPTION_REVOKED = 12,\n\n /** A subscription has expired. */\n SUBSCRIPTION_EXPIRED = 13,\n\n /** A subscription item's price change details are updated. */\n SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,\n\n /** A pending transaction of a subscription has been canceled. */\n SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20,\n}\n\nexport interface SubscriptionNotification {\n version: string;\n purchaseToken: string;\n notificationType: SubscriptionNotificationType;\n}\n\nexport enum OneTimeProductNotificationType {\n /** A one-time product was successfully purchased by a user. */\n ONE_TIME_PRODUCT_PURCHASED = 1,\n\n /** A pending one-time product purchase has been canceled by the user. */\n ONE_TIME_PRODUCT_CANCELED = 2,\n}\n\nexport interface OneTimeProductNotification {\n version: string;\n sku: string;\n purchaseToken: string;\n notificationType: OneTimeProductNotificationType;\n}\n\nexport enum VoidedPurchaseProductType {\n /** A subscription purchase has been voided. */\n PRODUCT_TYPE_SUBSCRIPTION = 1,\n\n /** A one-time purchase has been voided. */\n PRODUCT_TYPE_ONE_TIME = 2,\n}\n\n/**\n * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType\n * will be REFUND_TYPE_FULL_REFUND.\n */\nexport enum VoidedPurchaseRefundType {\n /** The purchase has been fully voided. */\n REFUND_TYPE_FULL_REFUND = 1,\n\n /**\n * The purchase has been partially voided by a quantity-based partial refund, applicable only to\n * multi-quantity purchases. A purchase can be partially voided multiple times.\n */\n REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2,\n}\n\nexport interface VoidedPurchaseNotification {\n purchaseToken: string;\n orderId: string;\n productType: VoidedPurchaseProductType;\n refundType: VoidedPurchaseRefundType;\n}\n\nexport interface TestNotification {\n version: string;\n}\n\n/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */\nexport enum GooglePlaySubscriptionState {\n /** Unspecified subscription state. */\n SUBSCRIPTION_STATE_UNSPECIFIED = 'SUBSCRIPTION_STATE_UNSPECIFIED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n */\n SUBSCRIPTION_STATE_PENDING = 'SUBSCRIPTION_STATE_PENDING',\n\n /**\n * Subscription is active.\n * (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.\n * (2) If the subscription is a prepaid plan, at least one item is not expired.\n */\n SUBSCRIPTION_STATE_ACTIVE = 'SUBSCRIPTION_STATE_ACTIVE',\n\n /**\n * Subscription is paused. The state is only available when the subscription is an auto renewing\n * plan. In this state, all items are in paused state.\n */\n SUBSCRIPTION_STATE_PAUSED = 'SUBSCRIPTION_STATE_PAUSED',\n\n /**\n * Subscription is in grace period. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in grace period.\n */\n SUBSCRIPTION_STATE_IN_GRACE_PERIOD = 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold.\n */\n SUBSCRIPTION_STATE_ON_HOLD = 'SUBSCRIPTION_STATE_ON_HOLD',\n\n /**\n * Subscription is canceled but not expired yet. The state is only available when the subscription\n * is an auto renewing plan. All items have autoRenewEnabled set to false.\n */\n SUBSCRIPTION_STATE_CANCELED = 'SUBSCRIPTION_STATE_CANCELED',\n\n /** Subscription is expired. All items have expiryTime in the past. */\n SUBSCRIPTION_STATE_EXPIRED = 'SUBSCRIPTION_STATE_EXPIRED',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an existing\n * subscription, use linkedPurchaseToken to get the current state of that subscription.\n */\n SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED',\n}\n"],"mappings":";;;;;AAuBA,IAAY,+BAAL,yBAAA,8BAAA;;CAEL,6BAAA,6BAAA,4BAAA,KAAA;;CAGA,6BAAA,6BAAA,0BAAA,KAAA;;;;;CAMA,6BAAA,6BAAA,2BAAA,KAAA;;CAGA,6BAAA,6BAAA,4BAAA,KAAA;;CAGA,6BAAA,6BAAA,0BAAA,KAAA;;CAGA,6BAAA,6BAAA,kCAAA,KAAA;;;;;CAMA,6BAAA,6BAAA,4BAAA,KAAA;;CAGA,6BAAA,6BAAA,yCAAA,KAAA;;CAGA,6BAAA,6BAAA,2BAAA,KAAA;;CAGA,6BAAA,6BAAA,yBAAA,MAAA;;CAGA,6BAAA,6BAAA,yCAAA,MAAA;;CAGA,6BAAA,6BAAA,0BAAA,MAAA;;CAGA,6BAAA,6BAAA,0BAAA,MAAA;;CAGA,6BAAA,6BAAA,uCAAA,MAAA;;CAGA,6BAAA,6BAAA,4CAAA,MAAA;;AACF,EAAA,CAAA,CAAA;AAQA,IAAY,iCAAL,yBAAA,gCAAA;;CAEL,+BAAA,+BAAA,gCAAA,KAAA;;CAGA,+BAAA,+BAAA,+BAAA,KAAA;;AACF,EAAA,CAAA,CAAA;AASA,IAAY,4BAAL,yBAAA,2BAAA;;CAEL,0BAAA,0BAAA,+BAAA,KAAA;;CAGA,0BAAA,0BAAA,2BAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;;AAMA,IAAY,2BAAL,yBAAA,0BAAA;;CAEL,yBAAA,yBAAA,6BAAA,KAAA;;;;;CAMA,yBAAA,yBAAA,+CAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;AAcA,IAAY,8BAAL,yBAAA,6BAAA;;CAEL,4BAAA,oCAAA;;;;;CAMA,4BAAA,gCAAA;;;;;;CAOA,4BAAA,+BAAA;;;;;CAMA,4BAAA,+BAAA;;;;;CAMA,4BAAA,wCAAA;;;;;CAMA,4BAAA,gCAAA;;;;;CAMA,4BAAA,iCAAA;;CAGA,4BAAA,gCAAA;;;;;CAMA,4BAAA,kDAAA;;AACF,EAAA,CAAA,CAAA"}