@rork-ai/toolkit-sdk 0.2.31 → 0.2.33

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.
Files changed (36) hide show
  1. package/lib/module/dev/sdk53/index.js +1 -1
  2. package/lib/module/dev/sdk53/index.js.map +1 -1
  3. package/lib/module/dev/sdk54/index.js +1 -1
  4. package/lib/module/dev/sdk54/index.js.map +1 -1
  5. package/lib/module/metro/index.js +26 -0
  6. package/lib/module/metro/index.js.map +1 -1
  7. package/lib/module/polyfills/alert.js +4 -0
  8. package/lib/module/polyfills/alert.js.map +1 -0
  9. package/lib/module/{dev/patch-alert/patch-alert.web.js → polyfills/alert.web.js} +1 -1
  10. package/lib/module/polyfills/alert.web.js.map +1 -0
  11. package/lib/module/polyfills/haptics.web.js +54 -0
  12. package/lib/module/polyfills/haptics.web.js.map +1 -0
  13. package/lib/typescript/src/dev/sdk53/index.d.ts +1 -1
  14. package/lib/typescript/src/dev/sdk53/index.d.ts.map +1 -1
  15. package/lib/typescript/src/dev/sdk54/index.d.ts +1 -1
  16. package/lib/typescript/src/dev/sdk54/index.d.ts.map +1 -1
  17. package/lib/typescript/src/polyfills/alert.d.ts +2 -0
  18. package/lib/typescript/src/polyfills/alert.d.ts.map +1 -0
  19. package/lib/typescript/src/polyfills/alert.web.d.ts +2 -0
  20. package/lib/typescript/src/polyfills/alert.web.d.ts.map +1 -0
  21. package/lib/typescript/src/polyfills/haptics.web.d.ts +20 -0
  22. package/lib/typescript/src/polyfills/haptics.web.d.ts.map +1 -0
  23. package/package.json +1 -1
  24. package/src/dev/sdk53/index.tsx +1 -1
  25. package/src/dev/sdk54/index.tsx +1 -1
  26. package/src/metro/index.js +28 -0
  27. package/src/polyfills/haptics.web.ts +68 -0
  28. package/lib/module/dev/patch-alert/patch-alert.js +0 -4
  29. package/lib/module/dev/patch-alert/patch-alert.js.map +0 -1
  30. package/lib/module/dev/patch-alert/patch-alert.web.js.map +0 -1
  31. package/lib/typescript/src/dev/patch-alert/patch-alert.d.ts +0 -2
  32. package/lib/typescript/src/dev/patch-alert/patch-alert.d.ts.map +0 -1
  33. package/lib/typescript/src/dev/patch-alert/patch-alert.web.d.ts +0 -2
  34. package/lib/typescript/src/dev/patch-alert/patch-alert.web.d.ts.map +0 -1
  35. /package/src/{dev/patch-alert/patch-alert.tsx → polyfills/alert.ts} +0 -0
  36. /package/src/{dev/patch-alert/patch-alert.web.tsx → polyfills/alert.web.ts} +0 -0
@@ -3,7 +3,7 @@
3
3
  import { RorkErrorBoundary } from "../error-boundary.js";
4
4
  import { RorkSafeInsets } from "../safe-insets-content";
5
5
  import { BundleInspector } from "./inspector";
