@infuro/cms-core 1.0.33 → 1.0.35

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 (164) hide show
  1. package/README.md +22 -6
  2. package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
  3. package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
  4. package/dist/admin.cjs +34072 -20487
  5. package/dist/admin.d.cts +191 -9
  6. package/dist/admin.d.ts +191 -9
  7. package/dist/admin.js +33913 -20423
  8. package/dist/api.cjs +123 -16508
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +14 -16519
  12. package/dist/auth.cjs +196 -955
  13. package/dist/auth.d.cts +201 -42
  14. package/dist/auth.d.ts +201 -42
  15. package/dist/auth.js +4 -888
  16. package/dist/chunk-2XE4X74C.js +29602 -0
  17. package/dist/chunk-3DZRIZOD.cjs +52 -0
  18. package/dist/chunk-3KPNTQBV.cjs +620 -0
  19. package/dist/chunk-46GKADYE.cjs +84 -0
  20. package/dist/chunk-4TRPKBKO.js +589 -0
  21. package/dist/chunk-5ELSW2UP.js +150 -0
  22. package/dist/chunk-6KPQWRFW.js +171 -0
  23. package/dist/chunk-7NMT3GBR.cjs +29 -0
  24. package/dist/chunk-7YIBMQDR.cjs +86 -0
  25. package/dist/chunk-BGJAV67S.cjs +29710 -0
  26. package/dist/chunk-CNTSLED2.cjs +559 -0
  27. package/dist/chunk-CRFV5WJK.js +16 -0
  28. package/dist/chunk-D5FBNKQM.cjs +104 -0
  29. package/dist/chunk-EF2JBPDM.js +114 -0
  30. package/dist/chunk-EQPITOP6.js +543 -0
  31. package/dist/chunk-GO7PPYNU.js +76 -0
  32. package/dist/chunk-HF3L2GIT.cjs +194 -0
  33. package/dist/chunk-J7XHLOLO.js +830 -0
  34. package/dist/chunk-JBRR5UYL.js +87 -0
  35. package/dist/chunk-JC6DLWTE.js +21 -0
  36. package/dist/chunk-JHF4YYRC.cjs +188 -0
  37. package/dist/chunk-JXF23MPG.js +25 -0
  38. package/dist/chunk-MQBT33IV.js +48 -0
  39. package/dist/chunk-N44BJZ4C.cjs +123 -0
  40. package/dist/chunk-OOTLNH63.cjs +18 -0
  41. package/dist/chunk-PAMVINEX.cjs +577 -0
  42. package/dist/chunk-PNOKNSG2.cjs +222 -0
  43. package/dist/chunk-QM733NUK.js +186 -0
  44. package/dist/chunk-R73BKDRO.cjs +90 -0
  45. package/dist/chunk-SHUYVCID.js +4 -0
  46. package/dist/chunk-SYBOCAWB.js +97 -0
  47. package/dist/chunk-TDV6EJHV.js +192 -0
  48. package/dist/chunk-TFUOHI37.cjs +839 -0
  49. package/dist/chunk-TIAEXJLI.cjs +182 -0
  50. package/dist/chunk-UPLVMVRX.cjs +23 -0
  51. package/dist/chunk-USNT2KNT.cjs +6 -0
  52. package/dist/chunk-WEMDMVHQ.js +216 -0
  53. package/dist/chunk-XDSNZUW7.js +564 -0
  54. package/dist/chunk-XQ3QUHWR.cjs +83 -0
  55. package/dist/chunk-XW5ATPRW.cjs +155 -0
  56. package/dist/chunk-ZQ4X6OAU.js +82 -0
  57. package/dist/chunk-ZSVCP6N3.js +83 -0
  58. package/dist/cli.cjs +142 -84
  59. package/dist/cli.js +101 -27
  60. package/dist/email-FKR4FXFI.js +5 -0
  61. package/dist/email-KVKVPNCL.cjs +58 -0
  62. package/dist/email-queue-CGZBVVAS.js +2 -0
  63. package/dist/email-queue-TPZWLTIV.cjs +23 -0
  64. package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
  65. package/dist/erp-config-enabled-T37X7T34.js +2 -0
  66. package/dist/erp-order-invoice-3YISSOWW.js +3 -0
  67. package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
  68. package/dist/event-order-defaults-6E543227.js +2 -0
  69. package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
  70. package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
  71. package/dist/event-order-notifications-IIIF23D5.js +10 -0
  72. package/dist/hooks.cjs +259 -132
  73. package/dist/hooks.d.cts +42 -1
  74. package/dist/hooks.d.ts +42 -1
  75. package/dist/hooks.js +234 -91
  76. package/dist/index.cjs +3884 -21070
  77. package/dist/index.d.cts +2255 -749
  78. package/dist/index.d.ts +2255 -749
  79. package/dist/index.js +1925 -19891
  80. package/dist/interpolate-WAKPN56R.cjs +11 -0
  81. package/dist/interpolate-WDUWDF3I.js +2 -0
  82. package/dist/layout-36UFTHC5.cjs +11 -0
  83. package/dist/layout-AOBN26XG.js +2 -0
  84. package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
  85. package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
  86. package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
  87. package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
  88. package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
  89. package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
  90. package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
  91. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  92. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  93. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  94. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  95. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  96. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  97. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  98. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  99. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  100. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  101. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  102. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  103. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  104. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  105. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  106. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  107. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  108. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  109. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  110. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  111. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  112. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  113. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  114. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  115. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  116. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  117. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  118. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  119. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  120. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  121. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  122. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  123. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  124. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  125. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  126. package/dist/razorpay-KLO2KNCB.js +49 -0
  127. package/dist/razorpay-U23LGY72.cjs +56 -0
  128. package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
  129. package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
  130. package/dist/sms-defaults-2NL24H57.js +2 -0
  131. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  132. package/dist/stripe-4FD27QVJ.js +51 -0
  133. package/dist/stripe-VU6OEG2D.cjs +57 -0
  134. package/dist/theme.cjs +31 -59
  135. package/dist/theme.d.cts +78 -3
  136. package/dist/theme.d.ts +78 -3
  137. package/dist/theme.js +23 -20
  138. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  139. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  140. package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
  141. package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
  142. package/package.json +147 -141
  143. package/dist/admin.cjs.map +0 -1
  144. package/dist/admin.js.map +0 -1
  145. package/dist/api.cjs.map +0 -1
  146. package/dist/api.js.map +0 -1
  147. package/dist/auth.cjs.map +0 -1
  148. package/dist/auth.js.map +0 -1
  149. package/dist/cli.cjs.map +0 -1
  150. package/dist/cli.js.map +0 -1
  151. package/dist/config-DJ5CmQvS.d.cts +0 -8
  152. package/dist/config-DJ5CmQvS.d.ts +0 -8
  153. package/dist/hooks.cjs.map +0 -1
  154. package/dist/hooks.js.map +0 -1
  155. package/dist/index-DWd5Gjc4.d.ts +0 -582
  156. package/dist/index-rZTnpK7y.d.cts +0 -582
  157. package/dist/index.cjs.map +0 -1
  158. package/dist/index.js.map +0 -1
  159. package/dist/theme.cjs.map +0 -1
  160. package/dist/theme.js.map +0 -1
  161. package/dist/types-DCVaXlPV.d.cts +0 -78
  162. package/dist/types-DCVaXlPV.d.ts +0 -78
  163. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  164. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
