Files
jiapu/utils/ApiClient.js
T
fizzleaf ce4f05b60f test(api): 更新API客户端契约测试以符合YAML规范
- 更新登录响应模拟数据以匹配真实的AppLoginVo结构
- 添加认证客户端租户和授权字段验证
- 增加操作码枚举验证测试用例
- 移除对旧token别名的兼容性测试
- 修复测试用例中的短信验证码长度一致性问题
- 更新区域接口路径为PC专用路径
- 调整分片上传接口参数以符合新契约定义

refactor(api): 重构API客户端实现以严格遵循YAML契约

- 添加认证操作码和短信操作码枚举验证
- 实现严格的token响应解析只接受access_token字段
- 使用pickDefined函数过滤请求体中未定义的字段
- 重构认证接口参数映射以符合契约定义
- 更新区域接口路径为PC专用路径/genealogy/pc/region/*
- 优化分片上传接口参数结构与契约保持一致
- 添加操作码枚举验证函数toRequiredOperationCode
- 实现请求体字段选择性提取功能

feat(auth): 优化认证页面的验证码处理流程

- 添加takeCaptchaToken函数用于一次性获取验证码票据
- 更新短信验证码长度验证从4-6位改为精确4位
- 在登录和密码重置流程中集成验证码票据处理
- 修复验证码发送后票据清理逻辑
- 更新HTML模板中的验证码输入字段属性

chore(config): 提取常量配置并扩展配置对象结构

- 将客户端ID、租户ID和令牌键提取为常量
- 扩展配置对象返回客户端配置信息
- 更新配置测试用例以验证新增配置项

docs(planning): 更新PC接口对接规划文档

- 更新契约源说明以反映YAML冻结契约
- 添加YAML与在线Apifox复核对比内容
- 更新阻断项状态表格
- 修订登录响应token字段处理规范
- 更新文件上传和行政区划接口规范说明

style(profile): 优化相册管理页面的文件上传交互

- 将封面和照片OSS ID输入改为隐藏字段
- 添加文件选择标签以改善用户体验
- 移除手动输入OSS ID的选项保持界面简洁
2026-07-28 15:06:34 +08:00

645 lines
25 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function (root, factory) {
if (typeof module === 'object' && module.exports) {
module.exports = factory(root);
return;
}
root.GenealogyApi = factory(root);
})(typeof globalThis !== 'undefined' ? globalThis : window, function (root) {
'use strict';
var DEFAULT_CLIENT_ID = 'ced7e5f0498645c6ec642dcf450b036f';
var DEFAULT_TENANT_ID = '000000';
var DEFAULT_TOKEN_KEY = 'genealogy_auth_token';
var VERIFICATION_OPERATION_CODES = [
'password-login',
'sms-login',
'register',
'forgot-password',
'phone-change',
'account-deactivate'
];
var SMS_OPERATION_CODES = [
'sms-login',
'register',
'forgot-password',
'phone-change',
'account-deactivate'
];
function loadNodeModule(path) {
if (typeof require !== 'function') return null;
try {
return require(path);
} catch (error) {
return null;
}
}
function getConfigApi() {
var configFactory;
if (root.GenealogyConfig) return root.GenealogyConfig;
configFactory = loadNodeModule('../config.js');
return configFactory ? configFactory(root) : null;
}
function getStorageUtil() {
return root.StorageUtil || loadNodeModule('./StorageUtil.js');
}
function getAxiosRequestUtil() {
return root.AxiosRequestUtil || loadNodeModule('./AxiosRequestUtil.js');
}
function getStorage(store) {
if (store) return store;
try {
return root.localStorage;
} catch (error) {
return null;
}
}
function getTokenFromResponse(data) {
return data && data.access_token || '';
}
function pickDefined(source, allowedFields) {
var input = source || {};
var result = {};
allowedFields.forEach(function (field) {
if (input[field] !== undefined) result[field] = input[field];
});
return result;
}
function createChunkFormData(bodyOrFormData) {
var FormDataCtor = root.FormData;
var source = bodyOrFormData || {};
var formData;
if (FormDataCtor && bodyOrFormData instanceof FormDataCtor) return bodyOrFormData;
if (!FormDataCtor) throw new Error('当前环境不支持文件上传');
formData = new FormDataCtor();
formData.append('uploadId', source.uploadId);
formData.append('chunkIndex', source.chunkIndex);
formData.append('chunkMd5', source.chunkMd5);
formData.append('file', source.file);
return formData;
}
function buildApiUrl(baseUrl, path, query) {
var url = String(baseUrl || '').replace(/\/+$/, '') + '/' + String(path || '').replace(/^\/+/, '');
var params = new URLSearchParams();
Object.keys(query || {}).forEach(function (key) {
var value = query[key];
if (value !== undefined && value !== null && value !== '') params.append(key, value);
});
return params.toString() ? url + '?' + params.toString() : url;
}
function createClient(options) {
var settings = options || {};
var configApi = getConfigApi();
var config = configApi && configApi.getConfig ? configApi.getConfig() : {};
var storageUtil = getStorageUtil();
var axiosRequestUtil = getAxiosRequestUtil();
var store = getStorage(settings.tokenStore || settings.storage);
var clientId = settings.clientId || config.clientId || DEFAULT_CLIENT_ID;
var tenantId = settings.tenantId || config.tenantId || DEFAULT_TENANT_ID;
var tokenKey = settings.tokenKey || config.tokenKey || DEFAULT_TOKEN_KEY;
var baseUrl = settings.baseUrl || config.apiBaseUrl;
var requester;
if (!axiosRequestUtil || !axiosRequestUtil.createRequester) throw new Error('缺少 AxiosRequestUtil.createRequester');
if (!baseUrl) throw new Error('缺少接口基础地址');
function getToken() {
return storageUtil && storageUtil.read ? storageUtil.read(store, tokenKey) || '' : '';
}
function setToken(token) {
if (token && storageUtil && storageUtil.write) storageUtil.write(store, tokenKey, token);
}
function clearToken() {
if (storageUtil && storageUtil.remove) storageUtil.remove(store, tokenKey);
}
requester = axiosRequestUtil.createRequester({
baseUrl: baseUrl,
clientId: clientId,
getToken: getToken,
onUnauthorized: clearToken,
axiosInstance: settings.axiosInstance || root.axios
});
function request(method, path, requestOptions) {
// 请求函数保持私有,页面只能调用下方已在接口文档中定义的业务方法。
return requester(method, path, requestOptions || {});
}
function withTenant(body) {
return Object.assign({}, body || {}, { tenantId: tenantId });
}
function buildVerificationPath(operationCode, suffix) {
return '/genealogy/pc/auth/verification/' +
toRequiredOperationCode(operationCode, 'PC 认证动作', VERIFICATION_OPERATION_CODES) +
(suffix || '');
}
function buildSmsCodePath(operationCode) {
return '/genealogy/pc/auth/sms/' +
toRequiredOperationCode(operationCode, 'PC 短信认证动作', SMS_OPERATION_CODES) +
'/code';
}
function toRequiredPathId(value, label) {
var text = String(value === undefined || value === null ? '' : value).trim();
if (!text) throw new Error('缺少' + label);
return encodeURIComponent(text);
}
function toRequiredOperationCode(value, label, allowedValues) {
var text = String(value === undefined || value === null ? '' : value).trim();
if (!text) throw new Error('缺少' + label);
if (allowedValues.indexOf(text) === -1) throw new Error('不支持的' + label + '' + text);
return encodeURIComponent(text);
}
function buildFeedPath(genealogyId, suffix) {
// 家族圈接口统一由家谱编号定位,避免页面拼接出未定义的请求路径。
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/feeds' + (suffix || '');
}
function buildFeedDetailPath(genealogyId, feedId, suffix) {
return buildFeedPath(genealogyId, '/' + toRequiredPathId(feedId, '动态编号') + (suffix || ''));
}
function buildFeedCommentPath(genealogyId, feedId, commentId) {
var path = buildFeedDetailPath(genealogyId, feedId, '/comments');
return commentId === undefined || commentId === null || commentId === ''
? path
: path + '/' + toRequiredPathId(commentId, '评论编号');
}
function buildFeedReplyPath(genealogyId, feedId, commentId, suffix) {
return buildFeedCommentPath(genealogyId, feedId, commentId) + '/replies' + (suffix || '');
}
function buildGenerationPoemPath(genealogyId, suffix) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/generation-poems' + (suffix || '');
}
function buildLineagePath(genealogyId, suffix) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/lineage' + (suffix || '');
}
function buildLineagePersonPath(genealogyId, personId, suffix) {
return buildLineagePath(
genealogyId,
'/persons/' + toRequiredPathId(personId, '人物编号') + (suffix || '')
);
}
function buildGrowthRecordPath(genealogyId, recordId) {
var path = '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/growth-records';
return recordId === undefined || recordId === null || recordId === ''
? path
: path + '/' + toRequiredPathId(recordId, '成长记录编号');
}
function buildRelativeRecordPath(genealogyId, relativeId) {
var path = '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/relative-records';
return relativeId === undefined || relativeId === null || relativeId === ''
? path
: path + '/' + toRequiredPathId(relativeId, '亲友记录编号');
}
function buildMemoPath(genealogyId, memoId) {
var path = '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') + '/memos';
return memoId === undefined || memoId === null || memoId === ''
? path
: path + '/' + toRequiredPathId(memoId, '备忘录编号');
}
function buildMeritRecordPath(genealogyId, meritId) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') +
'/merit-records/' + toRequiredPathId(meritId, '功德记录编号');
}
function buildArticlePath(genealogyId, articleId) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') +
'/articles/' + toRequiredPathId(articleId, '谱文编号');
}
function buildAlbumPath(genealogyId, albumId) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') +
'/albums/' + toRequiredPathId(albumId, '相册编号');
}
function buildAlbumPhotoPath(genealogyId, albumId, photoId) {
return buildAlbumPath(genealogyId, albumId) + '/photos/' + toRequiredPathId(photoId, '相册照片编号');
}
function buildVideoPath(genealogyId, videoId) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') +
'/videos/' + toRequiredPathId(videoId, '视频编号');
}
function buildCeremonyPath(genealogyId, ceremonyId) {
return '/genealogy/pc/genealogies/' + toRequiredPathId(genealogyId, '家谱编号') +
'/ceremonies/' + toRequiredPathId(ceremonyId, '祭祀活动编号');
}
function buildCeremonyGiftPath(genealogyId, ceremonyId, giftId) {
return buildCeremonyPath(genealogyId, ceremonyId) + '/gifts/' + toRequiredPathId(giftId, '祭品编号');
}
async function login(body) {
var data = await request('POST', '/genealogy/pc/auth/login', {
auth: false,
body: Object.assign(
pickDefined(body, ['phone', 'password', 'validToken']),
{ grantType: 'password', tenantId: tenantId }
)
});
var token = getTokenFromResponse(data);
if (!token) throw new Error('登录响应缺少 token');
setToken(token);
return data;
}
async function loginBySms(body) {
var data = await request('POST', '/genealogy/pc/auth/login/sms', {
auth: false,
body: Object.assign(
pickDefined(body, ['phone', 'smsCode']),
{ grantType: 'sms', tenantId: tenantId }
)
});
var token = getTokenFromResponse(data);
if (!token) throw new Error('登录响应缺少 token');
setToken(token);
return data;
}
async function deactivateAccount(body) {
var data = await request('POST', '/genealogy/pc/auth/account/deactivate', {
body: pickDefined(body, ['smsCode'])
});
clearToken();
return data;
}
async function logout() {
try {
return await request('DELETE', '/genealogy/pc/auth/logout');
} finally {
clearToken();
}
}
return {
clientId: clientId,
tenantId: tenantId,
tokenKey: tokenKey,
getToken: getToken,
setToken: setToken,
clearToken: clearToken,
buildApiUrl: function (path, query) {
return buildApiUrl(baseUrl, path, query);
},
register: function (body) {
return request('POST', '/genealogy/pc/auth/register', {
auth: false,
body: Object.assign(
pickDefined(body, ['phone', 'password', 'nickName', 'smsCode']),
{ grantType: 'password', tenantId: tenantId, registerSource: 'PC' }
)
});
},
login: login,
loginBySms: loginBySms,
sendSmsCode: function (operationCode, body) {
return request('POST', buildSmsCodePath(operationCode), {
auth: false,
// PC 认证目录以路径 operationCode 绑定动作;clientid 只由请求头提供。
body: Object.assign(
pickDefined(body, ['phone', 'validToken']),
{ grantType: 'sms', tenantId: tenantId }
)
});
},
currentProfile: function () {
return request('GET', '/genealogy/pc/auth/profile');
},
updateProfile: function (body) {
return request('PUT', '/genealogy/pc/auth/profile', {
body: pickDefined(body, ['nickName', 'realName', 'avatar', 'sex', 'birthday', 'email'])
});
},
changePassword: function (body) {
return request('PUT', '/genealogy/pc/auth/password', {
body: pickDefined(body, ['oldPassword', 'newPassword'])
});
},
resetPassword: function (body) {
return request('PUT', '/genealogy/pc/auth/password/reset', {
auth: false,
body: Object.assign(
pickDefined(body, ['phone', 'smsCode', 'newPassword']),
{ grantType: 'password', tenantId: tenantId }
)
});
},
changePhone: function (body) {
return request('PUT', '/genealogy/pc/auth/phone', {
body: pickDefined(body, ['phone', 'smsCode'])
});
},
deactivateAccount: deactivateAccount,
logout: logout,
initResumableUpload: function (body) {
return request('POST', '/genealogy/pc/files/resumable/init', { body: body });
},
uploadResumableChunk: function (bodyOrFormData) {
return request('POST', '/genealogy/pc/files/resumable/chunk', {
body: createChunkFormData(bodyOrFormData)
});
},
completeResumableUpload: function (body) {
return request('POST', '/genealogy/pc/files/resumable/complete', { body: body });
},
captchaRequirement: function (operationCode, query) {
var source = query || {};
return request('GET', buildVerificationPath(operationCode, '/require'), {
auth: false,
query: {
tenantId: source.tenantId || tenantId,
subject: source.subject
}
});
},
captchaChallenge: function (operationCode, body) {
return request('POST', buildVerificationPath(operationCode, '/challenge'), {
auth: false,
body: withTenant(pickDefined(body, ['subject']))
});
},
captchaVerify: function (operationCode, body) {
return request('POST', buildVerificationPath(operationCode, '/verify'), {
auth: false,
body: withTenant(pickDefined(body, [
'subject',
'challengeId',
'providerCode',
'captchaType',
'payload'
]))
});
},
captchaChallengeUrl: function (operationCode) {
return buildApiUrl(baseUrl, buildVerificationPath(operationCode, '/challenge'));
},
captchaVerifyUrl: function (operationCode) {
return buildApiUrl(baseUrl, buildVerificationPath(operationCode, '/verify'));
},
regionChildren: function (parentCode) {
return request('GET', '/genealogy/pc/region/children', { query: { parentCode: parentCode } });
},
regionPath: function (regionCode) {
return request('GET', '/genealogy/pc/region/path/' + encodeURIComponent(regionCode));
},
regionSearch: function (query) {
return request('GET', '/genealogy/pc/region/search', { query: query });
},
regionDetail: function (regionCode) {
return request('GET', '/genealogy/pc/region/' + encodeURIComponent(regionCode));
},
genealogyQuota: function () {
return request('GET', '/genealogy/pc/genealogies/quota');
},
notifications: function (query) {
return request('GET', '/genealogy/pc/notifications', { query: query });
},
unreadNotificationCount: function () {
return request('GET', '/genealogy/pc/notifications/unread-count');
},
markNotificationRead: function (notificationId) {
return request('POST', '/genealogy/pc/notifications/' + toRequiredPathId(notificationId, '通知编号') + '/read');
},
markAllNotificationsRead: function () {
return request('POST', '/genealogy/pc/notifications/read-all');
},
feeds: function (genealogyId) {
return request('GET', buildFeedPath(genealogyId));
},
feedsPage: function (genealogyId, query) {
return request('GET', buildFeedPath(genealogyId, '/page'), { query: query });
},
feedDetail: function (genealogyId, feedId) {
return request('GET', buildFeedDetailPath(genealogyId, feedId));
},
createFeed: function (genealogyId, body) {
return request('POST', buildFeedPath(genealogyId), { body: body });
},
updateFeed: function (genealogyId, feedId, body) {
return request('PUT', buildFeedDetailPath(genealogyId, feedId), { body: body });
},
deleteFeed: function (genealogyId, feedId) {
return request('DELETE', buildFeedDetailPath(genealogyId, feedId));
},
likeFeed: function (genealogyId, feedId) {
return request('POST', buildFeedDetailPath(genealogyId, feedId, '/likes'));
},
unlikeFeed: function (genealogyId, feedId) {
return request('DELETE', buildFeedDetailPath(genealogyId, feedId, '/likes'));
},
feedComments: function (genealogyId, feedId) {
return request('GET', buildFeedCommentPath(genealogyId, feedId));
},
feedCommentsPage: function (genealogyId, feedId, query) {
return request('GET', buildFeedCommentPath(genealogyId, feedId) + '/page', { query: query });
},
feedCommentReplies: function (genealogyId, feedId, commentId) {
return request('GET', buildFeedReplyPath(genealogyId, feedId, commentId));
},
feedCommentRepliesPage: function (genealogyId, feedId, commentId, query) {
return request('GET', buildFeedReplyPath(genealogyId, feedId, commentId, '/page'), { query: query });
},
createFeedComment: function (genealogyId, feedId, body) {
return request('POST', buildFeedCommentPath(genealogyId, feedId), { body: body });
},
deleteFeedComment: function (genealogyId, feedId, commentId) {
return request('DELETE', buildFeedCommentPath(genealogyId, feedId, commentId));
},
generationPoems: function (genealogyId) {
return request('GET', buildGenerationPoemPath(genealogyId));
},
generationPoemsManagement: function (genealogyId) {
return request('GET', buildGenerationPoemPath(genealogyId, '/management'));
},
createGenerationPoem: function (genealogyId, body) {
return request('POST', buildGenerationPoemPath(genealogyId), { body: body });
},
updateGenerationPoem: function (genealogyId, poemId, body) {
return request('PUT', buildGenerationPoemPath(genealogyId, '/' + toRequiredPathId(poemId, '字辈编号')), { body: body });
},
previewGenerationPoems: function (genealogyId, body) {
return request('POST', buildGenerationPoemPath(genealogyId, '/batch/preview'), { body: body });
},
saveGenerationPoems: function (genealogyId, body) {
return request('POST', buildGenerationPoemPath(genealogyId, '/batch/save'), { body: body });
},
lineagePersons: function (genealogyId) {
return request('GET', buildLineagePath(genealogyId, '/persons'));
},
lineagePersonsPage: function (genealogyId, query) {
return request('GET', buildLineagePath(genealogyId, '/persons/page'), { query: query });
},
lineagePersonOptions: function (genealogyId) {
return request('GET', buildLineagePath(genealogyId, '/persons/options'));
},
lineageTree: function (genealogyId) {
return request('GET', buildLineagePath(genealogyId, '/tree'));
},
createLineagePerson: function (genealogyId, body) {
return request('POST', buildLineagePath(genealogyId, '/persons'), { body: body });
},
lineagePersonDetail: function (genealogyId, personId) {
return request('GET', buildLineagePersonPath(genealogyId, personId));
},
updateLineagePerson: function (genealogyId, personId, body) {
return request('PUT', buildLineagePersonPath(genealogyId, personId), { body: body });
},
disableLineagePerson: function (genealogyId, personId) {
return request('DELETE', buildLineagePersonPath(genealogyId, personId));
},
createLineageChild: function (genealogyId, personId, body) {
return request('POST', buildLineagePersonPath(genealogyId, personId, '/children'), { body: body });
},
createLineageParent: function (genealogyId, personId, body) {
return request('POST', buildLineagePersonPath(genealogyId, personId, '/parents'), { body: body });
},
createLineageSibling: function (genealogyId, personId, body) {
return request('POST', buildLineagePersonPath(genealogyId, personId, '/siblings'), { body: body });
},
createLineageSpouse: function (genealogyId, personId, body) {
return request('POST', buildLineagePersonPath(genealogyId, personId, '/spouses'), { body: body });
},
growthRecords: function (genealogyId) {
return request('GET', buildGrowthRecordPath(genealogyId));
},
createGrowthRecord: function (genealogyId, body) {
return request('POST', buildGrowthRecordPath(genealogyId), { body: body });
},
growthRecordDetail: function (genealogyId, recordId) {
return request('GET', buildGrowthRecordPath(genealogyId, recordId));
},
updateGrowthRecord: function (genealogyId, recordId, body) {
return request('PUT', buildGrowthRecordPath(genealogyId, recordId), { body: body });
},
deleteGrowthRecord: function (genealogyId, recordId) {
return request('DELETE', buildGrowthRecordPath(genealogyId, recordId));
},
relativeRecords: function (genealogyId) {
return request('GET', buildRelativeRecordPath(genealogyId));
},
createRelativeRecord: function (genealogyId, body) {
return request('POST', buildRelativeRecordPath(genealogyId), { body: body });
},
relativeRecordDetail: function (genealogyId, relativeId) {
return request('GET', buildRelativeRecordPath(genealogyId, relativeId));
},
updateRelativeRecord: function (genealogyId, relativeId, body) {
return request('PUT', buildRelativeRecordPath(genealogyId, relativeId), { body: body });
},
deleteRelativeRecord: function (genealogyId, relativeId) {
return request('DELETE', buildRelativeRecordPath(genealogyId, relativeId));
},
memos: function (genealogyId) {
return request('GET', buildMemoPath(genealogyId));
},
createMemo: function (genealogyId, body) {
return request('POST', buildMemoPath(genealogyId), { body: body });
},
memoDetail: function (genealogyId, memoId) {
return request('GET', buildMemoPath(genealogyId, memoId));
},
updateMemo: function (genealogyId, memoId, body) {
return request('PUT', buildMemoPath(genealogyId, memoId), { body: body });
},
deleteMemo: function (genealogyId, memoId) {
return request('DELETE', buildMemoPath(genealogyId, memoId));
},
deleteMeritRecord: function (genealogyId, meritId) {
return request('DELETE', buildMeritRecordPath(genealogyId, meritId));
},
deleteArticle: function (genealogyId, articleId) {
return request('DELETE', buildArticlePath(genealogyId, articleId));
},
deleteAlbum: function (genealogyId, albumId) {
return request('DELETE', buildAlbumPath(genealogyId, albumId));
},
deleteAlbumPhoto: function (genealogyId, albumId, photoId) {
return request('DELETE', buildAlbumPhotoPath(genealogyId, albumId, photoId));
},
deleteVideo: function (genealogyId, videoId) {
return request('DELETE', buildVideoPath(genealogyId, videoId));
},
replaceCeremonyInvitees: function (genealogyId, ceremonyId, body) {
return request('PUT', buildCeremonyPath(genealogyId, ceremonyId) + '/invitees', { body: body });
},
ceremonyInvitations: function (genealogyId, ceremonyId) {
return request('GET', buildCeremonyPath(genealogyId, ceremonyId) + '/invitations');
},
respondCeremonyInvitation: function (genealogyId, ceremonyId, body) {
return request('PUT', buildCeremonyPath(genealogyId, ceremonyId) + '/invitations/me', { body: body });
},
myCeremonyInvitations: function () {
return request('GET', '/genealogy/pc/genealogies/ceremony-invitations/mine');
},
deleteCeremony: function (genealogyId, ceremonyId) {
return request('DELETE', buildCeremonyPath(genealogyId, ceremonyId));
},
deleteCeremonyGift: function (genealogyId, ceremonyId, giftId) {
return request('DELETE', buildCeremonyGiftPath(genealogyId, ceremonyId, giftId));
}
};
}
function createDefaultClient() {
try {
return createClient();
} catch (error) {
return null;
}
}
return {
DEFAULT_CLIENT_ID: DEFAULT_CLIENT_ID,
DEFAULT_TENANT_ID: DEFAULT_TENANT_ID,
TOKEN_KEY: DEFAULT_TOKEN_KEY,
createClient: createClient,
defaultClient: createDefaultClient()
};
});