@ikas/storefront-next 4.0.0-alpha.9 → 4.0.0-beta.10

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 (110) hide show
  1. package/build/api/getComponentDirs.d.ts +3 -0
  2. package/build/api/getComponentDirs.js +1 -0
  3. package/build/api/getTheme.d.ts +3 -0
  4. package/build/api/getTheme.js +1 -0
  5. package/{src/api/index.ts → build/api/index.d.ts} +11 -14
  6. package/build/api/index.js +1 -0
  7. package/build/api/middleware.d.ts +3 -0
  8. package/build/api/middleware.js +1 -0
  9. package/build/api/updateTheme.d.ts +9 -0
  10. package/build/api/updateTheme.js +1 -0
  11. package/build/api/uploadTheme.d.ts +3 -0
  12. package/build/api/uploadTheme.js +1 -0
  13. package/build/ext/tslib/tslib.es6.js +1 -0
  14. package/{src/index.ts → build/index.d.ts} +4 -4
  15. package/build/index.js +1 -0
  16. package/build/packages/cmd/build/ext/tslib/tslib.es6.js +1 -0
  17. package/build/packages/cmd/build/scripts/generators/api/index.js +1 -0
  18. package/build/packages/cmd/build/scripts/generators/api/info.js +1 -0
  19. package/build/packages/cmd/build/scripts/generators/components/index.js +1 -0
  20. package/build/packages/cmd/build/scripts/generators/pages/index.js +1 -0
  21. package/build/packages/cmd/build/scripts/generators/pages/info.js +1 -0
  22. package/build/packages/cmd/build/scripts/generators/theme/index.js +1 -0
  23. package/build/packages/cmd/build/scripts/generators/types/index.js +1 -0
  24. package/build/packages/cmd/build/utils/fs.js +1 -0
  25. package/build/packages/cmd/build/utils/helper.js +1 -0
  26. package/build/pages/404.d.ts +2 -0
  27. package/build/pages/404.js +1 -0
  28. package/build/pages/[slug]/index.d.ts +3 -0
  29. package/build/pages/_slug_/index.js +1 -0
  30. package/build/pages/account/addresses.d.ts +2 -0
  31. package/build/pages/account/addresses.js +1 -0
  32. package/build/pages/account/favorite-products.d.ts +2 -0
  33. package/build/pages/account/favorite-products.js +1 -0
  34. package/build/pages/account/forgot-password.d.ts +2 -0
  35. package/build/pages/account/forgot-password.js +1 -0
  36. package/build/pages/account/index.d.ts +2 -0
  37. package/build/pages/account/index.js +1 -0
  38. package/build/pages/account/login.d.ts +2 -0
  39. package/build/pages/account/login.js +1 -0
  40. package/build/pages/account/orders/[id].d.ts +2 -0
  41. package/build/pages/account/orders/_id_.js +1 -0
  42. package/build/pages/account/orders/index.d.ts +2 -0
  43. package/build/pages/account/orders/index.js +1 -0
  44. package/build/pages/account/raffles.d.ts +2 -0
  45. package/build/pages/account/raffles.js +1 -0
  46. package/build/pages/account/recover-password.d.ts +2 -0
  47. package/build/pages/account/recover-password.js +1 -0
  48. package/build/pages/account/register.d.ts +2 -0
  49. package/build/pages/account/register.js +1 -0
  50. package/build/pages/blog/[slug].d.ts +3 -0
  51. package/build/pages/blog/_slug_.js +1 -0
  52. package/build/pages/blog/index.d.ts +2 -0
  53. package/build/pages/blog/index.js +1 -0
  54. package/build/pages/cart.d.ts +2 -0
  55. package/build/pages/cart.js +1 -0
  56. package/build/pages/checkout.d.ts +2 -0
  57. package/build/pages/checkout.js +1 -0
  58. package/build/pages/editor.d.ts +2 -0
  59. package/build/pages/editor.js +1 -0
  60. package/build/pages/home.d.ts +2 -0
  61. package/build/pages/home.js +1 -0
  62. package/{src/pages/index.ts → build/pages/index.d.ts} +22 -22
  63. package/build/pages/pages/[slug].d.ts +3 -0
  64. package/build/pages/pages/_slug_.js +1 -0
  65. package/build/pages/raffle/[slug].d.ts +3 -0
  66. package/build/pages/raffle/_slug_.js +1 -0
  67. package/build/pages/raffle/index.d.ts +2 -0
  68. package/build/pages/raffle/index.js +1 -0
  69. package/build/pages/search.d.ts +2 -0
  70. package/build/pages/search.js +1 -0
  71. package/build/provider/page-data-next.d.ts +94 -0
  72. package/build/provider/page-data-next.js +1 -0
  73. package/build/utils/fs.d.ts +28 -0
  74. package/build/utils/fs.js +1 -0
  75. package/build/utils/google-fonts.d.ts +2 -0
  76. package/build/utils/google-fonts.js +1 -0
  77. package/build/utils/i18n.d.ts +9 -0
  78. package/build/utils/i18n.js +1 -0
  79. package/package.json +19 -18
  80. package/src/api/getComponentDirs.ts +0 -39
  81. package/src/api/getTheme.ts +0 -22
  82. package/src/api/middleware.ts +0 -24
  83. package/src/api/updateTheme.ts +0 -33
  84. package/src/api/uploadTheme.ts +0 -307
  85. package/src/pages/404.tsx +0 -18
  86. package/src/pages/[slug]/index.tsx +0 -18
  87. package/src/pages/account/addresses.tsx +0 -10
  88. package/src/pages/account/favorite-products.tsx +0 -10
  89. package/src/pages/account/forgot-password.tsx +0 -10
  90. package/src/pages/account/index.tsx +0 -10
  91. package/src/pages/account/login.tsx +0 -10
  92. package/src/pages/account/orders/[id].tsx +0 -10
  93. package/src/pages/account/orders/index.tsx +0 -10
  94. package/src/pages/account/raffles.tsx +0 -10
  95. package/src/pages/account/recover-password.tsx +0 -10
  96. package/src/pages/account/register.tsx +0 -10
  97. package/src/pages/blog/[slug].tsx +0 -17
  98. package/src/pages/blog/index.tsx +0 -10
  99. package/src/pages/cart.tsx +0 -10
  100. package/src/pages/checkout.tsx +0 -10
  101. package/src/pages/editor.tsx +0 -11
  102. package/src/pages/home.tsx +0 -10
  103. package/src/pages/pages/[slug].tsx +0 -72
  104. package/src/pages/raffle/[slug].tsx +0 -17
  105. package/src/pages/raffle/index.tsx +0 -10
  106. package/src/pages/search.tsx +0 -10
  107. package/src/provider/page-data-next.ts +0 -618
  108. package/src/utils/fs.ts +0 -93
  109. package/src/utils/google-fonts.ts +0 -52
  110. package/src/utils/i18n.ts +0 -80
