@sollinked/sdk
Advanced tools
Comparing version 1.1.5 to 1.2.2
@@ -1,2 +0,2 @@ | ||
import { BroadcastParams, CreateMailingListParams, DraftParams, MailingList, MailingListBroadcast, RetryBroadcastParams, UpdateMailingListPriceListParams } from "./types"; | ||
import { BroadcastParams, CreateMailingListParams, DraftParams, MailingList, MailingListBroadcast, ResendBroadcastParams, RetryBroadcastParams, UpdateMailingListPriceListParams } from "./types"; | ||
import { ApiResult, AuthCallParams } from "../../types"; | ||
@@ -7,2 +7,3 @@ export declare const create: (params: CreateMailingListParams) => Promise<string | import("axios").AxiosResponse<ApiResult<undefined>, any>>; | ||
export declare const retry: (id: number, params: RetryBroadcastParams) => Promise<string | import("axios").AxiosResponse<ApiResult<undefined>, any>>; | ||
export declare const resend: (params: ResendBroadcastParams) => Promise<string | import("axios").AxiosResponse<ApiResult<undefined>, any>>; | ||
export declare const saveDraft: (params: DraftParams) => Promise<string | import("axios").AxiosResponse<ApiResult<number>, any>>; | ||
@@ -9,0 +10,0 @@ export declare const updateDraft: (id: number, params: DraftParams) => Promise<string | import("axios").AxiosResponse<ApiResult<undefined>, any>>; |
@@ -34,2 +34,10 @@ import axios from '../Services/axios.js'; | ||
}; | ||
export const resend = async (params) => { | ||
try { | ||
return await axios.post(`/mailingList/resend`, params); | ||
} | ||
catch (e) { | ||
return e.response.data; | ||
} | ||
}; | ||
export const saveDraft = async (params) => { | ||
@@ -36,0 +44,0 @@ try { |
@@ -34,2 +34,3 @@ import { AuthCallParams } from "../../types"; | ||
username?: string; | ||
past_broadcasts: PastBroadcast[]; | ||
}; | ||
@@ -50,2 +51,9 @@ export type MailingListBroadcast = { | ||
}; | ||
export type PastBroadcast = { | ||
id: number; | ||
user_id: number; | ||
username: string; | ||
title: string; | ||
created_at: string; | ||
}; | ||
export interface CreateMailingListParams extends AuthCallParams { | ||
@@ -64,2 +72,6 @@ tier_ids?: number[]; | ||
} | ||
export interface ResendBroadcastParams extends AuthCallParams { | ||
broadcast_id: number; | ||
subscriber_id: number; | ||
} | ||
export interface DraftParams extends AuthCallParams { | ||
@@ -66,0 +78,0 @@ title: string; |
@@ -305,2 +305,17 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
}, [user, auth, signature, me]); | ||
const resendBroadcast = useCallback(async (params) => { | ||
if (!user) { | ||
throw new UninitializedError(); | ||
} | ||
if (!auth.address || !auth.message || !signature) { | ||
return; | ||
} | ||
let { address, message } = auth; | ||
let res = await mailingList.resend({ address, message, signature, ...params }); | ||
if (typeof res === 'string') { | ||
return res; | ||
} | ||
await me(); | ||
return res; | ||
}, [user, auth, signature, me]); | ||
const saveBroadcastDraft = useCallback(async (params) => { | ||
@@ -683,2 +698,3 @@ if (!user) { | ||
retry: retryBroadcast, | ||
resend: resendBroadcast, | ||
broadcast: newBroadcast, | ||
@@ -685,0 +701,0 @@ saveDraft: saveBroadcastDraft, |
@@ -8,3 +8,3 @@ import { ReactNode } from "react"; | ||
import { MailTier, NewMailParams, OnMailPaymentParams } from "./src/Mail/types"; | ||
import { BroadcastParams, DraftParams, MailingList, MailingListBroadcast, UpdateMailingListPriceListParams } from "./src/MailingList/types"; | ||
import { BroadcastParams, DraftParams, MailingList, MailingListBroadcast, ResendBroadcastParams, UpdateMailingListPriceListParams } from "./src/MailingList/types"; | ||
import { Content, ContentCreateParams, ContentPayParams, ContentUpdateParams } from "./src/Content/types"; | ||
@@ -68,2 +68,3 @@ import { ContentCNFT, ContentPassCreateParams, ContentPassPayParams, ContentPassUpdateParams } from "./src/ContentPass/types"; | ||
retry: (id: number) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
resend: (params: Omit<ResendBroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
broadcast: (params: Omit<BroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
@@ -70,0 +71,0 @@ saveDraft: (params: Omit<BroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<number>, any> | undefined>; |
{ | ||
"name": "@sollinked/sdk", | ||
"version": "1.1.5", | ||
"version": "1.2.2", | ||
"description": "SDK for Sollinked", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -1,2 +0,2 @@ | ||
import { BroadcastParams, CreateMailingListParams, DraftParams, MailingList, MailingListBroadcast, RetryBroadcastParams, UpdateMailingListPriceListParams } from "./types" | ||
import { BroadcastParams, CreateMailingListParams, DraftParams, MailingList, MailingListBroadcast, ResendBroadcastParams, RetryBroadcastParams, UpdateMailingListPriceListParams } from "./types" | ||
import axios from '../Services/axios.js'; | ||
@@ -39,2 +39,3 @@ import { ApiResult, AuthCallParams } from "../../types"; | ||
// from content creator | ||
export const retry = async(id: number, params: RetryBroadcastParams) => { | ||
@@ -50,2 +51,13 @@ try { | ||
// from subscriber | ||
export const resend = async(params: ResendBroadcastParams) => { | ||
try { | ||
return await axios.post<ApiResult<undefined>>(`/mailingList/resend`, params); | ||
} | ||
catch(e: any) { | ||
return e.response.data as string; | ||
} | ||
} | ||
export const saveDraft = async(params: DraftParams) => { | ||
@@ -52,0 +64,0 @@ try { |
@@ -41,2 +41,3 @@ import { AuthCallParams } from "../../types"; | ||
username?: string; | ||
past_broadcasts: PastBroadcast[]; | ||
} | ||
@@ -59,2 +60,10 @@ | ||
export type PastBroadcast = { | ||
id: number; | ||
user_id: number; | ||
username: string; | ||
title: string; | ||
created_at: string; | ||
} | ||
export interface CreateMailingListParams extends AuthCallParams { | ||
@@ -74,2 +83,3 @@ tier_ids?: number[]; | ||
// by content creator | ||
export interface RetryBroadcastParams extends AuthCallParams { | ||
@@ -79,2 +89,8 @@ | ||
// by subscriber | ||
export interface ResendBroadcastParams extends AuthCallParams { | ||
broadcast_id: number; | ||
subscriber_id: number; | ||
} | ||
export interface DraftParams extends AuthCallParams { | ||
@@ -81,0 +97,0 @@ title: string; |
@@ -8,3 +8,3 @@ import { ReactNode } from "react"; | ||
import { MailTier, NewMailParams, OnMailPaymentParams } from "./src/Mail/types"; | ||
import { BroadcastParams, DraftParams, MailingList, MailingListBroadcast, UpdateMailingListPriceListParams } from "./src/MailingList/types"; | ||
import { BroadcastParams, DraftParams, MailingList, MailingListBroadcast, ResendBroadcastParams, UpdateMailingListPriceListParams } from "./src/MailingList/types"; | ||
import { Content, ContentCreateParams, ContentPayParams, ContentUpdateParams } from "./src/Content/types"; | ||
@@ -73,2 +73,3 @@ import { ContentCNFT, ContentPassCreateParams, ContentPassPayParams, ContentPassUpdateParams } from "./src/ContentPass/types"; | ||
retry: (id: number) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
resend: (params: Omit<ResendBroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
broadcast: (params: Omit<BroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<undefined>, any> | undefined>; | ||
@@ -75,0 +76,0 @@ saveDraft: (params: Omit<BroadcastParams, keyof AuthCallParams>) => Promise<string | AxiosResponse<ApiResult<number>, any> | undefined>; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153089
4035