@dicty/payment 2.0.6 → 2.0.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 CHANGED
@@ -2,45 +2,13 @@
2
2
 
3
3
  Dicty Payment Plugin for Capacitor apps
4
4
 
5
- ## Overview
6
-
7
- `@dicty/payment` bridges Capacitor projects to native Apple in-app purchases and Google Pay flows. It ships with TypeScript definitions, a React context provider, and native shims for iOS, Android, and the web fallback.
8
-
9
- ## Installation
5
+ ## Install
10
6
 
11
7
  ```bash
12
8
  npm install @dicty/payment
13
9
  npx cap sync
14
10
  ```
15
11
 
16
- After syncing, open Android Studio/Xcode to let Gradle/CocoaPods refresh native dependencies.
17
-
18
- ## Usage
19
-
20
- ```ts
21
- import { Payment } from '@dicty/payment';
22
-
23
- const available = await Payment.isAppleInAppPurchaseAvailable();
24
- if (available) {
25
- const { products } = await Payment.getAppleInAppPurchaseProducts({ id: ['premium_monthly'] });
26
- await Payment.buyAppleInAppPurchase({ id: products[0].id });
27
- }
28
- ```
29
-
30
- For React apps, wrap your tree with the provider:
31
-
32
- ```tsx
33
- import { PaymentPluginProvider } from '@dicty/payment/react';
34
-
35
- <PaymentPluginProvider>{children}</PaymentPluginProvider>;
36
- ```
37
-
38
- ## Development
39
-
40
- - `npm run build` cleans, regenerates docs, compiles TypeScript, and bundles output via Rollup.
41
- - `npm run verify` runs iOS, Android, and web checks; execute before publishing changes.
42
- - `npm run fmt` formats TypeScript, Java, and Swift sources; `npm run lint` performs the read-only equivalent.
43
-
44
12
  ## API
45
13
 
46
14
  <docgen-index>
@@ -40,12 +40,6 @@ android {
40
40
  sourceCompatibility JavaVersion.VERSION_21
41
41
  targetCompatibility JavaVersion.VERSION_21
42
42
  }
43
-
44
- gradle.projectsEvaluated {
45
- tasks.withType(JavaCompile) {
46
- options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
47
- }
48
- }
49
43
  }
50
44
 
