@skyporch/daykeeper-react-native 0.1.0 → 0.2.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/dist/native.js ADDED
@@ -0,0 +1,36 @@
1
+ import {
2
+ DaykeeperReactNativeApiError,
3
+ DaykeeperReactNativeClient,
4
+ DaykeeperReactNativeTransportError
5
+ } from "./chunk-BAQHY3R2.js";
6
+
7
+ // src/native.ts
8
+ var DaykeeperReactNativeClient2 = class extends DaykeeperReactNativeClient {
9
+ constructor(options) {
10
+ if (typeof options?.fetch !== "function") {
11
+ throw new DaykeeperReactNativeTransportError({
12
+ code: "INVALID_CONFIGURATION",
13
+ message: "Native Daykeeper requires an explicit Fetch transport that rejects redirects and omits cookies"
14
+ });
15
+ }
16
+ const transport = options.fetch;
17
+ super({
18
+ ...options,
19
+ fetch: (input, init) => {
20
+ const headers = new Headers(init?.headers);
21
+ headers.set("cache-control", "no-cache, no-store");
22
+ return transport(input, { ...init, headers });
23
+ }
24
+ });
25
+ }
26
+ };
27
+ function createDaykeeperReactNativeClient(options) {
28
+ return new DaykeeperReactNativeClient2(options);
29
+ }
30
+ export {
31
+ DaykeeperReactNativeApiError,
32
+ DaykeeperReactNativeClient2 as DaykeeperReactNativeClient,
33
+ DaykeeperReactNativeTransportError,
34
+ createDaykeeperReactNativeClient
35
+ };
36
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/native.ts"],"sourcesContent":["import {\n DaykeeperReactNativeClient as BaseClient,\n type DaykeeperReactNativeClientOptions as BaseOptions,\n} from \"./client.js\";\nimport { DaykeeperReactNativeTransportError } from \"./errors.js\";\n\nexport * from \"./index.js\";\n\nexport interface DaykeeperReactNativeClientOptions extends BaseOptions {\n /**\n * Required on native. Use explicit expo/fetch on the validated Expo runtime,\n * or a native Fetch implementation that enforces redirect:error and\n * credentials:omit and honors request Cache-Control directives. The\n * XHR-backed React Native global is not compliant.\n */\n fetch: typeof globalThis.fetch;\n}\n\nexport class DaykeeperReactNativeClient extends BaseClient {\n constructor(options: DaykeeperReactNativeClientOptions) {\n // The native conditional export must never quietly fall back to XHR Fetch.\n // A custom transport is a caller-owned trust boundary: a JS wrapper cannot\n // repair an implementation that ignores the native redirect policy.\n if (typeof options?.fetch !== \"function\") {\n throw new DaykeeperReactNativeTransportError({\n code: \"INVALID_CONFIGURATION\",\n message:\n \"Native Daykeeper requires an explicit Fetch transport that rejects redirects and omits cookies\",\n });\n }\n const transport = options.fetch;\n super({\n ...options,\n fetch: (input, init) => {\n // Expo 57 does not forward Fetch's cache option to URLSession/OkHttp.\n // no-cache revalidates an existing entry; no-store prevents new storage.\n // Keep this native-only so browser preflights gain no custom headers.\n const headers = new Headers(init?.headers);\n headers.set(\"cache-control\", \"no-cache, no-store\");\n return transport(input, { ...init, headers });\n },\n });\n }\n}\n\nexport function createDaykeeperReactNativeClient(\n options: DaykeeperReactNativeClientOptions,\n): DaykeeperReactNativeClient {\n return new DaykeeperReactNativeClient(options);\n}\n"],"mappings":";;;;;;;AAkBO,IAAMA,8BAAN,cAAyC,2BAAW;AAAA,EACzD,YAAY,SAA4C;AAItD,QAAI,OAAO,SAAS,UAAU,YAAY;AACxC,YAAM,IAAI,mCAAmC;AAAA,QAC3C,MAAM;AAAA,QACN,SACE;AAAA,MACJ,CAAC;AAAA,IACH;AACA,UAAM,YAAY,QAAQ;AAC1B,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,OAAO,CAAC,OAAO,SAAS;AAItB,cAAM,UAAU,IAAI,QAAQ,MAAM,OAAO;AACzC,gBAAQ,IAAI,iBAAiB,oBAAoB;AACjD,eAAO,UAAU,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC;AAAA,MAC9C;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEO,SAAS,iCACd,SAC4B;AAC5B,SAAO,IAAIA,4BAA2B,OAAO;AAC/C;","names":["DaykeeperReactNativeClient"]}
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@skyporch/daykeeper-react-native",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Official React Native SDK for Daykeeper customer support experiences",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
9
- "react-native": "./dist/index.js",
9
+ "react-native": "./dist/native.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
13
  "react-native": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
14
+ "types": "./dist/native.d.ts",
15
+ "import": "./dist/native.js",
16
+ "require": "./dist/native.cjs",
17
+ "default": "./dist/native.js"
16
18
  },
17
19
  "types": "./dist/index.d.ts",
18
20
  "import": "./dist/index.js",
@@ -25,22 +27,26 @@
25
27
  "dist",
26
28
  "CHANGELOG.md",
27
29
  "COMPATIBILITY.md",
30
+ "LICENSE-APACHE-2.0",
31
+ "NOTICE",
28
32
  "README.md"
29
33
  ],
30
34
  "scripts": {
31
- "build": "tsup src/index.ts --format esm,cjs --dts --sourcemap --target es2020 --clean",
32
- "check": "pnpm format:check && pnpm check:generated && pnpm typecheck && pnpm test && pnpm build && pnpm verify:exports && pnpm smoke:metro && pnpm pack:check",
33
- "check:generated": "pnpm generate && git diff --exit-code -- src/generated/schema.ts",
35
+ "build": "tsup src/index.ts src/native.ts --format esm,cjs --dts --sourcemap --target es2020 --clean",
36
+ "check": "pnpm format:check && pnpm check:generated && pnpm typecheck && pnpm test && pnpm test:hermes-harness && pnpm build && pnpm verify:exports && pnpm smoke:package && pnpm smoke:metro && pnpm pack:check",
37
+ "check:generated": "node scripts/check-generated.mjs",
34
38
  "format": "prettier --write .",
35
39
  "format:check": "prettier --check .",
36
40
  "generate": "openapi-typescript openapi/customer.yaml --output src/generated/schema.ts",
37
- "pack:check": "npm pack --dry-run --json",
41
+ "pack:check": "npm pack --dry-run --json && node scripts/verify-pack.mjs",
42
+ "smoke:package": "node scripts/package-smoke.mjs",
38
43
  "smoke:metro": "react-native bundle --platform ios --dev false --entry-file smoke/index.js --bundle-output .smoke/ios.jsbundle && react-native bundle --platform android --dev false --entry-file smoke/index.js --bundle-output .smoke/android.jsbundle",
39
- "test": "tsx --test \"test/**/*.test.ts\"",
44
+ "test": "node scripts/run-tests.mjs",
40
45
  "typecheck": "tsc -p tsconfig.json --noEmit",
41
46
  "verify:exports": "node scripts/verify-exports.mjs",
42
47
  "prepublishOnly": "node scripts/verify-release.mjs",
43
- "prepack": "pnpm run build"
48
+ "prepack": "pnpm run build",
49
+ "test:hermes-harness": "node --test verification/hermes/safety.test.mjs && tsx --test verification/hermes/android/fixture.test.ts"
44
50
  },
45
51
  "packageManager": "pnpm@10.8.0",
46
52
  "engines": {