@golocalinteractive/golocal-cloud-wrapper 1.0.68 → 1.0.69

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 CHANGED
@@ -135,7 +135,7 @@ export async function GET() {
135
135
  Then use in your components:
136
136
 
137
137
  ```jsx
138
- import { PermissionsProvider, usePermissions } from "@golocalinteractive/golocal-cloud-wrapper";
138
+ import { PermissionsProvider, usePermissions, useProductAccess } from "@golocalinteractive/golocal-cloud-wrapper";
139
139
 
140
140
  function App() {
141
141
  return (
@@ -145,6 +145,7 @@ function App() {
145
145
  );
146
146
  }
147
147
 
148
+ // Option 1: Using usePermissions (original way)
148
149
  function YourComponent() {
149
150
  const { permissions, loading, error } = usePermissions();
150
151
 
@@ -160,6 +161,24 @@ function YourComponent() {
160
161
  </div>
161
162
  );
162
163
  }
164
+
165
+ // Option 2: Using useProductAccess (shorthand access)
166
+ function YourComponentShorthand() {
167
+ const { essentialInsights, organic, paid, web, priceMonster, se_company_id, loading, error } = useProductAccess();
168
+
169
+ if (loading) return <div>Loading...</div>;
170
+
171
+ return (
172
+ <div>
173
+ {essentialInsights && <EssentialInsightsContent />}
174
+ {organic && <OrganicContent />}
175
+ {paid && <PaidContent />}
176
+ {web && <WebContent />}
177
+ {priceMonster && <PriceMonsterContent />}
178
+ <p>Company ID: {se_company_id}</p>
179
+ </div>
180
+ );
181
+ }
163
182
  ```
164
183
 
165
184
  #### Server-Side Permissions
@@ -7,6 +7,18 @@ interface PermissionsContextValue {
7
7
  fetchPermissions: () => Promise<void>;
8
8
  }
9
9
  export declare const usePermissions: () => PermissionsContextValue;
10
+ export declare const useProductAccess: () => {
11
+ essentialInsights: boolean;
12
+ organic: boolean;
13
+ paid: boolean;
14
+ web: boolean;
15
+ priceMonster: boolean;
16
+ se_company_id: string | null;
17
+ permissions: ProductAccess;
18
+ loading: boolean;
19
+ error: Error | null;
20
+ fetchPermissions: () => Promise<void>;
21
+ };
10
22
  interface PermissionsProviderProps {
11
23
  children: ReactNode;
12
24
  fetchPermissionsEndpoint?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionsContext.d.ts","sourceRoot":"","sources":["../../src/context/PermissionsContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,UAAU,uBAAuB;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAMD,eAAO,MAAM,cAAc,+BAM1B,CAAC;AAEF,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,aAAa,CAAC;CACpC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,wBAAkD,EAClD,kBAAkB,GACnB,EAAE,wBAAwB,2CA6C1B"}
1
+ {"version":3,"file":"PermissionsContext.d.ts","sourceRoot":"","sources":["../../src/context/PermissionsContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,UAAU,uBAAuB;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAMD,eAAO,MAAM,cAAc,+BAM1B,CAAC;AAGF,eAAO,MAAM,gBAAgB;;;;;;;;;;4BAhBH,OAAO,CAAC,IAAI,CAAC;CAkCtC,CAAC;AAEF,UAAU,wBAAwB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,aAAa,CAAC;CACpC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,wBAAkD,EAClD,kBAAkB,GACnB,EAAE,wBAAwB,2CA6C1B"}