@appcorp/fusion-storybook 0.3.44 → 0.3.46

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 (106) hide show
  1. package/base-modules/admission/context/use-admission-module.js +4 -1
  2. package/base-modules/admission/form.js +3 -1
  3. package/base-modules/admission/more-actions.js +2 -2
  4. package/base-modules/admission/view.js +1 -1
  5. package/base-modules/attendance/context.js +2 -1
  6. package/base-modules/attendance/form.js +3 -3
  7. package/base-modules/attendance/more-actions.js +1 -1
  8. package/base-modules/attendance/page.js +1 -1
  9. package/base-modules/attendance/view.js +2 -2
  10. package/base-modules/campus/context.js +2 -1
  11. package/base-modules/campus/more-actions.js +2 -1
  12. package/base-modules/class/cache.d.ts +3 -3
  13. package/base-modules/class/cache.js +1 -1
  14. package/base-modules/class/context.js +2 -1
  15. package/base-modules/class/more-actions.js +1 -1
  16. package/base-modules/course/context.js +2 -1
  17. package/base-modules/course/form.js +1 -1
  18. package/base-modules/course/more-actions.js +2 -1
  19. package/base-modules/course/view.js +1 -3
  20. package/base-modules/discount-code/cache.d.ts +3 -3
  21. package/base-modules/discount-code/cache.js +1 -1
  22. package/base-modules/discount-code/context.js +2 -1
  23. package/base-modules/enrollment/context.js +2 -1
  24. package/base-modules/enrollment/form.js +4 -3
  25. package/base-modules/enrollment/more-actions.js +1 -1
  26. package/base-modules/enrollment/page.js +2 -1
  27. package/base-modules/enrollment/view.js +3 -3
  28. package/base-modules/expense/context.js +2 -1
  29. package/base-modules/expense/more-actions.js +1 -1
  30. package/base-modules/expense/page.js +1 -1
  31. package/base-modules/expense/view.js +2 -4
  32. package/base-modules/family/context.js +2 -1
  33. package/base-modules/family/more-actions.js +1 -1
  34. package/base-modules/family-member/context.js +2 -1
  35. package/base-modules/family-member/more-actions.js +2 -2
  36. package/base-modules/family-member/view.js +1 -1
  37. package/base-modules/fee-structure/cache.d.ts +3 -3
  38. package/base-modules/fee-structure/cache.js +1 -1
  39. package/base-modules/fee-structure/context.js +2 -1
  40. package/base-modules/fee-structure/form.js +1 -1
  41. package/base-modules/fee-structure/more-actions.js +1 -1
  42. package/base-modules/push-campaign/cache.d.ts +9 -0
  43. package/base-modules/push-campaign/cache.js +16 -0
  44. package/base-modules/push-campaign/constants.d.ts +24 -0
  45. package/base-modules/push-campaign/constants.js +11 -0
  46. package/base-modules/push-campaign/context/module-base.d.ts +181 -0
  47. package/base-modules/push-campaign/context/module-base.js +45 -0
  48. package/base-modules/push-campaign/context/use-push-campaign-module.d.ts +66 -0
  49. package/base-modules/push-campaign/context/use-push-campaign-module.js +451 -0
  50. package/base-modules/push-campaign/context.d.ts +2 -0
  51. package/base-modules/push-campaign/context.js +3 -0
  52. package/base-modules/push-campaign/filter.d.ts +1 -0
  53. package/base-modules/push-campaign/filter.js +43 -0
  54. package/base-modules/push-campaign/form.d.ts +1 -0
  55. package/base-modules/push-campaign/form.js +21 -0
  56. package/base-modules/push-campaign/page.d.ts +28 -0
  57. package/base-modules/push-campaign/page.js +152 -0
  58. package/base-modules/push-campaign/validate.d.ts +11 -0
  59. package/base-modules/push-campaign/validate.js +11 -0
  60. package/base-modules/push-campaign/view.d.ts +1 -0
  61. package/base-modules/push-campaign/view.js +26 -0
  62. package/base-modules/rbac/context.js +2 -1
  63. package/base-modules/school/cache.js +1 -1
  64. package/base-modules/school/context.js +1 -1
  65. package/base-modules/section/cache.d.ts +3 -3
  66. package/base-modules/section/cache.js +1 -1
  67. package/base-modules/section/context.js +2 -1
  68. package/base-modules/section/more-actions.js +1 -1
  69. package/base-modules/student-fee/context/use-student-fee-module.js +4 -1
  70. package/base-modules/student-fee/form.js +2 -1
  71. package/base-modules/student-fee/more-actions.js +1 -1
  72. package/base-modules/student-fee/page.js +1 -1
  73. package/base-modules/student-fee/single-entry.js +1 -1
  74. package/base-modules/student-fee/view.js +4 -4
  75. package/base-modules/student-profile/cache.d.ts +3 -3
  76. package/base-modules/student-profile/cache.js +1 -1
  77. package/base-modules/student-profile/context/use-student-profile-module.js +4 -1
  78. package/base-modules/student-profile/form.js +1 -1
  79. package/base-modules/student-profile/more-actions.js +1 -1
  80. package/base-modules/student-profile/page.js +1 -1
  81. package/base-modules/student-profile/view.js +1 -1
  82. package/base-modules/subject/cache.d.ts +3 -3
  83. package/base-modules/subject/cache.js +1 -1
  84. package/base-modules/subject/context.js +2 -1
  85. package/base-modules/subject/more-actions.js +1 -1
  86. package/base-modules/teacher/cache.d.ts +3 -3
  87. package/base-modules/teacher/cache.js +1 -1
  88. package/base-modules/teacher/context.js +2 -1
  89. package/base-modules/teacher/more-actions.js +1 -1
  90. package/base-modules/teacher/view.js +1 -1
  91. package/base-modules/user/cache.d.ts +3 -3
  92. package/base-modules/user/cache.js +1 -1
  93. package/base-modules/user/context/use-user-module.js +4 -1
  94. package/base-modules/user/more-actions.js +2 -1
  95. package/base-modules/workspace/cache.js +2 -1
  96. package/base-modules/workspace/context.js +1 -1
  97. package/base-modules/workspace/view.js +1 -1
  98. package/base-modules/workspace-user/context.js +5 -2
  99. package/base-modules/workspace-user/more-actions.js +2 -2
  100. package/constants.d.ts +6 -0
  101. package/constants.js +6 -0
  102. package/package.json +2 -2
  103. package/tsconfig.build.tsbuildinfo +1 -1
  104. package/types/communication.d.ts +28 -0
  105. package/types/enums.d.ts +1 -0
  106. package/types/enums.js +1 -0
