@salefony/api-sdk 1.0.6 → 1.0.8
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 +29 -0
- package/dist/index.d.mts +106 -7
- package/dist/index.d.ts +106 -7
- package/dist/index.js +100 -0
- package/dist/index.mjs +100 -0
- package/package.json +1 -1
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,33 @@ 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 – URL oluşturur ve otomatik yönlendirir
|
|
510
|
+
sdk.admin.integrations.authorize('google-analytics', '/admin/analytics');
|
|
511
|
+
|
|
512
|
+
// Check connection status
|
|
513
|
+
const { data } = await sdk.admin.integrations.getStatus('google-analytics');
|
|
514
|
+
|
|
515
|
+
// Disconnect
|
|
516
|
+
await sdk.admin.integrations.disconnect('google-analytics');
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
**Platform usage:**
|
|
520
|
+
|
|
521
|
+
| Platform | Flow |
|
|
522
|
+
|--------------------|--------------------------------------------------------------|
|
|
523
|
+
| React / Next.js | `authorize('google-analytics', '/admin/analytics')` – otomatik redirect |
|
|
524
|
+
| Expo / React Native| `url = authorize(...)` + `Linking.openURL(url)` – sadece URL döner |
|
|
525
|
+
| Node.js | `url = authorize(...)` – sadece URL döner, `res.redirect(url)` |
|
|
526
|
+
|
|
527
|
+
Full guide: [Integrations Documentation](./docs/INTEGRATIONS.md)
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
502
531
|
## 🛠️ SSR Usage
|
|
503
532
|
|
|
504
533
|
### 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,67 @@ 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: sdk.admin.integrations.authorize('google-analytics', '/admin/analytics')
|
|
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şlatır: URL üretir ve tarayıcıda yönlendirir.
|
|
1264
|
+
* Kullanıcının URL oluşturup window.location atamasına gerek kalmaz.
|
|
1265
|
+
*
|
|
1266
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1267
|
+
* @param redirectUriOrPath - Tam URL veya path (örn: '/admin/analytics'). Verilmezse mevcut sayfa kullanılır.
|
|
1268
|
+
* @returns Oluşturulan URL (Node.js / Expo gibi ortamlarda manuel kullanım için)
|
|
1269
|
+
*/
|
|
1270
|
+
authorize(provider: IntegrationProviderId | string, redirectUriOrPath?: string): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* OAuth başlatma URL'ini döner (redirect yapmaz).
|
|
1273
|
+
* Tarayıcıda otomatik yönlendirme için `authorize()` kullanın.
|
|
1274
|
+
*
|
|
1275
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1276
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1277
|
+
*/
|
|
1278
|
+
getAuthorizeUrl(provider: IntegrationProviderId | string, redirectUri?: string): string;
|
|
1279
|
+
private resolveRedirectUri;
|
|
1280
|
+
/**
|
|
1281
|
+
* Bağlantı durumunu sorgular
|
|
1282
|
+
*/
|
|
1283
|
+
getStatus(provider: IntegrationProviderId | string): Promise<ApiResponse<IntegrationConnectionStatus>>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Bağlantıyı keser (token siler)
|
|
1286
|
+
*/
|
|
1287
|
+
disconnect(provider: IntegrationProviderId | string): Promise<ApiResponse<{
|
|
1288
|
+
success: boolean;
|
|
1289
|
+
provider: string;
|
|
1290
|
+
}>>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Desteklenen provider listesini döner
|
|
1293
|
+
*/
|
|
1294
|
+
listProviders(): Promise<ApiResponse<{
|
|
1295
|
+
providers: IntegrationProviderId[];
|
|
1296
|
+
}>>;
|
|
1297
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1298
|
+
private getBaseUrl;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1209
1301
|
declare class CloudflareResource extends BaseResource {
|
|
1210
1302
|
constructor(httpClient: AxiosInstance);
|
|
1211
1303
|
getAccounts(): Promise<ApiResponse<any>>;
|
|
@@ -1298,6 +1390,10 @@ type index$5_DatasourceResource = DatasourceResource;
|
|
|
1298
1390
|
declare const index$5_DatasourceResource: typeof DatasourceResource;
|
|
1299
1391
|
type index$5_GoogleResource = GoogleResource;
|
|
1300
1392
|
declare const index$5_GoogleResource: typeof GoogleResource;
|
|
1393
|
+
type index$5_IntegrationConnectionStatus = IntegrationConnectionStatus;
|
|
1394
|
+
type index$5_IntegrationProviderId = IntegrationProviderId;
|
|
1395
|
+
type index$5_IntegrationsResource = IntegrationsResource;
|
|
1396
|
+
declare const index$5_IntegrationsResource: typeof IntegrationsResource;
|
|
1301
1397
|
type index$5_LayoutResource = LayoutResource;
|
|
1302
1398
|
declare const index$5_LayoutResource: typeof LayoutResource;
|
|
1303
1399
|
type index$5_MetadataResource = MetadataResource;
|
|
@@ -1335,7 +1431,7 @@ declare const index$5_sectorColumns: typeof sectorColumns;
|
|
|
1335
1431
|
declare const index$5_storeColumns: typeof storeColumns;
|
|
1336
1432
|
declare const index$5_vendorColumns: typeof vendorColumns;
|
|
1337
1433
|
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 };
|
|
1434
|
+
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
1435
|
}
|
|
1340
1436
|
|
|
1341
1437
|
declare class StoreResource extends CrudResource<Store, StoreWhereInput, StoreOrderByInput, StoreCreateInput, StoreUpdateInput> {
|
|
@@ -1613,6 +1709,8 @@ type index$3_DatasourceWhereInput = DatasourceWhereInput;
|
|
|
1613
1709
|
type index$3_DateFilter = DateFilter;
|
|
1614
1710
|
type index$3_FindManyArgs<WhereInput = any, OrderByInput = any, IncludeInput = any, SelectInput = any> = FindManyArgs<WhereInput, OrderByInput, IncludeInput, SelectInput>;
|
|
1615
1711
|
type index$3_FindUniqueArgs<WhereInput = any, IncludeInput = any, SelectInput = any> = FindUniqueArgs<WhereInput, IncludeInput, SelectInput>;
|
|
1712
|
+
type index$3_GoogleOAuthInput = GoogleOAuthInput;
|
|
1713
|
+
type index$3_GoogleOAuthResponse = GoogleOAuthResponse;
|
|
1616
1714
|
type index$3_LanguageCreateInput = LanguageCreateInput;
|
|
1617
1715
|
type index$3_LanguageUpdateInput = LanguageUpdateInput;
|
|
1618
1716
|
type index$3_LanguageWhereInput = LanguageWhereInput;
|
|
@@ -1657,7 +1755,7 @@ type index$3_VendorOrderByInput = VendorOrderByInput;
|
|
|
1657
1755
|
type index$3_VendorUpdateInput = VendorUpdateInput;
|
|
1658
1756
|
type index$3_VendorWhereInput = VendorWhereInput;
|
|
1659
1757
|
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 };
|
|
1758
|
+
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
1759
|
}
|
|
1662
1760
|
|
|
1663
1761
|
type index$2_BooleanFilter = BooleanFilter;
|
|
@@ -1767,6 +1865,7 @@ declare class AdminNamespace {
|
|
|
1767
1865
|
readonly sections: SectionResource;
|
|
1768
1866
|
readonly themes: ThemeResource;
|
|
1769
1867
|
readonly google: GoogleResource;
|
|
1868
|
+
readonly integrations: IntegrationsResource;
|
|
1770
1869
|
readonly cloudflare: CloudflareResource;
|
|
1771
1870
|
readonly reviews: ReviewResource$1;
|
|
1772
1871
|
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,67 @@ 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: sdk.admin.integrations.authorize('google-analytics', '/admin/analytics')
|
|
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şlatır: URL üretir ve tarayıcıda yönlendirir.
|
|
1264
|
+
* Kullanıcının URL oluşturup window.location atamasına gerek kalmaz.
|
|
1265
|
+
*
|
|
1266
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1267
|
+
* @param redirectUriOrPath - Tam URL veya path (örn: '/admin/analytics'). Verilmezse mevcut sayfa kullanılır.
|
|
1268
|
+
* @returns Oluşturulan URL (Node.js / Expo gibi ortamlarda manuel kullanım için)
|
|
1269
|
+
*/
|
|
1270
|
+
authorize(provider: IntegrationProviderId | string, redirectUriOrPath?: string): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* OAuth başlatma URL'ini döner (redirect yapmaz).
|
|
1273
|
+
* Tarayıcıda otomatik yönlendirme için `authorize()` kullanın.
|
|
1274
|
+
*
|
|
1275
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1276
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1277
|
+
*/
|
|
1278
|
+
getAuthorizeUrl(provider: IntegrationProviderId | string, redirectUri?: string): string;
|
|
1279
|
+
private resolveRedirectUri;
|
|
1280
|
+
/**
|
|
1281
|
+
* Bağlantı durumunu sorgular
|
|
1282
|
+
*/
|
|
1283
|
+
getStatus(provider: IntegrationProviderId | string): Promise<ApiResponse<IntegrationConnectionStatus>>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Bağlantıyı keser (token siler)
|
|
1286
|
+
*/
|
|
1287
|
+
disconnect(provider: IntegrationProviderId | string): Promise<ApiResponse<{
|
|
1288
|
+
success: boolean;
|
|
1289
|
+
provider: string;
|
|
1290
|
+
}>>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Desteklenen provider listesini döner
|
|
1293
|
+
*/
|
|
1294
|
+
listProviders(): Promise<ApiResponse<{
|
|
1295
|
+
providers: IntegrationProviderId[];
|
|
1296
|
+
}>>;
|
|
1297
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1298
|
+
private getBaseUrl;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1209
1301
|
declare class CloudflareResource extends BaseResource {
|
|
1210
1302
|
constructor(httpClient: AxiosInstance);
|
|
1211
1303
|
getAccounts(): Promise<ApiResponse<any>>;
|
|
@@ -1298,6 +1390,10 @@ type index$5_DatasourceResource = DatasourceResource;
|
|
|
1298
1390
|
declare const index$5_DatasourceResource: typeof DatasourceResource;
|
|
1299
1391
|
type index$5_GoogleResource = GoogleResource;
|
|
1300
1392
|
declare const index$5_GoogleResource: typeof GoogleResource;
|
|
1393
|
+
type index$5_IntegrationConnectionStatus = IntegrationConnectionStatus;
|
|
1394
|
+
type index$5_IntegrationProviderId = IntegrationProviderId;
|
|
1395
|
+
type index$5_IntegrationsResource = IntegrationsResource;
|
|
1396
|
+
declare const index$5_IntegrationsResource: typeof IntegrationsResource;
|
|
1301
1397
|
type index$5_LayoutResource = LayoutResource;
|
|
1302
1398
|
declare const index$5_LayoutResource: typeof LayoutResource;
|
|
1303
1399
|
type index$5_MetadataResource = MetadataResource;
|
|
@@ -1335,7 +1431,7 @@ declare const index$5_sectorColumns: typeof sectorColumns;
|
|
|
1335
1431
|
declare const index$5_storeColumns: typeof storeColumns;
|
|
1336
1432
|
declare const index$5_vendorColumns: typeof vendorColumns;
|
|
1337
1433
|
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 };
|
|
1434
|
+
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
1435
|
}
|
|
1340
1436
|
|
|
1341
1437
|
declare class StoreResource extends CrudResource<Store, StoreWhereInput, StoreOrderByInput, StoreCreateInput, StoreUpdateInput> {
|
|
@@ -1613,6 +1709,8 @@ type index$3_DatasourceWhereInput = DatasourceWhereInput;
|
|
|
1613
1709
|
type index$3_DateFilter = DateFilter;
|
|
1614
1710
|
type index$3_FindManyArgs<WhereInput = any, OrderByInput = any, IncludeInput = any, SelectInput = any> = FindManyArgs<WhereInput, OrderByInput, IncludeInput, SelectInput>;
|
|
1615
1711
|
type index$3_FindUniqueArgs<WhereInput = any, IncludeInput = any, SelectInput = any> = FindUniqueArgs<WhereInput, IncludeInput, SelectInput>;
|
|
1712
|
+
type index$3_GoogleOAuthInput = GoogleOAuthInput;
|
|
1713
|
+
type index$3_GoogleOAuthResponse = GoogleOAuthResponse;
|
|
1616
1714
|
type index$3_LanguageCreateInput = LanguageCreateInput;
|
|
1617
1715
|
type index$3_LanguageUpdateInput = LanguageUpdateInput;
|
|
1618
1716
|
type index$3_LanguageWhereInput = LanguageWhereInput;
|
|
@@ -1657,7 +1755,7 @@ type index$3_VendorOrderByInput = VendorOrderByInput;
|
|
|
1657
1755
|
type index$3_VendorUpdateInput = VendorUpdateInput;
|
|
1658
1756
|
type index$3_VendorWhereInput = VendorWhereInput;
|
|
1659
1757
|
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 };
|
|
1758
|
+
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
1759
|
}
|
|
1662
1760
|
|
|
1663
1761
|
type index$2_BooleanFilter = BooleanFilter;
|
|
@@ -1767,6 +1865,7 @@ declare class AdminNamespace {
|
|
|
1767
1865
|
readonly sections: SectionResource;
|
|
1768
1866
|
readonly themes: ThemeResource;
|
|
1769
1867
|
readonly google: GoogleResource;
|
|
1868
|
+
readonly integrations: IntegrationsResource;
|
|
1770
1869
|
readonly cloudflare: CloudflareResource;
|
|
1771
1870
|
readonly reviews: ReviewResource$1;
|
|
1772
1871
|
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,92 @@ 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şlatır: URL üretir ve tarayıcıda yönlendirir.
|
|
1344
|
+
* Kullanıcının URL oluşturup window.location atamasına gerek kalmaz.
|
|
1345
|
+
*
|
|
1346
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1347
|
+
* @param redirectUriOrPath - Tam URL veya path (örn: '/admin/analytics'). Verilmezse mevcut sayfa kullanılır.
|
|
1348
|
+
* @returns Oluşturulan URL (Node.js / Expo gibi ortamlarda manuel kullanım için)
|
|
1349
|
+
*/
|
|
1350
|
+
authorize(provider, redirectUriOrPath) {
|
|
1351
|
+
const redirectUri = this.resolveRedirectUri(redirectUriOrPath);
|
|
1352
|
+
const url = this.getAuthorizeUrl(provider, redirectUri);
|
|
1353
|
+
if (typeof window !== "undefined") {
|
|
1354
|
+
window.location.href = url;
|
|
1355
|
+
}
|
|
1356
|
+
return url;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* OAuth başlatma URL'ini döner (redirect yapmaz).
|
|
1360
|
+
* Tarayıcıda otomatik yönlendirme için `authorize()` kullanın.
|
|
1361
|
+
*
|
|
1362
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1363
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1364
|
+
*/
|
|
1365
|
+
getAuthorizeUrl(provider, redirectUri) {
|
|
1366
|
+
const baseUrl = this.getBaseUrl();
|
|
1367
|
+
const path = `/api/admin/integrations/authorize/${encodeURIComponent(provider)}`;
|
|
1368
|
+
const params = redirectUri ? `?redirect_uri=${encodeURIComponent(redirectUri)}` : "";
|
|
1369
|
+
return `${baseUrl}${path}${params}`;
|
|
1370
|
+
}
|
|
1371
|
+
resolveRedirectUri(redirectUriOrPath) {
|
|
1372
|
+
if (redirectUriOrPath) {
|
|
1373
|
+
if (redirectUriOrPath.startsWith("http://") || redirectUriOrPath.startsWith("https://")) {
|
|
1374
|
+
return redirectUriOrPath;
|
|
1375
|
+
}
|
|
1376
|
+
if (typeof window !== "undefined") {
|
|
1377
|
+
const path = redirectUriOrPath.startsWith("/") ? redirectUriOrPath : `/${redirectUriOrPath}`;
|
|
1378
|
+
return `${window.location.origin}${path}`;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
if (typeof window !== "undefined") {
|
|
1382
|
+
return window.location.href;
|
|
1383
|
+
}
|
|
1384
|
+
return void 0;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Bağlantı durumunu sorgular
|
|
1388
|
+
*/
|
|
1389
|
+
async getStatus(provider) {
|
|
1390
|
+
return this.request({
|
|
1391
|
+
method: "GET",
|
|
1392
|
+
url: `/api/admin/integrations/status/${encodeURIComponent(provider)}`
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Bağlantıyı keser (token siler)
|
|
1397
|
+
*/
|
|
1398
|
+
async disconnect(provider) {
|
|
1399
|
+
return this.request({
|
|
1400
|
+
method: "DELETE",
|
|
1401
|
+
url: `/api/admin/integrations/${encodeURIComponent(provider)}`
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Desteklenen provider listesini döner
|
|
1406
|
+
*/
|
|
1407
|
+
async listProviders() {
|
|
1408
|
+
return this.request({
|
|
1409
|
+
method: "GET",
|
|
1410
|
+
url: "/api/admin/integrations/providers/list"
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1414
|
+
getBaseUrl() {
|
|
1415
|
+
const baseURL = this.httpClient?.defaults?.baseURL;
|
|
1416
|
+
if (baseURL && typeof baseURL === "string") {
|
|
1417
|
+
return String(baseURL).replace(/\/$/, "");
|
|
1418
|
+
}
|
|
1419
|
+
return "http://localhost:3031";
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1325
1423
|
// src/resources/admin/cloudflare.ts
|
|
1326
1424
|
var CloudflareResource = class extends BaseResource {
|
|
1327
1425
|
constructor(httpClient) {
|
|
@@ -2108,6 +2206,7 @@ var AdminNamespace = class {
|
|
|
2108
2206
|
sections;
|
|
2109
2207
|
themes;
|
|
2110
2208
|
google;
|
|
2209
|
+
integrations;
|
|
2111
2210
|
cloudflare;
|
|
2112
2211
|
reviews;
|
|
2113
2212
|
customData;
|
|
@@ -2134,6 +2233,7 @@ var AdminNamespace = class {
|
|
|
2134
2233
|
this.sections = new SectionResource(client.instance);
|
|
2135
2234
|
this.themes = new ThemeResource(client.instance);
|
|
2136
2235
|
this.google = new GoogleResource(client.instance);
|
|
2236
|
+
this.integrations = new IntegrationsResource(client.instance);
|
|
2137
2237
|
this.cloudflare = new CloudflareResource(client.instance);
|
|
2138
2238
|
this.reviews = new ReviewResource(client.instance);
|
|
2139
2239
|
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,92 @@ 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şlatır: URL üretir ve tarayıcıda yönlendirir.
|
|
1281
|
+
* Kullanıcının URL oluşturup window.location atamasına gerek kalmaz.
|
|
1282
|
+
*
|
|
1283
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1284
|
+
* @param redirectUriOrPath - Tam URL veya path (örn: '/admin/analytics'). Verilmezse mevcut sayfa kullanılır.
|
|
1285
|
+
* @returns Oluşturulan URL (Node.js / Expo gibi ortamlarda manuel kullanım için)
|
|
1286
|
+
*/
|
|
1287
|
+
authorize(provider, redirectUriOrPath) {
|
|
1288
|
+
const redirectUri = this.resolveRedirectUri(redirectUriOrPath);
|
|
1289
|
+
const url = this.getAuthorizeUrl(provider, redirectUri);
|
|
1290
|
+
if (typeof window !== "undefined") {
|
|
1291
|
+
window.location.href = url;
|
|
1292
|
+
}
|
|
1293
|
+
return url;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* OAuth başlatma URL'ini döner (redirect yapmaz).
|
|
1297
|
+
* Tarayıcıda otomatik yönlendirme için `authorize()` kullanın.
|
|
1298
|
+
*
|
|
1299
|
+
* @param provider - Provider ID (google-analytics, facebook-business, vb.)
|
|
1300
|
+
* @param redirectUri - OAuth tamamlandıktan sonra dönülecek URL (opsiyonel)
|
|
1301
|
+
*/
|
|
1302
|
+
getAuthorizeUrl(provider, redirectUri) {
|
|
1303
|
+
const baseUrl = this.getBaseUrl();
|
|
1304
|
+
const path = `/api/admin/integrations/authorize/${encodeURIComponent(provider)}`;
|
|
1305
|
+
const params = redirectUri ? `?redirect_uri=${encodeURIComponent(redirectUri)}` : "";
|
|
1306
|
+
return `${baseUrl}${path}${params}`;
|
|
1307
|
+
}
|
|
1308
|
+
resolveRedirectUri(redirectUriOrPath) {
|
|
1309
|
+
if (redirectUriOrPath) {
|
|
1310
|
+
if (redirectUriOrPath.startsWith("http://") || redirectUriOrPath.startsWith("https://")) {
|
|
1311
|
+
return redirectUriOrPath;
|
|
1312
|
+
}
|
|
1313
|
+
if (typeof window !== "undefined") {
|
|
1314
|
+
const path = redirectUriOrPath.startsWith("/") ? redirectUriOrPath : `/${redirectUriOrPath}`;
|
|
1315
|
+
return `${window.location.origin}${path}`;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (typeof window !== "undefined") {
|
|
1319
|
+
return window.location.href;
|
|
1320
|
+
}
|
|
1321
|
+
return void 0;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Bağlantı durumunu sorgular
|
|
1325
|
+
*/
|
|
1326
|
+
async getStatus(provider) {
|
|
1327
|
+
return this.request({
|
|
1328
|
+
method: "GET",
|
|
1329
|
+
url: `/api/admin/integrations/status/${encodeURIComponent(provider)}`
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Bağlantıyı keser (token siler)
|
|
1334
|
+
*/
|
|
1335
|
+
async disconnect(provider) {
|
|
1336
|
+
return this.request({
|
|
1337
|
+
method: "DELETE",
|
|
1338
|
+
url: `/api/admin/integrations/${encodeURIComponent(provider)}`
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Desteklenen provider listesini döner
|
|
1343
|
+
*/
|
|
1344
|
+
async listProviders() {
|
|
1345
|
+
return this.request({
|
|
1346
|
+
method: "GET",
|
|
1347
|
+
url: "/api/admin/integrations/providers/list"
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
/** HttpClient'ın baseURL'ini alır */
|
|
1351
|
+
getBaseUrl() {
|
|
1352
|
+
const baseURL = this.httpClient?.defaults?.baseURL;
|
|
1353
|
+
if (baseURL && typeof baseURL === "string") {
|
|
1354
|
+
return String(baseURL).replace(/\/$/, "");
|
|
1355
|
+
}
|
|
1356
|
+
return "http://localhost:3031";
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1262
1360
|
// src/resources/admin/cloudflare.ts
|
|
1263
1361
|
var CloudflareResource = class extends BaseResource {
|
|
1264
1362
|
constructor(httpClient) {
|
|
@@ -2045,6 +2143,7 @@ var AdminNamespace = class {
|
|
|
2045
2143
|
sections;
|
|
2046
2144
|
themes;
|
|
2047
2145
|
google;
|
|
2146
|
+
integrations;
|
|
2048
2147
|
cloudflare;
|
|
2049
2148
|
reviews;
|
|
2050
2149
|
customData;
|
|
@@ -2071,6 +2170,7 @@ var AdminNamespace = class {
|
|
|
2071
2170
|
this.sections = new SectionResource(client.instance);
|
|
2072
2171
|
this.themes = new ThemeResource(client.instance);
|
|
2073
2172
|
this.google = new GoogleResource(client.instance);
|
|
2173
|
+
this.integrations = new IntegrationsResource(client.instance);
|
|
2074
2174
|
this.cloudflare = new CloudflareResource(client.instance);
|
|
2075
2175
|
this.reviews = new ReviewResource(client.instance);
|
|
2076
2176
|
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.8",
|
|
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",
|