@youversion/platform-react-ui 1.22.1 → 1.22.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"verse.d.ts","sourceRoot":"","sources":["../../src/components/verse.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,kCAAkC,CAAC;AAgBxE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAyBzD,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAClC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAyNF;;GAEG;AACH,KAAK,UAAU,GAAG;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC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M,EAAE,KAAK,IAAI,CAAC;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,+GA8FzB,CAAC"}
package/dist/index.cjs CHANGED
@@ -15983,6 +15983,44 @@ var Footnote = (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
15983
15983
  }
15984
15984
  );
15985
15985
 
15986
+ // src/lib/bible-text-error.ts
15987
+ var PASSAGE_NOT_FOUND_MESSAGE = "This passage isn't available in the selected Bible version.";
15988
+ var INVALID_APP_KEY_MESSAGE = "This Bible content couldn't be loaded because the app key is missing or invalid.";
15989
+ var FORBIDDEN_MESSAGE = "This app isn't allowed to access this Bible content.";
15990
+ var UNREACHABLE_SERVER_MESSAGE = "The Bible server couldn't be reached. Check your connection and try again.";
15991
+ var RATE_LIMITED_MESSAGE = "The Bible service is receiving too many requests right now. Please wait a moment and try again.";
15992
+ var SERVER_ERROR_MESSAGE = "The Bible service is having trouble right now. Please try again in a moment.";
15993
+ var GENERIC_ERROR_MESSAGE = "We couldn't load this Bible passage. Please try again.";
15994
+ function isUnreachableServerError(message) {
15995
+ return message.includes("failed to fetch") || message.includes("networkerror") || message.includes("network request failed") || message.includes("load failed") || message.includes("request timeout");
15996
+ }
15997
+ function getBibleTextErrorMessage(error46) {
15998
+ const status = error46.status;
15999
+ const message = error46.message.toLowerCase();
16000
+ if (status === 401) {
16001
+ return INVALID_APP_KEY_MESSAGE;
16002
+ }
16003
+ if (status === 403) {
16004
+ return FORBIDDEN_MESSAGE;
16005
+ }
16006
+ if (status === 429) {
16007
+ return RATE_LIMITED_MESSAGE;
16008
+ }
16009
+ if (status !== void 0 && status >= 500) {
16010
+ return SERVER_ERROR_MESSAGE;
16011
+ }
16012
+ if (status === 404 || message.includes("not found")) {
16013
+ return PASSAGE_NOT_FOUND_MESSAGE;
16014
+ }
16015
+ if (typeof navigator !== "undefined" && navigator.onLine === false) {
16016
+ return UNREACHABLE_SERVER_MESSAGE;
16017
+ }
16018
+ if (isUnreachableServerError(message)) {
16019
+ return UNREACHABLE_SERVER_MESSAGE;
16020
+ }
16021
+ return GENERIC_ERROR_MESSAGE;
16022
+ }
16023
+
15986
16024
  // src/lib/verse-html-utils.ts
15987
16025
  var INTER_FONT = '"Inter", sans-serif';
15988
16026
  var SOURCE_SERIF_FONT = '"Source Serif 4", serif';
@@ -16079,8 +16117,7 @@ var VerseFootnoteButton = (0, import_react3.memo)(function VerseFootnoteButton2(
16079
16117
  )
16080
16118
  ] });
16081
16119
  });
16082
- var VERSE_UNAVAILABLE_MESSAGE = "Your previously selected Bible verse is unavailable.";
16083
- function VerseUnavailableMessage() {
16120
+ function VerseUnavailableMessage({ message }) {
16084
16121
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
16085
16122
  "div",
16086
16123
  {
@@ -16089,7 +16126,7 @@ function VerseUnavailableMessage() {
16089
16126
  className: "yv:flex yv:items-center yv:justify-center yv:gap-2.5 yv:px-3 yv:py-2.5 yv:text-foreground",
16090
16127
  children: [
16091
16128
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ExclamationCircle, { className: "yv:size-5 yv:shrink-0 yv:text-foreground" }),
16092
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "yv:m-0 yv:text-[13px] yv:font-medium yv:leading-tight", children: VERSE_UNAVAILABLE_MESSAGE })
16129
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "yv:m-0 yv:text-[13px] yv:font-medium yv:leading-tight", children: message })
16093
16130
  ]
16094
16131
  }
16095
16132
  );
@@ -16300,7 +16337,7 @@ var BibleTextView = (0, import_react3.forwardRef)(
16300
16337
  );
16301
16338
  }
16302
16339
  if (currentError) {
16303
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, "data-yv-sdk": true, "data-yv-theme": currentTheme, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VerseUnavailableMessage, {}) });
16340
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref, "data-yv-sdk": true, "data-yv-theme": currentTheme, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VerseUnavailableMessage, { message: getBibleTextErrorMessage(currentError) }) });
16304
16341
  }
16305
16342
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
16306
16343
  "div",
package/dist/index.js CHANGED
@@ -15966,6 +15966,44 @@ var Footnote = (props) => /* @__PURE__ */ jsx21(
15966
15966
  }
15967
15967
  );
15968
15968
 
