react-native-iap 14.3.7 → 14.3.9

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 (98) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +74 -14
  4. package/ios/HybridRnIap.swift +47 -12
  5. package/lib/module/hooks/useIAP.js +31 -21
  6. package/lib/module/hooks/useIAP.js.map +1 -1
  7. package/lib/module/index.js +580 -695
  8. package/lib/module/index.js.map +1 -1
  9. package/lib/module/types.js +12 -0
  10. package/lib/module/types.js.map +1 -1
  11. package/lib/module/utils/purchase.js +22 -0
  12. package/lib/module/utils/purchase.js.map +1 -0
  13. package/lib/module/utils.js +43 -0
  14. package/lib/module/utils.js.map +1 -0
  15. package/lib/typescript/plugin/src/withIAP.d.ts +1 -0
  16. package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
  17. package/lib/typescript/src/hooks/useIAP.d.ts +4 -5
  18. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  19. package/lib/typescript/src/index.d.ts +57 -176
  20. package/lib/typescript/src/index.d.ts.map +1 -1
  21. package/lib/typescript/src/specs/RnIap.nitro.d.ts +113 -154
  22. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  23. package/lib/typescript/src/types.d.ts +99 -76
  24. package/lib/typescript/src/types.d.ts.map +1 -1
  25. package/lib/typescript/src/utils/purchase.d.ts +4 -0
  26. package/lib/typescript/src/utils/purchase.d.ts.map +1 -0
  27. package/lib/typescript/src/utils.d.ts +8 -0
  28. package/lib/typescript/src/utils.d.ts.map +1 -0
  29. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -1
  30. package/nitrogen/generated/android/c++/{JNitroSubscriptionOffer.hpp → JAndroidSubscriptionOfferInput.hpp} +15 -15
  31. package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +2 -0
  32. package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +4 -0
  33. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +16 -16
  34. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
  35. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +6 -5
  36. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidType.hpp +59 -0
  37. package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +2 -1
  38. package/nitrogen/generated/android/c++/JNitroProduct.hpp +22 -20
  39. package/nitrogen/generated/android/c++/JNitroPurchase.hpp +12 -8
  40. package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +2 -2
  41. package/nitrogen/generated/android/c++/JNitroReceiptValidationAndroidOptions.hpp +10 -10
  42. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +6 -6
  43. package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +4 -0
  44. package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +7 -7
  45. package/nitrogen/generated/android/c++/JRequestPurchaseResult.cpp +39 -0
  46. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +68 -53
  47. package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +4 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/{NitroSubscriptionOffer.kt → AndroidSubscriptionOfferInput.kt} +5 -5
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +1 -1
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidType.kt +21 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +11 -11
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +2 -2
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationAndroidOptions.kt +4 -4
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +2 -2
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +1 -1
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +31 -13
  58. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +4 -4
  59. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +99 -64
  60. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -6
  61. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +10 -10
  62. package/nitrogen/generated/ios/swift/{NitroSubscriptionOffer.swift → AndroidSubscriptionOfferInput.swift} +13 -13
  63. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__variant_PurchaseAndroid__PurchaseIOS__std__vector_std__variant_PurchaseAndroid__PurchaseIOS____.swift +81 -0
  64. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
  65. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +35 -7
  66. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +7 -14
  67. package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidType.swift +40 -0
  68. package/nitrogen/generated/ios/swift/NitroProduct.swift +72 -72
  69. package/nitrogen/generated/ios/swift/NitroPurchase.swift +8 -8
  70. package/nitrogen/generated/ios/swift/NitroReceiptValidationAndroidOptions.swift +21 -21
  71. package/nitrogen/generated/ios/swift/NitroReceiptValidationResultAndroid.swift +37 -11
  72. package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +11 -11
  73. package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +8 -137
  74. package/nitrogen/generated/shared/c++/{NitroSubscriptionOffer.hpp → AndroidSubscriptionOfferInput.hpp} +15 -15
  75. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +9 -6
  76. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +8 -7
  77. package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidType.hpp +76 -0
  78. package/nitrogen/generated/shared/c++/NitroProduct.hpp +24 -22
  79. package/nitrogen/generated/shared/c++/NitroPurchase.hpp +15 -10
  80. package/nitrogen/generated/shared/c++/NitroReceiptValidationAndroidOptions.hpp +10 -10
  81. package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +9 -9
  82. package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +8 -8
  83. package/package.json +2 -2
  84. package/plugin/build/withIAP.d.ts +1 -0
  85. package/plugin/build/withIAP.js +8 -2
  86. package/plugin/src/withIAP.ts +13 -3
  87. package/src/hooks/useIAP.ts +63 -32
  88. package/src/index.ts +716 -790
  89. package/src/specs/RnIap.nitro.ts +131 -163
  90. package/src/types.ts +131 -85
  91. package/src/utils/purchase.ts +32 -0
  92. package/src/utils.ts +68 -0
  93. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +0 -26
  94. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +0 -80
  95. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +0 -42
  96. package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +0 -47
  97. package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +0 -18
  98. package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +0 -78
