@hulkapps/app-manager-vue 3.1.19 → 3.1.21

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.19",
3
+ "version": "3.1.21",
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,7 +396,7 @@ export default {
396
396
  if (this.discount_code !== null) {
397
397
  params['discount_code'] = this.discount_code;
398
398
  }
399
- params['frontend_sdk_version'] = "3.1.19"
399
+ params['frontend_sdk_version'] = "3.1.21"
400
400
  let {data} = await axios.get(`${this.app_manager_config.baseUrl}/api/app-manager/plans`, {params: params}).catch(error => {
401
401
  console.error(error)
402
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,54 @@ 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
+ const assignedFeature = plan.features[feature.uuid];
147
+ return {
148
+ ...feature,
149
+ value: assignedFeature && assignedFeature.value !== undefined
150
+ ? assignedFeature.value
151
+ : assignedFeature,
152
+ };
153
+ });
154
+ },
155
+ preparePlanFeatures(plan) {
156
+ const highlights = this.getSortedPlanHighlights(plan);
157
+ const features = this.getSortedPlanFeatures(plan);
158
+ return [...highlights, ...features].slice(0, 4);
159
+ },
139
160
  async handlePlanClick(plan) {
140
161
  this.loadingPlanId = plan.id;
141
162
  try {
@@ -471,7 +492,7 @@ export default {
471
492
  <ul>
472
493
  <li
473
494
  class="feature"
474
- v-for="feature in sortedPlanFeatures(plan)"
495
+ v-for="feature in preparePlanFeatures(plan)"
475
496
  :key="feature.uuid"
476
497
  >
477
498
  <svg
@@ -603,7 +624,7 @@ export default {
603
624
  <ul>
604
625
  <li
605
626
  class="feature"
606
- v-for="feature in sortedPlanFeatures(plan)"
627
+ v-for="feature in preparePlanFeatures(plan)"
607
628
  :key="feature.uuid"
608
629
  >
609
630
  <svg