Skip to content

Commit

Permalink
v6.3.0 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed Nov 3, 2022
1 parent 31bb82d commit 683f678
Show file tree
Hide file tree
Showing 56 changed files with 1,412 additions and 1,198 deletions.
9 changes: 9 additions & 0 deletions LabelStoreMax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [6.3.0] - 2022-11-03

* Ability to add Menu Links to the drawer widget through the WooSignal dashboard
* Fix wording when a shipping zone cannot be found to "Shipping is not supported for your location, sorry"
* Update account shipping widget to be uniform with the checkout shipping widget
* When logged in, the `CheckoutDetailsPage` will now populate shipping info from the users account
* Small refactor to resources/pages
* Pubspec.yaml dependency updates

## [6.2.0] - 2022-09-23

* Migration to use Nylo v3.4.0
Expand Down
2 changes: 1 addition & 1 deletion LabelStoreMax/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# WooCommerce App: Label StoreMax

### Label StoreMax - v6.2.0
### Label StoreMax - v6.3.0


[Official WooSignal WooCommerce App](https://woosignal.com)
Expand Down
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "Lösche deinen Account",
"Are you sure?": "Bist du dir sicher?",
"Yes, delete my account": "Ja, lösche mein Konto",
"Account deleted": "Konto gelöscht"
"Account deleted": "Konto gelöscht",
"Shipping is not supported for your location, sorry": "Der Versand wird für Ihren Standort nicht unterstützt, tut mir leid"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "Delete your account",
"Are you sure?": "Are you sure?",
"Yes, delete my account": "Yes, delete my account",
"Account deleted": "Account deleted"
"Account deleted": "Account deleted",
"Shipping is not supported for your location, sorry": "Shipping is not supported for your location, sorry"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "eliminar su cuenta",
"Are you sure?": "¿Está seguro?",
"Yes, delete my account": "Sí, eliminar mi cuenta",
"Account deleted": "Cuenta borrada"
"Account deleted": "Cuenta borrada",
"Shipping is not supported for your location, sorry": "El envío no es compatible para su ubicación, lo siento"
}
2 changes: 1 addition & 1 deletion LabelStoreMax/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,5 @@
"Are you sure?": "Êtes-vous sûr?",
"Yes, delete my account": "Oui, supprimer mon compte",
"Account deleted": "Compte supprimé",
"Phone Number": "Numéro de téléphone"
"Shipping is not supported for your location, sorry": "L'expédition n'est pas prise en charge pour votre emplacement, désolé"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "apane khaate ko nasht karo",
"Are you sure?": "kya aapako yakeen hai?",
"Yes, delete my account": "haan, mera akaunt dileet kar do",
"Account deleted": "khaata hataaya gaya"
"Account deleted": "khaata hataaya gaya",
"Shipping is not supported for your location, sorry": "aapake sthaan ke lie shiping samarthit nahin hai, kshama karen"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "cancella il tuo account",
"Are you sure?": "Sei sicuro?",
"Yes, delete my account": "Sì, elimina il mio account",
"Account deleted": "Account cancellato"
"Account deleted": "Account cancellato",
"Shipping is not supported for your location, sorry": "La spedizione non è supportata per la tua posizione, mi dispiace"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "Verwijder je account",
"Are you sure?": "Weet je het zeker?",
"Yes, delete my account": "Ja, verwijder mijn account",
"Account deleted": "Account verwijderd"
"Account deleted": "Account verwijderd",
"Shipping is not supported for your location, sorry": "Verzending wordt niet ondersteund voor uw locatie, sorry"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "Deletar sua conta",
"Are you sure?": "Tem certeza?",
"Yes, delete my account": "Sim, excluir minha conta",
"Account deleted": "Conta excluída"
"Account deleted": "Conta excluída",
"Shipping is not supported for your location, sorry": "O envio não é suportado para a sua localização, desculpe"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "Hesabını sil",
"Are you sure?": "Emin misin?",
"Yes, delete my account": "Evet, hesabımı sil",
"Account deleted": "Hesap silindi"
"Account deleted": "Hesap silindi",
"Shipping is not supported for your location, sorry": "Bulunduğunuz yer için gönderim desteklenmiyor, üzgünüm"
}
3 changes: 2 additions & 1 deletion LabelStoreMax/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"Delete your account": "删除您的帐户",
"Are you sure?": "你确定吗?",
"Yes, delete my account": "是的,删除我的帐户",
"Account deleted": "帐号已删除"
"Account deleted": "帐号已删除",
"Shipping is not supported for your location, sorry": "您所在的位置不支持送货,抱歉"
}
33 changes: 33 additions & 0 deletions LabelStoreMax/lib/app/models/billing_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,41 @@ class BillingDetails {
CustomerAddress? shippingAddress;
bool? rememberDetails;

BillingDetails();

void initSession() {
billingAddress = CustomerAddress();
shippingAddress = CustomerAddress();
}

Map<String, String?> getShippingAddressStripe() => {
"name": shippingAddress?.nameFull(),
"line1": shippingAddress!.addressLine,
"city": shippingAddress!.city,
"postal_code": shippingAddress!.postalCode,
"country": (shippingAddress?.customerCountry?.name ?? "")
};

fromWpMeta(Map<String, String> data) async {
final Map<String, String> shippingDetailsWpMeta = <String, String>{},
billingDetailsWpMeta = <String, String>{};

shippingDetailsWpMeta.addEntries(data.entries
.where((element) => element.key.startsWith("shipping_"))
.map((shippingMeta) => MapEntry(
shippingMeta.key.replaceAll("shipping_", ""), shippingMeta.value)));
billingDetailsWpMeta.addEntries(data.entries
.where((element) => element.key.startsWith("billing_"))
.map((billingMeta) => MapEntry(
billingMeta.key.replaceAll("billing_", ""), billingMeta.value)));

CustomerAddress billingCustomerAddress = CustomerAddress();
await billingCustomerAddress.fromWpMetaData(billingDetailsWpMeta);

CustomerAddress shippingCustomerAddress = CustomerAddress();
await shippingCustomerAddress.fromWpMetaData(shippingDetailsWpMeta);

billingAddress = billingCustomerAddress;
shippingAddress = shippingCustomerAddress;
}
}
61 changes: 61 additions & 0 deletions LabelStoreMax/lib/app/models/customer_address.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import 'package:flutter_app/app/models/customer_country.dart';
import 'package:flutter_app/app/models/default_shipping.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:wp_json_api/models/wp_meta_meta.dart';

