@powerhousedao/service-offering 1.0.0-dev.31 → 1.0.0-dev.32

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.
@@ -1,5 +1,5 @@
1
1
  import { t as ResourceInstanceEditor } from "../module-DUv4g-dH.mjs";
2
- import { t as ResourceTemplateEditor } from "../module-fVJgWgZZ.mjs";
3
- import { t as ServiceOfferingEditor } from "../module-Cf_fIedY.mjs";
2
+ import { t as ResourceTemplateEditor } from "../module-MnHsJ1Eh.mjs";
3
+ import { t as ServiceOfferingEditor } from "../module-D1vzC_A4.mjs";
4
4
  import { t as SubscriptionInstanceEditor } from "../module-CTH1fYZz.mjs";
5
5
  export { ResourceInstanceEditor, ResourceTemplateEditor, ServiceOfferingEditor, SubscriptionInstanceEditor };
@@ -1,2 +1,2 @@
1
- import { t as ResourceTemplateEditor } from "../../module-fVJgWgZZ.mjs";
1
+ import { t as ResourceTemplateEditor } from "../../module-MnHsJ1Eh.mjs";
2
2
  export { ResourceTemplateEditor };
@@ -1,2 +1,2 @@
1
- import { t as ServiceOfferingEditor } from "../../module-Cf_fIedY.mjs";
1
+ import { t as ServiceOfferingEditor } from "../../module-D1vzC_A4.mjs";
2
2
  export { ServiceOfferingEditor };