@@ -1,52 +0,0 @@
1
- import { IkasThemeJsonFontFamily } from "@ikas/storefront-models";
2
-
3
- export const getGoogleFontHref = (fontFamily: IkasThemeJsonFontFamily) => {
4
- if (!fontFamily.name) return;
5
-
6
- const fontName = fontFamily.name.replace(/ /g, "+");
7
- let fontVariants = "";
8
-
9
- if (fontFamily.variants) {
10
- fontVariants += ":";
11
- const isItalic = fontFamily.variants.some(
12
- (variant) => variant === "italic"
13
- );
14
- if (isItalic) {
15
- fontVariants += "ital,";
16
- }
17
-
18
- fontVariants += "wght@";
19
-
20
- if (isItalic) {
21
- const search = "italic";
22
- const checkItalic = new RegExp(search, "i");
23
- fontVariants += fontFamily.variants.reduce((str, variant) => {
24
- if (!checkItalic.test(variant)) {
25
- return str + `0,${variant.replace("regular", "400")};`;
26
- } else {
27
- return str;
28
- }
29
- }, "");
30
-
31
- fontVariants += fontFamily.variants.reduce((str, variant) => {
32
- if (checkItalic.test(variant)) {
33
- return (
34
- str +
35
- `1,${variant === "italic" ? "400" : variant.replace("italic", "")};`
36
- );
37
- } else {
38
- return str;
39
- }
40
- }, "");
41
- } else {
42
- fontVariants += fontFamily.variants.reduce((str, variant) => {
43
- return str + `${variant.replace("regular", "400")};`;
44
- }, "");
45
- }
46
-
47
- fontVariants = fontVariants.substring(0, fontVariants.length - 1);
48
- fontVariants += "&display=swap";
49
- }
50
-
51
- return `https://fonts.googleapis.com/css2?family=${fontName}${fontVariants}`;
52
- };
package/src/utils/i18n.ts DELETED
@@ -1,80 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
-
4
- export const CHECKOUT_TRANSLATION_NAMESPACE = "checkout-page";
5
-
6
- export class I18NFileReader {
7
- locale: string;
8
- namespaces: string[];
9
- localePath?: string;
10
-
11
- constructor(locale: string, namespaces: string[], localePath?: string) {
12
- this.locale = locale;
13
- this.namespaces = namespaces;
14
- this.localePath = localePath;
15
- }
16
-
17
- async read(): Promise<Record<string, any>> {
18
- const translations: Record<string, any> = {};
19
-
20
- for (const namespace of this.namespaces) {
21
- try {
22
- const filePath = this.localePath
23
- ? path.join(this.localePath, this.locale, namespace + ".json")
24
- : path.join(
25
- process.cwd(),
26
- "public",
27
- "locales",
28
- this.locale,
29
- namespace + ".json"
30
- );
31
- const fileExists = fs.existsSync(filePath);
32
-
33
- if (fileExists) {
34
- const localeTranslation = await this.readLocaleFile(filePath);
35
- translations[namespace] = localeTranslation;
36
- } else if (namespace === CHECKOUT_TRANSLATION_NAMESPACE) {
37
- let checkoutTranslation: Record<string, any> = {};
38
-
39
- if (this.locale === "tr") {
40
- const imported = await import(
41
- //@ts-ignore
42
- "@ikas/storefront-assets/checkout/tr.js"
43
- );
44
- checkoutTranslation = imported.default;
45
- } else {
46
- const imported = await import(
47
- //@ts-ignore
48
- "@ikas/storefront-assets/checkout/en.js"
49
- );
50
- checkoutTranslation = imported.default;
51
- }
52
-
53
- translations[namespace] = checkoutTranslation;
54
- }
55
- } catch (err) {
56
- console.error(err);
57
- }
58
- }
59
-
60
- return translations;
61
- }
62
-
63
- private async readLocaleFile(filePath: string): Promise<Record<string, any>> {
64
- return new Promise((resolve, reject) => {
65
- fs.readFile(
66
- filePath,
67
- {
68
- flag: "r",
69
- },
70
- function (err, file) {
71
- if (err) {
72
- return reject(err);
73
- }
74
- const result = file.length ? JSON.parse(file.toString()) : {};
75
- resolve(result);
76
- }
77
- );
78
- });
79
- }
80
- }