@chipmobilesdk/rn-payment 0.6.0 → 0.7.0
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/CHANGELOG.md +111 -0
- package/README.md +1 -1
- package/lib/commonjs/adapter/createStoreProvider.js +110 -0
- package/lib/commonjs/adapter/createStoreProvider.js.map +1 -0
- package/lib/commonjs/adapter/iap-adapter.js +393 -0
- package/lib/commonjs/adapter/iap-adapter.js.map +1 -0
- package/lib/commonjs/adapter/iapShapes.js +169 -0
- package/lib/commonjs/adapter/iapShapes.js.map +1 -0
- package/lib/commonjs/adapter/port.js +6 -0
- package/lib/commonjs/adapter/port.js.map +1 -0
- package/lib/commonjs/config/types.js +2 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/config/validate.js +181 -0
- package/lib/commonjs/config/validate.js.map +1 -0
- package/lib/commonjs/core/mutex.js +31 -0
- package/lib/commonjs/core/mutex.js.map +1 -0
- package/lib/commonjs/core/retry.js +37 -0
- package/lib/commonjs/core/retry.js.map +1 -0
- package/lib/commonjs/core/timers.js +207 -0
- package/lib/commonjs/core/timers.js.map +1 -0
- package/lib/commonjs/diagnostics/errors.js +83 -0
- package/lib/commonjs/diagnostics/errors.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +126 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/messageKeys.js +70 -0
- package/lib/commonjs/diagnostics/messageKeys.js.map +1 -0
- package/lib/commonjs/engine/connection.js +189 -0
- package/lib/commonjs/engine/connection.js.map +1 -0
- package/lib/commonjs/engine/engine.js +279 -0
- package/lib/commonjs/engine/engine.js.map +1 -0
- package/lib/commonjs/engine/finalize.js +325 -0
- package/lib/commonjs/engine/finalize.js.map +1 -0
- package/lib/commonjs/engine/foreground.js +26 -0
- package/lib/commonjs/engine/foreground.js.map +1 -0
- package/lib/commonjs/engine/internals.js +31 -0
- package/lib/commonjs/engine/internals.js.map +1 -0
- package/lib/commonjs/engine/pending.js +102 -0
- package/lib/commonjs/engine/pending.js.map +1 -0
- package/lib/commonjs/engine/products.js +198 -0
- package/lib/commonjs/engine/products.js.map +1 -0
- package/lib/commonjs/engine/purchase.js +395 -0
- package/lib/commonjs/engine/purchase.js.map +1 -0
- package/lib/commonjs/engine/purchaseFailure.js +77 -0
- package/lib/commonjs/engine/purchaseFailure.js.map +1 -0
- package/lib/commonjs/engine/receiptValidation.js +90 -0
- package/lib/commonjs/engine/receiptValidation.js.map +1 -0
- package/lib/commonjs/engine/state.js +201 -0
- package/lib/commonjs/engine/state.js.map +1 -0
- package/lib/commonjs/engine/subscriptions.js +122 -0
- package/lib/commonjs/engine/subscriptions.js.map +1 -0
- package/lib/commonjs/engine/sync.js +163 -0
- package/lib/commonjs/engine/sync.js.map +1 -0
- package/lib/commonjs/entitlements/aggregate.js +212 -0
- package/lib/commonjs/entitlements/aggregate.js.map +1 -0
- package/lib/commonjs/entitlements/mapping.js +41 -0
- package/lib/commonjs/entitlements/mapping.js.map +1 -0
- package/lib/commonjs/entitlements/policy.js +110 -0
- package/lib/commonjs/entitlements/policy.js.map +1 -0
- package/lib/commonjs/index.js +266 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/persistence/mmkv-store.js +149 -0
- package/lib/commonjs/persistence/mmkv-store.js.map +1 -0
- package/lib/commonjs/persistence/snapshot.js +229 -0
- package/lib/commonjs/persistence/snapshot.js.map +1 -0
- package/lib/commonjs/react/PaymentProvider.js +96 -0
- package/lib/commonjs/react/PaymentProvider.js.map +1 -0
- package/lib/commonjs/react/hooks.js +202 -0
- package/lib/commonjs/react/hooks.js.map +1 -0
- package/lib/commonjs/testing/conformance.js +136 -0
- package/lib/commonjs/testing/conformance.js.map +1 -0
- package/lib/commonjs/testing/fakeStore.js +281 -0
- package/lib/commonjs/testing/fakeStore.js.map +1 -0
- package/lib/commonjs/testing/index.js +45 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/module/adapter/createStoreProvider.js +106 -0
- package/lib/module/adapter/createStoreProvider.js.map +1 -0
- package/lib/module/adapter/iap-adapter.js +383 -0
- package/lib/module/adapter/iap-adapter.js.map +1 -0
- package/lib/module/adapter/iapShapes.js +160 -0
- package/lib/module/adapter/iapShapes.js.map +1 -0
- package/lib/module/adapter/port.js +4 -0
- package/lib/module/adapter/port.js.map +1 -0
- package/lib/module/config/types.js +2 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/config/validate.js +175 -0
- package/lib/module/config/validate.js.map +1 -0
- package/lib/module/core/mutex.js +22 -0
- package/lib/module/core/mutex.js.map +1 -0
- package/lib/module/core/retry.js +33 -0
- package/lib/module/core/retry.js.map +1 -0
- package/lib/module/core/timers.js +198 -0
- package/lib/module/core/timers.js.map +1 -0
- package/lib/module/diagnostics/errors.js +76 -0
- package/lib/module/diagnostics/errors.js.map +1 -0
- package/lib/module/diagnostics/events.js +117 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/messageKeys.js +64 -0
- package/lib/module/diagnostics/messageKeys.js.map +1 -0
- package/lib/module/engine/connection.js +185 -0
- package/lib/module/engine/connection.js.map +1 -0
- package/lib/module/engine/engine.js +274 -0
- package/lib/module/engine/engine.js.map +1 -0
- package/lib/module/engine/finalize.js +322 -0
- package/lib/module/engine/finalize.js.map +1 -0
- package/lib/module/engine/foreground.js +21 -0
- package/lib/module/engine/foreground.js.map +1 -0
- package/lib/module/engine/internals.js +26 -0
- package/lib/module/engine/internals.js.map +1 -0
- package/lib/module/engine/pending.js +95 -0
- package/lib/module/engine/pending.js.map +1 -0
- package/lib/module/engine/products.js +195 -0
- package/lib/module/engine/products.js.map +1 -0
- package/lib/module/engine/purchase.js +390 -0
- package/lib/module/engine/purchase.js.map +1 -0
- package/lib/module/engine/purchaseFailure.js +72 -0
- package/lib/module/engine/purchaseFailure.js.map +1 -0
- package/lib/module/engine/receiptValidation.js +87 -0
- package/lib/module/engine/receiptValidation.js.map +1 -0
- package/lib/module/engine/state.js +196 -0
- package/lib/module/engine/state.js.map +1 -0
- package/lib/module/engine/subscriptions.js +119 -0
- package/lib/module/engine/subscriptions.js.map +1 -0
- package/lib/module/engine/sync.js +158 -0
- package/lib/module/engine/sync.js.map +1 -0
- package/lib/module/entitlements/aggregate.js +204 -0
- package/lib/module/entitlements/aggregate.js.map +1 -0
- package/lib/module/entitlements/mapping.js +35 -0
- package/lib/module/entitlements/mapping.js.map +1 -0
- package/lib/module/entitlements/policy.js +104 -0
- package/lib/module/entitlements/policy.js.map +1 -0
- package/lib/module/index.js +59 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/persistence/mmkv-store.js +144 -0
- package/lib/module/persistence/mmkv-store.js.map +1 -0
- package/lib/module/persistence/snapshot.js +221 -0
- package/lib/module/persistence/snapshot.js.map +1 -0
- package/lib/module/react/PaymentProvider.js +90 -0
- package/lib/module/react/PaymentProvider.js.map +1 -0
- package/lib/module/react/hooks.js +192 -0
- package/lib/module/react/hooks.js.map +1 -0
- package/lib/module/testing/conformance.js +130 -0
- package/lib/module/testing/conformance.js.map +1 -0
- package/lib/module/testing/fakeStore.js +276 -0
- package/lib/module/testing/fakeStore.js.map +1 -0
- package/lib/module/testing/index.js +13 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts +45 -0
- package/lib/typescript/commonjs/adapter/createStoreProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/iap-adapter.d.ts +80 -0
- package/lib/typescript/commonjs/adapter/iap-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/iapShapes.d.ts +94 -0
- package/lib/typescript/commonjs/adapter/iapShapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/adapter/port.d.ts +184 -0
- package/lib/typescript/commonjs/adapter/port.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/types.d.ts +326 -0
- package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/config/validate.d.ts +63 -0
- package/lib/typescript/commonjs/config/validate.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/mutex.d.ts +17 -0
- package/lib/typescript/commonjs/core/mutex.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/retry.d.ts +19 -0
- package/lib/typescript/commonjs/core/retry.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/timers.d.ts +142 -0
- package/lib/typescript/commonjs/core/timers.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts +55 -0
- package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +158 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts +54 -0
- package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/connection.d.ts +30 -0
- package/lib/typescript/commonjs/engine/connection.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/engine.d.ts +93 -0
- package/lib/typescript/commonjs/engine/engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/finalize.d.ts +53 -0
- package/lib/typescript/commonjs/engine/finalize.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/foreground.d.ts +15 -0
- package/lib/typescript/commonjs/engine/foreground.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/internals.d.ts +28 -0
- package/lib/typescript/commonjs/engine/internals.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/pending.d.ts +51 -0
- package/lib/typescript/commonjs/engine/pending.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/products.d.ts +82 -0
- package/lib/typescript/commonjs/engine/products.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/purchase.d.ts +61 -0
- package/lib/typescript/commonjs/engine/purchase.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/purchaseFailure.d.ts +15 -0
- package/lib/typescript/commonjs/engine/purchaseFailure.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/receiptValidation.d.ts +42 -0
- package/lib/typescript/commonjs/engine/receiptValidation.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/state.d.ts +46 -0
- package/lib/typescript/commonjs/engine/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/subscriptions.d.ts +61 -0
- package/lib/typescript/commonjs/engine/subscriptions.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/sync.d.ts +36 -0
- package/lib/typescript/commonjs/engine/sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/aggregate.d.ts +97 -0
- package/lib/typescript/commonjs/entitlements/aggregate.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/mapping.d.ts +27 -0
- package/lib/typescript/commonjs/entitlements/mapping.d.ts.map +1 -0
- package/lib/typescript/commonjs/entitlements/policy.d.ts +75 -0
- package/lib/typescript/commonjs/entitlements/policy.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +44 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/persistence/mmkv-store.d.ts +45 -0
- package/lib/typescript/commonjs/persistence/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/persistence/snapshot.d.ts +106 -0
- package/lib/typescript/commonjs/persistence/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/PaymentProvider.d.ts +57 -0
- package/lib/typescript/commonjs/react/PaymentProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/react/hooks.d.ts +80 -0
- package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts +41 -0
- package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fakeStore.d.ts +69 -0
- package/lib/typescript/commonjs/testing/fakeStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +12 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/adapter/createStoreProvider.d.ts +45 -0
- package/lib/typescript/module/adapter/createStoreProvider.d.ts.map +1 -0
- package/lib/typescript/module/adapter/iap-adapter.d.ts +80 -0
- package/lib/typescript/module/adapter/iap-adapter.d.ts.map +1 -0
- package/lib/typescript/module/adapter/iapShapes.d.ts +94 -0
- package/lib/typescript/module/adapter/iapShapes.d.ts.map +1 -0
- package/lib/typescript/module/adapter/port.d.ts +184 -0
- package/lib/typescript/module/adapter/port.d.ts.map +1 -0
- package/lib/typescript/module/config/types.d.ts +326 -0
- package/lib/typescript/module/config/types.d.ts.map +1 -0
- package/lib/typescript/module/config/validate.d.ts +63 -0
- package/lib/typescript/module/config/validate.d.ts.map +1 -0
- package/lib/typescript/module/core/mutex.d.ts +17 -0
- package/lib/typescript/module/core/mutex.d.ts.map +1 -0
- package/lib/typescript/module/core/retry.d.ts +19 -0
- package/lib/typescript/module/core/retry.d.ts.map +1 -0
- package/lib/typescript/module/core/timers.d.ts +142 -0
- package/lib/typescript/module/core/timers.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/errors.d.ts +55 -0
- package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +158 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/messageKeys.d.ts +54 -0
- package/lib/typescript/module/diagnostics/messageKeys.d.ts.map +1 -0
- package/lib/typescript/module/engine/connection.d.ts +30 -0
- package/lib/typescript/module/engine/connection.d.ts.map +1 -0
- package/lib/typescript/module/engine/engine.d.ts +93 -0
- package/lib/typescript/module/engine/engine.d.ts.map +1 -0
- package/lib/typescript/module/engine/finalize.d.ts +53 -0
- package/lib/typescript/module/engine/finalize.d.ts.map +1 -0
- package/lib/typescript/module/engine/foreground.d.ts +15 -0
- package/lib/typescript/module/engine/foreground.d.ts.map +1 -0
- package/lib/typescript/module/engine/internals.d.ts +28 -0
- package/lib/typescript/module/engine/internals.d.ts.map +1 -0
- package/lib/typescript/module/engine/pending.d.ts +51 -0
- package/lib/typescript/module/engine/pending.d.ts.map +1 -0
- package/lib/typescript/module/engine/products.d.ts +82 -0
- package/lib/typescript/module/engine/products.d.ts.map +1 -0
- package/lib/typescript/module/engine/purchase.d.ts +61 -0
- package/lib/typescript/module/engine/purchase.d.ts.map +1 -0
- package/lib/typescript/module/engine/purchaseFailure.d.ts +15 -0
- package/lib/typescript/module/engine/purchaseFailure.d.ts.map +1 -0
- package/lib/typescript/module/engine/receiptValidation.d.ts +42 -0
- package/lib/typescript/module/engine/receiptValidation.d.ts.map +1 -0
- package/lib/typescript/module/engine/state.d.ts +46 -0
- package/lib/typescript/module/engine/state.d.ts.map +1 -0
- package/lib/typescript/module/engine/subscriptions.d.ts +61 -0
- package/lib/typescript/module/engine/subscriptions.d.ts.map +1 -0
- package/lib/typescript/module/engine/sync.d.ts +36 -0
- package/lib/typescript/module/engine/sync.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/aggregate.d.ts +97 -0
- package/lib/typescript/module/entitlements/aggregate.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/mapping.d.ts +27 -0
- package/lib/typescript/module/entitlements/mapping.d.ts.map +1 -0
- package/lib/typescript/module/entitlements/policy.d.ts +75 -0
- package/lib/typescript/module/entitlements/policy.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +44 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/persistence/mmkv-store.d.ts +45 -0
- package/lib/typescript/module/persistence/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/persistence/snapshot.d.ts +106 -0
- package/lib/typescript/module/persistence/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/react/PaymentProvider.d.ts +57 -0
- package/lib/typescript/module/react/PaymentProvider.d.ts.map +1 -0
- package/lib/typescript/module/react/hooks.d.ts +80 -0
- package/lib/typescript/module/react/hooks.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance.d.ts +41 -0
- package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
- package/lib/typescript/module/testing/fakeStore.d.ts +69 -0
- package/lib/typescript/module/testing/fakeStore.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +12 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/package.json +49 -13
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PaymentProvider = PaymentProvider;
|
|
7
|
+
exports.usePaymentEngine = usePaymentEngine;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _engine = require("../engine/engine.js");
|
|
10
|
+
var _foreground = require("../engine/foreground.js");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
14
|
+
* React integration.
|
|
15
|
+
*
|
|
16
|
+
* The provider owns the engine's lifecycle so an app does not have to remember to
|
|
17
|
+
* clean up. It renders nothing of its own — no paywall, no price table, no
|
|
18
|
+
* button. Every surface belongs to the app (UX-001).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const PaymentContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
22
|
+
function PaymentProvider(props) {
|
|
23
|
+
const {
|
|
24
|
+
autoInitialize = true,
|
|
25
|
+
syncOnForeground = false,
|
|
26
|
+
children
|
|
27
|
+
} = props;
|
|
28
|
+
const external = props.engine;
|
|
29
|
+
const key = props.engine ? undefined : props.engineKey ?? props.config.scopeToken;
|
|
30
|
+
|
|
31
|
+
// The latest config and deps, read only when an engine is built.
|
|
32
|
+
const latest = (0, _react.useRef)(props);
|
|
33
|
+
latest.current = props;
|
|
34
|
+
const build = () => {
|
|
35
|
+
const current = latest.current;
|
|
36
|
+
if (current.engine) {
|
|
37
|
+
return current.engine;
|
|
38
|
+
}
|
|
39
|
+
return (0, _engine.createEngine)(current.config, current.deps);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Built once, not once per render: validating the catalog and opening storage
|
|
43
|
+
// are not render work, and a new engine per render reconnected to the billing
|
|
44
|
+
// service every time the app's root re-rendered (FR-018, PAY-07).
|
|
45
|
+
const [owned, setOwned] = (0, _react.useState)(() => external ? null : build());
|
|
46
|
+
const builtFor = (0, _react.useRef)(key);
|
|
47
|
+
const cleanedUp = (0, _react.useRef)(new WeakSet());
|
|
48
|
+
const engine = external ?? owned ?? build();
|
|
49
|
+
(0, _react.useEffect)(() => {
|
|
50
|
+
if (external) {
|
|
51
|
+
// The app's engine, so the app's lifecycle.
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const cleaned = cleanedUp.current;
|
|
55
|
+
// An engine cleaned up by an earlier run of this effect — StrictMode's
|
|
56
|
+
// mount-unmount-mount in development, or a changed `engineKey` — is never
|
|
57
|
+
// reused: it would answer every call with "cleaned up". A fresh one replaces
|
|
58
|
+
// it and this effect runs again for that one.
|
|
59
|
+
if (!owned || cleaned.has(owned) || builtFor.current !== key) {
|
|
60
|
+
builtFor.current = key;
|
|
61
|
+
setOwned(build());
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
if (autoInitialize) {
|
|
65
|
+
owned.initialize().catch(() => undefined);
|
|
66
|
+
}
|
|
67
|
+
// Cleanup on unmount is the whole reason the provider owns the engine:
|
|
68
|
+
// after it, no event fires and no timer survives (FR-082).
|
|
69
|
+
return () => {
|
|
70
|
+
cleaned.add(owned);
|
|
71
|
+
owned.cleanup();
|
|
72
|
+
};
|
|
73
|
+
// `build` reads the latest props through a ref, so it is not a dependency.
|
|
74
|
+
}, [external, owned, key, autoInitialize]);
|
|
75
|
+
(0, _react.useEffect)(() => syncOnForeground ? (0, _foreground.syncOnForeground)(engine) : undefined, [engine, syncOnForeground]);
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PaymentContext.Provider, {
|
|
77
|
+
value: engine,
|
|
78
|
+
children: children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The engine from context.
|
|
84
|
+
*
|
|
85
|
+
* Throws when used outside a provider, deliberately: returning null would push a
|
|
86
|
+
* null check into every consumer and let a genuine wiring mistake read as "no
|
|
87
|
+
* entitlement" — the exact conflation this package exists to prevent.
|
|
88
|
+
*/
|
|
89
|
+
function usePaymentEngine() {
|
|
90
|
+
const engine = (0, _react.useContext)(PaymentContext);
|
|
91
|
+
if (!engine) {
|
|
92
|
+
throw new Error('usePaymentEngine must be used inside a <PaymentProvider>. Wrap your app ' + 'or the screen that reads entitlements.');
|
|
93
|
+
}
|
|
94
|
+
return engine;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=PaymentProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_engine","_foreground","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PaymentContext","createContext","PaymentProvider","props","autoInitialize","syncOnForeground","children","external","engine","key","undefined","engineKey","config","scopeToken","latest","useRef","current","build","createEngine","deps","owned","setOwned","useState","builtFor","cleanedUp","WeakSet","useEffect","cleaned","initialize","catch","add","cleanup","watchForeground","jsx","Provider","value","usePaymentEngine","useContext","Error"],"sourceRoot":"../../../src","sources":["react/PaymentProvider.tsx"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA2E,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAA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__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEntitlement = useEntitlement;
|
|
7
|
+
exports.useEntitlements = useEntitlements;
|
|
8
|
+
exports.usePaymentStatus = usePaymentStatus;
|
|
9
|
+
exports.usePendingPurchases = usePendingPurchases;
|
|
10
|
+
exports.useProducts = useProducts;
|
|
11
|
+
exports.usePurchase = usePurchase;
|
|
12
|
+
exports.useSync = useSync;
|
|
13
|
+
var _react = require("@chipmobilesdk/rn-core/react");
|
|
14
|
+
var _react2 = require("react");
|
|
15
|
+
var _PaymentProvider = require("./PaymentProvider.js");
|
|
16
|
+
/**
|
|
17
|
+
* Hooks over the engine.
|
|
18
|
+
*
|
|
19
|
+
* Each subscribes on mount and unsubscribes on unmount, so repeated mount/unmount
|
|
20
|
+
* leaves no duplicate subscription and no surviving listener (FR-006, PERF-002).
|
|
21
|
+
*
|
|
22
|
+
* Reads are synchronous: the engine holds entitlements in memory, so a hook never
|
|
23
|
+
* returns a loading placeholder for an entitlement it already knows (PERF-001).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One entitlement, re-rendering only when that one changes.
|
|
28
|
+
*
|
|
29
|
+
* The returned `status` is `unknown` until the first sync completes. That is the
|
|
30
|
+
* point: an app must be able to tell "not yet known" from "not entitled" so a
|
|
31
|
+
* paying user never sees the unpaid experience flash (FR-047).
|
|
32
|
+
*/
|
|
33
|
+
function useEntitlement(key) {
|
|
34
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
35
|
+
// The engine keeps an unchanged entitlement's object across recomputes, so this
|
|
36
|
+
// selection only changes, and the component only re-renders, when it changes.
|
|
37
|
+
const select = (0, _react2.useCallback)(map => map[key] ?? engine.getEntitlement(key), [engine, key]);
|
|
38
|
+
return (0, _react.useExternalStore)(engine.subscribeEntitlements, engine.getAllEntitlements, select);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Every entitlement at once, for a screen that shows overall plan state. */
|
|
42
|
+
function useEntitlements() {
|
|
43
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
44
|
+
return (0, _react.useExternalStore)(engine.subscribeEntitlements, engine.getAllEntitlements);
|
|
45
|
+
}
|
|
46
|
+
function narrowPending(state, keys) {
|
|
47
|
+
return keys ? {
|
|
48
|
+
...state,
|
|
49
|
+
purchases: state.purchases.filter(p => keys.includes(p.productKey))
|
|
50
|
+
} : state;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Pending purchases, in this session or an earlier one (FR-101). Added in 0.2.0.
|
|
55
|
+
*
|
|
56
|
+
* Pass product keys to narrow it to the products one screen sells. Read
|
|
57
|
+
* `status` before the list: under `unknown`, an empty list is not "nothing
|
|
58
|
+
* pending", and a Buy button shown on it could charge a user twice.
|
|
59
|
+
*/
|
|
60
|
+
function usePendingPurchases(productKeys) {
|
|
61
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
62
|
+
// Joined so a caller passing a literal array does not resubscribe each render.
|
|
63
|
+
const keyToken = productKeys ? productKeys.join('|') : null;
|
|
64
|
+
const [state, setState] = (0, _react2.useState)(() => narrowPending(engine.getPendingPurchases(), productKeys ?? null));
|
|
65
|
+
(0, _react2.useEffect)(() => {
|
|
66
|
+
const keys = keyToken === null ? null : keyToken.split('|').filter(Boolean);
|
|
67
|
+
setState(narrowPending(engine.getPendingPurchases(), keys));
|
|
68
|
+
return engine.subscribePendingPurchases(next => setState(narrowPending(next, keys)));
|
|
69
|
+
}, [engine, keyToken]);
|
|
70
|
+
return state;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Package status, so an app can tell "cannot sell here" from "not paid" (FR-022). */
|
|
74
|
+
function usePaymentStatus() {
|
|
75
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
76
|
+
return (0, _react.useExternalStore)(engine.subscribeStatus, engine.getStatus);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Starting a purchase.
|
|
80
|
+
*
|
|
81
|
+
* `lastResult` is the full typed union rather than a boolean, because a screen has
|
|
82
|
+
* to treat `user_cancelled` differently from `store_error` — showing an error
|
|
83
|
+
* banner to someone who simply changed their mind is the most common paywall bug.
|
|
84
|
+
*/
|
|
85
|
+
function usePurchase() {
|
|
86
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
87
|
+
const [isPurchasing, setIsPurchasing] = (0, _react2.useState)(false);
|
|
88
|
+
const [lastResult, setLastResult] = (0, _react2.useState)();
|
|
89
|
+
const purchase = (0, _react2.useCallback)(async (productKey, options) => {
|
|
90
|
+
setIsPurchasing(true);
|
|
91
|
+
try {
|
|
92
|
+
const result = await engine.purchase(productKey, options);
|
|
93
|
+
setLastResult(result);
|
|
94
|
+
return result;
|
|
95
|
+
} finally {
|
|
96
|
+
setIsPurchasing(false);
|
|
97
|
+
}
|
|
98
|
+
}, [engine]);
|
|
99
|
+
const consume = (0, _react2.useCallback)(ref => engine.consume(ref), [engine]);
|
|
100
|
+
return {
|
|
101
|
+
purchase,
|
|
102
|
+
consume,
|
|
103
|
+
isPurchasing,
|
|
104
|
+
lastResult
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Store-supplied product information for a paywall.
|
|
109
|
+
*
|
|
110
|
+
* Every price here is already formatted by the store for the user's locale. An app
|
|
111
|
+
* must render `formattedPrice` and never build its own string from
|
|
112
|
+
* `priceAmountMicros` — that field exists for sorting and comparison only
|
|
113
|
+
* (FR-028).
|
|
114
|
+
*/
|
|
115
|
+
function useProducts(productKeys) {
|
|
116
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
117
|
+
const [products, setProducts] = (0, _react2.useState)([]);
|
|
118
|
+
const [missing, setMissing] = (0, _react2.useState)([]);
|
|
119
|
+
const [isLoading, setIsLoading] = (0, _react2.useState)(false);
|
|
120
|
+
const [error, setError] = (0, _react2.useState)();
|
|
121
|
+
|
|
122
|
+
// Joined so the effect depends on the contents rather than the array identity:
|
|
123
|
+
// a caller passing a literal would otherwise re-query on every render.
|
|
124
|
+
const keyToken = productKeys.join('|');
|
|
125
|
+
// Each load's number. Only the latest may write: when the keys change while a
|
|
126
|
+
// query is out, the older answer must not overwrite the newer one (PAY-20).
|
|
127
|
+
const latestRequest = (0, _react2.useRef)(0);
|
|
128
|
+
const load = (0, _react2.useCallback)(async fresh => {
|
|
129
|
+
const request = ++latestRequest.current;
|
|
130
|
+
const keys = keyToken === '' ? [] : keyToken.split('|');
|
|
131
|
+
if (keys.length === 0) {
|
|
132
|
+
setProducts([]);
|
|
133
|
+
setMissing([]);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
setIsLoading(true);
|
|
137
|
+
try {
|
|
138
|
+
const result = fresh ? await engine.refreshProducts(keys) : await engine.getProducts(keys);
|
|
139
|
+
if (request !== latestRequest.current) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (result.ok) {
|
|
143
|
+
setProducts(result.products);
|
|
144
|
+
setMissing(result.missing);
|
|
145
|
+
setError(undefined);
|
|
146
|
+
} else {
|
|
147
|
+
setError(result.error);
|
|
148
|
+
}
|
|
149
|
+
} finally {
|
|
150
|
+
if (request === latestRequest.current) {
|
|
151
|
+
setIsLoading(false);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, [engine, keyToken]);
|
|
155
|
+
(0, _react2.useEffect)(() => {
|
|
156
|
+
load(false).catch(() => undefined);
|
|
157
|
+
}, [load]);
|
|
158
|
+
const refresh = (0, _react2.useCallback)(() => load(true), [load]);
|
|
159
|
+
return {
|
|
160
|
+
products,
|
|
161
|
+
missing,
|
|
162
|
+
isLoading,
|
|
163
|
+
error,
|
|
164
|
+
refresh
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Sync and restore, for a "Restore purchases" control.
|
|
169
|
+
*
|
|
170
|
+
* `restore`'s outcome distinguishes "restored" from "nothing found", so the app
|
|
171
|
+
* can avoid telling a user their purchases came back when none existed (FR-061).
|
|
172
|
+
*/
|
|
173
|
+
function useSync() {
|
|
174
|
+
const engine = (0, _PaymentProvider.usePaymentEngine)();
|
|
175
|
+
const [isSyncing, setIsSyncing] = (0, _react2.useState)(false);
|
|
176
|
+
const [lastSyncedAt, setLastSyncedAt] = (0, _react2.useState)(() => engine.getLastSyncedAt());
|
|
177
|
+
const sync = (0, _react2.useCallback)(async () => {
|
|
178
|
+
setIsSyncing(true);
|
|
179
|
+
try {
|
|
180
|
+
return await engine.sync('manual');
|
|
181
|
+
} finally {
|
|
182
|
+
setIsSyncing(false);
|
|
183
|
+
setLastSyncedAt(engine.getLastSyncedAt());
|
|
184
|
+
}
|
|
185
|
+
}, [engine]);
|
|
186
|
+
const restore = (0, _react2.useCallback)(async () => {
|
|
187
|
+
setIsSyncing(true);
|
|
188
|
+
try {
|
|
189
|
+
return await engine.restore();
|
|
190
|
+
} finally {
|
|
191
|
+
setIsSyncing(false);
|
|
192
|
+
setLastSyncedAt(engine.getLastSyncedAt());
|
|
193
|
+
}
|
|
194
|
+
}, [engine]);
|
|
195
|
+
return {
|
|
196
|
+
sync,
|
|
197
|
+
restore,
|
|
198
|
+
isSyncing,
|
|
199
|
+
lastSyncedAt
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_react2","_PaymentProvider","useEntitlement","key","engine","usePaymentEngine","select","useCallback","map","getEntitlement","useExternalStore","subscribeEntitlements","getAllEntitlements","useEntitlements","narrowPending","state","keys","purchases","filter","p","includes","productKey","usePendingPurchases","productKeys","keyToken","join","setState","useState","getPendingPurchases","useEffect","split","Boolean","subscribePendingPurchases","next","usePaymentStatus","subscribeStatus","getStatus","usePurchase","isPurchasing","setIsPurchasing","lastResult","setLastResult","purchase","options","result","consume","ref","useProducts","products","setProducts","missing","setMissing","isLoading","setIsLoading","error","setError","latestRequest","useRef","load","fresh","request","current","length","refreshProducts","getProducts","ok","undefined","catch","refresh","useSync","isSyncing","setIsSyncing","lastSyncedAt","setLastSyncedAt","getLastSyncedAt","sync","restore"],"sourceRoot":"../../../src","sources":["react/hooks.ts"],"mappings":";;;;;;;;;;;;AAUA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAACC,GAAmB,EAAoB;EACrE,MAAMC,MAAM,GAAG,IAAAC,iCAAgB,EAAC,CAAC;EACjC;EACA;EACA,MAAMC,MAAM,GAAG,IAAAC,mBAAW,EACxBC,GAAmB,IAAKA,GAAG,CAACL,GAAG,CAAC,IAAIC,MAAM,CAACK,cAAc,CAACN,GAAG,CAAC,EAC/D,CAACC,MAAM,EAAED,GAAG,CACb,CAAC;EACD,OAAO,IAAAO,uBAAgB,EAACN,MAAM,CAACO,qBAAqB,EAAEP,MAAM,CAACQ,kBAAkB,EAAEN,MAAM,CAAC;AACzF;;AAEA;AACO,SAASO,eAAeA,CAAA,EAAmB;EACjD,MAAMT,MAAM,GAAG,IAAAC,iCAAgB,EAAC,CAAC;EACjC,OAAO,IAAAK,uBAAgB,EAACN,MAAM,CAACO,qBAAqB,EAAEP,MAAM,CAACQ,kBAAkB,CAAC;AACjF;AAEA,SAASE,aAAaA,CACrBC,KAA4B,EAC5BC,IAA8B,EACN;EACxB,OAAOA,IAAI,GACR;IAAE,GAAGD,KAAK;IAAEE,SAAS,EAAEF,KAAK,CAACE,SAAS,CAACC,MAAM,CAACC,CAAC,IAAIH,IAAI,CAACI,QAAQ,CAACD,CAAC,CAACE,UAAU,CAAC;EAAE,CAAC,GACjFN,KAAK;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,mBAAmBA,CAACC,WAA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
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.providerPortChecks = exports.CONFORMANCE_STORE = void 0;
|
|
7
|
+
exports.runProviderPortConformance = runProviderPortConformance;
|
|
8
|
+
var _testing = require("@chipmobilesdk/rn-core/testing");
|
|
9
|
+
/**
|
|
10
|
+
* What any `ProviderPort` must do (IOS-12, PAY-13).
|
|
11
|
+
*
|
|
12
|
+
* The same checks run against the fake store and against the Play adapter over a
|
|
13
|
+
* simulated binding (or the real one, from a demo screen on a device), so a test
|
|
14
|
+
* that drives the fake proves something about the device path. Each check builds
|
|
15
|
+
* its own port over the same small store, through a harness.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The store every check runs against. */
|
|
19
|
+
const CONFORMANCE_STORE = exports.CONFORMANCE_STORE = {
|
|
20
|
+
products: [{
|
|
21
|
+
storeProductId: 'conformance.remove_ads',
|
|
22
|
+
productType: 'one_time_permanent',
|
|
23
|
+
formattedPrice: '€1.99'
|
|
24
|
+
}, {
|
|
25
|
+
storeProductId: 'conformance.coins',
|
|
26
|
+
productType: 'one_time_consumable',
|
|
27
|
+
formattedPrice: '€0.99'
|
|
28
|
+
}],
|
|
29
|
+
owned: [{
|
|
30
|
+
storeProductId: 'conformance.remove_ads',
|
|
31
|
+
token: 'token-owned',
|
|
32
|
+
state: 'purchased'
|
|
33
|
+
}, {
|
|
34
|
+
storeProductId: 'conformance.coins',
|
|
35
|
+
token: 'token-pending',
|
|
36
|
+
state: 'pending'
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
39
|
+
const providerPortChecks = exports.providerPortChecks = [{
|
|
40
|
+
name: 'connects, and disconnects safely before a connect and twice',
|
|
41
|
+
async run(harness) {
|
|
42
|
+
const {
|
|
43
|
+
port
|
|
44
|
+
} = harness.create(CONFORMANCE_STORE);
|
|
45
|
+
await port.disconnect();
|
|
46
|
+
const outcome = await port.connect();
|
|
47
|
+
(0, _testing.ensure)(outcome.ok, `connect failed: ${JSON.stringify(outcome)}`);
|
|
48
|
+
await port.disconnect();
|
|
49
|
+
await port.disconnect();
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
name: 'reports a dropped service to observers, and nothing after unsubscribing',
|
|
53
|
+
async run(harness) {
|
|
54
|
+
const subject = harness.create(CONFORMANCE_STORE);
|
|
55
|
+
const seen = [];
|
|
56
|
+
const stop = subject.port.observeConnection(connected => seen.push(connected));
|
|
57
|
+
await subject.port.connect();
|
|
58
|
+
(0, _testing.ensure)(seen.at(-1) === true, `after connect observers saw ${JSON.stringify(seen)}`);
|
|
59
|
+
subject.dropService();
|
|
60
|
+
(0, _testing.ensure)(seen.at(-1) === false, `after the drop observers saw ${JSON.stringify(seen)}`);
|
|
61
|
+
stop();
|
|
62
|
+
const before = seen.length;
|
|
63
|
+
await subject.port.connect();
|
|
64
|
+
(0, _testing.ensure)(seen.length === before, 'notified after unsubscribing');
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
name: 'returns the requested products with the store-formatted price',
|
|
68
|
+
async run(harness) {
|
|
69
|
+
const {
|
|
70
|
+
port
|
|
71
|
+
} = harness.create(CONFORMANCE_STORE);
|
|
72
|
+
await port.connect();
|
|
73
|
+
const products = await port.queryProducts(['conformance.remove_ads'], 'one_time_permanent');
|
|
74
|
+
(0, _testing.ensure)(products.length === 1, `expected one product, got ${products.length}`);
|
|
75
|
+
const [product] = products;
|
|
76
|
+
(0, _testing.ensure)(product?.storeProductId === 'conformance.remove_ads', 'wrong product returned');
|
|
77
|
+
(0, _testing.ensure)(product.productType === 'one_time_permanent', `product type ${product.productType}`);
|
|
78
|
+
(0, _testing.ensure)(product.formattedPrice === '€1.99', `price ${product.formattedPrice}`);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
name: 'flags a pending purchase rather than filtering it out',
|
|
82
|
+
async run(harness) {
|
|
83
|
+
const {
|
|
84
|
+
port
|
|
85
|
+
} = harness.create(CONFORMANCE_STORE);
|
|
86
|
+
await port.connect();
|
|
87
|
+
const owned = await port.queryOwned();
|
|
88
|
+
const pending = owned.find(purchase => purchase.token === 'token-pending');
|
|
89
|
+
const bought = owned.find(purchase => purchase.token === 'token-owned');
|
|
90
|
+
(0, _testing.ensure)(pending?.state === 'pending', `pending purchase reported as ${pending?.state}`);
|
|
91
|
+
(0, _testing.ensure)(bought?.state === 'purchased', `bought purchase reported as ${bought?.state}`);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
name: 'reports a bought purchase for the product that was requested',
|
|
95
|
+
async run(harness) {
|
|
96
|
+
const subject = harness.create(CONFORMANCE_STORE);
|
|
97
|
+
await subject.port.connect();
|
|
98
|
+
subject.nextPurchaseEnds('bought');
|
|
99
|
+
const outcome = await subject.port.launchPurchase({
|
|
100
|
+
storeProductId: 'conformance.coins',
|
|
101
|
+
productType: 'one_time_consumable'
|
|
102
|
+
});
|
|
103
|
+
(0, _testing.ensure)(outcome.ok, `purchase failed: ${JSON.stringify(outcome)}`);
|
|
104
|
+
(0, _testing.ensure)(outcome.purchase.storeProductId === 'conformance.coins', 'purchase for another product');
|
|
105
|
+
(0, _testing.ensure)(outcome.purchase.token !== '', 'purchase has no token to finalize');
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
name: 'reports a cancelled flow as user_cancelled',
|
|
109
|
+
async run(harness) {
|
|
110
|
+
const subject = harness.create(CONFORMANCE_STORE);
|
|
111
|
+
await subject.port.connect();
|
|
112
|
+
subject.nextPurchaseEnds('cancelled');
|
|
113
|
+
const outcome = await subject.port.launchPurchase({
|
|
114
|
+
storeProductId: 'conformance.remove_ads',
|
|
115
|
+
productType: 'one_time_permanent'
|
|
116
|
+
});
|
|
117
|
+
(0, _testing.ensure)(!outcome.ok, 'a cancelled flow reported a purchase');
|
|
118
|
+
(0, _testing.ensure)(outcome.reason === 'user_cancelled', `reason ${outcome.reason}`);
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
name: 'acknowledges and consumes safely twice',
|
|
122
|
+
async run(harness) {
|
|
123
|
+
const {
|
|
124
|
+
port
|
|
125
|
+
} = harness.create(CONFORMANCE_STORE);
|
|
126
|
+
await port.connect();
|
|
127
|
+
await port.acknowledge('token-owned');
|
|
128
|
+
await port.acknowledge('token-owned');
|
|
129
|
+
await port.consume('token-pending');
|
|
130
|
+
await port.consume('token-pending');
|
|
131
|
+
}
|
|
132
|
+
}];
|
|
133
|
+
function runProviderPortConformance(harness) {
|
|
134
|
+
return (0, _testing.runChecks)(() => harness, providerPortChecks);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_testing","require","CONFORMANCE_STORE","exports","products","storeProductId","productType","formattedPrice","owned","token","state","providerPortChecks","name","run","harness","port","create","disconnect","outcome","connect","ensure","ok","JSON","stringify","subject","seen","stop","observeConnection","connected","push","at","dropService","before","length","queryProducts","product","queryOwned","pending","find","purchase","bought","nextPurchaseEnds","launchPurchase","reason","acknowledge","consume","runProviderPortConformance","runChecks"],"sourceRoot":"../../../src","sources":["testing/conformance.ts"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCA;AACO,MAAMC,iBAAgC,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/CE,QAAQ,EAAE,CACT;IACCC,cAAc,EAAE,wBAAwB;IACxCC,WAAW,EAAE,oBAAoB;IACjCC,cAAc,EAAE;EACjB,CAAC,EACD;IACCF,cAAc,EAAE,mBAAmB;IACnCC,WAAW,EAAE,qBAAqB;IAClCC,cAAc,EAAE;EACjB,CAAC,CACD;EACDC,KAAK,EAAE,CACN;IAAEH,cAAc,EAAE,wBAAwB;IAAEI,KAAK,EAAE,aAAa;IAAEC,KAAK,EAAE;EAAY,CAAC,EACtF;IAAEL,cAAc,EAAE,mBAAmB;IAAEI,KAAK,EAAE,eAAe;IAAEC,KAAK,EAAE;EAAU,CAA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