@phystack/checkout-react 4.4.29

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.
@@ -0,0 +1,10 @@
1
+ import { CheckoutServiceInterface } from "@phystack/checkout";
2
+ import React from "react";
3
+ interface CheckoutProviderProps {
4
+ children: React.ReactNode;
5
+ service: CheckoutServiceInterface;
6
+ }
7
+ export declare const CheckoutProvider: React.FC<CheckoutProviderProps>;
8
+ export declare const useCheckout: () => CheckoutServiceInterface;
9
+ export {};
10
+ //# sourceMappingURL=checkout-service.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-service.provider.d.ts","sourceRoot":"","sources":["../src/checkout-service.provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,wBAAwB,CAAC;CACnC;AACD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAS5D,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,wBAM9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React, { createContext, useContext } from "react";
2
+ const CheckoutContext = createContext(null);
3
+ export const CheckoutProvider = ({ children, service, }) => {
4
+ return (React.createElement(CheckoutContext.Provider, { value: service }, children));
5
+ };
6
+ export const useCheckout = () => {
7
+ const ctx = useContext(CheckoutContext);
8
+ if (!ctx) {
9
+ throw new Error("useCheckout must be used within a CheckoutProvider");
10
+ }
11
+ return ctx;
12
+ };
13
+ //# sourceMappingURL=checkout-service.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-service.provider.js","sourceRoot":"","sources":["../src/checkout-service.provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,MAAM,eAAe,GAAG,aAAa,CAAkC,IAAI,CAAC,CAAC;AAM7E,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,QAAQ,EACR,OAAO,GACR,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACrC,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAA6B,EAAE;IACxD,MAAM,GAAG,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IACxC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./checkout-service.provider";
2
+ export * from "@phystack/checkout";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./checkout-service.provider";
2
+ export * from "@phystack/checkout";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@phystack/checkout-react",
3
+ "version": "4.4.29",
4
+ "main": "dist/index.js",
5
+ "author": "https://build.phygrid.com/",
6
+ "keywords": [
7
+ "ombori checkout",
8
+ "phygrid checkout sdk",
9
+ "ombori self checkout",
10
+ "stripe online checkout",
11
+ "adyen card payment"
12
+ ],
13
+ "scripts": {
14
+ "build": "rimraf dist && tsc",
15
+ "format": "prettier --write \"src/**/*.{ts,js,json,md}\"",
16
+ "format:check": "prettier --check \"src/**/*.{ts,js,json,md}\"",
17
+ "typecheck": "tsc --noEmit"
18
+ },
19
+ "dependencies": {
20
+ "@phystack/checkout": "4.4.29"
21
+ },
22
+ "peerDependencies": {
23
+ "react": "^18.2.0"
24
+ },
25
+ "devDependencies": {
26
+ "prettier": "^3.4.2",
27
+ "rimraf": "^6.0.1",
28
+ "typescript": "^5.7.3"
29
+ },
30
+ "engines": {
31
+ "node": ">=20.0.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "license": "MIT",
37
+ "gitHead": "7dba834ca1f446f669992ff14352862d2fbcfe22"
38
+ }
@@ -0,0 +1,27 @@
1
+ import { CheckoutServiceInterface } from "@phystack/checkout";
2
+ import React, { createContext, useContext } from "react";
3
+
4
+ const CheckoutContext = createContext<CheckoutServiceInterface | null>(null);
5
+
6
+ interface CheckoutProviderProps {
7
+ children: React.ReactNode;
8
+ service: CheckoutServiceInterface;
9
+ }
10
+ export const CheckoutProvider: React.FC<CheckoutProviderProps> = ({
11
+ children,
12
+ service,
13
+ }) => {
14
+ return (
15
+ <CheckoutContext.Provider value={service}>
16
+ {children}
17
+ </CheckoutContext.Provider>
18
+ );
19
+ };
20
+
21
+ export const useCheckout = (): CheckoutServiceInterface => {
22
+ const ctx = useContext(CheckoutContext);
23
+ if (!ctx) {
24
+ throw new Error("useCheckout must be used within a CheckoutProvider");
25
+ }
26
+ return ctx;
27
+ };
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./checkout-service.provider";
2
+ export * from "@phystack/checkout";
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "node",
7
+ "jsx": "react",
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "sourceMap": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "strict": true,
14
+ "skipLibCheck": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "esModuleInterop": true,
17
+ "resolveJsonModule": true,
18
+ "isolatedModules": true,
19
+ "allowJs": true,
20
+ "allowSyntheticDefaultImports": true
21
+ },
22
+ "include": ["src"],
23
+ "exclude": ["node_modules", "dist"]
24
+ }