51
45
  repositories {
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAGX,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;CACC,CAAC;AA4DX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["export interface PaymentPlugin {\n /**\n * Check if Apple In-App Purchases are available on this device\n */\n isAppleInAppPurchaseAvailable(): Promise<void>;\n\n /**\n * Get Apple In-App Purchase products by their identifiers\n */\n getAppleInAppPurchaseProducts(\n opts: GetAppleInAppPurchaseProductsOptions,\n ): Promise<GetAppleInAppPurchaseProductsResult>;\n\n /**\n * Purchase an Apple In-App Purchase product\n */\n buyAppleInAppPurchase(opts: BuyAppleInAppPurchaseOptions): Promise<BuyAppleInAppPurchaseResult>;\n\n /**\n * Restore Apple In-App Purchase transactions\n */\n restoreAppleInAppPurchase(): Promise<RestoreAppleInAppPurchaseResult>;\n\n /**\n * Get Apple In-App Purchase receipt data\n */\n getAppleInAppPurchaseReceipt(): Promise<GetAppleInAppPurchaseReceiptResult>;\n\n /**\n * Check if Google Pay is available on this device\n */\n isGooglePayAvailable(): Promise<void>;\n\n /**\n * Handle Google Pay payment flow\n */\n handleGooglePay(opts: GooglePayOptions): Promise<GooglePayResult>;\n}\nexport const AppleInAppPurchaseStatus = {\n Completed: 'completed',\n Restored: 'restored',\n Cancelled: 'cancelled',\n Failed: 'failed',\n} as const;\n\nexport type AppleInAppPurchaseStatus = (typeof AppleInAppPurchaseStatus)[keyof typeof AppleInAppPurchaseStatus];\nexport const AppleSubscriptionPeriodUnit = {\n Day: 0,\n Week: 1,\n Month: 2,\n Year: 3,\n} as const;\n\nexport type AppleSubscriptionPeriodUnit = (typeof AppleSubscriptionPeriodUnit)[keyof typeof AppleSubscriptionPeriodUnit];\n\n\nexport declare type GetAppleInAppPurchaseProductsOptions = {\n id: string[];\n};\n\nexport declare type AppleInAppPurchaseProduct = {\n id: string;\n title: string;\n description: string;\n price: number;\n localizedPrice: string;\n subscriptionPeriod?: {\n value: number;\n unit: AppleSubscriptionPeriodUnit;\n };\n};\n\nexport declare type GetAppleInAppPurchaseProductsResult = {\n products: AppleInAppPurchaseProduct[];\n};\n\nexport declare type BuyAppleInAppPurchaseOptions = {\n id: string;\n};\n\nexport declare type BuyAppleInAppPurchaseResult =\n | CompletedAppleInAppPurchaseResult\n | RestoredAppleInAppPurchaseResult\n | FailedAppleInAppPurchaseResult\n | CancelledAppleInAppPurchaseResult;\n\nexport declare type CompletedAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Completed;\n productIdentifier: string;\n transactionIdentifier: string;\n};\n\nexport declare type RestoredAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Restored;\n} & Omit<CompletedAppleInAppPurchaseResult, 'status'>;\n\nexport declare type FailedAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Failed;\n productIdentifier?: string;\n transactionIdentifier?: string;\n};\n\nexport declare type CancelledAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Cancelled;\n} & Omit<FailedAppleInAppPurchaseResult, 'status'>;\n\nexport declare type RestoreAppleInAppPurchaseResult = BuyAppleInAppPurchaseResult;\n\nexport declare type GetAppleInAppPurchaseReceiptResult = {\n receiptData: string;\n};\nexport const GooglePayResults = {\n Completed: 'completed',\n Failed: 'failed',\n} as const;\n\nexport type GooglePayResults = (typeof GooglePayResults)[keyof typeof GooglePayResults];\nexport declare type GooglePayOptions = {\n clientSecret: string;\n};\nexport declare type GooglePayResult = {\n result: GooglePayResults;\n};\nexport declare type PaymentPluginContext = {\n plugin: PaymentPlugin;\n isAppleInAppPurchaseAvailable: boolean;\n isGooglePayAvailable: boolean;\n};\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAsCA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAGX,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;CACC,CAAC;AA4DX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["export interface PaymentPlugin {\n /**\n * Check if Apple In-App Purchases are available on this device\n */\n isAppleInAppPurchaseAvailable(): Promise<void>;\n\n /**\n * Get Apple In-App Purchase products by their identifiers\n */\n getAppleInAppPurchaseProducts(\n opts: GetAppleInAppPurchaseProductsOptions,\n ): Promise<GetAppleInAppPurchaseProductsResult>;\n\n /**\n * Purchase an Apple In-App Purchase product\n */\n buyAppleInAppPurchase(opts: BuyAppleInAppPurchaseOptions): Promise<BuyAppleInAppPurchaseResult>;\n\n /**\n * Restore Apple In-App Purchase transactions\n */\n restoreAppleInAppPurchase(): Promise<RestoreAppleInAppPurchaseResult>;\n\n /**\n * Get Apple In-App Purchase receipt data\n */\n getAppleInAppPurchaseReceipt(): Promise<GetAppleInAppPurchaseReceiptResult>;\n\n /**\n * Check if Google Pay is available on this device\n */\n isGooglePayAvailable(): Promise<void>;\n\n /**\n * Handle Google Pay payment flow\n */\n handleGooglePay(opts: GooglePayOptions): Promise<GooglePayResult>;\n}\nexport const AppleInAppPurchaseStatus = {\n Completed: 'completed',\n Restored: 'restored',\n Cancelled: 'cancelled',\n Failed: 'failed',\n} as const;\n\nexport type AppleInAppPurchaseStatus = (typeof AppleInAppPurchaseStatus)[keyof typeof AppleInAppPurchaseStatus];\nexport const AppleSubscriptionPeriodUnit = {\n Day: 0,\n Week: 1,\n Month: 2,\n Year: 3,\n} as const;\n\nexport type AppleSubscriptionPeriodUnit =\n (typeof AppleSubscriptionPeriodUnit)[keyof typeof AppleSubscriptionPeriodUnit];\n\nexport declare type GetAppleInAppPurchaseProductsOptions = {\n id: string[];\n};\n\nexport declare type AppleInAppPurchaseProduct = {\n id: string;\n title: string;\n description: string;\n price: number;\n localizedPrice: string;\n subscriptionPeriod?: {\n value: number;\n unit: AppleSubscriptionPeriodUnit;\n };\n};\n\nexport declare type GetAppleInAppPurchaseProductsResult = {\n products: AppleInAppPurchaseProduct[];\n};\n\nexport declare type BuyAppleInAppPurchaseOptions = {\n id: string;\n};\n\nexport declare type BuyAppleInAppPurchaseResult =\n | CompletedAppleInAppPurchaseResult\n | RestoredAppleInAppPurchaseResult\n | FailedAppleInAppPurchaseResult\n | CancelledAppleInAppPurchaseResult;\n\nexport declare type CompletedAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Completed;\n productIdentifier: string;\n transactionIdentifier: string;\n};\n\nexport declare type RestoredAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Restored;\n} & Omit<CompletedAppleInAppPurchaseResult, 'status'>;\n\nexport declare type FailedAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Failed;\n productIdentifier?: string;\n transactionIdentifier?: string;\n};\n\nexport declare type CancelledAppleInAppPurchaseResult = {\n status: typeof AppleInAppPurchaseStatus.Cancelled;\n} & Omit<FailedAppleInAppPurchaseResult, 'status'>;\n\nexport declare type RestoreAppleInAppPurchaseResult = BuyAppleInAppPurchaseResult;\n\nexport declare type GetAppleInAppPurchaseReceiptResult = {\n receiptData: string;\n};\nexport const GooglePayResults = {\n Completed: 'completed',\n Failed: 'failed',\n} as const;\n\nexport type GooglePayResults = (typeof GooglePayResults)[keyof typeof GooglePayResults];\nexport declare type GooglePayOptions = {\n clientSecret: string;\n};\nexport declare type GooglePayResult = {\n result: GooglePayResults;\n};\nexport declare type PaymentPluginContext = {\n plugin: PaymentPlugin;\n isAppleInAppPurchaseAvailable: boolean;\n isGooglePayAvailable: boolean;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACrD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { PaymentPlugin } from './definitions';\n\nconst Payment = registerPlugin<PaymentPlugin>('Payment', {\n web: () => import('./web').then((m) => new m.PaymentWeb()),\n});\n\nexport * from './definitions';\nexport { Payment };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CAC3D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { PaymentPlugin } from './definitions';\n\nconst Payment = registerPlugin<PaymentPlugin>('Payment', {\n web: () => import('./web').then((m) => new m.PaymentWeb()),\n});\n\nexport * from './definitions';\nexport { Payment };\n"]}
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useEffect, useState } from 'react';
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useEffect, useState } from 'react';
2
3
  import { Payment } from '../../index';
