@tinkerlandai/longplay-react-native 0.10.6 → 0.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/native-sdk/android/assets/indiana/index.html +3 -3
- package/native-sdk/android/java/ai/tinkerland/indiana/IndianaClient.kt +5 -1
- package/native-sdk/android/java/ai/tinkerland/indiana/SDKVersion.kt +1 -1
- package/native-sdk/ios/IndianaClient.swift +7 -1
- package/native-sdk/ios/SDKVersion.swift +1 -1
- package/native-sdk/ios/WebView/index.html +3 -3
- package/package.json +1 -1
|
@@ -344,7 +344,11 @@ class IndianaClient internal constructor(private val configuration: IndianaConfi
|
|
|
344
344
|
suspend fun previewAttach(requestId: UUID, plans: List<IndianaSubscriptionPlan>, provider: IndianaSubscriptionProvider, currency: String, billingSubscriptionId: UUID? = null, offerId: UUID? = null, nativeOffer: IndianaNativeStoreOffer? = null): JSONObject {
|
|
345
345
|
if (plans.size !in 1..20 || plans.map { it.productVersionId }.distinct().size != plans.size || !currency.matches(Regex("[A-Z]{3}")) || plans.any { it.featureQuantities.size > 100 || it.featureQuantities.values.any { q -> q !in 0..10000 } || it.seatQuantities.size > 20 || it.seatQuantities.any { (key, quantity) -> !key.matches(Regex("[a-z][a-z0-9_]{0,63}")) || quantity !in 0..10000 } }) throw IndianaClientException("invalid_request")
|
|
346
346
|
val entries = JSONArray()
|
|
347
|
-
|
|
347
|
+
// Empty quantity maps are omitted: the contract treats them as absent and the deployed runtime refuses an empty object.
|
|
348
|
+
plans.forEach { plan -> entries.put(JSONObject().put("productVersionId", plan.productVersionId.toString()).apply {
|
|
349
|
+
if (plan.seatQuantities.isNotEmpty()) put("seatQuantities", JSONObject(plan.seatQuantities))
|
|
350
|
+
if (plan.featureQuantities.isNotEmpty()) put("featureQuantities", JSONObject(plan.featureQuantities.mapKeys { entry -> entry.key.toString() }))
|
|
351
|
+
}) }
|
|
348
352
|
val body = JSONObject().put("requestId", requestId.toString()).put("plans", entries).put("provider", provider.value).put("currency", currency)
|
|
349
353
|
billingSubscriptionId?.let { body.put("billingSubscriptionId", it.toString()) }
|
|
350
354
|
if (nativeOffer != null && (!nativeOffer.matches(provider) || plans.size != 1) ||
|
|
@@ -498,7 +498,13 @@ public actor IndianaClient {
|
|
|
498
498
|
guard (1...20).contains(plans.count), Set(plans.map(\.productVersionId)).count == plans.count,
|
|
499
499
|
currency.range(of: "^[A-Z]{3}$", options: .regularExpression) != nil,
|
|
500
500
|
plans.allSatisfy({ $0.featureQuantities.count <= 100 && $0.featureQuantities.values.allSatisfy { (0...10000).contains($0) } && $0.seatQuantities.count <= 20 && $0.seatQuantities.allSatisfy { $0.key.range(of: "^[a-z][a-z0-9_]{0,63}$", options: .regularExpression) != nil && (0...10000).contains($0.value) } }) else { throw IndianaClientError.invalidResponse }
|
|
501
|
-
|
|
501
|
+
// Empty quantity maps are omitted: the contract treats them as absent and the deployed runtime refuses an empty object.
|
|
502
|
+
let entries = plans.map { plan -> IndianaJSON in
|
|
503
|
+
var entry: [String: IndianaJSON] = ["productVersionId": .string(plan.productVersionId.uuidString.lowercased())]
|
|
504
|
+
if !plan.seatQuantities.isEmpty { entry["seatQuantities"] = .object(plan.seatQuantities.mapValues { .number(Double($0)) }) }
|
|
505
|
+
if !plan.featureQuantities.isEmpty { entry["featureQuantities"] = .object(Dictionary(uniqueKeysWithValues: plan.featureQuantities.map { ($0.key.uuidString.lowercased(), IndianaJSON.number(Double($0.value))) })) }
|
|
506
|
+
return .object(entry)
|
|
507
|
+
}
|
|
502
508
|
var fields: [String: IndianaJSON] = ["requestId":.string(requestId.uuidString.lowercased()), "plans":.array(entries), "provider":.string(provider.rawValue), "currency":.string(currency)]
|
|
503
509
|
if let billingSubscriptionId { fields["billingSubscriptionId"] = .string(billingSubscriptionId.uuidString.lowercased()) }
|
|
504
510
|
guard nativeOffer == nil || (nativeOffer!.matches(provider) && plans.count == 1),
|