@youversion/platform-react-ui 0.4.1 → 0.4.3
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/README.md +102 -270
- package/dist/components/bible-chapter-picker.d.ts +8 -1
- package/dist/components/bible-chapter-picker.d.ts.map +1 -1
- package/dist/components/bible-reader.d.ts +31 -0
- package/dist/components/bible-reader.d.ts.map +1 -0
- package/dist/components/bible-reader.stories.d.ts +18 -0
- package/dist/components/bible-reader.stories.d.ts.map +1 -0
- package/dist/components/bible-version-picker.d.ts +9 -2
- package/dist/components/bible-version-picker.d.ts.map +1 -1
- package/dist/components/bible-version-picker.stories.d.ts.map +1 -1
- package/dist/components/bible-widget-view.stories.d.ts +2 -2
- package/dist/components/bible-widget-view.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +1016 -456
- package/dist/index.js +1016 -453
- package/dist/tailwind.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -12565,7 +12565,7 @@ var ApiClient = class {
|
|
|
12565
12565
|
/**
|
|
12566
12566
|
* Creates an instance of ApiClient.
|
|
12567
12567
|
*
|
|
12568
|
-
* @param config - The API configuration object containing baseUrl, timeout, and
|
|
12568
|
+
* @param config - The API configuration object containing baseUrl, timeout, and appKey.
|
|
12569
12569
|
*/
|
|
12570
12570
|
constructor(config2) {
|
|
12571
12571
|
__publicField(this, "baseURL");
|
|
@@ -12573,14 +12573,19 @@ var ApiClient = class {
|
|
|
12573
12573
|
__publicField(this, "defaultHeaders");
|
|
12574
12574
|
__publicField(this, "config");
|
|
12575
12575
|
this.config = {
|
|
12576
|
-
version: config2.version || "v1",
|
|
12577
12576
|
...config2
|
|
12578
12577
|
};
|
|
12579
|
-
|
|
12578
|
+
const apiHost = config2.apiHost ?? process.env.YVP_API_HOST ?? "api.youversion.com";
|
|
12579
|
+
if (!apiHost) {
|
|
12580
|
+
throw new Error(
|
|
12581
|
+
"ApiClient requires a host name. Provide an apiHost in the config or set the YVP_API_HOST environment variable."
|
|
12582
|
+
);
|
|
12583
|
+
}
|
|
12584
|
+
this.baseURL = "https://" + apiHost;
|
|
12580
12585
|
this.timeout = config2.timeout || 1e4;
|
|
12581
12586
|
this.defaultHeaders = {
|
|
12582
12587
|
"Content-Type": "application/json",
|
|
12583
|
-
"X-YVP-App-Key": this.config.
|
|
12588
|
+
"X-YVP-App-Key": this.config.appKey,
|
|
12584
12589
|
"X-YVP-Installation-Id": this.config.installationId || "web-sdk-default"
|
|
12585
12590
|
};
|
|
12586
12591
|
}
|
|
@@ -12719,9 +12724,6 @@ var BibleClient = class {
|
|
|
12719
12724
|
__publicField(this, "booleanSchema", external_exports.boolean());
|
|
12720
12725
|
this.client = client;
|
|
12721
12726
|
}
|
|
12722
|
-
get rootPath() {
|
|
12723
|
-
return `/${this.client.config.version}`;
|
|
12724
|
-
}
|
|
12725
12727
|
/**
|
|
12726
12728
|
* Fetches a collection of Bible versions filtered by language ranges.
|
|
12727
12729
|
*
|
|
@@ -12737,7 +12739,7 @@ var BibleClient = class {
|
|
|
12737
12739
|
if (license_id !== void 0) {
|
|
12738
12740
|
params.license_id = license_id;
|
|
12739
12741
|
}
|
|
12740
|
-
return this.client.get(
|
|
12742
|
+
return this.client.get(`/v1/bibles`, params);
|
|
12741
12743
|
}
|
|
12742
12744
|
/**
|
|
12743
12745
|
* Fetches a Bible version by its ID.
|
|
@@ -12746,7 +12748,7 @@ var BibleClient = class {
|
|
|
12746
12748
|
*/
|
|
12747
12749
|
async getVersion(id) {
|
|
12748
12750
|
this.versionIdSchema.parse(id);
|
|
12749
|
-
return this.client.get(
|
|
12751
|
+
return this.client.get(`/v1/bibles/${id}`);
|
|
12750
12752
|
}
|
|
12751
12753
|
/**
|
|
12752
12754
|
* Fetches all books for a given Bible version.
|
|
@@ -12756,7 +12758,7 @@ var BibleClient = class {
|
|
|
12756
12758
|
*/
|
|
12757
12759
|
async getBooks(versionId, canon) {
|
|
12758
12760
|
this.versionIdSchema.parse(versionId);
|
|
12759
|
-
return this.client.get(
|
|
12761
|
+
return this.client.get(`/v1/bibles/${versionId}/books`, {
|
|
12760
12762
|
...canon && { canon }
|
|
12761
12763
|
});
|
|
12762
12764
|
}
|
|
@@ -12769,7 +12771,7 @@ var BibleClient = class {
|
|
|
12769
12771
|
async getBook(versionId, book) {
|
|
12770
12772
|
this.versionIdSchema.parse(versionId);
|
|
12771
12773
|
this.bookSchema.parse(book);
|
|
12772
|
-
return this.client.get(
|
|
12774
|
+
return this.client.get(`/v1/bibles/${versionId}/books/${book}`);
|
|
12773
12775
|
}
|
|
12774
12776
|
/**
|
|
12775
12777
|
* Fetches all chapters for a specific book in a version.
|
|
@@ -12781,7 +12783,7 @@ var BibleClient = class {
|
|
|
12781
12783
|
this.versionIdSchema.parse(versionId);
|
|
12782
12784
|
this.bookSchema.parse(book);
|
|
12783
12785
|
return this.client.get(
|
|
12784
|
-
|
|
12786
|
+
`/v1/bibles/${versionId}/books/${book}/chapters`
|
|
12785
12787
|
);
|
|
12786
12788
|
}
|
|
12787
12789
|
/**
|
|
@@ -12796,7 +12798,7 @@ var BibleClient = class {
|
|
|
12796
12798
|
this.bookSchema.parse(book);
|
|
12797
12799
|
this.chapterSchema.parse(chapter);
|
|
12798
12800
|
return this.client.get(
|
|
12799
|
-
|
|
12801
|
+
`/v1/bibles/${versionId}/books/${book}/chapters/${chapter}`
|
|
12800
12802
|
);
|
|
12801
12803
|
}
|
|
12802
12804
|
/**
|
|
@@ -12811,7 +12813,7 @@ var BibleClient = class {
|
|
|
12811
12813
|
this.bookSchema.parse(book);
|
|
12812
12814
|
this.chapterSchema.parse(chapter);
|
|
12813
12815
|
return this.client.get(
|
|
12814
|
-
|
|
12816
|
+
`/v1/bibles/${versionId}/books/${book}/chapters/${chapter}/verses`
|
|
12815
12817
|
);
|
|
12816
12818
|
}
|
|
12817
12819
|
/**
|
|
@@ -12828,7 +12830,7 @@ var BibleClient = class {
|
|
|
12828
12830
|
this.chapterSchema.parse(chapter);
|
|
12829
12831
|
this.verseSchema.parse(verse);
|
|
12830
12832
|
return this.client.get(
|
|
12831
|
-
|
|
12833
|
+
`/v1/bibles/${versionId}/books/${book}/chapters/${chapter}/verses/${verse}`
|
|
12832
12834
|
);
|
|
12833
12835
|
}
|
|
12834
12836
|
/**
|
|
@@ -12869,10 +12871,7 @@ var BibleClient = class {
|
|
|
12869
12871
|
if (include_notes !== void 0) {
|
|
12870
12872
|
params.include_notes = include_notes;
|
|
12871
12873
|
}
|
|
12872
|
-
return this.client.get(
|
|
12873
|
-
`${this.rootPath}/bibles/${versionId}/passages/${usfm}`,
|
|
12874
|
-
params
|
|
12875
|
-
);
|
|
12874
|
+
return this.client.get(`/v1/bibles/${versionId}/passages/${usfm}`, params);
|
|
12876
12875
|
}
|
|
12877
12876
|
/**
|
|
12878
12877
|
* Fetches the indexing structure for a Bible version.
|
|
@@ -12881,14 +12880,14 @@ var BibleClient = class {
|
|
|
12881
12880
|
*/
|
|
12882
12881
|
async getIndex(versionId) {
|
|
12883
12882
|
this.versionIdSchema.parse(versionId);
|
|
12884
|
-
return this.client.get(
|
|
12883
|
+
return this.client.get(`/v1/bibles/${versionId}/index`);
|
|
12885
12884
|
}
|
|
12886
12885
|
/**
|
|
12887
12886
|
* Fetches the verse of the day calendar for an entire year.
|
|
12888
12887
|
* @returns A collection of VOTD objects for all days of the year.
|
|
12889
12888
|
*/
|
|
12890
12889
|
async getAllVOTDs() {
|
|
12891
|
-
return this.client.get(
|
|
12890
|
+
return this.client.get(`/v1/verse_of_the_days`);
|
|
12892
12891
|
}
|
|
12893
12892
|
/**
|
|
12894
12893
|
* Fetches the passage_id for the Verse Of The Day.
|
|
@@ -12906,7 +12905,7 @@ var BibleClient = class {
|
|
|
12906
12905
|
async getVOTD(day) {
|
|
12907
12906
|
const daySchema = external_exports.number().int().min(1).max(366);
|
|
12908
12907
|
daySchema.parse(day);
|
|
12909
|
-
return this.client.get(
|
|
12908
|
+
return this.client.get(`/v1/verse_of_the_days/${day}`);
|
|
12910
12909
|
}
|
|
12911
12910
|
};
|
|
12912
12911
|
var LanguagesClient = class {
|
|
@@ -12923,9 +12922,6 @@ var LanguagesClient = class {
|
|
|
12923
12922
|
__publicField(this, "countrySchema", external_exports.string().trim().length(2, "Country code must be a 2-character ISO 3166-1 alpha-2 code").toUpperCase());
|
|
12924
12923
|
this.client = client;
|
|
12925
12924
|
}
|
|
12926
|
-
get rootPath() {
|
|
12927
|
-
return `/${this.client.config.version}`;
|
|
12928
|
-
}
|
|
12929
12925
|
/**
|
|
12930
12926
|
* Fetches a collection of languages supported in the Platform.
|
|
12931
12927
|
* @param options Query parameters for pagination and filtering (country is required).
|
|
@@ -12943,7 +12939,7 @@ var LanguagesClient = class {
|
|
|
12943
12939
|
if (options.page_token !== void 0) {
|
|
12944
12940
|
params.page_token = options.page_token;
|
|
12945
12941
|
}
|
|
12946
|
-
return this.client.get(
|
|
12942
|
+
return this.client.get(`/v1/languages`, params);
|
|
12947
12943
|
}
|
|
12948
12944
|
/**
|
|
12949
12945
|
* Fetches details about a specific language in the Platform.
|
|
@@ -12952,7 +12948,7 @@ var LanguagesClient = class {
|
|
|
12952
12948
|
*/
|
|
12953
12949
|
async getLanguage(languageId) {
|
|
12954
12950
|
this.languageIdSchema.parse(languageId);
|
|
12955
|
-
return this.client.get(
|
|
12951
|
+
return this.client.get(`/v1/languages/${languageId}`);
|
|
12956
12952
|
}
|
|
12957
12953
|
};
|
|
12958
12954
|
var _a;
|
|
@@ -12969,11 +12965,11 @@ var YouVersionPlatformConfiguration = (_a = class {
|
|
|
12969
12965
|
localStorage.setItem("x-yvp-installation-id", newId);
|
|
12970
12966
|
return newId;
|
|
12971
12967
|
}
|
|
12972
|
-
static get
|
|
12973
|
-
return this.
|
|
12968
|
+
static get appKey() {
|
|
12969
|
+
return this._appKey;
|
|
12974
12970
|
}
|
|
12975
|
-
static set
|
|
12976
|
-
this.
|
|
12971
|
+
static set appKey(value) {
|
|
12972
|
+
this._appKey = value;
|
|
12977
12973
|
}
|
|
12978
12974
|
static get installationId() {
|
|
12979
12975
|
if (!this._installationId) {
|
|
@@ -13011,7 +13007,7 @@ var YouVersionPlatformConfiguration = (_a = class {
|
|
|
13011
13007
|
static set previewUserInfo(value) {
|
|
13012
13008
|
this._previewUserInfo = value;
|
|
13013
13009
|
}
|
|
13014
|
-
}, __publicField(_a, "
|
|
13010
|
+
}, __publicField(_a, "_appKey", null), __publicField(_a, "_installationId", null), __publicField(_a, "_accessToken", null), __publicField(_a, "_apiHost", "api.youversion.com"), __publicField(_a, "_isPreviewMode", false), __publicField(_a, "_previewUserInfo", null), _a);
|
|
13015
13011
|
var HighlightsClient = class {
|
|
13016
13012
|
/**
|
|
13017
13013
|
* Creates a new HighlightsClient instance.
|
|
@@ -13024,9 +13020,6 @@ var HighlightsClient = class {
|
|
|
13024
13020
|
__publicField(this, "colorSchema", external_exports.string().regex(/^[0-9a-f]{6}$/i, "Color must be a 6-character hex string without #"));
|
|
13025
13021
|
this.client = client;
|
|
13026
13022
|
}
|
|
13027
|
-
get rootPath() {
|
|
13028
|
-
return `/${this.client.config.version}`;
|
|
13029
|
-
}
|
|
13030
13023
|
/**
|
|
13031
13024
|
* Gets the authentication token, either from the provided parameter or from the platform configuration.
|
|
13032
13025
|
* @param lat Optional explicit long access token. If not provided, retrieves from YouVersionPlatformConfiguration.
|
|
@@ -13096,7 +13089,7 @@ var HighlightsClient = class {
|
|
|
13096
13089
|
this.validatePassageId(options.passage_id);
|
|
13097
13090
|
params.passage_id = options.passage_id;
|
|
13098
13091
|
}
|
|
13099
|
-
return this.client.get(
|
|
13092
|
+
return this.client.get(`/v1/highlights`, params);
|
|
13100
13093
|
}
|
|
13101
13094
|
/**
|
|
13102
13095
|
* Creates or updates a highlight on a passage.
|
|
@@ -13111,7 +13104,7 @@ var HighlightsClient = class {
|
|
|
13111
13104
|
this.validatePassageId(data.passage_id);
|
|
13112
13105
|
this.validateColor(data.color);
|
|
13113
13106
|
const token = this.getAuthToken(lat);
|
|
13114
|
-
return this.client.post(
|
|
13107
|
+
return this.client.post(`/v1/highlights`, data, { lat: token });
|
|
13115
13108
|
}
|
|
13116
13109
|
/**
|
|
13117
13110
|
* Clears highlights for a passage.
|
|
@@ -13131,7 +13124,7 @@ var HighlightsClient = class {
|
|
|
13131
13124
|
this.validateVersionId(options.version_id);
|
|
13132
13125
|
params.version_id = options.version_id;
|
|
13133
13126
|
}
|
|
13134
|
-
await this.client.delete(
|
|
13127
|
+
await this.client.delete(`/v1/highlights/${passageId}`, params);
|
|
13135
13128
|
}
|
|
13136
13129
|
};
|
|
13137
13130
|
var AuthClient = class {
|
|
@@ -13415,13 +13408,13 @@ var YouVersionAPI = class {
|
|
|
13415
13408
|
Accept: "application/json",
|
|
13416
13409
|
"Content-Type": "application/json"
|
|
13417
13410
|
};
|
|
13418
|
-
const
|
|
13419
|
-
if (
|
|
13420
|
-
headers["X-App-
|
|
13411
|
+
const appKey = YouVersionPlatformConfiguration.appKey;
|
|
13412
|
+
if (appKey) {
|
|
13413
|
+
headers["X-YVP-App-Key"] = appKey;
|
|
13421
13414
|
}
|
|
13422
13415
|
const installationId = YouVersionPlatformConfiguration.installationId;
|
|
13423
13416
|
if (installationId) {
|
|
13424
|
-
headers["
|
|
13417
|
+
headers["X-YVP-Installation-ID"] = installationId;
|
|
13425
13418
|
}
|
|
13426
13419
|
const request = new Request(url2.toString(), {
|
|
13427
13420
|
headers
|
|
@@ -13433,15 +13426,15 @@ var URLBuilder = class {
|
|
|
13433
13426
|
static get baseURL() {
|
|
13434
13427
|
return new URL(`https://${YouVersionPlatformConfiguration.apiHost}`);
|
|
13435
13428
|
}
|
|
13436
|
-
static authURL(
|
|
13437
|
-
if (typeof
|
|
13438
|
-
throw new Error("
|
|
13429
|
+
static authURL(appKey, requiredPermissions = /* @__PURE__ */ new Set(), optionalPermissions = /* @__PURE__ */ new Set()) {
|
|
13430
|
+
if (typeof appKey !== "string" || appKey.trim().length === 0) {
|
|
13431
|
+
throw new Error("appKey must be a non-empty string");
|
|
13439
13432
|
}
|
|
13440
13433
|
try {
|
|
13441
13434
|
const url2 = new URL(this.baseURL);
|
|
13442
13435
|
url2.pathname = "/auth/login";
|
|
13443
13436
|
const searchParams = new URLSearchParams();
|
|
13444
|
-
searchParams.append("
|
|
13437
|
+
searchParams.append("APP_KEY", appKey);
|
|
13445
13438
|
searchParams.append("language", "en");
|
|
13446
13439
|
if (requiredPermissions.size > 0) {
|
|
13447
13440
|
const requiredList = Array.from(requiredPermissions).map((p) => p.toString());
|
|
@@ -13503,11 +13496,11 @@ var YouVersionAPIUsers = class {
|
|
|
13503
13496
|
if (!optionalPermissions || !(optionalPermissions instanceof Set)) {
|
|
13504
13497
|
throw new Error("Invalid optionalPermissions: must be a Set");
|
|
13505
13498
|
}
|
|
13506
|
-
const
|
|
13507
|
-
if (!
|
|
13508
|
-
throw new Error("YouVersionPlatformConfiguration.
|
|
13499
|
+
const appKey = YouVersionPlatformConfiguration.appKey;
|
|
13500
|
+
if (!appKey) {
|
|
13501
|
+
throw new Error("YouVersionPlatformConfiguration.appKey must be set before calling signIn");
|
|
13509
13502
|
}
|
|
13510
|
-
const url2 = URLBuilder.authURL(
|
|
13503
|
+
const url2 = URLBuilder.authURL(appKey, requiredPermissions, optionalPermissions);
|
|
13511
13504
|
const strategy = AuthenticationStrategyRegistry.get();
|
|
13512
13505
|
const callbackUrl = await strategy.authenticate(url2);
|
|
13513
13506
|
const result = new SignInWithYouVersionResult(callbackUrl);
|
|
@@ -14153,7 +14146,7 @@ function Root3({
|
|
|
14153
14146
|
/* @__PURE__ */ jsx6(
|
|
14154
14147
|
Accordion,
|
|
14155
14148
|
{
|
|
14156
|
-
className: "yv:relative yv:overflow-y-auto yv:bg-background yv:mx-6
|
|
14149
|
+
className: "yv:relative yv:overflow-y-auto yv:bg-background yv:mx-6",
|
|
14157
14150
|
type: "single",
|
|
14158
14151
|
collapsible: true,
|
|
14159
14152
|
defaultValue: defaultBook || book || "GEN",
|
|
@@ -14221,206 +14214,936 @@ function Trigger3({ asChild = true, children, ...props }) {
|
|
|
14221
14214
|
const { books, loading } = useBooks(versionId);
|
|
14222
14215
|
const currentBook = books?.data?.find((bookItem) => bookItem.id === book);
|
|
14223
14216
|
const buttonText = loading ? "Loading..." : `${currentBook?.title || "Select a chapter"}${chapter ? ` ${chapter}` : ""}`;
|
|
14224
|
-
|
|
14217
|
+
const content = typeof children === "function" ? children({ book, chapter, currentBook, loading }) : children || /* @__PURE__ */ jsx6(Button, { variant: background === "light" ? "outline" : "default", children: buttonText });
|
|
14218
|
+
return /* @__PURE__ */ jsx6(PopoverTrigger, { asChild, ...props, children: content });
|
|
14225
14219
|
}
|
|
14226
14220
|
var BibleChapterPicker = Object.assign({}, { Root: Root3, Trigger: Trigger3 });
|
|
14227
14221
|
|
|
14228
|
-
// src/components/
|
|
14229
|
-
import
|
|
14230
|
-
import {
|
|
14222
|
+
// src/components/bible-reader.tsx
|
|
14223
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3 } from "react";
|
|
14224
|
+
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
14225
|
+
import { useBooks as useBooks2, useVersion as useVersion2 } from "@youversion/platform-react-hooks";
|
|
14231
14226
|
|
|
14232
|
-
// src/
|
|
14227
|
+
// src/components/bible-version-picker.tsx
|
|
14228
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState2, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
14229
|
+
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
14233
14230
|
import {
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
} from "react";
|
|
14231
|
+
useFilteredVersions,
|
|
14232
|
+
useVersion,
|
|
14233
|
+
useVersions,
|
|
14234
|
+
useLanguages
|
|
14235
|
+
} from "@youversion/platform-react-hooks";
|
|
14240
14236
|
|
|
14241
|
-
// src/
|
|
14242
|
-
import
|
|
14243
|
-
import {
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
if (onError) {
|
|
14255
|
-
onError(error46, errorInfo);
|
|
14237
|
+
// src/components/ui/item.tsx
|
|
14238
|
+
import "react";
|
|
14239
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
14240
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
14241
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
14242
|
+
function ItemGroup({ className, ...props }) {
|
|
14243
|
+
return /* @__PURE__ */ jsx7(
|
|
14244
|
+
"div",
|
|
14245
|
+
{
|
|
14246
|
+
role: "list",
|
|
14247
|
+
"data-slot": "item-group",
|
|
14248
|
+
className: cn("yv:group/item-group yv:flex yv:flex-col", className),
|
|
14249
|
+
...props
|
|
14256
14250
|
}
|
|
14257
|
-
|
|
14258
|
-
|
|
14251
|
+
);
|
|
14252
|
+
}
|
|
14253
|
+
var itemVariants = cva3(
|
|
14254
|
+
"yv:group/item yv:flex yv:items-center yv:border yv:border-transparent yv:text-sm yv:rounded-md yv:transition-colors yv:[a]:hover:bg-accent/50 yv:[a]:transition-colors yv:duration-100 yv:flex-wrap yv:outline-none yv:focus-visible:border-ring yv:focus-visible:ring-ring/50 yv:focus-visible:ring-[3px]",
|
|
14255
|
+
{
|
|
14256
|
+
variants: {
|
|
14257
|
+
variant: {
|
|
14258
|
+
default: "yv:bg-transparent",
|
|
14259
|
+
outline: "yv:border-border",
|
|
14260
|
+
muted: "yv:bg-muted/50"
|
|
14261
|
+
},
|
|
14262
|
+
size: {
|
|
14263
|
+
default: "yv:p-4 yv:gap-4 yv:",
|
|
14264
|
+
sm: "yv:py-3 yv:px-4 yv:gap-2.5"
|
|
14265
|
+
}
|
|
14266
|
+
},
|
|
14267
|
+
defaultVariants: {
|
|
14268
|
+
variant: "default",
|
|
14269
|
+
size: "default"
|
|
14259
14270
|
}
|
|
14260
14271
|
}
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14272
|
+
);
|
|
14273
|
+
function Item2({
|
|
14274
|
+
className,
|
|
14275
|
+
variant = "default",
|
|
14276
|
+
size = "default",
|
|
14277
|
+
asChild = false,
|
|
14278
|
+
...props
|
|
14279
|
+
}) {
|
|
14280
|
+
const Comp = asChild ? Slot2 : "div";
|
|
14281
|
+
return /* @__PURE__ */ jsx7(
|
|
14282
|
+
Comp,
|
|
14283
|
+
{
|
|
14284
|
+
"data-slot": "item",
|
|
14285
|
+
"data-variant": variant,
|
|
14286
|
+
"data-size": size,
|
|
14287
|
+
className: cn(itemVariants({ variant, size, className })),
|
|
14288
|
+
...props
|
|
14289
|
+
}
|
|
14290
|
+
);
|
|
14291
|
+
}
|
|
14292
|
+
var itemMediaVariants = cva3(
|
|
14293
|
+
"yv:flex yv:shrink-0 yv:items-center yv:justify-center yv:gap-2 yv:group-has-[[data-slot=item-description]]/item:self-start yv:[&_svg]:pointer-events-none yv:group-has-[[data-slot=item-description]]/item:translate-y-0.5",
|
|
14294
|
+
{
|
|
14295
|
+
variants: {
|
|
14296
|
+
variant: {
|
|
14297
|
+
default: "yv:bg-transparent",
|
|
14298
|
+
icon: "yv:size-8 yv:border yv:rounded-sm yv:bg-muted yv:[&_svg:not([class*=size-])]:size-4",
|
|
14299
|
+
image: "yv:size-10 yv:rounded-sm yv:overflow-hidden yv:[&_img]:size-full yv:[&_img]:object-cover"
|
|
14268
14300
|
}
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
isDevelopment && error46 && /* @__PURE__ */ jsxs3("details", { style: { marginTop: "10px" }, children: [
|
|
14273
|
-
/* @__PURE__ */ jsx7("summary", { children: "Error details (development only)" }),
|
|
14274
|
-
/* @__PURE__ */ jsx7("pre", { style: { textAlign: "left", overflow: "auto" }, children: error46.toString() })
|
|
14275
|
-
] })
|
|
14276
|
-
] });
|
|
14301
|
+
},
|
|
14302
|
+
defaultVariants: {
|
|
14303
|
+
variant: "default"
|
|
14277
14304
|
}
|
|
14278
|
-
return children;
|
|
14279
14305
|
}
|
|
14280
|
-
|
|
14306
|
+
);
|
|
14307
|
+
function ItemMedia({
|
|
14308
|
+
className,
|
|
14309
|
+
variant = "default",
|
|
14310
|
+
...props
|
|
14311
|
+
}) {
|
|
14312
|
+
return /* @__PURE__ */ jsx7(
|
|
14313
|
+
"div",
|
|
14314
|
+
{
|
|
14315
|
+
"data-slot": "item-media",
|
|
14316
|
+
"data-variant": variant,
|
|
14317
|
+
className: cn(itemMediaVariants({ variant, className })),
|
|
14318
|
+
...props
|
|
14319
|
+
}
|
|
14320
|
+
);
|
|
14321
|
+
}
|
|
14322
|
+
function ItemContent({ className, ...props }) {
|
|
14323
|
+
return /* @__PURE__ */ jsx7(
|
|
14324
|
+
"div",
|
|
14325
|
+
{
|
|
14326
|
+
"data-slot": "item-content",
|
|
14327
|
+
className: cn(
|
|
14328
|
+
"yv:flex yv:flex-1 yv:flex-col yv:gap-1 yv:[&+[data-slot=item-content]]:flex-none",
|
|
14329
|
+
className
|
|
14330
|
+
),
|
|
14331
|
+
...props
|
|
14332
|
+
}
|
|
14333
|
+
);
|
|
14334
|
+
}
|
|
14335
|
+
function ItemTitle({ className, ...props }) {
|
|
14336
|
+
return /* @__PURE__ */ jsx7(
|
|
14337
|
+
"div",
|
|
14338
|
+
{
|
|
14339
|
+
"data-slot": "item-title",
|
|
14340
|
+
className: cn(
|
|
14341
|
+
"yv:flex yv:w-fit yv:items-center yv:gap-2 yv:text-sm yv:leading-snug yv:font-medium",
|
|
14342
|
+
className
|
|
14343
|
+
),
|
|
14344
|
+
...props
|
|
14345
|
+
}
|
|
14346
|
+
);
|
|
14347
|
+
}
|
|
14348
|
+
function ItemDescription({ className, ...props }) {
|
|
14349
|
+
return /* @__PURE__ */ jsx7(
|
|
14350
|
+
"p",
|
|
14351
|
+
{
|
|
14352
|
+
"data-slot": "item-description",
|
|
14353
|
+
className: cn(
|
|
14354
|
+
"yv:text-muted-foreground yv:line-clamp-2 yv:text-sm yv:leading-normal yv:font-normal yv:text-balance",
|
|
14355
|
+
"yv:[&>a:hover]:text-primary yv:[&>a]:underline yv:[&>a]:underline-offset-4",
|
|
14356
|
+
className
|
|
14357
|
+
),
|
|
14358
|
+
...props
|
|
14359
|
+
}
|
|
14360
|
+
);
|
|
14361
|
+
}
|
|
14281
14362
|
|
|
14282
|
-
// src/
|
|
14363
|
+
// src/components/bible-version-picker.tsx
|
|
14364
|
+
import { Search as Search2, Globe, X as XIcon2, ArrowLeft } from "lucide-react";
|
|
14365
|
+
|
|
14366
|
+
// src/components/ui/badge.tsx
|
|
14367
|
+
import "react";
|
|
14368
|
+
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
14369
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
14283
14370
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
14284
|
-
var
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
isAuthenticated: false,
|
|
14294
|
-
isLoading: false,
|
|
14295
|
-
accessToken: null,
|
|
14296
|
-
result: null,
|
|
14297
|
-
error: null
|
|
14298
|
-
});
|
|
14299
|
-
useEffect2(() => {
|
|
14300
|
-
const initializeAuth = () => {
|
|
14301
|
-
YouVersionPlatformConfiguration.appId = config2.appId;
|
|
14302
|
-
YouVersionPlatformConfiguration.installationId = config2.installationId ?? null;
|
|
14303
|
-
const strategy = new WebAuthenticationStrategy({
|
|
14304
|
-
redirectUri: config2.redirectUri || ""
|
|
14305
|
-
});
|
|
14306
|
-
AuthenticationStrategyRegistry.register(strategy);
|
|
14307
|
-
const existingToken = YouVersionPlatformConfiguration.accessToken;
|
|
14308
|
-
if (existingToken) {
|
|
14309
|
-
setAuthState({
|
|
14310
|
-
isAuthenticated: true,
|
|
14311
|
-
isLoading: false,
|
|
14312
|
-
accessToken: existingToken,
|
|
14313
|
-
result: null,
|
|
14314
|
-
error: null
|
|
14315
|
-
});
|
|
14316
|
-
return;
|
|
14317
|
-
}
|
|
14318
|
-
WebAuthenticationStrategy.handleCallback();
|
|
14319
|
-
const storedCallback = WebAuthenticationStrategy.getStoredCallback();
|
|
14320
|
-
if (storedCallback) {
|
|
14321
|
-
try {
|
|
14322
|
-
const result = new SignInWithYouVersionResult(storedCallback);
|
|
14323
|
-
const { accessToken, errorMsg } = result;
|
|
14324
|
-
if (accessToken) {
|
|
14325
|
-
YouVersionPlatformConfiguration.setAccessToken(accessToken);
|
|
14326
|
-
}
|
|
14327
|
-
setAuthState({
|
|
14328
|
-
isAuthenticated: !!accessToken,
|
|
14329
|
-
isLoading: false,
|
|
14330
|
-
accessToken: accessToken ?? null,
|
|
14331
|
-
result,
|
|
14332
|
-
error: errorMsg ? new Error(errorMsg) : null
|
|
14333
|
-
});
|
|
14334
|
-
} catch (error46) {
|
|
14335
|
-
setAuthState({
|
|
14336
|
-
isAuthenticated: false,
|
|
14337
|
-
isLoading: false,
|
|
14338
|
-
accessToken: null,
|
|
14339
|
-
result: null,
|
|
14340
|
-
error: error46
|
|
14341
|
-
});
|
|
14342
|
-
}
|
|
14343
|
-
} else {
|
|
14344
|
-
setAuthState({
|
|
14345
|
-
isAuthenticated: false,
|
|
14346
|
-
isLoading: false,
|
|
14347
|
-
accessToken: null,
|
|
14348
|
-
result: null,
|
|
14349
|
-
error: null
|
|
14350
|
-
});
|
|
14371
|
+
var badgeVariants = cva4(
|
|
14372
|
+
"yv:inline-flex yv:items-center yv:justify-center yv:rounded-full yv:border yv:px-2 yv:py-0.5 yv:text-xs yv:font-medium yv:w-fit yv:whitespace-nowrap yv:shrink-0 yv:[&>svg]:size-3 yv:gap-1 yv:[&>svg]:pointer-events-none yv:focus-visible:border-ring yv:focus-visible:ring-ring/50 yv:focus-visible:ring-[3px] yv:aria-invalid:ring-destructive/20 yv:dark:aria-invalid:ring-destructive/40 yv:aria-invalid:border-destructive yv:transition-[color,box-shadow] yv:overflow-hidden",
|
|
14373
|
+
{
|
|
14374
|
+
variants: {
|
|
14375
|
+
variant: {
|
|
14376
|
+
default: "yv:border-transparent yv:bg-primary yv:text-primary-foreground yv:[a&]:hover:bg-primary/90",
|
|
14377
|
+
secondary: "yv:border-transparent yv:bg-muted yv:text-muted-foreground yv:[a&]:hover:bg-muted/90",
|
|
14378
|
+
destructive: "yv:border-transparent yv:bg-destructive yv:text-white yv:[a&]:hover:bg-destructive/90 yv:focus-visible:ring-destructive/20 yv:dark:focus-visible:ring-destructive/40 yv:dark:bg-destructive/60",
|
|
14379
|
+
outline: "yv:text-foreground yv:[a&]:hover:bg-accent yv:[a&]:hover:text-accent-foreground"
|
|
14351
14380
|
}
|
|
14352
|
-
}
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
const signOut = useCallback(() => {
|
|
14356
|
-
YouVersionPlatformConfiguration.setAccessToken(null);
|
|
14357
|
-
setAuthState({
|
|
14358
|
-
isAuthenticated: false,
|
|
14359
|
-
isLoading: false,
|
|
14360
|
-
accessToken: null,
|
|
14361
|
-
result: null,
|
|
14362
|
-
error: null
|
|
14363
|
-
});
|
|
14364
|
-
}, []);
|
|
14365
|
-
const fetchUserInfo = useCallback(async () => {
|
|
14366
|
-
if (!authState.isAuthenticated || !authState.accessToken) {
|
|
14367
|
-
throw new Error("User is not authenticated");
|
|
14381
|
+
},
|
|
14382
|
+
defaultVariants: {
|
|
14383
|
+
variant: "default"
|
|
14368
14384
|
}
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
return /* @__PURE__ */ jsx8(
|
|
14385
|
+
}
|
|
14386
|
+
);
|
|
14387
|
+
function Badge({
|
|
14388
|
+
className,
|
|
14389
|
+
variant,
|
|
14390
|
+
asChild = false,
|
|
14391
|
+
...props
|
|
14392
|
+
}) {
|
|
14393
|
+
const Comp = asChild ? Slot3 : "span";
|
|
14394
|
+
return /* @__PURE__ */ jsx8(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props });
|
|
14379
14395
|
}
|
|
14380
|
-
|
|
14381
|
-
|
|
14396
|
+
|
|
14397
|
+
// src/components/bible-version-picker.tsx
|
|
14398
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
14399
|
+
var BibleVersionPickerContext = createContext2(null);
|
|
14400
|
+
function useBibleVersionPickerContext() {
|
|
14401
|
+
const context = useContext2(BibleVersionPickerContext);
|
|
14382
14402
|
if (!context) {
|
|
14383
|
-
throw new Error("
|
|
14403
|
+
throw new Error("BibleVersionPicker components must be used within BibleVersionPicker.Root");
|
|
14384
14404
|
}
|
|
14385
14405
|
return context;
|
|
14386
14406
|
}
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14407
|
+
function Root4({
|
|
14408
|
+
versionId: controlledVersionId,
|
|
14409
|
+
onVersionChange,
|
|
14410
|
+
background = "light",
|
|
14411
|
+
side = "top",
|
|
14412
|
+
children
|
|
14413
|
+
}) {
|
|
14414
|
+
const [versionId, setVersionIdState] = useControllableState2({
|
|
14415
|
+
prop: controlledVersionId,
|
|
14416
|
+
defaultProp: controlledVersionId,
|
|
14417
|
+
onChange: onVersionChange
|
|
14418
|
+
});
|
|
14419
|
+
const [selectedLanguageId, setSelectedLanguageId] = useState2("en");
|
|
14420
|
+
const [searchQuery, setSearchQuery] = useState2("");
|
|
14421
|
+
const [isLanguagesOpen, setIsLanguagesOpen] = useState2(false);
|
|
14422
|
+
const { languages: hookLanguages } = useLanguages({ country: "US" });
|
|
14423
|
+
const languages = useMemo2(() => {
|
|
14424
|
+
if (hookLanguages?.data && hookLanguages.data.length > 0) {
|
|
14425
|
+
return hookLanguages.data.map((lang) => ({
|
|
14426
|
+
id: lang.id || "",
|
|
14427
|
+
englishName: lang.display_names?.en || lang.language,
|
|
14428
|
+
name: lang.display_names?.[lang.id] || lang.language
|
|
14429
|
+
}));
|
|
14430
|
+
}
|
|
14431
|
+
return [];
|
|
14432
|
+
}, [hookLanguages?.data]);
|
|
14433
|
+
const { versions } = useVersions(selectedLanguageId);
|
|
14434
|
+
const filteredVersions = useFilteredVersions(
|
|
14435
|
+
versions?.data || [],
|
|
14436
|
+
searchQuery,
|
|
14437
|
+
selectedLanguageId
|
|
14400
14438
|
);
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14439
|
+
const contextValue = {
|
|
14440
|
+
versionId,
|
|
14441
|
+
setVersionId: setVersionIdState,
|
|
14442
|
+
background,
|
|
14443
|
+
side,
|
|
14444
|
+
languages,
|
|
14445
|
+
selectedLanguageId,
|
|
14446
|
+
setSelectedLanguageId,
|
|
14447
|
+
searchQuery,
|
|
14448
|
+
setSearchQuery,
|
|
14449
|
+
filteredVersions,
|
|
14450
|
+
isLanguagesOpen,
|
|
14451
|
+
setIsLanguagesOpen
|
|
14452
|
+
};
|
|
14453
|
+
return /* @__PURE__ */ jsx9(BibleVersionPickerContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx9(Popover, { children }) });
|
|
14454
|
+
}
|
|
14455
|
+
function Trigger4({ asChild = true, children, ...props }) {
|
|
14456
|
+
const { versionId, background } = useBibleVersionPickerContext();
|
|
14457
|
+
const { version: version2, loading } = useVersion(versionId);
|
|
14458
|
+
const content = typeof children === "function" ? children({ version: version2, loading }) : children || /* @__PURE__ */ jsx9(
|
|
14459
|
+
Button,
|
|
14460
|
+
{
|
|
14461
|
+
variant: background === "light" ? "outline" : "default",
|
|
14462
|
+
className: "yv:cursor-pointer",
|
|
14463
|
+
children: version2?.local_abbreviation || "Select"
|
|
14464
|
+
}
|
|
14465
|
+
);
|
|
14466
|
+
return /* @__PURE__ */ jsx9(PopoverTrigger, { asChild, ...props, children: content });
|
|
14407
14467
|
}
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14468
|
+
function Content3() {
|
|
14469
|
+
const {
|
|
14470
|
+
searchQuery,
|
|
14471
|
+
setSearchQuery,
|
|
14472
|
+
filteredVersions,
|
|
14473
|
+
versionId,
|
|
14474
|
+
setVersionId,
|
|
14475
|
+
background,
|
|
14476
|
+
side,
|
|
14477
|
+
setIsLanguagesOpen,
|
|
14478
|
+
isLanguagesOpen,
|
|
14479
|
+
languages,
|
|
14480
|
+
selectedLanguageId,
|
|
14481
|
+
setSelectedLanguageId
|
|
14482
|
+
} = useBibleVersionPickerContext();
|
|
14483
|
+
const closeRef = useRef2(null);
|
|
14484
|
+
const handleSelectLanguage = (languageId) => {
|
|
14485
|
+
setSelectedLanguageId(languageId);
|
|
14486
|
+
setIsLanguagesOpen(false);
|
|
14487
|
+
};
|
|
14488
|
+
const handleSelectVersion = (versionId2) => {
|
|
14489
|
+
setVersionId(versionId2);
|
|
14490
|
+
setIsLanguagesOpen(false);
|
|
14491
|
+
closeRef.current?.click();
|
|
14492
|
+
};
|
|
14493
|
+
return /* @__PURE__ */ jsxs3(
|
|
14494
|
+
PopoverContent,
|
|
14415
14495
|
{
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
"aria-label": "YouVersion",
|
|
14421
|
-
...props,
|
|
14496
|
+
"data-yv-sdk": true,
|
|
14497
|
+
"data-yv-theme": background === "dark" ? "dark" : "light",
|
|
14498
|
+
side,
|
|
14499
|
+
className: "yv:flex yv:flex-col yv:bg-background yv:p-0 yv:h-[66vh] yv:max-h-[66vh] yv:w-96 yv:sm:w-sm yv:overflow-hidden yv:rounded-2xl yv:border-0 yv:shadow-lg",
|
|
14422
14500
|
children: [
|
|
14423
|
-
/* @__PURE__ */
|
|
14501
|
+
/* @__PURE__ */ jsxs3(
|
|
14502
|
+
"div",
|
|
14503
|
+
{
|
|
14504
|
+
className: `yv:h-[66vh] yv:absolute yv:inset-0 yv:flex yv:flex-col yv:transition-all yv:duration-300 yv:rounded-2xl yv:origin-center ${isLanguagesOpen ? "yv:opacity-0 yv:pointer-events-none yv:blur-sm yv:scale-95" : "yv:opacity-100 yv:pointer-events-auto yv:blur-none yv:scale-100"}`,
|
|
14505
|
+
children: [
|
|
14506
|
+
/* @__PURE__ */ jsxs3("section", { className: "yv:bg-muted yv:py-3 yv:w-full yv:rounded-t-2xl yv:px-4 yv:border-b yv:border-border yv:flex yv:flex-row yv:justify-between yv:items-center", children: [
|
|
14507
|
+
/* @__PURE__ */ jsx9("div", { className: "yv:flex yv:flex-col", children: /* @__PURE__ */ jsx9("h2", { className: "yv:font-bold yv:text-base yv:line-clamp-1", children: "Bible Versions" }) }),
|
|
14508
|
+
/* @__PURE__ */ jsxs3("div", { className: "yv:flex yv:items-center yv:gap-2", children: [
|
|
14509
|
+
/* @__PURE__ */ jsxs3(
|
|
14510
|
+
Button,
|
|
14511
|
+
{
|
|
14512
|
+
"aria-label": "Select language",
|
|
14513
|
+
className: "yv:bg-card yv:border yv:border-transparent yv:hover:bg-card yv:hover:border-border",
|
|
14514
|
+
size: "sm",
|
|
14515
|
+
onClick: () => setIsLanguagesOpen(true),
|
|
14516
|
+
variant: "secondary",
|
|
14517
|
+
children: [
|
|
14518
|
+
/* @__PURE__ */ jsx9(Globe, { size: 16 }),
|
|
14519
|
+
/* @__PURE__ */ jsx9("span", { className: "yv:text-sm yv:font-medium yv:line-clamp-1", children: languages.find((language) => language.id === selectedLanguageId)?.englishName }),
|
|
14520
|
+
/* @__PURE__ */ jsx9(
|
|
14521
|
+
Badge,
|
|
14522
|
+
{
|
|
14523
|
+
variant: "secondary",
|
|
14524
|
+
className: "yv:h-5 yv:min-w-5 yv:rounded-full yv:px-1 yv:font-mono yv:tabular-nums",
|
|
14525
|
+
children: filteredVersions.length
|
|
14526
|
+
}
|
|
14527
|
+
)
|
|
14528
|
+
]
|
|
14529
|
+
}
|
|
14530
|
+
),
|
|
14531
|
+
/* @__PURE__ */ jsx9(PopoverClose, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
14532
|
+
Button,
|
|
14533
|
+
{
|
|
14534
|
+
ref: closeRef,
|
|
14535
|
+
variant: "ghost",
|
|
14536
|
+
size: "icon",
|
|
14537
|
+
className: "yv:w-8 yv:h-8 yv:text-muted-foreground",
|
|
14538
|
+
children: [
|
|
14539
|
+
/* @__PURE__ */ jsx9(XIcon2, { size: 16 }),
|
|
14540
|
+
/* @__PURE__ */ jsx9("span", { className: "yv:sr-only", children: "Close version selector" })
|
|
14541
|
+
]
|
|
14542
|
+
}
|
|
14543
|
+
) })
|
|
14544
|
+
] })
|
|
14545
|
+
] }),
|
|
14546
|
+
/* @__PURE__ */ jsx9("div", { className: "yv:flex-1 yv:overflow-y-auto yv:py-2", children: filteredVersions && filteredVersions.length > 0 ? /* @__PURE__ */ jsx9(ItemGroup, { children: filteredVersions.map((version2) => /* @__PURE__ */ jsx9(
|
|
14547
|
+
Item2,
|
|
14548
|
+
{
|
|
14549
|
+
className: cn(
|
|
14550
|
+
"yv:hover:bg-muted yv:rounded-[8px]",
|
|
14551
|
+
versionId === version2.id ? "yv:bg-muted" : ""
|
|
14552
|
+
),
|
|
14553
|
+
size: "sm",
|
|
14554
|
+
variant: "default",
|
|
14555
|
+
role: "listitem",
|
|
14556
|
+
asChild: true,
|
|
14557
|
+
"aria-label": version2.title,
|
|
14558
|
+
children: /* @__PURE__ */ jsxs3(
|
|
14559
|
+
"button",
|
|
14560
|
+
{
|
|
14561
|
+
type: "button",
|
|
14562
|
+
className: "yv:w-full",
|
|
14563
|
+
onClick: () => handleSelectVersion(version2.id),
|
|
14564
|
+
children: [
|
|
14565
|
+
/* @__PURE__ */ jsx9(
|
|
14566
|
+
ItemMedia,
|
|
14567
|
+
{
|
|
14568
|
+
variant: "icon",
|
|
14569
|
+
className: "yv:rounded-[8px] yv:size-12 yv:border-border",
|
|
14570
|
+
children: /* @__PURE__ */ jsx9("span", { className: "yv:font-serif yv:font-bold", children: version2.local_abbreviation })
|
|
14571
|
+
}
|
|
14572
|
+
),
|
|
14573
|
+
/* @__PURE__ */ jsx9(ItemContent, { children: /* @__PURE__ */ jsx9(ItemTitle, { className: "yv:line-clamp-2", children: version2.title }) })
|
|
14574
|
+
]
|
|
14575
|
+
}
|
|
14576
|
+
)
|
|
14577
|
+
},
|
|
14578
|
+
version2.id
|
|
14579
|
+
)) }) : /* @__PURE__ */ jsx9("div", { className: "yv:w-full yv:flex yv:items-center yv:justify-center yv:py-8 yv:text-center yv:text-muted-foreground yv:text-sm", children: "No versions found" }) }),
|
|
14580
|
+
/* @__PURE__ */ jsx9("section", { className: "yv:bg-muted yv:border-t yv:border-border yv:p-4 yv:w-full yv:rounded-b-2xl yv:flex yv:gap-3", children: /* @__PURE__ */ jsxs3("div", { className: "yv:flex-1 yv:relative", children: [
|
|
14581
|
+
/* @__PURE__ */ jsx9(
|
|
14582
|
+
Search2,
|
|
14583
|
+
{
|
|
14584
|
+
size: 13,
|
|
14585
|
+
className: "yv:absolute yv:left-3 yv:top-1/2 yv:-translate-y-1/2 yv:text-muted-foreground"
|
|
14586
|
+
}
|
|
14587
|
+
),
|
|
14588
|
+
/* @__PURE__ */ jsx9(
|
|
14589
|
+
Input,
|
|
14590
|
+
{
|
|
14591
|
+
className: "yv:rounded-3xl yv:bg-background yv:pl-9 yv:py-3 yv:border-border",
|
|
14592
|
+
type: "text",
|
|
14593
|
+
placeholder: "Search",
|
|
14594
|
+
value: searchQuery,
|
|
14595
|
+
onChange: (e) => setSearchQuery(e.target.value)
|
|
14596
|
+
}
|
|
14597
|
+
)
|
|
14598
|
+
] }) })
|
|
14599
|
+
]
|
|
14600
|
+
}
|
|
14601
|
+
),
|
|
14602
|
+
/* @__PURE__ */ jsxs3(
|
|
14603
|
+
"div",
|
|
14604
|
+
{
|
|
14605
|
+
className: `yv:h-[66vh] yv:absolute yv:inset-0 yv:flex yv:flex-col yv:transition-all yv:duration-300 yv:rounded-2xl yv:origin-center ${isLanguagesOpen ? "yv:opacity-100 yv:pointer-events-auto yv:blur-none yv:scale-100" : "yv:opacity-0 yv:pointer-events-none yv:blur-sm yv:scale-95"}`,
|
|
14606
|
+
children: [
|
|
14607
|
+
/* @__PURE__ */ jsxs3("section", { className: "yv:bg-muted yv:py-3 yv:w-full yv:rounded-t-2xl yv:px-4 yv:border-b yv:border-border yv:grid yv:grid-cols-[auto_1fr] yv:gap-2 yv:items-center", children: [
|
|
14608
|
+
/* @__PURE__ */ jsxs3(
|
|
14609
|
+
Button,
|
|
14610
|
+
{
|
|
14611
|
+
onClick: () => setIsLanguagesOpen(false),
|
|
14612
|
+
variant: "ghost",
|
|
14613
|
+
size: "icon",
|
|
14614
|
+
className: "yv:w-8 yv:h-8 yv:text-muted-foreground",
|
|
14615
|
+
children: [
|
|
14616
|
+
/* @__PURE__ */ jsx9(ArrowLeft, { size: 16 }),
|
|
14617
|
+
/* @__PURE__ */ jsx9("span", { className: "yv:sr-only", children: "Close Language selector" })
|
|
14618
|
+
]
|
|
14619
|
+
}
|
|
14620
|
+
),
|
|
14621
|
+
/* @__PURE__ */ jsx9("h2", { className: "yv:font-bold yv:text-base", children: "Select Language" })
|
|
14622
|
+
] }),
|
|
14623
|
+
/* @__PURE__ */ jsx9(ItemGroup, { className: "yv:overflow-y-auto yv:py-2", children: languages.map((language) => /* @__PURE__ */ jsx9(
|
|
14624
|
+
Item2,
|
|
14625
|
+
{
|
|
14626
|
+
className: "yv:hover:bg-muted yv:rounded-[8px]",
|
|
14627
|
+
size: "sm",
|
|
14628
|
+
role: "listitem",
|
|
14629
|
+
"aria-label": language.englishName,
|
|
14630
|
+
asChild: true,
|
|
14631
|
+
children: /* @__PURE__ */ jsxs3("button", { className: "yv:w-full", onClick: () => handleSelectLanguage(language.id), children: [
|
|
14632
|
+
/* @__PURE__ */ jsx9(ItemContent, { children: /* @__PURE__ */ jsx9(ItemTitle, { className: "yv:line-clamp-2", children: language.englishName }) }),
|
|
14633
|
+
/* @__PURE__ */ jsx9(ItemContent, { className: "flex-none text-center", children: /* @__PURE__ */ jsx9(ItemDescription, { children: language.name }) })
|
|
14634
|
+
] })
|
|
14635
|
+
},
|
|
14636
|
+
language.id
|
|
14637
|
+
)) })
|
|
14638
|
+
]
|
|
14639
|
+
}
|
|
14640
|
+
)
|
|
14641
|
+
]
|
|
14642
|
+
}
|
|
14643
|
+
);
|
|
14644
|
+
}
|
|
14645
|
+
var BibleVersionPicker = Object.assign({}, { Root: Root4, Trigger: Trigger4, Content: Content3 });
|
|
14646
|
+
|
|
14647
|
+
// src/components/verse.tsx
|
|
14648
|
+
import React8 from "react";
|
|
14649
|
+
import DOMPurify from "isomorphic-dompurify";
|
|
14650
|
+
import { usePassage } from "@youversion/platform-react-hooks";
|
|
14651
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
14652
|
+
var NON_BREAKING_SPACE = "\xA0";
|
|
14653
|
+
var DOMPURIFY_CONFIG = {
|
|
14654
|
+
ALLOWED_ATTR: ["class", "style", "id"],
|
|
14655
|
+
ALLOW_DATA_ATTR: true
|
|
14656
|
+
};
|
|
14657
|
+
function yvDomTransformer(html) {
|
|
14658
|
+
if (!window || !("DOMParser" in window)) {
|
|
14659
|
+
return html;
|
|
14660
|
+
}
|
|
14661
|
+
const sanitizedHtml = DOMPurify.sanitize(html, DOMPURIFY_CONFIG);
|
|
14662
|
+
const parser = new DOMParser();
|
|
14663
|
+
const doc = parser.parseFromString(sanitizedHtml, "text/html");
|
|
14664
|
+
const paragraphs = doc.querySelectorAll(".yv-vlbl");
|
|
14665
|
+
paragraphs.forEach((p) => {
|
|
14666
|
+
const text = p.textContent || "";
|
|
14667
|
+
if (!text.endsWith(NON_BREAKING_SPACE)) {
|
|
14668
|
+
p.textContent = text + NON_BREAKING_SPACE;
|
|
14669
|
+
}
|
|
14670
|
+
});
|
|
14671
|
+
const tables = doc.querySelectorAll("table");
|
|
14672
|
+
tables.forEach((table) => {
|
|
14673
|
+
const rows = table.querySelectorAll("tr");
|
|
14674
|
+
if (rows.length === 0) return;
|
|
14675
|
+
let maxColumns = 0;
|
|
14676
|
+
rows.forEach((row) => {
|
|
14677
|
+
const cells = row.querySelectorAll("td, th");
|
|
14678
|
+
let rowColumnCount = 0;
|
|
14679
|
+
cells.forEach((cell) => {
|
|
14680
|
+
if (cell instanceof HTMLTableCellElement) {
|
|
14681
|
+
const colspan = parseInt(cell.getAttribute("colspan") || "1", 10);
|
|
14682
|
+
rowColumnCount += colspan;
|
|
14683
|
+
} else {
|
|
14684
|
+
rowColumnCount += 1;
|
|
14685
|
+
}
|
|
14686
|
+
});
|
|
14687
|
+
maxColumns = Math.max(maxColumns, rowColumnCount);
|
|
14688
|
+
});
|
|
14689
|
+
if (maxColumns > 1) {
|
|
14690
|
+
rows.forEach((row) => {
|
|
14691
|
+
const cells = row.querySelectorAll("td, th");
|
|
14692
|
+
if (cells.length === 1) {
|
|
14693
|
+
const cell = cells[0];
|
|
14694
|
+
if (cell instanceof HTMLTableCellElement) {
|
|
14695
|
+
const existingColspan = parseInt(cell.getAttribute("colspan") || "1", 10);
|
|
14696
|
+
if (existingColspan < maxColumns) {
|
|
14697
|
+
cell.setAttribute("colspan", maxColumns.toString());
|
|
14698
|
+
}
|
|
14699
|
+
}
|
|
14700
|
+
}
|
|
14701
|
+
});
|
|
14702
|
+
}
|
|
14703
|
+
});
|
|
14704
|
+
const modifiedHtml = doc.body.innerHTML;
|
|
14705
|
+
return modifiedHtml;
|
|
14706
|
+
}
|
|
14707
|
+
var Verse = {
|
|
14708
|
+
/**
|
|
14709
|
+
* Renders a single verse with superscript number and text.
|
|
14710
|
+
*
|
|
14711
|
+
* @param props - The verse properties.
|
|
14712
|
+
* @param props.number - The verse number.
|
|
14713
|
+
* @param props.text - The verse text.
|
|
14714
|
+
* @param props.size - The size variant. Defaults to 'default'.
|
|
14715
|
+
* @returns The rendered verse element.
|
|
14716
|
+
*/
|
|
14717
|
+
Text: ({ number: number4, text, size = "default" }) => {
|
|
14718
|
+
if (size === "lg") {
|
|
14719
|
+
return /* @__PURE__ */ jsxs4("span", { className: "yv:[&>p]:inline-block", children: [
|
|
14720
|
+
/* @__PURE__ */ jsx10("sup", { className: "yv:text-muted-foreground yv:align-super yv:text-[0.6em]", children: number4 }),
|
|
14721
|
+
"\xA0",
|
|
14722
|
+
/* @__PURE__ */ jsx10("span", { className: "yv:font-serif! yv:text-xl yv:text-primary", children: text }),
|
|
14723
|
+
"\xA0"
|
|
14724
|
+
] });
|
|
14725
|
+
}
|
|
14726
|
+
return /* @__PURE__ */ jsxs4("span", { className: "yv:[&>p]:inline-block", children: [
|
|
14727
|
+
/* @__PURE__ */ jsx10("sup", { className: "yv:text-muted-foreground yv:align-super yv:text-[0.6em]", children: number4 }),
|
|
14728
|
+
"\xA0",
|
|
14729
|
+
/* @__PURE__ */ jsx10("span", { className: "yv:text-primary", children: text }),
|
|
14730
|
+
"\xA0"
|
|
14731
|
+
] });
|
|
14732
|
+
},
|
|
14733
|
+
Html: ({
|
|
14734
|
+
html,
|
|
14735
|
+
fontFamily,
|
|
14736
|
+
fontSize,
|
|
14737
|
+
lineHeight,
|
|
14738
|
+
showVerseNumbers = true
|
|
14739
|
+
}) => {
|
|
14740
|
+
const [transformedHtml, setTransformedHtml] = React8.useState(html);
|
|
14741
|
+
React8.useEffect(() => {
|
|
14742
|
+
setTransformedHtml(yvDomTransformer(html));
|
|
14743
|
+
}, [html]);
|
|
14744
|
+
return /* @__PURE__ */ jsx10(
|
|
14745
|
+
"section",
|
|
14746
|
+
{
|
|
14747
|
+
style: {
|
|
14748
|
+
...fontFamily ? { "--yv-reader-font-family": fontFamily } : {},
|
|
14749
|
+
...fontSize ? { "--yv-reader-font-size": `${fontSize}px` } : {},
|
|
14750
|
+
...lineHeight ? { "--yv-reader-line-height": lineHeight } : {}
|
|
14751
|
+
},
|
|
14752
|
+
"data-show-verse-numbers": showVerseNumbers,
|
|
14753
|
+
"data-slot": "yv-bible-renderer",
|
|
14754
|
+
dangerouslySetInnerHTML: { __html: transformedHtml }
|
|
14755
|
+
}
|
|
14756
|
+
);
|
|
14757
|
+
}
|
|
14758
|
+
};
|
|
14759
|
+
var BibleTextView = ({
|
|
14760
|
+
reference,
|
|
14761
|
+
fontFamily,
|
|
14762
|
+
fontSize,
|
|
14763
|
+
lineHeight,
|
|
14764
|
+
versionId,
|
|
14765
|
+
showVerseNumbers
|
|
14766
|
+
}) => {
|
|
14767
|
+
const { passage, loading, error: error46 } = usePassage({
|
|
14768
|
+
versionId,
|
|
14769
|
+
usfm: reference,
|
|
14770
|
+
include_headings: true,
|
|
14771
|
+
include_notes: true
|
|
14772
|
+
});
|
|
14773
|
+
if (loading) {
|
|
14774
|
+
return /* @__PURE__ */ jsx10(
|
|
14775
|
+
Verse.Html,
|
|
14776
|
+
{
|
|
14777
|
+
html: "<span>Loading...</span>",
|
|
14778
|
+
fontFamily,
|
|
14779
|
+
fontSize,
|
|
14780
|
+
lineHeight,
|
|
14781
|
+
showVerseNumbers
|
|
14782
|
+
}
|
|
14783
|
+
);
|
|
14784
|
+
}
|
|
14785
|
+
if (error46) {
|
|
14786
|
+
return /* @__PURE__ */ jsx10(
|
|
14787
|
+
Verse.Html,
|
|
14788
|
+
{
|
|
14789
|
+
html: '<span class="wj">We have run into an error...</span>',
|
|
14790
|
+
fontFamily,
|
|
14791
|
+
fontSize,
|
|
14792
|
+
lineHeight,
|
|
14793
|
+
showVerseNumbers
|
|
14794
|
+
}
|
|
14795
|
+
);
|
|
14796
|
+
}
|
|
14797
|
+
return /* @__PURE__ */ jsx10(
|
|
14798
|
+
Verse.Html,
|
|
14799
|
+
{
|
|
14800
|
+
html: passage?.content || "",
|
|
14801
|
+
fontFamily,
|
|
14802
|
+
fontSize,
|
|
14803
|
+
lineHeight,
|
|
14804
|
+
showVerseNumbers
|
|
14805
|
+
}
|
|
14806
|
+
);
|
|
14807
|
+
};
|
|
14808
|
+
|
|
14809
|
+
// src/components/bible-reader.tsx
|
|
14810
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
14811
|
+
var BibleReaderContext = createContext3(null);
|
|
14812
|
+
function useBibleReaderContext() {
|
|
14813
|
+
const context = useContext3(BibleReaderContext);
|
|
14814
|
+
if (!context) {
|
|
14815
|
+
throw new Error("BibleReader components must be used within BibleReader.Root");
|
|
14816
|
+
}
|
|
14817
|
+
return context;
|
|
14818
|
+
}
|
|
14819
|
+
function Root5({
|
|
14820
|
+
book: controlledBook,
|
|
14821
|
+
defaultBook = "JHN",
|
|
14822
|
+
onBookChange,
|
|
14823
|
+
chapter: controlledChapter,
|
|
14824
|
+
defaultChapter = "1",
|
|
14825
|
+
onChapterChange,
|
|
14826
|
+
versionId: controlledVersionId,
|
|
14827
|
+
defaultVersionId = 111,
|
|
14828
|
+
onVersionChange,
|
|
14829
|
+
fontFamily,
|
|
14830
|
+
fontSize = 16,
|
|
14831
|
+
lineHeight,
|
|
14832
|
+
showVerseNumbers = true,
|
|
14833
|
+
background = "light",
|
|
14834
|
+
children
|
|
14835
|
+
}) {
|
|
14836
|
+
const [book, setBook] = useControllableState3({
|
|
14837
|
+
prop: controlledBook,
|
|
14838
|
+
defaultProp: defaultBook,
|
|
14839
|
+
onChange: onBookChange
|
|
14840
|
+
});
|
|
14841
|
+
const [chapter, setChapter] = useControllableState3({
|
|
14842
|
+
prop: controlledChapter,
|
|
14843
|
+
defaultProp: defaultChapter,
|
|
14844
|
+
onChange: onChapterChange
|
|
14845
|
+
});
|
|
14846
|
+
const [versionId, setVersionId] = useControllableState3({
|
|
14847
|
+
prop: controlledVersionId,
|
|
14848
|
+
defaultProp: defaultVersionId,
|
|
14849
|
+
onChange: onVersionChange
|
|
14850
|
+
});
|
|
14851
|
+
const contextValue = {
|
|
14852
|
+
book,
|
|
14853
|
+
chapter,
|
|
14854
|
+
versionId,
|
|
14855
|
+
setBook,
|
|
14856
|
+
setChapter,
|
|
14857
|
+
setVersionId,
|
|
14858
|
+
fontFamily,
|
|
14859
|
+
fontSize,
|
|
14860
|
+
lineHeight,
|
|
14861
|
+
showVerseNumbers,
|
|
14862
|
+
background
|
|
14863
|
+
};
|
|
14864
|
+
return /* @__PURE__ */ jsx11(BibleReaderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx11(
|
|
14865
|
+
"div",
|
|
14866
|
+
{
|
|
14867
|
+
"data-yv-sdk": true,
|
|
14868
|
+
"data-yv-theme": background === "dark" ? "dark" : "light",
|
|
14869
|
+
className: "yv:flex yv:flex-col yv:h-full yv:bg-background yv:text-foreground",
|
|
14870
|
+
children
|
|
14871
|
+
}
|
|
14872
|
+
) });
|
|
14873
|
+
}
|
|
14874
|
+
function Content4() {
|
|
14875
|
+
const { book, chapter, versionId, fontFamily, fontSize, lineHeight, showVerseNumbers } = useBibleReaderContext();
|
|
14876
|
+
const { books } = useBooks2(versionId);
|
|
14877
|
+
const { version: version2 } = useVersion2(versionId);
|
|
14878
|
+
const bookData = useMemo3(() => {
|
|
14879
|
+
return books?.data?.find((b) => b.id === book);
|
|
14880
|
+
}, [books?.data, book]);
|
|
14881
|
+
const usfmReference = `${book}.${chapter}`;
|
|
14882
|
+
return /* @__PURE__ */ jsxs5("main", { className: "yv:*:max-w-lg yv:flex yv:flex-col yv:items-center yv:gap-6 yv:overflow-y-auto yv:px-6 yv:max-sm:px-4 yv:py-12 yv:h-full", children: [
|
|
14883
|
+
/* @__PURE__ */ jsxs5("h1", { className: "yv:flex yv:gap-2 yv:flex-col yv:justify-center yv:items-center yv:font-serif yv:text-muted-foreground yv:font-medium", children: [
|
|
14884
|
+
/* @__PURE__ */ jsx11(
|
|
14885
|
+
"span",
|
|
14886
|
+
{
|
|
14887
|
+
className: cn(
|
|
14888
|
+
"yv:leading-none yv:block yv:text-2xl yv:transition-[filter]",
|
|
14889
|
+
!bookData?.title && "yv:blur-sm"
|
|
14890
|
+
),
|
|
14891
|
+
children: bookData?.title || "Loading..."
|
|
14892
|
+
}
|
|
14893
|
+
),
|
|
14894
|
+
/* @__PURE__ */ jsx11("span", { className: "yv:leading-none yv:block yv:ml-2 yv:text-[2.5rem] yv:font-normal", children: chapter || "-" })
|
|
14895
|
+
] }),
|
|
14896
|
+
/* @__PURE__ */ jsx11(
|
|
14897
|
+
BibleTextView,
|
|
14898
|
+
{
|
|
14899
|
+
reference: usfmReference,
|
|
14900
|
+
versionId,
|
|
14901
|
+
fontFamily,
|
|
14902
|
+
fontSize,
|
|
14903
|
+
lineHeight,
|
|
14904
|
+
showVerseNumbers
|
|
14905
|
+
}
|
|
14906
|
+
),
|
|
14907
|
+
version2?.copyright_short && /* @__PURE__ */ jsx11("footer", { style: { fontSize }, children: /* @__PURE__ */ jsx11("p", { className: "yv:text-balance yv:text-[0.75em] yv:text-center yv:text-muted-foreground", children: version2.copyright_short }) })
|
|
14908
|
+
] });
|
|
14909
|
+
}
|
|
14910
|
+
function Toolbar({ border = "top" }) {
|
|
14911
|
+
const { book, chapter, versionId, setBook, setChapter, setVersionId, background } = useBibleReaderContext();
|
|
14912
|
+
return /* @__PURE__ */ jsx11(
|
|
14913
|
+
"section",
|
|
14914
|
+
{
|
|
14915
|
+
className: cn(
|
|
14916
|
+
"yv:flex yv:justify-center yv:gap-2 yv:p-4 yv:bg-background yv:border-border",
|
|
14917
|
+
border === "top" && "yv:border-t",
|
|
14918
|
+
border === "bottom" && "yv:border-b"
|
|
14919
|
+
),
|
|
14920
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "yv:grid yv:w-full yv:grid-cols-2 yv:items-center yv:max-w-lg yv:gap-1", children: [
|
|
14921
|
+
/* @__PURE__ */ jsx11(
|
|
14922
|
+
BibleChapterPicker.Root,
|
|
14923
|
+
{
|
|
14924
|
+
book,
|
|
14925
|
+
chapter,
|
|
14926
|
+
onBookChange: setBook,
|
|
14927
|
+
onChapterChange: setChapter,
|
|
14928
|
+
versionId,
|
|
14929
|
+
background,
|
|
14930
|
+
children: /* @__PURE__ */ jsx11(BibleChapterPicker.Trigger, { "aria-label": "Change Bible book and chapter", children: ({ chapter: chapter2, currentBook, loading }) => /* @__PURE__ */ jsx11(Button, { variant: "secondary", className: "yv:rounded-r-none", disabled: loading, children: loading ? "Loading..." : `${currentBook?.title || "Select"} ${chapter2 || ""}` }) })
|
|
14931
|
+
}
|
|
14932
|
+
),
|
|
14933
|
+
/* @__PURE__ */ jsxs5(
|
|
14934
|
+
BibleVersionPicker.Root,
|
|
14935
|
+
{
|
|
14936
|
+
versionId,
|
|
14937
|
+
onVersionChange: setVersionId,
|
|
14938
|
+
background,
|
|
14939
|
+
children: [
|
|
14940
|
+
/* @__PURE__ */ jsx11(BibleVersionPicker.Trigger, { "aria-label": "Change Bible version", children: ({ version: version2, loading }) => /* @__PURE__ */ jsx11(Button, { variant: "secondary", className: "yv:rounded-l-none", disabled: loading, children: loading ? "Loading..." : version2?.local_abbreviation || "Select version" }) }),
|
|
14941
|
+
/* @__PURE__ */ jsx11(BibleVersionPicker.Content, {})
|
|
14942
|
+
]
|
|
14943
|
+
}
|
|
14944
|
+
)
|
|
14945
|
+
] })
|
|
14946
|
+
}
|
|
14947
|
+
);
|
|
14948
|
+
}
|
|
14949
|
+
var BibleReader = Object.assign({}, { Root: Root5, Content: Content4, Toolbar });
|
|
14950
|
+
|
|
14951
|
+
// src/components/SignInButton.tsx
|
|
14952
|
+
import React12 from "react";
|
|
14953
|
+
import { Loader2 } from "lucide-react";
|
|
14954
|
+
|
|
14955
|
+
// src/providers/YVPProvider.tsx
|
|
14956
|
+
import {
|
|
14957
|
+
createContext as createContext4,
|
|
14958
|
+
useContext as useContext4,
|
|
14959
|
+
useEffect as useEffect2,
|
|
14960
|
+
useState as useState3,
|
|
14961
|
+
useCallback
|
|
14962
|
+
} from "react";
|
|
14963
|
+
|
|
14964
|
+
// src/providers/YVPErrorBoundary.tsx
|
|
14965
|
+
import { Component } from "react";
|
|
14966
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
14967
|
+
var YVPErrorBoundary = class extends Component {
|
|
14968
|
+
constructor(props) {
|
|
14969
|
+
super(props);
|
|
14970
|
+
this.state = { hasError: false, error: null };
|
|
14971
|
+
}
|
|
14972
|
+
static getDerivedStateFromError(error46) {
|
|
14973
|
+
return { hasError: true, error: error46 };
|
|
14974
|
+
}
|
|
14975
|
+
componentDidCatch(error46, errorInfo) {
|
|
14976
|
+
const { onError } = this.props;
|
|
14977
|
+
if (onError) {
|
|
14978
|
+
onError(error46, errorInfo);
|
|
14979
|
+
}
|
|
14980
|
+
if (process.env.NODE_ENV === "development") {
|
|
14981
|
+
console.error("YVP Error Boundary caught error:", error46, errorInfo);
|
|
14982
|
+
}
|
|
14983
|
+
}
|
|
14984
|
+
render() {
|
|
14985
|
+
const { hasError, error: error46 } = this.state;
|
|
14986
|
+
const { children, fallback } = this.props;
|
|
14987
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
14988
|
+
if (hasError) {
|
|
14989
|
+
if (fallback) {
|
|
14990
|
+
return fallback;
|
|
14991
|
+
}
|
|
14992
|
+
return /* @__PURE__ */ jsxs6("div", { style: { padding: "20px", textAlign: "center" }, children: [
|
|
14993
|
+
/* @__PURE__ */ jsx12("h2", { children: "Something went wrong" }),
|
|
14994
|
+
/* @__PURE__ */ jsx12("p", { children: "We encountered an error while loading YouVersion Platform components." }),
|
|
14995
|
+
isDevelopment && error46 && /* @__PURE__ */ jsxs6("details", { style: { marginTop: "10px" }, children: [
|
|
14996
|
+
/* @__PURE__ */ jsx12("summary", { children: "Error details (development only)" }),
|
|
14997
|
+
/* @__PURE__ */ jsx12("pre", { style: { textAlign: "left", overflow: "auto" }, children: error46.toString() })
|
|
14998
|
+
] })
|
|
14999
|
+
] });
|
|
15000
|
+
}
|
|
15001
|
+
return children;
|
|
15002
|
+
}
|
|
15003
|
+
};
|
|
15004
|
+
|
|
15005
|
+
// src/providers/YVPProvider.tsx
|
|
15006
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
15007
|
+
var YVPContext = createContext4(null);
|
|
15008
|
+
function YVPProvider({
|
|
15009
|
+
config: config2,
|
|
15010
|
+
children,
|
|
15011
|
+
errorFallback,
|
|
15012
|
+
onError,
|
|
15013
|
+
theme = "light"
|
|
15014
|
+
}) {
|
|
15015
|
+
const [authState, setAuthState] = useState3({
|
|
15016
|
+
isAuthenticated: false,
|
|
15017
|
+
isLoading: false,
|
|
15018
|
+
accessToken: null,
|
|
15019
|
+
result: null,
|
|
15020
|
+
error: null
|
|
15021
|
+
});
|
|
15022
|
+
useEffect2(() => {
|
|
15023
|
+
const initializeAuth = () => {
|
|
15024
|
+
YouVersionPlatformConfiguration.appKey = config2.appKey;
|
|
15025
|
+
YouVersionPlatformConfiguration.installationId = config2.installationId ?? null;
|
|
15026
|
+
const strategy = new WebAuthenticationStrategy({
|
|
15027
|
+
redirectUri: config2.redirectUri || ""
|
|
15028
|
+
});
|
|
15029
|
+
AuthenticationStrategyRegistry.register(strategy);
|
|
15030
|
+
const existingToken = YouVersionPlatformConfiguration.accessToken;
|
|
15031
|
+
if (existingToken) {
|
|
15032
|
+
setAuthState({
|
|
15033
|
+
isAuthenticated: true,
|
|
15034
|
+
isLoading: false,
|
|
15035
|
+
accessToken: existingToken,
|
|
15036
|
+
result: null,
|
|
15037
|
+
error: null
|
|
15038
|
+
});
|
|
15039
|
+
return;
|
|
15040
|
+
}
|
|
15041
|
+
WebAuthenticationStrategy.handleCallback();
|
|
15042
|
+
const storedCallback = WebAuthenticationStrategy.getStoredCallback();
|
|
15043
|
+
if (storedCallback) {
|
|
15044
|
+
try {
|
|
15045
|
+
const result = new SignInWithYouVersionResult(storedCallback);
|
|
15046
|
+
const { accessToken, errorMsg } = result;
|
|
15047
|
+
if (accessToken) {
|
|
15048
|
+
YouVersionPlatformConfiguration.setAccessToken(accessToken);
|
|
15049
|
+
}
|
|
15050
|
+
setAuthState({
|
|
15051
|
+
isAuthenticated: !!accessToken,
|
|
15052
|
+
isLoading: false,
|
|
15053
|
+
accessToken: accessToken ?? null,
|
|
15054
|
+
result,
|
|
15055
|
+
error: errorMsg ? new Error(errorMsg) : null
|
|
15056
|
+
});
|
|
15057
|
+
} catch (error46) {
|
|
15058
|
+
setAuthState({
|
|
15059
|
+
isAuthenticated: false,
|
|
15060
|
+
isLoading: false,
|
|
15061
|
+
accessToken: null,
|
|
15062
|
+
result: null,
|
|
15063
|
+
error: error46
|
|
15064
|
+
});
|
|
15065
|
+
}
|
|
15066
|
+
} else {
|
|
15067
|
+
setAuthState({
|
|
15068
|
+
isAuthenticated: false,
|
|
15069
|
+
isLoading: false,
|
|
15070
|
+
accessToken: null,
|
|
15071
|
+
result: null,
|
|
15072
|
+
error: null
|
|
15073
|
+
});
|
|
15074
|
+
}
|
|
15075
|
+
};
|
|
15076
|
+
initializeAuth();
|
|
15077
|
+
}, [config2.appKey, config2.installationId, config2.redirectUri]);
|
|
15078
|
+
const signOut = useCallback(() => {
|
|
15079
|
+
YouVersionPlatformConfiguration.setAccessToken(null);
|
|
15080
|
+
setAuthState({
|
|
15081
|
+
isAuthenticated: false,
|
|
15082
|
+
isLoading: false,
|
|
15083
|
+
accessToken: null,
|
|
15084
|
+
result: null,
|
|
15085
|
+
error: null
|
|
15086
|
+
});
|
|
15087
|
+
}, []);
|
|
15088
|
+
const fetchUserInfo = useCallback(async () => {
|
|
15089
|
+
if (!authState.isAuthenticated || !authState.accessToken) {
|
|
15090
|
+
throw new Error("User is not authenticated");
|
|
15091
|
+
}
|
|
15092
|
+
return YouVersionAPIUsers.userInfo(authState.accessToken);
|
|
15093
|
+
}, [authState.isAuthenticated, authState.accessToken]);
|
|
15094
|
+
const value = {
|
|
15095
|
+
config: config2,
|
|
15096
|
+
client: ApiClient,
|
|
15097
|
+
auth: authState,
|
|
15098
|
+
signOut,
|
|
15099
|
+
fetchUserInfo
|
|
15100
|
+
};
|
|
15101
|
+
return /* @__PURE__ */ jsx13(YVPErrorBoundary, { fallback: errorFallback, onError, children: /* @__PURE__ */ jsx13(YVPContext.Provider, { value, children: /* @__PURE__ */ jsx13("div", { className: "yv:contents", "data-yv-sdk": true, "data-yv-theme": theme, children }) }) });
|
|
15102
|
+
}
|
|
15103
|
+
function useYVP() {
|
|
15104
|
+
const context = useContext4(YVPContext);
|
|
15105
|
+
if (!context) {
|
|
15106
|
+
throw new Error("useYVP must be used within a YVPProvider");
|
|
15107
|
+
}
|
|
15108
|
+
return context;
|
|
15109
|
+
}
|
|
15110
|
+
|
|
15111
|
+
// src/hooks/useAuthentication.ts
|
|
15112
|
+
import { useCallback as useCallback2 } from "react";
|
|
15113
|
+
function useAuthentication() {
|
|
15114
|
+
const { auth, signOut, fetchUserInfo, client: _client } = useYVP();
|
|
15115
|
+
const signIn = useCallback2(
|
|
15116
|
+
async (requiredPermissions = [], optionalPermissions = []) => {
|
|
15117
|
+
return await YouVersionAPIUsers.signIn(
|
|
15118
|
+
new Set(requiredPermissions),
|
|
15119
|
+
new Set(optionalPermissions)
|
|
15120
|
+
);
|
|
15121
|
+
},
|
|
15122
|
+
[]
|
|
15123
|
+
);
|
|
15124
|
+
return {
|
|
15125
|
+
auth,
|
|
15126
|
+
signIn,
|
|
15127
|
+
signOut,
|
|
15128
|
+
fetchUserInfo
|
|
15129
|
+
};
|
|
15130
|
+
}
|
|
15131
|
+
|
|
15132
|
+
// src/components/youversion-logo.tsx
|
|
15133
|
+
import "react";
|
|
15134
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
15135
|
+
function YouVersionLogo(props) {
|
|
15136
|
+
return /* @__PURE__ */ jsxs7(
|
|
15137
|
+
"svg",
|
|
15138
|
+
{
|
|
15139
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15140
|
+
fill: "none",
|
|
15141
|
+
viewBox: "0 0 26 26",
|
|
15142
|
+
role: "img",
|
|
15143
|
+
"aria-label": "YouVersion",
|
|
15144
|
+
...props,
|
|
15145
|
+
children: [
|
|
15146
|
+
/* @__PURE__ */ jsx14(
|
|
14424
15147
|
"mask",
|
|
14425
15148
|
{
|
|
14426
15149
|
id: "youversion-logo-mask",
|
|
@@ -14432,7 +15155,7 @@ function YouVersionLogo(props) {
|
|
|
14432
15155
|
style: {
|
|
14433
15156
|
maskType: "alpha"
|
|
14434
15157
|
},
|
|
14435
|
-
children: /* @__PURE__ */
|
|
15158
|
+
children: /* @__PURE__ */ jsx14(
|
|
14436
15159
|
"path",
|
|
14437
15160
|
{
|
|
14438
15161
|
fill: "url(#youversion-logo-gradient-a)",
|
|
@@ -14443,9 +15166,9 @@ function YouVersionLogo(props) {
|
|
|
14443
15166
|
)
|
|
14444
15167
|
}
|
|
14445
15168
|
),
|
|
14446
|
-
/* @__PURE__ */
|
|
14447
|
-
/* @__PURE__ */
|
|
14448
|
-
/* @__PURE__ */
|
|
15169
|
+
/* @__PURE__ */ jsxs7("g", { mask: "url(#youversion-logo-mask)", children: [
|
|
15170
|
+
/* @__PURE__ */ jsx14("path", { fill: "url(#youversion-logo-gradient-c)", d: "M0 0h26v26H0z" }),
|
|
15171
|
+
/* @__PURE__ */ jsx14(
|
|
14449
15172
|
"path",
|
|
14450
15173
|
{
|
|
14451
15174
|
fill: "#FEF5EB",
|
|
@@ -14454,8 +15177,8 @@ function YouVersionLogo(props) {
|
|
|
14454
15177
|
clipRule: "evenodd"
|
|
14455
15178
|
}
|
|
14456
15179
|
),
|
|
14457
|
-
/* @__PURE__ */
|
|
14458
|
-
/* @__PURE__ */
|
|
15180
|
+
/* @__PURE__ */ jsx14("path", { fill: "#FF3D4D", d: "M4.774 20.468h4.073v3.055l-2.036-1.019-2.037 1.019v-3.055Z" }),
|
|
15181
|
+
/* @__PURE__ */ jsx14(
|
|
14459
15182
|
"path",
|
|
14460
15183
|
{
|
|
14461
15184
|
fill: "#FEF5EB",
|
|
@@ -14463,8 +15186,8 @@ function YouVersionLogo(props) {
|
|
|
14463
15186
|
}
|
|
14464
15187
|
)
|
|
14465
15188
|
] }),
|
|
14466
|
-
/* @__PURE__ */
|
|
14467
|
-
/* @__PURE__ */
|
|
15189
|
+
/* @__PURE__ */ jsxs7("defs", { children: [
|
|
15190
|
+
/* @__PURE__ */ jsxs7(
|
|
14468
15191
|
"linearGradient",
|
|
14469
15192
|
{
|
|
14470
15193
|
id: "youversion-logo-gradient-a",
|
|
@@ -14474,12 +15197,12 @@ function YouVersionLogo(props) {
|
|
|
14474
15197
|
y2: 26,
|
|
14475
15198
|
gradientUnits: "userSpaceOnUse",
|
|
14476
15199
|
children: [
|
|
14477
|
-
/* @__PURE__ */
|
|
14478
|
-
/* @__PURE__ */
|
|
15200
|
+
/* @__PURE__ */ jsx14("stop", { stopColor: "#C93D34" }),
|
|
15201
|
+
/* @__PURE__ */ jsx14("stop", { offset: 1, stopColor: "#7A2629" })
|
|
14479
15202
|
]
|
|
14480
15203
|
}
|
|
14481
15204
|
),
|
|
14482
|
-
/* @__PURE__ */
|
|
15205
|
+
/* @__PURE__ */ jsxs7(
|
|
14483
15206
|
"linearGradient",
|
|
14484
15207
|
{
|
|
14485
15208
|
id: "youversion-logo-gradient-c",
|
|
@@ -14489,8 +15212,8 @@ function YouVersionLogo(props) {
|
|
|
14489
15212
|
y2: 26,
|
|
14490
15213
|
gradientUnits: "userSpaceOnUse",
|
|
14491
15214
|
children: [
|
|
14492
|
-
/* @__PURE__ */
|
|
14493
|
-
/* @__PURE__ */
|
|
15215
|
+
/* @__PURE__ */ jsx14("stop", { stopColor: "#C93D34" }),
|
|
15216
|
+
/* @__PURE__ */ jsx14("stop", { offset: 1, stopColor: "#7A2629" })
|
|
14494
15217
|
]
|
|
14495
15218
|
}
|
|
14496
15219
|
)
|
|
@@ -14501,8 +15224,8 @@ function YouVersionLogo(props) {
|
|
|
14501
15224
|
}
|
|
14502
15225
|
|
|
14503
15226
|
// src/components/SignInButton.tsx
|
|
14504
|
-
import { jsx as
|
|
14505
|
-
var SignInButton =
|
|
15227
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
15228
|
+
var SignInButton = React12.forwardRef(
|
|
14506
15229
|
({
|
|
14507
15230
|
background = "light",
|
|
14508
15231
|
className,
|
|
@@ -14518,7 +15241,7 @@ var SignInButton = React9.forwardRef(
|
|
|
14518
15241
|
...props
|
|
14519
15242
|
}, ref) => {
|
|
14520
15243
|
const { signIn, auth } = useAuthentication();
|
|
14521
|
-
const [localLoading, setLocalLoading] =
|
|
15244
|
+
const [localLoading, setLocalLoading] = React12.useState(false);
|
|
14522
15245
|
const handleClick = async (e) => {
|
|
14523
15246
|
e.preventDefault();
|
|
14524
15247
|
if (onClick) {
|
|
@@ -14543,9 +15266,9 @@ var SignInButton = React9.forwardRef(
|
|
|
14543
15266
|
if (size === "short") {
|
|
14544
15267
|
buttonCopy = "Sign in";
|
|
14545
15268
|
}
|
|
14546
|
-
const loadingSpinner = /* @__PURE__ */
|
|
15269
|
+
const loadingSpinner = /* @__PURE__ */ jsx15(Loader2, { className: "yv:z-20 yv:absolute yv:left-1/2 yv:top-1/2 yv:animate-spin yv:-translate-x-1/2 yv:-translate-y-1/2 yv:fill-primary-foreground yv:text-primary" });
|
|
14547
15270
|
if (size === "icon") {
|
|
14548
|
-
return /* @__PURE__ */
|
|
15271
|
+
return /* @__PURE__ */ jsxs8(
|
|
14549
15272
|
Button,
|
|
14550
15273
|
{
|
|
14551
15274
|
...props,
|
|
@@ -14568,13 +15291,13 @@ var SignInButton = React9.forwardRef(
|
|
|
14568
15291
|
variant: background === "light" ? "outline" : "default",
|
|
14569
15292
|
children: [
|
|
14570
15293
|
buttonLoading ? loadingSpinner : null,
|
|
14571
|
-
/* @__PURE__ */
|
|
14572
|
-
/* @__PURE__ */
|
|
15294
|
+
/* @__PURE__ */ jsx15(YouVersionLogo, {}),
|
|
15295
|
+
/* @__PURE__ */ jsx15("span", { className: "yv:sr-only", children: buttonCopy })
|
|
14573
15296
|
]
|
|
14574
15297
|
}
|
|
14575
15298
|
);
|
|
14576
15299
|
}
|
|
14577
|
-
return /* @__PURE__ */
|
|
15300
|
+
return /* @__PURE__ */ jsxs8(
|
|
14578
15301
|
Button,
|
|
14579
15302
|
{
|
|
14580
15303
|
...props,
|
|
@@ -14597,7 +15320,7 @@ var SignInButton = React9.forwardRef(
|
|
|
14597
15320
|
variant: background === "light" ? "outline" : "default",
|
|
14598
15321
|
children: [
|
|
14599
15322
|
buttonLoading ? loadingSpinner : null,
|
|
14600
|
-
/* @__PURE__ */
|
|
15323
|
+
/* @__PURE__ */ jsx15(YouVersionLogo, {}),
|
|
14601
15324
|
buttonCopy
|
|
14602
15325
|
]
|
|
14603
15326
|
}
|
|
@@ -14607,12 +15330,12 @@ var SignInButton = React9.forwardRef(
|
|
|
14607
15330
|
SignInButton.displayName = "SignInButton";
|
|
14608
15331
|
|
|
14609
15332
|
// src/components/verse-of-the-day.tsx
|
|
14610
|
-
import
|
|
15333
|
+
import React13 from "react";
|
|
14611
15334
|
|
|
14612
15335
|
// src/components/icons/votd.tsx
|
|
14613
15336
|
import "react";
|
|
14614
|
-
import { jsx as
|
|
14615
|
-
var SvgComponent = (props) => /* @__PURE__ */
|
|
15337
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
15338
|
+
var SvgComponent = (props) => /* @__PURE__ */ jsxs9(
|
|
14616
15339
|
"svg",
|
|
14617
15340
|
{
|
|
14618
15341
|
width: "44",
|
|
@@ -14622,8 +15345,8 @@ var SvgComponent = (props) => /* @__PURE__ */ jsxs6(
|
|
|
14622
15345
|
fill: "none",
|
|
14623
15346
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14624
15347
|
children: [
|
|
14625
|
-
/* @__PURE__ */
|
|
14626
|
-
/* @__PURE__ */
|
|
15348
|
+
/* @__PURE__ */ jsx16("title", { children: "Sun" }),
|
|
15349
|
+
/* @__PURE__ */ jsx16(
|
|
14627
15350
|
"path",
|
|
14628
15351
|
{
|
|
14629
15352
|
fillRule: "evenodd",
|
|
@@ -14637,8 +15360,8 @@ var SvgComponent = (props) => /* @__PURE__ */ jsxs6(
|
|
|
14637
15360
|
);
|
|
14638
15361
|
|
|
14639
15362
|
// src/components/icons/share.tsx
|
|
14640
|
-
import { jsx as
|
|
14641
|
-
var SvgComponent2 = (props) => /* @__PURE__ */
|
|
15363
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
15364
|
+
var SvgComponent2 = (props) => /* @__PURE__ */ jsxs10(
|
|
14642
15365
|
"svg",
|
|
14643
15366
|
{
|
|
14644
15367
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -14648,14 +15371,14 @@ var SvgComponent2 = (props) => /* @__PURE__ */ jsxs7(
|
|
|
14648
15371
|
fill: "none",
|
|
14649
15372
|
...props,
|
|
14650
15373
|
children: [
|
|
14651
|
-
/* @__PURE__ */
|
|
15374
|
+
/* @__PURE__ */ jsx17(
|
|
14652
15375
|
"path",
|
|
14653
15376
|
{
|
|
14654
15377
|
fill: "currentColor",
|
|
14655
15378
|
d: "M16.121 9.187a1 1 0 0 1-1.414 0L13 7.48V15a1 1 0 1 1-2 0V7.348L9.121 9.227a1 1 0 1 1-1.414-1.414l3.52-3.52a1 1 0 0 1 1.414 0l3.48 3.48a1 1 0 0 1 0 1.414Z"
|
|
14656
15379
|
}
|
|
14657
15380
|
),
|
|
14658
|
-
/* @__PURE__ */
|
|
15381
|
+
/* @__PURE__ */ jsx17(
|
|
14659
15382
|
"path",
|
|
14660
15383
|
{
|
|
14661
15384
|
fill: "currentColor",
|
|
@@ -14667,8 +15390,8 @@ var SvgComponent2 = (props) => /* @__PURE__ */ jsxs7(
|
|
|
14667
15390
|
);
|
|
14668
15391
|
|
|
14669
15392
|
// src/components/bible-app-logo-lockup.tsx
|
|
14670
|
-
import { jsx as
|
|
14671
|
-
var SvgComponent3 = (props) => /* @__PURE__ */
|
|
15393
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
15394
|
+
var SvgComponent3 = (props) => /* @__PURE__ */ jsxs11(
|
|
14672
15395
|
"svg",
|
|
14673
15396
|
{
|
|
14674
15397
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -14678,8 +15401,8 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14678
15401
|
fill: "none",
|
|
14679
15402
|
...props,
|
|
14680
15403
|
children: [
|
|
14681
|
-
/* @__PURE__ */
|
|
14682
|
-
/* @__PURE__ */
|
|
15404
|
+
/* @__PURE__ */ jsx18("title", { children: "Bible App" }),
|
|
15405
|
+
/* @__PURE__ */ jsx18(
|
|
14683
15406
|
"mask",
|
|
14684
15407
|
{
|
|
14685
15408
|
id: "bible-app-logo-lockup-mask",
|
|
@@ -14691,7 +15414,7 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14691
15414
|
style: {
|
|
14692
15415
|
maskType: "alpha"
|
|
14693
15416
|
},
|
|
14694
|
-
children: /* @__PURE__ */
|
|
15417
|
+
children: /* @__PURE__ */ jsx18(
|
|
14695
15418
|
"path",
|
|
14696
15419
|
{
|
|
14697
15420
|
fill: "url(#bible-app-logo-lockup-gradient-a)",
|
|
@@ -14702,9 +15425,9 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14702
15425
|
)
|
|
14703
15426
|
}
|
|
14704
15427
|
),
|
|
14705
|
-
/* @__PURE__ */
|
|
14706
|
-
/* @__PURE__ */
|
|
14707
|
-
/* @__PURE__ */
|
|
15428
|
+
/* @__PURE__ */ jsxs11("g", { mask: "url(#bible-app-logo-lockup-mask)", children: [
|
|
15429
|
+
/* @__PURE__ */ jsx18("path", { fill: "url(#bible-app-logo-lockup-gradient-c)", d: "M63.562 0H80v16.438H63.562z" }),
|
|
15430
|
+
/* @__PURE__ */ jsx18(
|
|
14708
15431
|
"path",
|
|
14709
15432
|
{
|
|
14710
15433
|
fill: "#FEF5EB",
|
|
@@ -14713,18 +15436,18 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14713
15436
|
clipRule: "evenodd"
|
|
14714
15437
|
}
|
|
14715
15438
|
),
|
|
14716
|
-
/* @__PURE__ */
|
|
14717
|
-
/* @__PURE__ */
|
|
15439
|
+
/* @__PURE__ */ jsx18("path", { fill: "#FF3D4D", d: "M66.58 12.94h2.575v1.932l-1.287-.644-1.288.644v-1.931Z" }),
|
|
15440
|
+
/* @__PURE__ */ jsx18("g", { fill: "#FEF5EB", clipPath: "url(#bible-app-logo-lockup-clip)", children: /* @__PURE__ */ jsx18("path", { d: "M70.602 5.614c.173.105.374.156.603.156.219 0 .42-.055.593-.17.178-.113.31-.273.407-.474.1-.206.146-.439.146-.694a1.57 1.57 0 0 0-.142-.694 1.05 1.05 0 0 0-.402-.452 1.135 1.135 0 0 0-.598-.156c-.219 0-.42.055-.598.17a1.15 1.15 0 0 0-.406.474 1.626 1.626 0 0 0-.142.694c0 .265.046.498.142.694.091.197.223.347.397.452Zm-.096-1.16c0-.232.027-.438.087-.616a.906.906 0 0 1 .246-.406.512.512 0 0 1 .356-.142c.133 0 .247.046.357.137.11.091.196.224.26.402.069.174.1.379.1.616 0 .233-.032.439-.09.617a.951.951 0 0 1-.248.41.516.516 0 0 1-.356.142.537.537 0 0 1-.356-.137.95.95 0 0 1-.265-.401 1.995 1.995 0 0 1-.091-.621ZM76.675 9.14a3.91 3.91 0 0 1-.014-.68l.005-.056h-.178l-.005.046a1.256 1.256 0 0 1-.073.36.324.324 0 0 1-.141.16.704.704 0 0 1-.302.05h-.25a.696.696 0 0 1-.17-.013.073.073 0 0 1-.046-.05.654.654 0 0 1-.018-.174v-.78h.178c.082 0 .142.022.183.059.041.036.069.1.082.187.014.096.019.15.023.169l.005.041H76.122l-.004-.05a8.485 8.485 0 0 1-.023-.489v-.164c0-.119.005-.228.01-.324l.004-.05H75.936l-.005.04-.01.07c-.009.077-.022.14-.036.186a.188.188 0 0 1-.073.11c-.032.027-.082.046-.155.046h-.178v-.768c0-.086.009-.141.018-.173.01-.028.023-.041.046-.046a.637.637 0 0 1 .169-.018h.287c.119 0 .201.018.251.046a.241.241 0 0 1 .105.132c.023.064.046.174.06.32l.004.045h.178l-.009-.054a2.264 2.264 0 0 1-.009-.21c0-.12.01-.252.023-.402l.005-.055h-1.832v.164l.046.005a.719.719 0 0 1 .165.023.07.07 0 0 1 .05.05c.009.032.018.087.018.173v1.708c0 .087-.01.142-.018.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.165.023l-.046.004v.165h1.9v-.05ZM74.543 5.724l-.005-.055a3.91 3.91 0 0 1-.014-.717l.005-.055h-.178l-.005.046a1.678 1.678 0 0 1-.073.38.31.31 0 0 1-.146.173.693.693 0 0 1-.301.054h-.251a.695.695 0 0 1-.17-.013.072.072 0 0 1-.045-.05.653.653 0 0 1-.018-.174V3.587c0-.087.009-.142.018-.174a.072.072 0 0 1 .046-.05.82.82 0 0 1 .168-.023l.046-.004v-.164h-.982V3.34l.046.005a.72.72 0 0 1 .165.023.07.07 0 0 1 .05.05c.009.032.018.087.018.173v1.713c0 .087-.01.141-.018.173a.07.07 0 0 1-.05.05.72.72 0 0 1-.165.023l-.046.005v.164l1.904.005ZM68.762 8.034c-.091-.095-.233-.164-.411-.205a.685.685 0 0 0 .27-.2.61.61 0 0 0 .136-.389.522.522 0 0 0-.21-.434c-.137-.11-.329-.16-.57-.16l-.996-.009V6.806l.046.005a.72.72 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.019.087.019.173v1.717c0 .087-.01.142-.019.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.164.023l-.046.004v.169l1.073-.004c.178 0 .329-.028.461-.087a.705.705 0 0 0 .306-.256.666.666 0 0 0 .11-.374.555.555 0 0 0-.17-.439Zm-1.078-.977a.71.71 0 0 1 .018-.173c.01-.032.028-.046.046-.06a.349.349 0 0 1 .142-.018c.164 0 .269.041.333.11.064.073.1.187.1.356a.637.637 0 0 1-.105.383c-.059.083-.173.133-.356.133h-.182v-.73h.004Zm.662 1.818c-.096.091-.242.137-.452.137a.375.375 0 0 1-.146-.019c-.023-.009-.036-.027-.046-.054a.639.639 0 0 1-.018-.17v-.826h.242c.21 0 .352.046.434.128.087.082.132.205.132.379 0 .2-.05.338-.146.425ZM72.232 8.034s-.004 0 0 0c-.004 0-.004 0 0 0a.812.812 0 0 0-.41-.205.686.686 0 0 0 .269-.2.61.61 0 0 0 .137-.389.522.522 0 0 0-.21-.434c-.138-.11-.33-.16-.571-.16l-.996-.009V6.806l.046.005a.72.72 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.019.087.019.173v1.717c0 .087-.01.142-.018.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.165.023l-.046.004v.169l1.073-.004c.178 0 .33-.028.462-.087a.706.706 0 0 0 .305-.256.667.667 0 0 0 .11-.374.588.588 0 0 0-.169-.439Zm-.242-1.191c-.004 0-.004 0 0 0Zm-.835.214c0-.082.009-.137.018-.173.009-.032.027-.046.045-.06a.35.35 0 0 1 .142-.018c.164 0 .27.041.333.11.064.073.1.187.1.356a.637.637 0 0 1-.104.383c-.06.083-.174.133-.356.133h-.183v-.73h.004Zm.662 1.818c-.096.091-.242.137-.452.137a.36.36 0 0 1-.147-.019c-.022-.009-.036-.027-.045-.054a.634.634 0 0 1-.019-.17v-.826h.243c.21 0 .351.046.433.128.087.082.133.205.133.379 0 .2-.05.338-.146.425ZM69.2 6.637V6.806l.046.005a.72.72 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.019.087.019.173v1.717c0 .087-.01.142-.019.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.164.023l-.046.004v.169h.982V9.03l-.046-.005a.824.824 0 0 1-.169-.023.073.073 0 0 1-.046-.05.654.654 0 0 1-.018-.173V7.062c0-.087.01-.142.018-.174a.073.073 0 0 1 .046-.05.824.824 0 0 1 .17-.023l.045-.004v-.164l-.982-.01ZM68.328 5.724v-.165l-.046-.004a.823.823 0 0 1-.169-.023.072.072 0 0 1-.045-.05.648.648 0 0 1-.019-.174v-.785h1.028v.78c0 .087-.01.142-.019.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.164.023l-.046.005v.164h.982V5.55l-.046-.004a.821.821 0 0 1-.169-.023.072.072 0 0 1-.045-.05.653.653 0 0 1-.019-.174V3.587c0-.087.01-.142.019-.174a.072.072 0 0 1 .045-.05.821.821 0 0 1 .17-.023l.045-.004v-.169h-.982v.164l.046.005a.719.719 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.019.087.019.173v.767h-1.028v-.762c0-.087.01-.142.019-.174a.072.072 0 0 1 .045-.05.824.824 0 0 1 .17-.023l.045-.004v-.164h-.982V3.34l.046.005a.72.72 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.019.087.019.173v1.713c0 .086-.01.141-.019.173a.07.07 0 0 1-.05.05.72.72 0 0 1-.164.023l-.046.005v.169h.982ZM74.465 3.372c.027.023.06.064.1.142l.699 1.287v.503c0 .086-.01.141-.018.173a.07.07 0 0 1-.05.05.72.72 0 0 1-.165.023l-.046.005v.169l.927-.005.05.005v-.165l-.045-.004a.82.82 0 0 1-.169-.023.072.072 0 0 1-.046-.05.652.652 0 0 1-.018-.174v-.616l.539-1.069a1.07 1.07 0 0 1 .132-.205.244.244 0 0 1 .11-.078l.036-.009v-.16h-.703l-.05-.004v.164h.046c.1 0 .164.018.205.041.032.018.05.046.05.096a.673.673 0 0 1-.086.274l-.402.795-.53-1.014a.195.195 0 0 1-.027-.1c0-.014.004-.023.009-.033a.047.047 0 0 1 .027-.022c.028-.019.082-.028.16-.028h.05v-.173h-.885v.178h.05c.004 0 .023.004.05.027ZM74.538 8.701c0-.119.005-.21.01-.278l.004-.055h-.178l-.005.045a1.678 1.678 0 0 1-.073.38.32.32 0 0 1-.142.173.693.693 0 0 1-.3.055h-.252a.696.696 0 0 1-.169-.014.072.072 0 0 1-.046-.05.648.648 0 0 1-.018-.174V7.066c0-.086.01-.141.018-.173a.072.072 0 0 1 .046-.05.824.824 0 0 1 .169-.023l.046-.005v-.164h-.982V6.82l.046.004a.719.719 0 0 1 .164.023.07.07 0 0 1 .05.05c.01.032.018.087.018.174v1.703c0 .087-.009.142-.018.174a.07.07 0 0 1-.05.05.72.72 0 0 1-.164.023l-.046.004v.164h1.9l-.005-.054a5.229 5.229 0 0 1-.023-.434Z" }) })
|
|
14718
15441
|
] }),
|
|
14719
|
-
/* @__PURE__ */
|
|
15442
|
+
/* @__PURE__ */ jsx18(
|
|
14720
15443
|
"path",
|
|
14721
15444
|
{
|
|
14722
15445
|
fill: "currentColor",
|
|
14723
15446
|
d: "M1 2.706h3.248c.684 0 1.245.066 1.683.198.438.122.785.298 1.039.526.263.219.443.482.539.789a3.1 3.1 0 0 1 .145.96c0 .394-.088.762-.263 1.104-.176.333-.496.61-.96.829.298.131.543.28.736.447.193.167.346.346.46.54.114.183.193.38.237.59a3.206 3.206 0 0 1-.118 1.71c-.114.342-.307.64-.579.895-.272.245-.627.442-1.065.591-.438.14-.978.21-1.618.21H1V2.707ZM4.431 6.56c.622 0 1.056-.114 1.302-.342.245-.228.368-.557.368-.987 0-.447-.145-.767-.434-.96-.28-.201-.772-.302-1.473-.302H2.538v2.59h1.894Zm0 4.26c.377 0 .688-.035.933-.105.255-.07.452-.17.592-.302.15-.132.255-.29.316-.474s.092-.39.092-.618c0-.473-.136-.833-.408-1.078-.263-.254-.723-.382-1.38-.382H2.537v2.96h1.894Zm6.373-8.114v1.486H9.253V2.706h1.552Zm-.026 2.552v6.838h-1.5V5.258h1.5ZM13.976 8.9c.009.439.061.798.158 1.079.105.28.236.504.394.67.167.167.355.28.566.342.21.062.43.092.657.092.246 0 .474-.043.684-.131.21-.088.395-.224.552-.408.158-.193.28-.443.369-.75.087-.306.131-.683.131-1.13 0-.43-.048-.794-.145-1.092a2.062 2.062 0 0 0-.355-.736 1.314 1.314 0 0 0-.539-.421 1.566 1.566 0 0 0-.631-.132 2.06 2.06 0 0 0-.842.158 1.493 1.493 0 0 0-.565.447 1.9 1.9 0 0 0-.329.697c-.07.263-.105.557-.105.881V8.9Zm.013-6.194v3.446c.272-.36.583-.631.934-.816.36-.192.775-.289 1.249-.289.49 0 .916.088 1.276.263.359.176.657.421.894.737a3.2 3.2 0 0 1 .526 1.144c.123.438.184.925.184 1.46 0 .56-.07 1.07-.21 1.525-.14.447-.342.828-.605 1.144a2.768 2.768 0 0 1-.947.736c-.368.167-.78.25-1.236.25-.412 0-.794-.079-1.144-.236-.351-.158-.671-.421-.96-.79v.816h-1.447v-9.39h1.486Zm8.053 0v9.39h-1.5v-9.39h1.5Zm7.8 7.365c-.123.71-.426 1.262-.908 1.657-.482.386-1.175.578-2.078.578-1.087 0-1.916-.31-2.485-.933-.561-.632-.842-1.517-.842-2.657 0-.587.079-1.109.237-1.565.166-.456.394-.837.684-1.144a2.868 2.868 0 0 1 1.052-.71c.412-.167.863-.25 1.354-.25.526 0 .982.083 1.368.25.386.158.706.386.96.684.254.29.443.64.565 1.052.123.403.184.855.184 1.354v.658h-4.905c.018.622.176 1.127.474 1.512.298.386.75.579 1.354.579.474 0 .829-.092 1.065-.276.237-.184.395-.447.474-.79h1.446Zm-1.368-2.065c0-.561-.132-1.004-.395-1.328-.263-.325-.684-.487-1.262-.487-.553 0-.973.167-1.263.5-.29.324-.456.763-.5 1.315h3.42Zm8.715-5.3h1.578l3.577 9.39h-1.696l-.881-2.393h-3.643l-.868 2.393h-1.644l3.577-9.39Zm2.144 5.668-1.394-3.866-1.381 3.866h2.775Zm3.992-3.116h1.46v.946c.28-.377.6-.661.96-.854.367-.202.788-.303 1.262-.303.482 0 .903.088 1.262.263.36.167.658.408.894.723.246.316.426.697.54 1.145.122.438.184.929.184 1.472 0 .553-.07 1.057-.21 1.513a3.46 3.46 0 0 1-.606 1.157 2.642 2.642 0 0 1-.933.736c-.368.167-.785.25-1.25.25-.368 0-.727-.07-1.078-.21-.35-.14-.68-.399-.986-.776v3.327h-1.5v-9.39Zm1.485 3.537c0 .447.049.82.145 1.118.097.29.224.522.382.697.166.175.355.298.565.368.22.07.447.105.684.105.245 0 .473-.043.684-.131.21-.088.394-.228.552-.421.158-.193.28-.443.368-.75.088-.306.132-.679.132-1.117 0-.447-.048-.82-.145-1.118a1.933 1.933 0 0 0-.368-.737 1.229 1.229 0 0 0-.526-.407 1.718 1.718 0 0 0-.631-.119c-.535 0-.978.176-1.329.526-.342.351-.513.903-.513 1.657v.33Zm6.541-3.537h1.46v.946c.28-.377.6-.661.96-.854a2.585 2.585 0 0 1 1.262-.303c.482 0 .903.088 1.263.263.36.167.657.408.894.723.245.316.425.697.54 1.145.122.438.183.929.183 1.472 0 .553-.07 1.057-.21 1.513a3.46 3.46 0 0 1-.605 1.157 2.642 2.642 0 0 1-.934.736c-.368.167-.784.25-1.25.25a2.88 2.88 0 0 1-1.078-.21c-.35-.14-.679-.399-.986-.776v3.327h-1.499v-9.39Zm1.486 3.537c0 .447.048.82.145 1.118.096.29.223.522.381.697.167.175.355.298.566.368.219.07.447.105.683.105.246 0 .474-.043.684-.131a1.41 1.41 0 0 0 .553-.421c.157-.193.28-.443.368-.75.087-.306.131-.679.131-1.117 0-.447-.048-.82-.144-1.118a1.933 1.933 0 0 0-.369-.737 1.228 1.228 0 0 0-.526-.407 1.717 1.717 0 0 0-.63-.119c-.536 0-.978.176-1.329.526-.342.351-.513.903-.513 1.657v.33Z"
|
|
14724
15447
|
}
|
|
14725
15448
|
),
|
|
14726
|
-
/* @__PURE__ */
|
|
14727
|
-
/* @__PURE__ */
|
|
15449
|
+
/* @__PURE__ */ jsxs11("defs", { children: [
|
|
15450
|
+
/* @__PURE__ */ jsxs11(
|
|
14728
15451
|
"linearGradient",
|
|
14729
15452
|
{
|
|
14730
15453
|
id: "bible-app-logo-lockup-gradient-a",
|
|
@@ -14734,12 +15457,12 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14734
15457
|
y2: 16.438,
|
|
14735
15458
|
gradientUnits: "userSpaceOnUse",
|
|
14736
15459
|
children: [
|
|
14737
|
-
/* @__PURE__ */
|
|
14738
|
-
/* @__PURE__ */
|
|
15460
|
+
/* @__PURE__ */ jsx18("stop", { stopColor: "#C93D34" }),
|
|
15461
|
+
/* @__PURE__ */ jsx18("stop", { offset: 1, stopColor: "#7A2629" })
|
|
14739
15462
|
]
|
|
14740
15463
|
}
|
|
14741
15464
|
),
|
|
14742
|
-
/* @__PURE__ */
|
|
15465
|
+
/* @__PURE__ */ jsxs11(
|
|
14743
15466
|
"linearGradient",
|
|
14744
15467
|
{
|
|
14745
15468
|
id: "bible-app-logo-lockup-gradient-c",
|
|
@@ -14749,186 +15472,24 @@ var SvgComponent3 = (props) => /* @__PURE__ */ jsxs8(
|
|
|
14749
15472
|
y2: 16.438,
|
|
14750
15473
|
gradientUnits: "userSpaceOnUse",
|
|
14751
15474
|
children: [
|
|
14752
|
-
/* @__PURE__ */
|
|
14753
|
-
/* @__PURE__ */
|
|
15475
|
+
/* @__PURE__ */ jsx18("stop", { stopColor: "#C93D34" }),
|
|
15476
|
+
/* @__PURE__ */ jsx18("stop", { offset: 1, stopColor: "#7A2629" })
|
|
14754
15477
|
]
|
|
14755
15478
|
}
|
|
14756
15479
|
),
|
|
14757
|
-
/* @__PURE__ */
|
|
15480
|
+
/* @__PURE__ */ jsx18("clipPath", { id: "bible-app-logo-lockup-clip", children: /* @__PURE__ */ jsx18("path", { fill: "#fff", d: "M65.52 2.472h12.521V9.68h-12.52z" }) })
|
|
14758
15481
|
] })
|
|
14759
15482
|
]
|
|
14760
15483
|
}
|
|
14761
15484
|
);
|
|
14762
15485
|
|
|
14763
|
-
// src/components/verse.tsx
|
|
14764
|
-
import React10 from "react";
|
|
14765
|
-
import DOMPurify from "isomorphic-dompurify";
|
|
14766
|
-
import { usePassage } from "@youversion/platform-react-hooks";
|
|
14767
|
-
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
14768
|
-
var NON_BREAKING_SPACE = "\xA0";
|
|
14769
|
-
var DOMPURIFY_CONFIG = {
|
|
14770
|
-
ALLOWED_ATTR: ["class", "style", "id"],
|
|
14771
|
-
ALLOW_DATA_ATTR: true
|
|
14772
|
-
};
|
|
14773
|
-
function yvDomTransformer(html) {
|
|
14774
|
-
if (!window || !("DOMParser" in window)) {
|
|
14775
|
-
return html;
|
|
14776
|
-
}
|
|
14777
|
-
const sanitizedHtml = DOMPurify.sanitize(html, DOMPURIFY_CONFIG);
|
|
14778
|
-
const parser = new DOMParser();
|
|
14779
|
-
const doc = parser.parseFromString(sanitizedHtml, "text/html");
|
|
14780
|
-
const paragraphs = doc.querySelectorAll(".yv-vlbl");
|
|
14781
|
-
paragraphs.forEach((p) => {
|
|
14782
|
-
const text = p.textContent || "";
|
|
14783
|
-
if (!text.endsWith(NON_BREAKING_SPACE)) {
|
|
14784
|
-
p.textContent = text + NON_BREAKING_SPACE;
|
|
14785
|
-
}
|
|
14786
|
-
});
|
|
14787
|
-
const tables = doc.querySelectorAll("table");
|
|
14788
|
-
tables.forEach((table) => {
|
|
14789
|
-
const rows = table.querySelectorAll("tr");
|
|
14790
|
-
if (rows.length === 0) return;
|
|
14791
|
-
let maxColumns = 0;
|
|
14792
|
-
rows.forEach((row) => {
|
|
14793
|
-
const cells = row.querySelectorAll("td, th");
|
|
14794
|
-
let rowColumnCount = 0;
|
|
14795
|
-
cells.forEach((cell) => {
|
|
14796
|
-
if (cell instanceof HTMLTableCellElement) {
|
|
14797
|
-
const colspan = parseInt(cell.getAttribute("colspan") || "1", 10);
|
|
14798
|
-
rowColumnCount += colspan;
|
|
14799
|
-
} else {
|
|
14800
|
-
rowColumnCount += 1;
|
|
14801
|
-
}
|
|
14802
|
-
});
|
|
14803
|
-
maxColumns = Math.max(maxColumns, rowColumnCount);
|
|
14804
|
-
});
|
|
14805
|
-
if (maxColumns > 1) {
|
|
14806
|
-
rows.forEach((row) => {
|
|
14807
|
-
const cells = row.querySelectorAll("td, th");
|
|
14808
|
-
if (cells.length === 1) {
|
|
14809
|
-
const cell = cells[0];
|
|
14810
|
-
if (cell instanceof HTMLTableCellElement) {
|
|
14811
|
-
const existingColspan = parseInt(cell.getAttribute("colspan") || "1", 10);
|
|
14812
|
-
if (existingColspan < maxColumns) {
|
|
14813
|
-
cell.setAttribute("colspan", maxColumns.toString());
|
|
14814
|
-
}
|
|
14815
|
-
}
|
|
14816
|
-
}
|
|
14817
|
-
});
|
|
14818
|
-
}
|
|
14819
|
-
});
|
|
14820
|
-
const modifiedHtml = doc.body.innerHTML;
|
|
14821
|
-
return modifiedHtml;
|
|
14822
|
-
}
|
|
14823
|
-
var Verse = {
|
|
14824
|
-
/**
|
|
14825
|
-
* Renders a single verse with superscript number and text.
|
|
14826
|
-
*
|
|
14827
|
-
* @param props - The verse properties.
|
|
14828
|
-
* @param props.number - The verse number.
|
|
14829
|
-
* @param props.text - The verse text.
|
|
14830
|
-
* @param props.size - The size variant. Defaults to 'default'.
|
|
14831
|
-
* @returns The rendered verse element.
|
|
14832
|
-
*/
|
|
14833
|
-
Text: ({ number: number4, text, size = "default" }) => {
|
|
14834
|
-
if (size === "lg") {
|
|
14835
|
-
return /* @__PURE__ */ jsxs9("span", { className: "yv:[&>p]:inline-block", children: [
|
|
14836
|
-
/* @__PURE__ */ jsx14("sup", { className: "yv:text-muted-foreground yv:align-super yv:text-[0.6em]", children: number4 }),
|
|
14837
|
-
"\xA0",
|
|
14838
|
-
/* @__PURE__ */ jsx14("span", { className: "yv:font-serif! yv:text-xl yv:text-primary", children: text }),
|
|
14839
|
-
"\xA0"
|
|
14840
|
-
] });
|
|
14841
|
-
}
|
|
14842
|
-
return /* @__PURE__ */ jsxs9("span", { className: "yv:[&>p]:inline-block", children: [
|
|
14843
|
-
/* @__PURE__ */ jsx14("sup", { className: "yv:text-muted-foreground yv:align-super yv:text-[0.6em]", children: number4 }),
|
|
14844
|
-
"\xA0",
|
|
14845
|
-
/* @__PURE__ */ jsx14("span", { className: "yv:text-primary", children: text }),
|
|
14846
|
-
"\xA0"
|
|
14847
|
-
] });
|
|
14848
|
-
},
|
|
14849
|
-
Html: ({
|
|
14850
|
-
html,
|
|
14851
|
-
fontFamily,
|
|
14852
|
-
fontSize,
|
|
14853
|
-
lineHeight,
|
|
14854
|
-
showVerseNumbers = true
|
|
14855
|
-
}) => {
|
|
14856
|
-
const [transformedHtml, setTransformedHtml] = React10.useState(html);
|
|
14857
|
-
React10.useEffect(() => {
|
|
14858
|
-
setTransformedHtml(yvDomTransformer(html));
|
|
14859
|
-
}, [html]);
|
|
14860
|
-
return /* @__PURE__ */ jsx14(
|
|
14861
|
-
"section",
|
|
14862
|
-
{
|
|
14863
|
-
style: {
|
|
14864
|
-
...fontFamily ? { "--yv-reader-font-family": fontFamily } : {},
|
|
14865
|
-
...fontSize ? { "--yv-reader-font-size": `${fontSize}px` } : {},
|
|
14866
|
-
...lineHeight ? { "--yv-reader-line-height": lineHeight } : {}
|
|
14867
|
-
},
|
|
14868
|
-
"data-show-verse-numbers": showVerseNumbers,
|
|
14869
|
-
"data-slot": "yv-bible-renderer",
|
|
14870
|
-
dangerouslySetInnerHTML: { __html: transformedHtml }
|
|
14871
|
-
}
|
|
14872
|
-
);
|
|
14873
|
-
}
|
|
14874
|
-
};
|
|
14875
|
-
var BibleTextView = ({
|
|
14876
|
-
reference,
|
|
14877
|
-
fontFamily,
|
|
14878
|
-
fontSize,
|
|
14879
|
-
lineHeight,
|
|
14880
|
-
versionId,
|
|
14881
|
-
showVerseNumbers
|
|
14882
|
-
}) => {
|
|
14883
|
-
const { passage, loading, error: error46 } = usePassage({
|
|
14884
|
-
versionId,
|
|
14885
|
-
usfm: reference,
|
|
14886
|
-
include_headings: true,
|
|
14887
|
-
include_notes: true
|
|
14888
|
-
});
|
|
14889
|
-
if (loading) {
|
|
14890
|
-
return /* @__PURE__ */ jsx14(
|
|
14891
|
-
Verse.Html,
|
|
14892
|
-
{
|
|
14893
|
-
html: "<span>Loading...</span>",
|
|
14894
|
-
fontFamily,
|
|
14895
|
-
fontSize,
|
|
14896
|
-
lineHeight,
|
|
14897
|
-
showVerseNumbers
|
|
14898
|
-
}
|
|
14899
|
-
);
|
|
14900
|
-
}
|
|
14901
|
-
if (error46) {
|
|
14902
|
-
return /* @__PURE__ */ jsx14(
|
|
14903
|
-
Verse.Html,
|
|
14904
|
-
{
|
|
14905
|
-
html: '<span class="wj">We have run into an error...</span>',
|
|
14906
|
-
fontFamily,
|
|
14907
|
-
fontSize,
|
|
14908
|
-
lineHeight,
|
|
14909
|
-
showVerseNumbers
|
|
14910
|
-
}
|
|
14911
|
-
);
|
|
14912
|
-
}
|
|
14913
|
-
return /* @__PURE__ */ jsx14(
|
|
14914
|
-
Verse.Html,
|
|
14915
|
-
{
|
|
14916
|
-
html: passage?.content || "",
|
|
14917
|
-
fontFamily,
|
|
14918
|
-
fontSize,
|
|
14919
|
-
lineHeight,
|
|
14920
|
-
showVerseNumbers
|
|
14921
|
-
}
|
|
14922
|
-
);
|
|
14923
|
-
};
|
|
14924
|
-
|
|
14925
15486
|
// src/components/verse-of-the-day.tsx
|
|
14926
15487
|
import {
|
|
14927
15488
|
useVerseOfTheDay,
|
|
14928
15489
|
usePassage as usePassage2,
|
|
14929
15490
|
getDayOfYear
|
|
14930
15491
|
} from "@youversion/platform-react-hooks";
|
|
14931
|
-
import { jsx as
|
|
15492
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
14932
15493
|
function VerseOfTheDay({
|
|
14933
15494
|
dayOfYear,
|
|
14934
15495
|
versionId = 1,
|
|
@@ -14939,7 +15500,7 @@ function VerseOfTheDay({
|
|
|
14939
15500
|
showBibleAppAttribution = true,
|
|
14940
15501
|
size = "default"
|
|
14941
15502
|
}) {
|
|
14942
|
-
const day =
|
|
15503
|
+
const day = React13.useMemo(
|
|
14943
15504
|
() => dayOfYear || getDayOfYear(/* @__PURE__ */ new Date()),
|
|
14944
15505
|
[dayOfYear]
|
|
14945
15506
|
);
|
|
@@ -14969,34 +15530,34 @@ function VerseOfTheDay({
|
|
|
14969
15530
|
} else {
|
|
14970
15531
|
referenceText = "No verse found";
|
|
14971
15532
|
}
|
|
14972
|
-
return /* @__PURE__ */
|
|
15533
|
+
return /* @__PURE__ */ jsxs12(
|
|
14973
15534
|
"section",
|
|
14974
15535
|
{
|
|
14975
15536
|
"data-size": size,
|
|
14976
15537
|
className: "yv:data-[size=lg]:p-8 yv:data-[size=default]:p-4 yv:*:shrink-0 yv:font-sans yv:flex yv:flex-col yv:gap-3 yv:max-w-screen-sm yv:p-4 yv:shadow yv:rounded-2xl",
|
|
14977
15538
|
children: [
|
|
14978
|
-
/* @__PURE__ */
|
|
14979
|
-
showSunIcon ? /* @__PURE__ */
|
|
15539
|
+
/* @__PURE__ */ jsxs12("div", { className: "yv:flex yv:items-center yv:gap-2", children: [
|
|
15540
|
+
showSunIcon ? /* @__PURE__ */ jsx19(
|
|
14980
15541
|
"div",
|
|
14981
15542
|
{
|
|
14982
15543
|
"data-slot": "card-icon",
|
|
14983
15544
|
className: "yv:col-start-1 yv:row-start-1 yv:self-start yv:justify-self-start",
|
|
14984
|
-
children: /* @__PURE__ */
|
|
15545
|
+
children: /* @__PURE__ */ jsx19(SvgComponent, { className: "yv:shrink-0 yv:h-10 yv:w-10" })
|
|
14985
15546
|
}
|
|
14986
15547
|
) : null,
|
|
14987
|
-
/* @__PURE__ */
|
|
15548
|
+
/* @__PURE__ */ jsx19("div", { className: "yv:grow yv:grid", children: /* @__PURE__ */ jsx19(
|
|
14988
15549
|
"p",
|
|
14989
15550
|
{
|
|
14990
15551
|
className: "trim-both yv:line-clamp-1 yv:text-muted-foreground yv:uppercase yv:text-xs yv:font-medium yv:select-none",
|
|
14991
15552
|
children: "Verse of The Day"
|
|
14992
15553
|
}
|
|
14993
15554
|
) }),
|
|
14994
|
-
showShareButton ? /* @__PURE__ */
|
|
15555
|
+
showShareButton ? /* @__PURE__ */ jsx19(
|
|
14995
15556
|
"div",
|
|
14996
15557
|
{
|
|
14997
15558
|
"data-slot": "card-action",
|
|
14998
15559
|
className: "yv:col-start-2 yv:row-span-2 yv:row-start-1 yv:self-start yv:justify-self-end",
|
|
14999
|
-
children: /* @__PURE__ */
|
|
15560
|
+
children: /* @__PURE__ */ jsx19(
|
|
15000
15561
|
Button,
|
|
15001
15562
|
{
|
|
15002
15563
|
"aria-label": "Share",
|
|
@@ -15006,13 +15567,13 @@ function VerseOfTheDay({
|
|
|
15006
15567
|
onClick: () => alert("Share: To be implemented..."),
|
|
15007
15568
|
size: "icon",
|
|
15008
15569
|
variant: "ghost",
|
|
15009
|
-
children: /* @__PURE__ */
|
|
15570
|
+
children: /* @__PURE__ */ jsx19(SvgComponent2, { className: "yv:h-6! yv:w-6!" })
|
|
15010
15571
|
}
|
|
15011
15572
|
)
|
|
15012
15573
|
}
|
|
15013
15574
|
) : null
|
|
15014
15575
|
] }),
|
|
15015
|
-
/* @__PURE__ */
|
|
15576
|
+
/* @__PURE__ */ jsx19("div", { children: passage ? /* @__PURE__ */ jsx19(
|
|
15016
15577
|
Verse.Html,
|
|
15017
15578
|
{
|
|
15018
15579
|
fontSize: size === "default" ? 16 : 20,
|
|
@@ -15020,13 +15581,13 @@ function VerseOfTheDay({
|
|
|
15020
15581
|
html: passage?.content || ""
|
|
15021
15582
|
}
|
|
15022
15583
|
) : null }),
|
|
15023
|
-
/* @__PURE__ */
|
|
15024
|
-
showReadFullChapterButton || showBibleAppAttribution ? /* @__PURE__ */
|
|
15584
|
+
/* @__PURE__ */ jsx19("p", { className: "yv:text-(--yv-gray-30) yv:font-medium yv:text-sm", children: referenceText }),
|
|
15585
|
+
showReadFullChapterButton || showBibleAppAttribution ? /* @__PURE__ */ jsxs12(
|
|
15025
15586
|
"div",
|
|
15026
15587
|
{
|
|
15027
15588
|
className: 'yv:grid yv:grid-cols-1 yv:[:has([data-slot="card-action"]):has([data-slot="attribution"])]:grid-cols-2 yv:mt-4 yv:justify-between yv:items-center yv:gap-2 yv:w-full',
|
|
15028
15589
|
children: [
|
|
15029
|
-
showReadFullChapterButton ? /* @__PURE__ */
|
|
15590
|
+
showReadFullChapterButton ? /* @__PURE__ */ jsx19(
|
|
15030
15591
|
Button,
|
|
15031
15592
|
{
|
|
15032
15593
|
"data-slot": "card-action",
|
|
@@ -15036,7 +15597,7 @@ function VerseOfTheDay({
|
|
|
15036
15597
|
children: "Read Full Chapter"
|
|
15037
15598
|
}
|
|
15038
15599
|
) : null,
|
|
15039
|
-
showBibleAppAttribution ? /* @__PURE__ */
|
|
15600
|
+
showBibleAppAttribution ? /* @__PURE__ */ jsx19(
|
|
15040
15601
|
SvgComponent3,
|
|
15041
15602
|
{
|
|
15042
15603
|
"data-slot": "attribution",
|
|
@@ -15061,8 +15622,10 @@ export {
|
|
|
15061
15622
|
BOOK_IDS,
|
|
15062
15623
|
BibleChapterPicker,
|
|
15063
15624
|
BibleClient,
|
|
15625
|
+
BibleReader,
|
|
15064
15626
|
BibleSDKProvider,
|
|
15065
15627
|
BibleTextView,
|
|
15628
|
+
BibleVersionPicker,
|
|
15066
15629
|
HighlightsClient,
|
|
15067
15630
|
LanguagesClient,
|
|
15068
15631
|
MemoryStorageStrategy,
|