3
4
  const PaymentPluginContext = createContext({
4
5
  plugin: undefined,
@@ -41,12 +42,12 @@ export const PaymentPluginProvider = ({ fallback, children }) => {
41
42
  }
42
43
  }, [initialized]);
43
44
  if (!plugin) {
44
- return React.createElement(React.Fragment, null, fallback);
45
+ return _jsx(_Fragment, { children: fallback });
45
46
  }
46
- return (React.createElement(PaymentPluginContext.Provider, { value: {
47
+ return (_jsx(PaymentPluginContext.Provider, { value: {
47
48
  plugin,
48
49
  isGooglePayAvailable,
49
50
  isAppleInAppPurchaseAvailable,
50
- } }, children));
51
+ }, children: children }));
51
52
  };
52
53
  //# sourceMappingURL=PaymentPluginProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentPluginProvider.js","sourceRoot":"","sources":["../../../../src/provider/react/PaymentPluginProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,oBAAoB,GAAG,aAAa,CAA2B;IACjE,MAAM,EAAE,SAAgB;IACxB,6BAA6B,EAAE,KAAK;IACpC,oBAAoB,EAAE,KAAK;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAA6B,EAAE;IAC3D,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC5C,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,qBAAqB,GAAkC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3F,MAAM,CAAC,6BAA6B,EAAE,8BAA8B,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACjG,MAAM,CAAC,oBAAoB,EAAE,2BAA2B,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACrF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAAiB,CAAC;IACtD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE/D,SAAS,CAAC,GAAG,EAAE;QACX,KAAK,UAAU,UAAU;YACrB,IAAI,4BAA4B,CAAC;YACjC,IAAI,kBAAkB,CAAC;YACvB,IAAI,CAAC;gBACD,MAAM,OAAO,CAAC,6BAA6B,EAAE,CAAC;gBAC9C,4BAA4B,GAAG,IAAI,CAAC;YACxC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,4BAA4B,GAAG,KAAK,CAAC;YACzC,CAAC;YACD,IAAI,CAAC;gBACD,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBACrC,kBAAkB,GAAG,IAAI,CAAC;YAC9B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,kBAAkB,GAAG,KAAK,CAAC;YAC/B,CAAC;YACD,8BAA8B,CAAC,4BAA4B,CAAC,CAAC;YAC7D,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;YAChD,SAAS,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,cAAc,CAAC,IAAI,CAAC,CAAC;YACrB,UAAU,EAAE,CAAC;QACjB,CAAC;IACL,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,0CAAG,QAAQ,CAAI,CAAC;IAC3B,CAAC;IACD,OAAO,CACH,oBAAC,oBAAoB,CAAC,QAAQ,IAC1B,KAAK,EAAE;YACH,MAAM;YACN,oBAAoB;YACpB,6BAA6B;SAChC,IAEA,QAAQ,CACmB,CACnC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren, ReactNode } from 'react';\nimport React, { createContext, useContext, useEffect, useState } from 'react';\n\nimport type { PaymentPlugin, PaymentPluginContext as PaymentPluginContextType } from '../../definitions';\nimport { Payment } from '../../index';\n\nconst PaymentPluginContext = createContext<PaymentPluginContextType>({\n plugin: undefined as any,\n isAppleInAppPurchaseAvailable: false,\n isGooglePayAvailable: false,\n});\n\nexport const usePaymentPlugin = (): PaymentPluginContextType => {\n return useContext(PaymentPluginContext);\n};\n\nexport type PaymentPluginProviderType = PropsWithChildren<{\n fallback?: ReactNode;\n}>;\n\nexport const PaymentPluginProvider: FC<PaymentPluginProviderType> = ({ fallback, children }) => {\n const [isAppleInAppPurchaseAvailable, setAppleInAppPurchaseAvailable] = useState<boolean>(false);\n const [isGooglePayAvailable, setGooglePayAvailableStatus] = useState<boolean>(false);\n const [plugin, setPlugin] = useState<PaymentPlugin>();\n const [initialized, setInitialized] = useState<boolean>(false);\n\n useEffect(() => {\n async function initialize() {\n let appleInAppPurchasesAvailable;\n let googlePayAvailable;\n try {\n await Payment.isAppleInAppPurchaseAvailable();\n appleInAppPurchasesAvailable = true;\n } catch (e) {\n appleInAppPurchasesAvailable = false;\n }\n try {\n await Payment.isGooglePayAvailable();\n googlePayAvailable = true;\n } catch (e) {\n googlePayAvailable = false;\n }\n setAppleInAppPurchaseAvailable(appleInAppPurchasesAvailable);\n setGooglePayAvailableStatus(googlePayAvailable);\n setPlugin(Payment);\n }\n if (!initialized) {\n setInitialized(true);\n initialize();\n }\n }, [initialized]);\n\n if (!plugin) {\n return <>{fallback}</>;\n }\n return (\n <PaymentPluginContext.Provider\n value={{\n plugin,\n isGooglePayAvailable,\n isAppleInAppPurchaseAvailable,\n }}\n >\n {children}\n </PaymentPluginContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"PaymentPluginProvider.js","sourceRoot":"","sources":["../../../../src/provider/react/PaymentPluginProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,oBAAoB,GAAG,aAAa,CAA2B;IACnE,MAAM,EAAE,SAAgB;IACxB,6BAA6B,EAAE,KAAK;IACpC,oBAAoB,EAAE,KAAK;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAA6B,EAAE;IAC7D,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,qBAAqB,GAAkC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7F,MAAM,CAAC,6BAA6B,EAAE,8BAA8B,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACjG,MAAM,CAAC,oBAAoB,EAAE,2BAA2B,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACrF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAAiB,CAAC;IACtD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,UAAU;YACvB,IAAI,4BAA4B,CAAC;YACjC,IAAI,kBAAkB,CAAC;YACvB,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,6BAA6B,EAAE,CAAC;gBAC9C,4BAA4B,GAAG,IAAI,CAAC;YACtC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,4BAA4B,GAAG,KAAK,CAAC;YACvC,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBACrC,kBAAkB,GAAG,IAAI,CAAC;YAC5B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,kBAAkB,GAAG,KAAK,CAAC;YAC7B,CAAC;YACD,8BAA8B,CAAC,4BAA4B,CAAC,CAAC;YAC7D,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;YAChD,SAAS,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,cAAc,CAAC,IAAI,CAAC,CAAC;YACrB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IACD,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAC5B,KAAK,EAAE;YACL,MAAM;YACN,oBAAoB;YACpB,6BAA6B;SAC9B,YAEA,QAAQ,GACqB,CACjC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { FC, PropsWithChildren, ReactNode } from 'react';\nimport { createContext, useContext, useEffect, useState } from 'react';\n\nimport type { PaymentPlugin, PaymentPluginContext as PaymentPluginContextType } from '../../definitions';\nimport { Payment } from '../../index';\n\nconst PaymentPluginContext = createContext<PaymentPluginContextType>({\n plugin: undefined as any,\n isAppleInAppPurchaseAvailable: false,\n isGooglePayAvailable: false,\n});\n\nexport const usePaymentPlugin = (): PaymentPluginContextType => {\n return useContext(PaymentPluginContext);\n};\n\nexport type PaymentPluginProviderType = PropsWithChildren<{\n fallback?: ReactNode;\n}>;\n\nexport const PaymentPluginProvider: FC<PaymentPluginProviderType> = ({ fallback, children }) => {\n const [isAppleInAppPurchaseAvailable, setAppleInAppPurchaseAvailable] = useState<boolean>(false);\n const [isGooglePayAvailable, setGooglePayAvailableStatus] = useState<boolean>(false);\n const [plugin, setPlugin] = useState<PaymentPlugin>();\n const [initialized, setInitialized] = useState<boolean>(false);\n\n useEffect(() => {\n async function initialize() {\n let appleInAppPurchasesAvailable;\n let googlePayAvailable;\n try {\n await Payment.isAppleInAppPurchaseAvailable();\n appleInAppPurchasesAvailable = true;\n } catch (e) {\n appleInAppPurchasesAvailable = false;\n }\n try {\n await Payment.isGooglePayAvailable();\n googlePayAvailable = true;\n } catch (e) {\n googlePayAvailable = false;\n }\n setAppleInAppPurchaseAvailable(appleInAppPurchasesAvailable);\n setGooglePayAvailableStatus(googlePayAvailable);\n setPlugin(Payment);\n }\n if (!initialized) {\n setInitialized(true);\n initialize();\n }\n }, [initialized]);\n\n if (!plugin) {\n return <>{fallback}</>;\n }\n return (\n <PaymentPluginContext.Provider\n value={{\n plugin,\n isGooglePayAvailable,\n isAppleInAppPurchaseAvailable,\n }}\n >\n {children}\n </PaymentPluginContext.Provider>\n );\n};\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import { BuyAppleInAppPurchaseOptions, BuyAppleInAppPurchaseResult, GetAppleInAppPurchaseProductsOptions, GetAppleInAppPurchaseProductsResult, GetAppleInAppPurchaseReceiptResult, GooglePayOptions, GooglePayResult, PaymentPlugin, RestoreAppleInAppPurchaseResult } from './definitions';
