@vtex/faststore-plugin-buyer-portal 1.0.39 → 1.0.41

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +1 -1
  3. package/plugin.config.js +14 -4
  4. package/public/buyer-portal-icons.svg +11 -1
  5. package/src/features/addresses/components/AddressForm/AddressForm.tsx +33 -27
  6. package/src/features/addresses/components/AddressLine/AddressLine.tsx +1 -1
  7. package/src/features/addresses/components/CreateAddressDrawer/create-address-drawer.scss +1 -1
  8. package/src/features/addresses/layouts/AddressDetailsLayout/address-details-layout.scss +2 -2
  9. package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +23 -0
  10. package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/buying-policy-dropdown-menu.scss +1 -0
  11. package/src/features/buying-policies/components/index.ts +1 -0
  12. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +62 -0
  13. package/src/features/buying-policies/layouts/BuyingPoliciesLayout/buying-policies-layout.scss +24 -0
  14. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +83 -0
  15. package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/buying-policy-details-layout.scss +74 -0
  16. package/src/features/buying-policies/layouts/index.ts +1 -0
  17. package/src/features/buying-policies/mocks/buying-policy-data.ts +145 -0
  18. package/src/features/buying-policies/mocks/index.ts +1 -0
  19. package/src/features/buying-policies/types/BuyingPolicies.ts +10 -0
  20. package/src/features/buying-policies/types/index.ts +1 -0
  21. package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx +135 -0
  22. package/src/features/credit-cards/components/CreateCreditCardDrawer/create-credit-card-drawer.scss +21 -0
  23. package/src/features/credit-cards/components/CreditCardDropdownMenu/CreditCardDropdownMenu.tsx +103 -0
  24. package/src/features/credit-cards/components/CreditCardForm/CreditCardForm.tsx +79 -0
  25. package/src/features/credit-cards/components/CreditCardForm/credit-card-form.scss +5 -0
  26. package/src/features/credit-cards/components/DeleteCreditCardDrawer/DeleteCreditCardDrawer.tsx +82 -0
  27. package/src/features/credit-cards/components/EditCreditCardDrawer/EditCreditCardDrawer.tsx +90 -0
  28. package/src/features/credit-cards/components/EditCreditCardDrawer/edit-credit-card-drawer.scss +4 -0
  29. package/src/features/credit-cards/components/RemoveCreditCardDrawer/RemoveCreditCardDrawer.tsx +84 -0
  30. package/src/features/credit-cards/components/RemoveCreditCardDrawer/remove-credit-card-drawer.scss +9 -0
  31. package/src/features/credit-cards/components/index.ts +24 -0
  32. package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +100 -0
  33. package/src/features/credit-cards/layouts/CreditCardsLayout/credit-card-layout.scss +140 -0
  34. package/src/features/credit-cards/layouts/index.ts +1 -0
  35. package/src/features/credit-cards/types/CreditCard.ts +12 -0
  36. package/src/features/credit-cards/types/index.ts +1 -0
  37. package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +65 -48
  38. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +9 -7
  39. package/src/features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss +1 -0
  40. package/src/features/shared/components/ListLine/ListLine.tsx +52 -0
  41. package/src/features/shared/components/ListLine/list-line.scss +49 -0
  42. package/src/features/shared/components/index.ts +1 -0
  43. package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +1 -0
  44. package/src/features/shared/layouts/FinanceTabsLayout/FinanceTabsLayout.tsx +40 -0
  45. package/src/features/shared/layouts/FinanceTabsLayout/finance-tabs-layout.scss +4 -0
  46. package/src/features/shared/layouts/index.ts +4 -0
  47. package/src/features/shared/utils/buyerPortalRoutes.ts +12 -0
  48. package/src/features/shared/utils/creditCard.ts +16 -0
  49. package/src/features/shared/utils/getFinanceSettingsLinks.ts +15 -0
  50. package/src/features/shared/utils/index.ts +2 -0
  51. package/src/pages/buying-policies.tsx +81 -0
  52. package/src/pages/buying-policy-details.tsx +72 -0
  53. package/src/pages/credit-cards.tsx +71 -0
  54. package/src/themes/layouts.scss +7 -0
