@apps-in-toss/framework 0.0.15 → 0.0.16
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.cjs +21 -9
- package/dist/index.js +21 -9
- package/dist/plugins/index.cjs +8 -33602
- package/dist/plugins/index.d.cts +1 -96
- package/dist/plugins/index.d.ts +1 -96
- package/dist/plugins/index.js +1 -33614
- package/package.json +4 -12
- package/plugins.d.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -444,6 +444,7 @@ __export(event_bridges_exports, {
|
|
|
444
444
|
// src/components/WebView.tsx
|
|
445
445
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
446
446
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
447
|
+
var TYPES = ["partner", "external", "game"];
|
|
447
448
|
var WEBVIEW_TYPES = {
|
|
448
449
|
partner: import_react_native11.PartnerWebViewScreen,
|
|
449
450
|
external: import_react_native11.ExternalWebViewScreen,
|
|
@@ -472,6 +473,9 @@ function getWebViewUri(local) {
|
|
|
472
473
|
return url.toString();
|
|
473
474
|
}
|
|
474
475
|
function WebView({ type, local, onMessage, ...props }) {
|
|
476
|
+
if (!TYPES.includes(type)) {
|
|
477
|
+
throw new Error(`Invalid WebView type: '${type}'`);
|
|
478
|
+
}
|
|
475
479
|
const uri = (0, import_react3.useMemo)(() => getWebViewUri(local), [local]);
|
|
476
480
|
const handler = (0, import_react_native_bedrock5.useBridgeHandler)({
|
|
477
481
|
onMessage,
|
|
@@ -493,24 +497,26 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
493
497
|
const baseProps = (0, import_react3.useMemo)(() => {
|
|
494
498
|
switch (type) {
|
|
495
499
|
case "partner": {
|
|
496
|
-
|
|
500
|
+
const headerOnlyProp = {
|
|
497
501
|
header: {
|
|
498
|
-
...props.header,
|
|
499
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
500
|
-
title: appsInTossGlobals.brandDisplayName,
|
|
502
|
+
..."header" in props ? props.header : {},
|
|
503
|
+
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
504
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName"),
|
|
501
505
|
rightButtons: void 0
|
|
502
506
|
// TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
|
|
503
507
|
}
|
|
504
508
|
};
|
|
509
|
+
return headerOnlyProp;
|
|
505
510
|
}
|
|
506
511
|
case "external": {
|
|
507
|
-
|
|
512
|
+
const headerOnlyProp = {
|
|
508
513
|
header: {
|
|
509
|
-
...props.header,
|
|
510
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
511
|
-
title: appsInTossGlobals.brandDisplayName
|
|
514
|
+
..."header" in props ? props.header : {},
|
|
515
|
+
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
516
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
512
517
|
}
|
|
513
518
|
};
|
|
519
|
+
return headerOnlyProp;
|
|
514
520
|
}
|
|
515
521
|
default: {
|
|
516
522
|
return {};
|
|
@@ -522,8 +528,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
522
528
|
BaseWebView,
|
|
523
529
|
{
|
|
524
530
|
ref: handler.ref,
|
|
525
|
-
...baseProps,
|
|
526
531
|
...props,
|
|
532
|
+
...baseProps,
|
|
527
533
|
source: { uri },
|
|
528
534
|
sharedCookiesEnabled: true,
|
|
529
535
|
thirdPartyCookiesEnabled: true,
|
|
@@ -535,6 +541,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
535
541
|
}
|
|
536
542
|
);
|
|
537
543
|
}
|
|
544
|
+
function ensureValue(value, name) {
|
|
545
|
+
if (value === void 0) {
|
|
546
|
+
throw new Error(`${name} is required`);
|
|
547
|
+
}
|
|
548
|
+
return value;
|
|
549
|
+
}
|
|
538
550
|
|
|
539
551
|
// src/hooks/useGeolocation.ts
|
|
540
552
|
var import_react4 = require("react");
|
package/dist/index.js
CHANGED
|
@@ -405,6 +405,7 @@ __export(event_bridges_exports, {
|
|
|
405
405
|
// src/components/WebView.tsx
|
|
406
406
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
407
407
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
408
|
+
var TYPES = ["partner", "external", "game"];
|
|
408
409
|
var WEBVIEW_TYPES = {
|
|
409
410
|
partner: PartnerWebViewScreen,
|
|
410
411
|
external: ExternalWebViewScreen,
|
|
@@ -433,6 +434,9 @@ function getWebViewUri(local) {
|
|
|
433
434
|
return url.toString();
|
|
434
435
|
}
|
|
435
436
|
function WebView({ type, local, onMessage, ...props }) {
|
|
437
|
+
if (!TYPES.includes(type)) {
|
|
438
|
+
throw new Error(`Invalid WebView type: '${type}'`);
|
|
439
|
+
}
|
|
436
440
|
const uri = useMemo(() => getWebViewUri(local), [local]);
|
|
437
441
|
const handler = useBridgeHandler({
|
|
438
442
|
onMessage,
|
|
@@ -454,24 +458,26 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
454
458
|
const baseProps = useMemo(() => {
|
|
455
459
|
switch (type) {
|
|
456
460
|
case "partner": {
|
|
457
|
-
|
|
461
|
+
const headerOnlyProp = {
|
|
458
462
|
header: {
|
|
459
|
-
...props.header,
|
|
460
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
461
|
-
title: appsInTossGlobals.brandDisplayName,
|
|
463
|
+
..."header" in props ? props.header : {},
|
|
464
|
+
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
465
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName"),
|
|
462
466
|
rightButtons: void 0
|
|
463
467
|
// TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
|
|
464
468
|
}
|
|
465
469
|
};
|
|
470
|
+
return headerOnlyProp;
|
|
466
471
|
}
|
|
467
472
|
case "external": {
|
|
468
|
-
|
|
473
|
+
const headerOnlyProp = {
|
|
469
474
|
header: {
|
|
470
|
-
...props.header,
|
|
471
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
472
|
-
title: appsInTossGlobals.brandDisplayName
|
|
475
|
+
..."header" in props ? props.header : {},
|
|
476
|
+
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
477
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
473
478
|
}
|
|
474
479
|
};
|
|
480
|
+
return headerOnlyProp;
|
|
475
481
|
}
|
|
476
482
|
default: {
|
|
477
483
|
return {};
|
|
@@ -483,8 +489,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
483
489
|
BaseWebView,
|
|
484
490
|
{
|
|
485
491
|
ref: handler.ref,
|
|
486
|
-
...baseProps,
|
|
487
492
|
...props,
|
|
493
|
+
...baseProps,
|
|
488
494
|
source: { uri },
|
|
489
495
|
sharedCookiesEnabled: true,
|
|
490
496
|
thirdPartyCookiesEnabled: true,
|
|
@@ -496,6 +502,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
496
502
|
}
|
|
497
503
|
);
|
|
498
504
|
}
|
|
505
|
+
function ensureValue(value, name) {
|
|
506
|
+
if (value === void 0) {
|
|
507
|
+
throw new Error(`${name} is required`);
|
|
508
|
+
}
|
|
509
|
+
return value;
|
|
510
|
+
}
|
|
499
511
|
|
|
500
512
|
// src/hooks/useGeolocation.ts
|
|
501
513
|
import { useState, useEffect as useEffect2 } from "react";
|