6
- import "../patch-alert/patch-alert";
6
+ import "../../polyfills/alert";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export function RorkDevWrapper({
9
9
  children
@@ -1 +1 @@
1
- {"version":3,"names":["RorkErrorBoundary","RorkSafeInsets","BundleInspector","jsx","_jsx","RorkDevWrapper","children"],"sourceRoot":"../../../../src","sources":["dev/sdk53/index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,sBAAmB;AACrD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,aAAa;AAE7C,OAAO,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpC,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAwC,CAAC,EAAE;EAC1E,oBACEF,IAAA,CAACJ,iBAAiB;IAAAM,QAAA,eAChBF,IAAA,CAACF,eAAe;MAAAI,QAAA,eACdF,IAAA,CAACH,cAAc;QAAAK,QAAA,EAAEA;MAAQ,CAAiB;IAAC,CAC5B;EAAC,CACD,CAAC;AAExB","ignoreList":[]}
1
+ {"version":3,"names":["RorkErrorBoundary","RorkSafeInsets","BundleInspector","jsx","_jsx","RorkDevWrapper","children"],"sourceRoot":"../../../../src","sources":["dev/sdk53/index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,sBAAmB;AACrD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,aAAa;AAE7C,OAAO,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAwC,CAAC,EAAE;EAC1E,oBACEF,IAAA,CAACJ,iBAAiB;IAAAM,QAAA,eAChBF,IAAA,CAACF,eAAe;MAAAI,QAAA,eACdF,IAAA,CAACH,cAAc;QAAAK,QAAA,EAAEA;MAAQ,CAAiB;IAAC,CAC5B;EAAC,CACD,CAAC;AAExB","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  import { RorkErrorBoundary } from "../error-boundary.js";
4
4
  import { RorkSafeInsets } from "../safe-insets-content";
5
5
  import { BundleInspector } from "./inspector";
6
- import "../patch-alert/patch-alert";
6
+ import "../../polyfills/alert";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export function RorkDevWrapper({
9
9
  children
@@ -1 +1 @@
1
- {"version":3,"names":["RorkErrorBoundary","RorkSafeInsets","BundleInspector","jsx","_jsx","RorkDevWrapper","children"],"sourceRoot":"../../../../src","sources":["dev/sdk54/index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,sBAAmB;AACrD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,aAAa;AAE7C,OAAO,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpC,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAwC,CAAC,EAAE;EAC1E,oBACEF,IAAA,CAACJ,iBAAiB;IAAAM,QAAA,eAChBF,IAAA,CAACF,eAAe;MAAAI,QAAA,eACdF,IAAA,CAACH,cAAc;QAAAK,QAAA,EAAEA;MAAQ,CAAiB;IAAC,CAC5B;EAAC,CACD,CAAC;AAExB","ignoreList":[]}
1
+ {"version":3,"names":["RorkErrorBoundary","RorkSafeInsets","BundleInspector","jsx","_jsx","RorkDevWrapper","children"],"sourceRoot":"../../../../src","sources":["dev/sdk54/index.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,sBAAmB;AACrD,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,eAAe,QAAQ,aAAa;AAE7C,OAAO,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAwC,CAAC,EAAE;EAC1E,oBACEF,IAAA,CAACJ,iBAAiB;IAAAM,QAAA,eAChBF,IAAA,CAACF,eAAe;MAAAI,QAAA,eACdF,IAAA,CAACH,cAAc;QAAAK,QAAA,EAAEA;MAAQ,CAAiB;IAAC,CAC5B;EAAC,CACD,CAAC;AAExB","ignoreList":[]}
@@ -1,15 +1,41 @@
1
1
  "use strict";
2
2
 
3
+ const path = require("path");
4
+
3
5
  /**
4
6
  * Metro configuration helper for Rork
5
7
  * Automatically wraps _layout.tsx with Rork providers
8
+ * and redirects expo-haptics to web polyfill on web platform
6
9
  */
10
+
11
+ const libPath = path.resolve(__dirname, "../lib/module/");
7
12
  function withRorkMetro(config) {
13
+ const originalResolveRequest = config.resolver?.resolveRequest;
8
14
  return {
9
15
  ...config,
10
16
  transformer: {
11
17
  ...config.transformer,
12
18
  babelTransformerPath: require.resolve("@rork-ai/toolkit-sdk/metro-transformer")
19
+ },
20
+ resolver: {
21
+ ...config.resolver,
22
+ resolveRequest: (context, moduleName, platform) => {
23
+ // Redirect expo-haptics to our web polyfill on web platform
24
+ if (moduleName === "expo-haptics" && platform === "web") {
25
+ return {
26
+ filePath: path.resolve(libPath, "polyfills/haptics.web.ts"),
27
+ type: "sourceFile"
28
+ };
29
+ }
30
+
31
+ // Use original resolver if provided, otherwise use default
32
+ if (originalResolveRequest) {
33
+ return originalResolveRequest(context, moduleName, platform);
34
+ }
35
+
36
+ // Fall back to default resolution
37
+ return context.resolveRequest(context, moduleName, platform);
38
+ }
13
39
  }
14
40
  };
15
41
  }
@@ -1 +1 @@
1
- {"version":3,"names":["withRorkMetro","config","transformer","babelTransformerPath","require","resolve","module","exports"],"sourceRoot":"../../../src","sources":["metro/index.js"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAACC,MAAM,EAAE;EAC7B,OAAO;IACL,GAAGA,MAAM;IACTC,WAAW,EAAE;MACX,GAAGD,MAAM,CAACC,WAAW;MACrBC,oBAAoB,EAAEC,OAAO,CAACC,OAAO,CACnC,wCACF;IACF;EACF,CAAC;AACH;AAEAC,MAAM,CAACC,OAAO,GAAG;EAAEP;AAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["path","require","libPath","resolve","__dirname","withRorkMetro","config","originalResolveRequest","resolver","resolveRequest","transformer","babelTransformerPath","context","moduleName","platform","filePath","type","module","exports"],"sourceRoot":"../../../src","sources":["metro/index.js"],"mappings":";;AAAA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;;AAE5B;AACA;AACA;AACA;AACA;;AAEA,MAAMC,OAAO,GAAGF,IAAI,CAACG,OAAO,CAACC,SAAS,EAAE,gBAAgB,CAAC;AAEzD,SAASC,aAAaA,CAACC,MAAM,EAAE;EAC7B,MAAMC,sBAAsB,GAAGD,MAAM,CAACE,QAAQ,EAAEC,cAAc;EAE9D,OAAO;IACL,GAAGH,MAAM;IACTI,WAAW,EAAE;MACX,GAAGJ,MAAM,CAACI,WAAW;MACrBC,oBAAoB,EAAEV,OAAO,CAACE,OAAO,CACnC,wCACF;IACF,CAAC;IACDK,QAAQ,EAAE;MACR,GAAGF,MAAM,CAACE,QAAQ;MAClBC,cAAc,EAAEA,CAACG,OAAO,EAAEC,UAAU,EAAEC,QAAQ,KAAK;QACjD;QACA,IAAID,UAAU,KAAK,cAAc,IAAIC,QAAQ,KAAK,KAAK,EAAE;UACvD,OAAO;YACLC,QAAQ,EAAEf,IAAI,CAACG,OAAO,CAACD,OAAO,EAAE,0BAA0B,CAAC;YAC3Dc,IAAI,EAAE;UACR,CAAC;QACH;;QAEA;QACA,IAAIT,sBAAsB,EAAE;UAC1B,OAAOA,sBAAsB,CAACK,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC;QAC9D;;QAEA;QACA,OAAOF,OAAO,CAACH,cAAc,CAACG,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC;MAC9D;IACF;EACF,CAAC;AACH;AAEAG,MAAM,CAACC,OAAO,GAAG;EAAEb;AAAc,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["polyfills/alert.ts"],"mappings":";;AAAA","ignoreList":[]}
@@ -4,4 +4,4 @@ import AlertNew from "@blazejkustra/react-native-alert";
4
4
  import { Alert } from "react-native";
5
5
  Alert.alert = AlertNew.alert;
6
6
  Alert.prompt = AlertNew.prompt;
7
- //# sourceMappingURL=patch-alert.web.js.map
7
+ //# sourceMappingURL=alert.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AlertNew","Alert","alert","prompt"],"sourceRoot":"../../../src","sources":["polyfills/alert.web.ts"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,kCAAkC;AACvD,SAASC,KAAK,QAAQ,cAAc;AAEpCA,KAAK,CAACC,KAAK,GAAGF,QAAQ,CAACE,KAAK;AAC5BD,KAAK,CAACE,MAAM,GAAGH,QAAQ,CAACG,MAAM","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Web polyfill for expo-haptics using the Vibration API
5
+ * This provides haptic-like feedback on web browsers that support vibration
6
+ */
7
+
8
+ export let NotificationFeedbackType = /*#__PURE__*/function (NotificationFeedbackType) {
9
+ NotificationFeedbackType["Success"] = "success";
10
+ NotificationFeedbackType["Warning"] = "warning";
11
+ NotificationFeedbackType["Error"] = "error";
12
+ return NotificationFeedbackType;
13
+ }({});
14
+ export let ImpactFeedbackStyle = /*#__PURE__*/function (ImpactFeedbackStyle) {
15
+ ImpactFeedbackStyle["Light"] = "light";
16
+ ImpactFeedbackStyle["Medium"] = "medium";
17
+ ImpactFeedbackStyle["Heavy"] = "heavy";
18
+ ImpactFeedbackStyle["Soft"] = "soft";
19
+ ImpactFeedbackStyle["Rigid"] = "rigid";
20
+ return ImpactFeedbackStyle;
21
+ }({});
22
+ const vibrationPatterns = {
23
+ [NotificationFeedbackType.Success]: [40, 100, 40],
24
+ [NotificationFeedbackType.Warning]: [50, 100, 50],
25
+ [NotificationFeedbackType.Error]: [60, 100, 60, 100, 60],
26
+ [ImpactFeedbackStyle.Light]: [40],
27
+ [ImpactFeedbackStyle.Medium]: [50],
28
+ [ImpactFeedbackStyle.Heavy]: [60],
29
+ [ImpactFeedbackStyle.Soft]: [35],
30
+ [ImpactFeedbackStyle.Rigid]: [45],
31
+ selection: [50]
32
+ };
33
+ function isVibrationAvailable() {
34
+ return typeof window !== 'undefined' && 'navigator' in window && 'vibrate' in navigator;
35
+ }
36
+ export async function selectionAsync() {
37
+ if (!isVibrationAvailable()) {
38
+ return;
39
+ }
40
+ navigator.vibrate(vibrationPatterns.selection);
41
+ }
42
+ export async function notificationAsync(type = NotificationFeedbackType.Success) {
43
+ if (!isVibrationAvailable()) {
44
+ return;
45
+ }
46
+ navigator.vibrate(vibrationPatterns[type]);
47
+ }
48
+ export async function impactAsync(style = ImpactFeedbackStyle.Medium) {
49
+ if (!isVibrationAvailable()) {
50
+ return;
51
+ }
52
+ navigator.vibrate(vibrationPatterns[style]);
53
+ }
54
+ //# sourceMappingURL=haptics.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NotificationFeedbackType","ImpactFeedbackStyle","vibrationPatterns","Success","Warning","Error","Light","Medium","Heavy","Soft","Rigid","selection","isVibrationAvailable","window","navigator","selectionAsync","vibrate","notificationAsync","type","impactAsync","style"],"sourceRoot":"../../../src","sources":["polyfills/haptics.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,WAAYA,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;AAMpC,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAU/B,MAAMC,iBAGL,GAAG;EACF,CAACF,wBAAwB,CAACG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;EACjD,CAACH,wBAAwB,CAACI,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;EACjD,CAACJ,wBAAwB,CAACK,KAAK,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC;EACxD,CAACJ,mBAAmB,CAACK,KAAK,GAAG,CAAC,EAAE,CAAC;EACjC,CAACL,mBAAmB,CAACM,MAAM,GAAG,CAAC,EAAE,CAAC;EAClC,CAACN,mBAAmB,CAACO,KAAK,GAAG,CAAC,EAAE,CAAC;EACjC,CAACP,mBAAmB,CAACQ,IAAI,GAAG,CAAC,EAAE,CAAC;EAChC,CAACR,mBAAmB,CAACS,KAAK,GAAG,CAAC,EAAE,CAAC;EACjCC,SAAS,EAAE,CAAC,EAAE;AAChB,CAAC;AAED,SAASC,oBAAoBA,CAAA,EAAY;EACvC,OACE,OAAOC,MAAM,KAAK,WAAW,IAC7B,WAAW,IAAIA,MAAM,IACrB,SAAS,IAAIC,SAAS;AAE1B;AAEA,OAAO,eAAeC,cAAcA,CAAA,EAAkB;EACpD,IAAI,CAACH,oBAAoB,CAAC,CAAC,EAAE;IAC3B;EACF;EACAE,SAAS,CAACE,OAAO,CAACd,iBAAiB,CAACS,SAAS,CAAC;AAChD;AAEA,OAAO,eAAeM,iBAAiBA,CACrCC,IAA8B,GAAGlB,wBAAwB,CAACG,OAAO,EAClD;EACf,IAAI,CAACS,oBAAoB,CAAC,CAAC,EAAE;IAC3B;EACF;EACAE,SAAS,CAACE,OAAO,CAACd,iBAAiB,CAACgB,IAAI,CAAC,CAAC;AAC5C;AAEA,OAAO,eAAeC,WAAWA,CAC/BC,KAA0B,GAAGnB,mBAAmB,CAACM,MAAM,EACxC;EACf,IAAI,CAACK,oBAAoB,CAAC,CAAC,EAAE;IAC3B;EACF;EACAE,SAAS,CAACE,OAAO,CAACd,iBAAiB,CAACkB,KAAK,CAAC,CAAC;AAC7C","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import "../patch-alert/patch-alert";
1
+ import "../../polyfills/alert";
2
2
  export declare function RorkDevWrapper({ children }: {
3
3
  children: React.ReactNode;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/index.tsx"],"names":[],"mappings":"AAIA,OAAO,4BAA4B,CAAC;AAEpC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk53/index.tsx"],"names":[],"mappings":"AAIA,OAAO,uBAAuB,CAAC;AAE/B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
@@ -1,4 +1,4 @@
1
- import "../patch-alert/patch-alert";
1
+ import "../../polyfills/alert";
2
2
  export declare function RorkDevWrapper({ children }: {
3
3
  children: React.ReactNode;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/index.tsx"],"names":[],"mappings":"AAIA,OAAO,4BAA4B,CAAC;AAEpC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dev/sdk54/index.tsx"],"names":[],"mappings":"AAIA,OAAO,uBAAuB,CAAC;AAE/B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAQzE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/alert.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Web polyfill for expo-haptics using the Vibration API
3
+ * This provides haptic-like feedback on web browsers that support vibration
4
+ */
5
+ export declare enum NotificationFeedbackType {
6
+ Success = "success",
7
+ Warning = "warning",
8
+ Error = "error"
9
+ }
10
+ export declare enum ImpactFeedbackStyle {
11
+ Light = "light",
12
+ Medium = "medium",
13
+ Heavy = "heavy",
14
+ Soft = "soft",
15
+ Rigid = "rigid"
16
+ }
17
+ export declare function selectionAsync(): Promise<void>;
18
+ export declare function notificationAsync(type?: NotificationFeedbackType): Promise<void>;
19
+ export declare function impactAsync(style?: ImpactFeedbackStyle): Promise<void>;
20
+ //# sourceMappingURL=haptics.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"haptics.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/haptics.web.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AA2BD,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAKpD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,GAAE,wBAA2D,GAChE,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,WAAW,CAC/B,KAAK,GAAE,mBAAgD,GACtD,OAAO,CAAC,IAAI,CAAC,CAKf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rork-ai/toolkit-sdk",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "toolkit-sdk",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -2,7 +2,7 @@ import { RorkErrorBoundary } from "../error-boundary";
2
2
  import { RorkSafeInsets } from "../safe-insets-content";
3
3
  import { BundleInspector } from "./inspector";
4
4
 
5
- import "../patch-alert/patch-alert";
5
+ import "../../polyfills/alert";
6
6
 
7
7
  export function RorkDevWrapper({ children }: { children: React.ReactNode }) {
8
8
  return (
@@ -2,7 +2,7 @@ import { RorkErrorBoundary } from "../error-boundary";
2
2
  import { RorkSafeInsets } from "../safe-insets-content";
3
3
  import { BundleInspector } from "./inspector";
4
4
 
5
- import "../patch-alert/patch-alert";
5
+ import "../../polyfills/alert";
6
6
 
7
7
  export function RorkDevWrapper({ children }: { children: React.ReactNode }) {
8
8
  return (
@@ -1,8 +1,16 @@
1
+ const path = require("path");
2
+
1
3
  /**
2
4
  * Metro configuration helper for Rork
3
5
  * Automatically wraps _layout.tsx with Rork providers
6
+ * and redirects expo-haptics to web polyfill on web platform
4
7
  */
8
+
9
+ const libPath = path.resolve(__dirname, "../lib/module/");
10
+
5
11
  function withRorkMetro(config) {
12
+ const originalResolveRequest = config.resolver?.resolveRequest;
13
+
6
14
  return {
7
15
  ...config,
8
16
  transformer: {
@@ -11,6 +19,26 @@ function withRorkMetro(config) {
11
19
  "@rork-ai/toolkit-sdk/metro-transformer",
12
20
  ),
13
21
  },
22
+ resolver: {
23
+ ...config.resolver,
24
+ resolveRequest: (context, moduleName, platform) => {
25
+ // Redirect expo-haptics to our web polyfill on web platform
26
+ if (moduleName === "expo-haptics" && platform === "web") {
27
+ return {
28
+ filePath: path.resolve(libPath, "polyfills/haptics.web.ts"),
29
+ type: "sourceFile",
30
+ };
31
+ }
32
+
33
+ // Use original resolver if provided, otherwise use default
34
+ if (originalResolveRequest) {
35
+ return originalResolveRequest(context, moduleName, platform);
36
+ }
37
+
38
+ // Fall back to default resolution
39
+ return context.resolveRequest(context, moduleName, platform);
40
+ },
41
+ },
14
42
  };
15
43
  }
16
44
 
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Web polyfill for expo-haptics using the Vibration API
3
+ * This provides haptic-like feedback on web browsers that support vibration
4
+ */
5
+
6
+ export enum NotificationFeedbackType {
7
+ Success = 'success',
8
+ Warning = 'warning',
9
+ Error = 'error',
10
+ }
11
+
12
+ export enum ImpactFeedbackStyle {
13
+ Light = 'light',
14
+ Medium = 'medium',
15
+ Heavy = 'heavy',
16
+ Soft = 'soft',
17
+ Rigid = 'rigid',
18
+ }
19
+
20
+ type VibratePattern = number | number[];
21
+
22
+ const vibrationPatterns: Record<
23
+ NotificationFeedbackType | ImpactFeedbackStyle | 'selection',
24
+ VibratePattern
25
+ > = {
26
+ [NotificationFeedbackType.Success]: [40, 100, 40],
27
+ [NotificationFeedbackType.Warning]: [50, 100, 50],
28
+ [NotificationFeedbackType.Error]: [60, 100, 60, 100, 60],
29
+ [ImpactFeedbackStyle.Light]: [40],
30
+ [ImpactFeedbackStyle.Medium]: [50],
31
+ [ImpactFeedbackStyle.Heavy]: [60],
32
+ [ImpactFeedbackStyle.Soft]: [35],
33
+ [ImpactFeedbackStyle.Rigid]: [45],
34
+ selection: [50],
35
+ };
36
+
37
+ function isVibrationAvailable(): boolean {
38
+ return (
39
+ typeof window !== 'undefined' &&
40
+ 'navigator' in window &&
41
+ 'vibrate' in navigator
42
+ );
43
+ }
44
+
45
+ export async function selectionAsync(): Promise<void> {
46
+ if (!isVibrationAvailable()) {
47
+ return;
48
+ }
49
+ navigator.vibrate(vibrationPatterns.selection);
50
+ }
51
+
52
+ export async function notificationAsync(
53
+ type: NotificationFeedbackType = NotificationFeedbackType.Success
54
+ ): Promise<void> {
55
+ if (!isVibrationAvailable()) {
56
+ return;
57
+ }
58
+ navigator.vibrate(vibrationPatterns[type]);
59
+ }
60
+
61
+ export async function impactAsync(
62
+ style: ImpactFeedbackStyle = ImpactFeedbackStyle.Medium
63
+ ): Promise<void> {
64
+ if (!isVibrationAvailable()) {
65
+ return;
66
+ }
67
+ navigator.vibrate(vibrationPatterns[style]);
68
+ }
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=patch-alert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["dev/patch-alert/patch-alert.tsx"],"mappings":";;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["AlertNew","Alert","alert","prompt"],"sourceRoot":"../../../../src","sources":["dev/patch-alert/patch-alert.web.tsx"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,kCAAkC;AACvD,SAASC,KAAK,QAAQ,cAAc;AAEpCA,KAAK,CAACC,KAAK,GAAGF,QAAQ,CAACE,KAAK;AAC5BD,KAAK,CAACE,MAAM,GAAGH,QAAQ,CAACG,MAAM","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=patch-alert.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-alert.d.ts","sourceRoot":"","sources":["../../../../../src/dev/patch-alert/patch-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=patch-alert.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch-alert.web.d.ts","sourceRoot":"","sources":["../../../../../src/dev/patch-alert/patch-alert.web.tsx"],"names":[],"mappings":""}