package/CHANGELOG.md CHANGED
@@ -9,5 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
+ - Add Buying Policies Page
13
+ - Add Buying Policy Details Page
14
+
15
+ ### Added
16
+
12
17
  - Add CHANGELOG file
13
18
  - Add README file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {
package/plugin.config.js CHANGED
@@ -24,10 +24,10 @@ module.exports = {
24
24
  // path: "/buyer-portal/payment-methods/[orgUnitId]/[contractId]",
25
25
  // appLayout: false,
26
26
  // },
27
- // "credit-cards": {
28
- // path: "/buyer-portal/credit-cards/[orgUnitId]/[contractId]",
29
- // appLayout: false,
30
- // },
27
+ "credit-cards": {
28
+ path: "/buyer-portal/credit-cards/[orgUnitId]/[contractId]",
29
+ appLayout: false,
30
+ },
31
31
  // collections: {
32
32
  // path: "/buyer-portal/collections/[orgUnitId]/[contractId]",
33
33
  // appLayout: false,
@@ -49,6 +49,16 @@ module.exports = {
49
49
  // appLayout: false,
50
50
  // },
51
51
 
52
+ "buying-policies": {
53
+ path: "/buyer-portal/buying-policies/[orgUnitId]/[contractId]",
54
+ appLayout: false,
55
+ },
56
+
57
+ "buying-policy-details": {
58
+ path: "/buyer-portal/buying-policy/[orgUnitId]/[contractId]/[buyingPolicyId]",
59
+ appLayout: false,
60
+ },
61
+
52
62
  users: {
53
63
  path: "/buyer-portal/users/[orgUnitId]",
54
64
  appLayout: false,
@@ -337,4 +337,14 @@
337
337
  fill="currentColor" />
338
338
 
339
339
  </symbol>
340
- </svg>
340
+
341
+ <symbol
342
+ id="Rename"
343
+ viewBox="0 0 17 13"
344
+ fill="none"
345
+ xmlns="http://www.w3.org/2000/svg">
346
+ <path d="M10.0712 12.6473V2.64734H6.0712V0.647339H16.0712V2.64734H12.0712V12.6473H10.0712ZM2.5712 12.6473V6.64734H0.0711975V4.64734H7.0712V6.64734H4.5712V12.6473H2.5712Z" fill="currentColor"/>
347
+ </symbol>
348
+
349
+
350
+ </svg>
@@ -25,6 +25,7 @@ export type AddressFormProps = {
25
25
  completedAddress?: AddressData;
26
26
  setCompletedAddress?: (completedAddress: AddressData) => void;
27
27
  isEdit?: boolean;
28
+ fixedType?: boolean;
28
29
  };
29
30
 
30
31
  export const AddressForm = ({
@@ -37,6 +38,7 @@ export const AddressForm = ({
37
38
  setUseExistingAddress,
38
39
  completedAddress,
39
40
  setCompletedAddress,
41
+ fixedType = false,
40
42
  }: AddressFormProps) => {
41
43
  const addressTypeOptions = ["Shipping", "Billing", "Sold To"];
42
44
 
@@ -60,11 +62,13 @@ export const AddressForm = ({
60
62
  });
61
63
  };
62
64
 
65
+ const hideLabel = isEdit || fixedType;
66
+
63
67
  return (
64
68
  <>
65
69
  {!useExistingAddress ? (
66
70
  <div>
67
- {!isEdit && <span>Fill in the address details</span>}
71
+ {!hideLabel && <span>Fill in the address details</span>}
68
72
 
69
73
  <AutocompleteDropdown
70
74
  data-fs-bp-create-address-country-selector
@@ -242,32 +246,34 @@ export const AddressForm = ({
242
246
  />
243
247
  )}
244
248
 
245
- <AutocompleteDropdown
246
- label="Address Type"
247
- value={address.types}
248
- options={addressTypeOptions}
249
- onConfirmKeyPress={(option) =>
250
- setAddress({ ...address, types: [option] })
251
- }
252
- renderOption={(option, index) => (
253
- <AutocompleteDropdown.Item
254
- key={`${option}-${index}`}
255
- closeOnClick={true}
256
- index={index}
257
- isSelected={
258
- address?.types[0]?.toLocaleLowerCase() ===
259
- option.toLocaleLowerCase()
260
- }
261
- onClick={() => setAddress({ ...address, types: [option] })}
262
- >
263
- {option}
264
- {address?.types[0]?.toLowerCase() ===
265
- option.toLocaleLowerCase() && (
266
- <Icon name="Check" width={12} height={12} />
267
- )}
268
- </AutocompleteDropdown.Item>
269
- )}
270
- />
249
+ {!fixedType && (
250
+ <AutocompleteDropdown
251
+ label="Address Type"
252
+ value={address.types}
253
+ options={addressTypeOptions}
254
+ onConfirmKeyPress={(option) =>
255
+ setAddress({ ...address, types: [option] })
256
+ }
257
+ renderOption={(option, index) => (
258
+ <AutocompleteDropdown.Item
259
+ key={`${option}-${index}`}
260
+ closeOnClick={true}
261
+ index={index}
262
+ isSelected={
263
+ address?.types[0]?.toLocaleLowerCase() ===
264
+ option.toLocaleLowerCase()
265
+ }
266
+ onClick={() => setAddress({ ...address, types: [option] })}
267
+ >
268
+ {option}
269
+ {address?.types[0]?.toLowerCase() ===
270
+ option.toLocaleLowerCase() && (
271
+ <Icon name="Check" width={12} height={12} />
272
+ )}
273
+ </AutocompleteDropdown.Item>
274
+ )}
275
+ />
276
+ )}
271
277
  </div>
272
278
  ) : (
273
279
  <ExistingAddress
@@ -1,4 +1,4 @@
1
- import { Toggle, Dropdown, DropdownButton } from "@faststore/ui";
1
+ import { Dropdown } from "@faststore/ui";
2
2
  import Link from "next/link";
3
3
  import { BasicDropdownMenu, Icon, Tag } from "../../../shared/components";
4
4
  import type { AddressData } from "../../types";
@@ -29,7 +29,7 @@
29
29
  margin-top: 1rem;
30
30
  width: fit-content;
31
31
  border-radius: var(--fs-border-radius-pill);
32
- border: 1px;
32
+ border: var(--fs-border-width);
33
33
  padding: var(--fs-spacing-0);
34
34
  gap: var(--fs-spacing-0);
35
35
  border-style: solid;
@@ -53,7 +53,7 @@
53
53
  [data-fs-bp-tab-bar] {
54
54
  width: fit-content;
55
55
  border-radius: var(--fs-border-radius-pill);
56
- border: 1px;
56
+ border: var(--fs-border-width);
57
57
  padding: var(--fs-spacing-0);
58
58
  gap: var(--fs-spacing-0);
59
59
  border-style: solid;
@@ -82,7 +82,7 @@
82
82
  line-height: var(--fs-spacing-4);
83
83
 
84
84
  border-radius: var(--fs-border-radius-pill);
85
- border: 1px solid #e0e0e0;
85
+ border: var(--fs-border-width) solid #e0e0e0;
86
86
  }
87
87
  }
88
88
 
@@ -0,0 +1,23 @@
1
+ import { BasicDropdownMenu, Icon } from "../../../shared/components";
2
+
3
+ import { DropdownItem } from "@faststore/ui";
4
+
5
+ export const BuyingPolicyDropdownMenu = () => {
6
+ return (
7
+ <BasicDropdownMenu>
8
+ <DropdownItem>
9
+ <Icon name="OpenInNew" />
10
+ Open
11
+ </DropdownItem>
12
+ <DropdownItem>
13
+ <Icon name="Edit" />
14
+ Edit settings
15
+ </DropdownItem>
16
+ <BasicDropdownMenu.Separator />
17
+ <DropdownItem data-fs-bp-dropdown-menu-item-mode="danger">
18
+ <Icon name="Delete" />
19
+ <span>Delete</span>
20
+ </DropdownItem>
21
+ </BasicDropdownMenu>
22
+ );
23
+ };
@@ -0,0 +1 @@
1
+ @import "../../../shared/components/BasicDropdownMenu/basic-dropdown-menu.scss";
@@ -0,0 +1 @@
1
+ export { BuyingPolicyDropdownMenu } from "./BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu";
@@ -0,0 +1,62 @@
1
+ import { FinanceTabsLayout, GlobalLayout } from "../../../shared/layouts";
2
+ import {
3
+ HeaderInside,
4
+ InternalSearch,
5
+ ListLine,
6
+ } from "../../../shared/components";
7
+ import { useBuyerPortal, useQueryParams } from "../../../shared/hooks";
8
+ import type { BuyingPolicy } from "../../types";
9
+ import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
10
+ import { BuyingPolicyDropdownMenu } from "../../components";
11
+
12
+ export type BuyingPoliciesLayoutProps = {
13
+ data: { buyingPolicies: BuyingPolicy[] } | null;
14
+ search: string;
15
+ };
16
+
17
+ export const BuyingPoliciesLayout = ({
18
+ data,
19
+ search,
20
+ }: BuyingPoliciesLayoutProps) => {
21
+ const { setQueryString, removeQueryString } = useQueryParams();
22
+
23
+ const { currentContract, currentOrgUnit } = useBuyerPortal();
24
+
25
+ return (
26
+ <GlobalLayout>
27
+ <FinanceTabsLayout pageName="Finance and Compliance">
28
+ <section data-fs-buying-policies-section>
29
+ <HeaderInside title="Buying Policies">
30
+ <HeaderInside.Button />
31
+ </HeaderInside>
32
+
33
+ <div data-fs-buying-policies-filter>
34
+ <InternalSearch
35
+ defaultValue={search}
36
+ textSearch={(searchTerm) => {
37
+ searchTerm
38
+ ? setQueryString("search", searchTerm)
39
+ : removeQueryString("search");
40
+ }}
41
+ />
42
+ </div>
43
+
44
+ <span data-fs-buying-policies-heading>Name</span>
45
+ {data?.buyingPolicies.map((buyingPolicy) => (
46
+ <ListLine
47
+ key={buyingPolicy.id}
48
+ title={buyingPolicy.name}
49
+ iconName="Rebase"
50
+ href={buyerPortalRoutes.buyingPolicyDetails({
51
+ contractId: currentContract?.id ?? "",
52
+ orgUnitId: currentOrgUnit?.id ?? "",
53
+ buyingPolicyId: buyingPolicy.id,
54
+ })}
55
+ dropdownMenu={<BuyingPolicyDropdownMenu />}
56
+ />
57
+ ))}
58
+ </section>
59
+ </FinanceTabsLayout>
60
+ </GlobalLayout>
61
+ );
62
+ };
@@ -0,0 +1,24 @@
1
+ @import "@faststore/ui/src/components/molecules/Dropdown/styles.scss";
2
+ @import "../../components/BuyingPolicyDropdownMenu/buying-policy-dropdown-menu.scss";
3
+ @import "../../../shared/layouts/FinanceTabsLayout/finance-tabs-layout.scss";
4
+
5
+ [data-fs-buying-policies-section] {
6
+ @import "../../../shared/components/HeaderInside/header-inside.scss";
7
+ @import "../../../shared/components/InternalSearch/internal-search.scss";
8
+ @import "../../../shared/components/ListLine/list-line.scss";
9
+
10
+ [data-fs-buying-policies-filter] {
11
+ display: flex;
12
+ justify-content: space-between;
13
+ padding: 0 0 var(--fs-spacing-4);
14
+ }
15
+
16
+ [data-fs-buying-policies-heading] {
17
+ display: flex;
18
+ font-weight: 400;
19
+ font-size: var(--fs-text-size-1);
20
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
21
+ color: #5c5c5c;
22
+ margin-bottom: var(--fs-spacing-1);
23
+ }
24
+ }
@@ -0,0 +1,83 @@
1
+ import { FinanceTabsLayout, GlobalLayout } from "../../../shared/layouts";
2
+ import {
3
+ BasicDropdownMenu,
4
+ HeaderInside,
5
+ Icon,
6
+ } from "../../../shared/components";
7
+ import { useBuyerPortal } from "../../../shared/hooks";
8
+ import type { BuyingPolicy } from "../../types";
9
+ import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
10
+ import { Dropdown, DropdownItem } from "@faststore/ui";
11
+ import { BuyingPolicyDropdownMenu } from "../../components";
12
+
13
+ export type BuyingPolicyDetailsLayoutProps = {
14
+ data: { buyingPolicy: BuyingPolicy | null };
15
+ };
16
+
17
+ export const BuyingPolicyDetailsLayout = ({
18
+ data: { buyingPolicy },
19
+ }: BuyingPolicyDetailsLayoutProps) => {
20
+ const { currentContract, currentOrgUnit } = useBuyerPortal();
21
+
22
+ return (
23
+ <GlobalLayout>
24
+ <FinanceTabsLayout pageName="Finance and Compliance">
25
+ <section data-fs-buying-policy-details-section>
26
+ <HeaderInside
27
+ title={buyingPolicy?.name ?? ""}
28
+ backLink={buyerPortalRoutes.buyingPolicies({
29
+ contractId: currentContract?.id || "",
30
+ orgUnitId: currentOrgUnit?.id || "",
31
+ })}
32
+ >
33
+ <Dropdown>
34
+ <BasicDropdownMenu.Trigger />
35
+ <BuyingPolicyDropdownMenu />
36
+ </Dropdown>
37
+ </HeaderInside>
38
+
39
+ <div data-fs-buying-policy-details-line>
40
+ <span data-fs-buying-policy-details-title>Settings</span>
41
+ <button type="button" data-fs-buying-policy-details-edit-button>
42
+ Edit
43
+ </button>
44
+ </div>
45
+ <div data-fs-buying-policy-details-line>
46
+ <span data-fs-buying-policy-details-field-label>Name</span>
47
+ <span data-fs-buying-policy-details-field-content>
48
+ {buyingPolicy?.name}
49
+ </span>
50
+ </div>
51
+ <div data-fs-buying-policy-details-line>
52
+ <span data-fs-buying-policy-details-field-label>Description</span>
53
+ <span data-fs-buying-policy-details-field-content>
54
+ {buyingPolicy?.description}
55
+ </span>
56
+ </div>
57
+ <div data-fs-buying-policy-details-line>
58
+ <span data-fs-buying-policy-details-field-label>Criteria</span>
59
+ <span data-fs-buying-policy-details-field-content>
60
+ {buyingPolicy?.criteria}
61
+ </span>
62
+ </div>
63
+ <div data-fs-buying-policy-details-line>
64
+ <span data-fs-buying-policy-details-field-label>Action</span>
65
+ <span data-fs-buying-policy-details-field-content>
66
+ {buyingPolicy?.action.type}
67
+ {buyingPolicy?.action.levels?.map((level, index) => (
68
+ <>
69
+ <span key={level} data-fs-buying-policy-details-level-title>
70
+ Level {index + 1}
71
+ </span>
72
+ <span key={level} data-fs-buying-policy-details-level-value>
73
+ {level}
74
+ </span>
75
+ </>
76
+ ))}
77
+ </span>
78
+ </div>
79
+ </section>
80
+ </FinanceTabsLayout>
81
+ </GlobalLayout>
82
+ );
83
+ };
@@ -0,0 +1,74 @@
1
+ @import "@faststore/ui/src/components/molecules/Dropdown/styles.scss";
2
+
3
+ @import "../../../shared/layouts/FinanceTabsLayout/finance-tabs-layout.scss";
4
+ @import "../../components/BuyingPolicyDropdownMenu/buying-policy-dropdown-menu.scss";
5
+
6
+ [data-fs-buying-policy-details-section] {
7
+ @import "../../../shared/components/HeaderInside/header-inside.scss";
8
+ @import "../../../shared/components/InternalSearch/internal-search.scss";
9
+
10
+ [data-fs-buying-policy-details-line] {
11
+ padding: calc(var(--fs-spacing-4) - var(--fs-spacing-0)) 0;
12
+ border-top: var(--fs-border-width) solid #e0e0e0;
13
+ display: flex;
14
+
15
+ &:first-of-type {
16
+ border-top: none;
17
+ }
18
+
19
+ [data-fs-buying-policy-details-title] {
20
+ font-weight: 600;
21
+ font-size: var(--fs-text-size-2);
22
+ line-height: var(--fs-spacing-4);
23
+ margin-right: auto;
24
+ }
25
+
26
+ [data-fs-buying-policy-details-edit-button] {
27
+ border: var(--fs-border-width) solid #e0e0e0;
28
+ border-radius: var(--fs-border-radius-pill);
29
+ padding: var(--fs-spacing-1)
30
+ calc(var(--fs-spacing-4) - var(--fs-spacing-0));
31
+ font-weight: 600;
32
+ font-size: var(--fs-text-size-1);
33
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
34
+ text-align: center;
35
+ color: #0366dd;
36
+ cursor: pointer;
37
+ }
38
+
39
+ [data-fs-buying-policy-details-field-label] {
40
+ width: 14rem;
41
+ display: inline-block;
42
+
43
+ font-weight: 400;
44
+ font-size: var(--fs-text-size-1);
45
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
46
+
47
+ color: #5c5c5c;
48
+ }
49
+
50
+ [data-fs-buying-policy-details-field-content] {
51
+ font-weight: 400;
52
+ font-size: var(--fs-text-size-1);
53
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
54
+ color: #000000;
55
+
56
+ [data-fs-buying-policy-details-level-title] {
57
+ display: block;
58
+ margin-top: var(--fs-spacing-3);
59
+ font-weight: 400;
60
+ font-size: var(--fs-text-size-1);
61
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
62
+ color: #5c5c5c;
63
+ }
64
+
65
+ [data-fs-buying-policy-details-level-value] {
66
+ display: block;
67
+ font-weight: 500;
68
+ font-size: var(--fs-text-size-1);
69
+ line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
70
+ color: #1f1f1f;
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1 @@
1
+ export { BuyingPoliciesLayout } from "./BuyingPoliciesLayout/BuyingPoliciesLayout";
@@ -0,0 +1,145 @@
1
+ import type { BuyingPolicy } from "../types";
2
+
3
+ export const buyingPoliciesData: BuyingPolicy[] = [
4
+ {
5
+ id: "1",
6
+ name: "Standard Purchase Policy",
7
+ description: "Defines the standard rules for purchasing items.",
8
+ criteria: "budget >= 100",
9
+ action: {
10
+ type: "Bypass all policies",
11
+ },
12
+ },
13
+ {
14
+ id: "2",
15
+ name: "Bulk Order Policy",
16
+ description: "Policy for handling bulk orders with discounts.",
17
+ criteria: "quantity > 100",
18
+ action: {
19
+ type: "Sequential approval workflow",
20
+ levels: ["Manager", "Director", "CEO"],
21
+ },
22
+ },
23
+ {
24
+ id: "3",
25
+ name: "Restricted Items Policy",
26
+ description: "Restricts the purchase of certain items.",
27
+ criteria: "category == 'restricted'",
28
+ action: {
29
+ type: "Deny all",
30
+ },
31
+ },
32
+ {
33
+ id: "4",
34
+ name: "Employee Discount Policy",
35
+ description: "Provides discounts for employees.",
36
+ criteria: "userRole == 'employee'",
37
+ action: {
38
+ type: "Bypass all policies",
39
+ },
40
+ },
41
+ {
42
+ id: "5",
43
+ name: "Seasonal Promotion Policy",
44
+ description: "Handles seasonal promotions and discounts.",
45
+ criteria: "season == 'holiday'",
46
+ action: {
47
+ type: "Sequential approval workflow",
48
+ levels: ["Marketing Manager", "Finance Director"],
49
+ },
50
+ },
51
+ {
52
+ id: "6",
53
+ name: "High-Value Purchase Policy",
54
+ description: "Requires approval for high-value purchases.",
55
+ criteria: "purchaseAmount > 10000",
56
+ action: {
57
+ type: "Sequential approval workflow",
58
+ levels: ["Manager", "Finance Director", "CEO"],
59
+ },
60
+ },
61
+ {
62
+ id: "7",
63
+ name: "Loyalty Program Policy",
64
+ description: "Rewards loyal customers with points.",
65
+ criteria: "loyaltyPoints >= 500",
66
+ action: {
67
+ type: "Bypass all policies",
68
+ },
69
+ },
70
+ {
71
+ id: "8",
72
+ name: "New Customer Policy",
73
+ description: "Special offers for new customers.",
74
+ criteria: "isFirstPurchase == true",
75
+ action: {
76
+ type: "Bypass all policies",
77
+ },
78
+ },
79
+ {
80
+ id: "9",
81
+ name: "Corporate Account Policy",
82
+ description: "Custom rules for corporate accounts.",
83
+ criteria: "accountType == 'corporate'",
84
+ action: {
85
+ type: "Sequential approval workflow",
86
+ levels: ["Account Manager", "Finance Director"],
87
+ },
88
+ },
89
+ {
90
+ id: "10",
91
+ name: "Subscription Renewal Policy",
92
+ description: "Handles subscription renewals.",
93
+ criteria: "subscriptionStatus == 'active'",
94
+ action: {
95
+ type: "Bypass all policies",
96
+ },
97
+ },
98
+ {
99
+ id: "11",
100
+ name: "International Shipping Policy",
101
+ description: "Rules for international orders.",
102
+ criteria: "shippingCountry != 'domestic'",
103
+ action: {
104
+ type: "Sequential approval workflow",
105
+ levels: ["Logistics Manager", "Finance Director"],
106
+ },
107
+ },
108
+ {
109
+ id: "12",
110
+ name: "Return and Refund Policy",
111
+ description: "Defines rules for returns and refunds.",
112
+ criteria: "daysSincePurchase <= 30",
113
+ action: {
114
+ type: "Deny all",
115
+ },
116
+ },
117
+ {
118
+ id: "13",
119
+ name: "Age-Restricted Items Policy",
120
+ description: "Restricts purchase of age-sensitive items.",
121
+ criteria: "userAge < 18",
122
+ action: {
123
+ type: "Deny all",
124
+ },
125
+ },
126
+ {
127
+ id: "14",
128
+ name: "VIP Customer Policy",
129
+ description: "Exclusive benefits for VIP customers.",
130
+ criteria: "userStatus == 'VIP'",
131
+ action: {
132
+ type: "Bypass all policies",
133
+ },
134
+ },
135
+ {
136
+ id: "15",
137
+ name: "Environmental Sustainability Policy",
138
+ description: "Encourages eco-friendly purchases.",
139
+ criteria: "productType == 'eco-friendly'",
140
+ action: {
141
+ type: "Sequential approval workflow",
142
+ levels: ["Sustainability Manager", "CEO"],
143
+ },
144
+ },
145
+ ];
@@ -0,0 +1 @@
1
+ export { buyingPoliciesData } from "./buying-policy-data";
@@ -0,0 +1,10 @@
1
+ export type BuyingPolicy = {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ criteria: string;
6
+ action: {
7
+ type: string;
8
+ levels?: string[];
9
+ };
10
+ };
@@ -0,0 +1 @@
1
+ export type { BuyingPolicy } from "./BuyingPolicies";