@powerhousedao/service-offering 1.0.0-dev.4 → 1.0.0-dev.6
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/document-models/facet/v1/actions.d.ts +3 -1
- package/dist/document-models/facet/v1/actions.d.ts.map +1 -1
- package/dist/document-models/facet/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/facet/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/facet/v1/gen/controller.js +3 -0
- package/dist/document-models/facet/v1/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/facet/v1/gen/document-model.js +31 -7
- package/dist/document-models/facet/v1/gen/document-schema.d.ts +6 -6
- package/dist/document-models/facet/v1/gen/index.d.ts +1 -0
- package/dist/document-models/facet/v1/gen/index.d.ts.map +1 -1
- package/dist/document-models/facet/v1/gen/index.js +1 -0
- package/dist/document-models/facet/v1/gen/option-management/error.d.ts +27 -1
- package/dist/document-models/facet/v1/gen/option-management/error.d.ts.map +1 -1
- package/dist/document-models/facet/v1/gen/option-management/error.js +23 -1
- package/dist/document-models/facet/v1/gen/ph-factories.js +2 -2
- package/dist/document-models/facet/v1/gen/schema/types.d.ts +2 -2
- package/dist/document-models/facet/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/facet/v1/gen/schema/zod.js +2 -2
- package/dist/document-models/facet/v1/gen/utils.js +2 -2
- package/dist/document-models/facet/v1/module.d.ts +1 -1
- package/dist/document-models/facet/v1/module.d.ts.map +1 -1
- package/dist/document-models/facet/v1/module.js +4 -1
- package/dist/document-models/resource-instance/v1/actions.d.ts +4 -1
- package/dist/document-models/resource-instance/v1/actions.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/configuration-management/error.d.ts +34 -1
- package/dist/document-models/resource-instance/v1/gen/configuration-management/error.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/configuration-management/error.js +32 -1
- package/dist/document-models/resource-instance/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/resource-instance/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/resource-instance/v1/gen/controller.js +3 -0
- package/dist/document-models/resource-instance/v1/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/document-model.js +222 -70
- package/dist/document-models/resource-instance/v1/gen/document-schema.d.ts +0 -6
- package/dist/document-models/resource-instance/v1/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/index.d.ts +1 -0
- package/dist/document-models/resource-instance/v1/gen/index.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/index.js +1 -0
- package/dist/document-models/resource-instance/v1/gen/instance-management/actions.d.ts +6 -2
- package/dist/document-models/resource-instance/v1/gen/instance-management/actions.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/creators.d.ts +3 -2
- package/dist/document-models/resource-instance/v1/gen/instance-management/creators.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/creators.js +2 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/error.d.ts +98 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/error.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/error.js +112 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/operations.d.ts +2 -1
- package/dist/document-models/resource-instance/v1/gen/instance-management/operations.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/ph-factories.js +0 -2
- package/dist/document-models/resource-instance/v1/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/reducer.js +6 -1
- package/dist/document-models/resource-instance/v1/gen/schema/types.d.ts +3 -3
- package/dist/document-models/resource-instance/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/schema/zod.d.ts +2 -1
- package/dist/document-models/resource-instance/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/schema/zod.js +5 -3
- package/dist/document-models/resource-instance/v1/gen/utils.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/gen/utils.js +0 -2
- package/dist/document-models/resource-instance/v1/module.d.ts +1 -1
- package/dist/document-models/resource-instance/v1/module.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/module.js +4 -1
- package/dist/document-models/resource-instance/v1/src/reducers/configuration-management.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/src/reducers/configuration-management.js +57 -53
- package/dist/document-models/resource-instance/v1/src/reducers/instance-management.d.ts.map +1 -1
- package/dist/document-models/resource-instance/v1/src/reducers/instance-management.js +57 -21
- package/dist/document-models/resource-instance/v1/tests/instance-management.test.js +11 -1
- package/dist/document-models/resource-template/v1/actions.d.ts +3 -1
- package/dist/document-models/resource-template/v1/actions.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/audience-management/error.d.ts +20 -1
- package/dist/document-models/resource-template/v1/gen/audience-management/error.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/audience-management/error.js +16 -1
- package/dist/document-models/resource-template/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/resource-template/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/resource-template/v1/gen/controller.js +3 -0
- package/dist/document-models/resource-template/v1/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/document-model.js +207 -89
- package/dist/document-models/resource-template/v1/gen/document-schema.d.ts +12 -12
- package/dist/document-models/resource-template/v1/gen/facet-targeting/error.d.ts +27 -1
- package/dist/document-models/resource-template/v1/gen/facet-targeting/error.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/facet-targeting/error.js +23 -1
- package/dist/document-models/resource-template/v1/gen/index.d.ts +1 -0
- package/dist/document-models/resource-template/v1/gen/index.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/index.js +1 -0
- package/dist/document-models/resource-template/v1/gen/option-group-management/error.d.ts +27 -1
- package/dist/document-models/resource-template/v1/gen/option-group-management/error.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/option-group-management/error.js +23 -1
- package/dist/document-models/resource-template/v1/gen/ph-factories.js +3 -3
- package/dist/document-models/resource-template/v1/gen/schema/types.d.ts +4 -4
- package/dist/document-models/resource-template/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/schema/zod.js +4 -4
- package/dist/document-models/resource-template/v1/gen/service-management/error.d.ts +51 -1
- package/dist/document-models/resource-template/v1/gen/service-management/error.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/gen/service-management/error.js +49 -1
- package/dist/document-models/resource-template/v1/gen/utils.js +3 -3
- package/dist/document-models/resource-template/v1/module.d.ts +1 -1
- package/dist/document-models/resource-template/v1/module.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/module.js +4 -1
- package/dist/document-models/resource-template/v1/src/reducers/option-group-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/v1/src/reducers/option-group-management.js +2 -21
- package/dist/document-models/service-offering/v1/actions.d.ts +3 -1
- package/dist/document-models/service-offering/v1/actions.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/service-offering/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/service-offering/v1/gen/controller.js +3 -0
- package/dist/document-models/service-offering/v1/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/document-model.js +421 -199
- package/dist/document-models/service-offering/v1/gen/document-schema.d.ts +9 -9
- package/dist/document-models/service-offering/v1/gen/index.d.ts +1 -0
- package/dist/document-models/service-offering/v1/gen/index.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/index.js +1 -0
- package/dist/document-models/service-offering/v1/gen/offering/error.d.ts +41 -1
- package/dist/document-models/service-offering/v1/gen/offering/error.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/offering/error.js +37 -1
- package/dist/document-models/service-offering/v1/gen/option-groups/error.d.ts +55 -1
- package/dist/document-models/service-offering/v1/gen/option-groups/error.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/option-groups/error.js +53 -1
- package/dist/document-models/service-offering/v1/gen/ph-factories.js +3 -3
- package/dist/document-models/service-offering/v1/gen/schema/types.d.ts +134 -61
- package/dist/document-models/service-offering/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/schema/zod.d.ts +35 -10
- package/dist/document-models/service-offering/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/schema/zod.js +182 -64
- package/dist/document-models/service-offering/v1/gen/services/error.d.ts +20 -1
- package/dist/document-models/service-offering/v1/gen/services/error.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/services/error.js +16 -1
- package/dist/document-models/service-offering/v1/gen/tiers/error.d.ts +100 -1
- package/dist/document-models/service-offering/v1/gen/tiers/error.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/gen/tiers/error.js +106 -1
- package/dist/document-models/service-offering/v1/gen/utils.js +4 -4
- package/dist/document-models/service-offering/v1/module.d.ts +1 -1
- package/dist/document-models/service-offering/v1/module.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/module.js +4 -1
- package/dist/document-models/service-offering/v1/src/reducers/offering.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/src/reducers/offering.js +20 -12
- package/dist/document-models/service-offering/v1/src/reducers/option-groups.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/src/reducers/option-groups.js +157 -39
- package/dist/document-models/service-offering/v1/src/reducers/services.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/src/reducers/services.js +17 -14
- package/dist/document-models/service-offering/v1/src/reducers/tiers.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/src/reducers/tiers.js +111 -78
- package/dist/document-models/service-offering/v1/src/utils.d.ts +60 -1
- package/dist/document-models/service-offering/v1/src/utils.d.ts.map +1 -1
- package/dist/document-models/service-offering/v1/src/utils.js +173 -1
- package/dist/document-models/service-offering/v1/tests/option-groups.test.js +1 -1
- package/dist/document-models/service-offering/v1/utils.d.ts +3 -0
- package/dist/document-models/service-offering/v1/utils.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/actions.d.ts +3 -1
- package/dist/document-models/subscription-instance/v1/actions.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/controller.d.ts +4 -0
- package/dist/document-models/subscription-instance/v1/gen/controller.d.ts.map +1 -0
- package/dist/document-models/subscription-instance/v1/gen/controller.js +3 -0
- package/dist/document-models/subscription-instance/v1/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/document-model.js +488 -246
- package/dist/document-models/subscription-instance/v1/gen/document-schema.d.ts +3 -3
- package/dist/document-models/subscription-instance/v1/gen/index.d.ts +1 -0
- package/dist/document-models/subscription-instance/v1/gen/index.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/index.js +1 -0
- package/dist/document-models/subscription-instance/v1/gen/metrics/error.d.ts +73 -1
- package/dist/document-models/subscription-instance/v1/gen/metrics/error.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/metrics/error.js +86 -1
- package/dist/document-models/subscription-instance/v1/gen/ph-factories.js +1 -1
- package/dist/document-models/subscription-instance/v1/gen/schema/types.d.ts +199 -82
- package/dist/document-models/subscription-instance/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/schema/zod.d.ts +22 -12
- package/dist/document-models/subscription-instance/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/schema/zod.js +230 -84
- package/dist/document-models/subscription-instance/v1/gen/service/error.d.ts +62 -1
- package/dist/document-models/subscription-instance/v1/gen/service/error.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/service/error.js +60 -1
- package/dist/document-models/subscription-instance/v1/gen/service-group/error.d.ts +39 -1
- package/dist/document-models/subscription-instance/v1/gen/service-group/error.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/service-group/error.js +39 -1
- package/dist/document-models/subscription-instance/v1/gen/subscription/error.d.ts +55 -1
- package/dist/document-models/subscription-instance/v1/gen/subscription/error.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/gen/subscription/error.js +51 -1
- package/dist/document-models/subscription-instance/v1/gen/utils.js +2 -2
- package/dist/document-models/subscription-instance/v1/module.d.ts +1 -1
- package/dist/document-models/subscription-instance/v1/module.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/module.js +4 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/customer.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/customer.js +1 -0
- package/dist/document-models/subscription-instance/v1/src/reducers/metrics.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/metrics.js +70 -45
- package/dist/document-models/subscription-instance/v1/src/reducers/service-group.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/service-group.js +108 -30
- package/dist/document-models/subscription-instance/v1/src/reducers/service.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/service.js +108 -39
- package/dist/document-models/subscription-instance/v1/src/reducers/subscription.d.ts.map +1 -1
- package/dist/document-models/subscription-instance/v1/src/reducers/subscription.js +193 -35
- package/dist/editors/resource-instance-editor/editor.d.ts.map +1 -1
- package/dist/editors/resource-instance-editor/editor.js +13 -3
- package/dist/editors/service-offering-editor/components/ResourceTemplateSelector.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ResourceTemplateSelector.js +4 -2
- package/dist/editors/service-offering-editor/components/ServiceCatalog.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ServiceCatalog.js +189 -32
- package/dist/editors/service-offering-editor/components/TheMatrix.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/TheMatrix.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/TheMatrix.js +295 -140
- package/dist/editors/service-offering-editor/components/TierDefinition.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/TierDefinition.js +2 -0
- package/dist/editors/service-offering-editor/components/TierPricingOptionsPanel.js +3 -3
- package/dist/editors/service-offering-editor/components/pricing-utils.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/pricing-utils.js +26 -7
- package/dist/editors/subscription-instance-editor/components/BillingPanel.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/BillingPanel.js +4 -4
- package/dist/editors/subscription-instance-editor/components/CustomerInfo.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/CustomerInfo.js +3 -2
- package/dist/editors/subscription-instance-editor/components/ImportServiceConfigButton.d.ts +3 -0
- package/dist/editors/subscription-instance-editor/components/ImportServiceConfigButton.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/ImportServiceConfigButton.js +12 -0
- package/dist/editors/subscription-instance-editor/components/MetricActions.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/MetricActions.js +4 -2
- package/dist/editors/subscription-instance-editor/components/MockDataButton.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/MockDataButton.js +214 -2
- package/dist/editors/subscription-instance-editor/components/OperatorNotes.js +1 -1
- package/dist/editors/subscription-instance-editor/components/ServicesPanel.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/ServicesPanel.js +9 -20
- package/dist/editors/subscription-instance-editor/components/SubscriptionActions.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/SubscriptionActions.js +8 -9
- package/dist/editors/subscription-instance-editor/components/SubscriptionHeader.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/SubscriptionHeader.js +1 -1
- package/dist/editors/subscription-instance-editor/components/billing-utils.d.ts +14 -6
- package/dist/editors/subscription-instance-editor/components/billing-utils.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/billing-utils.js +19 -23
- package/dist/editors/subscription-instance-editor/components/mapOfferingToSubscription.d.ts +16 -2
- package/dist/editors/subscription-instance-editor/components/mapOfferingToSubscription.d.ts.map +1 -1
- package/dist/editors/subscription-instance-editor/components/mapOfferingToSubscription.js +155 -6
- package/dist/powerhouse.manifest.json +29 -3
- package/dist/style.css +14 -0
- package/dist/subgraphs/resources-services/resolvers.d.ts +1 -1
- package/dist/subgraphs/resources-services/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/resources-services/resolvers.js +273 -158
- package/dist/subgraphs/resources-services/schema.d.ts.map +1 -1
- package/dist/subgraphs/resources-services/schema.js +107 -41
- package/package.json +22 -18
|
@@ -1,86 +1,155 @@
|
|
|
1
|
+
import { RemoveServiceNotFoundError, UpdateServiceSetupCostNotFoundError, UpdateServiceRecurringCostNotFoundError, ReportSetupPaymentServiceNotFoundError, ReportRecurringPaymentServiceNotFoundError, UpdateServiceInfoNotFoundError, AddServiceFacetSelectionServiceNotFoundError, RemoveServiceFacetSelectionServiceNotFoundError, } from "../../gen/service/error.js";
|
|
1
2
|
export const subscriptionInstanceServiceOperations = {
|
|
2
3
|
addServiceOperation(state, action) {
|
|
3
|
-
|
|
4
|
-
id: action.input.
|
|
5
|
-
name: action.input.name,
|
|
4
|
+
const service = {
|
|
5
|
+
id: action.input.serviceId,
|
|
6
|
+
name: action.input.name || null,
|
|
6
7
|
description: action.input.description || null,
|
|
7
8
|
customValue: action.input.customValue || null,
|
|
8
9
|
facetSelections: [],
|
|
9
|
-
setupCost:
|
|
10
|
-
|
|
10
|
+
setupCost: action.input.setupAmount && action.input.setupCurrency
|
|
11
|
+
? {
|
|
12
|
+
amount: action.input.setupAmount,
|
|
13
|
+
currency: action.input.setupCurrency,
|
|
14
|
+
billingDate: action.input.setupBillingDate || null,
|
|
15
|
+
paymentDate: action.input.setupPaymentDate || null,
|
|
16
|
+
}
|
|
17
|
+
: null,
|
|
18
|
+
recurringCost: action.input.recurringAmount &&
|
|
19
|
+
action.input.recurringCurrency &&
|
|
20
|
+
action.input.recurringBillingCycle
|
|
21
|
+
? {
|
|
22
|
+
amount: action.input.recurringAmount,
|
|
23
|
+
currency: action.input.recurringCurrency,
|
|
24
|
+
billingCycle: action.input.recurringBillingCycle,
|
|
25
|
+
nextBillingDate: action.input.recurringNextBillingDate || null,
|
|
26
|
+
lastPaymentDate: action.input.recurringLastPaymentDate || null,
|
|
27
|
+
discount: action.input.recurringDiscount
|
|
28
|
+
? {
|
|
29
|
+
originalAmount: action.input.recurringDiscount.originalAmount,
|
|
30
|
+
discountType: action.input.recurringDiscount.discountType,
|
|
31
|
+
discountValue: action.input.recurringDiscount.discountValue,
|
|
32
|
+
source: action.input.recurringDiscount.source,
|
|
33
|
+
}
|
|
34
|
+
: null,
|
|
35
|
+
}
|
|
36
|
+
: null,
|
|
11
37
|
metrics: [],
|
|
12
|
-
}
|
|
38
|
+
};
|
|
39
|
+
state.services.push(service);
|
|
13
40
|
},
|
|
14
41
|
removeServiceOperation(state, action) {
|
|
15
|
-
const index = state.services.findIndex((s) => s.id === action.input.
|
|
16
|
-
if (index
|
|
17
|
-
|
|
42
|
+
const index = state.services.findIndex((s) => s.id === action.input.serviceId);
|
|
43
|
+
if (index === -1) {
|
|
44
|
+
throw new RemoveServiceNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
18
45
|
}
|
|
46
|
+
state.services.splice(index, 1);
|
|
19
47
|
},
|
|
20
48
|
updateServiceSetupCostOperation(state, action) {
|
|
21
49
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
22
|
-
if (svc) {
|
|
50
|
+
if (!svc) {
|
|
51
|
+
throw new UpdateServiceSetupCostNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
52
|
+
}
|
|
53
|
+
if (action.input.amount && action.input.currency) {
|
|
23
54
|
svc.setupCost = {
|
|
24
55
|
amount: action.input.amount,
|
|
25
56
|
currency: action.input.currency,
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
billingDate: action.input.billingDate || null,
|
|
58
|
+
paymentDate: action.input.paymentDate || null,
|
|
28
59
|
};
|
|
29
60
|
}
|
|
61
|
+
else if (svc.setupCost) {
|
|
62
|
+
if (action.input.amount)
|
|
63
|
+
svc.setupCost.amount = action.input.amount;
|
|
64
|
+
if (action.input.currency)
|
|
65
|
+
svc.setupCost.currency = action.input.currency;
|
|
66
|
+
if (action.input.billingDate !== undefined)
|
|
67
|
+
svc.setupCost.billingDate = action.input.billingDate || null;
|
|
68
|
+
if (action.input.paymentDate !== undefined)
|
|
69
|
+
svc.setupCost.paymentDate = action.input.paymentDate || null;
|
|
70
|
+
}
|
|
30
71
|
},
|
|
31
72
|
updateServiceRecurringCostOperation(state, action) {
|
|
32
73
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
33
|
-
if (svc) {
|
|
74
|
+
if (!svc) {
|
|
75
|
+
throw new UpdateServiceRecurringCostNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
76
|
+
}
|
|
77
|
+
if (action.input.amount &&
|
|
78
|
+
action.input.currency &&
|
|
79
|
+
action.input.billingCycle) {
|
|
34
80
|
svc.recurringCost = {
|
|
35
81
|
amount: action.input.amount,
|
|
36
82
|
currency: action.input.currency,
|
|
37
|
-
|
|
38
|
-
|
|
83
|
+
billingCycle: action.input.billingCycle,
|
|
84
|
+
nextBillingDate: action.input.nextBillingDate || null,
|
|
85
|
+
lastPaymentDate: action.input.lastPaymentDate || null,
|
|
86
|
+
discount: svc.recurringCost?.discount || null,
|
|
39
87
|
};
|
|
40
88
|
}
|
|
89
|
+
else if (svc.recurringCost) {
|
|
90
|
+
if (action.input.amount)
|
|
91
|
+
svc.recurringCost.amount = action.input.amount;
|
|
92
|
+
if (action.input.currency)
|
|
93
|
+
svc.recurringCost.currency = action.input.currency;
|
|
94
|
+
if (action.input.billingCycle)
|
|
95
|
+
svc.recurringCost.billingCycle = action.input.billingCycle;
|
|
96
|
+
if (action.input.nextBillingDate !== undefined)
|
|
97
|
+
svc.recurringCost.nextBillingDate =
|
|
98
|
+
action.input.nextBillingDate || null;
|
|
99
|
+
if (action.input.lastPaymentDate !== undefined)
|
|
100
|
+
svc.recurringCost.lastPaymentDate =
|
|
101
|
+
action.input.lastPaymentDate || null;
|
|
102
|
+
}
|
|
41
103
|
},
|
|
42
104
|
reportSetupPaymentOperation(state, action) {
|
|
43
105
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
44
|
-
if (svc
|
|
45
|
-
|
|
46
|
-
|
|
106
|
+
if (!svc) {
|
|
107
|
+
throw new ReportSetupPaymentServiceNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
108
|
+
}
|
|
109
|
+
if (svc.setupCost) {
|
|
110
|
+
svc.setupCost.paymentDate = action.input.paymentDate;
|
|
47
111
|
}
|
|
48
112
|
},
|
|
49
113
|
reportRecurringPaymentOperation(state, action) {
|
|
50
114
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
51
|
-
if (svc
|
|
52
|
-
|
|
53
|
-
|
|
115
|
+
if (!svc) {
|
|
116
|
+
throw new ReportRecurringPaymentServiceNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
117
|
+
}
|
|
118
|
+
if (svc.recurringCost) {
|
|
119
|
+
svc.recurringCost.lastPaymentDate = action.input.paymentDate;
|
|
54
120
|
}
|
|
55
121
|
},
|
|
56
122
|
updateServiceInfoOperation(state, action) {
|
|
57
123
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
58
|
-
if (svc) {
|
|
59
|
-
|
|
60
|
-
svc.name = action.input.name ?? svc.name;
|
|
61
|
-
if (action.input.description !== undefined)
|
|
62
|
-
svc.description = action.input.description ?? null;
|
|
63
|
-
if (action.input.customValue !== undefined)
|
|
64
|
-
svc.customValue = action.input.customValue ?? null;
|
|
124
|
+
if (!svc) {
|
|
125
|
+
throw new UpdateServiceInfoNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
65
126
|
}
|
|
127
|
+
if (action.input.name !== undefined)
|
|
128
|
+
svc.name = action.input.name || null;
|
|
129
|
+
if (action.input.description !== undefined)
|
|
130
|
+
svc.description = action.input.description || null;
|
|
131
|
+
if (action.input.customValue !== undefined)
|
|
132
|
+
svc.customValue = action.input.customValue || null;
|
|
66
133
|
},
|
|
67
134
|
addServiceFacetSelectionOperation(state, action) {
|
|
68
135
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
69
|
-
if (svc) {
|
|
70
|
-
|
|
71
|
-
id: action.input.id,
|
|
72
|
-
facetName: action.input.facetName,
|
|
73
|
-
selectedOption: action.input.selectedOption,
|
|
74
|
-
});
|
|
136
|
+
if (!svc) {
|
|
137
|
+
throw new AddServiceFacetSelectionServiceNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
75
138
|
}
|
|
139
|
+
svc.facetSelections.push({
|
|
140
|
+
id: action.input.facetSelectionId,
|
|
141
|
+
facetName: action.input.facetName,
|
|
142
|
+
selectedOption: action.input.selectedOption,
|
|
143
|
+
});
|
|
76
144
|
},
|
|
77
145
|
removeServiceFacetSelectionOperation(state, action) {
|
|
78
146
|
const svc = state.services.find((s) => s.id === action.input.serviceId);
|
|
79
|
-
if (svc) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
147
|
+
if (!svc) {
|
|
148
|
+
throw new RemoveServiceFacetSelectionServiceNotFoundError(`Service with ID ${action.input.serviceId} not found`);
|
|
149
|
+
}
|
|
150
|
+
const index = svc.facetSelections.findIndex((fs) => fs.id === action.input.facetSelectionId);
|
|
151
|
+
if (index !== -1) {
|
|
152
|
+
svc.facetSelections.splice(index, 1);
|
|
84
153
|
}
|
|
85
154
|
},
|
|
86
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../../../../document-models/subscription-instance/v1/src/reducers/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,0EAA0E,CAAC;
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../../../../document-models/subscription-instance/v1/src/reducers/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,0EAA0E,CAAC;AAW3I,eAAO,MAAM,0CAA0C,EAAE,0CAwStD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActivateNotPendingError, PauseNotActiveError, SetExpiringNotActiveError, CancelAlreadyCancelledError, ResumeNotPausedError, RenewNotExpiringError, RemoveBudgetNotFoundError, } from "../../gen/subscription/error.js";
|
|
1
2
|
export const subscriptionInstanceSubscriptionOperations = {
|
|
2
3
|
initializeSubscriptionOperation(state, action) {
|
|
3
4
|
state.customerId = action.input.customerId || null;
|
|
@@ -11,72 +12,231 @@ export const subscriptionInstanceSubscriptionOperations = {
|
|
|
11
12
|
state.tierPricingMode = action.input.tierPricingMode || null;
|
|
12
13
|
state.selectedBillingCycle = action.input.selectedBillingCycle || null;
|
|
13
14
|
state.globalCurrency = action.input.globalCurrency || null;
|
|
14
|
-
|
|
15
|
+
if (action.input.resourceId) {
|
|
16
|
+
state.resource = {
|
|
17
|
+
id: action.input.resourceId,
|
|
18
|
+
label: action.input.resourceLabel || null,
|
|
19
|
+
thumbnailUrl: action.input.resourceThumbnailUrl || null,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
state.autoRenew = action.input.autoRenew || false;
|
|
15
23
|
state.createdAt = action.input.createdAt;
|
|
16
|
-
state.status = "
|
|
17
|
-
state.services = []
|
|
18
|
-
|
|
24
|
+
state.status = "PENDING";
|
|
25
|
+
state.services = (action.input.services || []).map((s) => ({
|
|
26
|
+
id: s.id,
|
|
27
|
+
name: s.name || null,
|
|
28
|
+
description: s.description || null,
|
|
29
|
+
customValue: s.customValue || null,
|
|
30
|
+
facetSelections: (s.facetSelections || []).map((fs) => ({
|
|
31
|
+
id: fs.id,
|
|
32
|
+
facetName: fs.facetName,
|
|
33
|
+
selectedOption: fs.selectedOption,
|
|
34
|
+
})),
|
|
35
|
+
setupCost: s.setupAmount && s.setupCurrency
|
|
36
|
+
? {
|
|
37
|
+
amount: s.setupAmount,
|
|
38
|
+
currency: s.setupCurrency,
|
|
39
|
+
billingDate: null,
|
|
40
|
+
paymentDate: null,
|
|
41
|
+
}
|
|
42
|
+
: null,
|
|
43
|
+
recurringCost: s.recurringAmount && s.recurringCurrency && s.recurringBillingCycle
|
|
44
|
+
? {
|
|
45
|
+
amount: s.recurringAmount,
|
|
46
|
+
currency: s.recurringCurrency,
|
|
47
|
+
billingCycle: s.recurringBillingCycle,
|
|
48
|
+
nextBillingDate: null,
|
|
49
|
+
lastPaymentDate: null,
|
|
50
|
+
discount: s.recurringDiscount
|
|
51
|
+
? {
|
|
52
|
+
originalAmount: s.recurringDiscount.originalAmount,
|
|
53
|
+
discountType: s.recurringDiscount.discountType,
|
|
54
|
+
discountValue: s.recurringDiscount.discountValue,
|
|
55
|
+
source: s.recurringDiscount.source,
|
|
56
|
+
}
|
|
57
|
+
: null,
|
|
58
|
+
}
|
|
59
|
+
: null,
|
|
60
|
+
metrics: (s.metrics || []).map((m) => ({
|
|
61
|
+
id: m.id,
|
|
62
|
+
name: m.name,
|
|
63
|
+
unitName: m.unitName,
|
|
64
|
+
limit: m.limit || null,
|
|
65
|
+
freeLimit: m.freeLimit || null,
|
|
66
|
+
paidLimit: m.paidLimit || null,
|
|
67
|
+
unitCost: m.unitCostAmount && m.unitCostCurrency && m.unitCostBillingCycle
|
|
68
|
+
? {
|
|
69
|
+
amount: m.unitCostAmount,
|
|
70
|
+
currency: m.unitCostCurrency,
|
|
71
|
+
billingCycle: m.unitCostBillingCycle,
|
|
72
|
+
nextBillingDate: null,
|
|
73
|
+
lastPaymentDate: null,
|
|
74
|
+
discount: null,
|
|
75
|
+
}
|
|
76
|
+
: null,
|
|
77
|
+
currentUsage: m.currentUsage,
|
|
78
|
+
usageResetPeriod: m.usageResetPeriod || null,
|
|
79
|
+
nextUsageReset: null,
|
|
80
|
+
})),
|
|
81
|
+
}));
|
|
82
|
+
state.serviceGroups = (action.input.serviceGroups || []).map((sg) => ({
|
|
83
|
+
id: sg.id,
|
|
84
|
+
name: sg.name,
|
|
85
|
+
optional: sg.optional,
|
|
86
|
+
costType: sg.costType || null,
|
|
87
|
+
setupCost: sg.setupAmount && sg.setupCurrency
|
|
88
|
+
? {
|
|
89
|
+
amount: sg.setupAmount,
|
|
90
|
+
currency: sg.setupCurrency,
|
|
91
|
+
billingDate: sg.setupBillingDate || null,
|
|
92
|
+
paymentDate: null,
|
|
93
|
+
}
|
|
94
|
+
: null,
|
|
95
|
+
recurringCost: sg.recurringAmount && sg.recurringCurrency && sg.recurringBillingCycle
|
|
96
|
+
? {
|
|
97
|
+
amount: sg.recurringAmount,
|
|
98
|
+
currency: sg.recurringCurrency,
|
|
99
|
+
billingCycle: sg.recurringBillingCycle,
|
|
100
|
+
nextBillingDate: null,
|
|
101
|
+
lastPaymentDate: null,
|
|
102
|
+
discount: sg.recurringDiscount
|
|
103
|
+
? {
|
|
104
|
+
originalAmount: sg.recurringDiscount.originalAmount,
|
|
105
|
+
discountType: sg.recurringDiscount.discountType,
|
|
106
|
+
discountValue: sg.recurringDiscount.discountValue,
|
|
107
|
+
source: sg.recurringDiscount.source,
|
|
108
|
+
}
|
|
109
|
+
: null,
|
|
110
|
+
}
|
|
111
|
+
: null,
|
|
112
|
+
services: (sg.services || []).map((s) => ({
|
|
113
|
+
id: s.id,
|
|
114
|
+
name: s.name || null,
|
|
115
|
+
description: s.description || null,
|
|
116
|
+
customValue: s.customValue || null,
|
|
117
|
+
facetSelections: (s.facetSelections || []).map((fs) => ({
|
|
118
|
+
id: fs.id,
|
|
119
|
+
facetName: fs.facetName,
|
|
120
|
+
selectedOption: fs.selectedOption,
|
|
121
|
+
})),
|
|
122
|
+
setupCost: s.setupAmount && s.setupCurrency
|
|
123
|
+
? {
|
|
124
|
+
amount: s.setupAmount,
|
|
125
|
+
currency: s.setupCurrency,
|
|
126
|
+
billingDate: null,
|
|
127
|
+
paymentDate: null,
|
|
128
|
+
}
|
|
129
|
+
: null,
|
|
130
|
+
recurringCost: s.recurringAmount && s.recurringCurrency && s.recurringBillingCycle
|
|
131
|
+
? {
|
|
132
|
+
amount: s.recurringAmount,
|
|
133
|
+
currency: s.recurringCurrency,
|
|
134
|
+
billingCycle: s.recurringBillingCycle,
|
|
135
|
+
nextBillingDate: null,
|
|
136
|
+
lastPaymentDate: null,
|
|
137
|
+
discount: s.recurringDiscount
|
|
138
|
+
? {
|
|
139
|
+
originalAmount: s.recurringDiscount.originalAmount,
|
|
140
|
+
discountType: s.recurringDiscount.discountType,
|
|
141
|
+
discountValue: s.recurringDiscount.discountValue,
|
|
142
|
+
source: s.recurringDiscount.source,
|
|
143
|
+
}
|
|
144
|
+
: null,
|
|
145
|
+
}
|
|
146
|
+
: null,
|
|
147
|
+
metrics: (s.metrics || []).map((m) => ({
|
|
148
|
+
id: m.id,
|
|
149
|
+
name: m.name,
|
|
150
|
+
unitName: m.unitName,
|
|
151
|
+
limit: m.limit || null,
|
|
152
|
+
freeLimit: m.freeLimit || null,
|
|
153
|
+
paidLimit: m.paidLimit || null,
|
|
154
|
+
unitCost: m.unitCostAmount && m.unitCostCurrency && m.unitCostBillingCycle
|
|
155
|
+
? {
|
|
156
|
+
amount: m.unitCostAmount,
|
|
157
|
+
currency: m.unitCostCurrency,
|
|
158
|
+
billingCycle: m.unitCostBillingCycle,
|
|
159
|
+
nextBillingDate: null,
|
|
160
|
+
lastPaymentDate: null,
|
|
161
|
+
discount: null,
|
|
162
|
+
}
|
|
163
|
+
: null,
|
|
164
|
+
currentUsage: m.currentUsage,
|
|
165
|
+
usageResetPeriod: m.usageResetPeriod || null,
|
|
166
|
+
nextUsageReset: null,
|
|
167
|
+
})),
|
|
168
|
+
})),
|
|
169
|
+
}));
|
|
19
170
|
},
|
|
20
171
|
setResourceDocumentOperation(state, action) {
|
|
21
172
|
state.resource = {
|
|
22
|
-
|
|
23
|
-
|
|
173
|
+
id: action.input.resourceId,
|
|
174
|
+
label: action.input.resourceLabel || null,
|
|
175
|
+
thumbnailUrl: action.input.resourceThumbnailUrl || null,
|
|
24
176
|
};
|
|
25
177
|
},
|
|
26
178
|
updateSubscriptionStatusOperation(state, action) {
|
|
27
179
|
state.status = action.input.status;
|
|
28
180
|
},
|
|
29
181
|
activateSubscriptionOperation(state, action) {
|
|
30
|
-
if (state.status
|
|
31
|
-
state.status
|
|
32
|
-
state.activatedSince = action.input.activatedAt;
|
|
182
|
+
if (state.status !== "PENDING") {
|
|
183
|
+
throw new ActivateNotPendingError(`Cannot activate subscription with status ${state.status}`);
|
|
33
184
|
}
|
|
185
|
+
state.status = "ACTIVE";
|
|
186
|
+
state.activatedSince = action.input.activatedSince;
|
|
34
187
|
},
|
|
35
188
|
pauseSubscriptionOperation(state, action) {
|
|
36
|
-
if (state.status
|
|
37
|
-
state.status
|
|
38
|
-
state.pausedSince = action.input.pausedAt;
|
|
189
|
+
if (state.status !== "ACTIVE") {
|
|
190
|
+
throw new PauseNotActiveError(`Cannot pause subscription with status ${state.status}`);
|
|
39
191
|
}
|
|
192
|
+
state.status = "PAUSED";
|
|
193
|
+
state.pausedSince = action.input.pausedSince;
|
|
40
194
|
},
|
|
41
195
|
setExpiringOperation(state, action) {
|
|
42
|
-
if (state.status
|
|
43
|
-
state.status
|
|
44
|
-
state.expiringSince = action.input.expiringAt;
|
|
196
|
+
if (state.status !== "ACTIVE") {
|
|
197
|
+
throw new SetExpiringNotActiveError(`Cannot set expiring on subscription with status ${state.status}`);
|
|
45
198
|
}
|
|
199
|
+
state.status = "EXPIRING";
|
|
200
|
+
state.expiringSince = action.input.expiringSince;
|
|
46
201
|
},
|
|
47
202
|
cancelSubscriptionOperation(state, action) {
|
|
48
|
-
if (state.status
|
|
49
|
-
|
|
50
|
-
state.cancelledSince = action.input.cancelledAt;
|
|
51
|
-
state.cancellationReason = action.input.reason || null;
|
|
203
|
+
if (state.status === "CANCELLED") {
|
|
204
|
+
throw new CancelAlreadyCancelledError("Subscription is already cancelled");
|
|
52
205
|
}
|
|
206
|
+
state.status = "CANCELLED";
|
|
207
|
+
state.cancelledSince = action.input.cancelledSince;
|
|
208
|
+
state.cancellationReason = action.input.cancellationReason || null;
|
|
53
209
|
},
|
|
54
|
-
resumeSubscriptionOperation(state,
|
|
55
|
-
if (state.status
|
|
56
|
-
state.status
|
|
57
|
-
state.pausedSince = null;
|
|
210
|
+
resumeSubscriptionOperation(state, action) {
|
|
211
|
+
if (state.status !== "PAUSED") {
|
|
212
|
+
throw new ResumeNotPausedError(`Cannot resume subscription with status ${state.status}`);
|
|
58
213
|
}
|
|
214
|
+
state.status = "ACTIVE";
|
|
215
|
+
state.pausedSince = null;
|
|
59
216
|
},
|
|
60
217
|
renewExpiringSubscriptionOperation(state, action) {
|
|
61
|
-
if (state.status
|
|
62
|
-
state.status
|
|
63
|
-
state.expiringSince = null;
|
|
64
|
-
state.renewalDate = action.input.newRenewalDate || null;
|
|
218
|
+
if (state.status !== "EXPIRING") {
|
|
219
|
+
throw new RenewNotExpiringError(`Cannot renew subscription with status ${state.status}`);
|
|
65
220
|
}
|
|
221
|
+
state.status = "ACTIVE";
|
|
222
|
+
state.expiringSince = null;
|
|
223
|
+
state.renewalDate = action.input.newRenewalDate || null;
|
|
66
224
|
},
|
|
67
225
|
setBudgetCategoryOperation(state, action) {
|
|
68
226
|
state.budget = {
|
|
69
|
-
id: action.input.
|
|
70
|
-
|
|
71
|
-
description: action.input.description || null,
|
|
227
|
+
id: action.input.budgetId,
|
|
228
|
+
label: action.input.budgetLabel,
|
|
72
229
|
};
|
|
73
230
|
},
|
|
74
231
|
removeBudgetCategoryOperation(state, action) {
|
|
75
|
-
if (state.budget
|
|
76
|
-
|
|
232
|
+
if (!state.budget || state.budget.id !== action.input.budgetId) {
|
|
233
|
+
throw new RemoveBudgetNotFoundError(`Budget category with ID ${action.input.budgetId} not found`);
|
|
77
234
|
}
|
|
235
|
+
state.budget = null;
|
|
78
236
|
},
|
|
79
237
|
updateCustomerInfoOperation(state, action) {
|
|
238
|
+
if (action.input.customerId !== undefined)
|
|
239
|
+
state.customerId = action.input.customerId || null;
|
|
80
240
|
if (action.input.customerName !== undefined)
|
|
81
241
|
state.customerName = action.input.customerName || null;
|
|
82
242
|
if (action.input.customerEmail !== undefined)
|
|
@@ -93,11 +253,9 @@ export const subscriptionInstanceSubscriptionOperations = {
|
|
|
93
253
|
state.tierCurrency = action.input.tierCurrency || null;
|
|
94
254
|
if (action.input.tierPricingMode !== undefined)
|
|
95
255
|
state.tierPricingMode = action.input.tierPricingMode || null;
|
|
96
|
-
if (action.input.selectedBillingCycle !== undefined)
|
|
97
|
-
state.selectedBillingCycle = action.input.selectedBillingCycle || null;
|
|
98
256
|
},
|
|
99
257
|
setOperatorNotesOperation(state, action) {
|
|
100
|
-
state.operatorNotes = action.input.
|
|
258
|
+
state.operatorNotes = action.input.operatorNotes || null;
|
|
101
259
|
},
|
|
102
260
|
setAutoRenewOperation(state, action) {
|
|
103
261
|
state.autoRenew = action.input.autoRenew;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/resource-instance-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/resource-instance-editor/editor.tsx"],"names":[],"mappings":"AAmCA,MAAM,CAAC,OAAO,UAAU,sBAAsB,4CA2H7C"}
|
|
@@ -3,7 +3,7 @@ import { useState, useCallback } from "react";
|
|
|
3
3
|
import { generateId } from "document-model/core";
|
|
4
4
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
5
5
|
import { useSelectedResourceInstanceDocument } from "../../document-models/resource-instance/v1/hooks.js";
|
|
6
|
-
import { initializeInstance, updateInstanceInfo, confirmInstance, reportProvisioningStarted, reportProvisioningCompleted, reportProvisioningFailed, activateInstance, suspendForNonPayment, suspendForMaintenance, suspendInstance, resumeAfterPayment, resumeAfterMaintenance, terminateInstance, } from "../../document-models/resource-instance/v1/gen/instance-management/creators.js";
|
|
6
|
+
import { initializeInstance, updateInstanceInfo, updateInstanceStatus, confirmInstance, reportProvisioningStarted, reportProvisioningCompleted, reportProvisioningFailed, activateInstance, suspendForNonPayment, suspendForMaintenance, suspendInstance, resumeAfterPayment, resumeAfterMaintenance, terminateInstance, } from "../../document-models/resource-instance/v1/gen/instance-management/creators.js";
|
|
7
7
|
import { setInstanceFacet, removeInstanceFacet, updateInstanceFacet, } from "../../document-models/resource-instance/v1/gen/configuration-management/creators.js";
|
|
8
8
|
import { OperatorProfilePanel } from "./components/OperatorProfilePanel.js";
|
|
9
9
|
export default function ResourceInstanceEditor() {
|
|
@@ -75,8 +75,18 @@ function StatusBadge({ status }) {
|
|
|
75
75
|
const config = STATUS_CONFIG[status];
|
|
76
76
|
return _jsx("span", { className: `ri-badge ${config.className}`, children: config.label });
|
|
77
77
|
}
|
|
78
|
-
function StatusSelector({ status }) {
|
|
79
|
-
|
|
78
|
+
function StatusSelector({ status, dispatch, mode }) {
|
|
79
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
80
|
+
const handleStatusChange = useCallback((newStatus) => {
|
|
81
|
+
if (newStatus !== status) {
|
|
82
|
+
dispatch(updateInstanceStatus({ status: newStatus }));
|
|
83
|
+
}
|
|
84
|
+
setIsOpen(false);
|
|
85
|
+
}, [dispatch, status]);
|
|
86
|
+
if (mode !== "operator") {
|
|
87
|
+
return _jsx(StatusBadge, { status: status });
|
|
88
|
+
}
|
|
89
|
+
return (_jsxs("div", { className: "ri-status-selector", children: [_jsxs("button", { type: "button", className: `ri-badge ${STATUS_CONFIG[status].className} ri-badge--clickable`, onClick: () => setIsOpen(!isOpen), children: [STATUS_CONFIG[status].label, _jsx("svg", { className: "ri-badge__chevron", viewBox: "0 0 20 20", fill: "currentColor", width: "14", height: "14", children: _jsx("path", { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }) })] }), isOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "ri-status-selector__backdrop", onClick: () => setIsOpen(false) }), _jsx("div", { className: "ri-status-selector__dropdown", children: ALL_STATUSES.map((s) => (_jsxs("button", { type: "button", className: `ri-status-selector__option ${s === status ? "ri-status-selector__option--active" : ""}`, onClick: () => handleStatusChange(s), children: [_jsx("span", { className: `ri-status-selector__dot ri-status-selector__dot--${s.toLowerCase()}` }), STATUS_CONFIG[s].label] }, s))) })] }))] }));
|
|
80
90
|
}
|
|
81
91
|
function InstanceHeader({ document, dispatch, mode }) {
|
|
82
92
|
const state = document.state.global;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTemplateSelector.d.ts","sourceRoot":"","sources":["../../../../editors/service-offering-editor/components/ResourceTemplateSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,kEAAkE,CAAC;AAuF1E,UAAU,6BAA6B;IACrC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CACnD;AAED,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,QAAQ,GACT,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"ResourceTemplateSelector.d.ts","sourceRoot":"","sources":["../../../../editors/service-offering-editor/components/ResourceTemplateSelector.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,kEAAkE,CAAC;AAuF1E,UAAU,6BAA6B;IACrC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CACnD;AAED,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,QAAQ,GACT,EAAE,6BAA6B,2CAgkB/B"}
|
|
@@ -175,14 +175,16 @@ export function ResourceTemplateSelector({ document, dispatch, }) {
|
|
|
175
175
|
// Deselect if clicking the already-selected product
|
|
176
176
|
if (currentTemplateId === template.id) {
|
|
177
177
|
dispatch(changeResourceTemplate({
|
|
178
|
-
|
|
178
|
+
previousTemplateId: currentTemplateId,
|
|
179
|
+
newTemplateId: "",
|
|
179
180
|
lastModified: now,
|
|
180
181
|
}));
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
if (currentTemplateId) {
|
|
184
185
|
dispatch(changeResourceTemplate({
|
|
185
|
-
|
|
186
|
+
previousTemplateId: currentTemplateId,
|
|
187
|
+
newTemplateId: template.id,
|
|
186
188
|
lastModified: now,
|
|
187
189
|
}));
|
|
188
190
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceCatalog.d.ts","sourceRoot":"","sources":["../../../../editors/service-offering-editor/components/ServiceCatalog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ServiceCatalog.d.ts","sourceRoot":"","sources":["../../../../editors/service-offering-editor/components/ServiceCatalog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EAMtB,MAAM,kEAAkE,CAAC;AAgH1E,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CACnD;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAokEzE"}
|