15969
+ // src/lib/bible-text-error.ts
15970
+ var PASSAGE_NOT_FOUND_MESSAGE = "This passage isn't available in the selected Bible version.";
15971
+ var INVALID_APP_KEY_MESSAGE = "This Bible content couldn't be loaded because the app key is missing or invalid.";
15972
+ var FORBIDDEN_MESSAGE = "This app isn't allowed to access this Bible content.";
15973
+ var UNREACHABLE_SERVER_MESSAGE = "The Bible server couldn't be reached. Check your connection and try again.";
15974
+ var RATE_LIMITED_MESSAGE = "The Bible service is receiving too many requests right now. Please wait a moment and try again.";
15975
+ var SERVER_ERROR_MESSAGE = "The Bible service is having trouble right now. Please try again in a moment.";
15976
+ var GENERIC_ERROR_MESSAGE = "We couldn't load this Bible passage. Please try again.";
15977
+ function isUnreachableServerError(message) {
15978
+ return message.includes("failed to fetch") || message.includes("networkerror") || message.includes("network request failed") || message.includes("load failed") || message.includes("request timeout");
15979
+ }
15980
+ function getBibleTextErrorMessage(error46) {
15981
+ const status = error46.status;
15982
+ const message = error46.message.toLowerCase();
15983
+ if (status === 401) {
15984
+ return INVALID_APP_KEY_MESSAGE;
15985
+ }
15986
+ if (status === 403) {
15987
+ return FORBIDDEN_MESSAGE;
15988
+ }
15989
+ if (status === 429) {
15990
+ return RATE_LIMITED_MESSAGE;
15991
+ }
15992
+ if (status !== void 0 && status >= 500) {
15993
+ return SERVER_ERROR_MESSAGE;
15994
+ }
15995
+ if (status === 404 || message.includes("not found")) {
15996
+ return PASSAGE_NOT_FOUND_MESSAGE;
15997
+ }
15998
+ if (typeof navigator !== "undefined" && navigator.onLine === false) {
15999
+ return UNREACHABLE_SERVER_MESSAGE;
16000
+ }
16001
+ if (isUnreachableServerError(message)) {
16002
+ return UNREACHABLE_SERVER_MESSAGE;
16003
+ }
16004
+ return GENERIC_ERROR_MESSAGE;
16005
+ }
16006
+
15969
16007
  // src/lib/verse-html-utils.ts
15970
16008
  var INTER_FONT = '"Inter", sans-serif';
15971
16009
  var SOURCE_SERIF_FONT = '"Source Serif 4", serif';
@@ -16062,8 +16100,7 @@ var VerseFootnoteButton = memo(function VerseFootnoteButton2({
16062
16100
  )
16063
16101
  ] });
16064
16102
  });
16065
- var VERSE_UNAVAILABLE_MESSAGE = "Your previously selected Bible verse is unavailable.";
16066
- function VerseUnavailableMessage() {
16103
+ function VerseUnavailableMessage({ message }) {
16067
16104
  return /* @__PURE__ */ jsxs7(
16068
16105
  "div",
16069
16106
  {
@@ -16072,7 +16109,7 @@ function VerseUnavailableMessage() {
16072
16109
  className: "yv:flex yv:items-center yv:justify-center yv:gap-2.5 yv:px-3 yv:py-2.5 yv:text-foreground",
16073
16110
  children: [
16074
16111
  /* @__PURE__ */ jsx22(ExclamationCircle, { className: "yv:size-5 yv:shrink-0 yv:text-foreground" }),
16075
- /* @__PURE__ */ jsx22("p", { className: "yv:m-0 yv:text-[13px] yv:font-medium yv:leading-tight", children: VERSE_UNAVAILABLE_MESSAGE })
16112
+ /* @__PURE__ */ jsx22("p", { className: "yv:m-0 yv:text-[13px] yv:font-medium yv:leading-tight", children: message })
16076
16113
  ]
16077
16114
  }
16078
16115
  );
@@ -16283,7 +16320,7 @@ var BibleTextView = forwardRef2(
16283
16320
  );
16284
16321
  }
16285
16322
  if (currentError) {
16286
- return /* @__PURE__ */ jsx22("div", { ref, "data-yv-sdk": true, "data-yv-theme": currentTheme, children: /* @__PURE__ */ jsx22(VerseUnavailableMessage, {}) });
16323
+ return /* @__PURE__ */ jsx22("div", { ref, "data-yv-sdk": true, "data-yv-theme": currentTheme, children: /* @__PURE__ */ jsx22(VerseUnavailableMessage, { message: getBibleTextErrorMessage(currentError) }) });
16287
16324
  }
16288
16325
  return /* @__PURE__ */ jsx22(
16289
16326
  "div",
@@ -0,0 +1,6 @@
1
+ type BibleTextError = Error & {
2
+ status?: number;
3
+ };
4
+ export declare function getBibleTextErrorMessage(error: BibleTextError): string;
5
+ export {};
6
+ //# sourceMappingURL=bible-text-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bible-text-error.d.ts","sourceRoot":"","sources":["../../src/lib/bible-text-error.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,KAAK,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAwBF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAiCtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youversion/platform-react-ui",
3
- "version": "1.22.1",
3
+ "version": "1.22.2",
4
4
  "description": "Pre-built React components for Bible applications with styling included.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "clsx": "2.1.1",
38
38
  "tailwind-merge": "3.3.1",
39
39
  "tw-animate-css": "1.4.0",
40
- "@youversion/platform-core": "1.22.1",
41
- "@youversion/platform-react-hooks": "1.22.1"
40
+ "@youversion/platform-core": "1.22.2",
41
+ "@youversion/platform-react-hooks": "1.22.2"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": ">=19.1.0 <20.0.0",