@campnetwork/origin 1.2.0 → 1.2.1
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 +0 -6
- package/dist/core.cjs +51 -61
- package/dist/core.d.ts +0 -25
- package/dist/core.esm.d.ts +0 -25
- package/dist/core.esm.js +49 -59
- package/dist/react/index.esm.d.ts +1 -44
- package/dist/react/index.esm.js +44 -230
- package/package.json +1 -1
|
@@ -168,15 +168,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
|
|
|
168
168
|
|
|
169
169
|
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
170
170
|
|
|
171
|
-
interface OriginUsageReturnType {
|
|
172
|
-
user: {
|
|
173
|
-
multiplier: number;
|
|
174
|
-
points: number;
|
|
175
|
-
active: boolean;
|
|
176
|
-
};
|
|
177
|
-
teams: Array<any>;
|
|
178
|
-
dataSources: Array<any>;
|
|
179
|
-
}
|
|
180
171
|
interface RoyaltyInfo {
|
|
181
172
|
tokenBoundAccount: Address;
|
|
182
173
|
balance: bigint;
|
|
@@ -219,26 +210,10 @@ declare class Origin {
|
|
|
219
210
|
constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
|
|
220
211
|
getJwt(): string;
|
|
221
212
|
setViemClient(client: WalletClient): void;
|
|
222
|
-
uploadFile(file: File, options?: {
|
|
223
|
-
progressCallback?: (percent: number) => void;
|
|
224
|
-
}): Promise<any>;
|
|
225
213
|
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
226
214
|
progressCallback?: (percent: number) => void;
|
|
227
215
|
}): Promise<string | null>;
|
|
228
216
|
mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
|
|
229
|
-
getOriginUploads(): Promise<any[] | null>;
|
|
230
|
-
/**
|
|
231
|
-
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
232
|
-
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
233
|
-
*/
|
|
234
|
-
getOriginUsage(): Promise<OriginUsageReturnType>;
|
|
235
|
-
/**
|
|
236
|
-
* Set the user's consent for Origin usage.
|
|
237
|
-
* @param {boolean} consent The user's consent.
|
|
238
|
-
* @returns {Promise<void>}
|
|
239
|
-
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
240
|
-
*/
|
|
241
|
-
setOriginConsent(consent: boolean): Promise<void>;
|
|
242
217
|
/**
|
|
243
218
|
* Call a contract method.
|
|
244
219
|
* @param {string} contractAddress The contract address.
|
|
@@ -697,23 +672,5 @@ type UseSocialsResult<TData = unknown, TError = Error> = UseQueryResult<TData, T
|
|
|
697
672
|
* @returns { { data: {}, socials: {}, error: Error, isLoading: boolean, refetch: () => {} } } react-query query object.
|
|
698
673
|
*/
|
|
699
674
|
declare const useSocials: () => UseSocialsResult;
|
|
700
|
-
/**
|
|
701
|
-
* Fetches the Origin usage data and uploads data.
|
|
702
|
-
* @returns { usage: { data: any, isError: boolean, isLoading: boolean, refetch: () => void }, uploads: { data: any, isError: boolean, isLoading: boolean, refetch: () => void } } The Origin usage data and uploads data.
|
|
703
|
-
*/
|
|
704
|
-
declare const useOrigin: () => {
|
|
705
|
-
stats: {
|
|
706
|
-
data: any;
|
|
707
|
-
isError: boolean;
|
|
708
|
-
isLoading: boolean;
|
|
709
|
-
refetch: () => void;
|
|
710
|
-
};
|
|
711
|
-
uploads: {
|
|
712
|
-
data: any[];
|
|
713
|
-
isError: boolean;
|
|
714
|
-
isLoading: boolean;
|
|
715
|
-
refetch: () => void;
|
|
716
|
-
};
|
|
717
|
-
};
|
|
718
675
|
|
|
719
|
-
export { StandaloneCampButton as CampButton, CampContext, CampModal, CampProvider, LinkButton, ModalContext, MyCampModal, useAuth, useAuthState, useConnect, useLinkModal, useLinkSocials, useModal,
|
|
676
|
+
export { StandaloneCampButton as CampButton, CampContext, CampModal, CampProvider, LinkButton, ModalContext, MyCampModal, useAuth, useAuthState, useConnect, useLinkModal, useLinkSocials, useModal, useProvider, useProviders, useSocials, useViem };
|
package/dist/react/index.esm.js
CHANGED
|
@@ -3522,7 +3522,7 @@ const createLicenseTerms = (price, duration, royaltyBps, paymentToken) => {
|
|
|
3522
3522
|
};
|
|
3523
3523
|
};
|
|
3524
3524
|
|
|
3525
|
-
var _Origin_instances, _Origin_generateURL, _Origin_setOriginStatus, _Origin_waitForTxReceipt, _Origin_ensureChainId, _Origin_getCurrentAccount, _Origin_resolveWalletAddress;
|
|
3525
|
+
var _Origin_instances, _Origin_generateURL, _Origin_setOriginStatus, _Origin_uploadFile, _Origin_waitForTxReceipt, _Origin_ensureChainId, _Origin_getCurrentAccount, _Origin_resolveWalletAddress;
|
|
3526
3526
|
/**
|
|
3527
3527
|
* The Origin class
|
|
3528
3528
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
@@ -3561,41 +3561,6 @@ class Origin {
|
|
|
3561
3561
|
setViemClient(client) {
|
|
3562
3562
|
this.viemClient = client;
|
|
3563
3563
|
}
|
|
3564
|
-
uploadFile(file, options) {
|
|
3565
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3566
|
-
let uploadInfo;
|
|
3567
|
-
try {
|
|
3568
|
-
uploadInfo = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_generateURL).call(this, file);
|
|
3569
|
-
}
|
|
3570
|
-
catch (error) {
|
|
3571
|
-
console.error("Failed to generate upload URL:", error);
|
|
3572
|
-
throw new Error(`Failed to generate upload URL: ${error instanceof Error ? error.message : String(error)}`);
|
|
3573
|
-
}
|
|
3574
|
-
if (!uploadInfo) {
|
|
3575
|
-
throw new Error("Failed to generate upload URL: No upload info returned");
|
|
3576
|
-
}
|
|
3577
|
-
try {
|
|
3578
|
-
yield uploadWithProgress(file, uploadInfo.url, (options === null || options === void 0 ? void 0 : options.progressCallback) || (() => { }));
|
|
3579
|
-
}
|
|
3580
|
-
catch (error) {
|
|
3581
|
-
try {
|
|
3582
|
-
yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_setOriginStatus).call(this, uploadInfo.key, "failed");
|
|
3583
|
-
}
|
|
3584
|
-
catch (statusError) {
|
|
3585
|
-
console.error("Failed to update status to failed:", statusError);
|
|
3586
|
-
}
|
|
3587
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3588
|
-
throw new Error(`Failed to upload file: ${errorMessage}`);
|
|
3589
|
-
}
|
|
3590
|
-
try {
|
|
3591
|
-
yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_setOriginStatus).call(this, uploadInfo.key, "success");
|
|
3592
|
-
}
|
|
3593
|
-
catch (statusError) {
|
|
3594
|
-
console.error("Failed to update status to success:", statusError);
|
|
3595
|
-
}
|
|
3596
|
-
return uploadInfo;
|
|
3597
|
-
});
|
|
3598
|
-
}
|
|
3599
3564
|
mintFile(file, metadata, license, parents, options) {
|
|
3600
3565
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3601
3566
|
let account = null;
|
|
@@ -3607,7 +3572,7 @@ class Origin {
|
|
|
3607
3572
|
}
|
|
3608
3573
|
let info;
|
|
3609
3574
|
try {
|
|
3610
|
-
info = yield this.
|
|
3575
|
+
info = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_uploadFile).call(this, file, options);
|
|
3611
3576
|
if (!info || !info.key) {
|
|
3612
3577
|
throw new Error("Failed to upload file or get upload info.");
|
|
3613
3578
|
}
|
|
@@ -3694,72 +3659,6 @@ class Origin {
|
|
|
3694
3659
|
return tokenId.toString();
|
|
3695
3660
|
});
|
|
3696
3661
|
}
|
|
3697
|
-
getOriginUploads() {
|
|
3698
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3699
|
-
const res = yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`, {
|
|
3700
|
-
method: "GET",
|
|
3701
|
-
headers: {
|
|
3702
|
-
Authorization: `Bearer ${this.jwt}`,
|
|
3703
|
-
},
|
|
3704
|
-
});
|
|
3705
|
-
if (!res.ok) {
|
|
3706
|
-
console.error("Failed to get origin uploads");
|
|
3707
|
-
return null;
|
|
3708
|
-
}
|
|
3709
|
-
const data = yield res.json();
|
|
3710
|
-
return data.data;
|
|
3711
|
-
});
|
|
3712
|
-
}
|
|
3713
|
-
/**
|
|
3714
|
-
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
3715
|
-
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
3716
|
-
*/
|
|
3717
|
-
getOriginUsage() {
|
|
3718
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3719
|
-
const data = yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/usage`, {
|
|
3720
|
-
method: "GET",
|
|
3721
|
-
headers: {
|
|
3722
|
-
Authorization: `Bearer ${this.jwt}`,
|
|
3723
|
-
"Content-Type": "application/json",
|
|
3724
|
-
},
|
|
3725
|
-
}).then((res) => res.json());
|
|
3726
|
-
if (!data.isError && data.data.user) {
|
|
3727
|
-
return data;
|
|
3728
|
-
}
|
|
3729
|
-
else {
|
|
3730
|
-
throw new APIError(data.message || "Failed to fetch Origin usage");
|
|
3731
|
-
}
|
|
3732
|
-
});
|
|
3733
|
-
}
|
|
3734
|
-
/**
|
|
3735
|
-
* Set the user's consent for Origin usage.
|
|
3736
|
-
* @param {boolean} consent The user's consent.
|
|
3737
|
-
* @returns {Promise<void>}
|
|
3738
|
-
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
3739
|
-
*/
|
|
3740
|
-
setOriginConsent(consent) {
|
|
3741
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3742
|
-
if (consent === undefined) {
|
|
3743
|
-
throw new APIError("Consent is required");
|
|
3744
|
-
}
|
|
3745
|
-
const data = yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/status`, {
|
|
3746
|
-
method: "PATCH",
|
|
3747
|
-
headers: {
|
|
3748
|
-
Authorization: `Bearer ${this.jwt}`,
|
|
3749
|
-
"Content-Type": "application/json",
|
|
3750
|
-
},
|
|
3751
|
-
body: JSON.stringify({
|
|
3752
|
-
active: consent,
|
|
3753
|
-
}),
|
|
3754
|
-
}).then((res) => res.json());
|
|
3755
|
-
if (!data.isError) {
|
|
3756
|
-
return;
|
|
3757
|
-
}
|
|
3758
|
-
else {
|
|
3759
|
-
throw new APIError(data.message || "Failed to set Origin consent");
|
|
3760
|
-
}
|
|
3761
|
-
});
|
|
3762
|
-
}
|
|
3763
3662
|
/**
|
|
3764
3663
|
* Call a contract method.
|
|
3765
3664
|
* @param {string} contractAddress The contract address.
|
|
@@ -4081,6 +3980,40 @@ _Origin_instances = new WeakSet(), _Origin_generateURL = function _Origin_genera
|
|
|
4081
3980
|
throw error;
|
|
4082
3981
|
}
|
|
4083
3982
|
});
|
|
3983
|
+
}, _Origin_uploadFile = function _Origin_uploadFile(file, options) {
|
|
3984
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3985
|
+
let uploadInfo;
|
|
3986
|
+
try {
|
|
3987
|
+
uploadInfo = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_generateURL).call(this, file);
|
|
3988
|
+
}
|
|
3989
|
+
catch (error) {
|
|
3990
|
+
console.error("Failed to generate upload URL:", error);
|
|
3991
|
+
throw new Error(`Failed to generate upload URL: ${error instanceof Error ? error.message : String(error)}`);
|
|
3992
|
+
}
|
|
3993
|
+
if (!uploadInfo) {
|
|
3994
|
+
throw new Error("Failed to generate upload URL: No upload info returned");
|
|
3995
|
+
}
|
|
3996
|
+
try {
|
|
3997
|
+
yield uploadWithProgress(file, uploadInfo.url, (options === null || options === void 0 ? void 0 : options.progressCallback) || (() => { }));
|
|
3998
|
+
}
|
|
3999
|
+
catch (error) {
|
|
4000
|
+
try {
|
|
4001
|
+
yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_setOriginStatus).call(this, uploadInfo.key, "failed");
|
|
4002
|
+
}
|
|
4003
|
+
catch (statusError) {
|
|
4004
|
+
console.error("Failed to update status to failed:", statusError);
|
|
4005
|
+
}
|
|
4006
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4007
|
+
throw new Error(`Failed to upload file: ${errorMessage}`);
|
|
4008
|
+
}
|
|
4009
|
+
try {
|
|
4010
|
+
yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_setOriginStatus).call(this, uploadInfo.key, "success");
|
|
4011
|
+
}
|
|
4012
|
+
catch (statusError) {
|
|
4013
|
+
console.error("Failed to update status to success:", statusError);
|
|
4014
|
+
}
|
|
4015
|
+
return uploadInfo;
|
|
4016
|
+
});
|
|
4084
4017
|
}, _Origin_waitForTxReceipt = function _Origin_waitForTxReceipt(txHash_1) {
|
|
4085
4018
|
return __awaiter(this, arguments, void 0, function* (txHash, opts = {}) {
|
|
4086
4019
|
var _a, _b, _c;
|
|
@@ -5632,30 +5565,6 @@ const useToast = () => {
|
|
|
5632
5565
|
return context;
|
|
5633
5566
|
};
|
|
5634
5567
|
|
|
5635
|
-
const OriginContext = createContext({
|
|
5636
|
-
statsQuery: null,
|
|
5637
|
-
uploadsQuery: null,
|
|
5638
|
-
});
|
|
5639
|
-
const OriginProvider = ({ children }) => {
|
|
5640
|
-
const { authenticated } = useAuthState();
|
|
5641
|
-
const { auth } = useContext(CampContext);
|
|
5642
|
-
if (!auth && typeof window !== "undefined") {
|
|
5643
|
-
throw new Error("Auth instance is not available");
|
|
5644
|
-
}
|
|
5645
|
-
const statsQuery = useQuery({
|
|
5646
|
-
queryKey: ["origin-stats", authenticated],
|
|
5647
|
-
queryFn: () => { var _a, _b; return (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.origin) === null || _a === void 0 ? void 0 : _a.getOriginUsage()) !== null && _b !== void 0 ? _b : Promise.resolve(null); },
|
|
5648
|
-
});
|
|
5649
|
-
const uploadsQuery = useQuery({
|
|
5650
|
-
queryKey: ["origin-uploads", authenticated],
|
|
5651
|
-
queryFn: () => { var _a, _b; return (_b = (_a = auth === null || auth === void 0 ? void 0 : auth.origin) === null || _a === void 0 ? void 0 : _a.getOriginUploads()) !== null && _b !== void 0 ? _b : Promise.resolve(null); },
|
|
5652
|
-
});
|
|
5653
|
-
return (React.createElement(OriginContext.Provider, { value: {
|
|
5654
|
-
statsQuery: statsQuery,
|
|
5655
|
-
uploadsQuery: uploadsQuery,
|
|
5656
|
-
} }, children));
|
|
5657
|
-
};
|
|
5658
|
-
|
|
5659
5568
|
const CampContext = createContext({
|
|
5660
5569
|
clientId: null,
|
|
5661
5570
|
auth: null,
|
|
@@ -5697,9 +5606,8 @@ const CampProvider = ({ clientId, redirectUri, children, environment = "DEVELOPM
|
|
|
5697
5606
|
environment: ENVIRONMENTS[environment],
|
|
5698
5607
|
} },
|
|
5699
5608
|
React.createElement(SocialsProvider, null,
|
|
5700
|
-
React.createElement(
|
|
5701
|
-
React.createElement(
|
|
5702
|
-
React.createElement(ModalProvider, null, children))))));
|
|
5609
|
+
React.createElement(ToastProvider, null,
|
|
5610
|
+
React.createElement(ModalProvider, null, children)))));
|
|
5703
5611
|
};
|
|
5704
5612
|
|
|
5705
5613
|
const getWalletConnectProvider = (projectId, chain) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -5909,8 +5817,6 @@ const FancyInput = ({ value, onChange, step, placeholder, type = "text", icon, l
|
|
|
5909
5817
|
*/
|
|
5910
5818
|
const FileUpload = ({ onFileUpload, accept, maxFileSize, }) => {
|
|
5911
5819
|
const auth = useAuth();
|
|
5912
|
-
const { uploads } = useOrigin();
|
|
5913
|
-
const { refetch } = uploads;
|
|
5914
5820
|
const [isDragging, setIsDragging] = useState(false);
|
|
5915
5821
|
const [selectedFile, setSelectedFile] = useState(null);
|
|
5916
5822
|
const [isUploading, setIsUploading] = useState(false);
|
|
@@ -5953,7 +5859,6 @@ const FileUpload = ({ onFileUpload, accept, maxFileSize, }) => {
|
|
|
5953
5859
|
onFileUpload([selectedFile]);
|
|
5954
5860
|
}
|
|
5955
5861
|
addToast(`File minted successfully. Token ID: ${res}`, "success", 5000);
|
|
5956
|
-
refetch();
|
|
5957
5862
|
}
|
|
5958
5863
|
catch (error) {
|
|
5959
5864
|
if (error.toString().includes("User rejected")) {
|
|
@@ -6690,61 +6595,7 @@ const LinkingModal = () => {
|
|
|
6690
6595
|
* @returns { JSX.Element } The OriginSection component.
|
|
6691
6596
|
*/
|
|
6692
6597
|
const OriginSection = () => {
|
|
6693
|
-
|
|
6694
|
-
// const [royaltiesToClaim, setRoyaltiesToClaim] = useState<null | string>(null);
|
|
6695
|
-
// const [isClaiming, setIsClaiming] = useState(false);
|
|
6696
|
-
const { environment, auth } = useContext(CampContext);
|
|
6697
|
-
useToast();
|
|
6698
|
-
// const [uploadedImages, setUploadedImages] = useState(0);
|
|
6699
|
-
// const [uploadedVideos, setUploadedVideos] = useState(0);
|
|
6700
|
-
// const [uploadedAudio, setUploadedAudio] = useState(0);
|
|
6701
|
-
// const [uploadedText, setUploadedText] = useState(0);
|
|
6702
|
-
// useEffect(() => {
|
|
6703
|
-
// const fetchRoyalties = async () => {
|
|
6704
|
-
// if (!auth || !auth.origin) return;
|
|
6705
|
-
// const royalties = await auth?.origin.getRoyalties();
|
|
6706
|
-
// const bal = formatEther(royalties.balance);
|
|
6707
|
-
// setRoyaltiesToClaim(bal !== "0" ? formatCampAmount(Number(bal)) : null);
|
|
6708
|
-
// };
|
|
6709
|
-
// fetchRoyalties();
|
|
6710
|
-
// }, [auth]);
|
|
6711
|
-
// const handleClaimRoyalties = async () => {
|
|
6712
|
-
// if (!auth || !auth.origin || !royaltiesToClaim) return;
|
|
6713
|
-
// setIsClaiming(true);
|
|
6714
|
-
// try {
|
|
6715
|
-
// await auth.origin.claimRoyalties();
|
|
6716
|
-
// setRoyaltiesToClaim(null);
|
|
6717
|
-
// toast("Royalties claimed successfully!", "success", 5000);
|
|
6718
|
-
// } catch (error) {
|
|
6719
|
-
// console.error("Error claiming royalties:", error);
|
|
6720
|
-
// toast("Error claiming royalties. Please try again.", "error", 5000);
|
|
6721
|
-
// } finally {
|
|
6722
|
-
// setIsClaiming(false);
|
|
6723
|
-
// }
|
|
6724
|
-
// };
|
|
6725
|
-
// useEffect(() => {
|
|
6726
|
-
// if (uploads.data) {
|
|
6727
|
-
// let imagesCount = 0;
|
|
6728
|
-
// let videosCount = 0;
|
|
6729
|
-
// let audioCount = 0;
|
|
6730
|
-
// let textCount = 0;
|
|
6731
|
-
// uploads.data.forEach((upload) => {
|
|
6732
|
-
// if (upload.type.startsWith("image")) {
|
|
6733
|
-
// imagesCount++;
|
|
6734
|
-
// } else if (upload.type.startsWith("video")) {
|
|
6735
|
-
// videosCount++;
|
|
6736
|
-
// } else if (upload.type.startsWith("audio")) {
|
|
6737
|
-
// audioCount++;
|
|
6738
|
-
// } else if (upload.type.startsWith("text")) {
|
|
6739
|
-
// textCount++;
|
|
6740
|
-
// }
|
|
6741
|
-
// });
|
|
6742
|
-
// setUploadedImages(imagesCount);
|
|
6743
|
-
// setUploadedVideos(videosCount);
|
|
6744
|
-
// setUploadedAudio(audioCount);
|
|
6745
|
-
// setUploadedText(textCount);
|
|
6746
|
-
// }
|
|
6747
|
-
// }, [uploads.data]);
|
|
6598
|
+
const { environment } = useContext(CampContext);
|
|
6748
6599
|
return (React.createElement("div", { className: styles["origin-wrapper"] },
|
|
6749
6600
|
React.createElement("div", { className: styles["origin-section"] },
|
|
6750
6601
|
React.createElement(Tooltip, { content: environment.NAME === "PRODUCTION"
|
|
@@ -6900,36 +6751,20 @@ const SocialsTab = ({ connectedSocials, notConnectedSocials, refetch, isLoading,
|
|
|
6900
6751
|
connectedSocials.length === 0 && (React.createElement("span", { className: styles["no-socials"] }, "You have no socials linked.")))))));
|
|
6901
6752
|
};
|
|
6902
6753
|
const ImagesTab = () => {
|
|
6903
|
-
const { uploads } = useOrigin();
|
|
6904
|
-
const { isLoading } = uploads;
|
|
6905
6754
|
return (React.createElement(TabContent, { requiresProvider: true, className: styles["ip-tab-container"] },
|
|
6906
|
-
React.createElement(FileUpload, { accept: constants.SUPPORTED_IMAGE_FORMATS.join(","), maxFileSize: 1.049e7 })
|
|
6907
|
-
isLoading ? (React.createElement("div", { className: styles["ip-tab-content"] },
|
|
6908
|
-
React.createElement("div", { className: styles.spinner, style: { marginRight: "auto" } }))) : null));
|
|
6755
|
+
React.createElement(FileUpload, { accept: constants.SUPPORTED_IMAGE_FORMATS.join(","), maxFileSize: 1.049e7 })));
|
|
6909
6756
|
};
|
|
6910
6757
|
const AudioTab = () => {
|
|
6911
|
-
const { uploads } = useOrigin();
|
|
6912
|
-
const { isLoading } = uploads;
|
|
6913
6758
|
return (React.createElement(TabContent, { requiresProvider: true, className: styles["ip-tab-container"] },
|
|
6914
|
-
React.createElement(FileUpload, { accept: constants.SUPPORTED_AUDIO_FORMATS.join(","), maxFileSize: 1.573e7 })
|
|
6915
|
-
isLoading ? (React.createElement("div", { className: styles["ip-tab-content"] },
|
|
6916
|
-
React.createElement("div", { className: styles.spinner, style: { marginRight: "auto" } }))) : null));
|
|
6759
|
+
React.createElement(FileUpload, { accept: constants.SUPPORTED_AUDIO_FORMATS.join(","), maxFileSize: 1.573e7 })));
|
|
6917
6760
|
};
|
|
6918
6761
|
const VideosTab = () => {
|
|
6919
|
-
const { uploads } = useOrigin();
|
|
6920
|
-
const { isLoading } = uploads;
|
|
6921
6762
|
return (React.createElement(TabContent, { requiresProvider: true, className: styles["ip-tab-container"] },
|
|
6922
|
-
React.createElement(FileUpload, { accept: constants.SUPPORTED_VIDEO_FORMATS.join(","), maxFileSize: 2.097e7 })
|
|
6923
|
-
isLoading ? (React.createElement("div", { className: styles["ip-tab-content"] },
|
|
6924
|
-
React.createElement("div", { className: styles.spinner, style: { marginRight: "auto" } }))) : null));
|
|
6763
|
+
React.createElement(FileUpload, { accept: constants.SUPPORTED_VIDEO_FORMATS.join(","), maxFileSize: 2.097e7 })));
|
|
6925
6764
|
};
|
|
6926
6765
|
const TextTab = () => {
|
|
6927
|
-
const { uploads } = useOrigin();
|
|
6928
|
-
const { isLoading } = uploads;
|
|
6929
6766
|
return (React.createElement(TabContent, { requiresProvider: true, className: styles["ip-tab-container"] },
|
|
6930
|
-
React.createElement(FileUpload, { accept: constants.SUPPORTED_TEXT_FORMATS.join(","), maxFileSize: 1.049e7 })
|
|
6931
|
-
isLoading ? (React.createElement("div", { className: styles["ip-tab-content"] },
|
|
6932
|
-
React.createElement("div", { className: styles.spinner, style: { marginRight: "auto" } }))) : null));
|
|
6767
|
+
React.createElement(FileUpload, { accept: constants.SUPPORTED_TEXT_FORMATS.join(","), maxFileSize: 1.049e7 })));
|
|
6933
6768
|
};
|
|
6934
6769
|
|
|
6935
6770
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -7195,26 +7030,5 @@ const useSocials = () => {
|
|
|
7195
7030
|
const socials = (query === null || query === void 0 ? void 0 : query.data) || {};
|
|
7196
7031
|
return Object.assign(Object.assign({}, query), { socials });
|
|
7197
7032
|
};
|
|
7198
|
-
/**
|
|
7199
|
-
* Fetches the Origin usage data and uploads data.
|
|
7200
|
-
* @returns { usage: { data: any, isError: boolean, isLoading: boolean, refetch: () => void }, uploads: { data: any, isError: boolean, isLoading: boolean, refetch: () => void } } The Origin usage data and uploads data.
|
|
7201
|
-
*/
|
|
7202
|
-
const useOrigin = () => {
|
|
7203
|
-
const { statsQuery, uploadsQuery } = useContext(OriginContext);
|
|
7204
|
-
return {
|
|
7205
|
-
stats: {
|
|
7206
|
-
data: statsQuery === null || statsQuery === void 0 ? void 0 : statsQuery.data,
|
|
7207
|
-
isError: statsQuery === null || statsQuery === void 0 ? void 0 : statsQuery.isError,
|
|
7208
|
-
isLoading: statsQuery === null || statsQuery === void 0 ? void 0 : statsQuery.isLoading,
|
|
7209
|
-
refetch: statsQuery === null || statsQuery === void 0 ? void 0 : statsQuery.refetch,
|
|
7210
|
-
},
|
|
7211
|
-
uploads: {
|
|
7212
|
-
data: (uploadsQuery === null || uploadsQuery === void 0 ? void 0 : uploadsQuery.data) || [],
|
|
7213
|
-
isError: uploadsQuery === null || uploadsQuery === void 0 ? void 0 : uploadsQuery.isError,
|
|
7214
|
-
isLoading: uploadsQuery === null || uploadsQuery === void 0 ? void 0 : uploadsQuery.isLoading,
|
|
7215
|
-
refetch: uploadsQuery === null || uploadsQuery === void 0 ? void 0 : uploadsQuery.refetch,
|
|
7216
|
-
},
|
|
7217
|
-
};
|
|
7218
|
-
};
|
|
7219
7033
|
|
|
7220
|
-
export { StandaloneCampButton as CampButton, CampContext, CampModal, CampProvider, LinkButton, ModalContext, MyCampModal, useAuth, useAuthState, useConnect, useLinkModal, useLinkSocials, useModal,
|
|
7034
|
+
export { StandaloneCampButton as CampButton, CampContext, CampModal, CampProvider, LinkButton, ModalContext, MyCampModal, useAuth, useAuthState, useConnect, useLinkModal, useLinkSocials, useModal, useProvider, useProviders, useSocials, useViem };
|