capacitor-jok-helper
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -35,3 +35,42 @@ declare module "@capacitor/core" { | ||
}>; | ||
canMakePayments(): Promise<{ | ||
value: boolean; | ||
}>; | ||
loadProducts(data: LoadProductsProps): Promise<{ | ||
success: boolean; | ||
products: SKProduct[]; | ||
invalidProducts: string[]; | ||
}>; | ||
requestPayment(data: RequestPaymentProps): Promise<{ | ||
success: boolean; | ||
message: string; | ||
}>; | ||
finishPayment(data: FinishPaymentProps): Promise<{ | ||
success: boolean; | ||
message: string; | ||
}>; | ||
listenTransactionStateChanges(): Promise<void>; | ||
} | ||
export interface LoadProductsProps { | ||
productIds: string[]; | ||
} | ||
export interface SKProduct { | ||
localizedDescription: string; | ||
localizedTitle: string; | ||
price: number; | ||
formattedPrice: string; | ||
currencySymbol: string; | ||
currencyCode: string; | ||
productIdentifier: string; | ||
isDownloadable: boolean; | ||
downloadContentLengths: number; | ||
contentVersion: string; | ||
downloadContentVersion: string; | ||
} | ||
export interface RequestPaymentProps { | ||
productId: string; | ||
} | ||
export interface FinishPaymentProps { | ||
transactionId: string; | ||
} | ||
export interface SetKeychainItemProps { | ||
@@ -87,1 +126,35 @@ key: string; | ||
} | ||
export interface TransactionStateChangeData { | ||
transactionId: string; | ||
transactionDate: Date; | ||
productId: string; | ||
state: TransactionState; | ||
hasError: boolean; | ||
errorCode?: TransactionErrorCode; | ||
errorMessage?: string; | ||
} | ||
declare enum TransactionState { | ||
Purchasing = 0, | ||
Purchased = 1, | ||
Failed = 2, | ||
Restored = 3, | ||
Deferred = 4 | ||
} | ||
declare enum TransactionErrorCode { | ||
unknown = 0, | ||
clientInvalid = 1, | ||
paymentCancelled = 2, | ||
paymentInvalid = 3, | ||
paymentNotAllowed = 4, | ||
storeProductNotAvailable = 5, | ||
cloudServicePermissionDenied = 6, | ||
cloudServiceNetworkConnectionFailed = 7, | ||
cloudServiceRevoked = 8, | ||
privacyAcknowledgementRequired = 9, | ||
unauthorizedRequestData = 10, | ||
invalidOfferIdentifier = 11, | ||
invalidSignature = 12, | ||
missingOfferParams = 13, | ||
invalidOfferPrice = 14 | ||
} | ||
export {}; |
@@ -24,2 +24,47 @@ export var PushNotificationStateUserStatus; | ||
})(JokPluginEvents || (JokPluginEvents = {})); | ||
var TransactionState; | ||
(function (TransactionState) { | ||
// Transaction is being added to the server queue. | ||
TransactionState[TransactionState["Purchasing"] = 0] = "Purchasing"; | ||
// Transaction is in queue, user has been charged. Client should complete the transaction. | ||
TransactionState[TransactionState["Purchased"] = 1] = "Purchased"; | ||
// Transaction was cancelled or failed before being added to the server queue. | ||
TransactionState[TransactionState["Failed"] = 2] = "Failed"; | ||
// Transaction was restored from user's purchase history. Client should complete the transaction. | ||
TransactionState[TransactionState["Restored"] = 3] = "Restored"; | ||
// The transaction is in the queue, but its final status is pending external action. | ||
TransactionState[TransactionState["Deferred"] = 4] = "Deferred"; | ||
})(TransactionState || (TransactionState = {})); | ||
var TransactionErrorCode; | ||
(function (TransactionErrorCode) { | ||
TransactionErrorCode[TransactionErrorCode["unknown"] = 0] = "unknown"; | ||
// client is not allowed to issue the request, etc. | ||
TransactionErrorCode[TransactionErrorCode["clientInvalid"] = 1] = "clientInvalid"; | ||
// user cancelled the request, etc. | ||
TransactionErrorCode[TransactionErrorCode["paymentCancelled"] = 2] = "paymentCancelled"; | ||
// purchase identifier was invalid, etc. | ||
TransactionErrorCode[TransactionErrorCode["paymentInvalid"] = 3] = "paymentInvalid"; | ||
// this device is not allowed to make the payment | ||
TransactionErrorCode[TransactionErrorCode["paymentNotAllowed"] = 4] = "paymentNotAllowed"; | ||
// Product is not available in the current storefront | ||
TransactionErrorCode[TransactionErrorCode["storeProductNotAvailable"] = 5] = "storeProductNotAvailable"; | ||
// user has not allowed access to cloud service information | ||
TransactionErrorCode[TransactionErrorCode["cloudServicePermissionDenied"] = 6] = "cloudServicePermissionDenied"; | ||
// the device could not connect to the nework | ||
TransactionErrorCode[TransactionErrorCode["cloudServiceNetworkConnectionFailed"] = 7] = "cloudServiceNetworkConnectionFailed"; | ||
// user has revoked permission to use this cloud service | ||
TransactionErrorCode[TransactionErrorCode["cloudServiceRevoked"] = 8] = "cloudServiceRevoked"; | ||
// The user needs to acknowledge Apple's privacy policy | ||
TransactionErrorCode[TransactionErrorCode["privacyAcknowledgementRequired"] = 9] = "privacyAcknowledgementRequired"; | ||
// The app is attempting to use SKPayment's requestData property, but does not have the appropriate entitlement | ||
TransactionErrorCode[TransactionErrorCode["unauthorizedRequestData"] = 10] = "unauthorizedRequestData"; | ||
// The specified subscription offer identifier is not valid | ||
TransactionErrorCode[TransactionErrorCode["invalidOfferIdentifier"] = 11] = "invalidOfferIdentifier"; | ||
// The cryptographic signature provided is not valid | ||
TransactionErrorCode[TransactionErrorCode["invalidSignature"] = 12] = "invalidSignature"; | ||
// One or more parameters from SKPaymentDiscount is missing | ||
TransactionErrorCode[TransactionErrorCode["missingOfferParams"] = 13] = "missingOfferParams"; | ||
// The price of the selected offer is not valid (e.g. lower than the current base subscription price) | ||
TransactionErrorCode[TransactionErrorCode["invalidOfferPrice"] = 14] = "invalidOfferPrice"; | ||
})(TransactionErrorCode || (TransactionErrorCode = {})); | ||
//# sourceMappingURL=definitions.js.map |
import { WebPlugin } from '@capacitor/core'; | ||
import { JokHelperPlugin, SetKeychainItemProps, SetOrientationLockProps } from './definitions'; | ||
import { JokHelperPlugin, SetKeychainItemProps, SetOrientationLockProps, LoadProductsProps, SKProduct, RequestPaymentProps, FinishPaymentProps } from './definitions'; | ||
export declare class JokHelperWeb extends WebPlugin implements JokHelperPlugin { | ||
@@ -33,4 +33,21 @@ constructor(); | ||
}>; | ||
canMakePayments(): Promise<{ | ||
value: boolean; | ||
}>; | ||
loadProducts(_: LoadProductsProps): Promise<{ | ||
success: boolean; | ||
products: SKProduct[]; | ||
invalidProducts: string[]; | ||
}>; | ||
requestPayment(_: RequestPaymentProps): Promise<{ | ||
success: boolean; | ||
message: string; | ||
}>; | ||
finishPayment(_: FinishPaymentProps): Promise<{ | ||
success: boolean; | ||
message: string; | ||
}>; | ||
listenTransactionStateChanges(): Promise<void>; | ||
} | ||
declare const JokHelper: JokHelperWeb; | ||
export { JokHelper }; |
@@ -63,16 +63,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
getPushNotificationsState() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Promise.resolve(null); | ||
}); | ||
return Promise.resolve(null); | ||
} | ||
askPushNotificationsPermission() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return { accepted: false }; | ||
}); | ||
return Promise.resolve({ accepted: false }); | ||
} | ||
openAppSettings() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Promise.resolve({ success: false }); | ||
return Promise.resolve({ success: false }); | ||
} | ||
canMakePayments() { | ||
return Promise.resolve({ value: false }); | ||
} | ||
loadProducts(_) { | ||
return Promise.resolve({ | ||
success: false, | ||
products: [], | ||
invalidProducts: [], | ||
}); | ||
} | ||
requestPayment(_) { | ||
return Promise.resolve({ | ||
success: false, | ||
message: '', | ||
}); | ||
} | ||
finishPayment(_) { | ||
return Promise.resolve({ | ||
success: false, | ||
message: '', | ||
}); | ||
} | ||
listenTransactionStateChanges() { | ||
return Promise.resolve(null); | ||
} | ||
} | ||
@@ -79,0 +98,0 @@ const JokHelper = new JokHelperWeb(); |
{ | ||
"name": "capacitor-jok-helper", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "Helper functions for jok projects", | ||
@@ -5,0 +5,0 @@ "main": "dist/esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150470
382