package/dist/cli.cjs CHANGED
@@ -1,31 +1,15 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
-
26
- // src/cli.ts
27
- var import_fs = __toESM(require("fs"), 1);
28
- var import_path = __toESM(require("path"), 1);
2
+ 'use strict';
3
+
4
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
11
+ var path__default = /*#__PURE__*/_interopDefault(path);
12
+
29
13
  var TEMPLATES = {
30
14
  "src/lib/data-source.ts": `import 'reflect-metadata';
31
15
  import path from 'path';
@@ -252,6 +236,45 @@ async function getHandler() {
252
236
 
253
237
  type NextAuthContext = { params: Promise<{ nextauth?: string[] }> };
254
238
 
239
+ export async function GET(req: Request, context: NextAuthContext) {
240
+ return (await getHandler())(req, context);
241
+ }
242
+ export async function POST(req: Request, context: NextAuthContext) {
243
+ return (await getHandler())(req, context);
244
+ }
245
+ `,
246
+ "src/app/api/storefront-auth/[...nextauth]/route.ts": `import NextAuth from 'next-auth';
247
+ import { getStorefrontNextAuthOptions } from '@infuro/cms-core/auth';
248
+ import { getDataSourceInitialized } from '@/lib/data-source';
249
+ import { CMS_ENTITY_MAP, enrichUserWithVendorContext } from '@infuro/cms-core';
250
+ import bcrypt from 'bcryptjs';
251
+
252
+ async function getOptions() {
253
+ const dataSource = await getDataSourceInitialized();
254
+ const userRepo = dataSource.getRepository(CMS_ENTITY_MAP.users);
255
+ return getStorefrontNextAuthOptions({
256
+ getUserByEmail: async (email: string) => {
257
+ const user = await userRepo.findOne({
258
+ where: { email },
259
+ relations: ['group', 'group.permissions'],
260
+ select: ['id', 'email', 'name', 'password', 'blocked', 'deleted', 'groupId', 'adminAccess'],
261
+ });
262
+ return enrichUserWithVendorContext(dataSource, user as any);
263
+ },
264
+ comparePassword: (plain, hash) => Promise.resolve(bcrypt.compareSync(plain, hash)),
265
+ signInPage: '/signin',
266
+ });
267
+ }
268
+
269
+ let handler: ReturnType<typeof NextAuth> | null = null;
270
+
271
+ async function getHandler() {
272
+ if (!handler) handler = NextAuth(await getOptions());
273
+ return handler;
274
+ }
275
+
276
+ type NextAuthContext = { params: Promise<{ nextauth?: string[] }> };
277
+
255
278
  export async function GET(req: Request, context: NextAuthContext) {
256
279
  return (await getHandler())(req, context);
257
280
  }
@@ -651,25 +674,26 @@ export function getThemeById(id: string | undefined): ThemeConfig {
651
674
  `
652
675
  };