2
+ import type { BuyAppleInAppPurchaseOptions, BuyAppleInAppPurchaseResult, GetAppleInAppPurchaseProductsOptions, GetAppleInAppPurchaseProductsResult, GetAppleInAppPurchaseReceiptResult, GooglePayOptions, GooglePayResult, PaymentPlugin, RestoreAppleInAppPurchaseResult } from './definitions';
3
3
  export declare class PaymentWeb extends WebPlugin implements PaymentPlugin {
4
4
  /**
5
5
  * Apple
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAc5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IACrC;;OAEG;IACH,6BAA6B;QACzB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,6BAA6B,CAAC,KAA2C;QACrE,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,qBAAqB,CAAC,KAAmC;QACrD,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,yBAAyB;QACrB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,4BAA4B;QACxB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD;;OAEG;IACH,oBAAoB;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;IACD,eAAe,CAAC,KAAuB;QACnC,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport {\n BuyAppleInAppPurchaseOptions,\n BuyAppleInAppPurchaseResult,\n GetAppleInAppPurchaseProductsOptions,\n GetAppleInAppPurchaseProductsResult,\n GetAppleInAppPurchaseReceiptResult,\n GooglePayOptions,\n GooglePayResult,\n PaymentPlugin,\n RestoreAppleInAppPurchaseResult,\n} from './definitions';\n\nexport class PaymentWeb extends WebPlugin implements PaymentPlugin {\n /**\n * Apple\n */\n isAppleInAppPurchaseAvailable(): Promise<void> {\n return Promise.reject('Not supported');\n }\n getAppleInAppPurchaseProducts(_opts: GetAppleInAppPurchaseProductsOptions): Promise<GetAppleInAppPurchaseProductsResult> {\n return Promise.reject('Not supported');\n }\n buyAppleInAppPurchase(_opts: BuyAppleInAppPurchaseOptions): Promise<BuyAppleInAppPurchaseResult> {\n return Promise.reject('Not supported');\n }\n restoreAppleInAppPurchase(): Promise<RestoreAppleInAppPurchaseResult> {\n return Promise.reject('Not supported');\n }\n getAppleInAppPurchaseReceipt(): Promise<GetAppleInAppPurchaseReceiptResult> {\n return Promise.reject('Not supported');\n }\n /**\n * Google\n */\n isGooglePayAvailable(): Promise<void> {\n return Promise.reject('Not supported');\n }\n handleGooglePay(_opts: GooglePayOptions): Promise<GooglePayResult> {\n return Promise.reject('Not supported');\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAc5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IACvC;;OAEG;IACH,6BAA6B;QAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD,6BAA6B,CAC3B,KAA2C;QAE3C,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD,qBAAqB,CAAC,KAAmC;QACvD,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD,yBAAyB;QACvB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD,4BAA4B;QAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD;;OAEG;IACH,oBAAoB;QAClB,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;IACD,eAAe,CAAC,KAAuB;QACrC,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n BuyAppleInAppPurchaseOptions,\n BuyAppleInAppPurchaseResult,\n GetAppleInAppPurchaseProductsOptions,\n GetAppleInAppPurchaseProductsResult,\n GetAppleInAppPurchaseReceiptResult,\n GooglePayOptions,\n GooglePayResult,\n PaymentPlugin,\n RestoreAppleInAppPurchaseResult,\n} from './definitions';\n\nexport class PaymentWeb extends WebPlugin implements PaymentPlugin {\n /**\n * Apple\n */\n isAppleInAppPurchaseAvailable(): Promise<void> {\n return Promise.reject('Not supported');\n }\n getAppleInAppPurchaseProducts(\n _opts: GetAppleInAppPurchaseProductsOptions,\n ): Promise<GetAppleInAppPurchaseProductsResult> {\n return Promise.reject('Not supported');\n }\n buyAppleInAppPurchase(_opts: BuyAppleInAppPurchaseOptions): Promise<BuyAppleInAppPurchaseResult> {\n return Promise.reject('Not supported');\n }\n restoreAppleInAppPurchase(): Promise<RestoreAppleInAppPurchaseResult> {\n return Promise.reject('Not supported');\n }\n getAppleInAppPurchaseReceipt(): Promise<GetAppleInAppPurchaseReceiptResult> {\n return Promise.reject('Not supported');\n }\n /**\n * Google\n */\n isGooglePayAvailable(): Promise<void> {\n return Promise.reject('Not supported');\n }\n handleGooglePay(_opts: GooglePayOptions): Promise<GooglePayResult> {\n return Promise.reject('Not supported');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@dicty/payment",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Dicty Payment plugin",
5
- "type": "module",
6
5
  "main": "dist/plugin.cjs.js",
7
6
  "module": "dist/esm/index.js",
8
7
  "types": "dist/esm/index.d.ts",
@@ -16,7 +15,7 @@
16
15
  "Package.swift",
17
16
  "DictyPayment.podspec"
18
17
  ],
19
- "author": "Dicty",
18
+ "author": "dicty team",
20
19
  "license": "MIT",
21
20
  "repository": {
22
21
  "type": "git",
@@ -55,16 +54,17 @@
55
54
  "@ionic/prettier-config": "^4.0.0",
56
55
  "@ionic/swiftlint-config": "^2.0.0",
57
56
  "@types/react": "^19.2.7",
58
- "@typescript-eslint/eslint-plugin": "^8.50.1",
59
- "@typescript-eslint/parser": "^8.50.1",
60
57
  "eslint": "^8.57.1",
61
- "prettier": "^3.7.4",
58
+ "prettier": "^3.6.2",
62
59
  "prettier-plugin-java": "^2.7.7",
63
- "rimraf": "^6.1.2",
64
- "rollup": "^4.54.0",
60
+ "rimraf": "^6.1.0",
61
+ "rollup": "^4.53.2",
65
62
  "swiftlint": "^2.0.0",
66
63
  "typescript": "^5.9.3"
67
64
  },
65
+ "peerDependencies": {
66
+ "@capacitor/core": ">=8.0.0"
67
+ },
68
68
  "prettier": "@ionic/prettier-config",
69
69
  "swiftlint": "@ionic/swiftlint-config",
70
70
  "eslintConfig": {
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>$(DEVELOPMENT_LANGUAGE)</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>FMWK</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleVersion</key>
20
- <string>$(CURRENT_PROJECT_VERSION)</string>
21
- <key>NSPrincipalClass</key>
22
- <string></string>
23
- </dict>
24
- </plist>