class CustomerAddress {
String? firstName;
Expand Down Expand Up @@ -114,4 +117,62 @@ class CustomerAddress {
}
return data;
}

fromWpMetaData(Map<String, dynamic> data) async {
if (data.containsKey('first_name')) {
firstName = data['first_name'];
}

if (data.containsKey('last_name')) {
lastName = data['last_name'];
}

if (data.containsKey('address_1')) {
addressLine = data['address_1'];
}

if (data.containsKey('city')) {
city = data['city'];
}

if (data.containsKey('postcode')) {
postalCode = data['postcode'];
}

if (data.containsKey('email')) {
emailAddress = data['email'];
}

if (data.containsKey('phone')) {
phoneNumber = data['phone'];
}

if (data.containsKey('country')) {
DefaultShipping? defaultShipping =
await findCountryMetaForShipping(data['country']);
if (defaultShipping == null) {
return;
}
customerCountry = CustomerCountry.fromWpMeta(data, defaultShipping);
}
}

List<UserMetaDataItem> toUserMetaDataItem(String type) {
return [
UserMetaDataItem(key: "${type}_first_name", value: firstName),
UserMetaDataItem(key: "${type}_last_name", value: lastName),
UserMetaDataItem(key: "${type}_address_1", value: addressLine),
UserMetaDataItem(key: "${type}_city", value: city),
UserMetaDataItem(key: "${type}_postcode", value: postalCode),
UserMetaDataItem(key: "${type}_phone", value: phoneNumber),
if (type != "shipping")
UserMetaDataItem(key: "${type}_email", value: emailAddress),
UserMetaDataItem(
key: "${type}_country", value: customerCountry?.countryCode),
UserMetaDataItem(
key: "${type}_state",
value: customerCountry?.state?.code
?.replaceAll("${customerCountry?.countryCode}:", "")),
];
}
}
9 changes: 9 additions & 0 deletions LabelStoreMax/lib/app/models/customer_country.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