@@ -15,7 +15,7 @@ import { CLASS_API_ROUTES, FEE_STRUCTURE_API_ROUTES } from "../../constants";
15
15
  import { getCachedWorkspaceSync } from "../workspace/cache";
16
16
  import { useTranslations } from "next-intl";
17
17
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
18
- import { API_METHODS } from "@react-pakistan/util-functions";
18
+ import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
19
19
  import { useEffect } from "react";
20
20
  import { getTranslatedError } from "../../utils/get-translated-error";
21
21
  export const FeeStructureForm = () => {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { downloadFromUrl } from "@react-pakistan/util-functions";
3
+ import { downloadFromUrl } from "@react-pakistan/util-functions/general/download-from-url";
4
4
  import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
5
5
  import { getCachedWorkspaceSync } from "../workspace/cache";
6
6
  import converter from "json-2-csv";
@@ -0,0 +1,9 @@
1
+ import { PushCampaignBE } from "../../type";
2
+ export declare const getCachedPushCampaignsSync: () => import("@react-pakistan/util-functions/general/generic-cache").ListResponse<PushCampaignBE>;
3
+ export declare const getCachedPushCampaigns: ({ params, }: {
4
+ params: Record<string, unknown>;
5
+ }) => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<PushCampaignBE>>;
6
+ export declare const getCachedPushCampaignById: (campaignId: string) => PushCampaignBE | null;
7
+ export declare const invalidatePushCampaignsCache: () => void;
8
+ export declare const preloadPushCampaigns: () => Promise<import("@react-pakistan/util-functions/general/generic-cache").ListResponse<PushCampaignBE>>;
9
+ export declare const isPushCampaignsCacheStale: () => boolean;
@@ -0,0 +1,16 @@
1
+ import { LS_KEYS, PUSH_CAMPAIGN_API_ROUTES } from "../../constants";
2
+ import { getCachedData, getCachedDataSync, getCachedItemById, invalidateCache, isCacheStale, preloadCache, } from "@react-pakistan/util-functions/general/generic-cache";
3
+ const PUSH_CAMPAIGN_CACHE_CONFIG = {
4
+ cacheKey: LS_KEYS.CAMPAIGNS,
5
+ apiUrl: PUSH_CAMPAIGN_API_ROUTES.UNIT,
6
+ };
7
+ export const getCachedPushCampaignsSync = () => getCachedDataSync(LS_KEYS.CAMPAIGNS);
8
+ export const getCachedPushCampaigns = ({ params, }) => getCachedData({
9
+ config: PUSH_CAMPAIGN_CACHE_CONFIG,
10
+ params,
11
+ headers: { "Content-Type": "application/json" },
12
+ });
13
+ export const getCachedPushCampaignById = (campaignId) => getCachedItemById(LS_KEYS.CAMPAIGNS, campaignId);
14
+ export const invalidatePushCampaignsCache = () => invalidateCache(LS_KEYS.CAMPAIGNS);
15
+ export const preloadPushCampaigns = () => preloadCache(PUSH_CAMPAIGN_CACHE_CONFIG);
16
+ export const isPushCampaignsCacheStale = () => isCacheStale(LS_KEYS.CAMPAIGNS);
@@ -0,0 +1,24 @@
1
+ import { CAMPAIGN_STATUS } from "../../type";
2
+ export declare const pageLimit: number;
3
+ export declare const STATUS_OPTIONS: readonly [{
4
+ readonly label: "filterOptionAll";
5
+ readonly value: "";
6
+ }, {
7
+ readonly label: "filterOptionDraft";
8
+ readonly value: CAMPAIGN_STATUS.DRAFT;
9
+ }, {
10
+ readonly label: "filterOptionScheduled";
11
+ readonly value: CAMPAIGN_STATUS.SCHEDULED;
12
+ }, {
13
+ readonly label: "filterOptionRunning";
14
+ readonly value: CAMPAIGN_STATUS.RUNNING;
15
+ }, {
16
+ readonly label: "filterOptionCompleted";
17
+ readonly value: CAMPAIGN_STATUS.COMPLETED;
18
+ }, {
19
+ readonly label: "filterOptionFailed";
20
+ readonly value: CAMPAIGN_STATUS.FAILED;
21
+ }, {
22
+ readonly label: "filterOptionPaused";
23
+ readonly value: CAMPAIGN_STATUS.PAUSED;
24
+ }];
@@ -0,0 +1,11 @@
1
+ import { CAMPAIGN_STATUS } from "../../type";
2
+ export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
3
+ export const STATUS_OPTIONS = [
4
+ { label: "filterOptionAll", value: "" },
5
+ { label: "filterOptionDraft", value: CAMPAIGN_STATUS.DRAFT },
6
+ { label: "filterOptionScheduled", value: CAMPAIGN_STATUS.SCHEDULED },
7
+ { label: "filterOptionRunning", value: CAMPAIGN_STATUS.RUNNING },
8
+ { label: "filterOptionCompleted", value: CAMPAIGN_STATUS.COMPLETED },
9
+ { label: "filterOptionFailed", value: CAMPAIGN_STATUS.FAILED },
10
+ { label: "filterOptionPaused", value: CAMPAIGN_STATUS.PAUSED },
11
+ ];
@@ -0,0 +1,181 @@
1
+ import { PushCampaignBE } from "../../../type";
2
+ export declare const PUSH_CAMPAIGN_DRAWER: {
3
+ readonly FILTER_DRAWER: string;
4
+ readonly FORM_DRAWER: string;
5
+ readonly VIEW_DRAWER: string;
6
+ };
7
+ export declare const PUSH_CAMPAIGN_ACTION_TYPES: {
8
+ readonly RESET_FORM: "RESET_FORM";
9
+ readonly SET_CURRENT_PAGE: "SET_CURRENT_PAGE";
10
+ readonly SET_PAGE_LIMIT: "SET_PAGE_LIMIT";
11
+ readonly SET_SEARCH_QUERY: "SET_SEARCH_QUERY";
12
+ readonly SET_DRAWER: "SET_DRAWER";
13
+ readonly SET_ITEMS: "SET_ITEMS";
14
+ readonly SET_FORM_DATA: "SET_FORM_DATA";
15
+ readonly SET_DISABLE_SAVE_BUTTON: "SET_DISABLE_SAVE_BUTTON";
16
+ readonly SET_INPUT_FIELD: "SET_INPUT_FIELD";
17
+ readonly SET_ERRORS: "SET_ERRORS";
18
+ readonly SET_FILTERS: "SET_FILTERS";
19
+ }, pushCampaignModuleConfig: import("@react-pakistan/util-functions/factory/generic-module-factory").ModuleConfig<{
20
+ items: PushCampaignBE[];
21
+ count: number;
22
+ currentPage: number;
23
+ pageLimit: number;
24
+ searchQuery: string;
25
+ disableSaveButton: boolean;
26
+ drawer: string | null;
27
+ errors: Record<string, string>;
28
+ id: string;
29
+ name: string;
30
+ title: string;
31
+ body: string;
32
+ schoolId: string;
33
+ scheduledAt: string;
34
+ status: string;
35
+ enabled: boolean;
36
+ allStudents: boolean;
37
+ successCount: number;
38
+ failedCount: number;
39
+ totalCount: number;
40
+ workerJobId: string | null;
41
+ audience: Array<{
42
+ classId: string | null;
43
+ sectionId: string | null;
44
+ }>;
45
+ filterEnabled: boolean | undefined;
46
+ filterStatus: string | undefined;
47
+ aiCheckPassed: boolean;
48
+ aiCheckLoading: boolean;
49
+ aiCheckScore: number | null;
50
+ aiSuggestions: string;
51
+ }>, initialPushCampaignState: {
52
+ items: PushCampaignBE[];
53
+ count: number;
54
+ currentPage: number;
55
+ pageLimit: number;
56
+ searchQuery: string;
57
+ disableSaveButton: boolean;
58
+ drawer: string | null;
59
+ errors: Record<string, string>;
60
+ id: string;
61
+ name: string;
62
+ title: string;
63
+ body: string;
64
+ schoolId: string;
65
+ scheduledAt: string;
66
+ status: string;
67
+ enabled: boolean;
68
+ allStudents: boolean;
69
+ successCount: number;
70
+ failedCount: number;
71
+ totalCount: number;
72
+ workerJobId: string | null;
73
+ audience: Array<{
74
+ classId: string | null;
75
+ sectionId: string | null;
76
+ }>;
77
+ filterEnabled: boolean | undefined;
78
+ filterStatus: string | undefined;
79
+ aiCheckPassed: boolean;
80
+ aiCheckLoading: boolean;
81
+ aiCheckScore: number | null;
82
+ aiSuggestions: string;
83
+ }, PushCampaignProvider: import("react").FC<{
84
+ children: React.ReactNode;
85
+ }>, pushCampaignReducer: (state: {
86
+ items: PushCampaignBE[];
87
+ count: number;
88
+ currentPage: number;
89
+ pageLimit: number;
90
+ searchQuery: string;
91
+ disableSaveButton: boolean;
92
+ drawer: string | null;
93
+ errors: Record<string, string>;
94
+ id: string;
95
+ name: string;
96
+ title: string;
97
+ body: string;
98
+ schoolId: string;
99
+ scheduledAt: string;
100
+ status: string;
101
+ enabled: boolean;
102
+ allStudents: boolean;
103
+ successCount: number;
104
+ failedCount: number;
105
+ totalCount: number;
106
+ workerJobId: string | null;
107
+ audience: Array<{
108
+ classId: string | null;
109
+ sectionId: string | null;
110
+ }>;
111
+ filterEnabled: boolean | undefined;
112
+ filterStatus: string | undefined;
113
+ aiCheckPassed: boolean;
114
+ aiCheckLoading: boolean;
115
+ aiCheckScore: number | null;
116
+ aiSuggestions: string;
117
+ }, action: any) => {
118
+ items: PushCampaignBE[];
119
+ count: number;
120
+ currentPage: number;
121
+ pageLimit: number;
122
+ searchQuery: string;
123
+ disableSaveButton: boolean;
124
+ drawer: string | null;
125
+ errors: Record<string, string>;
126
+ id: string;
127
+ name: string;
128
+ title: string;
129
+ body: string;
130
+ schoolId: string;
131
+ scheduledAt: string;
132
+ status: string;
133
+ enabled: boolean;
134
+ allStudents: boolean;
135
+ successCount: number;
136
+ failedCount: number;
137
+ totalCount: number;
138
+ workerJobId: string | null;
139
+ audience: Array<{
140
+ classId: string | null;
141
+ sectionId: string | null;
142
+ }>;
143
+ filterEnabled: boolean | undefined;
144
+ filterStatus: string | undefined;
145
+ aiCheckPassed: boolean;
146
+ aiCheckLoading: boolean;
147
+ aiCheckScore: number | null;
148
+ aiSuggestions: string;
149
+ }, usePushCampaignContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContextWithHandlers<{
150
+ items: PushCampaignBE[];
151
+ count: number;
152
+ currentPage: number;
153
+ pageLimit: number;
154
+ searchQuery: string;
155
+ disableSaveButton: boolean;
156
+ drawer: string | null;
157
+ errors: Record<string, string>;
158
+ id: string;
159
+ name: string;
160
+ title: string;
161
+ body: string;
162
+ schoolId: string;
163
+ scheduledAt: string;
164
+ status: string;
165
+ enabled: boolean;
166
+ allStudents: boolean;
167
+ successCount: number;
168
+ failedCount: number;
169
+ totalCount: number;
170
+ workerJobId: string | null;
171
+ audience: Array<{
172
+ classId: string | null;
173
+ sectionId: string | null;
174
+ }>;
175
+ filterEnabled: boolean | undefined;
176
+ filterStatus: string | undefined;
177
+ aiCheckPassed: boolean;
178
+ aiCheckLoading: boolean;
179
+ aiCheckScore: number | null;
180
+ aiSuggestions: string;
181
+ }>;
@@ -0,0 +1,45 @@
1
+ import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
2
+ import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
3
+ import { CAMPAIGN_STATUS } from "../../../type";
4
+ import { pageLimit } from "../constants";
5
+ export const PUSH_CAMPAIGN_DRAWER = {
6
+ FILTER_DRAWER: DRAWER_TYPES.FILTER_DRAWER,
7
+ FORM_DRAWER: DRAWER_TYPES.FORM_DRAWER,
8
+ VIEW_DRAWER: DRAWER_TYPES.VIEW_DRAWER,
9
+ };
10
+ const pushCampaignConfig = {
11
+ name: "PushCampaign",
12
+ displayName: "Push Campaign",
13
+ drawerTypes: DRAWER_TYPES,
14
+ initialState: {
15
+ items: [],
16
+ count: 0,
17
+ currentPage: 1,
18
+ pageLimit,
19
+ searchQuery: "",
20
+ disableSaveButton: false,
21
+ drawer: null,
22
+ errors: {},
23
+ id: "",
24
+ name: "",
25
+ title: "",
26
+ body: "",
27
+ schoolId: "",
28
+ scheduledAt: "",
29
+ status: CAMPAIGN_STATUS.DRAFT,
30
+ enabled: true,
31
+ allStudents: false,
32
+ successCount: 0,
33
+ failedCount: 0,
34
+ totalCount: 0,
35
+ workerJobId: null,
36
+ audience: [],
37
+ filterEnabled: undefined,
38
+ filterStatus: undefined,
39
+ aiCheckPassed: false,
40
+ aiCheckLoading: false,
41
+ aiCheckScore: null,
42
+ aiSuggestions: "",
43
+ },
44
+ };
45
+ export const { actionTypes: PUSH_CAMPAIGN_ACTION_TYPES, config: pushCampaignModuleConfig, initialState: initialPushCampaignState, Provider: PushCampaignProvider, reducer: pushCampaignReducer, useContext: usePushCampaignContext, } = createGenericModule(pushCampaignConfig);
@@ -0,0 +1,66 @@
1
+ import { PushCampaignBE } from "../../../type";
2
+ import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
3
+ export declare const usePushCampaignModule: () => {
4
+ applyFilters: () => void;
5
+ byIdLoading: boolean;
6
+ clearFilters: () => void;
7
+ closeDrawer: () => void;
8
+ deleteLoading: boolean;
9
+ handleAiCheck: () => Promise<void>;
10
+ handleChange: (field: string, value: string | number | boolean | undefined | null) => void;
11
+ handleCreate: () => void;
12
+ handleDelete: (row?: TableRow) => void;
13
+ handleEdit: (row?: TableRow) => void;
14
+ handleFilters: () => void;
15
+ handleLaunch: (row?: TableRow) => Promise<void>;
16
+ handlePageChange: (page: number | unknown) => void;
17
+ handlePageLimitChange: (k: string, value: object) => void;
18
+ handleSearch: (query: string) => void;
19
+ handleSubmit: () => void;
20
+ handleView: (row?: TableRow) => void;
21
+ headerActions: {
22
+ enabled: boolean;
23
+ handleOnClick: () => void;
24
+ label: string;
25
+ order: number;
26
+ }[];
27
+ listFetchNow: (url?: string, config?: import("@react-pakistan/util-functions/hooks/use-fetch").FetchConfig) => void;
28
+ listLoading: boolean;
29
+ rowActions: RowAction[];
30
+ updateLoading: boolean;
31
+ handleCloseDrawer?: () => void;
32
+ state: {
33
+ items: PushCampaignBE[];
34
+ count: number;
35
+ currentPage: number;
36
+ pageLimit: number;
37
+ searchQuery: string;
38
+ disableSaveButton: boolean;
39
+ drawer: string | null;
40
+ errors: Record<string, string>;
41
+ id: string;
42
+ name: string;
43
+ title: string;
44
+ body: string;
45
+ schoolId: string;
46
+ scheduledAt: string;
47
+ status: string;
48
+ enabled: boolean;
49
+ allStudents: boolean;
50
+ successCount: number;
51
+ failedCount: number;
52
+ totalCount: number;
53
+ workerJobId: string | null;
54
+ audience: Array<{
55
+ classId: string | null;
56
+ sectionId: string | null;
57
+ }>;
58
+ filterEnabled: boolean | undefined;
59
+ filterStatus: string | undefined;
60
+ aiCheckPassed: boolean;
61
+ aiCheckLoading: boolean;
62
+ aiCheckScore: number | null;
63
+ aiSuggestions: string;
64
+ };
65
+ dispatch: React.Dispatch<any>;
66
+ };