@hulkapps/app-manager-vue 3.1.18 → 3.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hulkapps/app-manager-vue",
3
- "version": "3.1.18",
3
+ "version": "3.1.20",
4
4
  "description": "Vue SDK to render app manager contents",
5
5
  "main": "dist/app-manager-vue.ssr.js",
6
6
  "browser": "dist/app-manager-vue.esm.js",
@@ -396,9 +396,7 @@ export default {
396
396
  if (this.discount_code !== null) {
397
397
  params['discount_code'] = this.discount_code;
398
398
  }
399
- if (window && window.APP_MANAGER_FRONTEND_SDK_VERSION !== undefined) {
400
- params['frontend_sdk_version'] = window.APP_MANAGER_FRONTEND_SDK_VERSION
401
- }
399
+ params['frontend_sdk_version'] = "3.1.20"
402
400
  let {data} = await axios.get(`${this.app_manager_config.baseUrl}/api/app-manager/plans`, {params: params}).catch(error => {
403
401
  console.error(error)
404
402
  });
@@ -97,33 +97,6 @@ export default {
97
97
  return planDetails;
98
98
  });
99
99
  },
100
- sortedPlanFeatures() {
101
- return (plan) => {
102
- const assignedFeatures = Object.keys(plan.features);
103
-
104
- return this.features
105
- .filter(feature =>
106
- assignedFeatures.includes(feature.uuid) && !feature.hidden_feature
107
- )
108
- .sort((a, b) => {
109
- // First check popularity field
110
- const popularityA = parseInt(a.popularity) || 999;
111
- const popularityB = parseInt(b.popularity) || 999;
112
-
113
- if (popularityA !== popularityB) {
114
- return popularityA - popularityB; // Lower popularity number first (1 is highest)
115
- }
116
-
117
- // If popularity is same or not present, use display_order
118
- return (parseInt(a.display_order) || 999) - (parseInt(b.display_order) || 999);
119
- })
120
- .slice(0, 4)
121
- .map(feature => ({
122
- ...feature,
123
- value: plan.features[feature.uuid].value || plan.features[feature.uuid]
124
- }));
125
- };
126
- },
127
100
  isMonthlyVisible() {
128
101
  return this.selectedInterval === "monthly";
129
102
  },
@@ -136,6 +109,49 @@ export default {
136
109
  isPlanNote,
137
110
  isPlanButtonDisabled,
138
111
  formatFeature,
112
+ normalizeSortOrder(value, fallback = 999) {
113
+ const normalized = Number(value);
114
+ return Number.isNaN(normalized) ? fallback : normalized;
115
+ },
116
+ getSortedPlanHighlights(plan) {
117
+ return Object.values(plan.highlights || {})
118
+ .sort((a, b) => this.normalizeSortOrder(a.sort_order) - this.normalizeSortOrder(b.sort_order))
119
+ .map((highlight) => ({
120
+ plan_id: highlight.plan_id,
121
+ feature_id: `highlight_${highlight.id}`,
122
+ uuid: `highlight_${highlight.id}`,
123
+ value: "1",
124
+ value_type: "boolean",
125
+ name: highlight.text,
126
+ format: null,
127
+ slug: `highlight_${highlight.id}`,
128
+ }));
129
+ },
130
+ getSortedPlanFeatures(plan) {
131
+ const assignedFeatureUuids = new Set(Object.keys(plan.features || {}));
132
+
133
+ return this.features
134
+ .filter((feature) => assignedFeatureUuids.has(feature.uuid) && !feature.hidden_feature)
135
+ .sort((a, b) => {
136
+ const popularityA = this.normalizeSortOrder(a.popularity);
137
+ const popularityB = this.normalizeSortOrder(b.popularity);
138
+
139
+ if (popularityA !== popularityB) {
140
+ return popularityA - popularityB;
141
+ }
142
+
143
+ return this.normalizeSortOrder(a.display_order) - this.normalizeSortOrder(b.display_order);
144
+ })
145
+ .map((feature) => ({
146
+ ...feature,
147
+ value: plan.features[feature.uuid]?.value ?? plan.features[feature.uuid],
148
+ }));
149
+ },
150
+ preparePlanFeatures(plan) {
151
+ const highlights = this.getSortedPlanHighlights(plan);
152
+ const features = this.getSortedPlanFeatures(plan);
153
+ return [...highlights, ...features].slice(0, 4);
154
+ },
139
155
  async handlePlanClick(plan) {
140
156
  this.loadingPlanId = plan.id;
141
157
  try {
@@ -471,7 +487,7 @@ export default {
471
487
  <ul>
472
488
  <li
473
489
  class="feature"
474
- v-for="feature in sortedPlanFeatures(plan)"
490
+ v-for="feature in preparePlanFeatures(plan)"
475
491
  :key="feature.uuid"
476
492
  >
477
493
  <svg
@@ -603,7 +619,7 @@ export default {
603
619
  <ul>
604
620
  <li
605
621
  class="feature"
606
- v-for="feature in sortedPlanFeatures(plan)"
622
+ v-for="feature in preparePlanFeatures(plan)"
607
623
  :key="feature.uuid"
608
624
  >
609
625
  <svg