import 'package:flutter_app/app/models/default_shipping.dart';
import 'package:flutter_app/bootstrap/helpers.dart';

class CustomerCountry {
String? countryCode;
Expand All @@ -26,6 +27,14 @@ class CustomerCountry {
}
}

CustomerCountry.fromWpMeta(
Map<String, dynamic> json, DefaultShipping defaultShipping) {
countryCode = json['country'];
name = defaultShipping.country;
state = findDefaultShippingStateByCode(
defaultShipping, "${json['country']}:${json['state']}");
}

CustomerCountry.fromJson(Map<String, dynamic>? json) {
if (json == null) {
return;
Expand Down
22 changes: 18 additions & 4 deletions LabelStoreMax/lib/app/providers/app_provider.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app/bootstrap/app_helper.dart';
Expand Down Expand Up @@ -37,8 +39,10 @@ class AppProvider implements NyProvider {
/// );
///
/// if (settings.authorizationStatus == AuthorizationStatus.authorized) {
/// String token = await messaging.getToken();
/// WooSignal.instance.setFcmToken(token);
/// String? token = await messaging.getToken();
/// if (token != null) {
/// WooSignal.instance.setFcmToken(token);
/// }
/// }
AppHelper.instance.appConfig = WooSignalApp();
Expand Down Expand Up @@ -70,10 +74,20 @@ class AppProvider implements NyProvider {
AppHelper.instance.appConfig = wooSignalApp;

if (wooSignalApp.wpLoginEnabled == 1) {
if (wooSignalApp.wpLoginBaseUrl == null) {
AppHelper.instance.appConfig?.wpLoginEnabled = 0;
log('Set your stores domain on WooSignal. Go to Features > WP Login and add your domain to "Store Base Url"');
}

if (wooSignalApp.wpLoginWpApiPath == null) {
AppHelper.instance.appConfig?.wpLoginEnabled = 0;
log('Set your stores Wp JSON path on WooSignal. Go to Features > WP Login and add your Wp JSON path to "WP API Path"');
}

WPJsonAPI.instance.initWith(
baseUrl: wooSignalApp.wpLoginBaseUrl!,
baseUrl: wooSignalApp.wpLoginBaseUrl ?? "",
shouldDebug: getEnv('APP_DEBUG'),
wpJsonPath: wooSignalApp.wpLoginWpApiPath!,
wpJsonPath: wooSignalApp.wpLoginWpApiPath ?? "",
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_app/bootstrap/data/order_wc.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation_page.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_app/bootstrap/data/order_wc.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation_page.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
import 'package:woosignal/models/response/order.dart';
Expand All @@ -29,8 +29,16 @@ import 'package:woosignal/models/response/tax_rate.dart';
//
// });

// REMEMBER TO ADD THIS METHOD E.G. "examplePay" TO THE APP_PAYMENT_METHODS
// AS THE PAY METHOD
// TO USE A PAYMENT GATEWAY, FIRST OPEN /config/payment_gateways.dart.
// THEN ADD A NEW PAYMENT LIKE IN THE BELOW EXAMPLE
//
// addPayment(
// id: 6,
// name: "My Payment",
// description: trans("Debit or Credit Card"),
// assetImage: "payment_logo.png", E.g. /public/assets/images/payment_logo.png
// pay: examplePay,
// ),

examplePay(context,
{required CheckoutConfirmationPageState state, TaxRate? taxRate}) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_app/app/models/cart_line_item.dart';
import 'package:flutter_app/bootstrap/data/order_wc.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation.dart';
import 'package:flutter_app/resources/pages/checkout_confirmation_page.dart';
import 'package:flutter_app/resources/widgets/checkout_paypal.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/payload/order_wc.dart';
Expand Down
Loading

0 comments on commit 683f678

Please sign in to comment.