653
676
  function findRoot(cwd) {
654
- let dir = import_path.default.resolve(cwd);
677
+ let dir = path__default.default.resolve(cwd);
655
678
  for (let i = 0; i < 20; i++) {
656
- const pkgPath = import_path.default.join(dir, "package.json");
657
- if (import_fs.default.existsSync(pkgPath)) {
679
+ const pkgPath = path__default.default.join(dir, "package.json");
680
+ if (fs__default.default.existsSync(pkgPath)) {
658
681
  try {
659
- const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
682
+ const pkg = JSON.parse(fs__default.default.readFileSync(pkgPath, "utf8"));
660
683
  if (pkg.dependencies?.next || pkg.devDependencies?.next) return dir;
661
684
  } catch {
662
685
  }
663
686
  }
664
- const parent = import_path.default.dirname(dir);
687
+ const parent = path__default.default.dirname(dir);
665
688
  if (parent === dir) break;
666
689
  dir = parent;
667
690
  }
668
691
  return null;
669
692
  }
693
+ chunkUSNT2KNT_cjs.__name(findRoot, "findRoot");
670
694
  function writeFile(root, filePath, content, force2, dryRun2, log) {
671
- const full = import_path.default.join(root, filePath);
672
- if (import_fs.default.existsSync(full) && !force2) {
695
+ const full = path__default.default.join(root, filePath);
696
+ if (fs__default.default.existsSync(full) && !force2) {
673
697
  log(` skip (exists): ${filePath}`);
674
698
  return false;
675
699
  }
@@ -677,18 +701,25 @@ function writeFile(root, filePath, content, force2, dryRun2, log) {
677
701
  log(` would create: ${filePath}`);
678
702
  return true;
679
703
  }
680
- const dir = import_path.default.dirname(full);
681
- import_fs.default.mkdirSync(dir, { recursive: true });
682
- import_fs.default.writeFileSync(full, content, "utf8");
704
+ const dir = path__default.default.dirname(full);
705
+ fs__default.default.mkdirSync(dir, {
706
+ recursive: true
707
+ });
708
+ fs__default.default.writeFileSync(full, content, "utf8");
683
709
  log(` created: ${filePath}`);
684
710
  return true;
685
711
  }
712
+ chunkUSNT2KNT_cjs.__name(writeFile, "writeFile");
686
713
  function patchNextConfig(root, dryRun2, log) {
687
- const candidates = ["next.config.js", "next.config.mjs", "next.config.cjs"];
714
+ const candidates = [
715
+ "next.config.js",
716
+ "next.config.mjs",
717
+ "next.config.cjs"
718
+ ];
688
719
  let configPath = null;
689
720
  for (const name of candidates) {
690
- const p = import_path.default.join(root, name);
691
- if (import_fs.default.existsSync(p)) {
721
+ const p = path__default.default.join(root, name);
722
+ if (fs__default.default.existsSync(p)) {
692
723
  configPath = p;
693
724
  break;
694
725
  }
@@ -697,36 +728,35 @@ function patchNextConfig(root, dryRun2, log) {
697
728
  log(" skip next.config: not found");
698
729
  return false;
699
730
  }
700
- let content = import_fs.default.readFileSync(configPath, "utf8");
731
+ let content = fs__default.default.readFileSync(configPath, "utf8");
701
732
  if (content.includes("'@infuro/cms-core'") || content.includes('"@infuro/cms-core"')) {
702
- log(` skip (already has core): ${import_path.default.basename(configPath)}`);
733
+ log(` skip (already has core): ${path__default.default.basename(configPath)}`);
703
734
  return false;
704
735
  }
705
736
  if (content.includes("serverExternalPackages")) {
706
- content = content.replace(
707
- /(serverExternalPackages:\s*\[)/,
708
- "$1'@infuro/cms-core', 'typeorm', 'rss-parser', "
709
- );
737
+ content = content.replace(/(serverExternalPackages:\s*\[)/, "$1'@infuro/cms-core', 'typeorm', 'rss-parser', ");
710
738
  } else {
711
- content = content.replace(
712
- /(const nextConfig\s*=\s*\{|module\.exports\s*=\s*\{)/,
713
- "$1\n serverExternalPackages: ['@infuro/cms-core', 'typeorm', 'rss-parser'],"
714
- );
739
+ content = content.replace(/(const nextConfig\s*=\s*\{|module\.exports\s*=\s*\{)/, "$1\n serverExternalPackages: ['@infuro/cms-core', 'typeorm', 'rss-parser'],");
715
740
  }
716
741
  if (dryRun2) {
717
- log(` would patch: ${import_path.default.basename(configPath)}`);
742
+ log(` would patch: ${path__default.default.basename(configPath)}`);
718
743
  return true;
719
744
  }
720
- import_fs.default.writeFileSync(configPath, content, "utf8");
721
- log(` patched: ${import_path.default.basename(configPath)}`);
745
+ fs__default.default.writeFileSync(configPath, content, "utf8");
746
+ log(` patched: ${path__default.default.basename(configPath)}`);
722
747
  return true;
723
748
  }
749
+ chunkUSNT2KNT_cjs.__name(patchNextConfig, "patchNextConfig");
724
750
  function patchTailwind(root, dryRun2, log) {
725
- const candidates = ["tailwind.config.js", "tailwind.config.mjs", "tailwind.config.ts"];
751
+ const candidates = [
752
+ "tailwind.config.js",
753
+ "tailwind.config.mjs",
754
+ "tailwind.config.ts"
755
+ ];
726
756
  let configPath = null;
727
757
  for (const name of candidates) {
728
- const p = import_path.default.join(root, name);
729
- if (import_fs.default.existsSync(p)) {
758
+ const p = path__default.default.join(root, name);
759
+ if (fs__default.default.existsSync(p)) {
730
760
  configPath = p;
731
761
  break;
732
762
  }
@@ -735,34 +765,32 @@ function patchTailwind(root, dryRun2, log) {
735
765
  log(" skip tailwind: config not found");
736
766
  return false;
737
767
  }
738
- let content = import_fs.default.readFileSync(configPath, "utf8");
768
+ let content = fs__default.default.readFileSync(configPath, "utf8");
739
769
  const coreContent = "./node_modules/@infuro/cms-core/dist/**/*.{js,cjs}";
740
770
  if (content.includes("@infuro/cms-core")) {
741
- log(` skip (already has core): ${import_path.default.basename(configPath)}`);
771
+ log(` skip (already has core): ${path__default.default.basename(configPath)}`);
742
772
  return false;
743
773
  }
744
774
  if (content.includes("content:")) {
745
- content = content.replace(
746
- /(content:\s*\[)/,
747
- `$1
748
- "${coreContent}",`
749
- );
775
+ content = content.replace(/(content:\s*\[)/, `$1
776
+ "${coreContent}",`);
750
777
  }
751
778
  if (dryRun2) {
752
- log(` would patch: ${import_path.default.basename(configPath)}`);
779
+ log(` would patch: ${path__default.default.basename(configPath)}`);
753
780
  return true;
754
781
  }
755
- import_fs.default.writeFileSync(configPath, content, "utf8");
756
- log(` patched: ${import_path.default.basename(configPath)}`);
782
+ fs__default.default.writeFileSync(configPath, content, "utf8");
783
+ log(` patched: ${path__default.default.basename(configPath)}`);
757
784
  return true;
758
785
  }
786
+ chunkUSNT2KNT_cjs.__name(patchTailwind, "patchTailwind");
759
787
  function patchLayout(root, dryRun2, log) {
760
- const layoutPath = import_path.default.join(root, "src/app/layout.tsx");
761
- if (!import_fs.default.existsSync(layoutPath)) {
788
+ const layoutPath = path__default.default.join(root, "src/app/layout.tsx");
789
+ if (!fs__default.default.existsSync(layoutPath)) {
762
790
  log(" skip layout: src/app/layout.tsx not found");
763
791
  return false;
764
792
  }
765
- let content = import_fs.default.readFileSync(layoutPath, "utf8");
793
+ let content = fs__default.default.readFileSync(layoutPath, "utf8");
766
794
  if (content.includes("<Providers>")) {
767
795
  log(" skip layout: already uses Providers");
768
796
  return false;
@@ -788,14 +816,15 @@ function patchLayout(root, dryRun2, log) {
788
816
  if (content.includes("<html") && !content.includes("suppressHydrationWarning")) {
789
817
  content = content.replace(/<html(\s)/, "<html suppressHydrationWarning$1");
790
818
  }
791
- import_fs.default.writeFileSync(layoutPath, content, "utf8");
819
+ fs__default.default.writeFileSync(layoutPath, content, "utf8");
792
820
  log(" patched: src/app/layout.tsx");
793
821
  return true;
794
822
  }
823
+ chunkUSNT2KNT_cjs.__name(patchLayout, "patchLayout");
795
824
  function patchPackageJson(root, dryRun2, log) {
796
- const pkgPath = import_path.default.join(root, "package.json");
797
- if (!import_fs.default.existsSync(pkgPath)) return false;
798
- const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
825
+ const pkgPath = path__default.default.join(root, "package.json");
826
+ if (!fs__default.default.existsSync(pkgPath)) return false;
827
+ const pkg = JSON.parse(fs__default.default.readFileSync(pkgPath, "utf8"));
799
828
  const scripts = pkg.scripts || {};
800
829
  let changed = false;
801
830
  if (!scripts.seed) {
@@ -829,41 +858,65 @@ function patchPackageJson(root, dryRun2, log) {
829
858
  return false;
830
859
  }
831
860
  pkg.scripts = scripts;
832
- pkg.dependencies = { ...pkg.dependencies, ...deps };
833
- pkg.devDependencies = { ...pkg.devDependencies, ...dev };
861
+ pkg.dependencies = {
862
+ ...pkg.dependencies,
863
+ ...deps
864
+ };
865
+ pkg.devDependencies = {
866
+ ...pkg.devDependencies,
867
+ ...dev
868
+ };
834
869
  if (dryRun2) {
835
870
  log(" would patch: package.json (scripts + devDependencies)");
836
871
  return true;
837
872
  }
838
- import_fs.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), "utf8");
873
+ fs__default.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), "utf8");
839
874
  log(" patched: package.json");
840
875
  return true;
841
876
  }
877
+ chunkUSNT2KNT_cjs.__name(patchPackageJson, "patchPackageJson");
842
878
  async function runNpmInstall(root, log) {
843
- const { spawnSync } = await import("child_process");
879
+ const { spawnSync } = await import('child_process');
844
880
  log(" running: npm install (deps)...");
845
- spawnSync("npm", ["install", "@infuro/cms-core", "typeorm", "reflect-metadata", "bcryptjs", "next-auth", "next-themes", "sonner", "pg-boss"], {
881
+ spawnSync("npm", [
882
+ "install",
883
+ "@infuro/cms-core",
884
+ "typeorm",
885
+ "reflect-metadata",
886
+ "bcryptjs",
887
+ "next-auth",
888
+ "next-themes",
889
+ "sonner",
890
+ "pg-boss"
891
+ ], {
846
892
  cwd: root,
847
893
  stdio: "inherit",
848
894
  shell: true
849
895
  });
850
896
  log(" running: npm install -D tsx dotenv @types/node...");
851
- spawnSync("npm", ["install", "-D", "tsx", "dotenv", "@types/node"], {
897
+ spawnSync("npm", [
898
+ "install",
899
+ "-D",
900
+ "tsx",
901
+ "dotenv",
902
+ "@types/node"
903
+ ], {
852
904
  cwd: root,
853
905
  stdio: "inherit",
854
906
  shell: true
855
907
  });
856
908
  }
909
+ chunkUSNT2KNT_cjs.__name(runNpmInstall, "runNpmInstall");
857
910
  async function runInit(opts) {
858
- const log = (msg) => console.log(msg);
911
+ const log = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((msg) => console.log(msg), "log");
859
912
  const cwd = process.cwd();
860
913
  const root = findRoot(cwd);
861
914
  if (!root) {
862
915
  console.error("Not a Next.js project (no package.json with next dependency found from " + cwd + ")");
863
916
  process.exit(1);
864
917
  }
865
- const appDir = import_path.default.join(root, "src/app");
866
- if (!import_fs.default.existsSync(appDir)) {
918
+ const appDir = path__default.default.join(root, "src/app");
919
+ if (!fs__default.default.existsSync(appDir)) {
867
920
  console.error("Expected src/app directory not found. Use a Next.js app with src directory (e.g. create-next-app --src-dir).");
868
921
  process.exit(1);
869
922
  }
@@ -892,13 +945,19 @@ async function runInit(opts) {
892
945
  log(" 2. Run npm run migration:run then npm run seed (creates admin from ADMIN_EMAIL/ADMIN_PASSWORD)");
893
946
  log(" 3. npm run dev");
894
947
  }
948
+ chunkUSNT2KNT_cjs.__name(runInit, "runInit");
895
949
  var args = process.argv.slice(2);
896
950
  var force = args.includes("--force");
897
951
  var dryRun = args.includes("--dry-run");
898
952
  var noDeps = args.includes("--no-deps");
899
953
  var noPatchConfig = args.includes("--no-patch-config");
900
954
  if (args[0] === "init" || args.includes("--init") || args.length === 0 && !args.some((a) => a.startsWith("--"))) {
901
- runInit({ force, dryRun, noDeps, noPatchConfig }).catch((e) => {
955
+ runInit({
956
+ force,
957
+ dryRun,
958
+ noDeps,
959
+ noPatchConfig
960
+ }).catch((e) => {
902
961
  console.error(e);
903
962
  process.exit(1);
904
963
  });
@@ -906,4 +965,3 @@ if (args[0] === "init" || args.includes("--init") || args.length === 0 && !args.
906
965
  console.log("Usage: npx @infuro/cms-core init [--force] [--dry-run] [--no-deps] [--no-patch-config]");
907
966
  process.exit(args[0] === "--help" || args[0] === "-h" ? 0 : 1);
908
967
  }
909
- //# sourceMappingURL=cli.cjs.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import { __name } from './chunk-SHUYVCID.js';
3
+ import fs from 'fs';
4
+ import path from 'path';
2
5
 
3
- // src/cli.ts
4
- import fs from "fs";
5
- import path from "path";
6
6
  var TEMPLATES = {
7
7
  "src/lib/data-source.ts": `import 'reflect-metadata';
8
8
  import path from 'path';
@@ -229,6 +229,45 @@ async function getHandler() {
229
229
 
230
230
  type NextAuthContext = { params: Promise<{ nextauth?: string[] }> };
231
231
 
232
+ export async function GET(req: Request, context: NextAuthContext) {
233
+ return (await getHandler())(req, context);
234
+ }
235
+ export async function POST(req: Request, context: NextAuthContext) {
236
+ return (await getHandler())(req, context);
237
+ }
238
+ `,
239
+ "src/app/api/storefront-auth/[...nextauth]/route.ts": `import NextAuth from 'next-auth';
240
+ import { getStorefrontNextAuthOptions } from '@infuro/cms-core/auth';
241
+ import { getDataSourceInitialized } from '@/lib/data-source';
242
+ import { CMS_ENTITY_MAP, enrichUserWithVendorContext } from '@infuro/cms-core';
243
+ import bcrypt from 'bcryptjs';
244
+
245
+ async function getOptions() {
246
+ const dataSource = await getDataSourceInitialized();
247
+ const userRepo = dataSource.getRepository(CMS_ENTITY_MAP.users);
248
+ return getStorefrontNextAuthOptions({
249
+ getUserByEmail: async (email: string) => {
250
+ const user = await userRepo.findOne({
251
+ where: { email },
252
+ relations: ['group', 'group.permissions'],
253
+ select: ['id', 'email', 'name', 'password', 'blocked', 'deleted', 'groupId', 'adminAccess'],
254
+ });
255
+ return enrichUserWithVendorContext(dataSource, user as any);
256
+ },
257
+ comparePassword: (plain, hash) => Promise.resolve(bcrypt.compareSync(plain, hash)),
258
+ signInPage: '/signin',
259
+ });
260
+ }
261
+
262
+ let handler: ReturnType<typeof NextAuth> | null = null;
263
+
264
+ async function getHandler() {
265
+ if (!handler) handler = NextAuth(await getOptions());
266
+ return handler;
267
+ }
268
+
269
+ type NextAuthContext = { params: Promise<{ nextauth?: string[] }> };
270
+
232
271
  export async function GET(req: Request, context: NextAuthContext) {
233
272
  return (await getHandler())(req, context);
234
273
  }
@@ -644,6 +683,7 @@ function findRoot(cwd) {
644
683
  }
645
684
  return null;
646
685
  }
686
+ __name(findRoot, "findRoot");
647
687
  function writeFile(root, filePath, content, force2, dryRun2, log) {
648
688
  const full = path.join(root, filePath);
649
689
  if (fs.existsSync(full) && !force2) {
@@ -655,13 +695,20 @@ function writeFile(root, filePath, content, force2, dryRun2, log) {
655
695
  return true;
656
696
  }
657
697
  const dir = path.dirname(full);
658
- fs.mkdirSync(dir, { recursive: true });
698
+ fs.mkdirSync(dir, {
699
+ recursive: true
700
+ });
659
701
  fs.writeFileSync(full, content, "utf8");
660
702
  log(` created: ${filePath}`);
661
703
  return true;
662
704
  }
705
+ __name(writeFile, "writeFile");
663
706
  function patchNextConfig(root, dryRun2, log) {
664
- const candidates = ["next.config.js", "next.config.mjs", "next.config.cjs"];
707
+ const candidates = [
708
+ "next.config.js",
709
+ "next.config.mjs",
710
+ "next.config.cjs"
711
+ ];
665
712
  let configPath = null;
666
713
  for (const name of candidates) {
667
714
  const p = path.join(root, name);
@@ -680,15 +727,9 @@ function patchNextConfig(root, dryRun2, log) {
680
727
  return false;
681
728
  }
682
729
  if (content.includes("serverExternalPackages")) {
683
- content = content.replace(
684
- /(serverExternalPackages:\s*\[)/,
685
- "$1'@infuro/cms-core', 'typeorm', 'rss-parser', "
686
- );
730
+ content = content.replace(/(serverExternalPackages:\s*\[)/, "$1'@infuro/cms-core', 'typeorm', 'rss-parser', ");
687
731
  } else {
688
- content = content.replace(
689
- /(const nextConfig\s*=\s*\{|module\.exports\s*=\s*\{)/,
690
- "$1\n serverExternalPackages: ['@infuro/cms-core', 'typeorm', 'rss-parser'],"
691
- );
732
+ content = content.replace(/(const nextConfig\s*=\s*\{|module\.exports\s*=\s*\{)/, "$1\n serverExternalPackages: ['@infuro/cms-core', 'typeorm', 'rss-parser'],");
692
733
  }
693
734
  if (dryRun2) {
694
735
  log(` would patch: ${path.basename(configPath)}`);
@@ -698,8 +739,13 @@ function patchNextConfig(root, dryRun2, log) {
698
739
  log(` patched: ${path.basename(configPath)}`);
699
740
  return true;
700
741
  }
742
+ __name(patchNextConfig, "patchNextConfig");
701
743
  function patchTailwind(root, dryRun2, log) {
702
- const candidates = ["tailwind.config.js", "tailwind.config.mjs", "tailwind.config.ts"];
744
+ const candidates = [
745
+ "tailwind.config.js",
746
+ "tailwind.config.mjs",
747
+ "tailwind.config.ts"
748
+ ];
703
749
  let configPath = null;
704
750
  for (const name of candidates) {
705
751
  const p = path.join(root, name);
@@ -719,11 +765,8 @@ function patchTailwind(root, dryRun2, log) {
719
765
  return false;
720
766
  }
721
767
  if (content.includes("content:")) {
722
- content = content.replace(
723
- /(content:\s*\[)/,
724
- `$1
725
- "${coreContent}",`
726
- );
768
+ content = content.replace(/(content:\s*\[)/, `$1
769
+ "${coreContent}",`);
727
770
  }
728
771
  if (dryRun2) {
729
772
  log(` would patch: ${path.basename(configPath)}`);
@@ -733,6 +776,7 @@ function patchTailwind(root, dryRun2, log) {
733
776
  log(` patched: ${path.basename(configPath)}`);
734
777
  return true;
735
778
  }
779
+ __name(patchTailwind, "patchTailwind");
736
780
  function patchLayout(root, dryRun2, log) {
737
781
  const layoutPath = path.join(root, "src/app/layout.tsx");
738
782
  if (!fs.existsSync(layoutPath)) {
@@ -769,6 +813,7 @@ function patchLayout(root, dryRun2, log) {
769
813
  log(" patched: src/app/layout.tsx");
770
814
  return true;
771
815
  }
816
+ __name(patchLayout, "patchLayout");
772
817
  function patchPackageJson(root, dryRun2, log) {
773
818
  const pkgPath = path.join(root, "package.json");
774
819
  if (!fs.existsSync(pkgPath)) return false;
@@ -806,8 +851,14 @@ function patchPackageJson(root, dryRun2, log) {
806
851
  return false;
807
852
  }
808
853
  pkg.scripts = scripts;
809
- pkg.dependencies = { ...pkg.dependencies, ...deps };
810
- pkg.devDependencies = { ...pkg.devDependencies, ...dev };
854
+ pkg.dependencies = {
855
+ ...pkg.dependencies,
856
+ ...deps
857
+ };
858
+ pkg.devDependencies = {
859
+ ...pkg.devDependencies,
860
+ ...dev
861
+ };
811
862
  if (dryRun2) {
812
863
  log(" would patch: package.json (scripts + devDependencies)");
813
864
  return true;
@@ -816,23 +867,41 @@ function patchPackageJson(root, dryRun2, log) {
816
867
  log(" patched: package.json");
817
868
  return true;
818
869
  }
870
+ __name(patchPackageJson, "patchPackageJson");
819
871
  async function runNpmInstall(root, log) {
820
- const { spawnSync } = await import("child_process");
872
+ const { spawnSync } = await import('child_process');
821
873
  log(" running: npm install (deps)...");
822
- spawnSync("npm", ["install", "@infuro/cms-core", "typeorm", "reflect-metadata", "bcryptjs", "next-auth", "next-themes", "sonner", "pg-boss"], {
874
+ spawnSync("npm", [
875
+ "install",
876
+ "@infuro/cms-core",
877
+ "typeorm",
878
+ "reflect-metadata",
879
+ "bcryptjs",
880
+ "next-auth",
881
+ "next-themes",
882
+ "sonner",
883
+ "pg-boss"
884
+ ], {
823
885
  cwd: root,
824
886
  stdio: "inherit",
825
887
  shell: true
826
888
  });
827
889
  log(" running: npm install -D tsx dotenv @types/node...");
828
- spawnSync("npm", ["install", "-D", "tsx", "dotenv", "@types/node"], {
890
+ spawnSync("npm", [
891
+ "install",
892
+ "-D",
893
+ "tsx",
894
+ "dotenv",
895
+ "@types/node"
896
+ ], {
829
897
  cwd: root,
830
898
  stdio: "inherit",
831
899
  shell: true
832
900
  });
833
901
  }
902
+ __name(runNpmInstall, "runNpmInstall");
834
903
  async function runInit(opts) {
835
- const log = (msg) => console.log(msg);
904
+ const log = /* @__PURE__ */ __name((msg) => console.log(msg), "log");
836
905
  const cwd = process.cwd();
837
906
  const root = findRoot(cwd);
838
907
  if (!root) {
@@ -869,13 +938,19 @@ async function runInit(opts) {
869
938
  log(" 2. Run npm run migration:run then npm run seed (creates admin from ADMIN_EMAIL/ADMIN_PASSWORD)");
870
939
  log(" 3. npm run dev");
871
940
  }
941
+ __name(runInit, "runInit");
872
942
  var args = process.argv.slice(2);
873
943
  var force = args.includes("--force");
874
944
  var dryRun = args.includes("--dry-run");
875
945
  var noDeps = args.includes("--no-deps");
876
946
  var noPatchConfig = args.includes("--no-patch-config");
877
947
  if (args[0] === "init" || args.includes("--init") || args.length === 0 && !args.some((a) => a.startsWith("--"))) {
878
- runInit({ force, dryRun, noDeps, noPatchConfig }).catch((e) => {
948
+ runInit({
949
+ force,
950
+ dryRun,
951
+ noDeps,
952
+ noPatchConfig
953
+ }).catch((e) => {
879
954
  console.error(e);
880
955
  process.exit(1);
881
956
  });
@@ -883,4 +958,3 @@ if (args[0] === "init" || args.includes("--init") || args.length === 0 && !args.
883
958
  console.log("Usage: npx @infuro/cms-core init [--force] [--dry-run] [--no-deps] [--no-patch-config]");
884
959
  process.exit(args[0] === "--help" || args[0] === "-h" ? 0 : 1);
885
960
  }
886
- //# sourceMappingURL=cli.js.map
@@ -0,0 +1,5 @@
1
+ export { EmailService, emailPlugin, emailTemplates, renderEmail } from './chunk-J7XHLOLO.js';
2
+ export { renderLayout } from './chunk-ZQ4X6OAU.js';
3
+ export { getCompanyDetailsFromSettings, mergeEmailLayoutCompanyDetails, sendChatLeadEmail } from './chunk-XDSNZUW7.js';
4
+ export { queueEmail, queueOrderPlacedEmails, queueVendorOnboardEmails, registerEmailQueueProcessor } from './chunk-5ELSW2UP.js';
5
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var chunkTFUOHI37_cjs = require('./chunk-TFUOHI37.cjs');
4
+ var chunk46GKADYE_cjs = require('./chunk-46GKADYE.cjs');
5
+ var chunkPAMVINEX_cjs = require('./chunk-PAMVINEX.cjs');
6
+ var chunkXW5ATPRW_cjs = require('./chunk-XW5ATPRW.cjs');
7
+ require('./chunk-USNT2KNT.cjs');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "EmailService", {
12
+ enumerable: true,
13
+ get: function () { return chunkTFUOHI37_cjs.EmailService; }
14
+ });
15
+ Object.defineProperty(exports, "emailPlugin", {
16
+ enumerable: true,
17
+ get: function () { return chunkTFUOHI37_cjs.emailPlugin; }
18
+ });
19
+ Object.defineProperty(exports, "emailTemplates", {
20
+ enumerable: true,
21
+ get: function () { return chunkTFUOHI37_cjs.emailTemplates; }
22
+ });
23
+ Object.defineProperty(exports, "renderEmail", {
24
+ enumerable: true,
25
+ get: function () { return chunkTFUOHI37_cjs.renderEmail; }
26
+ });
27
+ Object.defineProperty(exports, "renderLayout", {
28
+ enumerable: true,
29
+ get: function () { return chunk46GKADYE_cjs.renderLayout; }
30
+ });
31
+ Object.defineProperty(exports, "getCompanyDetailsFromSettings", {
32
+ enumerable: true,
33
+ get: function () { return chunkPAMVINEX_cjs.getCompanyDetailsFromSettings; }
34
+ });
35
+ Object.defineProperty(exports, "mergeEmailLayoutCompanyDetails", {
36
+ enumerable: true,
37
+ get: function () { return chunkPAMVINEX_cjs.mergeEmailLayoutCompanyDetails; }
38
+ });
39
+ Object.defineProperty(exports, "sendChatLeadEmail", {
40
+ enumerable: true,
41
+ get: function () { return chunkPAMVINEX_cjs.sendChatLeadEmail; }
42
+ });
43
+ Object.defineProperty(exports, "queueEmail", {
44
+ enumerable: true,
45
+ get: function () { return chunkXW5ATPRW_cjs.queueEmail; }
46
+ });
47
+ Object.defineProperty(exports, "queueOrderPlacedEmails", {
48
+ enumerable: true,
49
+ get: function () { return chunkXW5ATPRW_cjs.queueOrderPlacedEmails; }
50
+ });
51
+ Object.defineProperty(exports, "queueVendorOnboardEmails", {
52
+ enumerable: true,
53
+ get: function () { return chunkXW5ATPRW_cjs.queueVendorOnboardEmails; }
54
+ });
55
+ Object.defineProperty(exports, "registerEmailQueueProcessor", {
56
+ enumerable: true,
57
+ get: function () { return chunkXW5ATPRW_cjs.registerEmailQueueProcessor; }
58
+ });
@@ -0,0 +1,2 @@
1
+ export { queueEmail, queueOrderPlacedEmails, queueVendorOnboardEmails, registerEmailQueueProcessor } from './chunk-5ELSW2UP.js';
2
+ import './chunk-SHUYVCID.js';