@explorins/pers-sdk-react-native 2.1.10 → 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.
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);