mobilyflow-react-native-sdk 0.1.0-alpha.1 → 0.1.0-alpha.3
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/lib/commonjs/MobilyPurchaseSDK.js +158 -0
- package/lib/commonjs/MobilyPurchaseSDK.js.map +1 -0
- package/lib/commonjs/NativeMobilyflowReactNativeSdk.js +9 -0
- package/lib/commonjs/NativeMobilyflowReactNativeSdk.js.map +1 -0
- package/lib/commonjs/entities/mobily-customer-entitlement.js +30 -0
- package/lib/commonjs/entities/mobily-customer-entitlement.js.map +1 -0
- package/lib/commonjs/entities/mobily-one-time-product.js +9 -0
- package/lib/commonjs/entities/mobily-one-time-product.js.map +1 -0
- package/lib/commonjs/entities/mobily-product.js +16 -0
- package/lib/commonjs/entities/mobily-product.js.map +1 -0
- package/lib/commonjs/entities/mobily-subscription-group.js +19 -0
- package/lib/commonjs/entities/mobily-subscription-group.js.map +1 -0
- package/lib/commonjs/entities/mobily-subscription-offer.js +9 -0
- package/lib/commonjs/entities/mobily-subscription-offer.js.map +1 -0
- package/lib/commonjs/entities/mobily-subscription-product.js +9 -0
- package/lib/commonjs/entities/mobily-subscription-product.js.map +1 -0
- package/lib/commonjs/enums/mobily-environment.js +13 -0
- package/lib/commonjs/enums/mobily-environment.js.map +1 -0
- package/lib/commonjs/enums/period-unit.js +13 -0
- package/lib/commonjs/enums/period-unit.js.map +1 -0
- package/lib/commonjs/enums/platform.js +12 -0
- package/lib/commonjs/enums/platform.js.map +1 -0
- package/lib/commonjs/enums/product-status.js +13 -0
- package/lib/commonjs/enums/product-status.js.map +1 -0
- package/lib/commonjs/enums/product-type.js +12 -0
- package/lib/commonjs/enums/product-type.js.map +1 -0
- package/lib/commonjs/enums/webhook-status.js +13 -0
- package/lib/commonjs/enums/webhook-status.js.map +1 -0
- package/lib/commonjs/errors/mobily-error.js +26 -0
- package/lib/commonjs/errors/mobily-error.js.map +1 -0
- package/lib/commonjs/errors/mobily-purchase-error.js +34 -0
- package/lib/commonjs/errors/mobily-purchase-error.js.map +1 -0
- package/lib/commonjs/errors/mobily-transfer-ownership-error.js +27 -0
- package/lib/commonjs/errors/mobily-transfer-ownership-error.js.map +1 -0
- package/lib/commonjs/index.js +130 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/utils/object-transformer.js +59 -0
- package/lib/commonjs/utils/object-transformer.js.map +1 -0
- package/lib/module/MobilyPurchaseSDK.js +152 -0
- package/lib/module/MobilyPurchaseSDK.js.map +1 -0
- package/lib/module/NativeMobilyflowReactNativeSdk.js +5 -0
- package/lib/module/NativeMobilyflowReactNativeSdk.js.map +1 -0
- package/lib/module/entities/mobily-customer-entitlement.js +23 -0
- package/lib/module/entities/mobily-customer-entitlement.js.map +1 -0
- package/lib/module/entities/mobily-one-time-product.js +4 -0
- package/lib/module/entities/mobily-one-time-product.js.map +1 -0
- package/lib/module/entities/mobily-product.js +11 -0
- package/lib/module/entities/mobily-product.js.map +1 -0
- package/lib/module/entities/mobily-subscription-group.js +14 -0
- package/lib/module/entities/mobily-subscription-group.js.map +1 -0
- package/lib/module/entities/mobily-subscription-offer.js +4 -0
- package/lib/module/entities/mobily-subscription-offer.js.map +1 -0
- package/lib/module/entities/mobily-subscription-product.js +4 -0
- package/lib/module/entities/mobily-subscription-product.js.map +1 -0
- package/lib/module/enums/mobily-environment.js +9 -0
- package/lib/module/enums/mobily-environment.js.map +1 -0
- package/lib/module/enums/period-unit.js +9 -0
- package/lib/module/enums/period-unit.js.map +1 -0
- package/lib/module/enums/platform.js +8 -0
- package/lib/module/enums/platform.js.map +1 -0
- package/lib/module/enums/product-status.js +9 -0
- package/lib/module/enums/product-status.js.map +1 -0
- package/lib/module/enums/product-type.js +8 -0
- package/lib/module/enums/product-type.js.map +1 -0
- package/lib/module/enums/webhook-status.js +9 -0
- package/lib/module/enums/webhook-status.js.map +1 -0
- package/lib/module/errors/mobily-error.js +21 -0
- package/lib/module/errors/mobily-error.js.map +1 -0
- package/lib/module/errors/mobily-purchase-error.js +29 -0
- package/lib/module/errors/mobily-purchase-error.js.map +1 -0
- package/lib/module/errors/mobily-transfer-ownership-error.js +22 -0
- package/lib/module/errors/mobily-transfer-ownership-error.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/utils/object-transformer.js +54 -0
- package/lib/module/utils/object-transformer.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/MobilyPurchaseSDK.d.ts +30 -0
- package/lib/typescript/commonjs/src/MobilyPurchaseSDK.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeMobilyflowReactNativeSdk.d.ts +34 -0
- package/lib/typescript/commonjs/src/NativeMobilyflowReactNativeSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-customer-entitlement.d.ts +23 -0
- package/lib/typescript/commonjs/src/entities/mobily-customer-entitlement.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-one-time-product.d.ts +11 -0
- package/lib/typescript/commonjs/src/entities/mobily-one-time-product.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-product.d.ts +23 -0
- package/lib/typescript/commonjs/src/entities/mobily-product.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-group.d.ts +12 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-group.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-offer.d.ts +16 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-offer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-product.d.ts +13 -0
- package/lib/typescript/commonjs/src/entities/mobily-subscription-product.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/mobily-environment.d.ts +6 -0
- package/lib/typescript/commonjs/src/enums/mobily-environment.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/period-unit.d.ts +6 -0
- package/lib/typescript/commonjs/src/enums/period-unit.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/platform.d.ts +5 -0
- package/lib/typescript/commonjs/src/enums/platform.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/product-status.d.ts +6 -0
- package/lib/typescript/commonjs/src/enums/product-status.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/product-type.d.ts +5 -0
- package/lib/typescript/commonjs/src/enums/product-type.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/webhook-status.d.ts +6 -0
- package/lib/typescript/commonjs/src/enums/webhook-status.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/errors/mobily-error.d.ts +15 -0
- package/lib/typescript/commonjs/src/errors/mobily-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/errors/mobily-purchase-error.d.ts +23 -0
- package/lib/typescript/commonjs/src/errors/mobily-purchase-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/errors/mobily-transfer-ownership-error.d.ts +16 -0
- package/lib/typescript/commonjs/src/errors/mobily-transfer-ownership-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +18 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/object-transformer.d.ts +37 -0
- package/lib/typescript/commonjs/src/utils/object-transformer.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/MobilyPurchaseSDK.d.ts +30 -0
- package/lib/typescript/module/src/MobilyPurchaseSDK.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeMobilyflowReactNativeSdk.d.ts +34 -0
- package/lib/typescript/module/src/NativeMobilyflowReactNativeSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-customer-entitlement.d.ts +23 -0
- package/lib/typescript/module/src/entities/mobily-customer-entitlement.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-one-time-product.d.ts +11 -0
- package/lib/typescript/module/src/entities/mobily-one-time-product.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-product.d.ts +23 -0
- package/lib/typescript/module/src/entities/mobily-product.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-subscription-group.d.ts +12 -0
- package/lib/typescript/module/src/entities/mobily-subscription-group.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-subscription-offer.d.ts +16 -0
- package/lib/typescript/module/src/entities/mobily-subscription-offer.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-subscription-product.d.ts +13 -0
- package/lib/typescript/module/src/entities/mobily-subscription-product.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/mobily-environment.d.ts +6 -0
- package/lib/typescript/module/src/enums/mobily-environment.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/period-unit.d.ts +6 -0
- package/lib/typescript/module/src/enums/period-unit.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/platform.d.ts +5 -0
- package/lib/typescript/module/src/enums/platform.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/product-status.d.ts +6 -0
- package/lib/typescript/module/src/enums/product-status.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/product-type.d.ts +5 -0
- package/lib/typescript/module/src/enums/product-type.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/webhook-status.d.ts +6 -0
- package/lib/typescript/module/src/enums/webhook-status.d.ts.map +1 -0
- package/lib/typescript/module/src/errors/mobily-error.d.ts +15 -0
- package/lib/typescript/module/src/errors/mobily-error.d.ts.map +1 -0
- package/lib/typescript/module/src/errors/mobily-purchase-error.d.ts +23 -0
- package/lib/typescript/module/src/errors/mobily-purchase-error.d.ts.map +1 -0
- package/lib/typescript/module/src/errors/mobily-transfer-ownership-error.d.ts +16 -0
- package/lib/typescript/module/src/errors/mobily-transfer-ownership-error.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +18 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/object-transformer.d.ts +37 -0
- package/lib/typescript/module/src/utils/object-transformer.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/MobilyPurchaseSDK.tsx +175 -0
- package/src/index.tsx +24 -175
package/src/index.tsx
CHANGED
@@ -1,175 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
export
|
13
|
-
|
14
|
-
|
15
|
-
};
|
16
|
-
|
17
|
-
export
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if (RNPlatform.OS === 'android') {
|
26
|
-
switch (error.name) {
|
27
|
-
case 'com.mobilyflow.mobilypurchasesdk.Exceptions.MobilyException':
|
28
|
-
return new MobilyError(parseInt(error.code, 10), error.message, error.nativeStackAndroid);
|
29
|
-
case 'com.mobilyflow.mobilypurchasesdk.Exceptions.MobilyPurchaseException':
|
30
|
-
return new MobilyPurchaseError(parseInt(error.code, 10), error.message, error.nativeStackAndroid);
|
31
|
-
case 'com.mobilyflow.mobilypurchasesdk.Exceptions.MobilyTransferOwnershipException':
|
32
|
-
return new MobilyTransferOwnershipError(parseInt(error.code, 10), error.message, error.nativeStackAndroid);
|
33
|
-
}
|
34
|
-
} else {
|
35
|
-
switch (error.domain) {
|
36
|
-
case 'MobilyflowSDK.MobilyError':
|
37
|
-
return new MobilyError(parseInt(error.code, 10), error.message, error.nativeStackIOS);
|
38
|
-
case 'MobilyflowSDK.MobilyPurchaseError':
|
39
|
-
return new MobilyPurchaseError(parseInt(error.code, 10), error.message, error.nativeStackIOS);
|
40
|
-
case 'MobilyflowSDK.MobilyTransferOwnershipError':
|
41
|
-
return new MobilyTransferOwnershipError(parseInt(error.code, 10), error.message, error.nativeStackIOS);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
return error;
|
46
|
-
}
|
47
|
-
|
48
|
-
close() {
|
49
|
-
try {
|
50
|
-
MobilyflowReactNativeSdk.close(this._uuid);
|
51
|
-
} catch (error: any) {
|
52
|
-
throw this.throwError(error);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
async login(externalId: string) {
|
57
|
-
try {
|
58
|
-
await MobilyflowReactNativeSdk.login(this._uuid, externalId);
|
59
|
-
} catch (error: any) {
|
60
|
-
throw this.throwError(error);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
async getProducts(identifiers?: string[], onlyAvailable = false): Promise<MobilyProduct[]> {
|
65
|
-
try {
|
66
|
-
const products = await MobilyflowReactNativeSdk.getProducts(this._uuid, identifiers, onlyAvailable);
|
67
|
-
return products.map(MobilyProduct.parseFromAPI);
|
68
|
-
} catch (error: any) {
|
69
|
-
throw this.throwError(error);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
async getSubscriptionGroups(identifiers?: string[], onlyAvailable = false) {
|
74
|
-
try {
|
75
|
-
const groups = await MobilyflowReactNativeSdk.getSubscriptionGroups(this._uuid, identifiers, onlyAvailable);
|
76
|
-
return groups.map(MobilySubscriptionGroup.parseFromAPI);
|
77
|
-
} catch (error: any) {
|
78
|
-
throw this.throwError(error);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
async getEntitlementForSubscription(subscriptionGroupId: string) {
|
83
|
-
try {
|
84
|
-
const entitlement = await MobilyflowReactNativeSdk.getEntitlementForSubscription(this._uuid, subscriptionGroupId);
|
85
|
-
return MobilyCustomerEntitlement.parseFromAPI(entitlement);
|
86
|
-
} catch (error: any) {
|
87
|
-
throw this.throwError(error);
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
async getEntitlement(productId: string) {
|
92
|
-
try {
|
93
|
-
const entitlement = await MobilyflowReactNativeSdk.getEntitlement(this._uuid, productId);
|
94
|
-
return MobilyCustomerEntitlement.parseFromAPI(entitlement);
|
95
|
-
} catch (error: any) {
|
96
|
-
throw this.throwError(error);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
async getEntitlements(productIds: string[]) {
|
101
|
-
try {
|
102
|
-
const entitlements = await MobilyflowReactNativeSdk.getEntitlements(this._uuid, productIds);
|
103
|
-
return entitlements.map(MobilyCustomerEntitlement.parseFromAPI);
|
104
|
-
} catch (error: any) {
|
105
|
-
throw this.throwError(error);
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
async requestTransferOwnership() {
|
110
|
-
try {
|
111
|
-
return await MobilyflowReactNativeSdk.requestTransferOwnership(this._uuid);
|
112
|
-
} catch (error: any) {
|
113
|
-
throw this.throwError(error);
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
async openManageSubscription() {
|
118
|
-
try {
|
119
|
-
return await MobilyflowReactNativeSdk.openManageSubscription(this._uuid);
|
120
|
-
} catch (error: any) {
|
121
|
-
throw this.throwError(error);
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
async openRefundDialog(transactionId: string): Promise<boolean> {
|
126
|
-
if (RNPlatform.OS === 'android') {
|
127
|
-
throw new Error('openRefundDialog not implemented on Android');
|
128
|
-
} else {
|
129
|
-
try {
|
130
|
-
return await MobilyflowReactNativeSdk.openRefundDialog(this._uuid, transactionId);
|
131
|
-
} catch (error: any) {
|
132
|
-
throw this.throwError(error);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
async purchaseProduct(product: MobilyProduct, options?: PurchaseOptions): Promise<WebhookStatus> {
|
138
|
-
try {
|
139
|
-
return await MobilyflowReactNativeSdk.purchaseProduct(this._uuid, product.id, {
|
140
|
-
offerId: options?.offer?.id || null,
|
141
|
-
quantity: options?.quantity || null,
|
142
|
-
});
|
143
|
-
} catch (error: any) {
|
144
|
-
throw this.throwError(error);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
sendDiagnotic() {
|
149
|
-
try {
|
150
|
-
return MobilyflowReactNativeSdk.sendDiagnotic(this._uuid);
|
151
|
-
} catch (error: any) {
|
152
|
-
throw this.throwError(error);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
async getStoreCountry() {
|
157
|
-
if (RNPlatform.OS === 'android') {
|
158
|
-
throw new Error('getStoreCountry not implemented on Android');
|
159
|
-
} else {
|
160
|
-
try {
|
161
|
-
return await MobilyflowReactNativeSdk.getStoreCountry(this._uuid);
|
162
|
-
} catch (error: any) {
|
163
|
-
throw this.throwError(error);
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
async isForwardingEnable() {
|
169
|
-
try {
|
170
|
-
return await MobilyflowReactNativeSdk.isForwardingEnable(this._uuid);
|
171
|
-
} catch (error: any) {
|
172
|
-
throw this.throwError(error);
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|
1
|
+
export type { PurchaseOptions } from './MobilyPurchaseSDK';
|
2
|
+
export { MobilyPurchaseSDK } from './MobilyPurchaseSDK';
|
3
|
+
|
4
|
+
export { MobilyProduct } from './entities/mobily-product';
|
5
|
+
export {
|
6
|
+
MobilyCustomerEntitlement,
|
7
|
+
ItemEntitlement,
|
8
|
+
SubscriptionEntitlement,
|
9
|
+
} from './entities/mobily-customer-entitlement';
|
10
|
+
export { MobilyOneTimeProduct } from './entities/mobily-one-time-product';
|
11
|
+
export { MobilySubscriptionProduct } from './entities/mobily-subscription-product';
|
12
|
+
export { MobilySubscriptionGroup } from './entities/mobily-subscription-group';
|
13
|
+
export { MobilySubscriptionOffer } from './entities/mobily-subscription-offer';
|
14
|
+
|
15
|
+
export { MobilyEnvironment } from './enums/mobily-environment';
|
16
|
+
export { PeriodUnit } from './enums/period-unit';
|
17
|
+
export { Platform } from './enums/platform';
|
18
|
+
export { ProductStatus } from './enums/product-status';
|
19
|
+
export { ProductType } from './enums/product-type';
|
20
|
+
export { WebhookStatus } from './enums/webhook-status';
|
21
|
+
|
22
|
+
export { MobilyError } from './errors/mobily-error';
|
23
|
+
export { MobilyPurchaseError } from './errors/mobily-purchase-error';
|
24
|
+
export { MobilyTransferOwnershipError } from './errors/mobily-transfer-ownership-error';
|