@explorins/pers-sdk-react-native 2.1.8 → 2.1.11

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.
@@ -1,8 +1,27 @@
1
- import type { CampaignClaimRequestDTO, CampaignDTO, CampaignClaimDTO, CampaignTriggerDTO, PaginatedResponseDTO, CampaignClaimIncludeRelation, CampaignIncludeRelation } from '@explorins/pers-shared';
1
+ import type { CampaignClaimRequestDTO, CampaignDTO, CampaignClaimDTO, CampaignTriggerDTO, PaginatedResponseDTO, CampaignClaimIncludeRelation, CampaignIncludeRelation, SortOrder } from '@explorins/pers-shared';
2
2
  import type { CampaignClaimFilters } from '@explorins/pers-sdk/campaign';
3
3
  export type { CampaignClaimFilters } from '@explorins/pers-sdk/campaign';
4
+ /**
5
+ * Options for fetching campaigns
6
+ */
7
+ export interface GetCampaignsOptions {
8
+ /** Filter by tag */
9
+ tag?: string;
10
+ /** Filter by business ID */
11
+ businessId?: string;
12
+ /** Page number (1-indexed) */
13
+ page?: number;
14
+ /** Items per page */
15
+ limit?: number;
16
+ /** Sort field */
17
+ sortBy?: 'name' | 'createdAt' | 'startDate';
18
+ /** Sort order */
19
+ sortOrder?: SortOrder;
20
+ /** Relations to include: 'triggerSources', 'businesses' */
21
+ include?: CampaignIncludeRelation[];
22
+ }
4
23
  export declare const useCampaigns: () => {
5
- getActiveCampaigns: () => Promise<PaginatedResponseDTO<CampaignDTO>>;
24
+ getActiveCampaigns: (options?: GetCampaignsOptions) => Promise<PaginatedResponseDTO<CampaignDTO>>;
6
25
  getCampaignById: (campaignId: string, include?: CampaignIncludeRelation[]) => Promise<CampaignDTO | null>;
7
26
  claimCampaign: (request: CampaignClaimRequestDTO) => Promise<CampaignClaimDTO | null>;
8
27
  getUserClaims: (options?: {
@@ -11,7 +30,9 @@ export declare const useCampaigns: () => {
11
30
  include?: CampaignClaimIncludeRelation[];
12
31
  }) => Promise<PaginatedResponseDTO<CampaignClaimDTO>>;
13
32
  getCampaignTriggers: () => Promise<PaginatedResponseDTO<CampaignTriggerDTO>>;
14
- getAllCampaigns: (active?: boolean) => Promise<PaginatedResponseDTO<CampaignDTO>>;
33
+ getAllCampaigns: (options?: GetCampaignsOptions & {
34
+ active?: boolean;
35
+ }) => Promise<PaginatedResponseDTO<CampaignDTO>>;
15
36
  getCampaignClaims: (filters?: CampaignClaimFilters, include?: CampaignClaimIncludeRelation[]) => Promise<PaginatedResponseDTO<CampaignClaimDTO>>;
16
37
  getCampaignClaimsByUserId: (userId: string, include?: CampaignClaimIncludeRelation[]) => Promise<PaginatedResponseDTO<CampaignClaimDTO>>;
17
38
  getCampaignClaimsByBusinessId: (businessId: string, include?: CampaignClaimIncludeRelation[]) => Promise<PaginatedResponseDTO<CampaignClaimDTO>>;
@@ -1 +1 @@
1
- {"version":3,"file":"useCampaigns.d.ts","sourceRoot":"","sources":["../../src/hooks/useCampaigns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,eAAO,MAAM,YAAY;8BAG0B,QAAQ,qBAAqB,WAAW,CAAC,CAAC;kCA6B7E,MAAM,YACR,uBAAuB,EAAE,KAClC,QAAQ,WAAW,GAAG,IAAI,CAAC;6BAcoB,uBAAuB,KAAG,QAAQ,gBAAgB,GAAG,IAAI,CAAC;8BAmCzD;QACjD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,4BAA4B,EAAE,CAAC;KAC1C,KAAG,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;+BAkBD,QAAQ,qBAAqB,kBAAkB,CAAC,CAAC;+BAe/C,OAAO,KAAG,QAAQ,qBAAqB,WAAW,CAAC,CAAC;kCA+B5F,oBAAoB,YACpB,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;wCAsBxC,MAAM,YACJ,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;gDAsBpC,MAAM,YACR,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;sCA4CpC,MAAM,mBACD,MAAM,KACtB,QAAQ,WAAW,CAAC;sCA4BT,MAAM,mBACD,MAAM,KACtB,QAAQ,WAAW,CAAC;;CA+BxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"useCampaigns.d.ts","sourceRoot":"","sources":["../../src/hooks/useCampaigns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,EACvB,SAAS,EACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;IAC5C,iBAAiB;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,YAAY;mCA6BX,mBAAmB,KAC5B,QAAQ,qBAAqB,WAAW,CAAC,CAAC;kCAgC/B,MAAM,YACR,uBAAuB,EAAE,KAClC,QAAQ,WAAW,GAAG,IAAI,CAAC;6BAcoB,uBAAuB,KAAG,QAAQ,gBAAgB,GAAG,IAAI,CAAC;8BAmCzD;QACjD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,4BAA4B,EAAE,CAAC;KAC1C,KAAG,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;+BAkBD,QAAQ,qBAAqB,kBAAkB,CAAC,CAAC;gCA0CvF,mBAAmB,GAAG;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KACnD,QAAQ,qBAAqB,WAAW,CAAC,CAAC;kCA+BjC,oBAAoB,YACpB,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;wCAsBxC,MAAM,YACJ,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;gDAsBpC,MAAM,YACR,4BAA4B,EAAE,KACvC,QAAQ,qBAAqB,gBAAgB,CAAC,CAAC;sCA4CpC,MAAM,mBACD,MAAM,KACtB,QAAQ,WAAW,CAAC;sCA4BT,MAAM,mBACD,MAAM,KACtB,QAAQ,WAAW,CAAC;;CA+BxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -2,12 +2,40 @@ import { useCallback } from 'react';
2
2
  import { usePersSDK } from '../providers/PersSDKProvider';
3
3
  export const useCampaigns = () => {
4
4
  const { sdk, isInitialized, isAuthenticated } = usePersSDK();
5
- const getActiveCampaigns = useCallback(async () => {
5
+ /**
6
+ * Get active campaigns with optional filters and include relations
7
+ *
8
+ * @param options - Filter, pagination, and include options
9
+ * @returns Promise resolving to paginated active campaigns
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Simple: get active campaigns with trigger sources
14
+ * const { data: campaigns } = await getActiveCampaigns({ include: ['triggerSources'] });
15
+ *
16
+ * // With pagination
17
+ * const { data, pagination } = await getActiveCampaigns({
18
+ * page: 1,
19
+ * limit: 10,
20
+ * include: ['triggerSources', 'businesses']
21
+ * });
22
+ *
23
+ * // Filter by tag
24
+ * const { data } = await getActiveCampaigns({ tag: 'summer-promo' });
25
+ *
26
+ * // Filter by business
27
+ * const { data } = await getActiveCampaigns({ businessId: 'business-123' });
28
+ * ```
29
+ */
30
+ const getActiveCampaigns = useCallback(async (options) => {
6
31
  if (!isInitialized || !sdk) {
7
32
  throw new Error('SDK not initialized. Call initialize() first.');
8
33
  }
9
34
  try {
10
- const result = await sdk.campaigns.getCampaigns({ active: true });
35
+ const result = await sdk.campaigns.getCampaigns({
36
+ active: true,
37
+ ...options
38
+ });
11
39
  return result;
12
40
  }
13
41
  catch (error) {
@@ -107,12 +135,38 @@ export const useCampaigns = () => {
107
135
  }
108
136
  }, [sdk, isInitialized]);
109
137
  // Admin methods
110
- const getAllCampaigns = useCallback(async (active) => {
138
+ /**
139
+ * Admin: Get all campaigns with optional filters and include relations
140
+ *
141
+ * @param options - Filter, pagination, and include options (same as getActiveCampaigns but active is optional)
142
+ * @returns Promise resolving to paginated campaigns
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * // Get all campaigns
147
+ * const { data } = await getAllCampaigns();
148
+ *
149
+ * // Get only active campaigns with trigger sources
150
+ * const { data } = await getAllCampaigns({ active: true, include: ['triggerSources'] });
151
+ *
152
+ * // Get inactive campaigns
153
+ * const { data } = await getAllCampaigns({ active: false });
154
+ *
155
+ * // With pagination and sorting
156
+ * const { data } = await getAllCampaigns({
157
+ * page: 1,
158
+ * limit: 20,
159
+ * sortBy: 'createdAt',
160
+ * sortOrder: 'DESC'
161
+ * });
162
+ * ```
163
+ */
164
+ const getAllCampaigns = useCallback(async (options) => {
111
165
  if (!isInitialized || !sdk) {
112
166
  throw new Error('SDK not initialized. Call initialize() first.');
113
167
  }
114
168
  try {
115
- const result = await sdk.campaigns.getCampaigns({ active });
169
+ const result = await sdk.campaigns.getCampaigns(options);
116
170
  return result;
117
171
  }
118
172
  catch (error) {
package/dist/index.js CHANGED
@@ -2933,15 +2933,42 @@ exports.PurchaseCurrency = void 0;
2933
2933
  })(exports.PurchaseCurrency || (exports.PurchaseCurrency = {}));
2934
2934
 
2935
2935
  /**
2936
- * Trigger Source Types
2937
- * Defines the different types of triggers that can activate a campaign flow
2936
+ * Trigger Source Types - HOW a claim is triggered (the touchpoint mechanism)
2937
+ *
2938
+ * This defines the physical/digital interaction method for triggering claims.
2939
+ * NOT to be confused with CampaignTriggerType which defines WHO can claim.
2940
+ *
2941
+ * Relationship:
2942
+ * - campaign.trigger.triggerType → WHO can claim (CLAIM_BY_USER, CLAIM_BY_BUSINESS, CLAIM_BY_SYSTEM)
2943
+ * - campaign.triggerSources[].type → HOW to claim (QR_CODE, NFC_TAG, GPS_GEOFENCE, etc.)
2944
+ *
2945
+ * Access via: campaign.included?.triggerSources?.map(ts => ts.type)
2946
+ *
2947
+ * App Integration Guide:
2948
+ * - QR_CODE: Open camera/scanner, decode QR, extract triggerSourceId
2949
+ * - NFC_TAG: Activate NFC reader, read tag data, extract triggerSourceId
2950
+ * - GPS_GEOFENCE: Get user location, send latitude/longitude with claim
2951
+ * - API_WEBHOOK: Server-to-server, external system triggers claim
2952
+ * - TRANSACTION: Triggered by purchase events (Stripe, POS, etc.)
2953
+ *
2954
+ * NOTE: A campaign can have MULTIPLE trigger sources of different types.
2955
+ * Example: Same campaign claimable via QR_CODE OR NFC_TAG at different locations.
2956
+ *
2938
2957
  * Using const object pattern for better extensibility without requiring deploys
2958
+ *
2959
+ * @see CampaignTriggerType for WHO can initiate claims
2960
+ * @see CampaignClaimRequestDTO for the claim payload structure
2939
2961
  */
2940
2962
  const TRIGGER_SOURCE_TYPES = {
2963
+ /** Physical QR code scan. App opens camera, decodes QR, extracts triggerSourceId */
2941
2964
  QR_CODE: 'QR_CODE',
2965
+ /** NFC tag tap. App activates NFC reader, reads tag data, extracts triggerSourceId */
2942
2966
  NFC_TAG: 'NFC_TAG',
2967
+ /** Server-to-server webhook. External system triggers claim via API */
2943
2968
  API_WEBHOOK: 'API_WEBHOOK',
2969
+ /** GPS-based geofence entry. App sends user coordinates for proximity validation */
2944
2970
  GPS_GEOFENCE: 'GPS_GEOFENCE',
2971
+ /** Purchase/transaction triggered. Claim activated by payment events */
2945
2972
  TRANSACTION: 'TRANSACTION',
2946
2973
  };
2947
2974
  // Export values array for validation
@@ -2967,10 +2994,46 @@ exports.CampaignConditionType = void 0;
2967
2994
  CampaignConditionType["IS_PART_OF"] = "IS_PART_OF";
2968
2995
  })(exports.CampaignConditionType || (exports.CampaignConditionType = {}));
2969
2996
 
2997
+ /**
2998
+ * Campaign Trigger Type - WHO can initiate a claim
2999
+ *
3000
+ * This defines the authentication/authorization context for claiming rewards.
3001
+ * NOT to be confused with TriggerSourceType which defines HOW to claim (QR, NFC, etc.)
3002
+ *
3003
+ * Relationship:
3004
+ * - campaign.trigger.triggerType → WHO can claim (CLAIM_BY_USER, CLAIM_BY_BUSINESS, CLAIM_BY_SYSTEM)
3005
+ * - campaign.triggerSources[].type → HOW to claim (QR_CODE, NFC_TAG, GPS_GEOFENCE, etc.)
3006
+ *
3007
+ * Example Flow:
3008
+ * 1. Campaign has triggerType=CLAIM_BY_USER (users initiate claims)
3009
+ * 2. Campaign has triggerSources with type=QR_CODE (via QR scan)
3010
+ * 3. User scans QR code → App calls claimCampaign with triggerSourceId
3011
+ *
3012
+ * @see TriggerSourceType for HOW claims are triggered
3013
+ * @see CampaignClaimRequestDTO for the claim payload structure
3014
+ */
2970
3015
  exports.CampaignTriggerType = void 0;
2971
3016
  (function (CampaignTriggerType) {
3017
+ /**
3018
+ * User-initiated claims. The end user triggers the claim action.
3019
+ * App determines HOW via campaign.triggerSources[].type:
3020
+ * - QR_CODE: Open camera/scanner
3021
+ * - NFC_TAG: Activate NFC reader
3022
+ * - GPS_GEOFENCE: Send user location
3023
+ * - TRANSACTION: Triggered by purchase
3024
+ */
2972
3025
  CampaignTriggerType["CLAIM_BY_USER"] = "CLAIM_BY_USER";
3026
+ /**
3027
+ * System/server-initiated claims. Automated processes trigger claims.
3028
+ * Use cases: webhooks, scheduled jobs, backend integrations.
3029
+ * Requires tenant API key authentication.
3030
+ */
2973
3031
  CampaignTriggerType["CLAIM_BY_SYSTEM"] = "CLAIM_BY_SYSTEM";
3032
+ /**
3033
+ * Business-initiated claims. A business claims on behalf of users.
3034
+ * Use cases: POS systems, staff-assisted redemptions, kiosks.
3035
+ * Requires business authentication + user identifier.
3036
+ */
2974
3037
  CampaignTriggerType["CLAIM_BY_BUSINESS"] = "CLAIM_BY_BUSINESS";
2975
3038
  })(exports.CampaignTriggerType || (exports.CampaignTriggerType = {}));
2976
3039
 
@@ -7703,15 +7766,26 @@ class TenantApi {
7703
7766
  // ==========================================
7704
7767
  // PUBLIC OPERATIONS
7705
7768
  // ==========================================
7769
+ /**
7770
+ * API KEY + ADMIN JWT: Get full tenant information including sensitive config
7771
+ * Uses /tenants/me endpoint with Admin JWT authentication
7772
+ *
7773
+ * Requires: X-API-Key header + Authorization Bearer token (Admin JWT)
7774
+ * Returns: Full tenant information including allowedTokenIssuers and sensitive config
7775
+ */
7776
+ async getRemoteTenant() {
7777
+ const timestamp = Date.now().toString();
7778
+ const url = `${this.basePath}/me?date=${timestamp}`;
7779
+ return this.apiClient.get(url);
7780
+ }
7706
7781
  /**
7707
7782
  * API KEY: Get current tenant public information
7708
- * UPDATED: Uses /tenants/me endpoint with API key authentication
7783
+ * Uses /tenants/me endpoint with API key authentication
7709
7784
  *
7710
7785
  * Requires: X-API-Key header (handled by PersApiClient)
7711
- * Returns: Enhanced public tenant information for the authenticated project
7786
+ * Returns: Public tenant information (no sensitive config)
7712
7787
  */
7713
- async getRemoteTenant() {
7714
- // Remove cache busting - not needed for authenticated endpoint
7788
+ async getRemoteTenantPublic() {
7715
7789
  const timestamp = Date.now().toString();
7716
7790
  const url = `${this.basePath}/me?date=${timestamp}`;
7717
7791
  return this.apiClient.get(url);
@@ -7748,7 +7822,8 @@ class TenantApi {
7748
7822
  // ==========================================
7749
7823
  /**
7750
7824
  * ADMIN: Update tenant information
7751
- * UPDATED: Uses PUT /tenants (admin endpoint)
7825
+ * UPDATED: Uses PUT /tenants (admin endpoint)
7826
+ * Returns full TenantDTO including sensitive config
7752
7827
  */
7753
7828
  async updateRemoteTenant(tenantData) {
7754
7829
  return this.apiClient.put(`${this.basePath}`, tenantData);
@@ -7793,11 +7868,17 @@ class TenantService {
7793
7868
  // PUBLIC OPERATIONS
7794
7869
  // ==========================================
7795
7870
  /**
7796
- * PUBLIC: Get tenant public information
7871
+ * Get full tenant information (Admin JWT required)
7797
7872
  */
7798
7873
  async getRemoteTenant() {
7799
7874
  return this.tenantApi.getRemoteTenant();
7800
7875
  }
7876
+ /**
7877
+ * PUBLIC: Get tenant public information (API key only)
7878
+ */
7879
+ async getRemoteTenantPublic() {
7880
+ return this.tenantApi.getRemoteTenantPublic();
7881
+ }
7801
7882
  /**
7802
7883
  * PUBLIC: Get remote login token
7803
7884
  */
@@ -7815,7 +7896,7 @@ class TenantService {
7815
7896
  // ==========================================
7816
7897
  /**
7817
7898
  * ADMIN: Update tenant information
7818
- * ✅ FIXED: Uses TenantPublicDTO directly like framework
7899
+ * Returns full TenantDTO including sensitive config
7819
7900
  */
7820
7901
  async updateRemoteTenant(tenantData) {
7821
7902
  return this.tenantApi.updateRemoteTenant(tenantData);
@@ -7859,9 +7940,20 @@ class TenantManager {
7859
7940
  this.tenantService = new TenantService(tenantApi);
7860
7941
  }
7861
7942
  /**
7862
- * Get current tenant information
7943
+ * Get current tenant public information (API key only)
7944
+ *
7945
+ * @returns Promise resolving to public tenant data
7946
+ */
7947
+ async getTenantPublicInfo() {
7948
+ return this.tenantService.getRemoteTenantPublic();
7949
+ }
7950
+ /**
7951
+ * Get full tenant information including sensitive config (Admin JWT required)
7952
+ *
7953
+ * Returns additional fields like allowedTokenIssuers that are only
7954
+ * available to authenticated tenant admins.
7863
7955
  *
7864
- * @returns Promise resolving to tenant data
7956
+ * @returns Promise resolving to full tenant data
7865
7957
  */
7866
7958
  async getTenantInfo() {
7867
7959
  return this.tenantService.getRemoteTenant();
@@ -7944,7 +8036,7 @@ class TenantManager {
7944
8036
  * Admin: Update tenant data
7945
8037
  *
7946
8038
  * @param tenantData - Updated tenant data
7947
- * @returns Promise resolving to updated tenant
8039
+ * @returns Promise resolving to full updated tenant (includes sensitive config)
7948
8040
  */
7949
8041
  async updateTenant(tenantData) {
7950
8042
  return this.tenantService.updateRemoteTenant(tenantData);
@@ -41248,12 +41340,40 @@ const useBusiness = () => {
41248
41340
 
41249
41341
  const useCampaigns = () => {
41250
41342
  const { sdk, isInitialized, isAuthenticated } = usePersSDK();
41251
- const getActiveCampaigns = react.useCallback(async () => {
41343
+ /**
41344
+ * Get active campaigns with optional filters and include relations
41345
+ *
41346
+ * @param options - Filter, pagination, and include options
41347
+ * @returns Promise resolving to paginated active campaigns
41348
+ *
41349
+ * @example
41350
+ * ```typescript
41351
+ * // Simple: get active campaigns with trigger sources
41352
+ * const { data: campaigns } = await getActiveCampaigns({ include: ['triggerSources'] });
41353
+ *
41354
+ * // With pagination
41355
+ * const { data, pagination } = await getActiveCampaigns({
41356
+ * page: 1,
41357
+ * limit: 10,
41358
+ * include: ['triggerSources', 'businesses']
41359
+ * });
41360
+ *
41361
+ * // Filter by tag
41362
+ * const { data } = await getActiveCampaigns({ tag: 'summer-promo' });
41363
+ *
41364
+ * // Filter by business
41365
+ * const { data } = await getActiveCampaigns({ businessId: 'business-123' });
41366
+ * ```
41367
+ */
41368
+ const getActiveCampaigns = react.useCallback(async (options) => {
41252
41369
  if (!isInitialized || !sdk) {
41253
41370
  throw new Error('SDK not initialized. Call initialize() first.');
41254
41371
  }
41255
41372
  try {
41256
- const result = await sdk.campaigns.getCampaigns({ active: true });
41373
+ const result = await sdk.campaigns.getCampaigns({
41374
+ active: true,
41375
+ ...options
41376
+ });
41257
41377
  return result;
41258
41378
  }
41259
41379
  catch (error) {
@@ -41353,12 +41473,38 @@ const useCampaigns = () => {
41353
41473
  }
41354
41474
  }, [sdk, isInitialized]);
41355
41475
  // Admin methods
41356
- const getAllCampaigns = react.useCallback(async (active) => {
41476
+ /**
41477
+ * Admin: Get all campaigns with optional filters and include relations
41478
+ *
41479
+ * @param options - Filter, pagination, and include options (same as getActiveCampaigns but active is optional)
41480
+ * @returns Promise resolving to paginated campaigns
41481
+ *
41482
+ * @example
41483
+ * ```typescript
41484
+ * // Get all campaigns
41485
+ * const { data } = await getAllCampaigns();
41486
+ *
41487
+ * // Get only active campaigns with trigger sources
41488
+ * const { data } = await getAllCampaigns({ active: true, include: ['triggerSources'] });
41489
+ *
41490
+ * // Get inactive campaigns
41491
+ * const { data } = await getAllCampaigns({ active: false });
41492
+ *
41493
+ * // With pagination and sorting
41494
+ * const { data } = await getAllCampaigns({
41495
+ * page: 1,
41496
+ * limit: 20,
41497
+ * sortBy: 'createdAt',
41498
+ * sortOrder: 'DESC'
41499
+ * });
41500
+ * ```
41501
+ */
41502
+ const getAllCampaigns = react.useCallback(async (options) => {
41357
41503
  if (!isInitialized || !sdk) {
41358
41504
  throw new Error('SDK not initialized. Call initialize() first.');
41359
41505
  }
41360
41506
  try {
41361
- const result = await sdk.campaigns.getCampaigns({ active });
41507
+ const result = await sdk.campaigns.getCampaigns(options);
41362
41508
  return result;
41363
41509
  }
41364
41510
  catch (error) {