@salefony/api-sdk 1.0.5 → 1.0.7
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 +33 -0
- package/dist/index.d.mts +97 -7
- package/dist/index.d.ts +97 -7
- package/dist/index.js +70 -0
- package/dist/index.mjs +70 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ Salefony API SDK - Official SDK for Salefony Backend API. Full TypeScript suppor
|
|
|
20
20
|
- [LINQ-style Fluent API](#-linq-style-fluent-api)
|
|
21
21
|
- [Response Helpers](#-response-helpers)
|
|
22
22
|
- [Admin vs Frontstore](#-admin-vs-frontstore)
|
|
23
|
+
- [Integrations (3rd Party OAuth)](#-integrations-3rd-party-oauth)
|
|
23
24
|
- [SSR Usage](#-ssr-usage)
|
|
24
25
|
- [Error Handling](#-error-handling)
|
|
25
26
|
- [API Reference](#-api-reference)
|
|
@@ -481,6 +482,7 @@ const { total, page, limit, totalPages, hasNextPage } = meta ?? {};
|
|
|
481
482
|
### Admin resources
|
|
482
483
|
|
|
483
484
|
- `collections`, `contents`, `layouts`, `navigations`
|
|
485
|
+
- `integrations` – 3rd party OAuth (Google Analytics, Facebook, TikTok, etc.)
|
|
484
486
|
- `languages`, `datasource`, `metadata`
|
|
485
487
|
- `vendors`, `stores`, `apiKeys`
|
|
486
488
|
- `settings`, `seo`, `media`
|
|
@@ -499,6 +501,37 @@ const { total, page, limit, totalPages, hasNextPage } = meta ?? {};
|
|
|
499
501
|
|
|
500
502
|
---
|
|
501
503
|
|
|
504
|
+
## 🔗 Integrations (3rd Party OAuth)
|
|
505
|
+
|
|
506
|
+
Connect Google Analytics, Facebook Business, TikTok Pixel, etc. OAuth flow runs on the backend.
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
// Start OAuth – redirect user
|
|
510
|
+
const url = sdk.admin.integrations.getAuthorizeUrl(
|
|
511
|
+
'google-analytics',
|
|
512
|
+
'https://app.example.com/admin/analytics'
|
|
513
|
+
);
|
|
514
|
+
window.location.href = url; // React/Next.js
|
|
515
|
+
|
|
516
|
+
// Check connection status
|
|
517
|
+
const { data } = await sdk.admin.integrations.getStatus('google-analytics');
|
|
518
|
+
|
|
519
|
+
// Disconnect
|
|
520
|
+
await sdk.admin.integrations.disconnect('google-analytics');
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
**Platform usage:**
|
|
524
|
+
|
|
525
|
+
| Platform | Flow |
|
|
526
|
+
|--------------------|--------------------------------------------------------------|
|
|
527
|
+
| React / Next.js | `window.location.href = getAuthorizeUrl(...)` |
|
|
528
|
+
| Expo / React Native| `Linking.openURL(url)` or WebView with `redirect_uri`: `myapp://` |
|
|
529
|
+
| Node.js | Return URL or `res.redirect(url)` |
|
|
530
|
+
|
|
531
|
+
Full guide: [Integrations Documentation](./docs/INTEGRATIONS.md)
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
502
535
|
## 🛠️ SSR Usage
|
|
503
536
|
|
|
504
537
|
### Next.js Server Component
|
package/dist/index.d.mts
CHANGED
|
@@ -427,11 +427,15 @@ interface CollectionUpdateInput {
|
|
|
427
427
|
*/
|
|
428
428
|
interface User extends BaseModel {
|
|
429
429
|
name?: string;
|
|
430
|
+
firstName?: string;
|
|
431
|
+
lastName?: string;
|
|
430
432
|
email: string;
|
|
431
433
|
emailVerified?: boolean;
|
|
432
434
|
image?: string;
|
|
433
435
|
phone?: string;
|
|
434
436
|
role?: string;
|
|
437
|
+
storeId?: string;
|
|
438
|
+
storeName?: string;
|
|
435
439
|
emailNotifications?: boolean;
|
|
436
440
|
smsNotifications?: boolean;
|
|
437
441
|
newsletter?: boolean;
|
|
@@ -1127,11 +1131,11 @@ interface SessionResponse {
|
|
|
1127
1131
|
id: string;
|
|
1128
1132
|
userId: string;
|
|
1129
1133
|
expiresAt: Date;
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1134
|
+
ipAddress?: string | null;
|
|
1135
|
+
userAgent?: string | null;
|
|
1136
|
+
token?: string;
|
|
1137
|
+
createdAt?: Date;
|
|
1138
|
+
updatedAt?: Date;
|
|
1135
1139
|
};
|
|
1136
1140
|
user: User;
|
|
1137
1141
|
}
|
|
@@ -1143,6 +1147,28 @@ interface TokenValidateResponse {
|
|
|
1143
1147
|
storeId: string;
|
|
1144
1148
|
sessionId: string;
|
|
1145
1149
|
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Google OAuth ile giriş için gerekli veriler
|
|
1152
|
+
*/
|
|
1153
|
+
interface GoogleOAuthInput {
|
|
1154
|
+
googleId: string;
|
|
1155
|
+
email: string;
|
|
1156
|
+
name: string;
|
|
1157
|
+
image?: string | null;
|
|
1158
|
+
accessToken: string;
|
|
1159
|
+
refreshToken?: string;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Google OAuth yanıtı (backend /api/auth/oauth/google)
|
|
1163
|
+
*/
|
|
1164
|
+
interface GoogleOAuthResponse {
|
|
1165
|
+
success: boolean;
|
|
1166
|
+
user: User & {
|
|
1167
|
+
storeId?: string;
|
|
1168
|
+
storeName?: string;
|
|
1169
|
+
};
|
|
1170
|
+
accessToken: string;
|
|
1171
|
+
}
|
|
1146
1172
|
|
|
1147
1173
|
/**
|
|
1148
1174
|
* Better Auth - Kimlik Doğrulama Kaynağı
|
|
@@ -1159,6 +1185,11 @@ declare class AuthResource extends BaseResource {
|
|
|
1159
1185
|
* Email/Password ile kayıt (Web - Cookie based)
|
|
1160
1186
|
*/
|
|
1161
1187
|
signUpEmail(input: RegisterInput): Promise<ApiResponse<any>>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Google OAuth ile giriş ( mobil uygulama )
|
|
1190
|
+
* Backend: POST /api/auth/oauth/google
|
|
1191
|
+
*/
|
|
1192
|
+
signInWithGoogle(input: GoogleOAuthInput): Promise<ApiResponse<GoogleOAuthResponse>>;
|
|
1162
1193
|
/**
|
|
1163
1194
|
* Mobil Uygulama Login (Token based)
|
|
1164
1195
|
* Bu metod, SDK kullanımı için en uygun olanıdır.
|
|
@@ -1206,6 +1237,58 @@ declare class GoogleResource extends BaseResource {
|
|
|
1206
1237
|
getDetailedAnalytics(acc: string, propertyId: string, reportType: string): Promise<ApiResponse<any>>;
|
|
1207
1238
|
}
|
|
1208
1239
|
|
|
1240
|
+
/**
|
|
1241
|
+
* Desteklenen integration provider ID'leri
|
|
1242
|
+
*/
|
|
1243
|
+
type IntegrationProviderId = 'google-analytics' | 'facebook-business' | 'tiktok-pixel' | 'snapchat';
|
|
1244
|
+
interface IntegrationConnectionStatus {
|
|
1245
|
+
connected: boolean;
|
|
1246
|
+
provider: IntegrationProviderId | string;
|
|
1247
|
+
storeId: string;
|
|
1248
|
+
expiresAt?: number | null;
|
|
1249
|
+
createdAt?: string;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 3. parti hesap bağlama API'si.
|
|
1253
|
+
* Tüm OAuth akışları backend üzerinden yönetilir - proxy yok.
|
|
1254
|
+
*
|
|
1255
|
+
* Kullanım:
|
|
1256
|
+
* - Bağlantı başlat: window.location.href = sdk.admin.integrations.getAuthorizeUrl('google-analytics', redirectUri)
|
|
1257
|
+
* - Durum: sdk.admin.integrations.getStatus('google-analytics')
|
|
1258
|
+
* - Bağlantı kes: sdk.admin.integrations.disconnect('google-analytics')
|
|
1259
|
+
*/
|
|
1260
|
+
declare class IntegrationsResource extends BaseResource {
|
|
1261
|
+
constructor(httpClient: AxiosInstance);
|
|
1262
|
+
/**
|
|
1263
|
+
* OAuth başlatma URL'ini döner.
|
|
1264
|
+
* Frontend bu URL'e yönlendirir (window.location.href = url).
|
|
1265
|
+
* Cookie/Authorization ile backend'e gidilir, backend Google'a redirect eder.
|
|
1266
|
+
*
|
|
1267
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1268
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1269
|
+
*/
|
|
1270
|
+
getAuthorizeUrl(provider: IntegrationProviderId | string, redirectUri?: string): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Bağlantı durumunu sorgular
|
|
1273
|
+
*/
|
|
1274
|
+
getStatus(provider: IntegrationProviderId | string): Promise<ApiResponse<IntegrationConnectionStatus>>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Bağlantıyı keser (token siler)
|
|
1277
|
+
*/
|
|
1278
|
+
disconnect(provider: IntegrationProviderId | string): Promise<ApiResponse<{
|
|
1279
|
+
success: boolean;
|
|
1280
|
+
provider: string;
|
|
1281
|
+
}>>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Desteklenen provider listesini döner
|
|
1284
|
+
*/
|
|
1285
|
+
listProviders(): Promise<ApiResponse<{
|
|
1286
|
+
providers: IntegrationProviderId[];
|
|
1287
|
+
}>>;
|
|
1288
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1289
|
+
private getBaseUrl;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1209
1292
|
declare class CloudflareResource extends BaseResource {
|
|
1210
1293
|
constructor(httpClient: AxiosInstance);
|
|
1211
1294
|
getAccounts(): Promise<ApiResponse<any>>;
|
|
@@ -1298,6 +1381,10 @@ type index$5_DatasourceResource = DatasourceResource;
|
|
|
1298
1381
|
declare const index$5_DatasourceResource: typeof DatasourceResource;
|
|
1299
1382
|
type index$5_GoogleResource = GoogleResource;
|
|
1300
1383
|
declare const index$5_GoogleResource: typeof GoogleResource;
|
|
1384
|
+
type index$5_IntegrationConnectionStatus = IntegrationConnectionStatus;
|
|
1385
|
+
type index$5_IntegrationProviderId = IntegrationProviderId;
|
|
1386
|
+
type index$5_IntegrationsResource = IntegrationsResource;
|
|
1387
|
+
declare const index$5_IntegrationsResource: typeof IntegrationsResource;
|
|
1301
1388
|
type index$5_LayoutResource = LayoutResource;
|
|
1302
1389
|
declare const index$5_LayoutResource: typeof LayoutResource;
|
|
1303
1390
|
type index$5_MetadataResource = MetadataResource;
|
|
@@ -1335,7 +1422,7 @@ declare const index$5_sectorColumns: typeof sectorColumns;
|
|
|
1335
1422
|
declare const index$5_storeColumns: typeof storeColumns;
|
|
1336
1423
|
declare const index$5_vendorColumns: typeof vendorColumns;
|
|
1337
1424
|
declare namespace index$5 {
|
|
1338
|
-
export { type index$5_AdminMediaCreateInput as AdminMediaCreateInput, index$5_ApiKeyResource as ApiKeyResource, index$5_AuthResource as AuthResource, index$5_CloudflareResource as CloudflareResource, CollectionResource$1 as CollectionResource, ContentResource$1 as ContentResource, type index$5_CreateDatasourceInput as CreateDatasourceInput, index$5_CustomDataResource as CustomDataResource, index$5_DatasourceResource as DatasourceResource, index$5_GoogleResource as GoogleResource, LanguageResource$1 as LanguageResource, index$5_LayoutResource as LayoutResource, MediaResource$1 as MediaResource, index$5_MetadataResource as MetadataResource, NavigationResource$1 as NavigationResource, index$5_ProjectResource as ProjectResource, index$5_PurchaseResource as PurchaseResource, ReviewResource$1 as ReviewResource, index$5_SEOResource as SEOResource, index$5_SectionResource as SectionResource, index$5_SectorResource as SectorResource, index$5_SettingsResource as SettingsResource, StoreResource$1 as StoreResource, index$5_SubscriptionResource as SubscriptionResource, index$5_ThemeResource as ThemeResource, type index$5_UpdateDatasourceInput as UpdateDatasourceInput, index$5_VendorResource as VendorResource, index$5_WebmailResource as WebmailResource, index$5_apiKeyColumns as apiKeyColumns, collectionColumns$1 as collectionColumns, contentColumns$1 as contentColumns, index$5_datasourceColumns as datasourceColumns, index$5_languageColumns as languageColumns, index$5_layoutColumns as layoutColumns, index$5_metadataColumns as metadataColumns, index$5_navigationColumns as navigationColumns, index$5_projectColumns as projectColumns, index$5_sectionColumns as sectionColumns, index$5_sectorColumns as sectorColumns, index$5_storeColumns as storeColumns, index$5_vendorColumns as vendorColumns };
|
|
1425
|
+
export { type index$5_AdminMediaCreateInput as AdminMediaCreateInput, index$5_ApiKeyResource as ApiKeyResource, index$5_AuthResource as AuthResource, index$5_CloudflareResource as CloudflareResource, CollectionResource$1 as CollectionResource, ContentResource$1 as ContentResource, type index$5_CreateDatasourceInput as CreateDatasourceInput, index$5_CustomDataResource as CustomDataResource, index$5_DatasourceResource as DatasourceResource, index$5_GoogleResource as GoogleResource, type index$5_IntegrationConnectionStatus as IntegrationConnectionStatus, type index$5_IntegrationProviderId as IntegrationProviderId, index$5_IntegrationsResource as IntegrationsResource, LanguageResource$1 as LanguageResource, index$5_LayoutResource as LayoutResource, MediaResource$1 as MediaResource, index$5_MetadataResource as MetadataResource, NavigationResource$1 as NavigationResource, index$5_ProjectResource as ProjectResource, index$5_PurchaseResource as PurchaseResource, ReviewResource$1 as ReviewResource, index$5_SEOResource as SEOResource, index$5_SectionResource as SectionResource, index$5_SectorResource as SectorResource, index$5_SettingsResource as SettingsResource, StoreResource$1 as StoreResource, index$5_SubscriptionResource as SubscriptionResource, index$5_ThemeResource as ThemeResource, type index$5_UpdateDatasourceInput as UpdateDatasourceInput, index$5_VendorResource as VendorResource, index$5_WebmailResource as WebmailResource, index$5_apiKeyColumns as apiKeyColumns, collectionColumns$1 as collectionColumns, contentColumns$1 as contentColumns, index$5_datasourceColumns as datasourceColumns, index$5_languageColumns as languageColumns, index$5_layoutColumns as layoutColumns, index$5_metadataColumns as metadataColumns, index$5_navigationColumns as navigationColumns, index$5_projectColumns as projectColumns, index$5_sectionColumns as sectionColumns, index$5_sectorColumns as sectorColumns, index$5_storeColumns as storeColumns, index$5_vendorColumns as vendorColumns };
|
|
1339
1426
|
}
|
|
1340
1427
|
|
|
1341
1428
|
declare class StoreResource extends CrudResource<Store, StoreWhereInput, StoreOrderByInput, StoreCreateInput, StoreUpdateInput> {
|
|
@@ -1613,6 +1700,8 @@ type index$3_DatasourceWhereInput = DatasourceWhereInput;
|
|
|
1613
1700
|
type index$3_DateFilter = DateFilter;
|
|
1614
1701
|
type index$3_FindManyArgs<WhereInput = any, OrderByInput = any, IncludeInput = any, SelectInput = any> = FindManyArgs<WhereInput, OrderByInput, IncludeInput, SelectInput>;
|
|
1615
1702
|
type index$3_FindUniqueArgs<WhereInput = any, IncludeInput = any, SelectInput = any> = FindUniqueArgs<WhereInput, IncludeInput, SelectInput>;
|
|
1703
|
+
type index$3_GoogleOAuthInput = GoogleOAuthInput;
|
|
1704
|
+
type index$3_GoogleOAuthResponse = GoogleOAuthResponse;
|
|
1616
1705
|
type index$3_LanguageCreateInput = LanguageCreateInput;
|
|
1617
1706
|
type index$3_LanguageUpdateInput = LanguageUpdateInput;
|
|
1618
1707
|
type index$3_LanguageWhereInput = LanguageWhereInput;
|
|
@@ -1657,7 +1746,7 @@ type index$3_VendorOrderByInput = VendorOrderByInput;
|
|
|
1657
1746
|
type index$3_VendorUpdateInput = VendorUpdateInput;
|
|
1658
1747
|
type index$3_VendorWhereInput = VendorWhereInput;
|
|
1659
1748
|
declare namespace index$3 {
|
|
1660
|
-
export type { index$3_ApiKey as ApiKey, index$3_ApiKeyCreateInput as ApiKeyCreateInput, index$3_ApiKeyUpdateInput as ApiKeyUpdateInput, index$3_ApiKeyWhereInput as ApiKeyWhereInput, index$3_AuthResponse as AuthResponse, index$3_BooleanFilter as BooleanFilter, index$3_Collection as Collection, index$3_CollectionCreateInput as CollectionCreateInput, index$3_CollectionUpdateInput as CollectionUpdateInput, index$3_CollectionWhereInput as CollectionWhereInput, index$3_Content as Content, index$3_ContentCreateInput as ContentCreateInput, index$3_ContentUpdateInput as ContentUpdateInput, index$3_ContentWhereInput as ContentWhereInput, index$3_Datasource as Datasource, index$3_DatasourceCreateInput as DatasourceCreateInput, index$3_DatasourceUpdateInput as DatasourceUpdateInput, index$3_DatasourceWhereInput as DatasourceWhereInput, index$3_DateFilter as DateFilter, index$3_FindManyArgs as FindManyArgs, index$3_FindUniqueArgs as FindUniqueArgs, Language$1 as Language, index$3_LanguageCreateInput as LanguageCreateInput, index$3_LanguageUpdateInput as LanguageUpdateInput, index$3_LanguageWhereInput as LanguageWhereInput, index$3_Layout as Layout, index$3_LayoutCreateInput as LayoutCreateInput, index$3_LayoutOrderByInput as LayoutOrderByInput, index$3_LayoutUpdateInput as LayoutUpdateInput, index$3_LayoutWhereInput as LayoutWhereInput, index$3_LoginInput as LoginInput, index$3_Media as Media, index$3_MediaCreateInput as MediaCreateInput, index$3_MediaOrderByInput as MediaOrderByInput, index$3_MediaUpdateInput as MediaUpdateInput, index$3_MediaWhereInput as MediaWhereInput, index$3_Metadata as Metadata, index$3_MetadataCreateInput as MetadataCreateInput, index$3_MetadataUpdateInput as MetadataUpdateInput, index$3_MetadataWhereInput as MetadataWhereInput, index$3_Navigation as Navigation, index$3_NavigationCreateInput as NavigationCreateInput, index$3_NavigationOrderByInput as NavigationOrderByInput, index$3_NavigationUpdateInput as NavigationUpdateInput, index$3_NavigationWhereInput as NavigationWhereInput, index$3_NumberFilter as NumberFilter, index$3_Pagination as Pagination, index$3_QueryParams as QueryParams, index$3_RegisterInput as RegisterInput, index$3_SeoSettings as SeoSettings, index$3_SessionResponse as SessionResponse, index$3_Settings as Settings, index$3_SortOrder as SortOrder, index$3_Store as Store, index$3_StoreCreateInput as StoreCreateInput, index$3_StoreOrderByInput as StoreOrderByInput, index$3_StoreUpdateInput as StoreUpdateInput, index$3_StoreWhereInput as StoreWhereInput, index$3_StringFilter as StringFilter, index$3_TokenValidateResponse as TokenValidateResponse, index$3_Vendor as Vendor, index$3_VendorCreateInput as VendorCreateInput, index$3_VendorOrderByInput as VendorOrderByInput, index$3_VendorUpdateInput as VendorUpdateInput, index$3_VendorWhereInput as VendorWhereInput };
|
|
1749
|
+
export type { index$3_ApiKey as ApiKey, index$3_ApiKeyCreateInput as ApiKeyCreateInput, index$3_ApiKeyUpdateInput as ApiKeyUpdateInput, index$3_ApiKeyWhereInput as ApiKeyWhereInput, index$3_AuthResponse as AuthResponse, index$3_BooleanFilter as BooleanFilter, index$3_Collection as Collection, index$3_CollectionCreateInput as CollectionCreateInput, index$3_CollectionUpdateInput as CollectionUpdateInput, index$3_CollectionWhereInput as CollectionWhereInput, index$3_Content as Content, index$3_ContentCreateInput as ContentCreateInput, index$3_ContentUpdateInput as ContentUpdateInput, index$3_ContentWhereInput as ContentWhereInput, index$3_Datasource as Datasource, index$3_DatasourceCreateInput as DatasourceCreateInput, index$3_DatasourceUpdateInput as DatasourceUpdateInput, index$3_DatasourceWhereInput as DatasourceWhereInput, index$3_DateFilter as DateFilter, index$3_FindManyArgs as FindManyArgs, index$3_FindUniqueArgs as FindUniqueArgs, index$3_GoogleOAuthInput as GoogleOAuthInput, index$3_GoogleOAuthResponse as GoogleOAuthResponse, Language$1 as Language, index$3_LanguageCreateInput as LanguageCreateInput, index$3_LanguageUpdateInput as LanguageUpdateInput, index$3_LanguageWhereInput as LanguageWhereInput, index$3_Layout as Layout, index$3_LayoutCreateInput as LayoutCreateInput, index$3_LayoutOrderByInput as LayoutOrderByInput, index$3_LayoutUpdateInput as LayoutUpdateInput, index$3_LayoutWhereInput as LayoutWhereInput, index$3_LoginInput as LoginInput, index$3_Media as Media, index$3_MediaCreateInput as MediaCreateInput, index$3_MediaOrderByInput as MediaOrderByInput, index$3_MediaUpdateInput as MediaUpdateInput, index$3_MediaWhereInput as MediaWhereInput, index$3_Metadata as Metadata, index$3_MetadataCreateInput as MetadataCreateInput, index$3_MetadataUpdateInput as MetadataUpdateInput, index$3_MetadataWhereInput as MetadataWhereInput, index$3_Navigation as Navigation, index$3_NavigationCreateInput as NavigationCreateInput, index$3_NavigationOrderByInput as NavigationOrderByInput, index$3_NavigationUpdateInput as NavigationUpdateInput, index$3_NavigationWhereInput as NavigationWhereInput, index$3_NumberFilter as NumberFilter, index$3_Pagination as Pagination, index$3_QueryParams as QueryParams, index$3_RegisterInput as RegisterInput, index$3_SeoSettings as SeoSettings, index$3_SessionResponse as SessionResponse, index$3_Settings as Settings, index$3_SortOrder as SortOrder, index$3_Store as Store, index$3_StoreCreateInput as StoreCreateInput, index$3_StoreOrderByInput as StoreOrderByInput, index$3_StoreUpdateInput as StoreUpdateInput, index$3_StoreWhereInput as StoreWhereInput, index$3_StringFilter as StringFilter, index$3_TokenValidateResponse as TokenValidateResponse, index$3_Vendor as Vendor, index$3_VendorCreateInput as VendorCreateInput, index$3_VendorOrderByInput as VendorOrderByInput, index$3_VendorUpdateInput as VendorUpdateInput, index$3_VendorWhereInput as VendorWhereInput };
|
|
1661
1750
|
}
|
|
1662
1751
|
|
|
1663
1752
|
type index$2_BooleanFilter = BooleanFilter;
|
|
@@ -1767,6 +1856,7 @@ declare class AdminNamespace {
|
|
|
1767
1856
|
readonly sections: SectionResource;
|
|
1768
1857
|
readonly themes: ThemeResource;
|
|
1769
1858
|
readonly google: GoogleResource;
|
|
1859
|
+
readonly integrations: IntegrationsResource;
|
|
1770
1860
|
readonly cloudflare: CloudflareResource;
|
|
1771
1861
|
readonly reviews: ReviewResource$1;
|
|
1772
1862
|
readonly customData: CustomDataResource;
|
package/dist/index.d.ts
CHANGED
|
@@ -427,11 +427,15 @@ interface CollectionUpdateInput {
|
|
|
427
427
|
*/
|
|
428
428
|
interface User extends BaseModel {
|
|
429
429
|
name?: string;
|
|
430
|
+
firstName?: string;
|
|
431
|
+
lastName?: string;
|
|
430
432
|
email: string;
|
|
431
433
|
emailVerified?: boolean;
|
|
432
434
|
image?: string;
|
|
433
435
|
phone?: string;
|
|
434
436
|
role?: string;
|
|
437
|
+
storeId?: string;
|
|
438
|
+
storeName?: string;
|
|
435
439
|
emailNotifications?: boolean;
|
|
436
440
|
smsNotifications?: boolean;
|
|
437
441
|
newsletter?: boolean;
|
|
@@ -1127,11 +1131,11 @@ interface SessionResponse {
|
|
|
1127
1131
|
id: string;
|
|
1128
1132
|
userId: string;
|
|
1129
1133
|
expiresAt: Date;
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1134
|
+
ipAddress?: string | null;
|
|
1135
|
+
userAgent?: string | null;
|
|
1136
|
+
token?: string;
|
|
1137
|
+
createdAt?: Date;
|
|
1138
|
+
updatedAt?: Date;
|
|
1135
1139
|
};
|
|
1136
1140
|
user: User;
|
|
1137
1141
|
}
|
|
@@ -1143,6 +1147,28 @@ interface TokenValidateResponse {
|
|
|
1143
1147
|
storeId: string;
|
|
1144
1148
|
sessionId: string;
|
|
1145
1149
|
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Google OAuth ile giriş için gerekli veriler
|
|
1152
|
+
*/
|
|
1153
|
+
interface GoogleOAuthInput {
|
|
1154
|
+
googleId: string;
|
|
1155
|
+
email: string;
|
|
1156
|
+
name: string;
|
|
1157
|
+
image?: string | null;
|
|
1158
|
+
accessToken: string;
|
|
1159
|
+
refreshToken?: string;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Google OAuth yanıtı (backend /api/auth/oauth/google)
|
|
1163
|
+
*/
|
|
1164
|
+
interface GoogleOAuthResponse {
|
|
1165
|
+
success: boolean;
|
|
1166
|
+
user: User & {
|
|
1167
|
+
storeId?: string;
|
|
1168
|
+
storeName?: string;
|
|
1169
|
+
};
|
|
1170
|
+
accessToken: string;
|
|
1171
|
+
}
|
|
1146
1172
|
|
|
1147
1173
|
/**
|
|
1148
1174
|
* Better Auth - Kimlik Doğrulama Kaynağı
|
|
@@ -1159,6 +1185,11 @@ declare class AuthResource extends BaseResource {
|
|
|
1159
1185
|
* Email/Password ile kayıt (Web - Cookie based)
|
|
1160
1186
|
*/
|
|
1161
1187
|
signUpEmail(input: RegisterInput): Promise<ApiResponse<any>>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Google OAuth ile giriş ( mobil uygulama )
|
|
1190
|
+
* Backend: POST /api/auth/oauth/google
|
|
1191
|
+
*/
|
|
1192
|
+
signInWithGoogle(input: GoogleOAuthInput): Promise<ApiResponse<GoogleOAuthResponse>>;
|
|
1162
1193
|
/**
|
|
1163
1194
|
* Mobil Uygulama Login (Token based)
|
|
1164
1195
|
* Bu metod, SDK kullanımı için en uygun olanıdır.
|
|
@@ -1206,6 +1237,58 @@ declare class GoogleResource extends BaseResource {
|
|
|
1206
1237
|
getDetailedAnalytics(acc: string, propertyId: string, reportType: string): Promise<ApiResponse<any>>;
|
|
1207
1238
|
}
|
|
1208
1239
|
|
|
1240
|
+
/**
|
|
1241
|
+
* Desteklenen integration provider ID'leri
|
|
1242
|
+
*/
|
|
1243
|
+
type IntegrationProviderId = 'google-analytics' | 'facebook-business' | 'tiktok-pixel' | 'snapchat';
|
|
1244
|
+
interface IntegrationConnectionStatus {
|
|
1245
|
+
connected: boolean;
|
|
1246
|
+
provider: IntegrationProviderId | string;
|
|
1247
|
+
storeId: string;
|
|
1248
|
+
expiresAt?: number | null;
|
|
1249
|
+
createdAt?: string;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 3. parti hesap bağlama API'si.
|
|
1253
|
+
* Tüm OAuth akışları backend üzerinden yönetilir - proxy yok.
|
|
1254
|
+
*
|
|
1255
|
+
* Kullanım:
|
|
1256
|
+
* - Bağlantı başlat: window.location.href = sdk.admin.integrations.getAuthorizeUrl('google-analytics', redirectUri)
|
|
1257
|
+
* - Durum: sdk.admin.integrations.getStatus('google-analytics')
|
|
1258
|
+
* - Bağlantı kes: sdk.admin.integrations.disconnect('google-analytics')
|
|
1259
|
+
*/
|
|
1260
|
+
declare class IntegrationsResource extends BaseResource {
|
|
1261
|
+
constructor(httpClient: AxiosInstance);
|
|
1262
|
+
/**
|
|
1263
|
+
* OAuth başlatma URL'ini döner.
|
|
1264
|
+
* Frontend bu URL'e yönlendirir (window.location.href = url).
|
|
1265
|
+
* Cookie/Authorization ile backend'e gidilir, backend Google'a redirect eder.
|
|
1266
|
+
*
|
|
1267
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1268
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1269
|
+
*/
|
|
1270
|
+
getAuthorizeUrl(provider: IntegrationProviderId | string, redirectUri?: string): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Bağlantı durumunu sorgular
|
|
1273
|
+
*/
|
|
1274
|
+
getStatus(provider: IntegrationProviderId | string): Promise<ApiResponse<IntegrationConnectionStatus>>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Bağlantıyı keser (token siler)
|
|
1277
|
+
*/
|
|
1278
|
+
disconnect(provider: IntegrationProviderId | string): Promise<ApiResponse<{
|
|
1279
|
+
success: boolean;
|
|
1280
|
+
provider: string;
|
|
1281
|
+
}>>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Desteklenen provider listesini döner
|
|
1284
|
+
*/
|
|
1285
|
+
listProviders(): Promise<ApiResponse<{
|
|
1286
|
+
providers: IntegrationProviderId[];
|
|
1287
|
+
}>>;
|
|
1288
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1289
|
+
private getBaseUrl;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1209
1292
|
declare class CloudflareResource extends BaseResource {
|
|
1210
1293
|
constructor(httpClient: AxiosInstance);
|
|
1211
1294
|
getAccounts(): Promise<ApiResponse<any>>;
|
|
@@ -1298,6 +1381,10 @@ type index$5_DatasourceResource = DatasourceResource;
|
|
|
1298
1381
|
declare const index$5_DatasourceResource: typeof DatasourceResource;
|
|
1299
1382
|
type index$5_GoogleResource = GoogleResource;
|
|
1300
1383
|
declare const index$5_GoogleResource: typeof GoogleResource;
|
|
1384
|
+
type index$5_IntegrationConnectionStatus = IntegrationConnectionStatus;
|
|
1385
|
+
type index$5_IntegrationProviderId = IntegrationProviderId;
|
|
1386
|
+
type index$5_IntegrationsResource = IntegrationsResource;
|
|
1387
|
+
declare const index$5_IntegrationsResource: typeof IntegrationsResource;
|
|
1301
1388
|
type index$5_LayoutResource = LayoutResource;
|
|
1302
1389
|
declare const index$5_LayoutResource: typeof LayoutResource;
|
|
1303
1390
|
type index$5_MetadataResource = MetadataResource;
|
|
@@ -1335,7 +1422,7 @@ declare const index$5_sectorColumns: typeof sectorColumns;
|
|
|
1335
1422
|
declare const index$5_storeColumns: typeof storeColumns;
|
|
1336
1423
|
declare const index$5_vendorColumns: typeof vendorColumns;
|
|
1337
1424
|
declare namespace index$5 {
|
|
1338
|
-
export { type index$5_AdminMediaCreateInput as AdminMediaCreateInput, index$5_ApiKeyResource as ApiKeyResource, index$5_AuthResource as AuthResource, index$5_CloudflareResource as CloudflareResource, CollectionResource$1 as CollectionResource, ContentResource$1 as ContentResource, type index$5_CreateDatasourceInput as CreateDatasourceInput, index$5_CustomDataResource as CustomDataResource, index$5_DatasourceResource as DatasourceResource, index$5_GoogleResource as GoogleResource, LanguageResource$1 as LanguageResource, index$5_LayoutResource as LayoutResource, MediaResource$1 as MediaResource, index$5_MetadataResource as MetadataResource, NavigationResource$1 as NavigationResource, index$5_ProjectResource as ProjectResource, index$5_PurchaseResource as PurchaseResource, ReviewResource$1 as ReviewResource, index$5_SEOResource as SEOResource, index$5_SectionResource as SectionResource, index$5_SectorResource as SectorResource, index$5_SettingsResource as SettingsResource, StoreResource$1 as StoreResource, index$5_SubscriptionResource as SubscriptionResource, index$5_ThemeResource as ThemeResource, type index$5_UpdateDatasourceInput as UpdateDatasourceInput, index$5_VendorResource as VendorResource, index$5_WebmailResource as WebmailResource, index$5_apiKeyColumns as apiKeyColumns, collectionColumns$1 as collectionColumns, contentColumns$1 as contentColumns, index$5_datasourceColumns as datasourceColumns, index$5_languageColumns as languageColumns, index$5_layoutColumns as layoutColumns, index$5_metadataColumns as metadataColumns, index$5_navigationColumns as navigationColumns, index$5_projectColumns as projectColumns, index$5_sectionColumns as sectionColumns, index$5_sectorColumns as sectorColumns, index$5_storeColumns as storeColumns, index$5_vendorColumns as vendorColumns };
|
|
1425
|
+
export { type index$5_AdminMediaCreateInput as AdminMediaCreateInput, index$5_ApiKeyResource as ApiKeyResource, index$5_AuthResource as AuthResource, index$5_CloudflareResource as CloudflareResource, CollectionResource$1 as CollectionResource, ContentResource$1 as ContentResource, type index$5_CreateDatasourceInput as CreateDatasourceInput, index$5_CustomDataResource as CustomDataResource, index$5_DatasourceResource as DatasourceResource, index$5_GoogleResource as GoogleResource, type index$5_IntegrationConnectionStatus as IntegrationConnectionStatus, type index$5_IntegrationProviderId as IntegrationProviderId, index$5_IntegrationsResource as IntegrationsResource, LanguageResource$1 as LanguageResource, index$5_LayoutResource as LayoutResource, MediaResource$1 as MediaResource, index$5_MetadataResource as MetadataResource, NavigationResource$1 as NavigationResource, index$5_ProjectResource as ProjectResource, index$5_PurchaseResource as PurchaseResource, ReviewResource$1 as ReviewResource, index$5_SEOResource as SEOResource, index$5_SectionResource as SectionResource, index$5_SectorResource as SectorResource, index$5_SettingsResource as SettingsResource, StoreResource$1 as StoreResource, index$5_SubscriptionResource as SubscriptionResource, index$5_ThemeResource as ThemeResource, type index$5_UpdateDatasourceInput as UpdateDatasourceInput, index$5_VendorResource as VendorResource, index$5_WebmailResource as WebmailResource, index$5_apiKeyColumns as apiKeyColumns, collectionColumns$1 as collectionColumns, contentColumns$1 as contentColumns, index$5_datasourceColumns as datasourceColumns, index$5_languageColumns as languageColumns, index$5_layoutColumns as layoutColumns, index$5_metadataColumns as metadataColumns, index$5_navigationColumns as navigationColumns, index$5_projectColumns as projectColumns, index$5_sectionColumns as sectionColumns, index$5_sectorColumns as sectorColumns, index$5_storeColumns as storeColumns, index$5_vendorColumns as vendorColumns };
|
|
1339
1426
|
}
|
|
1340
1427
|
|
|
1341
1428
|
declare class StoreResource extends CrudResource<Store, StoreWhereInput, StoreOrderByInput, StoreCreateInput, StoreUpdateInput> {
|
|
@@ -1613,6 +1700,8 @@ type index$3_DatasourceWhereInput = DatasourceWhereInput;
|
|
|
1613
1700
|
type index$3_DateFilter = DateFilter;
|
|
1614
1701
|
type index$3_FindManyArgs<WhereInput = any, OrderByInput = any, IncludeInput = any, SelectInput = any> = FindManyArgs<WhereInput, OrderByInput, IncludeInput, SelectInput>;
|
|
1615
1702
|
type index$3_FindUniqueArgs<WhereInput = any, IncludeInput = any, SelectInput = any> = FindUniqueArgs<WhereInput, IncludeInput, SelectInput>;
|
|
1703
|
+
type index$3_GoogleOAuthInput = GoogleOAuthInput;
|
|
1704
|
+
type index$3_GoogleOAuthResponse = GoogleOAuthResponse;
|
|
1616
1705
|
type index$3_LanguageCreateInput = LanguageCreateInput;
|
|
1617
1706
|
type index$3_LanguageUpdateInput = LanguageUpdateInput;
|
|
1618
1707
|
type index$3_LanguageWhereInput = LanguageWhereInput;
|
|
@@ -1657,7 +1746,7 @@ type index$3_VendorOrderByInput = VendorOrderByInput;
|
|
|
1657
1746
|
type index$3_VendorUpdateInput = VendorUpdateInput;
|
|
1658
1747
|
type index$3_VendorWhereInput = VendorWhereInput;
|
|
1659
1748
|
declare namespace index$3 {
|
|
1660
|
-
export type { index$3_ApiKey as ApiKey, index$3_ApiKeyCreateInput as ApiKeyCreateInput, index$3_ApiKeyUpdateInput as ApiKeyUpdateInput, index$3_ApiKeyWhereInput as ApiKeyWhereInput, index$3_AuthResponse as AuthResponse, index$3_BooleanFilter as BooleanFilter, index$3_Collection as Collection, index$3_CollectionCreateInput as CollectionCreateInput, index$3_CollectionUpdateInput as CollectionUpdateInput, index$3_CollectionWhereInput as CollectionWhereInput, index$3_Content as Content, index$3_ContentCreateInput as ContentCreateInput, index$3_ContentUpdateInput as ContentUpdateInput, index$3_ContentWhereInput as ContentWhereInput, index$3_Datasource as Datasource, index$3_DatasourceCreateInput as DatasourceCreateInput, index$3_DatasourceUpdateInput as DatasourceUpdateInput, index$3_DatasourceWhereInput as DatasourceWhereInput, index$3_DateFilter as DateFilter, index$3_FindManyArgs as FindManyArgs, index$3_FindUniqueArgs as FindUniqueArgs, Language$1 as Language, index$3_LanguageCreateInput as LanguageCreateInput, index$3_LanguageUpdateInput as LanguageUpdateInput, index$3_LanguageWhereInput as LanguageWhereInput, index$3_Layout as Layout, index$3_LayoutCreateInput as LayoutCreateInput, index$3_LayoutOrderByInput as LayoutOrderByInput, index$3_LayoutUpdateInput as LayoutUpdateInput, index$3_LayoutWhereInput as LayoutWhereInput, index$3_LoginInput as LoginInput, index$3_Media as Media, index$3_MediaCreateInput as MediaCreateInput, index$3_MediaOrderByInput as MediaOrderByInput, index$3_MediaUpdateInput as MediaUpdateInput, index$3_MediaWhereInput as MediaWhereInput, index$3_Metadata as Metadata, index$3_MetadataCreateInput as MetadataCreateInput, index$3_MetadataUpdateInput as MetadataUpdateInput, index$3_MetadataWhereInput as MetadataWhereInput, index$3_Navigation as Navigation, index$3_NavigationCreateInput as NavigationCreateInput, index$3_NavigationOrderByInput as NavigationOrderByInput, index$3_NavigationUpdateInput as NavigationUpdateInput, index$3_NavigationWhereInput as NavigationWhereInput, index$3_NumberFilter as NumberFilter, index$3_Pagination as Pagination, index$3_QueryParams as QueryParams, index$3_RegisterInput as RegisterInput, index$3_SeoSettings as SeoSettings, index$3_SessionResponse as SessionResponse, index$3_Settings as Settings, index$3_SortOrder as SortOrder, index$3_Store as Store, index$3_StoreCreateInput as StoreCreateInput, index$3_StoreOrderByInput as StoreOrderByInput, index$3_StoreUpdateInput as StoreUpdateInput, index$3_StoreWhereInput as StoreWhereInput, index$3_StringFilter as StringFilter, index$3_TokenValidateResponse as TokenValidateResponse, index$3_Vendor as Vendor, index$3_VendorCreateInput as VendorCreateInput, index$3_VendorOrderByInput as VendorOrderByInput, index$3_VendorUpdateInput as VendorUpdateInput, index$3_VendorWhereInput as VendorWhereInput };
|
|
1749
|
+
export type { index$3_ApiKey as ApiKey, index$3_ApiKeyCreateInput as ApiKeyCreateInput, index$3_ApiKeyUpdateInput as ApiKeyUpdateInput, index$3_ApiKeyWhereInput as ApiKeyWhereInput, index$3_AuthResponse as AuthResponse, index$3_BooleanFilter as BooleanFilter, index$3_Collection as Collection, index$3_CollectionCreateInput as CollectionCreateInput, index$3_CollectionUpdateInput as CollectionUpdateInput, index$3_CollectionWhereInput as CollectionWhereInput, index$3_Content as Content, index$3_ContentCreateInput as ContentCreateInput, index$3_ContentUpdateInput as ContentUpdateInput, index$3_ContentWhereInput as ContentWhereInput, index$3_Datasource as Datasource, index$3_DatasourceCreateInput as DatasourceCreateInput, index$3_DatasourceUpdateInput as DatasourceUpdateInput, index$3_DatasourceWhereInput as DatasourceWhereInput, index$3_DateFilter as DateFilter, index$3_FindManyArgs as FindManyArgs, index$3_FindUniqueArgs as FindUniqueArgs, index$3_GoogleOAuthInput as GoogleOAuthInput, index$3_GoogleOAuthResponse as GoogleOAuthResponse, Language$1 as Language, index$3_LanguageCreateInput as LanguageCreateInput, index$3_LanguageUpdateInput as LanguageUpdateInput, index$3_LanguageWhereInput as LanguageWhereInput, index$3_Layout as Layout, index$3_LayoutCreateInput as LayoutCreateInput, index$3_LayoutOrderByInput as LayoutOrderByInput, index$3_LayoutUpdateInput as LayoutUpdateInput, index$3_LayoutWhereInput as LayoutWhereInput, index$3_LoginInput as LoginInput, index$3_Media as Media, index$3_MediaCreateInput as MediaCreateInput, index$3_MediaOrderByInput as MediaOrderByInput, index$3_MediaUpdateInput as MediaUpdateInput, index$3_MediaWhereInput as MediaWhereInput, index$3_Metadata as Metadata, index$3_MetadataCreateInput as MetadataCreateInput, index$3_MetadataUpdateInput as MetadataUpdateInput, index$3_MetadataWhereInput as MetadataWhereInput, index$3_Navigation as Navigation, index$3_NavigationCreateInput as NavigationCreateInput, index$3_NavigationOrderByInput as NavigationOrderByInput, index$3_NavigationUpdateInput as NavigationUpdateInput, index$3_NavigationWhereInput as NavigationWhereInput, index$3_NumberFilter as NumberFilter, index$3_Pagination as Pagination, index$3_QueryParams as QueryParams, index$3_RegisterInput as RegisterInput, index$3_SeoSettings as SeoSettings, index$3_SessionResponse as SessionResponse, index$3_Settings as Settings, index$3_SortOrder as SortOrder, index$3_Store as Store, index$3_StoreCreateInput as StoreCreateInput, index$3_StoreOrderByInput as StoreOrderByInput, index$3_StoreUpdateInput as StoreUpdateInput, index$3_StoreWhereInput as StoreWhereInput, index$3_StringFilter as StringFilter, index$3_TokenValidateResponse as TokenValidateResponse, index$3_Vendor as Vendor, index$3_VendorCreateInput as VendorCreateInput, index$3_VendorOrderByInput as VendorOrderByInput, index$3_VendorUpdateInput as VendorUpdateInput, index$3_VendorWhereInput as VendorWhereInput };
|
|
1661
1750
|
}
|
|
1662
1751
|
|
|
1663
1752
|
type index$2_BooleanFilter = BooleanFilter;
|
|
@@ -1767,6 +1856,7 @@ declare class AdminNamespace {
|
|
|
1767
1856
|
readonly sections: SectionResource;
|
|
1768
1857
|
readonly themes: ThemeResource;
|
|
1769
1858
|
readonly google: GoogleResource;
|
|
1859
|
+
readonly integrations: IntegrationsResource;
|
|
1770
1860
|
readonly cloudflare: CloudflareResource;
|
|
1771
1861
|
readonly reviews: ReviewResource$1;
|
|
1772
1862
|
readonly customData: CustomDataResource;
|
package/dist/index.js
CHANGED
|
@@ -233,6 +233,7 @@ __export(admin_exports, {
|
|
|
233
233
|
CustomDataResource: () => CustomDataResource,
|
|
234
234
|
DatasourceResource: () => DatasourceResource,
|
|
235
235
|
GoogleResource: () => GoogleResource,
|
|
236
|
+
IntegrationsResource: () => IntegrationsResource,
|
|
236
237
|
LanguageResource: () => LanguageResource,
|
|
237
238
|
LayoutResource: () => LayoutResource,
|
|
238
239
|
MediaResource: () => MediaResource,
|
|
@@ -1203,6 +1204,17 @@ var AuthResource = class extends BaseResource {
|
|
|
1203
1204
|
data: input
|
|
1204
1205
|
});
|
|
1205
1206
|
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Google OAuth ile giriş ( mobil uygulama )
|
|
1209
|
+
* Backend: POST /api/auth/oauth/google
|
|
1210
|
+
*/
|
|
1211
|
+
async signInWithGoogle(input) {
|
|
1212
|
+
return this.request({
|
|
1213
|
+
method: "POST",
|
|
1214
|
+
url: `${this.path}/oauth/google`,
|
|
1215
|
+
data: { ...input, provider: "google" }
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1206
1218
|
/**
|
|
1207
1219
|
* Mobil Uygulama Login (Token based)
|
|
1208
1220
|
* Bu metod, SDK kullanımı için en uygun olanıdır.
|
|
@@ -1322,6 +1334,62 @@ var GoogleResource = class extends BaseResource {
|
|
|
1322
1334
|
}
|
|
1323
1335
|
};
|
|
1324
1336
|
|
|
1337
|
+
// src/resources/admin/integrations.ts
|
|
1338
|
+
var IntegrationsResource = class extends BaseResource {
|
|
1339
|
+
constructor(httpClient) {
|
|
1340
|
+
super(httpClient);
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* OAuth başlatma URL'ini döner.
|
|
1344
|
+
* Frontend bu URL'e yönlendirir (window.location.href = url).
|
|
1345
|
+
* Cookie/Authorization ile backend'e gidilir, backend Google'a redirect eder.
|
|
1346
|
+
*
|
|
1347
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1348
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1349
|
+
*/
|
|
1350
|
+
getAuthorizeUrl(provider, redirectUri) {
|
|
1351
|
+
const baseUrl = this.getBaseUrl();
|
|
1352
|
+
const path = `/api/admin/integrations/authorize/${encodeURIComponent(provider)}`;
|
|
1353
|
+
const params = redirectUri ? `?redirect_uri=${encodeURIComponent(redirectUri)}` : "";
|
|
1354
|
+
return `${baseUrl}${path}${params}`;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Bağlantı durumunu sorgular
|
|
1358
|
+
*/
|
|
1359
|
+
async getStatus(provider) {
|
|
1360
|
+
return this.request({
|
|
1361
|
+
method: "GET",
|
|
1362
|
+
url: `/api/admin/integrations/status/${encodeURIComponent(provider)}`
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Bağlantıyı keser (token siler)
|
|
1367
|
+
*/
|
|
1368
|
+
async disconnect(provider) {
|
|
1369
|
+
return this.request({
|
|
1370
|
+
method: "DELETE",
|
|
1371
|
+
url: `/api/admin/integrations/${encodeURIComponent(provider)}`
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Desteklenen provider listesini döner
|
|
1376
|
+
*/
|
|
1377
|
+
async listProviders() {
|
|
1378
|
+
return this.request({
|
|
1379
|
+
method: "GET",
|
|
1380
|
+
url: "/api/admin/integrations/providers/list"
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1384
|
+
getBaseUrl() {
|
|
1385
|
+
const baseURL = this.httpClient?.defaults?.baseURL;
|
|
1386
|
+
if (baseURL && typeof baseURL === "string") {
|
|
1387
|
+
return String(baseURL).replace(/\/$/, "");
|
|
1388
|
+
}
|
|
1389
|
+
return "http://localhost:3031";
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1325
1393
|
// src/resources/admin/cloudflare.ts
|
|
1326
1394
|
var CloudflareResource = class extends BaseResource {
|
|
1327
1395
|
constructor(httpClient) {
|
|
@@ -2108,6 +2176,7 @@ var AdminNamespace = class {
|
|
|
2108
2176
|
sections;
|
|
2109
2177
|
themes;
|
|
2110
2178
|
google;
|
|
2179
|
+
integrations;
|
|
2111
2180
|
cloudflare;
|
|
2112
2181
|
reviews;
|
|
2113
2182
|
customData;
|
|
@@ -2134,6 +2203,7 @@ var AdminNamespace = class {
|
|
|
2134
2203
|
this.sections = new SectionResource(client.instance);
|
|
2135
2204
|
this.themes = new ThemeResource(client.instance);
|
|
2136
2205
|
this.google = new GoogleResource(client.instance);
|
|
2206
|
+
this.integrations = new IntegrationsResource(client.instance);
|
|
2137
2207
|
this.cloudflare = new CloudflareResource(client.instance);
|
|
2138
2208
|
this.reviews = new ReviewResource(client.instance);
|
|
2139
2209
|
this.customData = new CustomDataResource(client.instance);
|
package/dist/index.mjs
CHANGED
|
@@ -170,6 +170,7 @@ __export(admin_exports, {
|
|
|
170
170
|
CustomDataResource: () => CustomDataResource,
|
|
171
171
|
DatasourceResource: () => DatasourceResource,
|
|
172
172
|
GoogleResource: () => GoogleResource,
|
|
173
|
+
IntegrationsResource: () => IntegrationsResource,
|
|
173
174
|
LanguageResource: () => LanguageResource,
|
|
174
175
|
LayoutResource: () => LayoutResource,
|
|
175
176
|
MediaResource: () => MediaResource,
|
|
@@ -1140,6 +1141,17 @@ var AuthResource = class extends BaseResource {
|
|
|
1140
1141
|
data: input
|
|
1141
1142
|
});
|
|
1142
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Google OAuth ile giriş ( mobil uygulama )
|
|
1146
|
+
* Backend: POST /api/auth/oauth/google
|
|
1147
|
+
*/
|
|
1148
|
+
async signInWithGoogle(input) {
|
|
1149
|
+
return this.request({
|
|
1150
|
+
method: "POST",
|
|
1151
|
+
url: `${this.path}/oauth/google`,
|
|
1152
|
+
data: { ...input, provider: "google" }
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1143
1155
|
/**
|
|
1144
1156
|
* Mobil Uygulama Login (Token based)
|
|
1145
1157
|
* Bu metod, SDK kullanımı için en uygun olanıdır.
|
|
@@ -1259,6 +1271,62 @@ var GoogleResource = class extends BaseResource {
|
|
|
1259
1271
|
}
|
|
1260
1272
|
};
|
|
1261
1273
|
|
|
1274
|
+
// src/resources/admin/integrations.ts
|
|
1275
|
+
var IntegrationsResource = class extends BaseResource {
|
|
1276
|
+
constructor(httpClient) {
|
|
1277
|
+
super(httpClient);
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* OAuth başlatma URL'ini döner.
|
|
1281
|
+
* Frontend bu URL'e yönlendirir (window.location.href = url).
|
|
1282
|
+
* Cookie/Authorization ile backend'e gidilir, backend Google'a redirect eder.
|
|
1283
|
+
*
|
|
1284
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1285
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1286
|
+
*/
|
|
1287
|
+
getAuthorizeUrl(provider, redirectUri) {
|
|
1288
|
+
const baseUrl = this.getBaseUrl();
|
|
1289
|
+
const path = `/api/admin/integrations/authorize/${encodeURIComponent(provider)}`;
|
|
1290
|
+
const params = redirectUri ? `?redirect_uri=${encodeURIComponent(redirectUri)}` : "";
|
|
1291
|
+
return `${baseUrl}${path}${params}`;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Bağlantı durumunu sorgular
|
|
1295
|
+
*/
|
|
1296
|
+
async getStatus(provider) {
|
|
1297
|
+
return this.request({
|
|
1298
|
+
method: "GET",
|
|
1299
|
+
url: `/api/admin/integrations/status/${encodeURIComponent(provider)}`
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Bağlantıyı keser (token siler)
|
|
1304
|
+
*/
|
|
1305
|
+
async disconnect(provider) {
|
|
1306
|
+
return this.request({
|
|
1307
|
+
method: "DELETE",
|
|
1308
|
+
url: `/api/admin/integrations/${encodeURIComponent(provider)}`
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Desteklenen provider listesini döner
|
|
1313
|
+
*/
|
|
1314
|
+
async listProviders() {
|
|
1315
|
+
return this.request({
|
|
1316
|
+
method: "GET",
|
|
1317
|
+
url: "/api/admin/integrations/providers/list"
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1321
|
+
getBaseUrl() {
|
|
1322
|
+
const baseURL = this.httpClient?.defaults?.baseURL;
|
|
1323
|
+
if (baseURL && typeof baseURL === "string") {
|
|
1324
|
+
return String(baseURL).replace(/\/$/, "");
|
|
1325
|
+
}
|
|
1326
|
+
return "http://localhost:3031";
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1262
1330
|
// src/resources/admin/cloudflare.ts
|
|
1263
1331
|
var CloudflareResource = class extends BaseResource {
|
|
1264
1332
|
constructor(httpClient) {
|
|
@@ -2045,6 +2113,7 @@ var AdminNamespace = class {
|
|
|
2045
2113
|
sections;
|
|
2046
2114
|
themes;
|
|
2047
2115
|
google;
|
|
2116
|
+
integrations;
|
|
2048
2117
|
cloudflare;
|
|
2049
2118
|
reviews;
|
|
2050
2119
|
customData;
|
|
@@ -2071,6 +2140,7 @@ var AdminNamespace = class {
|
|
|
2071
2140
|
this.sections = new SectionResource(client.instance);
|
|
2072
2141
|
this.themes = new ThemeResource(client.instance);
|
|
2073
2142
|
this.google = new GoogleResource(client.instance);
|
|
2143
|
+
this.integrations = new IntegrationsResource(client.instance);
|
|
2074
2144
|
this.cloudflare = new CloudflareResource(client.instance);
|
|
2075
2145
|
this.reviews = new ReviewResource(client.instance);
|
|
2076
2146
|
this.customData = new CustomDataResource(client.instance);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salefony/api-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Salefony API SDK - Official SDK for Salefony Backend API. Full TypeScript support, SSR-ready, Admin & Frontstore resources.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"version:patch": "node scripts/version-bump.js patch",
|
|
26
26
|
"version:minor": "node scripts/version-bump.js minor",
|
|
27
27
|
"version:major": "node scripts/version-bump.js major",
|
|
28
|
-
"
|
|
28
|
+
"release": "npm publish"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"salefony",
|