@fluid-app/portal-sdk 0.1.450 → 0.1.452
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/{FluidProvider-BjSf_FiB.cjs → FluidProvider-BULkBuyn.cjs} +121 -28
- package/dist/FluidProvider-BULkBuyn.cjs.map +1 -0
- package/dist/{FluidProvider-CXqSq1iX.mjs → FluidProvider-CA_HAl9a.mjs} +116 -29
- package/dist/FluidProvider-CA_HAl9a.mjs.map +1 -0
- package/dist/{MessagingScreen-Ck5kiA-O.mjs → MessagingScreen-BdsSr7l4.mjs} +2 -2
- package/dist/{MessagingScreen-NdUsPc_N.cjs → MessagingScreen-CApfcPd5.cjs} +2 -2
- package/dist/{MessagingScreen-NdUsPc_N.cjs.map → MessagingScreen-CApfcPd5.cjs.map} +1 -1
- package/dist/{MessagingScreen-CtMw_Wp3.mjs → MessagingScreen-Cf0OOWZ5.mjs} +2 -2
- package/dist/{MessagingScreen-CtMw_Wp3.mjs.map → MessagingScreen-Cf0OOWZ5.mjs.map} +1 -1
- package/dist/{MessagingScreen-BAl4Hg2w.cjs → MessagingScreen-N3CiZ807.cjs} +2 -2
- package/dist/{OrdersScreen-B3sEroyv.mjs → OrdersScreen-BPihQMaX.mjs} +2 -2
- package/dist/{OrdersScreen-B3sEroyv.mjs.map → OrdersScreen-BPihQMaX.mjs.map} +1 -1
- package/dist/{OrdersScreen-iCm9w3Kz.cjs → OrdersScreen-CgU8hdeD.cjs} +2 -2
- package/dist/{OrdersScreen-Dz_rz68P.mjs → OrdersScreen-Cv-qovZG.mjs} +2 -2
- package/dist/{OrdersScreen-CNCGv-jL.cjs → OrdersScreen-DEv_TOuP.cjs} +2 -2
- package/dist/{OrdersScreen-CNCGv-jL.cjs.map → OrdersScreen-DEv_TOuP.cjs.map} +1 -1
- package/dist/{ProfileScreen--xpXB--h.mjs → ProfileScreen-3gbdDTy0.mjs} +3 -3
- package/dist/{ProfileScreen-DD8HaCNH.mjs → ProfileScreen-BdzjBeMm.mjs} +4 -4
- package/dist/ProfileScreen-BdzjBeMm.mjs.map +1 -0
- package/dist/{ProfileScreen-CCVbDYek.cjs → ProfileScreen-Cs3B8vfS.cjs} +4 -4
- package/dist/ProfileScreen-Cs3B8vfS.cjs.map +1 -0
- package/dist/{ProfileScreen-Ce8jwoAg.cjs → ProfileScreen-cCOWdo-G.cjs} +3 -3
- package/dist/{ShopScreen-DsKCSRzS.mjs → ShopScreen-BQu3Hv89.mjs} +2 -2
- package/dist/{ShopScreen-DsKCSRzS.mjs.map → ShopScreen-BQu3Hv89.mjs.map} +1 -1
- package/dist/{ShopScreen-Cm-B46dF.cjs → ShopScreen-DqdBdkjS.cjs} +2 -2
- package/dist/{ShopScreen-Cm-B46dF.cjs.map → ShopScreen-DqdBdkjS.cjs.map} +1 -1
- package/dist/{ShopScreen-B9xABYoy.mjs → ShopScreen-eC3clAjp.mjs} +2 -2
- package/dist/{ShopScreen-CRVZOMY5.cjs → ShopScreen-lyjY8yxm.cjs} +2 -2
- package/dist/{SubscriptionsScreen-D1qYFGmN.cjs → SubscriptionsScreen-CYCQcYMB.cjs} +3 -3
- package/dist/{SubscriptionsScreen-C17iAZ_N.mjs → SubscriptionsScreen-Db9gI6D6.mjs} +3 -3
- package/dist/{SubscriptionsScreen-DhxSxQ43.cjs → SubscriptionsScreen-aaF2B1qD.cjs} +3 -3
- package/dist/{SubscriptionsScreen-DhxSxQ43.cjs.map → SubscriptionsScreen-aaF2B1qD.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-IWNnfQ36.mjs → SubscriptionsScreen-bCXc9Bqn.mjs} +3 -3
- package/dist/{SubscriptionsScreen-IWNnfQ36.mjs.map → SubscriptionsScreen-bCXc9Bqn.mjs.map} +1 -1
- package/dist/index.cjs +34 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +34 -22
- package/dist/index.mjs.map +1 -1
- package/dist/{use-portal-card-add-3ds-flow-Ch7FwzUp.cjs → use-portal-card-add-3ds-flow-1JkstOR0.cjs} +2 -2
- package/dist/{use-portal-card-add-3ds-flow-Ch7FwzUp.cjs.map → use-portal-card-add-3ds-flow-1JkstOR0.cjs.map} +1 -1
- package/dist/{use-portal-card-add-3ds-flow-hgln6QRL.mjs → use-portal-card-add-3ds-flow-DueNr2yx.mjs} +2 -2
- package/dist/{use-portal-card-add-3ds-flow-hgln6QRL.mjs.map → use-portal-card-add-3ds-flow-DueNr2yx.mjs.map} +1 -1
- package/package.json +16 -16
- package/dist/FluidProvider-BjSf_FiB.cjs.map +0 -1
- package/dist/FluidProvider-CXqSq1iX.mjs.map +0 -1
- package/dist/ProfileScreen-CCVbDYek.cjs.map +0 -1
- package/dist/ProfileScreen-DD8HaCNH.mjs.map +0 -1
|
@@ -15283,6 +15283,87 @@ function mapManifestToDefinition(manifest) {
|
|
|
15283
15283
|
};
|
|
15284
15284
|
}
|
|
15285
15285
|
//#endregion
|
|
15286
|
+
//#region ../core/src/native-capabilities-api.ts
|
|
15287
|
+
/** Safe no-op implementation used when no native shell is present. */
|
|
15288
|
+
const webNativeCapabilitiesApi = {
|
|
15289
|
+
isNativeApp: false,
|
|
15290
|
+
capabilities: [],
|
|
15291
|
+
supports: () => false,
|
|
15292
|
+
haptic: () => {},
|
|
15293
|
+
showActionSheet: () => Promise.resolve(null),
|
|
15294
|
+
showToast: () => {}
|
|
15295
|
+
};
|
|
15296
|
+
//#endregion
|
|
15297
|
+
//#region ../core/src/native-capabilities-api-context.ts
|
|
15298
|
+
const NativeCapabilitiesApiContext = (0, react.createContext)(null);
|
|
15299
|
+
const NativeCapabilitiesApiProvider = NativeCapabilitiesApiContext.Provider;
|
|
15300
|
+
/**
|
|
15301
|
+
* Resolve the effective capabilities api. Unlike most ports, a missing
|
|
15302
|
+
* provider is not an error: the web fallback is returned so portal code runs
|
|
15303
|
+
* unchanged outside the native shell.
|
|
15304
|
+
*/
|
|
15305
|
+
function resolveNativeCapabilitiesApi(api) {
|
|
15306
|
+
return api ?? webNativeCapabilitiesApi;
|
|
15307
|
+
}
|
|
15308
|
+
function useNativeCapabilities() {
|
|
15309
|
+
return resolveNativeCapabilitiesApi((0, react.use)(NativeCapabilitiesApiContext));
|
|
15310
|
+
}
|
|
15311
|
+
//#endregion
|
|
15312
|
+
//#region src/adapters/native-capabilities-api-adapter.ts
|
|
15313
|
+
/** Event emitted by portal-mobile after installing the native bridge runtime. */
|
|
15314
|
+
const PORTAL_NATIVE_BRIDGE_READY_EVENT = "fluid.portal.native:ready";
|
|
15315
|
+
/** Read the native bridge runtime from the current window, if installed. */
|
|
15316
|
+
function getFluidNativeBridge() {
|
|
15317
|
+
if (typeof window === "undefined") return null;
|
|
15318
|
+
return window.__fluidNativeBridge ?? null;
|
|
15319
|
+
}
|
|
15320
|
+
/**
|
|
15321
|
+
* Keep a consumer synchronized with the bridge runtime. The immediate read
|
|
15322
|
+
* covers bridges installed before React mounts; the event covers WebViews
|
|
15323
|
+
* that install injected JavaScript after the portal has started hydrating.
|
|
15324
|
+
*/
|
|
15325
|
+
function subscribeToFluidNativeBridge(listener) {
|
|
15326
|
+
if (typeof window === "undefined") return () => {};
|
|
15327
|
+
const syncBridge = () => listener(getFluidNativeBridge());
|
|
15328
|
+
syncBridge();
|
|
15329
|
+
window.addEventListener(PORTAL_NATIVE_BRIDGE_READY_EVENT, syncBridge);
|
|
15330
|
+
return () => {
|
|
15331
|
+
window.removeEventListener(PORTAL_NATIVE_BRIDGE_READY_EVENT, syncBridge);
|
|
15332
|
+
};
|
|
15333
|
+
}
|
|
15334
|
+
/**
|
|
15335
|
+
* Build a {@link NativeCapabilitiesApi} over the injected bridge runtime.
|
|
15336
|
+
* Returns the shared web fallback when no native shell is present, so callers
|
|
15337
|
+
* always receive a working implementation.
|
|
15338
|
+
*/
|
|
15339
|
+
function createNativeCapabilitiesAdapter(bridge) {
|
|
15340
|
+
if (!bridge || !bridge.isNativeApp) return webNativeCapabilitiesApi;
|
|
15341
|
+
const capabilities = bridge.capabilities ?? [];
|
|
15342
|
+
const supports = (capability) => capabilities.includes(capability);
|
|
15343
|
+
return {
|
|
15344
|
+
isNativeApp: true,
|
|
15345
|
+
capabilities,
|
|
15346
|
+
supports,
|
|
15347
|
+
haptic: (style = "light") => {
|
|
15348
|
+
if (!supports("haptic")) return;
|
|
15349
|
+
bridge.postRequest("haptic", { style }).catch(() => {});
|
|
15350
|
+
},
|
|
15351
|
+
showToast: (request) => {
|
|
15352
|
+
if (!supports("toast")) return;
|
|
15353
|
+
bridge.postRequest("toast", request).catch(() => {});
|
|
15354
|
+
},
|
|
15355
|
+
showActionSheet: async (request) => {
|
|
15356
|
+
if (!supports("actionSheet")) return null;
|
|
15357
|
+
const result = await bridge.postRequest("actionSheet", request).catch(() => null);
|
|
15358
|
+
if (result && typeof result === "object" && "actionId" in result) {
|
|
15359
|
+
const { actionId } = result;
|
|
15360
|
+
return typeof actionId === "string" ? actionId : null;
|
|
15361
|
+
}
|
|
15362
|
+
return null;
|
|
15363
|
+
}
|
|
15364
|
+
};
|
|
15365
|
+
}
|
|
15366
|
+
//#endregion
|
|
15286
15367
|
//#region src/adapters/account-api-adapter.ts
|
|
15287
15368
|
function mapAccount(raw) {
|
|
15288
15369
|
return {
|
|
@@ -18302,6 +18383,9 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
18302
18383
|
}), [config.baseUrl, csrfToken]);
|
|
18303
18384
|
const dataSourceApi = (0, react.useMemo)(() => createDataSourceApiAdapter(portalTenantClient, portalTenantContentClient), [portalTenantClient, portalTenantContentClient]);
|
|
18304
18385
|
const appDefinitionApi = (0, react.useMemo)(() => createAppDefinitionApiAdapter(portalTenantClient), [portalTenantClient]);
|
|
18386
|
+
const [nativeBridge, setNativeBridge] = (0, react.useState)(getFluidNativeBridge);
|
|
18387
|
+
(0, react.useEffect)(() => subscribeToFluidNativeBridge(setNativeBridge), []);
|
|
18388
|
+
const nativeCapabilitiesApi = (0, react.useMemo)(() => createNativeCapabilitiesAdapter(nativeBridge), [nativeBridge]);
|
|
18305
18389
|
const accountApi = (0, react.useMemo)(() => createAccountApiAdapter(portalTenantClient), [portalTenantClient]);
|
|
18306
18390
|
const storeApi = (0, react.useMemo)(() => createStoreApiAdapter(portalTenantClient), [portalTenantClient]);
|
|
18307
18391
|
const payApi = (0, react.useMemo)(() => createPortalTenantPayAdapter(portalTenantClient), [portalTenantClient]);
|
|
@@ -18338,35 +18422,38 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
18338
18422
|
...remoteWidgets?.packages === void 0 ? {} : { packages: remoteWidgets.packages },
|
|
18339
18423
|
...remoteWidgets?.functions === void 0 ? {} : { functions: remoteWidgets.functions },
|
|
18340
18424
|
...remoteWidgets?.onFullscreen === void 0 ? {} : { onFullscreen: remoteWidgets.onFullscreen },
|
|
18341
|
-
children: (remoteWidgetRegistry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18342
|
-
value:
|
|
18343
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18344
|
-
value:
|
|
18345
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18346
|
-
value:
|
|
18347
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18348
|
-
value:
|
|
18349
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18350
|
-
value:
|
|
18351
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18352
|
-
value:
|
|
18353
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18354
|
-
value:
|
|
18355
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18356
|
-
value:
|
|
18357
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18425
|
+
children: (remoteWidgetRegistry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NativeCapabilitiesApiProvider, {
|
|
18426
|
+
value: nativeCapabilitiesApi,
|
|
18427
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_build_widget_registry.AppDefinitionApiProvider, {
|
|
18428
|
+
value: appDefinitionApi,
|
|
18429
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_account.AccountApiProvider, {
|
|
18430
|
+
value: accountApi,
|
|
18431
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PayApiProvider, {
|
|
18432
|
+
value: payApi,
|
|
18433
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ContactsTranslationBridge.CountriesApiProvider, {
|
|
18434
|
+
value: countriesApi,
|
|
18435
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguagesApiProvider, {
|
|
18436
|
+
value: languagesApi,
|
|
18437
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalLocaleProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_mysite_api_context.MySiteApiProvider, {
|
|
18438
|
+
value: mysiteApi,
|
|
18439
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddressFieldsApiProvider, {
|
|
18440
|
+
value: addressFieldsApi,
|
|
18441
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AddressAutocompleteApiProvider, {
|
|
18442
|
+
value: addressAutocompleteApi,
|
|
18443
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalRuntimeProviderStack, {
|
|
18444
|
+
baseUrl: dataSourceBaseUrl,
|
|
18445
|
+
getApiHeaders,
|
|
18446
|
+
dataSourceApi,
|
|
18447
|
+
variables: effectiveVariables,
|
|
18448
|
+
registry: remoteWidgetRegistry,
|
|
18449
|
+
storeApi,
|
|
18450
|
+
themeProviderProps,
|
|
18451
|
+
children
|
|
18452
|
+
})
|
|
18366
18453
|
})
|
|
18367
18454
|
})
|
|
18368
|
-
})
|
|
18369
|
-
})
|
|
18455
|
+
}) })
|
|
18456
|
+
})
|
|
18370
18457
|
})
|
|
18371
18458
|
})
|
|
18372
18459
|
})
|
|
@@ -18566,6 +18653,12 @@ Object.defineProperty(exports, "useLanguagesApi", {
|
|
|
18566
18653
|
return useLanguagesApi;
|
|
18567
18654
|
}
|
|
18568
18655
|
});
|
|
18656
|
+
Object.defineProperty(exports, "useNativeCapabilities", {
|
|
18657
|
+
enumerable: true,
|
|
18658
|
+
get: function() {
|
|
18659
|
+
return useNativeCapabilities;
|
|
18660
|
+
}
|
|
18661
|
+
});
|
|
18569
18662
|
Object.defineProperty(exports, "usePayApi", {
|
|
18570
18663
|
enumerable: true,
|
|
18571
18664
|
get: function() {
|
|
@@ -18585,4 +18678,4 @@ Object.defineProperty(exports, "useThemeContext", {
|
|
|
18585
18678
|
}
|
|
18586
18679
|
});
|
|
18587
18680
|
|
|
18588
|
-
//# sourceMappingURL=FluidProvider-
|
|
18681
|
+
//# sourceMappingURL=FluidProvider-BULkBuyn.cjs.map
|