@playbasis-ai/qwikcard-sdk 2.3.10 → 2.3.12
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/CHANGELOG.md +12 -0
- package/dist/PlaybasisProvider.d.ts.map +1 -1
- package/dist/PlaybasisProvider.js +21 -3
- package/dist/web/widgetAssets.d.ts +2 -2
- package/dist/web/widgetAssets.d.ts.map +1 -1
- package/dist/web/widgetAssets.js +2 -2
- package/dist/web/widgetHtml.js +1 -1
- package/package.json +1 -1
- package/src/PlaybasisProvider.tsx +25 -6
- package/src/web/widgetAssets.ts +2 -4
- package/src/web/widgetHtml.ts +1 -1
package/dist/web/widgetHtml.js
CHANGED
package/package.json
CHANGED
|
@@ -29,6 +29,17 @@ interface PlaybasisProviderProps {
|
|
|
29
29
|
baseUrl?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const QWIK_BASE_URLS = {
|
|
33
|
+
production: 'https://apim-pb-production.azure-api.net/v1',
|
|
34
|
+
staging: 'https://apim-pb-staging.azure-api.net/playbasis/v1',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const resolveBaseUrl = (tenantId: string, baseUrl?: string) => {
|
|
38
|
+
if (baseUrl) return baseUrl;
|
|
39
|
+
if (tenantId.toLowerCase().includes('prod')) return QWIK_BASE_URLS.production;
|
|
40
|
+
return QWIK_BASE_URLS.staging;
|
|
41
|
+
};
|
|
42
|
+
|
|
32
43
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
33
44
|
// Provider Component
|
|
34
45
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -36,18 +47,26 @@ interface PlaybasisProviderProps {
|
|
|
36
47
|
export function PlaybasisProvider({
|
|
37
48
|
children,
|
|
38
49
|
apiKey,
|
|
39
|
-
tenantId
|
|
50
|
+
tenantId,
|
|
40
51
|
playerId,
|
|
41
|
-
baseUrl
|
|
52
|
+
baseUrl,
|
|
42
53
|
}: PlaybasisProviderProps) {
|
|
54
|
+
const resolvedTenantId =
|
|
55
|
+
tenantId ?? (baseUrl && baseUrl.includes('production') ? 'qwik-prod' : 'qwikcard');
|
|
56
|
+
const resolvedBaseUrl = resolveBaseUrl(resolvedTenantId, baseUrl);
|
|
43
57
|
const client = useMemo(
|
|
44
|
-
() => new PlaybasisClient({ apiKey, tenantId, baseUrl }),
|
|
45
|
-
[apiKey,
|
|
58
|
+
() => new PlaybasisClient({ apiKey, tenantId: resolvedTenantId, baseUrl: resolvedBaseUrl }),
|
|
59
|
+
[apiKey, resolvedTenantId, resolvedBaseUrl],
|
|
46
60
|
);
|
|
47
61
|
|
|
48
62
|
const value = useMemo(
|
|
49
|
-
() => ({
|
|
50
|
-
|
|
63
|
+
() => ({
|
|
64
|
+
client,
|
|
65
|
+
tenantId: resolvedTenantId,
|
|
66
|
+
playerId: playerId ?? null,
|
|
67
|
+
baseUrl: resolvedBaseUrl,
|
|
68
|
+
}),
|
|
69
|
+
[client, resolvedTenantId, playerId, resolvedBaseUrl],
|
|
51
70
|
);
|
|
52
71
|
|
|
53
72
|
return (
|