@@ -24,4 +24,4 @@ function useResourceTemplateDocumentsInSelectedFolder() {
24
24
  //#endregion
25
25
  export { useSelectedResourceTemplateDocument as i, useResourceTemplateDocumentsInSelectedDrive as n, useResourceTemplateDocumentsInSelectedFolder as r, useResourceTemplateDocumentById as t };
26
26
 
27
- //# sourceMappingURL=hooks-BXivFqRO.mjs.map
27
+ //# sourceMappingURL=hooks-DA93GUHf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-BXivFqRO.mjs","names":[],"sources":["../../document-models/resource-template/v1/hooks.ts"],"sourcesContent":["import type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n ResourceTemplateAction,\n ResourceTemplateDocument,\n} from \"document-models/resource-template/v1\";\nimport {\n assertIsResourceTemplateDocument,\n isResourceTemplateDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a ResourceTemplate document by its id */\nexport function useResourceTemplateDocumentById(\n documentId: string | null | undefined,\n):\n | [ResourceTemplateDocument, DocumentDispatch<ResourceTemplateAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isResourceTemplateDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected ResourceTemplate document */\nexport function useSelectedResourceTemplateDocument(): [\n ResourceTemplateDocument,\n DocumentDispatch<ResourceTemplateAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsResourceTemplateDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all ResourceTemplate documents in the selected drive */\nexport function useResourceTemplateDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isResourceTemplateDocument);\n}\n\n/** Hook to get all ResourceTemplate documents in the selected folder */\nexport function useResourceTemplateDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isResourceTemplateDocument);\n}\n"],"mappings":";;;;AAiBA,SAAgB,gCACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,WAAW;AACxD,KAAI,CAAC,2BAA2B,SAAS,CAAE,QAAO,CAAC,KAAA,GAAW,KAAA,EAAU;AACxE,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,sCAGd;CACA,MAAM,CAAC,UAAU,YAAY,qBAAqB;AAElD,kCAAiC,SAAS;AAC1C,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,8CAA8C;AAE5D,QADiC,6BAA6B,EAC7B,OAAO,2BAA2B;;;AAIrE,SAAgB,+CAA+C;AAE7D,QADkC,8BAA8B,EAC9B,OAAO,2BAA2B"}
1
+ {"version":3,"file":"hooks-DA93GUHf.mjs","names":[],"sources":["../../document-models/resource-template/v1/hooks.ts"],"sourcesContent":["import type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n ResourceTemplateAction,\n ResourceTemplateDocument,\n} from \"document-models/resource-template/v1\";\nimport {\n assertIsResourceTemplateDocument,\n isResourceTemplateDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a ResourceTemplate document by its id */\nexport function useResourceTemplateDocumentById(\n documentId: string | null | undefined,\n):\n | [ResourceTemplateDocument, DocumentDispatch<ResourceTemplateAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isResourceTemplateDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected ResourceTemplate document */\nexport function useSelectedResourceTemplateDocument(): [\n ResourceTemplateDocument,\n DocumentDispatch<ResourceTemplateAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsResourceTemplateDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all ResourceTemplate documents in the selected drive */\nexport function useResourceTemplateDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isResourceTemplateDocument);\n}\n\n/** Hook to get all ResourceTemplate documents in the selected folder */\nexport function useResourceTemplateDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isResourceTemplateDocument);\n}\n"],"mappings":";;;;AAiBA,SAAgB,gCACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,WAAW;AACxD,KAAI,CAAC,2BAA2B,SAAS,CAAE,QAAO,CAAC,KAAA,GAAW,KAAA,EAAU;AACxE,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,sCAGd;CACA,MAAM,CAAC,UAAU,YAAY,qBAAqB;AAElD,kCAAiC,SAAS;AAC1C,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,8CAA8C;AAE5D,QADiC,6BAA6B,EAC7B,OAAO,2BAA2B;;;AAIrE,SAAgB,+CAA+C;AAE7D,QADkC,8BAA8B,EAC9B,OAAO,2BAA2B"}
@@ -13,8 +13,8 @@ import { t as resourceInstanceUpgradeManifest } from "./upgrade-manifest-By-mR6W
13
13
  import { t as resourceTemplateUpgradeManifest } from "./upgrade-manifest-BRn1e9cV.mjs";
14
14
  import { t as serviceOfferingUpgradeManifest } from "./upgrade-manifest-Zr_o3-Fo.mjs";
15
15
  import { t as ResourceInstanceEditor } from "./module-DUv4g-dH.mjs";
16
- import { t as ResourceTemplateEditor } from "./module-fVJgWgZZ.mjs";
17
- import { t as ServiceOfferingEditor } from "./module-Cf_fIedY.mjs";
16
+ import { t as ResourceTemplateEditor } from "./module-MnHsJ1Eh.mjs";
17
+ import { t as ServiceOfferingEditor } from "./module-D1vzC_A4.mjs";
18
18
  import { t as SubscriptionInstanceEditor } from "./module-CTH1fYZz.mjs";
19
19
  import { t as processorFactory } from "./factory-CXyOTCWR.mjs";
20
20
  //#region powerhouse.manifest.json
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/service-offering-editor/module.ts
3
3
  /** Document editor module for the "["powerhouse/service-offering"]" document type */
4
4
  const ServiceOfferingEditor = {
5
- Component: lazy(() => import("./editor-C4nj1HFm.mjs")),
5
+ Component: lazy(() => import("./editor-Bjf1Xgga.mjs")),
6
6
  documentTypes: ["powerhouse/service-offering"],
7
7
  config: {
8
8
  id: "service-offering-editor",
@@ -12,4 +12,4 @@ const ServiceOfferingEditor = {
12
12
  //#endregion
13
13
  export { ServiceOfferingEditor as t };
14
14
 
15
- //# sourceMappingURL=module-Cf_fIedY.mjs.map
15
+ //# sourceMappingURL=module-D1vzC_A4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-Cf_fIedY.mjs","names":[],"sources":["../../editors/service-offering-editor/module.ts"],"sourcesContent":["import type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"[\"powerhouse/service-offering\"]\" document type */\nexport const ServiceOfferingEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/service-offering\"],\n config: {\n id: \"service-offering-editor\",\n name: \"Service Offering Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,wBAAsC;CACjD,WAAW,WAAW,OAAO,yBAAe;CAC5C,eAAe,CAAC,8BAA8B;CAC9C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
1
+ {"version":3,"file":"module-D1vzC_A4.mjs","names":[],"sources":["../../editors/service-offering-editor/module.ts"],"sourcesContent":["import type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"[\"powerhouse/service-offering\"]\" document type */\nexport const ServiceOfferingEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/service-offering\"],\n config: {\n id: \"service-offering-editor\",\n name: \"Service Offering Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,wBAAsC;CACjD,WAAW,WAAW,OAAO,yBAAe;CAC5C,eAAe,CAAC,8BAA8B;CAC9C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/resource-template-editor/module.ts
3
3
  /** Document editor module for the "["powerhouse/resource-template"]" document type */
4
4
  const ResourceTemplateEditor = {
5
- Component: lazy(() => import("./editor-BDOeH1Jb.mjs")),
5
+ Component: lazy(() => import("./editor-CvzAGclJ.mjs")),
6
6
  documentTypes: ["powerhouse/resource-template"],
7
7
  config: {
8
8
  id: "resource-template-editor",
@@ -12,4 +12,4 @@ const ResourceTemplateEditor = {
12
12
  //#endregion
13
13
  export { ResourceTemplateEditor as t };
14
14
 
15
- //# sourceMappingURL=module-fVJgWgZZ.mjs.map
15
+ //# sourceMappingURL=module-MnHsJ1Eh.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-fVJgWgZZ.mjs","names":[],"sources":["../../editors/resource-template-editor/module.ts"],"sourcesContent":["import type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"[\"powerhouse/resource-template\"]\" document type */\nexport const ResourceTemplateEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/resource-template\"],\n config: {\n id: \"resource-template-editor\",\n name: \"Resource Template Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,yBAAuC;CAClD,WAAW,WAAW,OAAO,yBAAe;CAC5C,eAAe,CAAC,+BAA+B;CAC/C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
1
+ {"version":3,"file":"module-MnHsJ1Eh.mjs","names":[],"sources":["../../editors/resource-template-editor/module.ts"],"sourcesContent":["import type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"[\"powerhouse/resource-template\"]\" document type */\nexport const ResourceTemplateEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/resource-template\"],\n config: {\n id: \"resource-template-editor\",\n name: \"Resource Template Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,yBAAuC;CAClD,WAAW,WAAW,OAAO,yBAAe;CAC5C,eAAe,CAAC,+BAA+B;CAC/C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
@@ -86,4 +86,4 @@ function useServiceOfferingDocumentsInSelectedFolder() {
86
86
  //#endregion
87
87
  export { ServiceOfferingController as a, defaultGlobalState as c, useServiceOfferingDocumentsInSelectedFolder as i, defaultLocalState as l, useServiceOfferingDocumentById as n, createServiceOfferingDocument as o, useServiceOfferingDocumentsInSelectedDrive as r, createState as s, useSelectedServiceOfferingDocument as t, defaultPHState as u };
88
88
 
89
- //# sourceMappingURL=service-offering-BZy11C0H.mjs.map
89
+ //# sourceMappingURL=service-offering-BvRAyDvR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-offering-BZy11C0H.mjs","names":[],"sources":["../../document-models/service-offering/v1/gen/ph-factories.ts","../../document-models/service-offering/v1/gen/controller.ts","../../document-models/service-offering/v1/hooks.ts"],"sourcesContent":["/**\n * Factory methods for creating ServiceOfferingDocument instances\n */\nimport type { PHAuthState, PHDocumentState, PHBaseState } from \"document-model\";\nimport { createBaseState, defaultBaseState } from \"document-model\";\nimport type {\n ServiceOfferingDocument,\n ServiceOfferingGlobalState,\n ServiceOfferingLocalState,\n ServiceOfferingPHState,\n} from \"./types.js\";\nimport { utils } from \"./utils.js\";\n\nexport function defaultGlobalState(): ServiceOfferingGlobalState {\n return {\n id: null,\n operatorId: null,\n resourceTemplateId: null,\n title: \"\",\n summary: \"\",\n description: null,\n thumbnailUrl: null,\n infoLink: null,\n status: \"DRAFT\",\n lastModified: null,\n availableBillingCycles: [],\n facetTargets: [],\n services: [],\n tiers: [],\n optionGroups: [],\n };\n}\n\nexport function defaultLocalState(): ServiceOfferingLocalState {\n return {};\n}\n\nexport function defaultPHState(): ServiceOfferingPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(\n state?: Partial<ServiceOfferingGlobalState>,\n): ServiceOfferingGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n } as ServiceOfferingGlobalState;\n}\n\nexport function createLocalState(\n state?: Partial<ServiceOfferingLocalState>,\n): ServiceOfferingLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as ServiceOfferingLocalState;\n}\n\nexport function createState(\n baseState?: Partial<PHBaseState>,\n globalState?: Partial<ServiceOfferingGlobalState>,\n localState?: Partial<ServiceOfferingLocalState>,\n): ServiceOfferingPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a ServiceOfferingDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createServiceOfferingDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<ServiceOfferingGlobalState>;\n local?: Partial<ServiceOfferingLocalState>;\n }>,\n): ServiceOfferingDocument {\n const document = utils.createDocument(\n state\n ? createState(\n createBaseState(state.auth, state.document),\n state.global,\n state.local,\n )\n : undefined,\n );\n\n return document;\n}\n","import { PHDocumentController } from \"document-model\";\nimport { ServiceOffering } from \"../module.js\";\nimport type { ServiceOfferingAction, ServiceOfferingPHState } from \"./types.js\";\n\nexport const ServiceOfferingController = PHDocumentController.forDocumentModel<\n ServiceOfferingPHState,\n ServiceOfferingAction\n>(ServiceOffering);\n","import type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n ServiceOfferingAction,\n ServiceOfferingDocument,\n} from \"document-models/service-offering/v1\";\nimport {\n assertIsServiceOfferingDocument,\n isServiceOfferingDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a ServiceOffering document by its id */\nexport function useServiceOfferingDocumentById(\n documentId: string | null | undefined,\n):\n | [ServiceOfferingDocument, DocumentDispatch<ServiceOfferingAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isServiceOfferingDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected ServiceOffering document */\nexport function useSelectedServiceOfferingDocument(): [\n ServiceOfferingDocument,\n DocumentDispatch<ServiceOfferingAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsServiceOfferingDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all ServiceOffering documents in the selected drive */\nexport function useServiceOfferingDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isServiceOfferingDocument);\n}\n\n/** Hook to get all ServiceOffering documents in the selected folder */\nexport function useServiceOfferingDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isServiceOfferingDocument);\n}\n"],"mappings":";;;;AAaA,SAAgB,qBAAiD;AAC/D,QAAO;EACL,IAAI;EACJ,YAAY;EACZ,oBAAoB;EACpB,OAAO;EACP,SAAS;EACT,aAAa;EACb,cAAc;EACd,UAAU;EACV,QAAQ;EACR,cAAc;EACd,wBAAwB,EAAE;EAC1B,cAAc,EAAE;EAChB,UAAU,EAAE;EACZ,OAAO,EAAE;EACT,cAAc,EAAE;EACjB;;AAGH,SAAgB,oBAA+C;AAC7D,QAAO,EAAE;;AAGX,SAAgB,iBAAyC;AACvD,QAAO;EACL,GAAG,kBAAkB;EACrB,QAAQ,oBAAoB;EAC5B,OAAO,mBAAmB;EAC3B;;AAGH,SAAgB,kBACd,OAC4B;AAC5B,QAAO;EACL,GAAG,oBAAoB;EACvB,GAAI,SAAS,EAAE;EAChB;;AAGH,SAAgB,iBACd,OAC2B;AAC3B,QAAO;EACL,GAAG,mBAAmB;EACtB,GAAI,SAAS,EAAE;EAChB;;AAGH,SAAgB,YACd,WACA,aACA,YACwB;AACxB,QAAO;EACL,GAAG,gBAAgB,WAAW,MAAM,WAAW,SAAS;EACxD,QAAQ,kBAAkB,YAAY;EACtC,OAAO,iBAAiB,WAAW;EACpC;;;;;;;AAQH,SAAgB,8BACd,OAMyB;AAWzB,QAViB,MAAM,eACrB,QACI,YACE,gBAAgB,MAAM,MAAM,MAAM,SAAS,EAC3C,MAAM,QACN,MAAM,MACP,GACD,KAAA,EACL;;;;AC5FH,MAAa,4BAA4B,qBAAqB,iBAG5D,gBAAgB;;;;ACUlB,SAAgB,+BACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,WAAW;AACxD,KAAI,CAAC,0BAA0B,SAAS,CAAE,QAAO,CAAC,KAAA,GAAW,KAAA,EAAU;AACvE,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,qCAGd;CACA,MAAM,CAAC,UAAU,YAAY,qBAAqB;AAElD,iCAAgC,SAAS;AACzC,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,6CAA6C;AAE3D,QADiC,6BAA6B,EAC7B,OAAO,0BAA0B;;;AAIpE,SAAgB,8CAA8C;AAE5D,QADkC,8BAA8B,EAC9B,OAAO,0BAA0B"}
1
+ {"version":3,"file":"service-offering-BvRAyDvR.mjs","names":[],"sources":["../../document-models/service-offering/v1/gen/ph-factories.ts","../../document-models/service-offering/v1/gen/controller.ts","../../document-models/service-offering/v1/hooks.ts"],"sourcesContent":["/**\n * Factory methods for creating ServiceOfferingDocument instances\n */\nimport type { PHAuthState, PHDocumentState, PHBaseState } from \"document-model\";\nimport { createBaseState, defaultBaseState } from \"document-model\";\nimport type {\n ServiceOfferingDocument,\n ServiceOfferingGlobalState,\n ServiceOfferingLocalState,\n ServiceOfferingPHState,\n} from \"./types.js\";\nimport { utils } from \"./utils.js\";\n\nexport function defaultGlobalState(): ServiceOfferingGlobalState {\n return {\n id: null,\n operatorId: null,\n resourceTemplateId: null,\n title: \"\",\n summary: \"\",\n description: null,\n thumbnailUrl: null,\n infoLink: null,\n status: \"DRAFT\",\n lastModified: null,\n availableBillingCycles: [],\n facetTargets: [],\n services: [],\n tiers: [],\n optionGroups: [],\n };\n}\n\nexport function defaultLocalState(): ServiceOfferingLocalState {\n return {};\n}\n\nexport function defaultPHState(): ServiceOfferingPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(\n state?: Partial<ServiceOfferingGlobalState>,\n): ServiceOfferingGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n } as ServiceOfferingGlobalState;\n}\n\nexport function createLocalState(\n state?: Partial<ServiceOfferingLocalState>,\n): ServiceOfferingLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as ServiceOfferingLocalState;\n}\n\nexport function createState(\n baseState?: Partial<PHBaseState>,\n globalState?: Partial<ServiceOfferingGlobalState>,\n localState?: Partial<ServiceOfferingLocalState>,\n): ServiceOfferingPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a ServiceOfferingDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createServiceOfferingDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<ServiceOfferingGlobalState>;\n local?: Partial<ServiceOfferingLocalState>;\n }>,\n): ServiceOfferingDocument {\n const document = utils.createDocument(\n state\n ? createState(\n createBaseState(state.auth, state.document),\n state.global,\n state.local,\n )\n : undefined,\n );\n\n return document;\n}\n","import { PHDocumentController } from \"document-model\";\nimport { ServiceOffering } from \"../module.js\";\nimport type { ServiceOfferingAction, ServiceOfferingPHState } from \"./types.js\";\n\nexport const ServiceOfferingController = PHDocumentController.forDocumentModel<\n ServiceOfferingPHState,\n ServiceOfferingAction\n>(ServiceOffering);\n","import type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n ServiceOfferingAction,\n ServiceOfferingDocument,\n} from \"document-models/service-offering/v1\";\nimport {\n assertIsServiceOfferingDocument,\n isServiceOfferingDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a ServiceOffering document by its id */\nexport function useServiceOfferingDocumentById(\n documentId: string | null | undefined,\n):\n | [ServiceOfferingDocument, DocumentDispatch<ServiceOfferingAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isServiceOfferingDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected ServiceOffering document */\nexport function useSelectedServiceOfferingDocument(): [\n ServiceOfferingDocument,\n DocumentDispatch<ServiceOfferingAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsServiceOfferingDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all ServiceOffering documents in the selected drive */\nexport function useServiceOfferingDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isServiceOfferingDocument);\n}\n\n/** Hook to get all ServiceOffering documents in the selected folder */\nexport function useServiceOfferingDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isServiceOfferingDocument);\n}\n"],"mappings":";;;;AAaA,SAAgB,qBAAiD;AAC/D,QAAO;EACL,IAAI;EACJ,YAAY;EACZ,oBAAoB;EACpB,OAAO;EACP,SAAS;EACT,aAAa;EACb,cAAc;EACd,UAAU;EACV,QAAQ;EACR,cAAc;EACd,wBAAwB,EAAE;EAC1B,cAAc,EAAE;EAChB,UAAU,EAAE;EACZ,OAAO,EAAE;EACT,cAAc,EAAE;EACjB;;AAGH,SAAgB,oBAA+C;AAC7D,QAAO,EAAE;;AAGX,SAAgB,iBAAyC;AACvD,QAAO;EACL,GAAG,kBAAkB;EACrB,QAAQ,oBAAoB;EAC5B,OAAO,mBAAmB;EAC3B;;AAGH,SAAgB,kBACd,OAC4B;AAC5B,QAAO;EACL,GAAG,oBAAoB;EACvB,GAAI,SAAS,EAAE;EAChB;;AAGH,SAAgB,iBACd,OAC2B;AAC3B,QAAO;EACL,GAAG,mBAAmB;EACtB,GAAI,SAAS,EAAE;EAChB;;AAGH,SAAgB,YACd,WACA,aACA,YACwB;AACxB,QAAO;EACL,GAAG,gBAAgB,WAAW,MAAM,WAAW,SAAS;EACxD,QAAQ,kBAAkB,YAAY;EACtC,OAAO,iBAAiB,WAAW;EACpC;;;;;;;AAQH,SAAgB,8BACd,OAMyB;AAWzB,QAViB,MAAM,eACrB,QACI,YACE,gBAAgB,MAAM,MAAM,MAAM,SAAS,EAC3C,MAAM,QACN,MAAM,MACP,GACD,KAAA,EACL;;;;AC5FH,MAAa,4BAA4B,qBAAqB,iBAG5D,gBAAgB;;;;ACUlB,SAAgB,+BACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,WAAW;AACxD,KAAI,CAAC,0BAA0B,SAAS,CAAE,QAAO,CAAC,KAAA,GAAW,KAAA,EAAU;AACvE,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,qCAGd;CACA,MAAM,CAAC,UAAU,YAAY,qBAAqB;AAElD,iCAAgC,SAAS;AACzC,QAAO,CAAC,UAAU,SAAS;;;AAI7B,SAAgB,6CAA6C;AAE3D,QADiC,6BAA6B,EAC7B,OAAO,0BAA0B;;;AAIpE,SAAgB,8CAA8C;AAE5D,QADkC,8BAA8B,EAC9B,OAAO,0BAA0B"}