@@ -18,33 +18,26 @@ public extension NitroAvailablePurchasesAndroidOptions {
18
18
  /**
19
19
  * Create a new instance of `NitroAvailablePurchasesAndroidOptions`.
20
20
  */
21
- init(type: String?) {
22
- self.init({ () -> bridge.std__optional_std__string_ in
21
+ init(type: NitroAvailablePurchasesAndroidType?) {
22
+ self.init({ () -> bridge.std__optional_NitroAvailablePurchasesAndroidType_ in
23
23
  if let __unwrappedValue = type {
24
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
24
+ return bridge.create_std__optional_NitroAvailablePurchasesAndroidType_(__unwrappedValue)
25
25
  } else {
26
26
  return .init()
27
27
  }
28
28
  }())
29
29
  }
30
30
 
31
- var type: String? {
31
+ var type: NitroAvailablePurchasesAndroidType? {
32
32
  @inline(__always)
33
33
  get {
34
- return { () -> String? in
35
- if bridge.has_value_std__optional_std__string_(self.__type) {
36
- let __unwrapped = bridge.get_std__optional_std__string_(self.__type)
37
- return String(__unwrapped)
38
- } else {
39
- return nil
40
- }
41
- }()
34
+ return self.__type.value
42
35
  }
43
36
  @inline(__always)
44
37
  set {
45
- self.__type = { () -> bridge.std__optional_std__string_ in
38
+ self.__type = { () -> bridge.std__optional_NitroAvailablePurchasesAndroidType_ in
46
39
  if let __unwrappedValue = newValue {
47
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
40
+ return bridge.create_std__optional_NitroAvailablePurchasesAndroidType_(__unwrappedValue)
48
41
  } else {
49
42
  return .init()
50
43
  }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// NitroAvailablePurchasesAndroidType.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `NitroAvailablePurchasesAndroidType`, backed by a C++ enum.
10
+ */
11
+ public typealias NitroAvailablePurchasesAndroidType = margelo.nitro.iap.NitroAvailablePurchasesAndroidType
12
+
13
+ public extension NitroAvailablePurchasesAndroidType {
14
+ /**
15
+ * Get a NitroAvailablePurchasesAndroidType for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "inapp":
21
+ self = .inapp
22
+ case "subs":
23
+ self = .subs
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this NitroAvailablePurchasesAndroidType represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .inapp:
35
+ return "inapp"
36
+ case .subs:
37
+ return "subs"
38
+ }
39
+ }
40
+ }
@@ -18,7 +18,7 @@ public extension NitroProduct {
18
18
  /**
19
19
  * Create a new instance of `NitroProduct`.
20
20
  */
21
- init(id: String, title: String, description: String, type: String, displayName: String?, displayPrice: String?, currency: String?, price: Double?, platform: String, typeIOS: String?, isFamilyShareableIOS: Bool?, jsonRepresentationIOS: String?, subscriptionPeriodUnitIOS: String?, subscriptionPeriodNumberIOS: Double?, introductoryPriceIOS: String?, introductoryPriceAsAmountIOS: Double?, introductoryPricePaymentModeIOS: String?, introductoryPriceNumberOfPeriodsIOS: Double?, introductoryPriceSubscriptionPeriodIOS: String?, originalPriceAndroid: String?, originalPriceAmountMicrosAndroid: Double?, introductoryPriceValueAndroid: Double?, introductoryPriceCyclesAndroid: Double?, introductoryPricePeriodAndroid: String?, subscriptionPeriodAndroid: String?, freeTrialPeriodAndroid: String?, subscriptionOfferDetailsAndroid: String?) {
21
+ init(id: String, title: String, description: String, type: String, displayName: String?, displayPrice: String?, currency: String?, price: Double?, platform: IapPlatform, typeIOS: String?, isFamilyShareableIOS: Bool?, jsonRepresentationIOS: String?, introductoryPriceIOS: String?, introductoryPriceAsAmountIOS: Double?, introductoryPriceNumberOfPeriodsIOS: Double?, introductoryPricePaymentModeIOS: String?, introductoryPriceSubscriptionPeriodIOS: String?, subscriptionPeriodNumberIOS: Double?, subscriptionPeriodUnitIOS: String?, originalPriceAndroid: String?, originalPriceAmountMicrosAndroid: Double?, introductoryPriceCyclesAndroid: Double?, introductoryPricePeriodAndroid: String?, introductoryPriceValueAndroid: Double?, subscriptionPeriodAndroid: String?, freeTrialPeriodAndroid: String?, subscriptionOfferDetailsAndroid: String?) {
22
22
  self.init(std.string(id), std.string(title), std.string(description), std.string(type), { () -> bridge.std__optional_std__string_ in
23
23
  if let __unwrappedValue = displayName {
24
24
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -43,7 +43,7 @@ public extension NitroProduct {
43
43
  } else {
44
44
  return .init()
45
45
  }
46
- }(), std.string(platform), { () -> bridge.std__optional_std__string_ in
46
+ }(), platform, { () -> bridge.std__optional_std__string_ in
47
47
  if let __unwrappedValue = typeIOS {
48
48
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
49
49
  } else {
@@ -62,25 +62,19 @@ public extension NitroProduct {
62
62
  return .init()
63
63
  }
64
64
  }(), { () -> bridge.std__optional_std__string_ in
65
- if let __unwrappedValue = subscriptionPeriodUnitIOS {
65
+ if let __unwrappedValue = introductoryPriceIOS {
66
66
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
67
67
  } else {
68
68
  return .init()
69
69
  }
70
70
  }(), { () -> bridge.std__optional_double_ in
71
- if let __unwrappedValue = subscriptionPeriodNumberIOS {
71
+ if let __unwrappedValue = introductoryPriceAsAmountIOS {
72
72
  return bridge.create_std__optional_double_(__unwrappedValue)
73
73
  } else {
74
74
  return .init()
75
75
  }
76
- }(), { () -> bridge.std__optional_std__string_ in
77
- if let __unwrappedValue = introductoryPriceIOS {
78
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
79
- } else {
80
- return .init()
81
- }
82
76
  }(), { () -> bridge.std__optional_double_ in
83
- if let __unwrappedValue = introductoryPriceAsAmountIOS {
77
+ if let __unwrappedValue = introductoryPriceNumberOfPeriodsIOS {
84
78
  return bridge.create_std__optional_double_(__unwrappedValue)
85
79
  } else {
86
80
  return .init()
@@ -91,14 +85,20 @@ public extension NitroProduct {
91
85
  } else {
92
86
  return .init()
93
87
  }
88
+ }(), { () -> bridge.std__optional_std__string_ in
89
+ if let __unwrappedValue = introductoryPriceSubscriptionPeriodIOS {
90
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
91
+ } else {
92
+ return .init()
93
+ }
94
94
  }(), { () -> bridge.std__optional_double_ in
95
- if let __unwrappedValue = introductoryPriceNumberOfPeriodsIOS {
95
+ if let __unwrappedValue = subscriptionPeriodNumberIOS {
96
96
  return bridge.create_std__optional_double_(__unwrappedValue)
97
97
  } else {
98
98
  return .init()
99
99
  }
100
100
  }(), { () -> bridge.std__optional_std__string_ in
101
- if let __unwrappedValue = introductoryPriceSubscriptionPeriodIOS {
101
+ if let __unwrappedValue = subscriptionPeriodUnitIOS {
102
102
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
103
103
  } else {
104
104
  return .init()
@@ -115,12 +115,6 @@ public extension NitroProduct {
115
115
  } else {
116
116
  return .init()
117
117
  }
118
- }(), { () -> bridge.std__optional_double_ in
119
- if let __unwrappedValue = introductoryPriceValueAndroid {
120
- return bridge.create_std__optional_double_(__unwrappedValue)
121
- } else {
122
- return .init()
123
- }
124
118
  }(), { () -> bridge.std__optional_double_ in
125
119
  if let __unwrappedValue = introductoryPriceCyclesAndroid {
126
120
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -133,6 +127,12 @@ public extension NitroProduct {
133
127
  } else {
134
128
  return .init()
135
129
  }
130
+ }(), { () -> bridge.std__optional_double_ in
131
+ if let __unwrappedValue = introductoryPriceValueAndroid {
132
+ return bridge.create_std__optional_double_(__unwrappedValue)
133
+ } else {
134
+ return .init()
135
+ }
136
136
  }(), { () -> bridge.std__optional_std__string_ in
137
137
  if let __unwrappedValue = subscriptionPeriodAndroid {
138
138
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -287,14 +287,14 @@ public extension NitroProduct {
287
287
  }
288
288
  }
289
289
 
290
- var platform: String {
290
+ var platform: IapPlatform {
291
291
  @inline(__always)
292
292
  get {
293
- return String(self.__platform)
293
+ return self.__platform
294
294
  }
295
295
  @inline(__always)
296
296
  set {
297
- self.__platform = std.string(newValue)
297
+ self.__platform = newValue
298
298
  }
299
299
  }
300
300
 
@@ -363,12 +363,12 @@ public extension NitroProduct {
363
363
  }
364
364
  }
365
365
 
366
- var subscriptionPeriodUnitIOS: String? {
366
+ var introductoryPriceIOS: String? {
367
367
  @inline(__always)
368
368
  get {
369
369
  return { () -> String? in
370
- if bridge.has_value_std__optional_std__string_(self.__subscriptionPeriodUnitIOS) {
371
- let __unwrapped = bridge.get_std__optional_std__string_(self.__subscriptionPeriodUnitIOS)
370
+ if bridge.has_value_std__optional_std__string_(self.__introductoryPriceIOS) {
371
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceIOS)
372
372
  return String(__unwrapped)
373
373
  } else {
374
374
  return nil
@@ -377,7 +377,7 @@ public extension NitroProduct {
377
377
  }
378
378
  @inline(__always)
379
379
  set {
380
- self.__subscriptionPeriodUnitIOS = { () -> bridge.std__optional_std__string_ in
380
+ self.__introductoryPriceIOS = { () -> bridge.std__optional_std__string_ in
381
381
  if let __unwrappedValue = newValue {
382
382
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
383
383
  } else {
@@ -387,14 +387,14 @@ public extension NitroProduct {
387
387
  }
388
388
  }
389
389
 
390
- var subscriptionPeriodNumberIOS: Double? {
390
+ var introductoryPriceAsAmountIOS: Double? {
391
391
  @inline(__always)
392
392
  get {
393
- return self.__subscriptionPeriodNumberIOS.value
393
+ return self.__introductoryPriceAsAmountIOS.value
394
394
  }
395
395
  @inline(__always)
396
396
  set {
397
- self.__subscriptionPeriodNumberIOS = { () -> bridge.std__optional_double_ in
397
+ self.__introductoryPriceAsAmountIOS = { () -> bridge.std__optional_double_ in
398
398
  if let __unwrappedValue = newValue {
399
399
  return bridge.create_std__optional_double_(__unwrappedValue)
400
400
  } else {
@@ -404,23 +404,16 @@ public extension NitroProduct {
404
404
  }
405
405
  }
406
406
 
407
- var introductoryPriceIOS: String? {
407
+ var introductoryPriceNumberOfPeriodsIOS: Double? {
408
408
  @inline(__always)
409
409
  get {
410
- return { () -> String? in
411
- if bridge.has_value_std__optional_std__string_(self.__introductoryPriceIOS) {
412
- let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceIOS)
413
- return String(__unwrapped)
414
- } else {
415
- return nil
416
- }
417
- }()
410
+ return self.__introductoryPriceNumberOfPeriodsIOS.value
418
411
  }
419
412
  @inline(__always)
420
413
  set {
421
- self.__introductoryPriceIOS = { () -> bridge.std__optional_std__string_ in
414
+ self.__introductoryPriceNumberOfPeriodsIOS = { () -> bridge.std__optional_double_ in
422
415
  if let __unwrappedValue = newValue {
423
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
416
+ return bridge.create_std__optional_double_(__unwrappedValue)
424
417
  } else {
425
418
  return .init()
426
419
  }
@@ -428,16 +421,23 @@ public extension NitroProduct {
428
421
  }
429
422
  }
430
423
 
431
- var introductoryPriceAsAmountIOS: Double? {
424
+ var introductoryPricePaymentModeIOS: String? {
432
425
  @inline(__always)
433
426
  get {
434
- return self.__introductoryPriceAsAmountIOS.value
427
+ return { () -> String? in
428
+ if bridge.has_value_std__optional_std__string_(self.__introductoryPricePaymentModeIOS) {
429
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPricePaymentModeIOS)
430
+ return String(__unwrapped)
431
+ } else {
432
+ return nil
433
+ }
434
+ }()
435
435
  }
436
436
  @inline(__always)
437
437
  set {
438
- self.__introductoryPriceAsAmountIOS = { () -> bridge.std__optional_double_ in
438
+ self.__introductoryPricePaymentModeIOS = { () -> bridge.std__optional_std__string_ in
439
439
  if let __unwrappedValue = newValue {
440
- return bridge.create_std__optional_double_(__unwrappedValue)
440
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
441
441
  } else {
442
442
  return .init()
443
443
  }
@@ -445,12 +445,12 @@ public extension NitroProduct {
445
445
  }
446
446
  }
447
447
 
448
- var introductoryPricePaymentModeIOS: String? {
448
+ var introductoryPriceSubscriptionPeriodIOS: String? {
449
449
  @inline(__always)
450
450
  get {
451
451
  return { () -> String? in
452
- if bridge.has_value_std__optional_std__string_(self.__introductoryPricePaymentModeIOS) {
453
- let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPricePaymentModeIOS)
452
+ if bridge.has_value_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS) {
453
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS)
454
454
  return String(__unwrapped)
455
455
  } else {
456
456
  return nil
@@ -459,7 +459,7 @@ public extension NitroProduct {
459
459
  }
460
460
  @inline(__always)
461
461
  set {
462
- self.__introductoryPricePaymentModeIOS = { () -> bridge.std__optional_std__string_ in
462
+ self.__introductoryPriceSubscriptionPeriodIOS = { () -> bridge.std__optional_std__string_ in
463
463
  if let __unwrappedValue = newValue {
464
464
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
465
465
  } else {
@@ -469,14 +469,14 @@ public extension NitroProduct {
469
469
  }
470
470
  }
471
471
 
472
- var introductoryPriceNumberOfPeriodsIOS: Double? {
472
+ var subscriptionPeriodNumberIOS: Double? {
473
473
  @inline(__always)
474
474
  get {
475
- return self.__introductoryPriceNumberOfPeriodsIOS.value
475
+ return self.__subscriptionPeriodNumberIOS.value
476
476
  }
477
477
  @inline(__always)
478
478
  set {
479
- self.__introductoryPriceNumberOfPeriodsIOS = { () -> bridge.std__optional_double_ in
479
+ self.__subscriptionPeriodNumberIOS = { () -> bridge.std__optional_double_ in
480
480
  if let __unwrappedValue = newValue {
481
481
  return bridge.create_std__optional_double_(__unwrappedValue)
482
482
  } else {
@@ -486,12 +486,12 @@ public extension NitroProduct {
486
486
  }
487
487
  }
488
488
 
489
- var introductoryPriceSubscriptionPeriodIOS: String? {
489
+ var subscriptionPeriodUnitIOS: String? {
490
490
  @inline(__always)
491
491
  get {
492
492
  return { () -> String? in
493
- if bridge.has_value_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS) {
494
- let __unwrapped = bridge.get_std__optional_std__string_(self.__introductoryPriceSubscriptionPeriodIOS)
493
+ if bridge.has_value_std__optional_std__string_(self.__subscriptionPeriodUnitIOS) {
494
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__subscriptionPeriodUnitIOS)
495
495
  return String(__unwrapped)
496
496
  } else {
497
497
  return nil
@@ -500,7 +500,7 @@ public extension NitroProduct {
500
500
  }
501
501
  @inline(__always)
502
502
  set {
503
- self.__introductoryPriceSubscriptionPeriodIOS = { () -> bridge.std__optional_std__string_ in
503
+ self.__subscriptionPeriodUnitIOS = { () -> bridge.std__optional_std__string_ in
504
504
  if let __unwrappedValue = newValue {
505
505
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
506
506
  } else {
@@ -551,23 +551,6 @@ public extension NitroProduct {
551
551
  }
552
552
  }
553
553
 
554
- var introductoryPriceValueAndroid: Double? {
555
- @inline(__always)
556
- get {
557
- return self.__introductoryPriceValueAndroid.value
558
- }
559
- @inline(__always)
560
- set {
561
- self.__introductoryPriceValueAndroid = { () -> bridge.std__optional_double_ in
562
- if let __unwrappedValue = newValue {
563
- return bridge.create_std__optional_double_(__unwrappedValue)
564
- } else {
565
- return .init()
566
- }
567
- }()
568
- }
569
- }
570
-
571
554
  var introductoryPriceCyclesAndroid: Double? {
572
555
  @inline(__always)
573
556
  get {
@@ -609,6 +592,23 @@ public extension NitroProduct {
609
592
  }
610
593
  }
611
594
 
595
+ var introductoryPriceValueAndroid: Double? {
596
+ @inline(__always)
597
+ get {
598
+ return self.__introductoryPriceValueAndroid.value
599
+ }
600
+ @inline(__always)
601
+ set {
602
+ self.__introductoryPriceValueAndroid = { () -> bridge.std__optional_double_ in
603
+ if let __unwrappedValue = newValue {
604
+ return bridge.create_std__optional_double_(__unwrappedValue)
605
+ } else {
606
+ return .init()
607
+ }
608
+ }()
609
+ }
610
+ }
611
+
612
612
  var subscriptionPeriodAndroid: String? {
613
613
  @inline(__always)
614
614
  get {
@@ -18,14 +18,14 @@ public extension NitroPurchase {
18
18
  /**
19
19
  * Create a new instance of `NitroPurchase`.
20
20
  */
21
- init(id: String, productId: String, transactionDate: Double, purchaseToken: String?, platform: String, quantity: Double, purchaseState: String, isAutoRenewing: Bool, quantityIOS: Double?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, appAccountToken: String?, purchaseTokenAndroid: String?, dataAndroid: String?, signatureAndroid: String?, autoRenewingAndroid: Bool?, purchaseStateAndroid: Double?, isAcknowledgedAndroid: Bool?, packageNameAndroid: String?, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?) {
21
+ init(id: String, productId: String, transactionDate: Double, purchaseToken: String?, platform: IapPlatform, quantity: Double, purchaseState: PurchaseState, isAutoRenewing: Bool, quantityIOS: Double?, originalTransactionDateIOS: Double?, originalTransactionIdentifierIOS: String?, appAccountToken: String?, purchaseTokenAndroid: String?, dataAndroid: String?, signatureAndroid: String?, autoRenewingAndroid: Bool?, purchaseStateAndroid: Double?, isAcknowledgedAndroid: Bool?, packageNameAndroid: String?, obfuscatedAccountIdAndroid: String?, obfuscatedProfileIdAndroid: String?) {
22
22
  self.init(std.string(id), std.string(productId), transactionDate, { () -> bridge.std__optional_std__string_ in
23
23
  if let __unwrappedValue = purchaseToken {
24
24
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
25
25
  } else {
26
26
  return .init()
27
27
  }
28
- }(), std.string(platform), quantity, std.string(purchaseState), isAutoRenewing, { () -> bridge.std__optional_double_ in
28
+ }(), platform, quantity, purchaseState, isAutoRenewing, { () -> bridge.std__optional_double_ in
29
29
  if let __unwrappedValue = quantityIOS {
30
30
  return bridge.create_std__optional_double_(__unwrappedValue)
31
31
  } else {
@@ -163,14 +163,14 @@ public extension NitroPurchase {
163
163
  }
164
164
  }
165
165
 
166
- var platform: String {
166
+ var platform: IapPlatform {
167
167
  @inline(__always)
168
168
  get {
169
- return String(self.__platform)
169
+ return self.__platform
170
170
  }
171
171
  @inline(__always)
172
172
  set {
173
- self.__platform = std.string(newValue)
173
+ self.__platform = newValue
174
174
  }
175
175
  }
176
176
 
@@ -185,14 +185,14 @@ public extension NitroPurchase {
185
185
  }
186
186
  }
187
187
 
188
- var purchaseState: String {
188
+ var purchaseState: PurchaseState {
189
189
  @inline(__always)
190
190
  get {
191
- return String(self.__purchaseState)
191
+ return self.__purchaseState
192
192
  }
193
193
  @inline(__always)
194
194
  set {
195
- self.__purchaseState = std.string(newValue)
195
+ self.__purchaseState = newValue
196
196
  }
197
197
  }
198
198
 
@@ -18,63 +18,63 @@ public extension NitroReceiptValidationAndroidOptions {
18
18
  /**
19
19
  * Create a new instance of `NitroReceiptValidationAndroidOptions`.
20
20
  */
21
- init(packageName: String, productToken: String, accessToken: String, isSub: Bool?) {
22
- self.init(std.string(packageName), std.string(productToken), std.string(accessToken), { () -> bridge.std__optional_bool_ in
21
+ init(accessToken: String, isSub: Bool?, packageName: String, productToken: String) {
22
+ self.init(std.string(accessToken), { () -> bridge.std__optional_bool_ in
23
23
  if let __unwrappedValue = isSub {
24
24
  return bridge.create_std__optional_bool_(__unwrappedValue)
25
25
  } else {
26
26
  return .init()
27
27
  }
28
- }())
28
+ }(), std.string(packageName), std.string(productToken))
29
29
  }
30
30
 
31
- var packageName: String {
31
+ var accessToken: String {
32
32
  @inline(__always)
33
33
  get {
34
- return String(self.__packageName)
34
+ return String(self.__accessToken)
35
35
  }
36
36
  @inline(__always)
37
37
  set {
38
- self.__packageName = std.string(newValue)
38
+ self.__accessToken = std.string(newValue)
39
39
  }
40
40
  }
41
41
 
42
- var productToken: String {
42
+ var isSub: Bool? {
43
43
  @inline(__always)
44
44
  get {
45
- return String(self.__productToken)
45
+ return self.__isSub.value
46
46
  }
47
47
  @inline(__always)
48
48
  set {
49
- self.__productToken = std.string(newValue)
49
+ self.__isSub = { () -> bridge.std__optional_bool_ in
50
+ if let __unwrappedValue = newValue {
51
+ return bridge.create_std__optional_bool_(__unwrappedValue)
52
+ } else {
53
+ return .init()
54
+ }
55
+ }()
50
56
  }
51
57
  }
52
58
 
53
- var accessToken: String {
59
+ var packageName: String {
54
60
  @inline(__always)
55
61
  get {
56
- return String(self.__accessToken)
62
+ return String(self.__packageName)
57
63
  }
58
64
  @inline(__always)
59
65
  set {
60
- self.__accessToken = std.string(newValue)
66
+ self.__packageName = std.string(newValue)
61
67
  }
62
68
  }
63
69
 
64
- var isSub: Bool? {
70
+ var productToken: String {
65
71
  @inline(__always)
66
72
  get {
67
- return self.__isSub.value
73
+ return String(self.__productToken)
68
74
  }
69
75
  @inline(__always)
70
76
  set {
71
- self.__isSub = { () -> bridge.std__optional_bool_ in
72
- if let __unwrappedValue = newValue {
73
- return bridge.create_std__optional_bool_(__unwrappedValue)
74
- } else {
75
- return .init()
76
- }
77
- }()
77
+ self.__productToken = std.string(newValue)
78
78
  }
79
79
  }
80
80
  }
@@ -18,22 +18,28 @@ public extension NitroReceiptValidationResultAndroid {
18
18
  /**
19
19
  * Create a new instance of `NitroReceiptValidationResultAndroid`.
20
20
  */
21
- init(autoRenewing: Bool, betaProduct: Bool, cancelDate: Double?, cancelReason: String, deferredDate: Double?, deferredSku: Double?, freeTrialEndDate: Double, gracePeriodEndDate: Double, parentProductId: String, productId: String, productType: String, purchaseDate: Double, quantity: Double, receiptId: String, renewalDate: Double, term: String, termSku: String, testTransaction: Bool) {
21
+ init(autoRenewing: Bool, betaProduct: Bool, cancelDate: Double?, cancelReason: String?, deferredDate: Double?, deferredSku: String?, freeTrialEndDate: Double, gracePeriodEndDate: Double, parentProductId: String, productId: String, productType: String, purchaseDate: Double, quantity: Double, receiptId: String, renewalDate: Double, term: String, termSku: String, testTransaction: Bool) {
22
22
  self.init(autoRenewing, betaProduct, { () -> bridge.std__optional_double_ in
23
23
  if let __unwrappedValue = cancelDate {
24
24
  return bridge.create_std__optional_double_(__unwrappedValue)
25
25
  } else {
26
26
  return .init()
27
27
  }
28
- }(), std.string(cancelReason), { () -> bridge.std__optional_double_ in
28
+ }(), { () -> bridge.std__optional_std__string_ in
29
+ if let __unwrappedValue = cancelReason {
30
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
31
+ } else {
32
+ return .init()
33
+ }
34
+ }(), { () -> bridge.std__optional_double_ in
29
35
  if let __unwrappedValue = deferredDate {
30
36
  return bridge.create_std__optional_double_(__unwrappedValue)
31
37
  } else {
32
38
  return .init()
33
39
  }
34
- }(), { () -> bridge.std__optional_double_ in
40
+ }(), { () -> bridge.std__optional_std__string_ in
35
41
  if let __unwrappedValue = deferredSku {
36
- return bridge.create_std__optional_double_(__unwrappedValue)
42
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
37
43
  } else {
38
44
  return .init()
39
45
  }
@@ -79,14 +85,27 @@ public extension NitroReceiptValidationResultAndroid {
79
85
  }
80
86
  }
81
87
 
82
- var cancelReason: String {
88
+ var cancelReason: String? {
83
89
  @inline(__always)
84
90
  get {
85
- return String(self.__cancelReason)
91
+ return { () -> String? in
92
+ if bridge.has_value_std__optional_std__string_(self.__cancelReason) {
93
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__cancelReason)
94
+ return String(__unwrapped)
95
+ } else {
96
+ return nil
97
+ }
98
+ }()
86
99
  }
87
100
  @inline(__always)
88
101
  set {
89
- self.__cancelReason = std.string(newValue)
102
+ self.__cancelReason = { () -> bridge.std__optional_std__string_ in
103
+ if let __unwrappedValue = newValue {
104
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
105
+ } else {
106
+ return .init()
107
+ }
108
+ }()
90
109
  }
91
110
  }
92
111
 
@@ -107,16 +126,23 @@ public extension NitroReceiptValidationResultAndroid {
107
126
  }
108
127
  }
109
128
 
110
- var deferredSku: Double? {
129
+ var deferredSku: String? {
111
130
  @inline(__always)
112
131
  get {
113
- return self.__deferredSku.value
132
+ return { () -> String? in
133
+ if bridge.has_value_std__optional_std__string_(self.__deferredSku) {
134
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__deferredSku)
135
+ return String(__unwrapped)
136
+ } else {
137
+ return nil
138
+ }
139
+ }()
114
140
  }
115
141
  @inline(__always)
116
142
  set {
117
- self.__deferredSku = { () -> bridge.std__optional_double_ in
143
+ self.__deferredSku = { () -> bridge.std__optional_std__string_ in
118
144
  if let __unwrappedValue = newValue {
119
- return bridge.create_std__optional_double_(__unwrappedValue)
145
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
120
146
  } else {
121
147
  return .init()
122
148
  }