@getmicdrop/svelte-components 5.20.0 → 5.20.1
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/config.d.ts +13 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -5
- package/dist/index.js +2 -2
- package/dist/primitives/Input/Input.svelte +1 -1
- package/dist/recipes/SuperLogin/SuperLogin.svelte +5 -4
- package/dist/recipes/SuperLogin/SuperLogin.svelte.d.ts.map +1 -1
- package/dist/telemetry.d.ts +5 -5
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +10 -11
- package/dist/telemetry.spec.js +108 -8
- package/dist/utils/apiConfig.js +30 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +2 -1
- package/package.json +2 -6
- package/dist/utils/apiConfig.spec.d.ts +0 -2
- package/dist/utils/apiConfig.spec.d.ts.map +0 -1
- package/dist/utils/apiConfig.spec.js +0 -226
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Configure runtime values (call once at app startup).
|
|
3
|
+
* SvelteKit apps should call this in their root layout with env values.
|
|
4
|
+
* @param {{ apiBaseUrl?: string, googleMapsApiKey?: string }} opts
|
|
5
|
+
*/
|
|
6
|
+
export function configureApp(opts?: {
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
googleMapsApiKey?: string;
|
|
9
|
+
}): void;
|
|
10
|
+
/** @type {string} */
|
|
11
|
+
export let API_BASE_URL: string;
|
|
12
|
+
/** @type {string} */
|
|
13
|
+
export let PUBLIC_GOOGLE_MAPS_API_KEY: string;
|
|
3
14
|
export namespace STRING_LIMITS {
|
|
4
15
|
let EVENT_TITLE_MIN: number;
|
|
5
16
|
let EVENT_TITLE_MAX: number;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/lib/config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/lib/config.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oCAFW;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,QAK5D;AAdD,qBAAqB;AACrB,yBADW,MAAM,CACmC;AAEpD,qBAAqB;AACrB,uCADW,MAAM,CACiE"}
|
package/dist/config.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @type {string} */
|
|
2
|
+
export let API_BASE_URL = 'https://get-micdrop.com';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/** @type {string} */
|
|
5
|
+
export let PUBLIC_GOOGLE_MAPS_API_KEY = 'AIzaSyCFB0-9qay7P0jZZDw93SsTnyLtZDlch7Q';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configure runtime values (call once at app startup).
|
|
9
|
+
* SvelteKit apps should call this in their root layout with env values.
|
|
10
|
+
* @param {{ apiBaseUrl?: string, googleMapsApiKey?: string }} opts
|
|
11
|
+
*/
|
|
12
|
+
export function configureApp(opts = {}) {
|
|
13
|
+
if (opts.apiBaseUrl) API_BASE_URL = opts.apiBaseUrl;
|
|
14
|
+
if (opts.googleMapsApiKey) PUBLIC_GOOGLE_MAPS_API_KEY = opts.googleMapsApiKey;
|
|
15
|
+
}
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
18
|
* String length limits for validation schemas
|
package/dist/index.js
CHANGED
|
@@ -32,8 +32,8 @@ export * from './calendar/index.js';
|
|
|
32
32
|
// NON-COMPONENT EXPORTS
|
|
33
33
|
// =============================================================================
|
|
34
34
|
|
|
35
|
-
// Note: config.js and telemetry.js
|
|
36
|
-
//
|
|
35
|
+
// Note: config.js and telemetry.js are exported separately via package.json.
|
|
36
|
+
// They are not re-exported here to avoid pulling in env-dependent code.
|
|
37
37
|
|
|
38
38
|
// Constants
|
|
39
39
|
export * from './constants/formOptions.js';
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
{:else}
|
|
354
354
|
<div class="relative flex items-center w-full">
|
|
355
355
|
{#if leftIcon}
|
|
356
|
-
<div class="absolute left-3
|
|
356
|
+
<div class="absolute left-3 inset-y-0 flex items-center text-gray-400 z-10 pointer-events-none">
|
|
357
357
|
{@render leftIcon()}
|
|
358
358
|
</div>
|
|
359
359
|
{/if}
|
|
@@ -404,8 +404,9 @@
|
|
|
404
404
|
saveRememberedUser(emailValue, data.firstName);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
// Call the success callback
|
|
408
|
-
|
|
407
|
+
// Call the success callback and wait for it to complete
|
|
408
|
+
// (consumers may fetch contexts/user data needed for routing)
|
|
409
|
+
await onLoginSuccess({
|
|
409
410
|
token: data.token,
|
|
410
411
|
refreshToken: data.refreshToken || data.refreshtoken,
|
|
411
412
|
firstName: data.firstName,
|
|
@@ -468,8 +469,8 @@
|
|
|
468
469
|
const data = await response.json();
|
|
469
470
|
// Keep loading state until navigation completes (don't set isLoading = false)
|
|
470
471
|
|
|
471
|
-
// Call the success callback
|
|
472
|
-
onLoginSuccess({
|
|
472
|
+
// Call the success callback and wait for it to complete
|
|
473
|
+
await onLoginSuccess({
|
|
473
474
|
token: data.token,
|
|
474
475
|
refreshToken: data.refreshToken || data.refreshtoken,
|
|
475
476
|
email: emailValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperLogin.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/recipes/SuperLogin/SuperLogin.svelte.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"SuperLogin.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/recipes/SuperLogin/SuperLogin.svelte.js"],"names":[],"mappings":";;;;;AAmjCA;iBAj7BkC,MAAM;cAAY,MAAM;cAAY,MAAM;kBAAgB,MAAM;kBAAgB,OAAO;gBAAc,MAAM;gBAAc,MAAM;iBAAe,MAAM;0BAAwB,MAAM;wBAAsB,MAAM;aAAW,MAAM;;;;;yBAAoI,OAAO;mBAAiB,MAAM;aAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAi7BxY;wBAj7BtC;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,WAAW;IAAC,eAAe,CAAC,WAAW;IAAC,UAAU,CAAC,WAAW;IAAC,kBAAkB,CAAC,WAAW;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE"}
|
package/dist/telemetry.d.ts
CHANGED
|
@@ -20,13 +20,13 @@ export function shutdownTelemetry(): Promise<void>;
|
|
|
20
20
|
*/
|
|
21
21
|
export function setupAutoTelemetry(): void;
|
|
22
22
|
export function getTelemetryConfig(): {
|
|
23
|
-
serviceName:
|
|
24
|
-
serviceVersion:
|
|
25
|
-
environment:
|
|
26
|
-
otlpEndpoint:
|
|
23
|
+
serviceName: string;
|
|
24
|
+
serviceVersion: string;
|
|
25
|
+
environment: string;
|
|
26
|
+
otlpEndpoint: string;
|
|
27
27
|
tracesEnabled: boolean;
|
|
28
28
|
sampleRate: number;
|
|
29
29
|
consoleDebug: boolean;
|
|
30
|
-
portalType:
|
|
30
|
+
portalType: string;
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=telemetry.d.ts.map
|
package/dist/telemetry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/lib/telemetry.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/lib/telemetry.js"],"names":[],"mappings":"AAkDA;;;GAGG;AACH,6CAFW,MAAM,QAsIhB;AAGD,wDAcC;AAGD;;SAMC;AAGD,mEAeC;AAGD,kEAcC;AAGD,2DAmBC;AAGD,4GAkBC;AAGD,kEAeC;AAGD,uEAeC;AAGD,mDASC;AAgCD;;;GAGG;AACH,2CAkBC;AAGD;;;;;;;;;EAEC"}
|
package/dist/telemetry.js
CHANGED
|
@@ -16,19 +16,18 @@ import {
|
|
|
16
16
|
} from '@opentelemetry/semantic-conventions';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Default telemetry configuration.
|
|
20
|
+
* Apps should pass their config to initTelemetry() at startup.
|
|
21
21
|
*/
|
|
22
22
|
const TELEMETRY_CONFIG = {
|
|
23
|
-
serviceName:
|
|
24
|
-
serviceVersion:
|
|
25
|
-
environment:
|
|
26
|
-
otlpEndpoint:
|
|
27
|
-
tracesEnabled:
|
|
28
|
-
sampleRate:
|
|
29
|
-
consoleDebug:
|
|
30
|
-
|
|
31
|
-
portalType: import.meta.env.VITE_PORTAL_TYPE || 'unknown',
|
|
23
|
+
serviceName: 'micdrop-app',
|
|
24
|
+
serviceVersion: '1.0.0',
|
|
25
|
+
environment: 'development',
|
|
26
|
+
otlpEndpoint: 'http://localhost:4318/v1/traces',
|
|
27
|
+
tracesEnabled: false,
|
|
28
|
+
sampleRate: 0.1,
|
|
29
|
+
consoleDebug: false,
|
|
30
|
+
portalType: 'unknown',
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
// Default CORS URLs for trace propagation - apps can extend this
|
package/dist/telemetry.spec.js
CHANGED
|
@@ -834,7 +834,7 @@ describe('Telemetry tracking with initialized tracer', () => {
|
|
|
834
834
|
shutdown: vi.fn().mockResolvedValue(undefined),
|
|
835
835
|
};
|
|
836
836
|
|
|
837
|
-
// Mock
|
|
837
|
+
// Mock all OpenTelemetry dependencies needed by initTelemetry
|
|
838
838
|
vi.doMock('@opentelemetry/sdk-trace-web', () => ({
|
|
839
839
|
WebTracerProvider: class MockWebTracerProviderForTracking {
|
|
840
840
|
constructor() {
|
|
@@ -843,11 +843,51 @@ describe('Telemetry tracking with initialized tracer', () => {
|
|
|
843
843
|
},
|
|
844
844
|
}));
|
|
845
845
|
|
|
846
|
-
// Mock registerInstrumentations to avoid instrumentation errors
|
|
847
846
|
vi.doMock('@opentelemetry/instrumentation', () => ({
|
|
848
847
|
registerInstrumentations: vi.fn(),
|
|
849
848
|
}));
|
|
850
849
|
|
|
850
|
+
vi.doMock('@opentelemetry/resources', () => ({
|
|
851
|
+
resourceFromAttributes: vi.fn().mockReturnValue({}),
|
|
852
|
+
}));
|
|
853
|
+
|
|
854
|
+
vi.doMock('@opentelemetry/exporter-trace-otlp-http', () => ({
|
|
855
|
+
OTLPTraceExporter: class { constructor() {} },
|
|
856
|
+
}));
|
|
857
|
+
|
|
858
|
+
vi.doMock('@opentelemetry/sdk-trace-base', () => ({
|
|
859
|
+
BatchSpanProcessor: class { constructor() {} },
|
|
860
|
+
}));
|
|
861
|
+
|
|
862
|
+
vi.doMock('@opentelemetry/context-zone', () => ({
|
|
863
|
+
ZoneContextManager: class { constructor() {} },
|
|
864
|
+
}));
|
|
865
|
+
|
|
866
|
+
vi.doMock('@opentelemetry/propagator-b3', () => ({
|
|
867
|
+
B3Propagator: class { constructor() {} },
|
|
868
|
+
}));
|
|
869
|
+
|
|
870
|
+
vi.doMock('@opentelemetry/semantic-conventions', () => ({
|
|
871
|
+
ATTR_SERVICE_NAME: 'service.name',
|
|
872
|
+
ATTR_SERVICE_VERSION: 'service.version',
|
|
873
|
+
}));
|
|
874
|
+
|
|
875
|
+
vi.doMock('@opentelemetry/instrumentation-document-load', () => ({
|
|
876
|
+
DocumentLoadInstrumentation: class { constructor() {} },
|
|
877
|
+
}));
|
|
878
|
+
|
|
879
|
+
vi.doMock('@opentelemetry/instrumentation-fetch', () => ({
|
|
880
|
+
FetchInstrumentation: class { constructor() {} },
|
|
881
|
+
}));
|
|
882
|
+
|
|
883
|
+
vi.doMock('@opentelemetry/instrumentation-user-interaction', () => ({
|
|
884
|
+
UserInteractionInstrumentation: class { constructor() {} },
|
|
885
|
+
}));
|
|
886
|
+
|
|
887
|
+
vi.doMock('@opentelemetry/instrumentation-xml-http-request', () => ({
|
|
888
|
+
XMLHttpRequestInstrumentation: class { constructor() {} },
|
|
889
|
+
}));
|
|
890
|
+
|
|
851
891
|
global.window = {
|
|
852
892
|
location: {
|
|
853
893
|
pathname: '/performers',
|
|
@@ -874,14 +914,24 @@ describe('Telemetry tracking with initialized tracer', () => {
|
|
|
874
914
|
|
|
875
915
|
telemetry = await import('./telemetry.js');
|
|
876
916
|
|
|
877
|
-
// Initialize telemetry to set up tracer
|
|
878
|
-
telemetry.initTelemetry();
|
|
917
|
+
// Initialize telemetry with tracing enabled to set up tracer
|
|
918
|
+
telemetry.initTelemetry({ tracesEnabled: true });
|
|
879
919
|
});
|
|
880
920
|
|
|
881
921
|
afterEach(() => {
|
|
882
922
|
vi.clearAllMocks();
|
|
883
923
|
vi.doUnmock('@opentelemetry/sdk-trace-web');
|
|
884
924
|
vi.doUnmock('@opentelemetry/instrumentation');
|
|
925
|
+
vi.doUnmock('@opentelemetry/resources');
|
|
926
|
+
vi.doUnmock('@opentelemetry/exporter-trace-otlp-http');
|
|
927
|
+
vi.doUnmock('@opentelemetry/sdk-trace-base');
|
|
928
|
+
vi.doUnmock('@opentelemetry/context-zone');
|
|
929
|
+
vi.doUnmock('@opentelemetry/propagator-b3');
|
|
930
|
+
vi.doUnmock('@opentelemetry/semantic-conventions');
|
|
931
|
+
vi.doUnmock('@opentelemetry/instrumentation-document-load');
|
|
932
|
+
vi.doUnmock('@opentelemetry/instrumentation-fetch');
|
|
933
|
+
vi.doUnmock('@opentelemetry/instrumentation-user-interaction');
|
|
934
|
+
vi.doUnmock('@opentelemetry/instrumentation-xml-http-request');
|
|
885
935
|
});
|
|
886
936
|
|
|
887
937
|
describe('trackPageView with tracer', () => {
|
|
@@ -1094,7 +1144,7 @@ describe('connectWithSSRTrace functionality', () => {
|
|
|
1094
1144
|
shutdown: vi.fn().mockResolvedValue(undefined),
|
|
1095
1145
|
};
|
|
1096
1146
|
|
|
1097
|
-
// Mock
|
|
1147
|
+
// Mock all OpenTelemetry dependencies needed by initTelemetry
|
|
1098
1148
|
vi.doMock('@opentelemetry/sdk-trace-web', () => ({
|
|
1099
1149
|
WebTracerProvider: class MockWebTracerProviderForSSR {
|
|
1100
1150
|
constructor() {
|
|
@@ -1103,11 +1153,51 @@ describe('connectWithSSRTrace functionality', () => {
|
|
|
1103
1153
|
},
|
|
1104
1154
|
}));
|
|
1105
1155
|
|
|
1106
|
-
// Mock registerInstrumentations
|
|
1107
1156
|
vi.doMock('@opentelemetry/instrumentation', () => ({
|
|
1108
1157
|
registerInstrumentations: vi.fn(),
|
|
1109
1158
|
}));
|
|
1110
1159
|
|
|
1160
|
+
vi.doMock('@opentelemetry/resources', () => ({
|
|
1161
|
+
resourceFromAttributes: vi.fn().mockReturnValue({}),
|
|
1162
|
+
}));
|
|
1163
|
+
|
|
1164
|
+
vi.doMock('@opentelemetry/exporter-trace-otlp-http', () => ({
|
|
1165
|
+
OTLPTraceExporter: class { constructor() {} },
|
|
1166
|
+
}));
|
|
1167
|
+
|
|
1168
|
+
vi.doMock('@opentelemetry/sdk-trace-base', () => ({
|
|
1169
|
+
BatchSpanProcessor: class { constructor() {} },
|
|
1170
|
+
}));
|
|
1171
|
+
|
|
1172
|
+
vi.doMock('@opentelemetry/context-zone', () => ({
|
|
1173
|
+
ZoneContextManager: class { constructor() {} },
|
|
1174
|
+
}));
|
|
1175
|
+
|
|
1176
|
+
vi.doMock('@opentelemetry/propagator-b3', () => ({
|
|
1177
|
+
B3Propagator: class { constructor() {} },
|
|
1178
|
+
}));
|
|
1179
|
+
|
|
1180
|
+
vi.doMock('@opentelemetry/semantic-conventions', () => ({
|
|
1181
|
+
ATTR_SERVICE_NAME: 'service.name',
|
|
1182
|
+
ATTR_SERVICE_VERSION: 'service.version',
|
|
1183
|
+
}));
|
|
1184
|
+
|
|
1185
|
+
vi.doMock('@opentelemetry/instrumentation-document-load', () => ({
|
|
1186
|
+
DocumentLoadInstrumentation: class { constructor() {} },
|
|
1187
|
+
}));
|
|
1188
|
+
|
|
1189
|
+
vi.doMock('@opentelemetry/instrumentation-fetch', () => ({
|
|
1190
|
+
FetchInstrumentation: class { constructor() {} },
|
|
1191
|
+
}));
|
|
1192
|
+
|
|
1193
|
+
vi.doMock('@opentelemetry/instrumentation-user-interaction', () => ({
|
|
1194
|
+
UserInteractionInstrumentation: class { constructor() {} },
|
|
1195
|
+
}));
|
|
1196
|
+
|
|
1197
|
+
vi.doMock('@opentelemetry/instrumentation-xml-http-request', () => ({
|
|
1198
|
+
XMLHttpRequestInstrumentation: class { constructor() {} },
|
|
1199
|
+
}));
|
|
1200
|
+
|
|
1111
1201
|
global.window = {
|
|
1112
1202
|
location: {
|
|
1113
1203
|
pathname: '/performers',
|
|
@@ -1143,11 +1233,21 @@ describe('connectWithSSRTrace functionality', () => {
|
|
|
1143
1233
|
vi.clearAllMocks();
|
|
1144
1234
|
vi.doUnmock('@opentelemetry/sdk-trace-web');
|
|
1145
1235
|
vi.doUnmock('@opentelemetry/instrumentation');
|
|
1236
|
+
vi.doUnmock('@opentelemetry/resources');
|
|
1237
|
+
vi.doUnmock('@opentelemetry/exporter-trace-otlp-http');
|
|
1238
|
+
vi.doUnmock('@opentelemetry/sdk-trace-base');
|
|
1239
|
+
vi.doUnmock('@opentelemetry/context-zone');
|
|
1240
|
+
vi.doUnmock('@opentelemetry/propagator-b3');
|
|
1241
|
+
vi.doUnmock('@opentelemetry/semantic-conventions');
|
|
1242
|
+
vi.doUnmock('@opentelemetry/instrumentation-document-load');
|
|
1243
|
+
vi.doUnmock('@opentelemetry/instrumentation-fetch');
|
|
1244
|
+
vi.doUnmock('@opentelemetry/instrumentation-user-interaction');
|
|
1245
|
+
vi.doUnmock('@opentelemetry/instrumentation-xml-http-request');
|
|
1146
1246
|
});
|
|
1147
1247
|
|
|
1148
1248
|
it('connects with SSR trace context when available', () => {
|
|
1149
|
-
// Manually call initTelemetry
|
|
1150
|
-
telemetry.initTelemetry();
|
|
1249
|
+
// Manually call initTelemetry with tracing enabled
|
|
1250
|
+
telemetry.initTelemetry({ tracesEnabled: true });
|
|
1151
1251
|
telemetry.setupAutoTelemetry();
|
|
1152
1252
|
|
|
1153
1253
|
// Check that a span was created with SSR trace context
|
package/dist/utils/apiConfig.js
CHANGED
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* API Configuration - Centralized URL and version management
|
|
3
3
|
* @module utils/apiConfig
|
|
4
|
+
*
|
|
5
|
+
* Call configureApi() at app startup to set values from environment.
|
|
4
6
|
*/
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
/** @type {string} */
|
|
9
|
+
export let API_BASE_URL = 'https://get-micdrop.com';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
/** @type {string} */
|
|
12
|
+
export let FRONTEND_BASE_URL = 'https://performers.get-micdrop.com';
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
export
|
|
14
|
+
/** @type {string} */
|
|
15
|
+
export let API_VERSION = 'v2';
|
|
16
|
+
|
|
17
|
+
/** @type {boolean} */
|
|
18
|
+
export let USE_V2_API = true;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Configure API settings at runtime (call once at app startup).
|
|
22
|
+
* @param {{ apiBaseUrl?: string, frontendBaseUrl?: string, apiVersion?: string }} opts
|
|
23
|
+
*/
|
|
24
|
+
export function configureApi(opts = {}) {
|
|
25
|
+
if (opts.apiBaseUrl) API_BASE_URL = opts.apiBaseUrl;
|
|
26
|
+
if (opts.frontendBaseUrl) {
|
|
27
|
+
FRONTEND_BASE_URL = opts.frontendBaseUrl;
|
|
28
|
+
} else if (opts.apiBaseUrl) {
|
|
29
|
+
FRONTEND_BASE_URL = opts.apiBaseUrl.includes('get-micdrop.com')
|
|
30
|
+
? 'https://performers.get-micdrop.com'
|
|
31
|
+
: 'http://localhost:5173';
|
|
32
|
+
}
|
|
33
|
+
if (opts.apiVersion) {
|
|
34
|
+
API_VERSION = opts.apiVersion;
|
|
35
|
+
USE_V2_API = opts.apiVersion === 'v2';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
13
38
|
|
|
14
39
|
/**
|
|
15
40
|
* @param {string} path - API path starting with /
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;CACrD;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;CACrD;AAaD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAM,GAClD,MAAM,CA4CR;AAYD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAEpE;AAUD,eAAO,MAAM,MAAM;qBACA,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;oBAMlC,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;oBAMjC,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;qBAMhC,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;CAKnD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -18,7 +18,8 @@ const LOG_LEVELS = {
|
|
|
18
18
|
warn: 2,
|
|
19
19
|
error: 3,
|
|
20
20
|
};
|
|
21
|
-
const isEnabled = () => typeof window !== 'undefined' &&
|
|
21
|
+
const isEnabled = () => typeof window !== 'undefined' &&
|
|
22
|
+
(typeof process === 'undefined' || process.env?.NODE_ENV !== 'production');
|
|
22
23
|
/**
|
|
23
24
|
* Create an independent logger instance with its own config.
|
|
24
25
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getmicdrop/svelte-components",
|
|
3
|
-
"version": "5.20.
|
|
3
|
+
"version": "5.20.1",
|
|
4
4
|
"description": "Shared component library for Micdrop applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,10 +13,7 @@
|
|
|
13
13
|
"import": "./dist/index.js"
|
|
14
14
|
},
|
|
15
15
|
"./styles": "./dist/styles.css",
|
|
16
|
-
"./base":
|
|
17
|
-
"style": "./dist/tokens/typography-base.css",
|
|
18
|
-
"default": "./dist/tokens/typography-base.css"
|
|
19
|
-
},
|
|
16
|
+
"./base": "./dist/base.css",
|
|
20
17
|
"./tokens": {
|
|
21
18
|
"types": "./dist/tokens/index.d.ts",
|
|
22
19
|
"import": "./dist/tokens/index.js"
|
|
@@ -48,7 +45,6 @@
|
|
|
48
45
|
"./tokens/css": "./dist/tokens/tokens.css",
|
|
49
46
|
"./tokens/typography-base": "./dist/tokens/typography-base.css",
|
|
50
47
|
"./tokens/utilities": "./dist/tokens/utilities.css",
|
|
51
|
-
"./base": "./dist/base.css",
|
|
52
48
|
"./tailwind-preset": "./dist/tailwind/preset.cjs",
|
|
53
49
|
"./primitives/*": {
|
|
54
50
|
"svelte": "./dist/primitives/*",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apiConfig.spec.d.ts","sourceRoot":"","sources":["../../src/lib/utils/apiConfig.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
API_BASE_URL,
|
|
4
|
-
FRONTEND_BASE_URL,
|
|
5
|
-
buildApiUrl,
|
|
6
|
-
API_ENDPOINTS,
|
|
7
|
-
buildPerformerInviteUrl,
|
|
8
|
-
getPerformerInviteMethod,
|
|
9
|
-
buildV2PerformerActionUrl,
|
|
10
|
-
} from './apiConfig';
|
|
11
|
-
|
|
12
|
-
describe('apiConfig', () => {
|
|
13
|
-
describe('API_BASE_URL', () => {
|
|
14
|
-
it('is defined', () => {
|
|
15
|
-
expect(API_BASE_URL).toBeDefined();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('is a string', () => {
|
|
19
|
-
expect(typeof API_BASE_URL).toBe('string');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('starts with http', () => {
|
|
23
|
-
expect(API_BASE_URL.startsWith('http')).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe('FRONTEND_BASE_URL', () => {
|
|
28
|
-
it('is defined', () => {
|
|
29
|
-
expect(FRONTEND_BASE_URL).toBeDefined();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('is a string', () => {
|
|
33
|
-
expect(typeof FRONTEND_BASE_URL).toBe('string');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('buildApiUrl', () => {
|
|
38
|
-
it('builds URL with path starting with /', () => {
|
|
39
|
-
const url = buildApiUrl('/api/test');
|
|
40
|
-
expect(url).toBe(`${API_BASE_URL}/api/test`);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('adds leading / when path does not have one', () => {
|
|
44
|
-
const url = buildApiUrl('api/test');
|
|
45
|
-
expect(url).toBe(`${API_BASE_URL}/api/test`);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('handles empty path', () => {
|
|
49
|
-
const url = buildApiUrl('');
|
|
50
|
-
expect(url).toBe(`${API_BASE_URL}/`);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('handles path with query params', () => {
|
|
54
|
-
const url = buildApiUrl('/api/test?param=value');
|
|
55
|
-
expect(url).toBe(`${API_BASE_URL}/api/test?param=value`);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('API_ENDPOINTS (defaults to V2)', () => {
|
|
60
|
-
it('has LOGIN endpoint', () => {
|
|
61
|
-
expect(API_ENDPOINTS.LOGIN).toBe('/api/v2/auth/login');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('has PERFORMER_PROFILE endpoint', () => {
|
|
65
|
-
expect(API_ENDPOINTS.PERFORMER_PROFILE).toBe('/api/v2/performer/profile');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('has MODIFY_PERFORMER_PROFILE endpoint', () => {
|
|
69
|
-
expect(API_ENDPOINTS.MODIFY_PERFORMER_PROFILE).toBe('/api/v2/performer/profile');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('has PERFORMER_AVAILABILITIES endpoint', () => {
|
|
73
|
-
expect(API_ENDPOINTS.PERFORMER_AVAILABILITIES).toBe('/api/v2/performer/availabilities');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('has GET_EVENT_PERFORMER_INVITES endpoint', () => {
|
|
77
|
-
expect(API_ENDPOINTS.GET_EVENT_PERFORMER_INVITES).toBe('/api/v2/performer/invites');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('has GET_ROSTER_EVENT_PERFORMERS_FOR_USER endpoint', () => {
|
|
81
|
-
expect(API_ENDPOINTS.GET_ROSTER_EVENT_PERFORMERS_FOR_USER).toBe('/api/v2/performers/roster');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('has GET_EVENTS_FOR_VENUE endpoint', () => {
|
|
85
|
-
expect(API_ENDPOINTS.GET_EVENTS_FOR_VENUE).toBe('/api/v2/public/events/venue');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('has GET_VENUE endpoint', () => {
|
|
89
|
-
expect(API_ENDPOINTS.GET_VENUE).toBe('/api/v2/public/venues');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('has ACCEPT_EVENT_PERFORMER_INVITE endpoint', () => {
|
|
93
|
-
expect(API_ENDPOINTS.ACCEPT_EVENT_PERFORMER_INVITE).toBe('/api/v2/event-performers');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('has DECLINE_EVENT_PERFORMER_INVITE endpoint', () => {
|
|
97
|
-
expect(API_ENDPOINTS.DECLINE_EVENT_PERFORMER_INVITE).toBe('/api/v2/event-performers');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('has CANCEL_EVENT_PERFORMER_INVITE endpoint', () => {
|
|
101
|
-
expect(API_ENDPOINTS.CANCEL_EVENT_PERFORMER_INVITE).toBe('/api/v2/event-performers');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('has SEND_VENUE_MESSAGE endpoint', () => {
|
|
105
|
-
expect(API_ENDPOINTS.SEND_VENUE_MESSAGE).toBe('/api/v2/performer/invites');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('has REJECT_ROSTER_INVITE endpoint', () => {
|
|
109
|
-
expect(API_ENDPOINTS.REJECT_ROSTER_INVITE).toBe('/api/v2/public/roster-invites');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('has REMOVE_VENUE_FROM_ROSTER endpoint', () => {
|
|
113
|
-
expect(API_ENDPOINTS.REMOVE_VENUE_FROM_ROSTER).toBe('/api/v2/performer/venues');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('has TICKETING_EVENTS endpoint', () => {
|
|
117
|
-
expect(API_ENDPOINTS.TICKETING_EVENTS).toBe('/ticketing/events');
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('uses buildApiUrl for full URLs', () => {
|
|
121
|
-
const loginUrl = buildApiUrl(API_ENDPOINTS.LOGIN);
|
|
122
|
-
expect(loginUrl).toContain('/api/v2/auth/login');
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe('buildPerformerInviteUrl (defaults to V2)', () => {
|
|
127
|
-
it('builds V2 accept URL (maps to confirm)', () => {
|
|
128
|
-
const url = buildPerformerInviteUrl(123, 'accept');
|
|
129
|
-
expect(url).toContain('/api/v2/event-performers/123/confirm');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('builds V2 decline URL', () => {
|
|
133
|
-
const url = buildPerformerInviteUrl(456, 'decline');
|
|
134
|
-
expect(url).toContain('/api/v2/event-performers/456/decline');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('builds V2 cancel URL', () => {
|
|
138
|
-
const url = buildPerformerInviteUrl(789, 'cancel');
|
|
139
|
-
expect(url).toContain('/api/v2/event-performers/789/cancel');
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe('getPerformerInviteMethod (defaults to V2)', () => {
|
|
144
|
-
it('returns POST for V2 accept and decline actions', () => {
|
|
145
|
-
expect(getPerformerInviteMethod('accept')).toBe('POST');
|
|
146
|
-
expect(getPerformerInviteMethod('decline')).toBe('POST');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('returns PUT for V2 cancel action', () => {
|
|
150
|
-
expect(getPerformerInviteMethod('cancel')).toBe('PUT');
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe('buildV2PerformerActionUrl', () => {
|
|
155
|
-
it('builds V2 performer action URL with confirm', () => {
|
|
156
|
-
const url = buildV2PerformerActionUrl(123, 'confirm');
|
|
157
|
-
expect(url).toContain('/api/v2/event-performers/123/confirm');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('builds V2 performer action URL with decline', () => {
|
|
161
|
-
const url = buildV2PerformerActionUrl(456, 'decline');
|
|
162
|
-
expect(url).toContain('/api/v2/event-performers/456/decline');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('builds V2 performer action URL with reassign', () => {
|
|
166
|
-
const url = buildV2PerformerActionUrl(789, 'reassign');
|
|
167
|
-
expect(url).toContain('/api/v2/event-performers/789/reassign');
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
describe('V2 API paths', () => {
|
|
172
|
-
let originalEnv;
|
|
173
|
-
|
|
174
|
-
beforeEach(async () => {
|
|
175
|
-
originalEnv = import.meta.env.VITE_API_VERSION;
|
|
176
|
-
vi.resetModules();
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
afterEach(async () => {
|
|
180
|
-
import.meta.env.VITE_API_VERSION = originalEnv;
|
|
181
|
-
vi.resetModules();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('buildPerformerInviteUrl uses V2 endpoint for accept when USE_V2_API is true', async () => {
|
|
185
|
-
// Set environment variable to v2
|
|
186
|
-
import.meta.env.VITE_API_VERSION = 'v2';
|
|
187
|
-
|
|
188
|
-
// Re-import to get fresh module with new env
|
|
189
|
-
const module = await import('./apiConfig');
|
|
190
|
-
|
|
191
|
-
const url = module.buildPerformerInviteUrl(123, 'accept');
|
|
192
|
-
expect(url).toContain('/api/v2/event-performers/123/confirm');
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('buildPerformerInviteUrl uses V2 endpoint for decline when USE_V2_API is true', async () => {
|
|
196
|
-
import.meta.env.VITE_API_VERSION = 'v2';
|
|
197
|
-
const module = await import('./apiConfig');
|
|
198
|
-
|
|
199
|
-
const url = module.buildPerformerInviteUrl(456, 'decline');
|
|
200
|
-
expect(url).toContain('/api/v2/event-performers/456/decline');
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it('buildPerformerInviteUrl uses V2 endpoint for cancel when USE_V2_API is true', async () => {
|
|
204
|
-
import.meta.env.VITE_API_VERSION = 'v2';
|
|
205
|
-
const module = await import('./apiConfig');
|
|
206
|
-
|
|
207
|
-
const url = module.buildPerformerInviteUrl(789, 'cancel');
|
|
208
|
-
expect(url).toContain('/api/v2/event-performers/789/cancel');
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('getPerformerInviteMethod returns POST for V2 non-cancel actions', async () => {
|
|
212
|
-
import.meta.env.VITE_API_VERSION = 'v2';
|
|
213
|
-
const module = await import('./apiConfig');
|
|
214
|
-
|
|
215
|
-
expect(module.getPerformerInviteMethod('accept')).toBe('POST');
|
|
216
|
-
expect(module.getPerformerInviteMethod('decline')).toBe('POST');
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('getPerformerInviteMethod returns PUT for V2 cancel action', async () => {
|
|
220
|
-
import.meta.env.VITE_API_VERSION = 'v2';
|
|
221
|
-
const module = await import('./apiConfig');
|
|
222
|
-
|
|
223
|
-
expect(module.getPerformerInviteMethod('cancel')).toBe('PUT');
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
});
|