@ai4b-team/fsaos-gateway-sdk 5.6.2 → 5.7.0
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 +26 -0
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +4 -4
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +51 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +48 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/iife/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-
|
|
1
|
+
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-16T03:22:12.647Z */
|
|
2
2
|
"use strict";var __FSAOS_UI__=(()=>{var m=Object.create;var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),N=(e,i)=>{for(var a in i)r(e,a,{get:i[a],enumerable:!0})},s=(e,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!h.call(e,t)&&t!==a&&r(e,t,{get:()=>i[t],enumerable:!(l=g(i,t))||l.enumerable});return e};var x=(e,i,a)=>(a=e!=null?m(f(e)):{},s(i||!e||!e.__esModule?r(a,"default",{value:e,enumerable:!0}):a,e)),b=e=>s(r({},"__esModule",{value:!0}),e);var d=y((V,c)=>{c.exports=React});var P={};N(P,{Badge:()=>z,Breadcrumbs:()=>A,Button:()=>D,Card:()=>w,DataView:()=>R,Detail:()=>_,Empty:()=>I,FilePreview:()=>O,Form:()=>F,Grid:()=>k,Image:()=>G,Link:()=>E,Page:()=>v,Router:()=>T,Sidebar:()=>S,Spinner:()=>B,Stack:()=>C,Table:()=>j,Tabs:()=>W,Video:()=>H});var n=x(d(),1);function o(){return(typeof window<"u"&&window.__FSAOS_CONFIG__||{}).edgeBaseUrl||""}function v(e){return(0,n.createElement)("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column"},className:e.className||""},e.children)}function C(e){let i=e.direction||"vertical";return(0,n.createElement)("div",{style:{display:"flex",flexDirection:i==="horizontal"?"row":"column",gap:e.gap||"0.5rem",padding:e.padding||"0",alignItems:e.align||"stretch",justifyContent:e.justify||"flex-start",flex:e.flex||"initial"},className:e.className||""},e.children)}function k(e){return(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:"repeat("+(e.columns||3)+", 1fr)",gap:e.gap||"1rem",padding:e.padding||"0"},className:e.className||""},e.children)}function S(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"row",minHeight:"100vh"},className:e.className||""},e.children)}function w(e){return(0,n.createElement)("div",{style:{border:"1px solid var(--color-border, #e5e7eb)",borderRadius:"var(--border-radius, 0.5rem)",padding:e.padding||"1rem",background:"var(--color-surface, #fff)"},className:e.className||"",onClick:e.onClick},e.children)}function z(e){return(0,n.createElement)("span",{style:{display:"inline-flex",alignItems:"center",padding:"0.125rem 0.5rem",fontSize:"0.75rem",fontWeight:"500",borderRadius:"9999px",background:e.color||"#e5e7eb",color:e.textColor||"#374151"},className:e.className||""},e.children||e.label)}function B(e){let i=e.size||"1.5rem";return(0,n.createElement)("div",{style:{width:i,height:i,border:"2px solid #e5e7eb",borderTopColor:"var(--color-primary, #3b82f6)",borderRadius:"50%",animation:"fsaos-spin 0.6s linear infinite"}})}function D(e){return(0,n.createElement)("button",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",borderRadius:"var(--border-radius, 0.375rem)",border:e.variant==="outline"?"1px solid var(--color-border, #d1d5db)":"none",background:e.variant==="outline"||e.variant==="ghost"?"transparent":"var(--color-primary, #3b82f6)",color:e.variant==="outline"||e.variant==="ghost"?"var(--color-text, #1a1a1a)":"#fff",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?"0.5":"1",gap:"0.5rem"},className:e.className||"",onClick:e.onClick,disabled:e.disabled},e.children||e.label)}function I(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"3rem",color:"var(--color-text-secondary, #6b7280)",textAlign:"center"}},e.icon?(0,n.createElement)("div",{style:{fontSize:"2rem",marginBottom:"0.5rem"}},e.icon):null,(0,n.createElement)("div",{style:{fontWeight:500,marginBottom:"0.25rem"}},e.title||e.message||e.children||"No items"),e.description?(0,n.createElement)("div",{style:{fontSize:"0.875rem",opacity:.7}},e.description):null)}function R(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function j(e){return(0,n.createElement)("table",{className:e.className||""},e.children)}function F(e){return(0,n.createElement)("form",{className:e.className||"",onSubmit:e.onSubmit},e.children)}function _(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function T(e){return(0,n.createElement)("div",null,e.children)}function E(e){return(0,n.createElement)("a",{href:e.href||e.to,className:e.className||"",onClick:e.onClick},e.children)}function W(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function A(e){return(0,n.createElement)("nav",{className:e.className||""},e.children)}function G(e){return(0,n.createElement)("img",{src:e.src||(e.path?o()+e.path:""),alt:e.alt||"",className:e.className||"",style:e.style})}function H(e){return(0,n.createElement)("video",{src:e.src||(e.path?o()+e.path:""),controls:!0,className:e.className||""})}function O(e){return(0,n.createElement)("div",{className:e.className||""},e.children||"File preview")}return b(P);})();
|
|
3
3
|
//# sourceMappingURL=ui.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,8 @@ __export(src_exports, {
|
|
|
92
92
|
fetchVfsItem: () => fetchVfsItem,
|
|
93
93
|
fetchVfsItemById: () => fetchVfsItemById,
|
|
94
94
|
fetchVfsTree: () => fetchVfsTree,
|
|
95
|
+
filePurchaseNextUrl: () => filePurchaseNextUrl,
|
|
96
|
+
funnelCheckoutLink: () => funnelCheckoutLink,
|
|
95
97
|
gatewayCall: () => gatewayCall,
|
|
96
98
|
getAccessToken: () => getAccessToken,
|
|
97
99
|
getAnchor: () => getAnchor,
|
|
@@ -99,6 +101,7 @@ __export(src_exports, {
|
|
|
99
101
|
getAnchorVersion: () => getAnchorVersion,
|
|
100
102
|
getAssetUrl: () => getAssetUrl,
|
|
101
103
|
getDefaultSort: () => getDefaultSort,
|
|
104
|
+
getFilePurchase: () => getFilePurchase,
|
|
102
105
|
getHomeAnchor: () => getHomeAnchor,
|
|
103
106
|
getInvitation: () => getInvitation,
|
|
104
107
|
getMountVersion: () => getMountVersion,
|
|
@@ -166,6 +169,7 @@ __export(src_exports, {
|
|
|
166
169
|
setScope: () => setScope,
|
|
167
170
|
setupRequireShim: () => setupRequireShim,
|
|
168
171
|
signal: () => signal,
|
|
172
|
+
startFileCheckout: () => startFileCheckout,
|
|
169
173
|
startTracking: () => startTracking,
|
|
170
174
|
steerTurn: () => steerTurn,
|
|
171
175
|
submitForm: () => submitForm,
|
|
@@ -6308,6 +6312,49 @@ async function submitForm(capabilityId, fields, options = {}) {
|
|
|
6308
6312
|
}, fillId, pageUrl, identity, options.signal);
|
|
6309
6313
|
return payload;
|
|
6310
6314
|
}
|
|
6315
|
+
|
|
6316
|
+
// src/commerce.ts
|
|
6317
|
+
async function startFileCheckout(options) {
|
|
6318
|
+
return gatewayCall("commerce-file-sale", {
|
|
6319
|
+
action: "checkout",
|
|
6320
|
+
product_id: options.productId,
|
|
6321
|
+
expected_product_revision_id: options.productRevisionId,
|
|
6322
|
+
destination_id: options.destinationId,
|
|
6323
|
+
request_key: options.requestKey,
|
|
6324
|
+
_scope_path: options.scopePath,
|
|
6325
|
+
...options.journey ? { journey: options.journey } : {}
|
|
6326
|
+
});
|
|
6327
|
+
}
|
|
6328
|
+
async function getFilePurchase(licenseId, scopePath) {
|
|
6329
|
+
return gatewayCall("commerce-file-sale", { action: "get", license_id: licenseId, _scope_path: scopePath });
|
|
6330
|
+
}
|
|
6331
|
+
function funnelCheckoutLink(options) {
|
|
6332
|
+
const host = new URL(options.hostOrigin);
|
|
6333
|
+
if (host.protocol !== "https:" && !(host.protocol === "http:" && host.hostname === "127.0.0.1") || host.username || host.password || host.search || host.hash || host.pathname !== "/") {
|
|
6334
|
+
throw new TypeError("hostOrigin must be an HTTPS origin or the local 127.0.0.1 app");
|
|
6335
|
+
}
|
|
6336
|
+
const page = new URL(options.pageUrl ?? window.location.href);
|
|
6337
|
+
if (page.protocol !== "https:" || page.username || page.password || page.hash || page.port) {
|
|
6338
|
+
throw new TypeError("The funnel must be a published HTTPS page");
|
|
6339
|
+
}
|
|
6340
|
+
const link = new URL("/v2/revven", host);
|
|
6341
|
+
link.search = new URLSearchParams({
|
|
6342
|
+
surface: "library",
|
|
6343
|
+
offer: options.productId,
|
|
6344
|
+
sale_page: page.href,
|
|
6345
|
+
sale_action: options.capabilityId
|
|
6346
|
+
}).toString();
|
|
6347
|
+
return link.href;
|
|
6348
|
+
}
|
|
6349
|
+
function filePurchaseNextUrl(receipt) {
|
|
6350
|
+
if (receipt.success !== true || receipt.state !== "ready" || !receipt.item_id || !receipt.file_id || !receipt.journey?.next_url) return null;
|
|
6351
|
+
const next = new URL(receipt.journey.next_url);
|
|
6352
|
+
const source = new URL(receipt.journey.return_url);
|
|
6353
|
+
if (next.protocol !== "https:" || source.protocol !== "https:" || next.origin !== source.origin || next.username || next.password || next.hash || next.searchParams.getAll("funnel_id").length !== 1 || next.searchParams.get("funnel_id") !== receipt.journey.funnel_id) {
|
|
6354
|
+
throw new Error("The purchase destination could not be verified");
|
|
6355
|
+
}
|
|
6356
|
+
return next.href;
|
|
6357
|
+
}
|
|
6311
6358
|
function readItem(path) {
|
|
6312
6359
|
return gatewayCall("read", { path });
|
|
6313
6360
|
}
|
|
@@ -7458,6 +7505,8 @@ exports.fetchVfsChildrenPage = fetchVfsChildrenPage;
|
|
|
7458
7505
|
exports.fetchVfsItem = fetchVfsItem;
|
|
7459
7506
|
exports.fetchVfsItemById = fetchVfsItemById;
|
|
7460
7507
|
exports.fetchVfsTree = fetchVfsTree;
|
|
7508
|
+
exports.filePurchaseNextUrl = filePurchaseNextUrl;
|
|
7509
|
+
exports.funnelCheckoutLink = funnelCheckoutLink;
|
|
7461
7510
|
exports.gatewayCall = gatewayCall;
|
|
7462
7511
|
exports.getAccessToken = getAccessToken;
|
|
7463
7512
|
exports.getAnchor = getAnchor;
|
|
@@ -7465,6 +7514,7 @@ exports.getAnchorRef = getAnchorRef;
|
|
|
7465
7514
|
exports.getAnchorVersion = getAnchorVersion;
|
|
7466
7515
|
exports.getAssetUrl = getAssetUrl;
|
|
7467
7516
|
exports.getDefaultSort = getDefaultSort;
|
|
7517
|
+
exports.getFilePurchase = getFilePurchase;
|
|
7468
7518
|
exports.getHomeAnchor = getHomeAnchor;
|
|
7469
7519
|
exports.getInvitation = getInvitation;
|
|
7470
7520
|
exports.getMountVersion = getMountVersion;
|
|
@@ -7532,6 +7582,7 @@ exports.setQueryClient = setQueryClient;
|
|
|
7532
7582
|
exports.setScope = setScope;
|
|
7533
7583
|
exports.setupRequireShim = setupRequireShim;
|
|
7534
7584
|
exports.signal = signal;
|
|
7585
|
+
exports.startFileCheckout = startFileCheckout;
|
|
7535
7586
|
exports.startTracking = startTracking;
|
|
7536
7587
|
exports.steerTurn = steerTurn;
|
|
7537
7588
|
exports.submitForm = submitForm;
|